Exiv2
|
Overload of fallback_add_overflow for unsigned integers. More...
#include <safe_op.hpp>
Static Public Member Functions | |
static bool | add (T summand_1, T summand_2, T &result) |
Adds the two summands only if no overflow occurs. More... | |
Overload of fallback_add_overflow for unsigned integers.
|
inlinestatic |
Adds the two summands only if no overflow occurs.
This function performs a check if summand_1 + summand_2 would overflow and returns true in that case. If no overflow occurs, the sum is saved in result and false is returned.
Further information: https://wiki.sei.cmu.edu/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap