Re: %b with uint64_t?
- Reply: Dag-Erling_Smørgrav : "Re: %b with uint64_t?"
- In reply to: Bjoern A. Zeeb: "%b with uint64_t?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Feb 2025 16:24:45 UTC
"Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> writes:
> I recently ran into a problem with a uint64_t bitflag to use the %b
> print format in the kernel.
The correct format string to print a uint64_t as binary is %w64b. You
may have to disable -Wformat locally to get it to compile cleanly:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"
printf("%w64b\n", num);
#pragma GCC diagnostic pop
DES
--
Dag-Erling Smørgrav - des@FreeBSD.org