From ddfa61ee194b9d4ec88d499c71cd6810e7f6a022 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 20 Jan 2005 13:24:08 +0000 Subject: Enclose passed macro values in brackets to ensure correct read/write span values. --- src/mesa/drivers/dri/mga/mgaspan.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mesa/drivers/dri/mga/mgaspan.c') diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 81cf4c8812a..4b2c5cd6829 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -138,10 +138,10 @@ /* 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" @@ -152,10 +152,10 @@ /* 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" @@ -165,14 +165,14 @@ /* 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 -- cgit v1.2.3