Suggested by @llllllllll, use the compiler-optimized routines for safe integer arithmetic, setting the failed result to nil. For example:
x = ...;
y = ...;
if (__builtin_add_overflow(x, y, &z)) {
z = nil_value;
}
This would require a significant change to the interpreter's math routines. The current set-up is portable, generic, and fast. We would need this to operate across Clang, GCC, and Visual Studio.
There could be a "debug" mode for Empirical in the future, which would abort when overflow occurs rather than return a nil.
Suggested by @llllllllll, use the compiler-optimized routines for safe integer arithmetic, setting the failed result to
nil
. For example:This would require a significant change to the interpreter's math routines. The current set-up is portable, generic, and fast. We would need this to operate across Clang, GCC, and Visual Studio.
There could be a "debug" mode for Empirical in the future, which would abort when overflow occurs rather than return a
nil
.