From 57b330cc8334015f9953d7fb82a30afc82d2a471 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Mon, 30 Jun 2008 10:33:57 +0000 Subject: [PATCH] 1.0.18.7: just one POWER-OF-TWO-CEILING, thank you * We had two, of which CEIL-POWER-OF-TWO with arguments that already were powers of two returned the *next* power of two, and not the argument, whereas POWER-OF-TWO-CEILING returned the argument if it already was a power of two. As far as I can tell returning the argument is fine in those case in places where CEIL-POWER-OF-TWO was used, so replace it with POWER-OF-TWO-CEILING -- which really doesn't have to be inline. --- NEWS | 2 +- package-data-list.lisp-expr | 1 + src/code/target-extensions.lisp | 5 +++++ src/code/target-hash-table.lisp | 10 +++------- src/pcl/cache.lisp | 5 ----- version.lisp-expr | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 0af2e7e..382cc2e 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,7 @@ changes in sbcl-1.0.19 relative to 1.0.18: * fixed some bugs revealed by Paul Dietz' test suite: ** interval arithmetic during type derivation used inexact integer to single-float coercions. - ** artihmetic operations involving large integers and single + ** arithmetic operations involving large integers and single floats give the same results in compiled and interpreted code. ** deriving the result type of COERCE no longer signals an error if the derived type of the second argument is a MEMBER type diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index 7143b05..1f0f388 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -930,6 +930,7 @@ possibly temporariliy, because it might be used internally." "BIT-VECTOR-=" "READ-EVALUATED-FORM" "MAKE-UNPRINTABLE-OBJECT" + "POWER-OF-TWO-CEILING" ;; ..and macros.. "COLLECT" diff --git a/src/code/target-extensions.lisp b/src/code/target-extensions.lisp index f65e25d..6963eeb 100644 --- a/src/code/target-extensions.lisp +++ b/src/code/target-extensions.lisp @@ -119,3 +119,8 @@ exit(3) directly will circumvent these hooks.") (%shrink-vector string size) string))) ,@body)))) + +;;; The smallest power of two that is equal to or greater than X. +(defun power-of-two-ceiling (x) + (declare (index x)) + (ash 1 (integer-length (1- x)))) diff --git a/src/code/target-hash-table.lisp b/src/code/target-hash-table.lisp index bdb5514..2a92616 100644 --- a/src/code/target-hash-table.lisp +++ b/src/code/target-hash-table.lisp @@ -108,10 +108,6 @@ (t (eq-hash key)))) -(defun ceil-power-of-two (num) - (declare (type index num)) - (ash 1 (integer-length num))) - (declaim (inline index-for-hashing)) (defun index-for-hashing (hash length) (declare (type hash hash length)) @@ -234,8 +230,8 @@ ;; Note that this has not yet been audited for ;; correctness. It just seems to work. -- CSR, 2002-11-02 (scaled-size (truncate (/ (float size+1) rehash-threshold))) - (length (ceil-power-of-two (max scaled-size - (1+ +min-hash-table-size+)))) + (length (power-of-two-ceiling (max scaled-size + (1+ +min-hash-table-size+)))) (index-vector (make-array length :element-type '(unsigned-byte #.sb!vm:n-word-bits) @@ -326,7 +322,7 @@ multiple threads accessing the same hash-table without locking." (old-hash-vector (hash-table-hash-vector table)) (old-size (length old-next-vector)) (new-size - (ceil-power-of-two + (power-of-two-ceiling (let ((rehash-size (hash-table-rehash-size table))) (etypecase rehash-size (fixnum diff --git a/src/pcl/cache.lisp b/src/pcl/cache.lisp index e7f60e4..73c197b 100644 --- a/src/pcl/cache.lisp +++ b/src/pcl/cache.lisp @@ -104,11 +104,6 @@ ;; bits at the low end. (logand (1- vector-length) (- line-size))) -;;; The smallest power of two that is equal to or greater then X. -(declaim (inline power-of-two-ceiling)) -(defun power-of-two-ceiling (x) - (ash 1 (integer-length (1- x)))) - (defun cache-statistics (cache) (let* ((vector (cache-vector cache)) (size (length vector)) diff --git a/version.lisp-expr b/version.lisp-expr index 20c2f2b..a563aa1 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.18.6" +"1.0.18.7" -- 1.7.10.4