[ipxe-devel] %lld format patch

James Harper james at ejbdigital.com.au
Wed Nov 4 09:35:48 UTC 2015

> On 04/11/15 08:24, James Harper wrote:
> > The following trivial patch adds support for %lld printf format. Currently,
> %lld will only take a 32 bit parameter from the stack which doesn't give the
> right answer and throws out the rest of the parameter list.
> Even with this patch, the upper 32 bits (on a 32-bit platform) will be
> discarded when passed to format_decimal().
> vsprintf.c currently deliberately omits support for %lld in order to
> avoid needing to drag in the support for 64-bit divisions.  I note that
> there is (my) code in time.c, ocsp.c and x509.c which erroneously uses
> %lld in debug messages to display seconds since the Epoch.

Ah. I assumed that because %llx was in there, %lld would also work, and noted that %lld was used by a bunch of DBG statements. %llx presumably shifts rather than divides though.

> I would be tempted to amend these debug messages to use %#llx, rather
> than adding either incomplete or partial support for %lld, but I'm open
> to argument here.  What's your use case for %lld?

I am sending the lba as a text string (part of the path retrieved by tftp)


More information about the ipxe-devel mailing list