diff --git a/ghc/docs/libraries/Int.sgml b/ghc/docs/libraries/Int.sgml index 0e29d6cf615e15eaa7dd163f1f9744efab3f3df5..b26cfe28ce11851c7d640059b58bc1d000e3332f 100644 --- a/ghc/docs/libraries/Int.sgml +++ b/ghc/docs/libraries/Int.sgml @@ -82,6 +82,14 @@ such as <tt/Int/ (see the section of the Haskell report dealing with arithmetic sequences) also hold for the <tt/Enum/ instances over the various <tt/Int/ types defined here. +<item> +Right and left shifts by amounts greater than or equal to the width of +the type result in either zero or -1, depending on the sign of the +value being shifted. This is contrary to the behaviour in C, which is +undefined; a common interpretation is to truncate the shift count to +the width of the type, for example <tt>1 << 32 == 1</tt> in some +C implementations. + <item> Hugs does not provide <tt/Int64/ at the moment. diff --git a/ghc/docs/libraries/Word.sgml b/ghc/docs/libraries/Word.sgml index 79af677ae27b6c0187e1d0d47c23c8427cfcb8c2..bf85825f39549e6d2aef3af1667d23e59f67555f 100644 --- a/ghc/docs/libraries/Word.sgml +++ b/ghc/docs/libraries/Word.sgml @@ -102,6 +102,13 @@ such as <tt/Int/ (see the section of the Haskell report dealing with arithmetic sequences) also hold for the <tt/Enum/ instances over the various <tt/Word/ types defined here. +<item> +Right and left shifts by amounts greater than or equal to the width of +the type result in a zero result. This is contrary to the behaviour +in C, which is undefined; a common interpretation is to truncate +the shift count to the width of the type, for example <tt>1 << +32 == 1</tt> in some C implementations. + </itemize> <bf/Implementation notes:/