Walter Bright:

Why aren't functions with ubyte/byte/short/ushort arguments included?


Here Lionello Lunesu has suggested a __traits(valueRange, <expression>) for built-in values:$1254$

Once such trait is working on checkedint values, can this help the compiler remove some useless tests and increase the performance of checked ints?

it can be used to implement multi-precision integer arithmetic types.

It looks very useful for the "small value optimization" for BigIntegers, to not allocate on the heap when the numbers are small, and switch to the heap allocation when they grow.

If you use such improved bigintegers to write code that is not supposed to overflow the range of normal integers, you obtain code that is only moderately slower than using checkedints, but it also gives the correct results if some overflow has occurred :-)


Reply via email to