X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=scripts%2Fgen_calc_bin.php;fp=scripts%2Fgen_calc_bin.php;h=c7dbf0188ee61663143a86d4e4f47ab32c6aa599;hp=0000000000000000000000000000000000000000;hb=52ed5940ed0ab3cafd36fbded2e83c92563e7b2b;hpb=acb84297d3ceeb57c97e0ac4da1881eba6aee18e diff --git a/scripts/gen_calc_bin.php b/scripts/gen_calc_bin.php new file mode 100644 index 0000000..c7dbf01 --- /dev/null +++ b/scripts/gen_calc_bin.php @@ -0,0 +1,98 @@ + "<<", + "rshift" => ">>", + "and" => "&", + "xor" => "^", + "or" => "|", +]; + +?> + + $op) : ?> + +static inline token_t psi_calc_bin_(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res) +{ + impl_val i1, i2; + + switch (t1) { + $v1) : ?> + + +#if HAVE_ + + + case PSI_T_: + i1.u64 = v1->; + break; + + +#endif + + + + default: + assert(0); + break; + } + + switch (t2) { + $v2) : ?> + + +#if HAVE_ + + + case PSI_T_: + i2.u64 = v2->; + break; + + + +#endif + + + default: + assert(0); + break; + } + + res->u64 = i1.u64 i2.u64; + return PSI_T_UINT64; +} + + +static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res) +{ + impl_val i1; + + (void) t2; + (void) v2; + + switch (t1) { + $v1) : ?> + + +#if HAVE_ + + + case PSI_T_: + i1.u64 = v1->; + break; + + +#endif + + + + default: + assert(0); + break; + } + + res->u64 = ~i1.u64; + return PSI_T_UINT64; +} \ No newline at end of file