[internal] make some binding stricter
This commit is contained in:
parent
488bc980aa
commit
da52607d41
@ -12,6 +12,7 @@
|
||||
-- to write compat code for primitives
|
||||
--
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE MagicHash #-}
|
||||
module Crypto.Internal.CompatPrim
|
||||
( be32Prim
|
||||
@ -33,10 +34,10 @@ byteswap32Prim :: Word# -> Word#
|
||||
byteswap32Prim w = byteSwap32# w
|
||||
#else
|
||||
byteswap32Prim w =
|
||||
let a = uncheckedShiftL# w 24#
|
||||
b = and# (uncheckedShiftL# w 8#) 0x00ff0000##
|
||||
c = and# (uncheckedShiftRL# w 8#) 0x0000ff00##
|
||||
d = and# (uncheckedShiftRL# w 24#) 0x000000ff##
|
||||
let !a = uncheckedShiftL# w 24#
|
||||
!b = and# (uncheckedShiftL# w 8#) 0x00ff0000##
|
||||
!c = and# (uncheckedShiftRL# w 8#) 0x0000ff00##
|
||||
!d = and# (uncheckedShiftRL# w 24#) 0x000000ff##
|
||||
in or# a (or# b (or# c d))
|
||||
#endif
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ array64 (I# n) l = unsafeDoIO $ IO $ \s ->
|
||||
loop i st mb ((W64# x):xs)
|
||||
| booleanPrim (i ==# n) = freezeArray mb st
|
||||
| otherwise =
|
||||
let st' = writeWord64Array# mb i x st
|
||||
let !st' = writeWord64Array# mb i x st
|
||||
in loop (i +# 1#) st' mb xs
|
||||
freezeArray mb st =
|
||||
case unsafeFreezeByteArray# mb st of
|
||||
@ -92,7 +92,7 @@ mutableArray32 (I# n) l = IO $ \s ->
|
||||
loop i st mb ((W32# x):xs)
|
||||
| booleanPrim (i ==# n) = (# st, MutableArray32 mb #)
|
||||
| otherwise =
|
||||
let st' = writeWord32Array# mb i x st
|
||||
let !st' = writeWord32Array# mb i x st
|
||||
in loop (i +# 1#) st' mb xs
|
||||
|
||||
mutableArray32FromAddrBE :: Int -> Addr# -> IO MutableArray32
|
||||
@ -103,7 +103,7 @@ mutableArray32FromAddrBE (I# n) a = IO $ \s ->
|
||||
loop i st mb
|
||||
| booleanPrim (i ==# n) = (# st, MutableArray32 mb #)
|
||||
| otherwise =
|
||||
let st' = writeWord32Array# mb i (be32Prim (indexWord32OffAddr# a i)) st
|
||||
let !st' = writeWord32Array# mb i (be32Prim (indexWord32OffAddr# a i)) st
|
||||
in loop (i +# 1#) st' mb
|
||||
|
||||
mutableArray32Freeze :: MutableArray32 -> IO Array32
|
||||
|
||||
Loading…
Reference in New Issue
Block a user