[Olsr-dev] [olsrd] [PATCH v1 19/29] gateway: simplify deserialize_gw_speed

Ferry Huberts (spam-protected)
Tue Jul 24 18:09:08 CEST 2012


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/gateway.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gateway.c b/src/gateway.c
index 6b6a61e..7e52c46 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -47,10 +47,9 @@ static bool v4gw_choosen_external, v6gw_choosen_external;
  */
 static uint32_t
 deserialize_gw_speed(uint8_t value) {
-  uint32_t speed, exp;
+  uint32_t speed = (value >> 3)+1;
+  uint32_t exp = value & 7;
 
-  speed = (value >> 3)+1;
-  exp = value & 7;
   while (exp-- > 0) {
     speed *= 10;
   }
-- 
1.7.10.4





More information about the Olsr-dev mailing list