Changeset 38593 in project for release


Ignore:
Timestamp:
04/07/20 03:36:03 (4 months ago)
Author:
Kon Lovett
Message:

fix bitwise-split @ 0 return

Location:
release/5/bitwise-utils/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/bitwise-utils/trunk/bitwise-utils.egg

    r38584 r38593  
    33
    44((synopsis "Bitwise utilities")
    5  (version "1.0.0")
     5 (version "1.0.1")
    66 (category data)
    77 (author "[[kon lovett]]")
  • release/5/bitwise-utils/trunk/bitwise-utils.scm

    r38587 r38593  
    9393;123 0 => '()
    9494(define (bitwise-split n w)
    95   (if (or (zero? n)(zero? w)) '()
     95  (if (or (zero? n) (zero? w)) `(,n)
    9696    (let ((neg? (negative? n)) (mask (bitwise-mask w)))
    9797      (let loop ((n (abs n)) (ns '()))
  • release/5/bitwise-utils/trunk/tests/bitwise-utils-test.scm

    r38586 r38593  
    4747(test #b110011000000001 (bitwise-and #b110011010110101 #b111111000000011))
    4848
     49(test '(0) (bitwise-split 0 5))
     50(test '(5) (bitwise-split 5 0))
     51(test '(0) (bitwise-split 0 0))
     52
    4953(test '("a" "b" "c" "d" "e" "f") (map (cut number->string <> 16) (bitwise-split #xabcdef 4)))
    5054(test '("-a" "-b" "-c" "-d" "-e" "-f") (map (cut number->string <> 16) (bitwise-split #x-abcdef 4)))
Note: See TracChangeset for help on using the changeset viewer.