Difference between revisions of "Template:IP Range/IP2Int"

From Second Life Wiki
Jump to navigation Jump to search
(Made the noinclude section a bit more obvious about what exactly is intended here)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>{{#expr:((((({{#explode:{{{1}}}.0|.|0}} * 256) + {{#explode:{{{1}}}.0.0|.|1}}) * 256) + {{#explode:{{{1}}}.0.0.0|.|2}}) * 256) + {{#explode:{{{1}}}.0.0.0.0|.|3}}}}</includeonly><noinclude>
{{#vardefine:s|{{#pos:{{{1}}}.0|.}}}}
{{#vardefine:c|{{#sub:0|{{{1}}}}}}}
{{#vardefine:t|{{#expr:{{#pos:{{{1}}}.0.0|.|{{#var:s}}}}+{{#var:s}}}}}}
{{#var:s}}
{{#var:t}}
{{#var:c}}
<!--{{#vardefine:c|{{#expr:({{#var:c}} * 255) + {{#sub:0|{{#var:s}}|{{#var:t}}}}}}}}
{{#vardefine:t|{{#var:s}}}}
{{#vardefine:s|{{#expr:{{#pos:{{{1}}}.0.0.0|.}}+{{#var:t}}}}}}
{{#vardefine:c|{{#expr:({{#var:c}} * 255) + {{#sub:0|{{#var:s}}|{{#var:t}}}}}}}}
{{#vardefine:t|{{#var:s}}}}
{{#vardefine:s|{{#expr:{{#pos:{{{1}}}.0.0.0.0|.}}+{{#var:t}}}}}}
{{#expr:({{#var:c}} * 255) + {{#sub:0|{{#var:s}}|{{#var:t}}}}}}-->
</includeonly>
<noinclude>
{|
{|
|-
|-
|{{{{PAGENAME}}|0.0.0.0}}
|<nowiki>0.0.0.0 => </nowiki>{{{{PAGENAME}}|0.0.0.0}}
|-
|-
|{{{{PAGENAME}}|0.0.0.256}}
|<nowiki>0.0.0.255 => </nowiki>{{{{PAGENAME}}|0.0.0.255}}
|-
|-
|{{{{PAGENAME}}|0.0.256.256}}
|<nowiki>0.0.255.255 => </nowiki>{{{{PAGENAME}}|0.0.255.255}}
|-
|-
|{{{{PAGENAME}}|0.256.256.256}}
|<nowiki>0.255.255.255 => </nowiki>{{{{PAGENAME}}|0.255.255.255}}
|-
|-
|{{{{PAGENAME}}|256.256.256.256}}
|<nowiki>255.255.255.255 => </nowiki>{{{{PAGENAME}}|255.255.255.255}}
|}
|}
</noinclude>
</noinclude>

Latest revision as of 12:15, 20 June 2023

0.0.0.0 => 0
0.0.0.255 => 255
0.0.255.255 => 65535
0.255.255.255 => 16777215
255.255.255.255 => 4294967295