115 |
if c2 <> 0 then c2 else |
if c2 <> 0 then c2 else |
116 |
compare a1 b1 |
compare a1 b1 |
117 |
|
|
118 |
|
let succ (a4,a3,a2,a1) = |
119 |
|
if a1 < 255 then |
120 |
|
(a4,a3,a2,a1+1) |
121 |
|
else if a2 < 255 then |
122 |
|
(a4,a3,a2+1,0) |
123 |
|
else if a3 < 255 then |
124 |
|
(a4,a3+1,0,0) |
125 |
|
else if a4 < 255 then |
126 |
|
(a4+1,0,0,0) |
127 |
|
else |
128 |
|
(0,0,0,0) (* or exception ? *) |
129 |
|
|
130 |
|
let pred (a4,a3,a2,a1) = |
131 |
|
if a1 > 0 then |
132 |
|
(a4,a3,a2,a1-1) |
133 |
|
else if a2 > 0 then |
134 |
|
(a4,a3,a2-1,255) |
135 |
|
else if a3 > 0 then |
136 |
|
(a4,a3-1,255,255) |
137 |
|
else if a4 > 0 then |
138 |
|
(a4-1,255,255,255) |
139 |
|
else |
140 |
|
(255,255,255,255) (* or exception ? *) |
141 |
|
|
142 |
let localhost = of_string "127.0.0.1" |
let localhost = of_string "127.0.0.1" |
143 |
|
|
144 |
let to_sockaddr ip port = |
let to_sockaddr ip port = |