diff options
| author | 2016-05-21 00:53:05 +0100 | |
|---|---|---|
| committer | 2016-05-21 00:53:05 +0100 | |
| commit | 8d68c46340f826e8c042ab3496c20ed6c99ccd9b (patch) | |
| tree | 27acbd3e4ec8b607c1f0bd7b0ae904036a6a223d /gb_math.h | |
| parent | New file API and improved platform layer (diff) | |
Minor code layout changes
Diffstat (limited to 'gb_math.h')
| -rw-r--r-- | gb_math.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,8 +1,9 @@ -/* gb_math.h - v0.06c - public domain C math library - no warranty implied; use at your own risk +/* gb_math.h - v0.06d - public domain C math library - no warranty implied; use at your own risk A C math library geared towards game development use '#define GB_MATH_IMPLEMENTATION' before including to create the implementation in _ONE_ file Version History: + 0.06d - Bug fix 0.06c - Remove extra needed define for C++ and inline all operators 0.06b - Just formatting 0.06a - Implement rough versions of mod, remainder, copy_sign @@ -797,7 +798,7 @@ gb_copy_sign(float x, float y) ix &= 0x7fffffff; ix |= iy & 0x80000000; - return *(float *)ix; + return *(float *)&ix; } float @@ -1014,9 +1015,9 @@ float gb_fast_exp2(float x) { return gb_fast_exp(GB_MATH_LOG_TWO * x); } -float gb_round(float x) { return (x >= 0.0f) ? gb_floor(x + 0.5f) : gb_ceil(x - 0.5f); } -float gb_floor(float x) { return (x >= 0.0f) ? (int)x : (int)(x-0.9999999999999999f); } -float gb_ceil(float x) { return (x < 0) ? (int)x : ((int)x)+1; } +float gb_round(float x) { return (float)((x >= 0.0f) ? gb_floor(x + 0.5f) : gb_ceil(x - 0.5f)); } +float gb_floor(float x) { return (float)((x >= 0.0f) ? (int)x : (int)(x-0.9999999999999999f)); } +float gb_ceil(float x) { return (float)((x < 0) ? (int)x : ((int)x)+1); } |
