From 7546e24c7e8b00bbc1c0c9af42e5cfa785a6613d Mon Sep 17 00:00:00 2001
From: Kia <kia@special-circumstanc.es>
Date: Thu, 14 Oct 2021 16:59:26 -0700
Subject: [PATCH] print the byte index along with the character set

---
 gen_intrange.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/gen_intrange.c b/gen_intrange.c
index ae82fde..01e8cc4 100644
--- a/gen_intrange.c
+++ b/gen_intrange.c
@@ -28,7 +28,7 @@ struct charset * new_charset(void) {
 }
 
 void print_charset(struct charset *cs, int depth) {
-    printf("current byte index = %d    ", depth);
+	printf("current byte index = %d    \n", depth);
     for (int i = 0; i<32; i++)
     	{
     		printf("%hhx ",cs->bitmap[i]);
@@ -103,8 +103,9 @@ void gen_int_range(uint64_t low, uint64_t high, uint8_t bytes, uint8_t starting_
       charset_set(cs, i, 1);
     }
     printf("current byte index = %d    ", current_byte_index);
+    print_charset(cs, current_byte_index);
     current_byte_index++;
-    print_charset(cs);
+
   }
   else if (1 < bytes) {
     uint8_t low_head, hi_head;
@@ -119,9 +120,10 @@ void gen_int_range(uint64_t low, uint64_t high, uint8_t bytes, uint8_t starting_
 	current_byte_index = starting_byte_index;
 	{
     printf("current byte index = %d    ", current_byte_index);
+
+	  HCFS_ADD_CHAR(low_head, current_byte_index);
 		current_byte_index++;
 
-	  HCFS_ADD_CHAR(low_head);
 	  gen_int_range(low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1, current_byte_index);
 	} 
 	HCFS_END_SEQ();
@@ -137,14 +139,16 @@ void gen_int_range(uint64_t low, uint64_t high, uint8_t bytes, uint8_t starting_
 	    charset_set(rest, i, 1);
 	  }
     printf("current byte index = %d    ", current_byte_index);
+
+	  HCFS_ADD_CHARSET(hd, current_byte_index);
 		current_byte_index++;
 
-	  HCFS_ADD_CHARSET(hd);
 	  for (int i = 2; i <= bytes; i++) {
     printf("current byte index = %d    ", current_byte_index);
+
+	    HCFS_ADD_CHARSET(rest, current_byte_index);
   		current_byte_index++;
 
-	    HCFS_ADD_CHARSET(rest);
 	  }
 	}
 	HCFS_END_SEQ();
@@ -153,9 +157,10 @@ void gen_int_range(uint64_t low, uint64_t high, uint8_t bytes, uint8_t starting_
 	{
 		current_byte_index = starting_byte_index;
     printf("current byte index = %d    ", current_byte_index);
+
+	  HCFS_ADD_CHAR(hi_head, current_byte_index);
 		current_byte_index++;
 
-	  HCFS_ADD_CHAR(hi_head);
 	  gen_int_range(0, high & ((1 << (8 * (bytes - 1))) - 1), bytes-1, current_byte_index);
 	} 
 	HCFS_END_SEQ();
@@ -171,9 +176,10 @@ void gen_int_range(uint64_t low, uint64_t high, uint8_t bytes, uint8_t starting_
 		current_byte_index = starting_byte_index;
 
     printf("current byte index = %d    ", current_byte_index);
+
+	  HCFS_ADD_CHAR(low_head, current_byte_index);
 		current_byte_index++;
 
-	  HCFS_ADD_CHAR(low_head);
 	  gen_int_range(
 			low & ((1 << (8 * (bytes - 1))) - 1),
 			high & ((1 << (8 * (bytes - 1))) - 1),
-- 
GitLab