diff options
| author | Ray <[email protected]> | 2020-02-04 16:55:24 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-02-04 16:55:24 +0100 |
| commit | b5fe41f41a88f3763d02db4f2dfa7e13617e9fc3 (patch) | |
| tree | 71b8e53a39cdc8c9a85bb1a2569d3685070d2591 /src/gestures.h | |
| parent | 3cd9e3896aa6d3cf04ac919f03e51f2b60502906 (diff) | |
| download | raylib-b5fe41f41a88f3763d02db4f2dfa7e13617e9fc3.tar.gz raylib-b5fe41f41a88f3763d02db4f2dfa7e13617e9fc3.zip | |
Review libc dependencies and remove when possible
Just for clarification, no plans to remove libc dependency, just did some code analysis to see how much raylib depend on stardard C library. My conclusions:
- stdlib.h: primary dependency is for malloc() and free()
- stdio.h: primary dependency is for FILE access, maybe it could go through a custom ABI?
- string.h: just around 8 functions required
- math.h: just around 8 functions required
- others: 1-2 functions required for some other headers
Diffstat (limited to 'src/gestures.h')
| -rw-r--r-- | src/gestures.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gestures.h b/src/gestures.h index 07de3137..911cd604 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -152,8 +152,7 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang #include <sys/time.h> // Required for: timespec #include <time.h> // Required for: clock_gettime() - #include <math.h> // Required for: atan2(), sqrt() - #include <stdint.h> // Required for: uint64_t + #include <math.h> // Required for: sqrtf(), atan2f() #endif #if defined(__APPLE__) // macOS also defines __MACH__ @@ -533,7 +532,7 @@ static double GetCurrentTime(void) // NOTE: Only for Linux-based systems struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - uint64_t nowTime = (uint64_t)now.tv_sec*1000000000LLU + (uint64_t)now.tv_nsec; // Time in nanoseconds + (unsigned long long int) nowTime = ((unsigned long long int))now.tv_sec*1000000000LLU + ((unsigned long long int))now.tv_nsec; // Time in nanoseconds time = ((double)nowTime/1000000.0); // Time in miliseconds #endif @@ -549,7 +548,7 @@ static double GetCurrentTime(void) // NOTE: OS X does not have clock_gettime(), using clock_get_time() clock_get_time(cclock, &now); mach_port_deallocate(mach_task_self(), cclock); - uint64_t nowTime = (uint64_t)now.tv_sec*1000000000LLU + (uint64_t)now.tv_nsec; // Time in nanoseconds + (unsigned long long int) nowTime = ((unsigned long long int))now.tv_sec*1000000000LLU + ((unsigned long long int))now.tv_nsec; // Time in nanoseconds time = ((double)nowTime/1000000.0); // Time in miliseconds #endif |
