[PATCH] malloc: Improve csize2tidx
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Wed Mar 19 10:17:42 GMT 2025
Hi Cupertino,
>> /* When "x" is from chunksize(). */
>> -# define csize2tidx(x) (((x) - MINSIZE + MALLOC_ALIGNMENT - 1) / MALLOC_ALIGNMENT)
>> +# define csize2tidx(x) (((x) - MINSIZE) / MALLOC_ALIGNMENT)
> Does it make sense to lose precision, considering that all this macros
> will be optimized to a constant value ?
I'm not sure what you mean? Like I said, the idea is to use chunksize_nomask()
in free() and still be sure that only valid sizes are accepted for tcache.
Basically this macro should be as simple and as fast as possible given that it is
used before entering the tcache code.
Cheers,
Wilco
More information about the Libc-alpha
mailing list