com php-src: Fix allocator for 64bit zend_long with 3 2bit long: Zend/zend_alloc.c Zend/zend_multiply .h

From: Date: Thu, 16 Oct 2014 10:42:23 +0000
Subject: com php-src: Fix allocator for 64bit zend_long with 3 2bit long: Zend/zend_alloc.c Zend/zend_multiply .h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82370@lists.php.net to get a copy of this message
Commit: 53a8584123f359c2c32f1869d98e4dd9e0a7a6ab Author: Nikita Popov <nikic@php.net> Thu, 16 Oct 2014 12:38:44 +0200 Parents: 876965d20a53d06fbe61e887f6f0c74b6a36d5ec Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=53a8584123f359c2c32f1869d98e4dd9e0a7a6ab Log: Fix allocator for 64bit zend_long with 32bit long Changed paths: M Zend/zend_alloc.c M Zend/zend_multiply.h Diff: diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f5ffb64..bae723f 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -482,7 +482,11 @@ static void zend_mm_munmap(void *addr, size_t size) static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset) { #if defined(__GNUC__) +# if SIZEOF_ZEND_LONG == SIZEOF_LONG return __builtin_ctzl(~bitset); +# else + return __builtin_ctzll(~bitset); +# endif #elif defined(_WIN32) unsigned long index; @@ -519,7 +523,11 @@ static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset) static zend_always_inline int zend_mm_bitset_ntz(zend_mm_bitset bitset) { #if defined(__GNUC__) +# if SIZEOF_ZEND_LONG == SIZEOF_LONG return __builtin_ctzl(bitset); +# else + return __builtin_ctzll(bitset); +# endif #elif defined(_WIN32) unsigned long index; diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index ad874ba..6dce8fb 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -117,7 +117,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow) { size_t res = nmemb; - zend_ulong m_overflow = 0; + size_t m_overflow = 0; __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1" : "=&a"(res), "=&d" (m_overflow)

« previous php.cvs (#82370) next »