summary refs log tree commit diff stats
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
authorLeonid Bloch <lbloch@janustech.com>2018-11-04 18:07:28 +0000
committerKevin Wolf <kwolf@redhat.com>2018-11-05 15:29:59 +0100
commit1240ac558d348f6c7a5752b1a57c1da58e4efe3e (patch)
tree646948618fb266400864dc894aa5ac0043e7af9f /qemu-io-cmds.c
parent3dd5b8f4718c6ca1eadb16dd67a8cad76455ddb0 (diff)
downloadfocaccia-qemu-1240ac558d348f6c7a5752b1a57c1da58e4efe3e.tar.gz
focaccia-qemu-1240ac558d348f6c7a5752b1a57c1da58e4efe3e.zip
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>
Diffstat (limited to 'qemu-io-cmds.c')
0 files changed, 0 insertions, 0 deletions