/* * Test: check whether b is present in the table * if not add it */ static void test_buffer64(bvexp_table_t *table, bvarith64_buffer_t *b) { bvmlist64_t *p; thvar_t x; uint32_t h, n; printf("=== test64 ===\n"); n = b->bitsize; printf("poly = "); print_bvexp64(stdout, b->list, n); printf("\n"); h = hash_bvmlist64(b->list, n); printf("hash code = %"PRIu32"\n", h); x = bvexp_table_find64(table, b, h); if (x < 0) { printf("not in table\n"); x = make_bvvar(table->vtbl, n); bvexp_table_add64(table, x, b, h); printf("adding variable: "); print_def(stdout, table, x); } else { printf("found matching variable: "); print_def(stdout, table, x); p = bvexp_def64(table, x); if (p == NULL || !equal_bvmlists64(b->list, p) || bvvar_bitsize(table->vtbl, x) != n) { printf("BUG\n"); exit(1); } } printf("\n"); }
/* * Equality test */ static bool eq_hash_bvexp_hobj(bvexp_hobj_t *o, thvar_t i) { bvexp_table_t *table; uint32_t n; bool result; table = o->table; assert(0 <= i && i < table->nvars && table->def[i] != NULL); n = o->bitsize; result = false; if (bvvar_bitsize(table->vtbl, i) == n) { if (n <= 64) { result = equal_bvmlists64(o->def, table->def[i]); } else { result = equal_bvmlists(o->def, table->def[i], n); } } return result; }