From 6410eac6be8166e4f3a1bd021ca9e744a14ef0ee Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 22 Apr 2006 12:40:25 +0000 Subject: [PATCH] (svn r4524) - Codechange: Use GB() macros for getting the saveload file/memory types --- saveload.c | 4 ++-- saveload.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/saveload.c b/saveload.c index a29c3990fc..0087db17e5 100644 --- a/saveload.c +++ b/saveload.c @@ -101,7 +101,7 @@ static inline uint32 SlGetOffs(void) {return _sl.offs_base - (_sl.bufe - _sl.buf static inline byte SlCalcConvMemLen(VarType conv) { static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; - byte length = (conv >> 4) & 0xF; + byte length = GB(conv, 4, 4); assert(length < lengthof(conv_mem_size)); return conv_mem_size[length]; } @@ -113,7 +113,7 @@ static inline byte SlCalcConvMemLen(VarType conv) static inline byte SlCalcConvFileLen(VarType conv) { static const byte conv_file_size[] = {1, 1, 2, 2, 4, 4, 8, 8, 2}; - byte length = conv & 0xF; + byte length = GB(conv, 0, 4); assert(length < lengthof(conv_file_size)); return conv_file_size[length]; } diff --git a/saveload.h b/saveload.h index fd815fc3a6..1a7fc82e21 100644 --- a/saveload.h +++ b/saveload.h @@ -250,7 +250,7 @@ static inline bool SlIsObjectCurrentlyValid(uint16 version_from, uint16 version_ * @return return the SLE_VAR_* part of a variable-type description */ static inline VarType GetVarMemType(VarType type) { - return type & 0xF0; // GB(type, 4, 8) << 4; + return type & 0xF0; // GB(type, 4, 4) << 4; } /* Get the FileType of a setting. This describes the integer type