typedef long long int ll_t;
-#ifndef _WIN32
+#ifdef __GNUC__
ll_t mul_ll(ll_t a, ll_t b) __attribute__((noinline));
ll_t shl_ll(ll_t a, ll_t b) __attribute__((noinline));
ll_t shr_ll(ll_t a, ll_t b) __attribute__((noinline));
return llabs(a);
}
+#if 0
double conv_ll_d(ll_t a) {
return (double)a;
}
ll_t conv_d_ll(double a) {
return (ll_t)a;
}
+#endif
int main(void) {
ll_t a = 0xff;
printf("%lld * %lld = %lld\n", a, b, mul_ll(a, b));
printf("%lld + %lld = %lld\n", a, b, add_ll(a, b));
printf("%lld - %lld = %lld\n", a, b, sub_ll(a, b));
- printf("%lld / %lld = %lld\n", a, b, div_ll(a, b));
- printf("%lld % %lld = %lld\n", a, b, mod_ll(a, b));
- printf("%lld / + % %lld = %lld\n", a, b, divmod_ll(a, b));
- printf("%lld << %lld = %lld\n", a, 2, shl_ll(a, 2));
- printf("%lld >> %lld = %lld\n", a, 2, shr_ll(a, 2));
+ printf("%lld / %lld = %lld\n", b, a, div_ll(b, a));
+ printf("%lld %% %lld = %lld\n", b, a, mod_ll(b, a));
+ printf("%lld / + %% %lld = %lld\n", b, a, divmod_ll(b, a));
+ printf("%lld << %d = %lld\n", a, 2, shl_ll(a, 2));
+ printf("%lld >> %d = %lld\n", a, 2, shr_ll(a, 2));
printf("abs(%lld) = %lld\n", c, abs_ll(c));
printf("neg(%lld) = %lld\n", b, neg_ll(b));
+#if 0
printf("conv(%lld) = %lf\n", c, conv_ll_d(c));
printf("conv(%lf) = %lld\n", d, conv_d_ll(d));
-
+#endif
return 0;
}