diff --git a/mud.c b/mud.c index 1990311..9a2c824 100644 --- a/mud.c +++ b/mud.c @@ -30,10 +30,6 @@ #define MUD_ASSERT(X) (void)sizeof(char[(X)?1:-1]) #define MUD_COUNT(X) (sizeof(X)/sizeof(X[0])) -#define MUD_PACKET_MASK (0x3FFU) -#define MUD_PACKET_COUNT (MUD_PACKET_MASK+1) -#define MUD_PACKET_NEXT(X) (((X)+1)&MUD_PACKET_MASK) - #define MUD_TIME_SIZE (6U) #define MUD_AD_SIZE (16U) @@ -76,6 +72,13 @@ #define MUD_PACKET_MAX_SIZE (1500U) #endif +#ifndef MUD_PACKET_MASK +#define MUD_PACKET_MASK (0x3FFU) +#endif + +#define MUD_PACKET_COUNT ((MUD_PACKET_MASK)+1) +#define MUD_PACKET_NEXT(X) (((X)+1)&(MUD_PACKET_MASK)) + struct path_info { uint64_t dt; uint64_t time; @@ -927,7 +930,7 @@ int mud_pull (struct mud *mud) { unsigned char ctrl[256]; - for (int i = 0; i < 16; i++) { + while (1) { unsigned next = MUD_PACKET_NEXT(mud->rx.end); if (mud->rx.start == next) {