summaryrefslogtreecommitdiffstats
path: root/net/dccp/dccp.h
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-03-20 16:45:59 +0100
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 07:26:43 +0200
commit0aec51c86986f61de26dd04913667af544a8b8eb (patch)
tree41c39d76acc58b8cebf7e36d69b7b528bb245289 /net/dccp/dccp.h
parent[DCCP]: 48-bit sequence number arithmetic (diff)
downloadlinux-0aec51c86986f61de26dd04913667af544a8b8eb.tar.xz
linux-0aec51c86986f61de26dd04913667af544a8b8eb.zip
[DCCP]: Make dccp_delta_seqno return signed numbers
Problem:
Diffstat (limited to '')
-rw-r--r--net/dccp/dccp.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index a2c20a265b25..afb313ff216e 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -113,9 +113,12 @@ static inline void dccp_inc_seqno(u64 *seqno)
*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 ? */