[PATCH 2/3] Simplify and inline get_uleb128 and get_sleb128

Petr Machata pmachata at redhat.com
Thu Dec 12 22:23:11 UTC 2013


Josh Stone <jistone at redhat.com> writes:

> On 12/12/2013 04:13 AM, Petr Machata wrote:
>> Josh Stone <jistone at redhat.com> writes:
>>> +static inline uint64_t
>>> +__libdw_get_uleb128 (const unsigned char **addrp)
>>> +{
>>> +  uint64_t acc = 0;
>>> +  get_uleb128_step (acc, *addrp, 0);
>>> +  for (unsigned int i = 1; i < len_leb128(acc); ++i)
>>> +    get_uleb128_step (acc, *addrp, i);
>> 
>> Is there a reason not to use for (i = 0; ...) instead of the pre-step
>> followed by a for (i = 1; ...)?
>
> Ah, yes, I should explain that a little.  I found that the code was
> actually faster with the first step unrolled.

Ah, I think that's fine then, but needs a comment.

Thanks,
PM


More information about the elfutils-devel mailing list