src/memory.h

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