summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-01-24 10:14:28 +0100
committerAnatol Belski <ab@php.net>2018-01-24 10:14:28 +0100
commit7e2a9936d380494724680db1a1595bf922bedcfb (patch)
tree2030ed0cc717c55fd4ecbcedfd5fd5204f35bce3
parenta6e86f7a3f954a5cc05508228572e9f1db5d2771 (diff)
downloadphp-git-7e2a9936d380494724680db1a1595bf922bedcfb.tar.gz
Move useful macro into zend_portability.h
-rw-r--r--Zend/zend_portability.h10
-rw-r--r--ext/standard/string.c12
2 files changed, 11 insertions, 11 deletions
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index 92b9bb307e..f89258e0d6 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -521,7 +521,7 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
#if defined(__GNUC__) && defined(__SSE4_2__)
/* Instructions compiled directly. */
# define ZEND_INTRIN_SSE4_2_NATIVE 1
-#elif (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_NMMINTRIN_H) || defined(PHP_WIN32)
+#elif (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_NMMINTRIN_H) || defined(ZEND_WIN32)
/* Function resolved by ifunc or MINIT. */
# define ZEND_INTRIN_SSE4_2_RESOLVER 1
#endif
@@ -532,6 +532,14 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
# define ZEND_INTRIN_SSE4_2_FUNC_PTR 1
#endif
+#ifdef ZEND_WIN32
+# define ZEND_SET_ALIGNED(alignment, decl) __declspec(align(alignment)) decl
+#elif HAVE_ATTRIBUTE_ALIGNED
+# define ZEND_SET_ALIGNED(alignment, decl) decl __attribute__ ((__aligned__ (alignment)))
+#else
+# define ZEND_SET_ALIGNED(alignment, decl) decl
+#endif
+
#endif /* ZEND_PORTABILITY_H */
/*
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 8915c532a4..cd2b028741 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -118,16 +118,8 @@ void register_string_constants(INIT_FUNC_ARGS)
int php_tag_find(char *tag, size_t len, const char *set);
-#ifdef PHP_WIN32
-# define SET_ALIGNED(alignment, decl) __declspec(align(alignment)) decl
-#elif HAVE_ATTRIBUTE_ALIGNED
-# define SET_ALIGNED(alignment, decl) decl __attribute__ ((__aligned__ (alignment)))
-#else
-# define SET_ALIGNED(alignment, decl) decl
-#endif
-
/* this is read-only, so it's ok */
-SET_ALIGNED(16, static char hexconvtab[]) = "0123456789abcdef";
+ZEND_SET_ALIGNED(16, static char hexconvtab[]) = "0123456789abcdef";
/* localeconv mutex */
#ifdef ZTS
@@ -3913,7 +3905,7 @@ PHPAPI zend_string *php_addslashes(zend_string *str, int should_free) /* {{{ */
zend_string *php_addslashes_sse42(zend_string *str, int should_free)
# endif
{
- SET_ALIGNED(16, static const char slashchars[16]) = "\'\"\\\0";
+ ZEND_SET_ALIGNED(16, static const char slashchars[16]) = "\'\"\\\0";
__m128i w128, s128;
uint32_t res = 0;
/* maximum string length, worst case situation */