X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=cbits%2Flonglong.c;h=f6e8567771358a53d0faca538c3db5c5aa564f25;hb=d5893dc5565da3dfa0e398cdcf7dd888200eb009;hp=4e2af36496e5396eb4c06d4bf79055f442ba66b3;hpb=260e7f2ed9a43c6ecf5a556d77817f39ed2893ab;p=haskell-directory.git diff --git a/cbits/longlong.c b/cbits/longlong.c index 4e2af36..f6e8567 100644 --- a/cbits/longlong.c +++ b/cbits/longlong.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: longlong.c,v 1.2 2001/12/21 15:07:26 simonmar Exp $ + * $Id: longlong.c,v 1.4 2002/12/13 14:23:42 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -63,15 +63,15 @@ StgWord64 stg_and64 (StgWord64 a, StgWord64 b) {return a & b;} StgWord64 stg_or64 (StgWord64 a, StgWord64 b) {return a | b;} StgWord64 stg_xor64 (StgWord64 a, StgWord64 b) {return a ^ b;} StgWord64 stg_not64 (StgWord64 a) {return ~a;} -StgWord64 stg_shiftL64 (StgWord64 a, StgInt b) {return a << b;} -StgWord64 stg_shiftRL64 (StgWord64 a, StgInt b) {return a >> b;} +StgWord64 stg_uncheckedShiftL64 (StgWord64 a, StgInt b) {return a << b;} +StgWord64 stg_uncheckedShiftRL64 (StgWord64 a, StgInt b) {return a >> b;} /* Right shifting of signed quantities is not portable in C, so the behaviour you'll get from using these primops depends on the whatever your C compiler is doing. ToDo: fix. -- sof 8/98 */ -StgInt64 stg_iShiftL64 (StgInt64 a, StgInt b) {return a << b;} -StgInt64 stg_iShiftRA64 (StgInt64 a, StgInt b) {return a >> b;} -StgInt64 stg_iShiftRL64 (StgInt64 a, StgInt b) +StgInt64 stg_uncheckedIShiftL64 (StgInt64 a, StgInt b) {return a << b;} +StgInt64 stg_uncheckedIShiftRA64 (StgInt64 a, StgInt b) {return a >> b;} +StgInt64 stg_uncheckedIShiftRL64 (StgInt64 a, StgInt b) {return (StgInt64) ((StgWord64) a >> b);} /* Casting between longs and longer longs. @@ -96,9 +96,9 @@ StgWord64 stg_integerToWord64 (I_ sa, StgByteArray /* Really: mp_limb_t* */ da) switch (s) { case 0: res = 0; break; case 1: res = d[0]; break; - case -1: res = -d[0]; break; + case -1: res = -(StgWord64)d[0]; break; default: - res = d[0] + ((StgWord64) d[1] << (BITS_IN (mp_limb_t))); + res = (StgWord64)d[0] + ((StgWord64)d[1] << (BITS_IN (mp_limb_t))); if (s < 0) res = -res; } return res; @@ -114,9 +114,9 @@ StgInt64 stg_integerToInt64 (StgInt sa, StgByteArray /* Really: mp_limb_t* */ da switch (s) { case 0: res = 0; break; case 1: res = d[0]; break; - case -1: res = -d[0]; break; + case -1: res = -(StgInt64)d[0]; break; default: - res = d[0] + ((StgWord64) d[1] << (BITS_IN (mp_limb_t))); + res = (StgInt64)d[0] + ((StgWord64)d[1] << (BITS_IN (mp_limb_t))); if (s < 0) res = -res; } return res;