-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsigned 64b shl does not work for values above 32 #3123
Comments
Produces 1125899906842624 for me. |
What exactly do you need? i'm under winXP 32b. Still getting the same result (in case you were wondering if i typed it wrongly): let a: uint64 = 1 shl 31
let b: uint64 = 1 shl 50
echo a # outputs: 2147483648
echo b # outputs: 0 (could be somewhat related to #3028) |
I'm on Windows 7, 32 bit. Maybe you use a different GCC version? |
Tried on Windows XP 32-bit, I get the same result as Abrasax! |
gcc -v: |
proc foo =
var
a: uint64 = 1
b: uint64 = 50
let i: uint64 = a shl b
assert i != 0
echo i
foo() Here, the assertion doesn't fail, but echo outputs 0. My former snippet does not pass the assertion On the other hand, |
I use GCC version 4.8.1. Maybe that's the reason? |
For me it is working fine on Linux 64bit. GCC 4.9.1 here. Per last Abrasax- comment, it don't seems a GCC problem if the generated C code already has When I try to cross-compile a 32bit binary with
So I could not test it. |
Araq: let i: uint64 = 1 shl 50
echo i It echoes |
@Araq i don't have this problem anymore. May i close it?
|
equals to 0. Declaring
1
and50
asuint64
does not affect the result.nim -v
The text was updated successfully, but these errors were encountered: