aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h62
1 files changed, 23 insertions, 39 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 2823e0570..25bcfb57d 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -61,46 +61,46 @@ extern "C" {
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER)
#if _MSC_VER < 1400 && !defined(__cplusplus)
-
-static INLINE float cosf( float f )
+
+static INLINE float cosf( float f )
{
return (float) cos( (double) f );
}
-static INLINE float sinf( float f )
+static INLINE float sinf( float f )
{
return (float) sin( (double) f );
}
-static INLINE float ceilf( float f )
+static INLINE float ceilf( float f )
{
return (float) ceil( (double) f );
}
-static INLINE float floorf( float f )
+static INLINE float floorf( float f )
{
return (float) floor( (double) f );
}
-static INLINE float powf( float f, float g )
+static INLINE float powf( float f, float g )
{
return (float) pow( (double) f, (double) g );
}
-static INLINE float sqrtf( float f )
+static INLINE float sqrtf( float f )
{
return (float) sqrt( (double) f );
}
-static INLINE float fabsf( float f )
+static INLINE float fabsf( float f )
{
return (float) fabs( (double) f );
}
-static INLINE float logf( float f )
+static INLINE float logf( float f )
{
return (float) log( (double) f );
}
@@ -149,28 +149,6 @@ roundf(float x)
#endif /* _MSC_VER */
-#ifdef PIPE_OS_ANDROID
-
-static INLINE
-double log2(double d)
-{
- return log(d) * (1.0 / M_LN2);
-}
-
-/* workaround a conflict with main/imports.h */
-#ifdef log2f
-#undef log2f
-#endif
-
-static INLINE
-float log2f(float f)
-{
- return logf(f) * (float) (1.0 / M_LN2);
-}
-
-#endif
-
-
#if __STDC_VERSION__ < 199901L && (!defined(__cplusplus) || defined(_MSC_VER))
static INLINE long int
lrint(double d)
@@ -258,7 +236,8 @@ union di {
* Extract the IEEE float32 exponent.
*/
static INLINE signed
-util_get_float32_exponent(float x) {
+util_get_float32_exponent(float x)
+{
union fi f;
f.f = x;
@@ -558,7 +537,8 @@ unsigned ffs( unsigned u )
* Find last bit set in a word. The least significant bit is 1.
* Return 0 if no bits are set.
*/
-static INLINE unsigned util_last_bit(unsigned u)
+static INLINE unsigned
+util_last_bit(unsigned u)
{
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304)
return u == 0 ? 0 : 32 - __builtin_clz(u);
@@ -577,7 +557,8 @@ static INLINE unsigned util_last_bit(unsigned u)
* significant bit is 1.
* Return 0 if no bits are set.
*/
-static INLINE unsigned util_last_bit_signed(int i)
+static INLINE unsigned
+util_last_bit_signed(int i)
{
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407) && !defined(__INTEL_COMPILER)
return 31 - __builtin_clrsb(i);
@@ -595,9 +576,10 @@ static INLINE unsigned util_last_bit_signed(int i)
* int i = u_bit_scan(&mymask);
* ... process element i
* }
- *
+ *
*/
-static INLINE int u_bit_scan(unsigned *mask)
+static INLINE int
+u_bit_scan(unsigned *mask)
{
int i = ffs(*mask) - 1;
*mask &= ~(1 << i);
@@ -907,12 +889,14 @@ do { \
#endif
-static INLINE uint32_t util_unsigned_fixed(float value, unsigned frac_bits)
+static INLINE uint32_t
+util_unsigned_fixed(float value, unsigned frac_bits)
{
return value < 0 ? 0 : (uint32_t)(value * (1<<frac_bits));
}
-static INLINE int32_t util_signed_fixed(float value, unsigned frac_bits)
+static INLINE int32_t
+util_signed_fixed(float value, unsigned frac_bits)
{
return (int32_t)(value * (1<<frac_bits));
}