Jump to content

Canonicalize CIDR: Difference between revisions

→‎{{header|TXR}}: New section.
m (Automated syntax highlighting fixup (second round - minor fixes))
(→‎{{header|TXR}}: New section.)
Line 1,746:
161.214.74.0/24
184.232.128.0/18</pre>
=={{header|TXR}}==
<syntaxhighlight lang="txrlisp">(defun cidr-canon (str)
(match `@dots/@bits` str
(let ((inaddr (inaddr-str dots).addr)
(bits (int-str bits)))
`@(str-inaddr (logand inaddr (ash -1 (- 32 bits))))/@bits`)))</syntaxhighlight>
=={{header|UNIX Shell}}==
{{works with|Bourne Again SHell}}
Line 1,801 ⟶ 1,807:
161.214.74.0/24
184.232.128.0/18</pre>
 
=={{header|Wren}}==
{{trans|Ruby}}
543

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.