[PATCH 1/4] libstdc++: More efficient date from days.

Jonathan Wakely jwakely@redhat.com
Thu Feb 25 16:57:59 GMT 2021


On 25/02/21 14:19 +0000, Jonathan Wakely wrote:
>On 25/02/21 14:02 +0000, Jonathan Wakely wrote:
>>On 25/02/21 13:46 +0000, Cassio Neri via Libstdc++ wrote:
>>>Hi Jonathan,
>>>
>>>The issue is that I didn't cast __dp.count() to uint32_t:
>>>
>>>-      const auto __r0 = __dp.count() + __r2_e3;
>>>+      const auto __r0 = static_cast<uint32_t>(__dp.count()) + __r2_e3;
>>>
>>>The above would be a better fix. Indeed, __r0 belongs to [0, 2^32[ which allows
>>>all arithmetics that follow to be performed on uint32_t values. For performance
>>>this is better than using signed integers.
>>
>>OK, I'll make that change shortly, thanks.
>
>We still need to cast to int for the return value though, because
>converting from uint32_t to int is still narrowing.

I've committed this now.

Tested powerpc64le-linux, committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210225/c6b2b9b6/attachment-0001.bin>


More information about the Libstdc++ mailing list