util: u_math: drop p_compiler.h include
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 9 Aug 2019 13:02:42 +0000 (16:02 +0300)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 9 Aug 2019 19:59:43 +0000 (22:59 +0300)
This file was moved from gallium so drop depending on gallium headers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
src/util/u_math.c
src/util/u_math.h

index 63511554bf4641b7f55360ed3c2a76e3d4b07585..9a8a9ecbbdeeb824f859cd0e686ce9a1608d93c4 100644 (file)
@@ -73,11 +73,11 @@ init_log2_table(void)
 void
 util_init_math(void)
 {
 void
 util_init_math(void)
 {
-   static boolean initialized = FALSE;
+   static bool initialized = false;
    if (!initialized) {
       init_pow2_table();
       init_log2_table();
    if (!initialized) {
       init_pow2_table();
       init_log2_table();
-      initialized = TRUE;
+      initialized = true;
    }
 }
 
    }
 }
 
index 5e712dadb4a46ea2f353297c1c7479047de6799d..a9fa35457ff6c1680c3368e240b4a3142db7d132 100644 (file)
@@ -39,8 +39,6 @@
 #define U_MATH_H
 
 
 #define U_MATH_H
 
 
-#include "pipe/p_compiler.h"
-
 #include "c99_math.h"
 #include <assert.h>
 #include <float.h>
 #include "c99_math.h"
 #include <assert.h>
 #include <float.h>
@@ -226,7 +224,7 @@ util_iround(float f)
 /**
  * Approximate floating point comparison
  */
 /**
  * Approximate floating point comparison
  */
-static inline boolean
+static inline bool
 util_is_approx(float a, float b, float tol)
 {
    return fabsf(b - a) <= tol;
 util_is_approx(float a, float b, float tol)
 {
    return fabsf(b - a) <= tol;
@@ -245,7 +243,7 @@ util_is_approx(float a, float b, float tol)
 /**
  * Single-float
  */
 /**
  * Single-float
  */
-static inline boolean
+static inline bool
 util_is_inf_or_nan(float x)
 {
    union fi tmp;
 util_is_inf_or_nan(float x)
 {
    union fi tmp;
@@ -254,7 +252,7 @@ util_is_inf_or_nan(float x)
 }
 
 
 }
 
 
-static inline boolean
+static inline bool
 util_is_nan(float x)
 {
    union fi tmp;
 util_is_nan(float x)
 {
    union fi tmp;
@@ -279,7 +277,7 @@ util_inf_sign(float x)
 /**
  * Double-float
  */
 /**
  * Double-float
  */
-static inline boolean
+static inline bool
 util_is_double_inf_or_nan(double x)
 {
    union di tmp;
 util_is_double_inf_or_nan(double x)
 {
    union di tmp;
@@ -288,7 +286,7 @@ util_is_double_inf_or_nan(double x)
 }
 
 
 }
 
 
-static inline boolean
+static inline bool
 util_is_double_nan(double x)
 {
    union di tmp;
 util_is_double_nan(double x)
 {
    union di tmp;
@@ -313,14 +311,14 @@ util_double_inf_sign(double x)
 /**
  * Half-float
  */
 /**
  * Half-float
  */
-static inline boolean
+static inline bool
 util_is_half_inf_or_nan(int16_t x)
 {
    return (x & 0x7c00) == 0x7c00;
 }
 
 
 util_is_half_inf_or_nan(int16_t x)
 {
    return (x & 0x7c00) == 0x7c00;
 }
 
 
-static inline boolean
+static inline bool
 util_is_half_nan(int16_t x)
 {
    return (x & 0x7fff) > 0x7c00;
 util_is_half_nan(int16_t x)
 {
    return (x & 0x7fff) > 0x7c00;
@@ -359,64 +357,64 @@ uif(uint32_t ui)
 
 
 /**
 
 
 /**
- * Convert ubyte to float in [0, 1].
+ * Convert uint8_t to float in [0, 1].
  */
 static inline float
  */
 static inline float
-ubyte_to_float(ubyte ub)
+ubyte_to_float(uint8_t ub)
 {
    return (float) ub * (1.0f / 255.0f);
 }
 
 
 /**
 {
    return (float) ub * (1.0f / 255.0f);
 }
 
 
 /**
- * Convert float in [0,1] to ubyte in [0,255] with clamping.
+ * Convert float in [0,1] to uint8_t in [0,255] with clamping.
  */
  */
-static inline ubyte
+static inline uint8_t
 float_to_ubyte(float f)
 {
    /* return 0 for NaN too */
    if (!(f > 0.0f)) {
 float_to_ubyte(float f)
 {
    /* return 0 for NaN too */
    if (!(f > 0.0f)) {
-      return (ubyte) 0;
+      return (uint8_t) 0;
    }
    else if (f >= 1.0f) {
    }
    else if (f >= 1.0f) {
-      return (ubyte) 255;
+      return (uint8_t) 255;
    }
    else {
       union fi tmp;
       tmp.f = f;
       tmp.f = tmp.f * (255.0f/256.0f) + 32768.0f;
    }
    else {
       union fi tmp;
       tmp.f = f;
       tmp.f = tmp.f * (255.0f/256.0f) + 32768.0f;
-      return (ubyte) tmp.i;
+      return (uint8_t) tmp.i;
    }
 }
 
 /**
    }
 }
 
 /**
- * Convert ushort to float in [0, 1].
+ * Convert uint16_t to float in [0, 1].
  */
 static inline float
  */
 static inline float
-ushort_to_float(ushort us)
+ushort_to_float(uint16_t us)
 {
    return (float) us * (1.0f / 65535.0f);
 }
 
 
 /**
 {
    return (float) us * (1.0f / 65535.0f);
 }
 
 
 /**
- * Convert float in [0,1] to ushort in [0,65535] with clamping.
+ * Convert float in [0,1] to uint16_t in [0,65535] with clamping.
  */
  */
-static inline ushort
+static inline uint16_t
 float_to_ushort(float f)
 {
    /* return 0 for NaN too */
    if (!(f > 0.0f)) {
 float_to_ushort(float f)
 {
    /* return 0 for NaN too */
    if (!(f > 0.0f)) {
-      return (ushort) 0;
+      return (uint16_t) 0;
    }
    else if (f >= 1.0f) {
    }
    else if (f >= 1.0f) {
-      return (ushort) 65535;
+      return (uint16_t) 65535;
    }
    else {
       union fi tmp;
       tmp.f = f;
       tmp.f = tmp.f * (65535.0f/65536.0f) + 128.0f;
    }
    else {
       union fi tmp;
       tmp.f = f;
       tmp.f = tmp.f * (65535.0f/65536.0f) + 128.0f;
-      return (ushort) tmp.i;
+      return (uint16_t) tmp.i;
    }
 }
 
    }
 }