On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote:
Is there a solution that results the same static optimizations, but has no runtime penalty, i.e. the functions just operates with ints? (At least when compiled)
Did you try looking at assembly generated by GDC or LDC with full optimizations? For example GDC does quite better than DMD for the proposed SafeInt type:
https://github.com/D-Programming-Language/phobos/pull/3389#issuecomment-119005595