Mesa (master): mesa: move _mesa_half_is_negative() to half_float.h

Brian Paul brianp at kemper.freedesktop.org
Tue Oct 10 17:38:04 UTC 2017


Module: Mesa
Branch: master
Commit: c43b0d3f9184752e848ef0ab617cca48c60246ec
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c43b0d3f9184752e848ef0ab617cca48c60246ec

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Oct  5 13:34:52 2017 -0600

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 <sroland at vmware.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/main/imports.h | 6 ------
 src/util/half_float.h   | 8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index a4964a34cc..51fa72cbc3 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -333,12 +333,6 @@ _mesa_bitcount_64(uint64_t n);
 #endif
 
 
-static inline bool
-_mesa_half_is_negative(GLhalfARB h)
-{
-   return h & 0x8000;
-}
-
 extern int
 _mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
 
diff --git a/src/util/half_float.h b/src/util/half_float.h
index 64f2042101..b3bc3f687a 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




More information about the mesa-commit mailing list