X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=scripts%2Fgen_calc_unary.php;fp=scripts%2Fgen_calc_unary.php;h=ef20720c75f4919547da7bad586a6916ad4b9363;hp=0000000000000000000000000000000000000000;hb=c9384515a81cb64d345b299908b2852f51bb8e6e;hpb=b029005e56a8913fbb3d17ab497b4a37a00a211c diff --git a/scripts/gen_calc_unary.php b/scripts/gen_calc_unary.php new file mode 100644 index 0000000..ef20720 --- /dev/null +++ b/scripts/gen_calc_unary.php @@ -0,0 +1,93 @@ + + +static inline token_t psi_calc_minus(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res) +{ + (void) t2; + (void) v2; + + switch (t1) { + $v1) : ?> + + +#if HAVE_ + + + case PSI_T_: + res-> = -v1->; + break; + + +#endif + + + + default: + assert(0); + break; + } + return t1; +} + + +static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res) +{ + (void) t2; + (void) v2; + + switch (t1) { + $v1) : ?> + + +#if HAVE_ + + + case PSI_T_: + res->u8 = !v1->; + break; + + +#endif + + + + default: + assert(0); + break; + } + return PSI_T_UINT8; +} + + +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