зеркало из https://github.com/github/ruby.git
* time.c (long_mul): overflow condition changed.
(wi_mul): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d245582dcb
Коммит
e758c3fbce
|
@ -1,3 +1,8 @@
|
|||
Thu Apr 1 04:30:11 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* time.c (long_mul): overflow condition changed.
|
||||
(wi_mul): ditto.
|
||||
|
||||
Wed Mar 31 23:33:29 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* time.c (long_mul): extracted from mul and avoid integer overflow.
|
||||
|
|
8
time.c
8
time.c
|
@ -103,8 +103,8 @@ long_mul(long x, long y, long *z)
|
|||
else {
|
||||
b = (unsigned long)y;
|
||||
}
|
||||
c = a * b;
|
||||
if (c / b == a) {
|
||||
if (a <= ULONG_MAX / b) {
|
||||
c = a * b;
|
||||
if (s < 0) {
|
||||
if (c <= (unsigned long)LONG_MAX + 1) {
|
||||
*z = -(long)c;
|
||||
|
@ -478,8 +478,8 @@ wi_mul(wideint_t x, wideint_t y, wideint_t *z)
|
|||
else {
|
||||
b = (uwideint_t)y;
|
||||
}
|
||||
c = a * b;
|
||||
if (c / b == a) {
|
||||
if (a <= UWIDEINT_MAX / b) {
|
||||
c = a * b;
|
||||
if (s < 0) {
|
||||
if (c <= (uwideint_t)WIDEINT_MAX + 1) {
|
||||
*z = -(wideint_t)c;
|
||||
|
|
Загрузка…
Ссылка в новой задаче