From 8b1cd7a4708ff494697a781fd647ca54ec7b1c1e Mon Sep 17 00:00:00 2001 From: bg- Date: Tue, 24 Apr 2007 16:37:45 +0000 Subject: [PATCH] * Explain that SCMP32 comes from RFC 3561 and is easy to implement using 2's complement arithmetic. Unfortunately C only defines unsigned arithmetic and consequently machines that don't use 2's complement (i.e unknown arithmetic) will have to be dealt with on a per machine basis. --- core/net/uaodv.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/net/uaodv.c b/core/net/uaodv.c index cb4b3a493..e08ed9608 100644 --- a/core/net/uaodv.c +++ b/core/net/uaodv.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: uaodv.c,v 1.9 2007/04/24 16:08:10 bg- Exp $ + * $Id: uaodv.c,v 1.10 2007/04/24 16:37:45 bg- Exp $ */ /** @@ -56,15 +56,15 @@ PROCESS(uaodv_process, "uAODV"); static struct uip_udp_conn *aodvconn, *unicastconn; -/* Compare sequence numbers. */ +/* Compare sequence numbers as per RFC 3561. */ #ifdef __GNUC__ #define SCMP32(a, b) ((int32_t)((a) - (b))) #else /* __GNUC__ */ -/* SCMP32() seems to be called with arguments of type u32_t. - * These seem to be subtracted in an unsigned manner and then - * the result is afterwards(!) casted to a signed type. As I'm - * unable to detect the behaviour intended here I'm unable to - * port it cleanly to other compilers :-( - Oliver Schmidt */ +/* + * The macro above works for any compiler that does int32_t arithmetic + * in 2's complement. Machines that does not use 2's complement needs + * to figure a different implementation. + */ #define SCMP32(a, b) exit(1) #endif /* __GNUC__ */