[fpc-pascal] Conversion from C to Pascal - Left bit shift
LacaK
lacak at zoznam.sk
Thu Sep 2 15:14:32 CEST 2021
Hello *,
I have code in C like this:
E1 << E2
If E1 is of unsigned type then "The value of E1 << E2 is E1 left-shifted
E2 bit positions; vacated bits are zero-filled. If E1 has an unsigned
type, the value of the result is E1 × 2^E2, reduced modulo one more than
the maximum value representable in the result type."
I understand this as result of such operation does not grow over 32
bits, right?
In Pascal I have:
E1 shl E2
where E1 is of LongWord type.
On 64-bit target this result of shl can overcome 32 bits (iow operates
on 32 bits)?
(does also bit shift operations works on 64 bits or this only affect
arithmetic operations like multiply?)
Assembler suggests that shl works on 32 bits: shl %cl,%r11d
-Laco.
More information about the fpc-pascal
mailing list