mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Merge pull request #217 from lebrush/rime-memory
Use memcpy, memcmp functions for the rime cmp and cpy
This commit is contained in:
commit
dd6f1c4824
@ -43,6 +43,7 @@
|
||||
*/
|
||||
|
||||
#include "net/rime/rimeaddr.h"
|
||||
#include <string.h>
|
||||
|
||||
rimeaddr_t rimeaddr_node_addr;
|
||||
#if RIMEADDR_SIZE == 2
|
||||
@ -58,22 +59,13 @@ const rimeaddr_t rimeaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||
void
|
||||
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < RIMEADDR_SIZE; i++) {
|
||||
dest->u8[i] = src->u8[i];
|
||||
}
|
||||
memcpy(dest, src, RIMEADDR_SIZE);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < RIMEADDR_SIZE; i++) {
|
||||
if(addr1->u8[i] != addr2->u8[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return (memcmp(addr1, addr2, RIMEADDR_SIZE) == 0);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user