aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-03-26 03:13:30 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-03-26 03:13:30 +0000
commitf7477528e1c1eaa2a06ca71c1496bb5f30fcd8bb (patch)
treeb496215a459b06e7a9398577853671d7b1b82137
parent905b6f3855e83d6d511bc350b46a5f5726618aa1 (diff)
downloadioquake3-aero-f7477528e1c1eaa2a06ca71c1496bb5f30fcd8bb.tar.gz
ioquake3-aero-f7477528e1c1eaa2a06ca71c1496bb5f30fcd8bb.zip
Make cast-workaround to unsigned int use sizeof operator.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1281 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/game/bg_lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/code/game/bg_lib.c b/code/game/bg_lib.c
index 2027d6f..a2f5ddb 100644
--- a/code/game/bg_lib.c
+++ b/code/game/bg_lib.c
@@ -1286,7 +1286,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
// value = (unsigned short int) va_arg (args, unsigned short int); // Thilo: This does not work because the rcc compiler cannot do that cast correctly.
- value = va_arg (args, unsigned int) & 0xFFFF; // Using this workaround instead.
+ value = va_arg (args, unsigned int) & ( (1 << sizeof(unsigned short int) * 8) - 1); // Using this workaround instead.
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)
@@ -1298,7 +1298,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'u':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
- value = va_arg (args, unsigned int) & 0xFFFF;
+ value = va_arg (args, unsigned int) & ( (1 << sizeof(unsigned short int) * 8) - 1);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)
@@ -1312,7 +1312,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
- value = va_arg (args, unsigned int) & 0xFFFF;
+ value = va_arg (args, unsigned int) & ( (1 << sizeof(unsigned short int) * 8) - 1);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)