[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rtl] "long long" via sprintf()
> long long mynumber = 5123456789; // this is longer than 32-bit long int
> char msg[255];
>
> sprintf(msg, "My number is %lld",mynumber);
> rtl_printf("%s\n", msg);
>
>
> And what I get in /var/log/messages is:
> Jul 3 15:43:17 twister kernel: My number is %ld
>
> ????????
> What am I doing wrong?
> The same code in kernel space with printf() in stead of rtl_printf()
> works well.
I'm a bit confused. Are you sure you have printed a long long
from kernel space?
Kernel space *printf is implemented in linux/lib/vsprintf.c.
Check it. It cannot handle long longs because 32 bit processors can
not divide them naturally. libc version of *printf() calls
64 bit arithmetic library functions.
Gabor