Skip to content

Commit 32e1093

Browse files
committed
be fixes
1 parent 18a385f commit 32e1093

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/standard/pack.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ static void php_pack(const zval *val, size_t size, php_pack_endianness endiannes
6161

6262
if ((endianness == PHP_LITTLE_ENDIAN) != MACHINE_LITTLE_ENDIAN) {
6363
zl = PHP_LONG_BSWAP(zl);
64+
#if MACHINE_LITTLE_ENDIAN
6465
zl >>= (sizeof(zl) - size) * 8;
66+
#endif
67+
} else {
68+
#if !MACHINE_LITTLE_ENDIAN
69+
zl <<= (sizeof(zl) - size) * 8;
70+
#endif
6571
}
6672

6773
memcpy(output, (const char *) &zl, size);

0 commit comments

Comments
 (0)