aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-04 12:18:13 +0100
committermarha <marha@users.sourceforge.net>2014-03-04 12:23:48 +0100
commit45392e4a0642880b569ea5d4a350cdc395a2c7db (patch)
treec3c2a49de903a18c3f8e1bf79684c29337ebcf7c /mesalib/src/gallium/auxiliary/util/u_math.h
parent5ec0616d4e3c4c6095f4975abbe9c21e5b6af967 (diff)
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.gz
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.bz2
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 libxcb mesa xserver xcb-proto xkeyboard-config git update 4 Mar 2014 Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mapi/glapi/glthread.c mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/main/bufferobj.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/winmultiwindowwm.c
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_math.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index b5e06630a..ec03e4e58 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -112,10 +112,13 @@ static INLINE float logf( float f )
#define logf(x) ((float)log((double)(x)))
#endif /* logf */
+#if _MSC_VER < 1800
#define isfinite(x) _finite((double)(x))
#define isnan(x) _isnan((double)(x))
+#endif /* _MSC_VER < 1800 */
#endif /* _MSC_VER < 1400 && !defined(__cplusplus) */
+#if _MSC_VER < 1800
static INLINE double log2( double x )
{
const double invln2 = 1.442695041;
@@ -133,6 +136,7 @@ roundf(float x)
{
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
}
+#endif
#define INFINITY (DBL_MAX + DBL_MAX)
#define NAN (INFINITY - INFINITY)
@@ -717,13 +721,18 @@ util_bitcount(unsigned n)
*/
#ifdef PIPE_ARCH_BIG_ENDIAN
+#define util_le64_to_cpu(x) util_bswap64(x)
#define util_le32_to_cpu(x) util_bswap32(x)
#define util_le16_to_cpu(x) util_bswap16(x)
#else
+#define util_le64_to_cpu(x) (x)
#define util_le32_to_cpu(x) (x)
#define util_le16_to_cpu(x) (x)
#endif
+#define util_cpu_to_le64(x) util_le64_to_cpu(x)
+#define util_cpu_to_le32(x) util_le32_to_cpu(x)
+#define util_cpu_to_le16(x) util_le16_to_cpu(x)
/**
* Reverse byte order of a 32 bit word.
@@ -731,7 +740,8 @@ util_bitcount(unsigned n)
static INLINE uint32_t
util_bswap32(uint32_t n)
{
-#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 403)
+/* We need the gcc version checks for non-autoconf build system */
+#if defined(HAVE___BUILTIN_BSWAP32) || (defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 403))
return __builtin_bswap32(n);
#else
return (n >> 24) |
@@ -741,6 +751,20 @@ util_bswap32(uint32_t n)
#endif
}
+/**
+ * Reverse byte order of a 64bit word.
+ */
+static INLINE uint64_t
+util_bswap64(uint64_t n)
+{
+#if defined(HAVE___BUILTIN_BSWAP64)
+ return __builtin_bswap64(n);
+#else
+ return ((uint64_t)util_bswap32(n) << 32) |
+ util_bswap32((n >> 32));
+#endif
+}
+
/**
* Reverse byte order of a 16 bit word.