On Fri, Mar 12, 2010 at 01:09:31AM +0100, Linus L??ssing wrote:
Sorry still does not seem to work :). Despite testing it on a setup in batman itself I also tested it with a small c program (which does not work as expected either):
#include <stdio.h> #include <stdint.h>
#define seq_before(x,y) ((x - y) > 1 << 7 + 8 * (sizeof(x) - 1)) #define seq_after(x,y) ((y - x) >= 1 << 7 + 8 * (sizeof(x) - 1))
int main() { uint8_t old = 0; uint8_t new = 1; if (!seq_after(new,old)) printf("foobar\n");
return 0;
}
It is worth taking a look at include/linux/jiffies.h. The macros time_after(), time_after_eq() etc.
Andrew