Canonicalize CIDR: Difference between revisions

m
Optimise the Common Lisp solution a bit
(Add a Common Lisp solution)
m (Optimise the Common Lisp solution a bit)
Line 457:
:with start := 0
:for pos := (position #\. ip :start start)
:collect (parse-integer (subseq ip :start start :end pos)) :into res
:while pos
:do (setf start (1+ pos))
Line 473:
(let* ((n (position #\/ cidr))
(ip (subseq cidr 0 n))
(sn (parse-integer (subseqcidr cidr:start (1+ n))))
(ip* (ip->bit-vector ip))
(canonical-ip (fill ip* 0 :start sn)))