Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / mesa / main / imports.h
index dad2767e72df30674b4e46d5d32a0fbfe3528604..bab00420710668f838c1fde072310a8ba2eadd22 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.2
+ * Version:  7.1
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -138,13 +138,16 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #define M_E (2.7182818284590452354)
 #endif
 
-#ifndef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
+#ifndef ONE_DIV_LN2
+#define ONE_DIV_LN2 (1.442695040888963456)
 #endif
 
-/* XXX this is a bit of a hack needed for compilation within XFree86 */
-#ifndef FLT_MIN
-#define FLT_MIN (1.0e-37)
+#ifndef ONE_DIV_SQRT_LN2
+#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
+#endif
+
+#ifndef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
 #endif
 
 /* Degrees to radians conversion: */
@@ -156,12 +159,13 @@ typedef union { GLfloat f; GLint i; } fi_type;
  ***/
 #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
     defined(__s390x__) || defined(__powerpc__) || \
-    defined(__amd64__) || \
+    defined(__x86_64__) || \
     defined(ia64) || defined(__ia64__) || \
     defined(__hppa__) || defined(hpux) || \
     defined(__mips) || defined(_MIPS_ARCH) || \
     defined(__arm__) || \
     defined(__sh__) || defined(__m32r__) || \
+    (defined(__sun) && defined(_IEEE_754)) || \
     (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
 #define USE_IEEE
 #define IEEE_ONE 0x3f800000
@@ -173,8 +177,6 @@ typedef union { GLfloat f; GLint i; } fi_type;
  ***/
 #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
 #  define SQRTF(X)  _mesa_sqrtf(X)
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#  define SQRTF(X)  (float) xf86sqrt((float) (X))
 #else
 #  define SQRTF(X)  (float) sqrt((float) (X))
 #endif
@@ -221,8 +223,6 @@ static INLINE GLfloat LOG2(GLfloat val)
    num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
    return num.f + log_2;
 }
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
 #else
 /*
  * NOTE: log_base_2(x) = log(x) / log(2)
@@ -293,15 +293,7 @@ static INLINE int GET_FLOAT_BITS( float x )
  *** LDEXPF: multiply value by an integral power of two
  *** FREXPF: extract mantissa and exponent from value
  ***/
-#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define CEILF(x)   ((GLfloat) xf86ceil(x))
-#define FLOORF(x)  ((GLfloat) xf86floor(x))
-#define FABSF(x)   ((GLfloat) xf86fabs(x))
-#define LOGF(x)    ((GLfloat) xf86log(x))
-#define EXPF(x)    ((GLfloat) xf86exp(x))
-#define LDEXPF(x,y)   ((GLfloat) xf86ldexp(x,y))
-#define FREXPF(x,y)   ((GLfloat) xf86frexp(x,y))
-#elif defined(__gnu_linux__)
+#if defined(__gnu_linux__)
 /* C99 functions */
 #define CEILF(x)   ceilf(x)
 #define FLOORF(x)  floorf(x)
@@ -341,7 +333,7 @@ static INLINE int iround(float f)
    return r;
 }
 #define IROUND(x)  iround(x)
-#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__)
+#elif defined(USE_X86_ASM) && defined(_MSC_VER)
 static INLINE int iround(float f)
 {
    int r;
@@ -470,6 +462,16 @@ static INLINE int iceil(float f)
 #endif
 
 
+/**
+ * Is x a power of two?
+ */
+static INLINE int
+_mesa_is_pow_two(int x)
+{
+   return !(x & (x - 1));
+}
+
+
 /***
  *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
  *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255]
@@ -699,11 +701,17 @@ _mesa_sqrtf(float x);
 extern float
 _mesa_inv_sqrtf(float x);
 
+extern void
+_mesa_init_sqrt_table(void);
+
 extern double
 _mesa_pow(double x, double y);
 
 extern int
-_mesa_ffs(int i);
+_mesa_ffs(int32_t i);
+
+extern int
+_mesa_ffsll(int64_t i);
 
 extern unsigned int
 _mesa_bitcount(unsigned int n);
@@ -778,10 +786,6 @@ extern void
 _mesa_exit( int status );
 
 
-extern void
-_mesa_init_default_imports( __GLimports *imports, void *driverCtx );
-
-
 #ifdef __cplusplus
 }
 #endif