summaryrefslogtreecommitdiffstats
path: root/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'host.c')
-rw-r--r--host.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/host.c b/host.c
index 89a8524..c4e4284 100644
--- a/host.c
+++ b/host.c
@@ -103,3 +103,10 @@ unsigned long long int ri (unsigned long long int v, int s) { /* 000 100 010 110
v &= ~(1 << i--);
}
}
+unsigned long long int localnumber (struct in_net n) {
+ unsigned long long int r = 0;
+ for (int i = 31; i >= 0; i--)
+ if (n.mask.s_addr & 1 << i && n.addr.s_addr & 1 << i)
+ r |= 1 << i;
+ return r;
+}