In C99 we have fixed-size integer types, defined in stdint.h. In stdlib.h we have the abs and div functions which operate on ints, as well as their long int/long long int counterparts labs, llabs, ldiv, lldiv.
Since the size of int/long/long long varies based on platform and used compiler I wonder how to chose the right variant of abs/div when using fixed-size integers like int16_t, int32_t or int64_t?
Assuming, that you are able to use a C11 compiler, you could use Generic macros feature and define wrapper, that covers fixed-size integers. An example might look like:
The trick is that these fixed-size integers are just type definitions for standard integer types.