aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index b9ed197d7..f6dcb228f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -812,6 +812,23 @@ util_bswap16(uint16_t n)
(n << 8);
}
+static INLINE void*
+util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n)
+{
+#ifdef PIPE_ARCH_BIG_ENDIAN
+ size_t i, e;
+ asset(n % 4 == 0);
+
+ for (i = 0, e = n / 4; i < e; i++) {
+ uint32_t * restrict d = (uint32_t* restrict)dest;
+ const uint32_t * restrict s = (const uint32_t* restrict)src;
+ d[i] = util_bswap32(s[i]);
+ }
+ return dest;
+#else
+ return memcpy(dest, src, n);
+#endif
+}
/**
* Clamp X to [MIN, MAX].