fix log table for integer-length (issue #634)

This commit is contained in:
Alex Shinn 2020-05-11 21:38:40 +09:00
parent 426579eef2
commit 610b6964ce
2 changed files with 8 additions and 1 deletions

View file

@ -350,7 +350,7 @@ static const char log_table_256[256] =
{ {
#define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n #define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
LT(5), LT(6), LT(7), LT(7), LT(7), LT(7), LT(7), LT(5), LT(6), LT(6), LT(7), LT(7), LT(7), LT(7),
LT(8), LT(8), LT(8), LT(8), LT(8), LT(8), LT(8), LT(8) LT(8), LT(8), LT(8), LT(8), LT(8), LT(8), LT(8), LT(8)
}; };

View file

@ -5,6 +5,13 @@
(define (run-tests) (define (run-tests)
(test-begin "srfi-151: bitwise operations") (test-begin "srfi-151: bitwise operations")
(test 0 (integer-length #b0))
(test 1 (integer-length #b1))
(test 2 (integer-length #b10))
(test 3 (integer-length #b100))
(test 4 (integer-length #b1000))
(test 5 (integer-length #b10000))
(test 6 (integer-length #b110000))
(test 0 (bitwise-and #b0 #b1)) (test 0 (bitwise-and #b0 #b1))
(test 1 (bitwise-and #b1 #b1)) (test 1 (bitwise-and #b1 #b1))
(test 0 (bitwise-and #b1 #b10)) (test 0 (bitwise-and #b1 #b10))