1 /* $Id: sequence.c 4871 2001-07-09 08:09:58Z alexk $
3 ** Sequence space arithmetic routines.
5 ** This is a set of routines for implementing so called sequence
6 ** space arithmetic (typically used for DNS serial numbers). The
7 ** implementation here is taken from RFC 1982.
13 #include "inn/sequence.h"
17 ** compare two unsigned long numbers using sequence space arithmetic
23 ** INT_MAX - undefined
26 seq_lcompare(unsigned long i1, unsigned long i2)
30 else if ((i1 < i2 && i2 - i1 < (1 + ULONG_MAX / 2)) ||
31 (i1 > i2 && i1 - i2 > (1 + ULONG_MAX / 2)))
33 else if ((i1 < i2 && i2 - i1 > (1 + ULONG_MAX / 2)) ||
34 (i1 > i2 && i1 - i2 < (1 + ULONG_MAX / 2)))