> And, are you aware of what some intel chips will
do if you ask them to
> shift 33 bits? (anything >32)
On Tue, 2 Dec 2014, Roe Peterson wrote:
No, but I imagine it could be spectacular. The
history of computing has
a bunch of stories regarding grim results when trying to execute
impossible or unimplemented instructions.
Generally most of us assume that a shift or rotate of N bits is the same
as doing the shift or rotate 1 bit, N times.
Rotate N bits [for 8 bit, 16 bit and 32 bit numbers] gives the same
results as rotating N modulus 32 (or N AND 1Fh).
Using only those "relevant" bits of N eliminates some wasted time V doing
the actual number requested.
BUT, that performance improvement was also applied to SHIFTS!
Shifting a 32 bit number 33 bits resulted in a 1 bit shift V clearing it.
NOTE: shifting is not always the fastest or best way to clear a number.