This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bz1311954 - multilib variations in LC_COLLATE files, with fixes


On 3/20/19 4:36 PM, Rafal Luzynski wrote:
20.03.2019 19:25 DJ Delorie <dj@redhat.com> wrote:
/* Same as above, but without extra chance of overflow */
   elem_size = next_prime (elem_size + (elem_size>>2) + (elem_size>>3));

If it does not have to be exactly 1.4 then what about:

   elem_size = next_prime (elem_size + elem_size / 2);

which is 1.5?

I vote for the >> version *and* using 1.5, which simplifies
the equation to:

elem_size = next_prime (elem_size + elem_size >> 2);

It is also the optimal number for reusing recently freed
and coalesced blocks of similar sizes from malloc via
realloc.

--
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]