ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/util.h
(Generate patch)

Comparing gvpe/src/util.h (file contents):
Revision 1.27 by pcg, Sun Aug 10 01:34:36 2008 UTC vs.
Revision 1.28 by pcg, Sun Aug 10 15:04:55 2008 UTC

84 { 84 {
85 memset (v, -1, sizeof v); 85 memset (v, -1, sizeof v);
86 seq = seqno; 86 seq = seqno;
87 } 87 }
88 88
89 // 0 == ok, 1 == silently ignore, 2 == error, reset 89 // 0 == ok, 1 == far history, 2 == duplicate in-window, 3 == far future
90 int seqno_classify (u32 seqno) 90 int seqno_classify (u32 seqno)
91 { 91 {
92 if (seqno <= seq - WINDOWSIZE) 92 if (seqno <= seq - WINDOWSIZE)
93 return 1; 93 return 1;
94 else if (seqno > seq + WINDOWSIZE * 16) 94 else if (seqno > seq + WINDOWSIZE * 16)
95 return 2; 95 return 3;
96 else 96 else
97 { 97 {
98 while (seqno > seq) 98 while (seqno > seq)
99 { 99 {
100 seq++; 100 seq++;
109 u32 s = seqno % WINDOWSIZE; 109 u32 s = seqno % WINDOWSIZE;
110 u32 *cell = v + (s >> 5); 110 u32 *cell = v + (s >> 5);
111 u32 mask = 1 << (s & 31); 111 u32 mask = 1 << (s & 31);
112 112
113 if (*cell & mask) 113 if (*cell & mask)
114 return 1; 114 return 2;
115 else 115 else
116 { 116 {
117 *cell |= mask; 117 *cell |= mask;
118 return 0; 118 return 0;
119 } 119 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines