Erroneous behaviour of LSH() procedure
Procedure Show() in attached module below calculates logical and arithmetic shift in 4 different situations.
Calculation no.2 LSH(1,bits) = 0
(where INTEGER bits = 8) gives wrong result of zero although it should be 256.
Why?
I suspect that compiler considers number 1 in LSH(1,bits)
to be an 8-bit number.
For unknown reason, because in calculation no.1 LSH(1,8) = 256
LSH gives correct result of 256.
To correct this erroneous behaviour of LSH procedure you must type 1 as LSH(INTEGER(1),bits) = 256
(see calculation no.3).
Note: arithmetic shift does not show such weird behaviour ASH(1,bits) = 256
(see calculation no.4).
I believe this is an error in fox compiler. It would be nice if you could point me to the module where to search for the error.