This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to divide a 64-bit variable.

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

0