From 41ae79e2699118120b976eb657782d614089aec4 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Wed, 9 Dec 2015 13:39:47 +0200 Subject: Add address count --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 720639a..60e4611 100644 --- a/index.js +++ b/index.js @@ -49,6 +49,13 @@ class IPAddress extends React.Component { } } + getCount = () => { + if (this.state.cidr == 32) { + return 1; + } + return ((0xFFFFFFFF >>> this.state.cidr) >>> 0) + 1 + } + render() { return
@@ -76,7 +83,7 @@ class IPAddress extends React.Component {
- Netmask: {this.getNetmask()} + Netmask: {this.getNetmask()}, Address Count: {this.getCount()}
-- cgit v1.3.1