diff options
Diffstat (limited to 'build_common/android/compatibility/c_compat.c')
-rw-r--r-- | build_common/android/compatibility/c_compat.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/build_common/android/compatibility/c_compat.c b/build_common/android/compatibility/c_compat.c new file mode 100644 index 000000000..000428a77 --- /dev/null +++ b/build_common/android/compatibility/c_compat.c @@ -0,0 +1,60 @@ +#include <stdlib.h> + +/* from stdlib.h */ +float strtof(const char *nptr, char **endptr) +{ + return (float)strtod(nptr, endptr); +} + +double atof(const char *nptr) +{ + return strtod(nptr, NULL); +} + +int abs(int __n) +{ + return (__n < 0) ? -__n : __n; +} + +long labs(long __n) +{ + return (__n < 0L) ? -__n : __n; +} + +long long llabs(long long __n) +{ + return (__n < 0LL) ? -__n : __n; +} + +int rand(void) +{ + return (int)lrand48(); +} + +void srand(unsigned int __s) +{ + srand48(__s); +} + +long random(void) +{ + return lrand48(); +} + +void srandom(unsigned int __s) +{ + srand48(__s); +} + +/* from unistd.h */ +int getpagesize(void) +{ + extern unsigned int __page_size; + return __page_size; +} + +int __getpageshift(void) +{ + extern unsigned int __page_shift; + return __page_shift; +} |