summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-10-05 13:34:52 -0600
committerBrian Paul <[email protected]>2017-10-10 11:28:31 -0600
commitc43b0d3f9184752e848ef0ab617cca48c60246ec (patch)
tree77fa6f0e6c9cdac4978946ada35291ba4e62a04a /src/util
parent3c5664b78d39e2d13f156369f8114ebbe08d6fb7 (diff)
mesa: move _mesa_half_is_negative() to half_float.h
v2: use !! in the function to be explicit about type conversion. Though, gcc generates the same code with or without the logical !!. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/half_float.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/half_float.h b/src/util/half_float.h
index 64f20421018..b3bc3f687ad 100644
--- a/src/util/half_float.h
+++ b/src/util/half_float.h
@@ -25,6 +25,7 @@
#ifndef _HALF_FLOAT_H_
#define _HALF_FLOAT_H_
+#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
@@ -34,6 +35,13 @@ extern "C" {
uint16_t _mesa_float_to_half(float val);
float _mesa_half_to_float(uint16_t val);
+static inline bool
+_mesa_half_is_negative(uint16_t h)
+{
+ return !!(h & 0x8000);
+}
+
+
#ifdef __cplusplus
} /* extern C */
#endif