From 0c073e6ea16bb9f4986af0e044872f0cc4f68098 Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Fri, 30 Jul 2021 21:03:30 -0600 Subject: [PATCH] comment it out a bit --- src/parsers/int_range.c | 52 +++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/src/parsers/int_range.c b/src/parsers/int_range.c index 0e26065..4e275f2 100644 --- a/src/parsers/int_range.c +++ b/src/parsers/int_range.c @@ -40,17 +40,25 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high, } HCFS_ADD_CHARSET(cs); } + + + /* multi-byte integer range */ else if (1 < bytes) { uint8_t low_head, hi_head; - low_head = ((low >> (8*(bytes - 1))) & 0xFF); - hi_head = ((high >> (8*(bytes - 1))) & 0xFF); + low_head = ((low >> (8*(bytes - 1))) & 0xFF); /* most significant byte, low marker */ + hi_head = ((high >> (8*(bytes - 1))) & 0xFF); /* most significant byte, high marker */ + + if (low_head != hi_head) { HCFS_BEGIN_CHOICE() { - HCFS_BEGIN_SEQ() { + + HCFS_BEGIN_SEQ() { HCFS_ADD_CHAR(low_head); gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1); } HCFS_END_SEQ(); - HCFS_BEGIN_SEQ() { + + + HCFS_BEGIN_SEQ() { HCharset hd = new_charset(mm__); HCharset rest = new_charset(mm__); for (int i = 0; i < 256; i++) { @@ -61,12 +69,21 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high, for (int i = 2; i < bytes; i++) HCFS_ADD_CHARSET(rest); } HCFS_END_SEQ(); - HCFS_BEGIN_SEQ() { + + + HCFS_BEGIN_SEQ() { HCFS_ADD_CHAR(hi_head); gen_int_range(mm__, stk__, 0, high & ((1 << (8 * (bytes - 1))) - 1), bytes-1); } HCFS_END_SEQ(); + + } HCFS_END_CHOICE(); - } else { + } /* low_head != high_head */ + + + + else { /* low_head == high_head */ + // TODO: find a way to merge this with the higher-up SEQ HCFS_BEGIN_CHOICE() { HCFS_BEGIN_SEQ() { @@ -79,6 +96,9 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high, } HCFS_END_CHOICE(); } } + + + } struct bits_env { @@ -92,7 +112,25 @@ static void desugar_int_range(HAllocator *mm__, HCFStack *stk__, void *env) { uint8_t bytes = be->length / 8; printf("signedness of desired range: %d\n", r->signedp); - gen_int_range(mm__, stk__, r->lower, r->upper, bytes); + //if (r->signedp == 0) { + gen_int_range(mm__, stk__, r->lower, r->upper, bytes); + //} + + /*if (r->signedp == 1) { + HCFS_BEGIN_CHOICE() { + + HCFS_BEGIN_SEQ() { + gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1); + } HCFS_END_SEQ(); + + HCFS_BEGIN_SEQ() { + gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1); + } HCFS_END_SEQ(); + + + } HCFS_END_CHOICE() + + }*/ } bool h_svm_action_validate_int_range(HArena *arena, HSVMContext *ctx, void* env) { -- GitLab