diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-02 01:54:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-02 01:54:17 +0000 |
commit | 610d4dd2e872c2c60b00d5cdb5549c0f8de33266 (patch) | |
tree | 4ca2fecb3d9f65d00b383ba6cad73c3c173b1164 /include/ruby | |
parent | db30e7bb96265861a8e65d6faff724f4e3d27c3f (diff) | |
download | ruby-610d4dd2e872c2c60b00d5cdb5549c0f8de33266.tar.gz |
ruby.h: reduce repeated calcuations
* include/ruby/ruby.h (rb_scan_args_{hash,block}_idx): reduce
repeated index calcuations.
* include/ruby/ruby.h (rb_scan_args_end_idx): unused right now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/ruby.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 64d33434bb..74f7b570c0 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2293,7 +2293,8 @@ ALWAYS_INLINE(static int rb_scan_args_hash_idx(const char *fmt)); static inline int rb_scan_args_hash_idx(const char *fmt) { - return (rb_scan_args_trail_idx(fmt)+rb_scan_args_trail_p(fmt)); + const int idx = rb_scan_args_trail_idx(fmt); + return idx+rb_scan_args_isdigit(fmt[idx]); } ALWAYS_INLINE(static int rb_scan_args_f_hash(const char *fmt)); @@ -2307,7 +2308,8 @@ ALWAYS_INLINE(static int rb_scan_args_block_idx(const char *fmt)); static inline int rb_scan_args_block_idx(const char *fmt) { - return (rb_scan_args_hash_idx(fmt)+rb_scan_args_f_hash(fmt)); + const int idx = rb_scan_args_hash_idx(fmt); + return idx+(fmt[idx]==':'); } ALWAYS_INLINE(static int rb_scan_args_f_block(const char *fmt)); @@ -2317,12 +2319,15 @@ rb_scan_args_f_block(const char *fmt) return (fmt[rb_scan_args_block_idx(fmt)]=='&'); } +# if 0 ALWAYS_INLINE(static int rb_scan_args_end_idx(const char *fmt)); static inline int rb_scan_args_end_idx(const char *fmt) { - return (rb_scan_args_block_idx(fmt)+rb_scan_args_f_block(fmt)); + const int idx = rb_scan_args_block_idx(fmt); + return idx+(fmt[idx]=='&'); } +# endif # define rb_scan_args0(argc, argv, fmt, varc, vars) \ rb_scan_args_set(argc, argv, \ |