1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the OK_IF_ALWAYS_TRUE() and OK_IF_ALWAYS_FALSE() macros for marking

conditionals that improve performance but do not change the outcome.

FossilOrigin-Name: 6035c9b2728f47d338696978eb6fe5a7d6cb84bbea0792ef985c0986ac8f39dd
This commit is contained in:
drh
2017-10-02 21:29:51 +00:00
parent 3ee1416b68
commit 2f65b2f512
5 changed files with 27 additions and 11 deletions

View File

@@ -446,6 +446,21 @@
# define NEVER(X) (X)
#endif
/*
** Some conditionals are optimizations only. In other words, if the
** conditionals are replaced with a constant 1 (true) or 0 (false) then
** the correct answer is still obtained, though perhaps not as quickly.
**
** The following macros mark these optimizations conditionals.
*/
#if defined(SQLITE_MUTATION_TEST)
# define OK_IF_ALWAYS_TRUE(X) (1)
# define OK_IF_ALWAYS_FALSE(X) (0)
#else
# define OK_IF_ALWAYS_TRUE(X) (X)
# define OK_IF_ALWAYS_FALSE(X) (X)
#endif
/*
** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
** defined. We need to defend against those failures when testing with