' Prints 0
const X as ulongint = (2^64) - 1ull
print "X = "; X
' Prints 18446744073709551615
const Z as ulongint = 18446744073709551615ull ' same as (2^64) - 1ull ... right?
print "Z = "; Z
' Prints 0
const X as ulongint = culngint(2^64) - 1
print "X = "; X
' Prints 18446744073709551615
const Z as ulongint = 18446744073709551615ull ' same as (2^64) - 1ull ... right?
print "Z = "; Z
Both (2 Shl 63) and (1 Shl 64) give warning 33(0): Shift value greater than or equal to number of bits in data type Which makes sense, but they give different results however?:
If 'shl 63' gives a warning, that's a bug, because shifting by 63 is well-defined.
Shifting by 64 is not well-defined. You would expect the result (after truncation) to be 0 for n>=64, but usually the CPU shifts by (n mod 64u), meaning '1 shl 64' is the same as '1 shl 0'.