[commit: packages/base] master: Comments only, about the "RA" and "RL" nomenclature for shifts (f109bb0)

git at git.haskell.org git at git.haskell.org
Thu Mar 13 12:26:50 UTC 2014


Repository : ssh://git@git.haskell.org/base

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f109bb03353dd81a1fa2820de3a199e3e5841ee0/base

>---------------------------------------------------------------

commit f109bb03353dd81a1fa2820de3a199e3e5841ee0
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Mar 13 12:11:36 2014 +0000

    Comments only, about the "RA" and "RL" nomenclature for shifts


>---------------------------------------------------------------

f109bb03353dd81a1fa2820de3a199e3e5841ee0
 GHC/Base.lhs |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/GHC/Base.lhs b/GHC/Base.lhs
index d876202..0a2dd80 100644
--- a/GHC/Base.lhs
+++ b/GHC/Base.lhs
@@ -694,6 +694,8 @@ a `shiftL#` b   | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0##
 
 -- | Shift the argument right by the specified number of bits
 -- (which must be non-negative).
+-- The "RL" means "right, logical" (as opposed to RA for arithmetic)
+-- (although an arithmetic right shift wouldn't make sense for Word#)
 shiftRL# :: Word# -> Int# -> Word#
 a `shiftRL#` b  | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0##
                 | otherwise                          = a `uncheckedShiftRL#` b
@@ -706,6 +708,7 @@ a `iShiftL#` b  | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0#
 
 -- | Shift the argument right (signed) by the specified number of bits
 -- (which must be non-negative).
+-- The "RA" means "right, arithmetic" (as opposed to RL for logical)
 iShiftRA# :: Int# -> Int# -> Int#
 a `iShiftRA#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = if isTrue# (a <# 0#)
                                                           then (-1#)
@@ -714,6 +717,7 @@ a `iShiftRA#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = if isTrue# (a <# 0#)
 
 -- | Shift the argument right (unsigned) by the specified number of bits
 -- (which must be non-negative).
+-- The "RL" means "right, logical" (as opposed to RA for arithmetic)
 iShiftRL# :: Int# -> Int# -> Int#
 a `iShiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0#
                 | otherwise                          = a `uncheckedIShiftRL#` b



More information about the ghc-commits mailing list