Merge pull request #42412 from ClibMouse/formatIpv6_s390x_support

format ipv6 in s390x, endianess support
This commit is contained in:
Yakov Olkhovskiy 2022-11-01 12:02:44 -04:00 committed by GitHub
commit 16159cc7a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@
#include <algorithm>
#include <utility>
#include <base/range.h>
#include <base/unaligned.h>
#include <Common/hex.h>
#include <Common/StringUtils/StringUtils.h>
@ -55,8 +56,11 @@ inline bool parseIPv4(const char * src, unsigned char * dst)
}
if (*(src - 1) != '\0')
return false;
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
reverseMemcpy(dst, &result, sizeof(result));
#else
memcpy(dst, &result, sizeof(result));
#endif
return true;
}