X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_misc.lisp;h=a3991d5924d9fdd666b5c4a6d2514f60f7be371a;hb=eede4e38936f10c03f4a66427ccb885142cf4237;hp=6ebcf38ddde8e1e299c8cd68c335a22df38f17d0;hpb=678a1561ca858c34fecf04792831caf68559c2ac;p=gacela.git diff --git a/gacela_misc.lisp b/gacela_misc.lisp index 6ebcf38..a3991d5 100755 --- a/gacela_misc.lisp +++ b/gacela_misc.lisp @@ -14,7 +14,6 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . - (in-package :gacela) (defconstant INFINITY MOST-POSITIVE-LONG-FLOAT) @@ -63,6 +62,12 @@ (cond ((or (numberp list) (numberp pattern)) (and (numberp list) (numberp pattern))) (t t))))) +(defun nearest-power-of-two (n) + (labels ((power (p n) + (cond ((> (* p 2) n) p) + (t (power (* p 2) n))))) + (power 1 n))) + ;Geometry (defun dotp (dot) (match-pattern dot '(0 0)))