diff options
author | drh <drh@noemail.net> | 2021-01-01 01:44:06 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2021-01-01 01:44:06 +0000 |
commit | 4fd4a7a1e91b6fca1aa7546cd537001c736f655f (patch) | |
tree | f89c964791947d6f176d10bd4cc9278ea8e3bf7e /src/func.c | |
parent | 85d31b9f3757016e4dc1b6e5f74fa14ad834aa96 (diff) | |
download | sqlite-4fd4a7a1e91b6fca1aa7546cd537001c736f655f.tar.gz sqlite-4fd4a7a1e91b6fca1aa7546cd537001c736f655f.zip |
Do not attempt to take a pointer to the ceil() and floor() functions as
those routines are intrinsics on some versions of MSVC.
FossilOrigin-Name: e5d7209e118a84537a85c0c9cd2b7ca4cd6ccf04181dc840b19339b4c93840cd
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/func.c b/src/func.c index e91fc256c..6cd9fdce6 100644 --- a/src/func.c +++ b/src/func.c @@ -1952,6 +1952,14 @@ static void ceilingFunc( } /* +** On some systems, ceil() and floor() are intrinsic function. You are +** unable to take a pointer to this functions. Hence, we here wrap them +** in our own actual functions. +*/ +static double xCeil(double x){ return ceil(x); } +static double xFloor(double x){ return floor(x); } + +/* ** Implementation of SQL functions: ** ** ln(X) - natural logarithm @@ -2211,9 +2219,9 @@ void sqlite3RegisterBuiltinFunctions(void){ FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), #ifdef SQLITE_ENABLE_MATH_FUNCTIONS - MFUNCTION(ceil, 1, ceil, ceilingFunc ), - MFUNCTION(ceiling, 1, ceil, ceilingFunc ), - MFUNCTION(floor, 1, floor, ceilingFunc ), + MFUNCTION(ceil, 1, xCeil, ceilingFunc ), + MFUNCTION(ceiling, 1, xCeil, ceilingFunc ), + MFUNCTION(floor, 1, xFloor, ceilingFunc ), #if SQLITE_HAVE_C99_MATH_FUNCS MFUNCTION(trunc, 1, trunc, ceilingFunc ), #endif |