Enclose passed macro values in brackets to ensure correct read/write span
authorAlan Hourihane <alanh@tungstengraphics.com>
Thu, 20 Jan 2005 13:24:08 +0000 (13:24 +0000)
committerAlan Hourihane <alanh@tungstengraphics.com>
Thu, 20 Jan 2005 13:24:08 +0000 (13:24 +0000)
values.

src/mesa/drivers/dri/gamma/gamma_span.c
src/mesa/drivers/dri/i810/i810span.c
src/mesa/drivers/dri/i915/intel_span.c
src/mesa/drivers/dri/mga/mgaspan.c
src/mesa/drivers/dri/r128/r128_span.c
src/mesa/drivers/dri/sis/sis_span.c
src/mesa/drivers/dri/unichrome/via_span.c

index 2cf0d49efbe35f3505828068c9e1b67fce71bba0..c953dfd08ffea2a16af01878e4cc2ec470059c47 100644 (file)
@@ -147,10 +147,10 @@ do {                                                                      \
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLushort *)(buf + _x*2 + _y*pitch) = d;
+   *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLushort *)(buf + _x*2 + _y*pitch);   
+   d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);       
 
 #define TAG(x) gamma##x##_16
 #include "depthtmp.h"
@@ -161,10 +161,10 @@ do {                                                                      \
 /* 32 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLuint *)(buf + _x*4 + _y*pitch) = d;
+   *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLuint *)(buf + _x*4 + _y*pitch);     
+   d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); 
 
 #define TAG(x) gamma##x##_32
 #include "depthtmp.h"
@@ -174,14 +174,14 @@ do {                                                                      \
 /* 24/8 bit interleaved depth/stencil functions
  */
 #define WRITE_DEPTH( _x, _y, d ) {                     \
-   GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch);    \
+   GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);        \
    tmp &= 0xff;                                                \
    tmp |= (d) & 0xffffff00;                            \
-   *(GLuint *)(buf + _x*4 + _y*pitch) = tmp;           \
+   *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp;               \
 }
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff;     
+   d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff; 
 
 
 #define TAG(x) gamma##x##_24_8
index 52fb1754df6969af73dbdeb466e66884057c051f..eb32cb7c7037326a22b4d547bce14eb25a22089b 100644 (file)
@@ -102,10 +102,10 @@ do {                                                                      \
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d ) \
-   *(GLushort *)(buf + _x*2 + _y*pitch)  = d;
+   *(GLushort *)(buf + (_x)*2 + (_y)*pitch)  = d;
 
 #define READ_DEPTH( d, _x, _y )        \
-   d = *(GLushort *)(buf + _x*2 + _y*pitch);
+   d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
 
 #define TAG(x) i810##x##_16
 #include "depthtmp.h"
index 456403f2c3400d4ada2f4f1019e178383bea23bc..494022b2957e880b4e3311730ddd2f0a6c33e2f3 100644 (file)
@@ -153,10 +153,10 @@ do {                                                              \
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d ) \
-   *(GLushort *)(buf + _x*2 + _y*pitch)  = d;
+   *(GLushort *)(buf + (_x)*2 + (_y)*pitch)  = d;
 
 #define READ_DEPTH( d, _x, _y )        \
-   d = *(GLushort *)(buf + _x*2 + _y*pitch);    
+   d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);        
 
 
 #define TAG(x) intel##x##_16
index 81cf4c8812a4dc35150331f8ae25ec591e39196b..4b2c5cd682982a9a1edfb577a35771e1d0d83a25 100644 (file)
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLushort *)(buf + _x*2 + _y*pitch) = d;
+   *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLushort *)(buf + _x*2 + _y*pitch);
+   d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
 
 #define TAG(x) mga##x##_16
 #include "depthtmp.h"
 /* 32 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLuint *)(buf + _x*4 + _y*pitch) = d;
+   *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLuint *)(buf + _x*4 + _y*pitch);
+   d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);
 
 #define TAG(x) mga##x##_32
 #include "depthtmp.h"
 /* 24/8 bit interleaved depth/stencil functions
  */
 #define WRITE_DEPTH( _x, _y, d ) {                     \
-   GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch);    \
+   GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);        \
    tmp &= 0xff;                                                \
    tmp |= (d) << 8;                                    \
