* include/ruby/ruby.h (rb_mul_size_overflow): use UNLIKELY
by user side to improve generallity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5587badf24
commit
973ba3e8e2
@ -1,3 +1,8 @@
|
|||||||
|
Sat Apr 23 16:11:39 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* include/ruby/ruby.h (rb_mul_size_overflow): use UNLIKELY
|
||||||
|
by user side to improve generallity.
|
||||||
|
|
||||||
Sat Apr 23 16:10:02 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
Sat Apr 23 16:10:02 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/ruby.h (RB_LIKELY): use prefix in ruby.h.
|
* include/ruby/ruby.h (RB_LIKELY): use prefix in ruby.h.
|
||||||
|
@ -1628,10 +1628,10 @@ rb_mul_size_overflow(size_t a, size_t b, size_t max, size_t *c)
|
|||||||
{
|
{
|
||||||
#ifdef DSIZE_T
|
#ifdef DSIZE_T
|
||||||
DSIZE_T c2 = (DSIZE_T)a * (DSIZE_T)b;
|
DSIZE_T c2 = (DSIZE_T)a * (DSIZE_T)b;
|
||||||
if (RB_UNLIKELY(c2 > max)) return 1;
|
if (c2 > max) return 1;
|
||||||
*c = (size_t)c2;
|
*c = (size_t)c2;
|
||||||
#else
|
#else
|
||||||
if (b != 0 && RB_UNLIKELY(a > max / b)) return 1;
|
if (b != 0 && a > max / b) return 1;
|
||||||
*c = a * b;
|
*c = a * b;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user