From b7afd2baf0bab0e5a29ed110f86e4d1cb478b4ae Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 21 Mar 2007 23:22:11 +0000 Subject: [PATCH] Remade the rimeaddr_t u16 to be an array rather than a scalar --- core/net/rime/rimeaddr.c | 14 ++++++++++---- core/net/rime/rimeaddr.h | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/net/rime/rimeaddr.c b/core/net/rime/rimeaddr.c index e7d61f312..6d055015c 100644 --- a/core/net/rime/rimeaddr.c +++ b/core/net/rime/rimeaddr.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rimeaddr.c,v 1.1 2007/03/15 19:43:07 adamdunkels Exp $ + * $Id: rimeaddr.c,v 1.2 2007/03/21 23:22:11 adamdunkels Exp $ */ /** @@ -41,18 +41,24 @@ #include "rimeaddr.h" rimeaddr_t rimeaddr_node_addr; -const rimeaddr_t rimeaddr_null = {.u16 = 0}; +const rimeaddr_t rimeaddr_null = {.u16 = {0}}; /*---------------------------------------------------------------------------*/ void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src) { - dest->u16 = src->u16; + dest->u16[0] = src->u16[0]; } /*---------------------------------------------------------------------------*/ int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2) { - return addr1->u16 == addr2->u16; + return addr1->u16[0] == addr2->u16[0]; +} +/*---------------------------------------------------------------------------*/ +void +rimeaddr_set_node_addr(rimeaddr_t *t) +{ + rimeaddr_copy(&rimeaddr_node_addr, t); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/rime/rimeaddr.h b/core/net/rime/rimeaddr.h index ea16b6180..38f17f7e5 100644 --- a/core/net/rime/rimeaddr.h +++ b/core/net/rime/rimeaddr.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rimeaddr.h,v 1.1 2007/03/15 19:43:07 adamdunkels Exp $ + * $Id: rimeaddr.h,v 1.2 2007/03/21 23:22:11 adamdunkels Exp $ */ /** @@ -43,11 +43,12 @@ typedef union { unsigned char u8[2]; - unsigned short u16; + unsigned short u16[1]; } rimeaddr_t; void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from); int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2); +void rimeaddr_set_node_addr(rimeaddr_t *t); extern rimeaddr_t rimeaddr_node_addr;