Overflow checking for integer lsl operation
- On Tue, Jul 08, 2008 at 09:07:40AM -0500, Raj Bandyopadhyay wrote:
> Is there a good way for checking overflow for the integer left-shiftA k-bit left shift (n lsl k) will overflow iff any of the upper k
> (lsl) operator in OCaml?
bits is 1, which you can check by shifting, masking, and comparing to 0.
Your code will depend on the word size, though.
Eric Cooper e c c @ c m u . e d u