Here are the slides of a nice talk, "Removing undefined behavior from integer operations: the bounded::integer library":
This may be a good start:
https://github.com/nordlow/justd/blob/master/bound.d
Here are the slides of a nice talk, "Removing undefined behavior from integer operations: the bounded::integer library":
This may be a good start:
https://github.com/nordlow/justd/blob/master/bound.d