inline ExecStatus Eqv<BVA,BVB,BVC>::post(Home home, BVA b0, BVB b1, BVC b2){ switch (bool_test(b0,b1)) { case BT_SAME: GECODE_ME_CHECK(b2.one(home)); break; case BT_COMP: GECODE_ME_CHECK(b2.zero(home)); break; case BT_NONE: if (b2.one()) return Eq<BVA,BVB>::post(home,b0,b1); if (b0.one()) { if (b1.one()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } } if (b0.zero()) { if (b1.one()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } } (void) new (home) Eqv(home,b0,b1,b2); break; default: GECODE_NEVER; } return ES_OK; }
int main (int argc, char* argv[]) { int32_t i = 2; uint8_t j = 3; bool t = i < j; bool f = i > j; printf("\n"); printf("i:%d, j:%d, i<j:%d, i>j:%d, true:%d, false:%d.\n", i, j, t, f, true, false); printf("\n"); bool_test(); printf("\n"); int8_t_test(); int16_t_test(); int32_t_test(); int64_t_test(); printf("\n"); uint8_t_test(); uint16_t_test(); uint32_t_test(); uint64_t_test(); printf("\n"); return 0; }
inline ExecStatus QXor<BVA,BVB>::post(Home home, BVA b0, TQuantifier _q0, int _r0, BVB b1, TQuantifier _q1, int _r1) { switch (bool_test(b0,b1)) { case BT_SAME: return ES_FAILED; case BT_COMP: return ES_OK; case BT_NONE: if ( ((_q0 == FORALL) && (_q1 == FORALL)) || ((_r0 < _r1) && (_q1 == FORALL)) || ((_r0 > _r1) && (_q0 == FORALL)) ) return ES_FAILED; if (b0.zero()) { if (_q1 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b1.one(home)); } else if (b0.one()) { if (_q1 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b1.zero(home)); } else if (b1.zero()) { if (_q0 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b0.one(home)); } else if (b1.one()) { if (_q0 == FORALL) return ES_FAILED; GECODE_ME_CHECK(b0.zero(home)); } else { (void) new (home) QXor<BVA,BVB>(home,b0,_q0,_r0,b1,_q1,_r1); } break; default: GECODE_NEVER; } return ES_OK; }
int main() { unsigned int seed = time(NULL); srand(seed); srandom(seed); LTRandomGenerator r((int)seed); int_test(&r, 1); int_test(&r, 2); int_test(&r, 3); int_test(&r, 4); int_test(&r, 5); int_test(&r, 6); int_test(&r, 7); int_test(&r, 8); int_test(&r, 9); int_test(&r, 10); int_test(&r, 20); int_test(&r, 30); bool_test(&r); if (ltRandomQuickCheck()) { printf("Quick check passed\n"); } else { printf("Quick check FAILED\n"); } rand_color_image(&r, 281, 281, "randimage1.png"); rand_bw_image(&r, 256, 256, "randimage2.png"); rand_color_image(&r, 512, 512, "randimage3.png"); rand_bw_image(&r, 64, 64, "randimage4.png"); rand_scatter_image(&r, 500, 500, "scatterimage1.png"); rand_scatter_image(&r, 281, 281, "scatterimage2.png"); rand_scatter_image(&r, 256, 256, "scatterimage3.png"); rand_scatter_image(&r, 128, 128, "scatterimage4.png"); rand_scatter_image(&r, 64, 64, "scatterimage5.png"); return 0; }
int main(int argc, char **argv) { string_test(); printf("1111111111111\n"); expr_test(); printf("1111111111111\n"); macro_test(); scope_test(); forward_test(); funcptr_test(); loop_test(); switch_test(); goto_test(); enum_test(); typedef_test(); struct_test(); array_test(); expr_ptr_test(); bool_test(); expr2_test(); constant_expr_test(); expr_cmp_test(); char_short_test(); init_test(); compound_literal_test(); kr_test(); struct_assign_test(); cast_test(); bitfield_test(); c99_bool_test(); float_test(); longlong_test(); manyarg_test(); stdarg_test(); whitespace_test(); relocation_test(); old_style_function(); alloca_test(); sizeof_test(); typeof_test(); statement_expr_test(); local_label_test(); asm_test(); builtin_test(); return 0; }
inline ExecStatus QEqv<BVA,BVB,BVC>::post(Home home, BVA b0, TQuantifier _q0, int _r0, BVB b1, TQuantifier _q1, int _r1, BVC b2) { switch (bool_test(b0,b1)) { case BT_SAME: GECODE_ME_CHECK(b2.one(home)); break; case BT_COMP: GECODE_ME_CHECK(b2.zero(home)); break; case BT_NONE: if ( ((_q0 == FORALL) && (_q1 == FORALL)) || ((_r0 < _r1) && (_q1 == FORALL)) || ((_r0 > _r1) && (_q0 == FORALL)) ) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } if (b2.one()) return QEq<BVA,BVB>::post(home,b0,_q0,_r0,b1,_q1,_r1); if (b2.zero()) return QXor<BVA,BVB>::post(home,b0,_q0,_r0,b1,_q1,_r1); if (b0.one()) { if (b1.one()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } } if (b0.zero()) { if (b1.one()) { GECODE_ME_CHECK(b2.zero(home)); return ES_OK; } else if (b1.zero()) { GECODE_ME_CHECK(b2.one(home)); return ES_OK; } } (void) new (home) QEqv(home,b0,_q0,_r0,b1,_q1,_r1,b2); break; default: GECODE_NEVER; } return ES_OK; }