qemu-devel
[Top][All Lists]
Advanced

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

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


From: Leonid Bloch
Subject: Re: [Qemu-devel] [PATCH 1/1] include: Auto-generate the sizes lookup table
Date: Thu, 3 Jan 2019 20:57:45 +0000

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 / 100)) -eq 0 ] && pad='  '
>> +        [ $((n / 10)) -eq 0 ] && pad='   '
>> +        local suff=$((p / 10))
>> +        printf "#define S_%u%s%s%20u\n" ${n} "$(size_suffix ${suff})" \
>> +            "${pad}" $((1 << p))
>> +        p=$((p + 1))
>> +    done
>> +}
> 
> 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 easily verifiable, 
whereas if someone would like to verify the table, they will need to 
generate it themselves. Also, this table is automatically generated 
anyway, so it only makes sense to generate it during the build.


Leonid.

> 
> Berto
> 

reply via email to

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