Skip to content

Commit

Permalink
Try to control ZEND_MM_ALIGNED_SIZE type
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 12, 2019
1 parent be36d92 commit 93c728b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Zend/zend_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
#include "zend.h"

#ifndef ZEND_MM_ALIGNMENT
# define ZEND_MM_ALIGNMENT Z_L(8)
# define ZEND_MM_ALIGNMENT ((size_t) 8)
# define ZEND_MM_ALIGNMENT_LOG2 Z_L(3)
#elif ZEND_MM_ALIGNMENT < 4
# undef ZEND_MM_ALIGNMENT
# undef ZEND_MM_ALIGNMENT_LOG2
# define ZEND_MM_ALIGNMENT Z_L(4)
# define ZEND_MM_ALIGNMENT ((size_t) 4)
# define ZEND_MM_ALIGNMENT_LOG2 Z_L(2)
#endif

#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT - Z_L(1))
#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT - 1)

#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - Z_L(1)) & ZEND_MM_ALIGNMENT_MASK)
#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)

#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment) \
(((size) + ((alignment) - Z_L(1))) & ~((alignment) - Z_L(1)))
(((size) + ((alignment) - 1)) & ~((alignment) - 1))

typedef struct _zend_leak_info {
void *addr;
Expand Down

0 comments on commit 93c728b

Please sign in to comment.