Browse Source

Merge pull request #4373 from haukepetersen/opt_ipv6_addr

net/gnrc/ipv6: de-inlined ipv6_addr_equal
cc430
Hauke Petersen 7 years ago
parent
commit
0b15943cc1
  1. 26
      sys/include/net/ipv6/addr.h
  2. 6
      sys/net/network_layer/ipv6/addr/ipv6_addr.c

26
sys/include/net/ipv6/addr.h

@ -228,21 +228,6 @@ typedef union {
#define IPV6_ADDR_MCAST_SCP_GLOBAL (0xe) /**< global scope */
/** @} */
/**
* @brief Checks if two IPv6 addresses are equal.
*
* @param[in] a An IPv6 address.
* @param[in] b Another IPv6 address.
*
* @return true, if @p a and @p b are equal
* @return false, otherwise.
*/
static inline bool ipv6_addr_equal(const ipv6_addr_t *a, const ipv6_addr_t *b)
{
return (a->u64[0].u64 == b->u64[0].u64) &&
(a->u64[1].u64 == b->u64[1].u64);
}
/**
* @brief Checks if @p addr is unspecified (all zero).
*
@ -448,6 +433,17 @@ static inline bool ipv6_addr_is_solicited_node(const ipv6_addr_t *addr)
}
/**
* @brief Checks if two IPv6 addresses are equal.
*
* @param[in] a An IPv6 address.
* @param[in] b Another IPv6 address.
*
* @return true, if @p a and @p b are equal
* @return false, otherwise.
*/
bool ipv6_addr_equal(const ipv6_addr_t *a, const ipv6_addr_t *b);
/**
* @brief Checks up to which bit-count two IPv6 addresses match in their
* prefix.

6
sys/net/network_layer/ipv6/addr/ipv6_addr.c

@ -19,6 +19,12 @@
#include "net/ipv6/addr.h"
bool ipv6_addr_equal(const ipv6_addr_t *a, const ipv6_addr_t *b)
{
return (a->u64[0].u64 == b->u64[0].u64) &&
(a->u64[1].u64 == b->u64[1].u64);
}
uint8_t ipv6_addr_match_prefix(const ipv6_addr_t *a, const ipv6_addr_t *b)
{
uint8_t prefix_len = 0;

Loading…
Cancel
Save