ubyte + ubyte = int

Ali Çehreli acehreli at yahoo.com
Wed Oct 26 21:37:57 UTC 2022


On 10/26/22 14:19, Ali Çehreli wrote:

 >    https://dlang.org/spec/type.html#integer-promotions

Reading "Value Range Propagation" further down that link, I learned that 
e.g. masking 'decimal' with 0xf makes the code compile:

         return ((decimal & 0xf) + ubyte('0'));

         return ((decimal & 0xf) - ubyte(10) + ubyte('A'));

Ali



More information about the Digitalmars-d-learn mailing list