2 Extern implementation of Nit module math
7 #include "core__math._ffi.h"
9 #include <android/log.h>
10 #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, "Nit", __VA_ARGS__)
12 #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)
14 #line 24 "../lib/core/math.nit"
17 /* Is rand shortcut? */
18 static int nit_rand_seeded
;
19 /* Current rand seed if seeded */
20 static unsigned int nit_rand_seed
;
22 #define NIT_RAND_MAX 0x7fffffff
24 /* This algorithm is mentioned in the ISO C standard, here extended
28 unsigned int next
= nit_rand_seed
;
33 result
= (unsigned int) (next
/ 65536) % 2048;
38 result
^= (unsigned int) (next
/ 65536) % 1024;
43 result
^= (unsigned int) (next
/ 65536) % 1024;
49 int core__math___Float_is_nan___impl( double self
)
51 #line 312 "../lib/core/math.nit"
54 int core__math___Float_native_is_inf___impl( double self
)
56 #line 334 "../lib/core/math.nit"
59 void core__math___Sys_srand___impl( Sys self
)
61 #line 573 "../lib/core/math.nit"
63 nit_rand_seeded
= 0; srand((unsigned int)time(NULL
)); }
64 void core__math___Sys_srand_from___impl( Sys self
, long x
)
66 #line 568 "../lib/core/math.nit"
68 nit_rand_seeded
= 1; nit_rand_seed
= (unsigned int)x
; }