Commit 6c5248f9 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Micro-optimise seqno computation.

parent d8e74ded
......@@ -40,20 +40,13 @@ seqno_compare(unsigned short s1, unsigned short s2)
{
if(s1 == s2)
return 0;
else if(((s2 - s1) & 0xFFFF) < 0x8000)
return -1;
else
return 1;
return ((s2 - s1) & 0x8000) ? 1 : -1;
}
int
seqno_minus(unsigned short s1, unsigned short s2)
{
if(s1 == s2)
return 0;
else if(((s2 - s1) & 0xFFFF) < 0x8000)
return -(int)((s2 - s1) & 0xFFFF);
else
return ((s1 - s2) & 0xFFFF);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment