[DCCP]: Make dccp_delta_seqno return signed numbers

Problem:
This commit is contained in:
Gerrit Renker 2007-03-20 12:45:59 -03:00 committed by David S. Miller
parent 6b811d43f6
commit 0aec51c869
1 changed files with 5 additions and 2 deletions

View File

@ -113,9 +113,12 @@ static inline void dccp_inc_seqno(u64 *seqno)
*seqno = ADD48(*seqno, 1); *seqno = ADD48(*seqno, 1);
} }
static inline u64 dccp_delta_seqno(u64 seqno1, u64 seqno2) /* signed mod-2^48 distance: pos. if seqno1 < seqno2, neg. if seqno1 > seqno2 */
static inline s64 dccp_delta_seqno(const u64 seqno1, const u64 seqno2)
{ {
return ((seqno2 << 16) - (seqno1 << 16)) >> 16; u64 delta = SUB48(seqno2, seqno1);
return TO_SIGNED48(delta);
} }
/* is seq1 < seq2 ? */ /* is seq1 < seq2 ? */