incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r465512 - /incubator/stdcxx/trunk/include/bitset.cc
Date Fri, 03 Nov 2006 01:14:25 GMT
Martin Sebor wrote:
> faridz@apache.org wrote:
> 
>> Author: faridz
>> Date: Wed Oct 18 23:53:06 2006
>> New Revision: 465512
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=465512
>> Log:
>> 2006-10-19 Farid Zaripov <faridz@kyiv.vdiweb.com>
>>
>>     STDCXX-297
>>     * bitset.cc (__rw_bitset): Corrected calculation of
>>     size of the __bits buffer
> 
> 
> I think the logic should be factored out into a function,
> say __rw_bits_to_bytes, defined in bitset.cpp.

Or maybe even __rw_bit_clear since, AFAICS, the only thing
the computed value is used for is a call to memset().

Another option would be to change __rw_shl() (as well as
__rw_shr()) to take the number of bits rather than bytes
as their second argument and have them do the computation.
Then we could call __rw_shl() (or __rw_shr()) to quickly
set all the bits to zero by shifting the bitset more than
the number of bits it contains.

Martin

> That will
> allow us to reduce the complexity of the code here (making
> it smaller and faster to compile) while at the same time
> letting us reuse the same logic in the char and wchar_t
> overloads defined in bitset.cpp.
> 
> Martin


Mime
View raw message