diff options
Diffstat (limited to 'host.c')
-rw-r--r-- | host.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; +} |