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 math___Float_is_nan___impl( double self
)
51 #line 308 "../lib/core/math.nit"
54 long math___Int_band___impl( long self
, long i
)
56 #line 71 "../lib/core/math.nit"
59 long math___Int_bor___impl( long self
, long i
)
61 #line 78 "../lib/core/math.nit"
64 unsigned char math___Byte_band___impl( unsigned char self
, unsigned char i
)
66 #line 183 "../lib/core/math.nit"
69 int math___Float_native_is_inf___impl( double self
)
71 #line 330 "../lib/core/math.nit"
74 void math___Sys_srand___impl( Sys self
)
76 #line 558 "../lib/core/math.nit"
78 nit_rand_seeded
= 0; srand(time(NULL
)); }
79 void math___Sys_srand_from___impl( Sys self
, long x
)
81 #line 553 "../lib/core/math.nit"
83 nit_rand_seeded
= 1; nit_rand_seed
= x
; }