mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] Changes to mldonkey/src/utils/net/ip.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] Changes to mldonkey/src/utils/net/ip.ml
Date: Thu, 01 Sep 2005 12:44:30 -0400

Index: mldonkey/src/utils/net/ip.ml
diff -u mldonkey/src/utils/net/ip.ml:1.14 mldonkey/src/utils/net/ip.ml:1.15
--- mldonkey/src/utils/net/ip.ml:1.14   Thu Sep  1 00:04:12 2005
+++ mldonkey/src/utils/net/ip.ml        Thu Sep  1 16:44:29 2005
@@ -115,6 +115,30 @@
   if c2 <> 0 then c2 else
   compare a1 b1
 
+let succ (a4,a3,a2,a1) =
+  if a1 < 255 then
+    (a4,a3,a2,a1+1)
+  else if a2 < 255 then
+    (a4,a3,a2+1,0)
+  else if a3 < 255 then
+    (a4,a3+1,0,0)
+  else if a4 < 255 then
+    (a4+1,0,0,0)
+  else
+    (0,0,0,0) (* or exception ? *)
+
+let pred (a4,a3,a2,a1) =
+  if a1 > 0 then
+    (a4,a3,a2,a1-1)
+  else if a2 > 0 then
+    (a4,a3,a2-1,255)
+  else if a3 > 0 then
+    (a4,a3-1,255,255)
+  else if a4 > 0 then
+    (a4-1,255,255,255)
+  else
+    (255,255,255,255) (* or exception ? *)
+
 let localhost = of_string "127.0.0.1"
 
 let to_sockaddr ip port =




reply via email to

[Prev in Thread] Current Thread [Next in Thread]