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

Jonathan Wakely jwakely@redhat.com
Wed Jun 10 14:49:05 GMT 2020


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.




More information about the Libstdc++ mailing list