Difference between revisions of "Template:IP Range"

From Second Life Wiki
Jump to navigation Jump to search
(FIXED this! #log: does not exist in this Wiki; however #expr does evaluate natural logarithms, and with a bit of math, you can get it working!)
 
(One intermediate revision by one other user not shown)
Line 12: Line 12:
|}
|}
</noinclude><includeonly>{{#if:
</noinclude><includeonly>{{#if:
{{#vardefine:ip-npl|{{#switch:{{{npl|}}}
{{#vardefine:ip-num|{{#switch:{{{npl|}}}
|32=1|31=2|30=4|29=8
|32=1|31=2|30=4|29=8
|28=16|27=32|26=64|25=128
|28=16|27=32|26=64|25=128
Line 23: Line 23:
|0=4294967296|{{#expr:4294967296 - {{IP_Range/IP2Int|{{{subnet|255.255.255.255}}}}}}}
|0=4294967296|{{#expr:4294967296 - {{IP_Range/IP2Int|{{{subnet|255.255.255.255}}}}}}}
}}}}
}}}}
{{#vardefine:ip-count|{{#expr:{{#var:ip-count}}+{{#var:ip-npl}}}}}}
{{#vardefine:ip-npl|{{#expr:32 - ln{{#var:ip-num}}/ln2}}}}
{{#vardefine:ip-count|{{#expr: {{#var:ip-count}} + {{#var:ip-num}}}}}}
{{#vardefine:ip-start|{{IP_Range/IP2Int|{{{ip|}}}}}}}
{{#vardefine:ip-start|{{IP_Range/IP2Int|{{{ip|}}}}}}}
{{#vardefine:ip-start|{{#expr:{{#var:ip-start}} - {{mod|{{#var:ip-start}}|{{#var:ip-npl}}}}}}}}
{{#vardefine:ip-start|{{#expr: {{#var:ip-start}} - {{mod|{{#var:ip-start}}|{{#var:ip-num}}}}}}}}
{{#vardefine:ip-end|{{IP Range/Int2IP|{{#expr:{{#var:ip-start}} + {{#var:ip-npl}} - 1}}}}}}
{{#vardefine:ip-end|{{IP Range/Int2IP|{{#expr: {{#var:ip-start}} + {{#var:ip-num}} - 1}}}}}}
{{#vardefine:ip-start|{{IP Range/Int2IP|{{#var:ip-start}}}}}}
{{#vardefine:ip-start|{{IP Range/Int2IP|{{#var:ip-start}}}}}}
}}{{HoverText|{{#var:ip-start}}/{{#expr:32 - {{#log:{{#var:ip-npl}}|2}}}}|Start:&nbsp;{{#var:ip-start}}, End:&nbsp;{{#var:ip-end}}, Addresses:&nbsp;{{#var:ip-npl}}, Subnet&nbsp;Mask:&nbsp;{{IP Range/Int2IP|(4294967295 * {{#var:ip-npl}})}}}}</includeonly>
}}{{HoverText|{{#var:ip-start}}/{{#var:ip-npl}}|Start:&nbsp;{{#var:ip-start}}, End:&nbsp;{{#var:ip-end}}, Addresses:&nbsp;{{#var:ip-num}}, Subnet&nbsp;Mask:&nbsp;{{IP Range/Int2IP|(4294967295 * {{#var:ip-num}})}}}}</includeonly>

Latest revision as of 12:12, 20 June 2023

{{IP Range|ip=0.0.0.0|npl=30}} 0.0.0.0/30
{{IP Range|ip=255.255.255.255|npl=30}} 255.255.255.252/30
{{IP Range|ip=255.255.255.255|subnet=255.255.255.252}} 255.255.255.252/30