Mercurial > hg > dmlib
changeset 540:54fefbd9aa31
Add helper macros for getting hi/lo bytes of 16bit BE words and use them.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 22 Nov 2012 22:24:33 +0200 |
parents | 8d7b6fecbb24 |
children | 7ca6abbbbb40 |
files | lib64gfx.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib64gfx.c Thu Nov 22 22:19:12 2012 +0200 +++ b/lib64gfx.c Thu Nov 22 22:24:33 2012 +0200 @@ -57,10 +57,14 @@ }; +#define DM_GET_ADDR_LO(addr) (addr & 0xff) +#define DM_GET_ADDR_HI(addr) ((addr >> 8) & 0xff) + static BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr) { - return (buf[offs] == (addr & 0xff)) && (buf[offs + 1] == ((addr >> 8) & 0xff)); + return buf[offs] == DM_GET_ADDR_LO(addr) && + buf[offs + 1] == DM_GET_ADDR_HI(addr); }