libstdc++: Extend memcmp optimization in std::lexicographical_compare

Jonathan Wakely jwakely@redhat.com
Wed Jun 10 17:14:28 GMT 2020


On 10/06/20 18:40 +0200, François Dumont wrote:
>On 10/06/20 4:49 pm, Jonathan Wakely wrote:
>>On 10/06/20 08:18 +0200, François Dumont via Libstdc++ wrote:
>>>On 09/06/20 10:53 pm, Jonathan Wakely wrote:
>>>>This reminds me that I was going to extend the condition for using
>>>>memcmp to also apply to unsigned integers with sizeof(T) > 1 on big
>>>>endian targets.
>>>>
>>>This illustrates what I tried to avoid in my original patch, the 
>>>code duplication. I was calling __lexicographical_compare_aux1 
>>>because I didn't want to duplicate the code to compute __simple.
>>>
>>>Of course it can be expose as a template using.
>>
>>Not for C++98.
>>
>>I'm not very concerned about duplicating the boolean condition. I
>>definitely prefer that to codegen changes that affect every user of
>>lexicographical_compare just to benefit the handful of people using
>>it with std::deque.
>>
>>If __lexicographical_compare_aux1 could be reused without changes,
>>great, but it needed changes with consequences for more code than just
>>deque iterators.
>>
>>
>That's fine with me, the patch looks good.
>
>Do you want me to get rid of the enable_if usage before the commit ?
>
>Otherwise I let you commit it ?

I've pushed it to master now.



More information about the Libstdc++ mailing list