src/memory.h

changeset 70
5bbe76e71698
parent 40
239bc48590ba
child 112
a392eb8f9806
     1.1 --- a/src/memory.h	Tue Dec 28 19:11:46 2010 +0000
     1.2 +++ b/src/memory.h	Tue Dec 28 19:23:57 2010 +0000
     1.3 @@ -23,22 +23,23 @@
     1.4  	((uint32_t)array[(address + 0) & (andmask)])
     1.5  
     1.6  /// Array write, 32-bit
     1.7 -#define WR32(array, address, andmask, value) {					\
     1.8 +#define WR32(array, address, andmask, value) do {				\
     1.9  	array[(address + 0) & (andmask)] = (value >> 24) & 0xff;	\
    1.10  	array[(address + 1) & (andmask)] = (value >> 16) & 0xff;	\
    1.11  	array[(address + 2) & (andmask)] = (value >> 8)  & 0xff;	\
    1.12  	array[(address + 3) & (andmask)] =  value        & 0xff;	\
    1.13 -}
    1.14 +} while (0)
    1.15  
    1.16  /// Array write, 16-bit
    1.17 -#define WR16(array, address, andmask, value) {					\
    1.18 +#define WR16(array, address, andmask, value) do {				\
    1.19  	array[(address + 0) & (andmask)] = (value >> 8)  & 0xff;	\
    1.20  	array[(address + 1) & (andmask)] =  value        & 0xff;	\
    1.21 -}
    1.22 +} while (0)
    1.23  
    1.24  /// Array write, 8-bit
    1.25 -#define WR8(array, address, andmask, value)						\
    1.26 -	array[(address + 0) & (andmask)] =  value        & 0xff;
    1.27 +#define WR8(array, address, andmask, value) do {				\
    1.28 +	array[(address + 0) & (andmask)] =  value        & 0xff;	\
    1.29 +} while (0)
    1.30  
    1.31  /******************
    1.32   * Memory mapping