Commit 4d286a3d authored by Joseph Noir's avatar Joseph Noir Committed by Joseph Noir

Clarify byte order for ipv4 address bit access

parent 46dba713
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
explicit ipv4_address(array_type bytes); explicit ipv4_address(array_type bytes);
/// Constructs an IPv4 address from bits in network byte order.
static ipv4_address from_bits(uint32_t bits) { static ipv4_address from_bits(uint32_t bits) {
ipv4_address result; ipv4_address result;
result.bits(bits); result.bits(bits);
...@@ -60,13 +61,14 @@ public: ...@@ -60,13 +61,14 @@ public:
/// Returns whether this is a multicast address. /// Returns whether this is a multicast address.
bool is_multicast() const noexcept; bool is_multicast() const noexcept;
/// Returns the bits of the IP address in a single integer. /// Returns the bits of the IP address in a single integer arranged in network
/// byte order.
inline uint32_t bits() const noexcept { inline uint32_t bits() const noexcept {
return bits_; return bits_;
} }
/// Sets all bits of the IP address in a single 32-bit write. /// Sets all bits of the IP address with a single 32-bit write. Expects
/// @private /// argument in network byte order.
inline void bits(uint32_t value) noexcept { inline void bits(uint32_t value) noexcept {
bits_ = value; bits_ = value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment