M
M
MayRiv2015-05-27 16:44:41
linux
MayRiv, 2015-05-27 16:44:41

When compiling under x32, __uint64_t-variables don't want to shift by 32 bits, what's wrong?

The variable is not shifted to values ​​< 32, but when the shift is stronger, the value is reset to zero. In fact, the variable behaves like a 32-bit variable, but I declare it as unsigned long long int.
What is the reason for this behavior?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maaGames, 2015-05-27
@MayRiv

Here the problem is very tricky. both arguments must be 64bit.
For example:
__int64 a = 1ull << 33; // will work,
__int64 b = 1 << 33; // zero out

P
Psionic, 2015-05-28
@Psionic

In x32, regardless of the type of the arguments, byte shift always returns a type under the size of the register. So if the value has gone beyond x32, then that's it, although an assembler insert can help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question