summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.js9
1 files changed, 8 insertions, 1 deletions
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 <div className="ip-address">
<div className="address">
@@ -76,7 +83,7 @@ class IPAddress extends React.Component {
</div>
<div className="details">
- <span className="netmask">Netmask: {this.getNetmask()}</span>
+ <span className="netmask">Netmask: {this.getNetmask()}</span>, <span className="count">Address Count: {this.getCount()}</span>
</div>
</div>