131
131
#endif
132
132
133
133
typedef uint32_t zend_mm_page_info ; /* 4-byte integer */
134
- /* XXX temporary fix crash on bitset computing on win64 */
135
- typedef unsigned long zend_mm_bitset ; /* 4-byte or 8-byte integer */
134
+ typedef zend_ulong zend_mm_bitset ; /* 4-byte or 8-byte integer */
136
135
137
136
#define ZEND_MM_ALIGNED_OFFSET (size , alignment ) \
138
137
(((size_t)(size)) & ((alignment) - 1))
@@ -459,9 +458,9 @@ static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
459
458
if (bitset == (zend_mm_bitset )- 1 ) return ZEND_MM_BITSET_LEN ;
460
459
461
460
n = 0 ;
462
- #if SIZEOF_LONG == 8
461
+ #if SIZEOF_ZEND_LONG == 8
463
462
if (sizeof (zend_mm_bitset ) == 8 ) {
464
- if ((bitset & 0xffffffff ) == 0xffffffff ) {n += 32 ; bitset = bitset >> 32 ;}
463
+ if ((bitset & 0xffffffff ) == 0xffffffff ) {n += 32 ; bitset = bitset >> Z_UL ( 32 ) ;}
465
464
}
466
465
#endif
467
466
if ((bitset & 0x0000ffff ) == 0x0000ffff ) {n += 16 ; bitset = bitset >> 16 ;}
@@ -483,9 +482,9 @@ static zend_always_inline int zend_mm_bitset_ntz(zend_mm_bitset bitset)
483
482
if (bitset == (zend_mm_bitset )0 ) return ZEND_MM_BITSET_LEN ;
484
483
485
484
n = 1 ;
486
- #if SIZEOF_LONG == 8
485
+ #if SIZEOF_ZEND_LONG == 8
487
486
if (sizeof (zend_mm_bitset ) == 8 ) {
488
- if ((bitset & 0xffffffff ) == 0 ) {n += 32 ; bitset = bitset >> 32 ;}
487
+ if ((bitset & 0xffffffff ) == 0 ) {n += 32 ; bitset = bitset >> Z_UL ( 32 ) ;}
489
488
}
490
489
#endif
491
490
if ((bitset & 0x0000ffff ) == 0 ) {n += 16 ; bitset = bitset >> 16 ;}
@@ -532,7 +531,7 @@ static zend_always_inline int zend_mm_bitset_find_zero_and_set(zend_mm_bitset *b
532
531
zend_mm_bitset tmp = bitset [i ];
533
532
if (tmp != (zend_mm_bitset )- 1 ) {
534
533
int n = zend_mm_bitset_nts (tmp );
535
- bitset [i ] |= 1 << n ;
534
+ bitset [i ] |= Z_UL ( 1 ) << n ;
536
535
return i * ZEND_MM_BITSET_LEN + n ;
537
536
}
538
537
i ++ ;
@@ -542,17 +541,17 @@ static zend_always_inline int zend_mm_bitset_find_zero_and_set(zend_mm_bitset *b
542
541
543
542
static zend_always_inline int zend_mm_bitset_is_set (zend_mm_bitset * bitset , int bit )
544
543
{
545
- return (bitset [bit / ZEND_MM_BITSET_LEN ] & (1L << (bit & (ZEND_MM_BITSET_LEN - 1 )))) != 0 ;
544
+ return (bitset [bit / ZEND_MM_BITSET_LEN ] & (Z_L ( 1 ) << (bit & (ZEND_MM_BITSET_LEN - 1 )))) != 0 ;
546
545
}
547
546
548
547
static zend_always_inline void zend_mm_bitset_set_bit (zend_mm_bitset * bitset , int bit )
549
548
{
550
- bitset [bit / ZEND_MM_BITSET_LEN ] |= (1L << (bit & (ZEND_MM_BITSET_LEN - 1 )));
549
+ bitset [bit / ZEND_MM_BITSET_LEN ] |= (Z_L ( 1 ) << (bit & (ZEND_MM_BITSET_LEN - 1 )));
551
550
}
552
551
553
552
static zend_always_inline void zend_mm_bitset_reset_bit (zend_mm_bitset * bitset , int bit )
554
553
{
555
- bitset [bit / ZEND_MM_BITSET_LEN ] &= ~(1L << (bit & (ZEND_MM_BITSET_LEN - 1 )));
554
+ bitset [bit / ZEND_MM_BITSET_LEN ] &= ~(Z_L ( 1 ) << (bit & (ZEND_MM_BITSET_LEN - 1 )));
556
555
}
557
556
558
557
static zend_always_inline void zend_mm_bitset_set_range (zend_mm_bitset * bitset , int start , int len )
@@ -599,7 +598,7 @@ static zend_always_inline void zend_mm_bitset_reset_range(zend_mm_bitset *bitset
599
598
600
599
if (pos != end ) {
601
600
/* reset bits from "bit" to ZEND_MM_BITSET_LEN-1 */
602
- tmp = ~((1L << bit ) - 1 );
601
+ tmp = ~((Z_L ( 1 ) << bit ) - 1 );
603
602
bitset [pos ++ ] &= ~tmp ;
604
603
while (pos != end ) {
605
604
/* set all bits */
@@ -1610,7 +1609,7 @@ zend_mm_heap *zend_mm_init(void)
1610
1609
chunk -> free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE ;
1611
1610
chunk -> free_tail = ZEND_MM_FIRST_PAGE ;
1612
1611
chunk -> num = 0 ;
1613
- chunk -> free_map [0 ] = (1L << ZEND_MM_FIRST_PAGE ) - 1 ;
1612
+ chunk -> free_map [0 ] = (Z_L ( 1 ) << ZEND_MM_FIRST_PAGE ) - 1 ;
1614
1613
chunk -> map [0 ] = ZEND_MM_LRUN (ZEND_MM_FIRST_PAGE );
1615
1614
heap -> main_chunk = chunk ;
1616
1615
heap -> cached_chunks = NULL ;
@@ -1627,7 +1626,7 @@ zend_mm_heap *zend_mm_init(void)
1627
1626
heap -> peak = 0 ;
1628
1627
#endif
1629
1628
#if ZEND_MM_LIMIT
1630
- heap -> limit = (-1L >> 1 );
1629
+ heap -> limit = (Z_L ( -1 ) >> Z_L ( 1 ) );
1631
1630
heap -> overflow = 0 ;
1632
1631
#endif
1633
1632
#if ZEND_MM_CUSTOM
0 commit comments