This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [v3] __pool_alloc rework


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.


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