Fix 312954 "monkey: on HPUX, special case failure when dividing by -0"

This commit is contained in:
norris%netscape.com 1998-09-10 20:27:16 +00:00
Родитель 0b411ad632
Коммит c7e0b4fd28
3 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -1118,7 +1118,7 @@ js_Interpret(JSContext *cx, jsval *result)
#if JS_HAS_SWITCH_STATEMENT
case JSOP_DEFAULT:
POP();
(void) POP();
/* fall through */
#endif
case JSOP_GOTO:
@ -1661,7 +1661,7 @@ js_Interpret(JSContext *cx, jsval *result)
#if JS_HAS_SWITCH_STATEMENT
case JSOP_CASE:
NEW_EQUALITY_OP(==, JS_FALSE);
POP();
(void) POP();
if (cond) {
len = GET_JUMP_OFFSET(pc);
CHECK_BRANCH(len);
@ -1848,7 +1848,16 @@ js_Interpret(JSContext *cx, jsval *result)
case JSOP_NEG:
POP_NUMBER(cx, d);
#ifdef HPUX
/*
* Negation of a zero doesn't produce a negative
* zero on HPUX. Perform the operation by bit
* twiddling.
*/
JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT;
#else
d = -d;
#endif
PUSH_NUMBER(cx, d);
break;

Просмотреть файл

@ -653,6 +653,16 @@ js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp)
d = *cx->runtime->jsPositiveInfinity;
else if (d == -HUGE_VAL)
d = *cx->runtime->jsNegativeInfinity;
#ifdef HPUX
if (d == 0.0 && negative) {
/*
* "-0", "-1e-2000" come out as positive zero
* here on HPUX. Force a negative zero instead.
*/
JSDOUBLE_HI32(d) = JSDOUBLE_HI32_SIGNBIT;
JSDOUBLE_LO32(d) = 0;
}
#endif
}
free(cstr);

Просмотреть файл

@ -2704,7 +2704,16 @@ js_FoldConstants(JSContext *cx, JSParseNode *pn)
break;
case JSOP_NEG:
#ifdef HPUX
/*
* Negation of a zero doesn't produce a negative
* zero on HPUX. Perform the operation by bit
* twiddling.
*/
JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT;
#else
d = -d;
#endif
break;
case JSOP_POS: