From a60f40dd38f7f2d3b621bff914589c5be7803165 Mon Sep 17 00:00:00 2001 From: Boian Bonev Date: Fri, 28 Oct 2011 10:18:00 +0530 Subject: use unified byte order conversion for uptime --- protocol.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'protocol.c') diff --git a/protocol.c b/protocol.c index 42cc557..f75bd1d 100644 --- a/protocol.c +++ b/protocol.c @@ -353,14 +353,7 @@ struct mt_mndp_info *parse_mndp(const unsigned char *data, const int packet_len) case MT_MNDPTYPE_TIMESTAMP: memcpy(&(packet.uptime), p, 4); /* Seems like ping uptime is transmitted as little endian? */ -#if BYTE_ORDER == BIG_ENDIAN - packet.uptime = ( - ((packet.uptime & 0x000000FF) << 24) + - ((packet.uptime & 0x0000FF00) << 8) + - ((packet.uptime & 0x00FF0000) >> 8) + - ((packet.uptime & 0xFF000000) >> 24) - ); -#endif + packet.uptime = le32toh(packet.uptime); break; case MT_MNDPTYPE_HARDWARE: -- cgit v1.2.3