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

Add likely() and unlikely() macros to the header file. They are not

yet used for anything. (CVS 4562)

FossilOrigin-Name: 485add38a1ef224732575f9998f06466dcc9742d
This commit is contained in:
drh
2007-11-27 02:38:00 +00:00
parent 454ad58c3f
commit b6dbc00078
3 changed files with 23 additions and 8 deletions

View File

@@ -11,11 +11,26 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.619 2007/11/26 22:54:27 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.620 2007/11/27 02:38:01 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
/*
** The macro unlikely() is a hint that surrounds a boolean
** expression that is usually false. Macro likely() surrounds
** a boolean expression that is usually true. GCC is able to
** use these hints to generate better code, sometimes.
*/
#if defined(__GNUC__)
# define likely(X) __builtin_expect((X),1)
# define unlikely(X) __builtin_expect((X),0)
#else
# define likely(X) !!(X)
# define unlikely(X) !!(X)
#endif
/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it. If the OS lacks