diff options
Diffstat (limited to 'gcc/hwint.c')
-rw-r--r-- | gcc/hwint.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/hwint.c b/gcc/hwint.c index a128dc134f9..533133c7b4d 100644 --- a/gcc/hwint.c +++ b/gcc/hwint.c @@ -109,6 +109,14 @@ abs_hwi (HOST_WIDE_INT x) return x >= 0 ? x : -x; } +/* Compute the absolute value of X as an unsigned type. */ + +unsigned HOST_WIDE_INT +absu_hwi (HOST_WIDE_INT x) +{ + return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x; +} + /* Compute the greatest common divisor of two numbers A and B using Euclid's algorithm. */ |