mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
a SRFI 60 installed which imports (scheme base). This can still break in theory if a user installs a third-party SRFI 33 in the search path in front of the Chibi SRFI 33, but we can't always be safe against such behavior. Fixes issue #267.
19 lines
626 B
Scheme
19 lines
626 B
Scheme
|
|
(define-library (chibi iset optimize)
|
|
(cond-expand
|
|
(chibi (import (chibi) (srfi 9)))
|
|
(else (import (scheme base))))
|
|
(import (chibi iset base)
|
|
(chibi iset iterators)
|
|
(chibi iset constructors))
|
|
(cond-expand
|
|
((library (srfi 33)) (import (srfi 33)))
|
|
(else
|
|
(import (srfi 60))
|
|
(begin
|
|
(define (%mask size) (bitwise-not (arithmetic-shift -1 size)))
|
|
(define (extract-bit-field size position n)
|
|
(bitwise-and (%mask size) (arithmetic-shift n (- position)))))))
|
|
(include "optimize.scm")
|
|
(export
|
|
iset-balance iset-balance! iset-optimize iset-optimize! iset->code))
|