[v3] __pool_alloc rework

Paolo Carlini pcarlini@suse.de
Fri Jun 18 19:54:00 GMT 2004


Paolo Carlini wrote:

>>> !   __pool_base::_Obj* volatile*
>>> !   __pool_base::_M_get_free_list(size_t __bytes)
>>> !   { !     size_t __i = ((__bytes + (size_t)_S_align - 1) / 
>>> (size_t)_S_align - 1);
>>> !     return _S_free_list + __i - 1;
>>> !   }
>>>
>>> Are you sure about the final '- 1'??? If I'm not mistaken, 
>>> _M_get_free_list replaces the previous _S_free_list + _S_freelist_index
>>>   
>>
>> Yes. In the above, __i is always >= 1, even for __bytes == 0 or 1.
>> Seemed odd, to have one of the free lists unused. Maybe I'm missing
>> something?
>
> Well, if __bytes == 1 then __i is definitely zero.

More generally, __bytes < _S_align + 1 => __i == 0.

Paolo.



More information about the Libstdc++ mailing list