Use memcpy, memcmp functions for the rime compare and copy functions as they

are already used all over contiki.
This commit is contained in:
lebrush 2013-05-15 11:33:02 +02:00
parent a445c4020d
commit 26177387fc

View File

@ -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