printf int64


#1

What is the correct prefix to use? I’ve tried llx but it does not appear to be work.

typedef unsigned long long int uint64_t


#2

LL (uppercase) :question:


#3

After some testing, it appears that int64 are clearly badly process by xprintf functions, whatever is the used compiler. GCC seems to simply ignore the 32 MSB and considers int64 as int32…
However, tests show that this is a bad xprintf behaviour only (i.e. int64 are correctly supported anywhere else).

We are investigating on the issue, trying to make back sprintf functional on this topic (o r at least provide a workaround).


#4

I’m sure i’ve printed 64-bit (long-long) values from Open-AT before - I’ll have to dig back and check…


#5

Please do so… any clue is welcome…


#6

I am using 64bit integers without any issues in my code. I use lld with *printf.

I am however not using GCC. The ARM ADS compiler, while really old, still works fine.

Edit: For some reason, the forum absolutely refuses to accept my sprintf example.


#7

See: https://forum.sierrawireless.com/t/forum-broken/4278/1
And: https://forum.sierrawireless.com/t/technical-issues-after-forum-revamping/4287/1


#8

Hmmm… it appears that I never actually printed them.

Ho-hum.


#9

Beware that it may appear to work; it’s the parameter after the int64 that doesn’t get printed properly.

I’ve used an (int) typecast for now.


#10
char out[20];
out[0]=0;
long long num=12232354532;
for(;num;)
{
memove(&out[1],out,sizeof(out)-1);
out[0]='0'+(num%10);
num/=10;
}

#11

I hate this forum tbh, can’t post anything longer than 30 chars…


#12

But yea, something like the above should work if converting to string is the idea


#13

See my earlier post - there are currently known bugs in the forum:

See: https://forum.sierrawireless.com/t/forum-broken/4278/1
And: https://forum.sierrawireless.com/t/technical-issues-after-forum-revamping/4287/1

IME, it’s specific characters that the forum dislikes - not a length limit…


#14

workaround seems to be to use https


#15

See: https://forum.sierrawireless.com/t/forum-broken/4278/22


#16

Well, in my code now I have

%.15lld - %.15lld

and both get printed correctly (with ARM ADS compiler).