diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-22 11:27:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-22 11:27:46 +0000 |
commit | 4c4d0389f53d9dbda6959e28c61a12c6e4f509cc (patch) | |
tree | 585f4d19c3a2e31384d17dfd9bf388c1855f9d48 /include | |
parent | c44360f62316f629441af47213a6c22ae1c3606b (diff) | |
download | ruby-4c4d0389f53d9dbda6959e28c61a12c6e4f509cc.tar.gz |
ruby.h: ASSUME
* include/ruby/ruby.h (ASSUME): hint for optimization, the
expression is assumed to be true always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/ruby.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index a27fc5d637..bad0b3f1cc 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -41,8 +41,15 @@ extern "C" { #ifndef NOINLINE # define NOINLINE(x) x #endif +#ifndef ASSUME +# ifdef UNREACHABLE +# define ASSUME(x) (LIKELY(!!(x)) ? (void)0 : UNREACHABLE) +# else +# define ASSUME(x) ((void)0) +# endif +#endif #ifndef UNREACHABLE -# define UNREACHABLE /* unreachable */ +# define UNREACHABLE ((void)0) /* unreachable */ #endif #ifdef __GNUC__ |