diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index b070bd6ae..05934c460 100644 --- a/src/util.c +++ b/src/util.c @@ -1138,3 +1138,13 @@ int sqlite3MulInt64(i64 *pA, i64 iB){ *pA = r; return 0; } + +/* +** Compute the absolute value of a 32-bit signed integer, of possible. Or +** if the integer has a value of -2147483648, return +2147483647 +*/ +int sqlite3AbsInt32(int x){ + if( x>=0 ) return x; + if( x==0x80000000 ) return 0x7fffffff; + return -x; +} |