Mesa (master): mesa: use _mesa_memcpy for COPY_4FV macro

Roland Scheidegger sroland at kemper.freedesktop.org
Tue Dec 8 18:28:44 UTC 2009


Module: Mesa
Branch: master
Commit: 86c8f70db10a584aa78e4d5f397ad3543fdb77d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=86c8f70db10a584aa78e4d5f397ad3543fdb77d2

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Dec  3 23:26:13 2009 +0100

mesa: use _mesa_memcpy for COPY_4FV macro

Gets rid of one of the worst strict-aliasing offenders, and actually
produces faster code (at least in some cases, when compiler can use
for instance 64bit moves for memcpy).
(note _mesa_memcpy should get inlined)

---

 src/mesa/main/macros.h |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 3d9a1ab..f0ea463 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -202,17 +202,12 @@ do {                                \
 #endif
 
 /**
- * Copy a 4-element float vector (avoid using FPU registers)
- * XXX Could use two 64-bit moves on 64-bit systems
+ * Copy a 4-element float vector
+ * memcpy seems to be most efficient
  */
 #define COPY_4FV( DST, SRC )                  \
 do {                                          \
-   const GLuint *_s = (const GLuint *) (SRC); \
-   GLuint *_d = (GLuint *) (DST);             \
-   _d[0] = _s[0];                             \
-   _d[1] = _s[1];                             \
-   _d[2] = _s[2];                             \
-   _d[3] = _s[3];                             \
+   _mesa_memcpy(DST, SRC, sizeof(GLfloat) * 4);       \
 } while (0)
 
 /** Copy \p SZ elements into a 4-element vector */




More information about the mesa-commit mailing list