|
| 1 | +/* |
| 2 | + Check whether stdckdint.h functionality is available. |
| 3 | + If it's available, then 'have_stdckdint.exe' will be created |
| 4 | + by config_sh.PL. |
| 5 | + $Config{i_stdckdint} and the XS symbol I_STDCKDINT will be |
| 6 | + defined if and only if 'have_stdckdint.exe' prints '0' |
| 7 | + when executed. |
| 8 | + Else $Config{i_stdckdint} and I_STDCKDINT will be undef. |
| 9 | +*/ |
| 10 | + |
| 11 | +#include <stdio.h> |
| 12 | +#include <stdckdint.h> |
| 13 | +int func_l(long *resultptr, long a, long b) { |
| 14 | + return (ckd_add(resultptr, a, b) || |
| 15 | + ckd_sub(resultptr, a, b) || |
| 16 | + ckd_mul(resultptr, a, b)) ? 1 : 0; |
| 17 | +} |
| 18 | + |
| 19 | +int func_ll(long long *resultptr, long long a, long long b) { |
| 20 | + return (ckd_add(resultptr, a, b) || |
| 21 | + ckd_sub(resultptr, a, b) || |
| 22 | + ckd_mul(resultptr, a, b)) ? 1 : 0; |
| 23 | +} |
| 24 | + |
| 25 | +int main(int argc, char **argv) { |
| 26 | + long lresult_1, lresult_2; |
| 27 | + long long llresult_1, llresult_2; |
| 28 | + int ret, lret_1, lret_2, llret_1, llret_2; |
| 29 | + lret_1 = func_l(&lresult_1, 42L, 53L); |
| 30 | + lret_2 = func_l(&lresult_2, 10485777L, 1048555L); |
| 31 | + llret_1 = func_ll(&llresult_1, 42LL, 53LL); |
| 32 | + llret_2 = func_ll(&llresult_2, 34359738333LL, 34359738887LL); |
| 33 | + |
| 34 | + if(lret_1 == 0 && llret_1 == 0 && |
| 35 | + lret_2 == 1 && llret_2 == 1 && |
| 36 | + lresult_1 == 2226L && llresult_1 == 2226LL && |
| 37 | + lresult_2 == -202375525L && llresult_2 == 16630113351947LL ) ret = 0; |
| 38 | + else ret = -1; |
| 39 | + printf("%d", ret); |
| 40 | + return 0; |
| 41 | +} |
| 42 | + |
0 commit comments