Exiv2
|
Overflow checker using compiler intrinsics. More...
#include <safe_op.hpp>
Static Public Member Functions | |
static bool | add (T summand_1, T summand_2, T &result) |
Add summand_1 and summand_2 and check for overflows. More... | |
Overflow checker using compiler intrinsics.
This struct provides an add function with the same interface & behavior as fallback_add_overload::add but it relies on compiler intrinsics instead. This version should be considerably faster than the fallback version as it can fully utilize available CPU instructions & the compiler's diagnostic.
However, as some compilers don't provide intrinsics for certain types, the default implementation of add is the version from falback.
The struct is explicitly specialized for each type via #ifdefs for each compiler.
|
inlinestatic |
Add summand_1 and summand_2 and check for overflows.
This is the default add() function that uses fallback_add_overflow<T>::add(). All specializations must have exactly the same interface and behave the same way.
References Safe::add().