From ab25325e9f8d2b5c73fab9094d582f81d1a3e780 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 29 Mar 2020 20:58:00 +0000 Subject: [PATCH] Fixed wrong results in cw_get_hdr_fragoffset and cw_get_hdr_fragid FossilOrigin-Name: 1bc1c836eae499da08204f9b7740cef0df0a4feaf45514b8a220f8ebca288f42 --- src/cw/cw.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cw/cw.h b/src/cw/cw.h index 9b5c3acf..7a84cff5 100644 --- a/src/cw/cw.h +++ b/src/cw/cw.h @@ -98,8 +98,13 @@ /* macros to acces transport header values */ #define cw_get_hdr_preamble(th) (th[0]) -#define cw_get_hdr_fragid(th) ((ntohl((((uint32_t*)th)[1]) >> 16) & 0xffff)) -#define cw_get_hdr_fragoffset(th) ((ntohl((((uint32_t*)th)[1]) >> 3) & 0x1fff)) + +#define cw_get_hdr_fragid(th)\ + (((ntohl(*(((uint32_t*)(th))+1))) >> 16) & 0xffff) + +#define cw_get_hdr_fragoffset(th)\ + (((ntohl(*(((uint32_t*)(th))+1))) >> 3) & 0x1fff) + #define cw_get_hdr_rid(th) ((ntohl((((uint32_t*)th)[0]) >> 14) & 0x1f)) #define cw_get_hdr_wbid(th) ((ntohl(((uint32_t*)th)[0]) >> 9) & 0x1f) #define cw_get_hdr_hlen(th) ((ntohl(((uint32_t*)th)[0]) >> 19) & 0x1f)