Abigail wrote: >Rotating, or shifting by "n module wordsize" seems like a bad thing >to me -- that exposes the user to the size of the integer used >internally. That's already exposed by the overflow behaviour: left shifting by small distances causes bits to drop off the high-order end of the word. > 1) Promote the IV to an NV; that is, treat "<< $n" as "* 2 ** $n". That's silly. Should 3>>1 return 1.5? And it still exposes parameters of the NV format. The only way to hide the word size is to use bignums to simulate an infinitely large integer word. Perl's native arithmetic isn't otherwise bignumish, so that would be a bizarre exception. > 3) Do what we now: shift by module wordbits. No, what we do now is to invoke undefined behaviour. In practice this turns out to be the native behaviour of the CPU's variable shift instructions, for which modulo behaviour is a popular (cheap) option. -zeframThread Previous | Thread Next