Mill Computing, Inc. › Forums › The Mill › Architecture › Pipelining › Reply To: Pipelining
First, just curious why you’d need literals? How is the binary representation of a 64 saturating int different from a 64 int?
Second, C++ operator overloading lets you deal correctly with X+Y
, X+1
and 1+X
. The only case missing is 1+1
, and at least for saturation, the cases where it matters are few and can be spelled out explicitly e.g. with sat64(1)+sat64(1)
.
Finally, C++11 introduced user-defined literals which are I believe almost exactly what you ask for, see http://en.cppreference.com/w/cpp/language/user_literal.