Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-04 Thread Leonid Bloch
On 1/4/19 12:31 PM, Alberto Garcia wrote: > On Thu 03 Jan 2019 10:42:30 PM CET, Eric Blake wrote: > >> In my view, code generators make sense when used on code that is >> expected to change over time (a good example is QAPI because we add >> new commands every release; other places might be a

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-04 Thread Alberto Garcia
On Thu 03 Jan 2019 10:42:30 PM CET, Eric Blake wrote: > In my view, code generators make sense when used on code that is > expected to change over time (a good example is QAPI because we add > new commands every release; other places might be a generator to help > deal with syscall handlers since

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Eric Blake
On 1/3/19 3:21 PM, Leonid Bloch wrote: > Hi, > > On 1/4/19 12:04 AM, Eric Blake wrote: >> On 1/3/19 2:57 PM, Leonid Bloch wrote: >> I have to say that I'm not very convinced of the benefits of replacing a set of trivial numeric macros with a longer and harder to read shell script

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Leonid Bloch
Hi, On 1/4/19 12:04 AM, Eric Blake wrote: > On 1/3/19 2:57 PM, Leonid Bloch wrote: > >>> I have to say that I'm not very convinced of the benefits of replacing a >>> set of trivial numeric macros with a longer and harder to read shell >>> script accompanied by changes to the build system. >> >>

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Leonid Bloch
Hi Phil, Thanks for your review! Very valid points. All taken, except the naming (I think "pow2_sizes.h" would be better than "lookup_table_sizes.h", no?) and the "generated" directory - I agree that it's a good idea, but I think it requires a separate patch which moves the generated files

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Eric Blake
On 1/3/19 2:57 PM, Leonid Bloch wrote: >> I have to say that I'm not very convinced of the benefits of replacing a >> set of trivial numeric macros with a longer and harder to read shell >> script accompanied by changes to the build system. > > I think that the benefit is that the script is

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Leonid Bloch
Hi Berto, On 1/3/19 12:19 PM, Alberto Garcia wrote: > On Wed 02 Jan 2019 12:09:05 PM CET, Leonid Bloch wrote: >> +print_sizes() { >> +local p=10 >> +while [ ${p} -lt 64 ] >> +do >> +local pad=' ' >> +local n=$((p % 10)) >> +n=$((1 << n)) >> +[ $((n /

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Alberto Garcia
On Wed 02 Jan 2019 12:09:05 PM CET, Leonid Bloch wrote: > +print_sizes() { > +local p=10 > +while [ ${p} -lt 64 ] > +do > +local pad=' ' > +local n=$((p % 10)) > +n=$((1 << n)) > +[ $((n / 100)) -eq 0 ] && pad=' ' > +[ $((n / 10)) -eq 0 ] &&

Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-03 Thread Philippe Mathieu-Daudé
Hi Leonid, On 1/2/19 12:09 PM, Leonid Bloch wrote: > The lookup table for power-of-two sizes is now auto-generated during the > build, and not hard-coded into the units.h file. > This partially reverts commit 540b8492618eb. > Signed-off-by: Leonid Bloch > --- > .gitignore | 1 + >

[Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table

2019-01-02 Thread Leonid Bloch
The lookup table for power-of-two sizes is now auto-generated during the build, and not hard-coded into the units.h file. Signed-off-by: Leonid Bloch --- .gitignore | 1 + Makefile | 5 +++ block/qcow2.h| 2 +- block/vdi.c | 1 + include/qemu/units.h |