]> git.jsancho.org Git - gacela.git/blobdiff - gacela_misc.lisp
(no commit message)
[gacela.git] / gacela_misc.lisp
index 6ebcf38ddde8e1e299c8cd68c335a22df38f17d0..a3991d5924d9fdd666b5c4a6d2514f60f7be371a 100755 (executable)
@@ -14,7 +14,6 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 (in-package :gacela)
 
 (defconstant INFINITY MOST-POSITIVE-LONG-FLOAT)
         (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)))