mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-26 10:03:40 +03:00
network: use official bswap_32() rather than inofficial __bswap_32()
The former is a macro for the latter, but let's use the official API (the one that has an API).
This commit is contained in:
parent
899c1c0a34
commit
fe92eb795b
@ -55,9 +55,9 @@ typedef uint64_t __sd_bitwise be64_t;
|
||||
#undef le64toh
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define bswap_16_on_le(x) __bswap_16(x)
|
||||
#define bswap_32_on_le(x) __bswap_32(x)
|
||||
#define bswap_64_on_le(x) __bswap_64(x)
|
||||
#define bswap_16_on_le(x) bswap_16(x)
|
||||
#define bswap_32_on_le(x) bswap_32(x)
|
||||
#define bswap_64_on_le(x) bswap_64(x)
|
||||
#define bswap_16_on_be(x) (x)
|
||||
#define bswap_32_on_be(x) (x)
|
||||
#define bswap_64_on_be(x) (x)
|
||||
@ -65,9 +65,9 @@ typedef uint64_t __sd_bitwise be64_t;
|
||||
#define bswap_16_on_le(x) (x)
|
||||
#define bswap_32_on_le(x) (x)
|
||||
#define bswap_64_on_le(x) (x)
|
||||
#define bswap_16_on_be(x) __bswap_16(x)
|
||||
#define bswap_32_on_be(x) __bswap_32(x)
|
||||
#define bswap_64_on_be(x) __bswap_64(x)
|
||||
#define bswap_16_on_be(x) bswap_16(x)
|
||||
#define bswap_32_on_be(x) bswap_32(x)
|
||||
#define bswap_64_on_be(x) bswap_64(x)
|
||||
#endif
|
||||
|
||||
static inline le16_t htole16(uint16_t value) { return (le16_t __sd_force) bswap_16_on_be(value); }
|
||||
|
@ -207,7 +207,7 @@ int dhcp_identifier_set_iaid(
|
||||
if (legacy_unstable_byteorder)
|
||||
/* for historical reasons (a bug), the bits were swapped and thus
|
||||
* the result was endianness dependent. Preserve that behavior. */
|
||||
id32 = __bswap_32(id32);
|
||||
id32 = bswap_32(id32);
|
||||
else
|
||||
/* the fixed behavior returns a stable byte order. Since LE is expected
|
||||
* to be more common, swap the bytes on LE to give the same as legacy
|
||||
|
@ -158,7 +158,7 @@ static void test_dhcp_identifier_set_iaid(void) {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
assert_se(iaid == iaid_legacy);
|
||||
#else
|
||||
assert_se(iaid == __bswap_32(iaid_legacy));
|
||||
assert_se(iaid == bswap_32(iaid_legacy));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user