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.