Hi,
I'm using the Keil uVision compiler.
I would like to work with 64-bit values. I declare myVar as unsigned long long;
By some calculation myVar contains a value greater than 2^32 for example 0x0000 0131 2BCE D300.
If I divide it by 2 (or 0x2, or 2L) like 'myVar/=2;' then only the lowest 32-bits are divided. So: invalid result: 0x0000 0131 95E7 6980 should be : 0x0000 0098 95E7 6980
How can a solve this?
thanks,
Henk
Sounds like a bug you have to send to Keil support.
uVision is not a compiler.
uVision is a front-end which is used with one (or more) of Keil's compilers: C51, C215, C166 or ARM.
You need to specify which actual compiler(s) you are using.
Does the documentation for whichever compiler(s) you are using state that it/they support 64-bit variables?
If the compiler can store 64-bit variables, it should also be able to divide 64-bit variables.
Indeed it should, and FAIK the only Keil compiler that even claims to support it is for ARM.
This could also be optimization, i.e. the compiler may have determined that the upper part of the quotient is never used. We should see a more complete code sample before reaching any conclusions.