Skip to content
Snippets Groups Projects
Commit 0c073e6e authored by Kia's avatar Kia
Browse files

comment it out a bit

parent c740cc74
No related branches found
No related tags found
No related merge requests found
...@@ -40,17 +40,25 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high, ...@@ -40,17 +40,25 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
} }
HCFS_ADD_CHARSET(cs); HCFS_ADD_CHARSET(cs);
} }
/* multi-byte integer range */
else if (1 < bytes) { else if (1 < bytes) {
uint8_t low_head, hi_head; uint8_t low_head, hi_head;
low_head = ((low >> (8*(bytes - 1))) & 0xFF); low_head = ((low >> (8*(bytes - 1))) & 0xFF); /* most significant byte, low marker */
hi_head = ((high >> (8*(bytes - 1))) & 0xFF); hi_head = ((high >> (8*(bytes - 1))) & 0xFF); /* most significant byte, high marker */
if (low_head != hi_head) { if (low_head != hi_head) {
HCFS_BEGIN_CHOICE() { HCFS_BEGIN_CHOICE() {
HCFS_BEGIN_SEQ() {
HCFS_BEGIN_SEQ() {
HCFS_ADD_CHAR(low_head); HCFS_ADD_CHAR(low_head);
gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1); gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1);
} HCFS_END_SEQ(); } HCFS_END_SEQ();
HCFS_BEGIN_SEQ() {
HCFS_BEGIN_SEQ() {
HCharset hd = new_charset(mm__); HCharset hd = new_charset(mm__);
HCharset rest = new_charset(mm__); HCharset rest = new_charset(mm__);
for (int i = 0; i < 256; i++) { 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, ...@@ -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++) for (int i = 2; i < bytes; i++)
HCFS_ADD_CHARSET(rest); HCFS_ADD_CHARSET(rest);
} HCFS_END_SEQ(); } HCFS_END_SEQ();
HCFS_BEGIN_SEQ() {
HCFS_BEGIN_SEQ() {
HCFS_ADD_CHAR(hi_head); HCFS_ADD_CHAR(hi_head);
gen_int_range(mm__, stk__, 0, high & ((1 << (8 * (bytes - 1))) - 1), bytes-1); gen_int_range(mm__, stk__, 0, high & ((1 << (8 * (bytes - 1))) - 1), bytes-1);
} HCFS_END_SEQ(); } HCFS_END_SEQ();
} HCFS_END_CHOICE(); } 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 // TODO: find a way to merge this with the higher-up SEQ
HCFS_BEGIN_CHOICE() { HCFS_BEGIN_CHOICE() {
HCFS_BEGIN_SEQ() { HCFS_BEGIN_SEQ() {
...@@ -79,6 +96,9 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high, ...@@ -79,6 +96,9 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
} HCFS_END_CHOICE(); } HCFS_END_CHOICE();
} }
} }
} }
struct bits_env { struct bits_env {
...@@ -92,7 +112,25 @@ static void desugar_int_range(HAllocator *mm__, HCFStack *stk__, void *env) { ...@@ -92,7 +112,25 @@ static void desugar_int_range(HAllocator *mm__, HCFStack *stk__, void *env) {
uint8_t bytes = be->length / 8; uint8_t bytes = be->length / 8;
printf("signedness of desired range: %d\n", r->signedp); 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) { bool h_svm_action_validate_int_range(HArena *arena, HSVMContext *ctx, void* env) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment