sub_of3
Subtract two integers, check for arithmetic overflow
Usage
#include <libowfat/rangecheck.h>
int sub_of(dest,a,b);
Overview
If calculating a-b is possible without causing undefined behavior or an arithmetic overflow in C, and the result fits into the destination integer type, do dest=a-b and return 0.
Otherwise, return 1.
Note: This is a macro, so dest does not have to be a pointer.
Releases
Unchanged in 2 releases since Debian 12 (Bookworm).