diff options
author | José Fonseca <[email protected]> | 2008-06-24 14:18:07 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-06-24 14:18:07 +0900 |
commit | a148025d94505bca08f9baa1689048032bb60e2c (patch) | |
tree | d5fe20f005a3715327909acd3266cbaedd9c0537 | |
parent | b6f053739f66c1c88db12df4690051c0a54ff0f7 (diff) |
mesa: Use standard integer types.
Especially get rid of the non-portable long long.
-rw-r--r-- | src/mesa/main/glheader.h | 35 | ||||
-rw-r--r-- | src/mesa/main/imports.c | 14 | ||||
-rw-r--r-- | src/mesa/main/imports.h | 8 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.c | 13 |
4 files changed, 37 insertions, 33 deletions
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 9e39a8370e6..57d7e60ad3d 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -69,16 +69,33 @@ #include <stdarg.h> -/* Get typedefs for uintptr_t and friends */ -#if defined(__MINGW32__) || defined(__NetBSD__) -# include <stdint.h> -#elif defined(_WIN32) -# include <BaseTsd.h> -# if _MSC_VER == 1200 - typedef UINT_PTR uintptr_t; -# endif +/* Get standard integer types */ +#if defined(_MSC_VER) + + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; +# ifndef __eglplatform_h_ + typedef __int32 int32_t; +# endif + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + +# if defined(_WIN64) + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +# else + typedef __int32 intptr_t; + typedef unsigned __int32 uintptr_t; +# endif + +# define INT64_C(__val) __val##i64 +# define UINT64_C(__val) __val##ui64 + #else -# include <inttypes.h> +# include <stdint.h> #endif #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index c46e5beb918..7231fa699cb 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -539,10 +539,10 @@ _mesa_pow(double x, double y) * Find the first bit set in a word. */ int -_mesa_ffs(int i) +_mesa_ffs(int32_t i) { #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__) - register int bit = 1; + register int32_t bit = 1; if ((i & 0xffff) == 0) { bit += 16; i >>= 16; @@ -573,11 +573,7 @@ _mesa_ffs(int i) * if no bits set. */ int -#ifdef __MINGW32__ -_mesa_ffsll(long val) -#else -_mesa_ffsll(long long val) -#endif +_mesa_ffsll(int64_t val) { #ifdef ffsll return ffsll(val); @@ -586,11 +582,11 @@ _mesa_ffsll(long long val) assert(sizeof(val) == 8); - bit = _mesa_ffs(val); + bit = _mesa_ffs((int32_t)val); if (bit != 0) return bit; - bit = _mesa_ffs(val >> 32); + bit = _mesa_ffs((int32_t)(val >> 32)); if (bit != 0) return 32 + bit; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 813be52e4e0..d91a1366b07 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -697,14 +697,10 @@ extern double _mesa_pow(double x, double y); extern int -_mesa_ffs(int i); +_mesa_ffs(int32_t i); extern int -#ifdef __MINGW32__ -_mesa_ffsll(long i); -#else -_mesa_ffsll(long long i); -#endif +_mesa_ffsll(int64_t i); extern unsigned int _mesa_bitcount(unsigned int n); diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index b6991f45ed8..16a3ba076fd 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -298,22 +298,17 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { /* * Define a 64-bit unsigned integer type and macros */ -#if defined(__GNUC__) && !defined(__cplusplus) +#if 1 #define FX64_NATIVE 1 -#ifdef __MINGW32__ -typedef unsigned long Fx64; -#else -typedef unsigned long long Fx64; -#endif - +typedef uint64_t Fx64; #define FX64_MOV32(a, b) a = b #define FX64_OR32(a, b) a |= b #define FX64_SHL(a, c) a <<= c -#else /* !__GNUC__ */ +#else #define FX64_NATIVE 0 @@ -335,7 +330,7 @@ typedef struct { } \ } while (0) -#endif /* !__GNUC__ */ +#endif #define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */ |