aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar gingerBill 2016-04-08 23:12:26 +0100
committerGravatar gingerBill 2016-04-08 23:12:26 +0100
commit5116635d04cc0357f8e6d7a4e163a37acc516cdb (patch)
tree76846bbec39c1cea22b3f3005764e836a157b5e5
parentFix strict aliasing in gb_quake_inv_sqrt (diff)
Update gb_math.h
-rw-r--r--gb_math.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/gb_math.h b/gb_math.h
index 2ab2e96..a43d948 100644
--- a/gb_math.h
+++ b/gb_math.h
@@ -421,7 +421,7 @@ GB_MATH_DEF int gb_rect2_intersection_result(gbRect2 a, gbRect2 b, gbRect2 *inte
#define GB_MURMUR64_DEFAULT_SEED 0x9747b28c
#endif
// Hashing
-GB_MATH_DEF gb_math_u64 gb_hash_murmur64(void const *key, size_t num_bytes, u64 seed);
+GB_MATH_DEF gb_math_u64 gb_hash_murmur64(void const *key, size_t num_bytes, gb_math_u64 seed);
// Random
// TODO(bill): Use a generator for the random numbers
@@ -853,7 +853,8 @@ gb_float_to_half(float value)
if (e > 30) {
float volatile f = 1e12f;
- for (unsigned int j = 0; j < 10; j++)
+ unsigned int j;
+ for (j = 0; j < 10; j++)
f *= f; // NOTE(bill): Cause overflow
return (gb_half)(s | 0x7c00);
@@ -1709,7 +1710,7 @@ gb_quat_slerp_approx(gbQuat *d, gbQuat a, gbQuat b, float t)
// Even works okay for nearly anti-parallel versors!!!
// NOTE(bill): Extra interations cannot be used as they require angle^4 which is not worth it to approximate
float tp = t + (1.0f - gb_quat_dot(a, b))/3.0f * t*(-2.0f*t*t + 3.0f*t - 1.0f);
- return gb_quat_nlerp(d, a, b, tp);
+ gb_quat_nlerp(d, a, b, tp);
}
void
@@ -1816,7 +1817,7 @@ gb_rect2_intersection_result(gbRect2 a, gbRect2 b, gbRect2 *intersection)
#if defined(__x86_64__) || defined(__ppc64__)
gb_math_u64
- gb_hash_murmur64(void const *key, size_t num_bytes, u64 seed)
+ gb_hash_murmur64(void const *key, size_t num_bytes, gb_math_u64 seed)
{
gb_math_u64 const m = 0xc6a4a7935bd1e995ULL;
gb_math_u64 const r = 47;
@@ -1857,7 +1858,7 @@ gb_rect2_intersection_result(gbRect2 a, gbRect2 b, gbRect2 *intersection)
}
#else
gb_math_u64
- gb_hash_murmur64(void const *key, size_t num_bytes, u64 seed)
+ gb_hash_murmur64(void const *key, size_t num_bytes, gb_math_u64 seed)
{
gb_math_u32 const m = 0x5bd1e995;
gb_math_u32 const r = 24;