diff options
author | Dylan Baker <[email protected]> | 2019-10-22 11:30:09 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-11-05 16:39:55 +0000 |
commit | 6b6897a9f9bdf813709a223e31e1eb5a6563686b (patch) | |
tree | 3907b8dfa3b7e711c73acbf6ef818e8c8ff20bab | |
parent | 39b9fe03a972f27b87bd9778371c93d04f60c49b (diff) |
gallium/osmesa: Use PIPE_ARCH_*_ENDIAN instead of little_endian function
Reviewed-by: Eric Engestrom <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/osmesa/osmesa.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c index 8225860dfa8..660b4c860fc 100644 --- a/src/gallium/state_trackers/osmesa/osmesa.c +++ b/src/gallium/state_trackers/osmesa/osmesa.c @@ -177,14 +177,6 @@ get_st_manager(void) } -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. @@ -199,10 +191,11 @@ osmesa_choose_format(GLenum format, GLenum type) 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; @@ -216,10 +209,11 @@ osmesa_choose_format(GLenum format, GLenum type) 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; @@ -233,10 +227,11 @@ osmesa_choose_format(GLenum format, GLenum type) 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; |