Merge pull request #4373 from haukepetersen/opt_ipv6_addr

net/gnrc/ipv6: de-inlined ipv6_addr_equal
This commit is contained in:
Hauke Petersen 2015-12-03 12:11:14 +01:00
commit 0b15943cc1
2 changed files with 17 additions and 15 deletions

View File

@ -228,21 +228,6 @@ typedef union {
#define IPV6_ADDR_MCAST_SCP_GLOBAL (0xe) /**< global scope */ #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). * @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 * @brief Checks up to which bit-count two IPv6 addresses match in their
* prefix. * prefix.

View File

@ -19,6 +19,12 @@
#include "net/ipv6/addr.h" #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 ipv6_addr_match_prefix(const ipv6_addr_t *a, const ipv6_addr_t *b)
{ {
uint8_t prefix_len = 0; uint8_t prefix_len = 0;