I have a problem initializing variables of type long long.
Normally this should work:
long long x = 0x428A2F98D728AE22LL;
but when I compile I get the following error: C2704: Illegal number
Is this not supported by CW compiler or am I doing something wrong ?
Thanks in advance!
I believe neither the HCS08 nor the HCS12 Codewarrior supports C99. If you need to use C99 features, the first thing you should do is to get a C99 compiler.
Hello,
yes, 64bit integers are not supported. long long is supported with 32bit max.
Anyway, doing 64bit math with a HCS08 or HCS12 will be rather a performance bottleneck.
So if you are using a 8 or 16bit processor for 64bit math, you might use the wrong cpu for it.
BK
Let me just see it I got this right.
Even if I manage to initialize the variable in another way, operations on that variable will only affect the lower 32 bits ?
Hello,
Your variable could be treated as an array of two double words, four words, or eight bytes, or maybe a union of all three to provide greater flexibility. Arithmetic operations would then need to be performed on the individual array elements.
Regards,
Mac
sizeof(long long) will return 4, means it occupies 4 bytes (32bit) in memory. You will only have 32bit available.
An alternative would be to use/implement a software library, with something like
int64_t Add64(int64_t, int64_t);
I did not check, but maybe things like that is already awailable as open source.
BK
What if lossless 64bit computation is required one or few times per second? Even 4-bits MCU can do it.