qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v10 2/9] include: Add a lookup table of sizes


From: Leonid Bloch
Subject: Re: [Qemu-devel] [PATCH v10 2/9] include: Add a lookup table of sizes
Date: Mon, 24 Sep 2018 16:42:54 +0000

On 9/24/18 5:09 PM, Eric Blake wrote:
> On 9/21/18 12:23 PM, Leonid Bloch wrote:
>> Adding a lookup table for the powers of two, with the appropriate size
>> prefixes. This is needed when a size has to be stringified, in which
>> case something like '(1 * KiB)' would become a literal '(1 * (1L << 10))'
>> string. Powers of two are used very often for sizes, so such a table
>> will also make it easier and more intuitive to write them.
> 
> Would it be better to provide a generic util function that takes an 
> arbitrary runtime value and converts it to a human-readable form?
> 

The problem is that the srtingification happens at compile time, and the 
literal string is written to qcow2.o (the default value). From here 
comes the need for this table. And the added benefit of it are more 
concise size notations for power-of-two sizes.

Leonid.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]