A strange div bug on Linux x86_64, (both dmd & ldc2): long -5000 / size_t 2 = 9223372036854773308

Timon Gehr timon.gehr at gmx.ch
Thu Aug 13 23:20:40 UTC 2020

On 13.08.20 21:40, mw wrote:
> On Thursday, 13 August 2020 at 19:24:11 UTC, Tove wrote:
>> One should always use unsigned whenever possible as it generates 
>> better code, many believe factor 2 is simply a shift, but not so on 
>> signed.
> I'm fine with that. In many area of the language design, we need to make 
> a choice between:  correctness v.s. raw performance.

This is not such a case. There is no good reason to round signed integer 
division towards zero.

More information about the Digitalmars-d mailing list