Re: %b with uint64_t?

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
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