}
-static inline boolean
-little_endian(void)
-{
- const unsigned ui = 1;
- return *((const char *) &ui);
-}
-
-
/**
* Given an OSMESA_x format and a GL_y type, return the best
* matching PIPE_FORMAT_z.
switch (format) {
case OSMESA_RGBA:
if (type == GL_UNSIGNED_BYTE) {
- if (little_endian())
- return PIPE_FORMAT_R8G8B8A8_UNORM;
- else
- return PIPE_FORMAT_A8B8G8R8_UNORM;
+#if PIPE_ARCH_LITTLE_ENDIAN
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
+#else
+ return PIPE_FORMAT_A8B8G8R8_UNORM;
+#endif
}
else if (type == GL_UNSIGNED_SHORT) {
return PIPE_FORMAT_R16G16B16A16_UNORM;
break;
case OSMESA_BGRA:
if (type == GL_UNSIGNED_BYTE) {
- if (little_endian())
- return PIPE_FORMAT_B8G8R8A8_UNORM;
- else
- return PIPE_FORMAT_A8R8G8B8_UNORM;
+#if PIPE_ARCH_LITTLE_ENDIAN
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
+#else
+ return PIPE_FORMAT_A8R8G8B8_UNORM;
+#endif
}
else if (type == GL_UNSIGNED_SHORT) {
return PIPE_FORMAT_R16G16B16A16_UNORM;
break;
case OSMESA_ARGB:
if (type == GL_UNSIGNED_BYTE) {
- if (little_endian())
- return PIPE_FORMAT_A8R8G8B8_UNORM;
- else
- return PIPE_FORMAT_B8G8R8A8_UNORM;
+#if PIPE_ARCH_LITTLE_ENDIAN
+ return PIPE_FORMAT_A8R8G8B8_UNORM;
+#else
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
+#endif
}
else if (type == GL_UNSIGNED_SHORT) {
return PIPE_FORMAT_R16G16B16A16_UNORM;