Wrong list, sorry


-------- Original Message -------- Subject: PATCH: operator precedence test and some wordsize stuff Date: Wed, 25 Feb 2004 12:03:27 +0100 From: [EMAIL PROTECTED] (Ard Biesheuvel) To: [EMAIL PROTECTED] Newsgroups: php.zend-engine.cvs Followup-To: php.dev


-- Ard
Index: Zend/zend_constants.h
===================================================================
RCS file: /repository/ZendEngine2/zend_constants.h,v
retrieving revision 1.29
diff -u -r1.29 zend_constants.h
--- Zend/zend_constants.h       23 Jan 2004 03:28:59 -0000      1.29
+++ Zend/zend_constants.h       25 Feb 2004 10:59:57 -0000
@@ -27,7 +27,7 @@
 #define CONST_CS                               (1<<0)                          /* 
Case Sensitive */
 #define CONST_PERSISTENT               (1<<1)                          /* Persistent 
*/
 
-#define        PHP_USER_CONSTANT LONG_MAX      /* a constant defined in user space */
+#define        PHP_USER_CONSTANT INT_MAX       /* a constant defined in user space */
 
 typedef struct _zend_constant {
        zval value;
Index: Zend/zend_operators.c
===================================================================
RCS file: /repository/ZendEngine2/zend_operators.c,v
retrieving revision 1.176
diff -u -r1.176 zend_operators.c
--- Zend/zend_operators.c       22 Feb 2004 20:02:26 -0000      1.176
+++ Zend/zend_operators.c       25 Feb 2004 10:59:57 -0000
@@ -33,8 +33,6 @@
 #include "ext/bcmath/number.h"
 #endif
 
-#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
-
 ZEND_API int zend_atoi(const char *str, int str_len)
 {
        int retval;
@@ -678,8 +676,8 @@
                long lval = op1->value.lval + op2->value.lval;
                
                /* check for overflow by comparing sign bits */
-               if ( (op1->value.lval & LONG_SIGN_MASK) == (op2->value.lval & 
LONG_SIGN_MASK) 
-                       && (op1->value.lval & LONG_SIGN_MASK) != (lval & 
LONG_SIGN_MASK)) {
+               if ( (op1->value.lval & LONG_MIN) == (op2->value.lval & LONG_MIN) 
+                       && (op1->value.lval & LONG_MIN) != (lval & LONG_MIN)) {
 
                        result->value.dval = (double) op1->value.lval + (double) 
op2->value.lval;
                        result->type = IS_DOUBLE;
@@ -718,8 +716,8 @@
                long lval = op1->value.lval - op2->value.lval;
                
                /* check for overflow by comparing sign bits */
-               if ( (op1->value.lval & LONG_SIGN_MASK) != (op2->value.lval & 
LONG_SIGN_MASK) 
-                       && (op1->value.lval & LONG_SIGN_MASK) != (lval & 
LONG_SIGN_MASK)) {
+               if ( (op1->value.lval & LONG_MIN) != (op2->value.lval & LONG_MIN) 
+                       && (op1->value.lval & LONG_MIN) != (lval & LONG_MIN)) {
 
                        result->value.dval = (double) op1->value.lval - (double) 
op2->value.lval;
                        result->type = IS_DOUBLE;
Index: Zend/zend_operators.h
===================================================================
RCS file: /repository/ZendEngine2/zend_operators.h,v
retrieving revision 1.86
diff -u -r1.86 zend_operators.h
--- Zend/zend_operators.h       20 Feb 2004 08:03:27 -0000      1.86
+++ Zend/zend_operators.h       25 Feb 2004 10:59:57 -0000
@@ -34,7 +34,7 @@
 #include "ext/bcmath/libbcmath/src/bcmath.h"
 #endif
 
-#define MAX_LENGTH_OF_LONG 18
+#define MAX_LENGTH_OF_LONG 20
 #define MAX_LENGTH_OF_DOUBLE 32
 
 BEGIN_EXTERN_C()
Index: Zend/tests/zend_operators.phpt
===================================================================
RCS file: Zend/tests/zend_operators.phpt
diff -N Zend/tests/zend_operators.phpt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ Zend/tests/zend_operators.phpt      25 Feb 2004 10:59:57 -0000
@@ -0,0 +1,12 @@
+--TEST--
+Operator precedence
+--FILE--
+<?php /* $Id$ */
+
+var_dump((object)1 instanceof stdClass);
+var_dump(! (object)1 instanceof Exception);
+
+?>
+--EXPECT--
+bool(true)
+bool(true)


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to