according to <http://darcs.haskell.org/packages/base/GHC/Word.hs>, GHC's rotate is implemented as

    (W32# x#) `rotate` (I# i#)
        | i'# ==# 0# = W32# x#
        | otherwise  = W32# ((x# `shiftL32#` i'#) `or32#`
                             (x# `shiftRL32#` (32# -# i'#)))
        where
        i'# = word2Int# (int2Word# i# `and#` int2Word# 31#)

So you can see that it takes i modulo 32 first (by anding it with 31). Perhaps one needs an uncheckedRotate32# function (if it doesn't exist).

Also, shouldn't the calls to shiftL32# and shiftRL32# be calls to uncheckedShiftL32# and uncheckedShiftR32# since i'# and (32# -# i'#) are provably safe?

--
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to