1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

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
This commit is contained in:
drh
2021-01-01 01:44:06 +00:00
parent 85d31b9f37
commit 4fd4a7a1e9
3 changed files with 18 additions and 10 deletions

View File

@@ -1951,6 +1951,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:
**
@@ -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