>>>>> long long int A;
>>>>> int B;
>>>>> A = B << 32;
On Thu, 4 Dec 2014, Chuck Guzis wrote:
I think that Fred's also hinting at differences in
x86 architecture as
well.
YES.
. . .
You could, of course, standardize the meaning of << on a particular
platform by AND-ing the shift count with (data item bit length -1) --
AND-ing a rotate count saves some time. AND-ing a SHIFT count
intrinsically is doing something other than was ordered by the
programmer.
SHIFTing AX 32 bits would be one way to recognize the presence of
80386 or above. Prior to 386, it would clear the register, post
386 does nothing.
SHIFT-ing one bit at a time for SHIFTCOUNT number of times would do what
the programmer ordered, even if it is not the "best" way to clear a
number, and gets rather silly if the programmer asked for 255 bits of
shift.
which may or may not be what the writer intended.
I think (and could be wrong), that the original intent of that piece
of code was to put the contents of B into the upper 32 bits of A.
(and assuming that A is 64 bit and B is 32 bit). But, it would fail
to do that, simply because B would also have to be at least 64 bit
for the shift to do that.
There, the best solution is to shoot the programmer
for even writing
such stuff.
always a much easier solution! (to almost any programming problem!)
--
Grumpy Ol' Fred cisin at
xenosoft.com