Use `SCM_LIKELY ()' and `SCM_UNLIKELY ()' instead of rolling our own.
[guile-r6rs-libs.git] / src / utils.h
blob6d48decfa2798233cadd805b047fe5701c7045c7
1 /* Guile-R6RS-Libs --- Implementation of R6RS standard libraries.
2 Copyright (C) 2007, 2009 Ludovic Courtès <ludo@gnu.org>
4 Guile-R6RS-Libs is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 Guile-R6RS-Libs is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with Guile-R6RS-Libs; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18 #ifndef GUILE_R6RS_UTILS_H
19 #define GUILE_R6RS_UTILS_H
21 /* Common utilities. */
23 /* `SCM_LIKELY ()' and `SCM_UNLIKELY ()' appeared sometime during the Guile
24 1.8 release series. */
26 #ifndef SCM_LIKELY
27 # ifdef __GNUC__
28 # define SCM_LIKELY(_cond) (__builtin_expect (!!(_cond), 1))
29 # define SCM_UNLIKELY(_cond) (__builtin_expect ((_cond), 0))
30 # else
31 # define SCM_LIKELY(_cond) (_cond)
32 # define SCM_UNLIKELY(_cond) (_cond)
33 # endif
34 #endif
36 #endif
38 /* arch-tag: 878d0655-2504-4154-bf27-fab06652ebd5