include: Add a comment to explain the origin of sizes' lookup table
commit1240ac558d348f6c7a5752b1a57c1da58e4efe3e
authorLeonid Bloch <lbloch@janustech.com>
Sun, 4 Nov 2018 18:07:28 +0000 (4 18:07 +0000)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Nov 2018 14:29:59 +0000 (5 15:29 +0100)
tree646948618fb266400864dc894aa5ac0043e7af9f
parent3dd5b8f4718c6ca1eadb16dd67a8cad76455ddb0
include: Add a comment to explain the origin of sizes' lookup table

The lookup table for power-of-two sizes was added in commit 540b8492618eb
for the purpose of having convenient shortcuts for these sizes in cases
when the literal number has to be present at compile time, and
expressions as '(1 * KiB)' can not be used. One such case is the
stringification of sizes. Beyond that, it is convenient to use these
shortcuts for all power-of-two sizes, even if they don't have to be
literal numbers.

Despite its convenience, this table introduced 55 lines of "dumb" code,
the purpose and origin of which are obscure without reading the message
of the commit which introduced it. This patch fixes that by adding a
comment to the code itself with a brief explanation for the reasoning
behind this table. This comment includes the short AWK script that
generated the table, so that anyone who's interested could make sure
that the values in it are correct (otherwise these values look as if
they were typed manually).

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
include/qemu/units.h