-   *(GLuint *)(buf + _x*4 + _y*pitch) = tmp;           \
+   *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp;               \
 }
 
 #define READ_DEPTH( d, _x, _y )        {                               \
-   d = (*(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff) >> 8;      \
+   d = (*(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff) >> 8;  \
 }
 
 #define TAG(x) mga##x##_24_8
index b169dc7509ec944cbb3089b1eda4336a95dd3e45..457e371edceec86f4077f969f34bdb0ae2f65474 100644 (file)
@@ -154,7 +154,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* 16-bit depth buffer functions
  */
 #define READ_DEPTH(d, _x, _y)                                           \
-    d = *(GLushort *)(buf + _x*2 + _y*pitch)
+    d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch)
 
 #define WRITE_DEPTH_SPAN()                                             \
    r128WriteDepthSpanLocked( rmesa, n,                                 \
index 47790a5f8527bf43e599255945af2ec352b5fee2..8f4b3af62ed2ccbd0bedd00fb8ffa3ab1a1ecb38 100644 (file)
@@ -143,10 +143,10 @@ do {                                                      \
 /* 16 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLushort *)(buf + _x*2 + _y*smesa->depthPitch) = d;
+   *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLushort *)(buf + _x*2 + _y*smesa->depthPitch);
+   d = *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch);
 
 #define TAG(x) sis##x##_16
 #include "depthtmp.h"
@@ -155,10 +155,10 @@ do {                                                      \
 /* 32 bit depthbuffer functions.
  */
 #define WRITE_DEPTH( _x, _y, d )       \
-   *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = d;
+   *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = d;
 
 #define READ_DEPTH( d, _x, _y )                \
-   d = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch);
+   d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch);
 
 #define TAG(x) sis##x##_32
 #include "depthtmp.h"
@@ -167,28 +167,28 @@ do {                                                      \
 /* 8/24 bit interleaved depth/stencil functions
  */
 #define WRITE_DEPTH( _x, _y, d ) {                             \
-   GLuint tmp = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch); \
+   GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch); \
    tmp &= 0xff000000;                                          \
    tmp |= (d & 0x00ffffff);                                    \
-   *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = tmp;       \
+   *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = tmp;   \
 }
 
 #define READ_DEPTH( d, _x, _y )        {                       \
-   d = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) & 0x00ffffff; \
+   d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0x00ffffff; \
 }
 
 #define TAG(x) sis##x##_24_8
 #include "depthtmp.h"
 
 #define WRITE_STENCIL( _x, _y, d ) {                           \
-   GLuint tmp = *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch); \
+   GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch); \
    tmp &= 0x00ffffff;                                          \
    tmp |= (d << 24);                                           \
-   *(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) = tmp;       \
+   *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = tmp;   \
 }
 
 #define READ_STENCIL( d, _x, _y )                      \
-   d = (*(GLuint *)(buf + _x*4 + _y*smesa->depthPitch) & 0xff000000) >> 24;
+   d = (*(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0xff000000) >> 24;
 
 #define TAG(x) sis##x##_24_8
 #include "stenciltmp.h"
index c45322770c4927f94cf7b94863a3bfc5155a00ec..4773f51627d29c587caba0f4f2d1f08a4b00aeaf 100644 (file)
 
 
 #define WRITE_DEPTH(_x, _y, d)                      \
-    *(GLushort *)(buf + _x * 2 + _y * depth_pitch) = d;
+    *(GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch) = d;
 
 #define READ_DEPTH(d, _x, _y)                       \
-    d = *(GLushort *)(buf + _x * 2 + _y * depth_pitch);
+    d = *(volatile GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch);
 
 #define TAG(x) via##x##_16
 #include "depthtmp.h"
 /* 32 bit depthbuffer functions.
  */
 #define WRITE_DEPTH(_x, _y, d)                      \
-    *(GLuint *)(buf + _x * 4 + _y * depth_pitch) = d;
+    *(GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch) = d;
 
 #define READ_DEPTH(d, _x, _y)                       \
-    d = *(GLuint *)(buf + _x * 4 + _y * depth_pitch);
+    d = *(volatile GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch);
 
 #define TAG(x) via##x##_32
 #include "depthtmp.h"