mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +00:00
More little-endian memreadwrite macros.
This commit is contained in:
parent
1744f13fb4
commit
ec384fb5ea
@ -40,7 +40,7 @@
|
||||
((addr)[6] << 8) | (addr)[7])
|
||||
|
||||
/* read an unaligned little-endian WORD (16bit) */
|
||||
#define READ_WORD_LE_U(addr) (((addr)[1] << 8) | (ptr)[0])
|
||||
#define READ_WORD_LE_U(addr) (((addr)[1] << 8) | (addr)[0])
|
||||
|
||||
/* read an unaligned little-endian DWORD (32bit) */
|
||||
#define READ_DWORD_LE_U(addr) (((addr)[3] << 24) | ((addr)[2] << 16) | \
|
||||
@ -78,4 +78,29 @@ do { \
|
||||
(addr)[3] = (val) & 0xFF; \
|
||||
} while(0)
|
||||
|
||||
/* write an aligned little-endian WORD (16bit) */
|
||||
#define WRITE_WORD_LE_A(addr,val) (*((uint16_t *)((addr))) = (val))
|
||||
|
||||
/* write an aligned little-endian DWORD (32bit) */
|
||||
#define WRITE_DWORD_LE_A(addr,val) (*((uint32_t *)((addr))) = (val))
|
||||
|
||||
/* write an aligned little-endian QWORD (64bit) */
|
||||
#define WRITE_QWORD_LE_A(addr,val) (*((uint64_t *)((addr))) = (val))
|
||||
|
||||
/* write an unaligned little-endian WORD (16bit) */
|
||||
#define WRITE_WORD_LE_U(addr, val) \
|
||||
do { \
|
||||
(addr)[0] = (val) & 0xFF; \
|
||||
(addr)[1] = ((val) >> 8) & 0xFF; \
|
||||
} while(0)
|
||||
|
||||
/* write an unaligned little-endian DWORD (32bit) */
|
||||
#define WRITE_DWORD_LE_U(addr, val) \
|
||||
do { \
|
||||
(addr)[0] = (val) & 0xFF; \
|
||||
(addr)[1] = ((val) >> 8) & 0xFF; \
|
||||
(addr)[2] = ((val) >> 16) & 0xFF; \
|
||||
(addr)[3] = ((val) >> 24) & 0xFF; \
|
||||
} while(0)
|
||||
|
||||
#endif /* MEM_READ_WRITE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user