Is there a way to store the absolute value of a signed value into an unsigned type of the same size? I don't want to use a larger type, because this is a template function that will need to work with all integral types (including the largest type).

For example, this doesn't work because 128 would overflow int8_t. It would work if we allow automatic promotions, but that's not an option for larger types.
Code:
int8_t x = -128;
int8_t neg_x = -x;
uint8_t abs_x = neg_x;
Thanks