From deb41aa9252c516c73b896dd52712c7dd912621e Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 30 Sep 2008 11:56:11 +0000 Subject: [PATCH] fix #2594: we were erroneously applying masks, as the reporter suggested My guess is that this is left over from when we represented Int8 and friends as zero-extended rather than sign-extended. It's amazing it hasn't been noticed earlier. --- rts/RtsAPI.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index 2496af3..525ead2 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -51,7 +51,7 @@ rts_mkInt8 (Capability *cap, HsInt8 i) StgClosure *p = (StgClosure *)allocateLocal(cap,CONSTR_sizeW(0,1)); SET_HDR(p, I8zh_con_info, CCS_SYSTEM); /* Make sure we mask out the bits above the lowest 8 */ - p->payload[0] = (StgClosure *)(StgInt)((unsigned)i & 0xff); + p->payload[0] = (StgClosure *)(StgInt)i; return p; } @@ -61,7 +61,7 @@ rts_mkInt16 (Capability *cap, HsInt16 i) StgClosure *p = (StgClosure *)allocateLocal(cap,CONSTR_sizeW(0,1)); SET_HDR(p, I16zh_con_info, CCS_SYSTEM); /* Make sure we mask out the relevant bits */ - p->payload[0] = (StgClosure *)(StgInt)((unsigned)i & 0xffff); + p->payload[0] = (StgClosure *)(StgInt)i; return p; } @@ -70,7 +70,7 @@ rts_mkInt32 (Capability *cap, HsInt32 i) { StgClosure *p = (StgClosure *)allocateLocal(cap,CONSTR_sizeW(0,1)); SET_HDR(p, I32zh_con_info, CCS_SYSTEM); - p->payload[0] = (StgClosure *)(StgInt)((unsigned)i & 0xffffffff); + p->payload[0] = (StgClosure *)(StgInt)i; return p; } -- 1.7.10.4