From 9a5678a8a95c46913c15a5fc19f73c113e8ed036 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 4 Nov 2006 20:41:42 +0000 Subject: Change GET/GBIT32 macros to explicitly cast final result to u32int. Otherwise, the type of the expression will be int, and if written to a uvlong (or just a ulong on most 64-bit systems), it will be sign-extended. This was going on in drawfcall with Mouse.msec, which is declared as a ulong. This fix assumes that the protocols only send unsigned numbers, which is true. --- include/fcall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/fcall.h') diff --git a/include/fcall.h b/include/fcall.h index aebb4515..a5dae337 100644 --- a/include/fcall.h +++ b/include/fcall.h @@ -50,7 +50,7 @@ struct Fcall #define GBIT8(p) ((p)[0]) #define GBIT16(p) ((p)[0]|((p)[1]<<8)) -#define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) +#define GBIT32(p) ((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))) #define GBIT64(p) ((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\ ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32)) -- cgit v1.2.3