~ chicken-core (chicken-5) 9973d0e33211d0452e033d48fd010dddb1364e6e
commit 9973d0e33211d0452e033d48fd010dddb1364e6e Author: Evan Hanson <evhan@foldling.org> AuthorDate: Wed Jan 13 15:08:58 2016 +1300 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Tue Mar 8 22:52:33 2016 +1300 Move bitwise procedures to new chicken.bitwise module Refactors the make rules for import libraries to allow building files for modules that don't have their own unit, and moves `bitwise-and` et al. into a dedicated module within the library unit. diff --git a/README b/README index 7fb57d91..d950e28a 100644 --- a/README +++ b/README @@ -286,6 +286,7 @@ | |-- chicken | | `-- 8 | | |-- chicken.import.so + | | |-- chicken.bitwise.import.so | | |-- chicken.continuation.import.so | | |-- chicken.data-structures.import.so | | |-- chicken.eval.import.so diff --git a/c-backend.scm b/c-backend.scm index 8ccfc08e..575084cd 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -38,6 +38,7 @@ foreign-type-declaration) (import chicken scheme + chicken.bitwise chicken.data-structures chicken.compiler.core chicken.compiler.c-platform diff --git a/c-platform.scm b/c-platform.scm index 1bccf350..757df6a7 100644 --- a/c-platform.scm +++ b/c-platform.scm @@ -138,14 +138,17 @@ current-input-port current-output-port) ) (set! default-extended-bindings - '(bignum? cplxnum? ratnum? bitwise-and bitwise-ior bitwise-xor bitwise-not + '(bignum? cplxnum? ratnum? chicken.bitwise#integer-length + chicken.bitwise#bitwise-and chicken.bitwise#bitwise-not + chicken.bitwise#bitwise-ior chicken.bitwise#bitwise-xor + chicken.bitwise#arithmetic-shift chicken.bitwise#bit-set? add1 sub1 fx+ fx- fx* fx/ fxgcd fx+? fx-? fx*? fx/? fxmod fxrem fp/? fx= fx> fx< fx>= fx<= fixnum? fxneg fxmax fxmin fxlen fxand fxnot fxior - fxxor fxshr fxshl bit-set? fxodd? fxeven? fp+ fp- fp* fp/ fpmin fpmax fpneg + fxxor fxshr fxshl fxodd? fxeven? fp+ fp- fp* fp/ fpmin fpmax fpneg fpgcd fp> fp< fp= fp>= fp<= fpfloor fpceiling fptruncate fpround fpsin fpcos fptan fpasin fpacos fpatan fpatan2 fpexp fpexpt fplog fpsqrt fpabs - fpinteger? exact-integer? flonum? nan? finite? infinite? integer-length - arithmetic-shift void flush-output print print* error call/cc blob-size + fpinteger? exact-integer? flonum? nan? finite? infinite? + void flush-output print print* error call/cc blob-size identity blob=? equal=? make-polar make-rectangular real-part imag-part string->symbol symbol-append foldl foldr setter current-error-port current-thread get-keyword @@ -565,11 +568,11 @@ (rewrite 'abs 14 'fixnum 1 "C_fixnum_abs" "C_fixnum_abs") -(rewrite 'bitwise-and 21 -1 "C_fixnum_and" "C_u_fixnum_and" "C_s_a_i_bitwise_and" 6) -(rewrite 'bitwise-xor 21 0 "C_fixnum_xor" "C_fixnum_xor" "C_s_a_i_bitwise_xor" 6) -(rewrite 'bitwise-ior 21 0 "C_fixnum_or" "C_u_fixnum_or" "C_s_a_i_bitwise_ior" 6) +(rewrite 'chicken.bitwise#bitwise-and 21 -1 "C_fixnum_and" "C_u_fixnum_and" "C_s_a_i_bitwise_and" 6) +(rewrite 'chicken.bitwise#bitwise-xor 21 0 "C_fixnum_xor" "C_fixnum_xor" "C_s_a_i_bitwise_xor" 6) +(rewrite 'chicken.bitwise#bitwise-ior 21 0 "C_fixnum_or" "C_u_fixnum_or" "C_s_a_i_bitwise_ior" 6) -(rewrite 'bitwise-not 22 1 "C_s_a_i_bitwise_not" #t 6 "C_fixnum_not") +(rewrite 'chicken.bitwise#bitwise-not 22 1 "C_s_a_i_bitwise_not" #t 6 "C_fixnum_not") (rewrite 'fp+ 16 2 "C_a_i_flonum_plus" #f words-per-flonum) (rewrite 'fp- 16 2 "C_a_i_flonum_difference" #f words-per-flonum) @@ -779,7 +782,7 @@ (rewrite 'fxrem 17 2 "C_i_fixnum_remainder_checked") (rewrite - 'arithmetic-shift 8 + 'chicken.bitwise#arithmetic-shift 8 (lambda (db classargs cont callargs) ;; (arithmetic-shift <x> <-int>) ;; -> (##core#inline "C_fixnum_shift_right" <x> -<int>) @@ -1001,7 +1004,7 @@ (list arg)) ) ) ) ) ) ) ) (rewrite - 'bit-set? 8 + 'chicken.bitwise#bit-set? 8 (lambda (db classargs cont callargs) (and (= 2 (length callargs)) (make-node @@ -1013,7 +1016,7 @@ callargs) ) ) ) ) ) (rewrite - 'integer-length 8 + 'chicken.bitwise#integer-length 8 (lambda (db classargs cont callargs) (and (= 1 (length callargs)) (make-node diff --git a/chicken-install.scm b/chicken-install.scm index d1924685..79dfc7c6 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -45,7 +45,7 @@ (define +default-repository-files+ ;;XXX keep this up-to-date! - '("chicken.continuation.import.so" + '("chicken.bitwise.import.so" "chicken.data-structures.import.so" "chicken.eval.import.so" "chicken.expand.import.so" diff --git a/chicken.import.scm b/chicken.import.scm index b8408c34..3745a79f 100644 --- a/chicken.import.scm +++ b/chicken.import.scm @@ -30,13 +30,7 @@ add1 argc+argv argv - arithmetic-shift bignum? - bit-set? - bitwise-and - bitwise-ior - bitwise-not - bitwise-xor blob->string blob-size blob? @@ -167,7 +161,6 @@ getter-with-setter implicit-exit-handler infinite? - integer-length (ir-macro-transformer . chicken.expand#ir-macro-transformer) keyword->string keyword-style diff --git a/defaults.make b/defaults.make index 65ccce10..7ca9bc87 100644 --- a/defaults.make +++ b/defaults.make @@ -263,9 +263,9 @@ CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile) # import libraries PRIMITIVE_IMPORT_LIBRARIES = chicken csi chicken.foreign -POSIX_IMPORT_LIBRARY = chicken.posix DYNAMIC_IMPORT_LIBRARIES = setup-api setup-download srfi-4 -DYNAMIC_CHICKEN_IMPORT_LIBRARIES = data-structures eval repl expand \ +DYNAMIC_CHICKEN_IMPORT_LIBRARIES = bitwise posix +DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES = data-structures eval repl expand \ continuation extras files internal irregex lolevel ports tcp utils # targets @@ -279,10 +279,10 @@ CHICKEN_UNINSTALL_PROGRAM = $(PROGRAM_PREFIX)chicken-uninstall$(PROGRAM_SUFFIX) CHICKEN_STATUS_PROGRAM = $(PROGRAM_PREFIX)chicken-status$(PROGRAM_SUFFIX) CHICKEN_BUG_PROGRAM = $(PROGRAM_PREFIX)chicken-bug$(PROGRAM_SUFFIX) CHICKEN_DEBUGGER_PROGRAM ?= $(PROGRAM_PREFIX)feathers$(PROGRAM_SUFFIX)$(SCRIPT_EXT) -IMPORT_LIBRARIES = $(POSIX_IMPORT_LIBRARY) \ - $(DYNAMIC_IMPORT_LIBRARIES) \ +IMPORT_LIBRARIES = $(DYNAMIC_IMPORT_LIBRARIES) \ $(PRIMITIVE_IMPORT_LIBRARIES) \ - $(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib)) + $(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib)) \ + $(foreach lib,$(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),chicken.$(lib)) ifdef STATICBUILD CHICKEN_STATIC_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE) diff --git a/distribution/manifest b/distribution/manifest index 51c4f6ba..9b56d71d 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -244,6 +244,8 @@ chicken-syntax.c common-declarations.scm chicken.import.scm chicken.import.c +chicken.bitwise.import.scm +chicken.bitwise.import.c chicken.continuation.import.scm chicken.continuation.import.c chicken.data-structures.import.scm diff --git a/eval.scm b/eval.scm index 7bb00ae8..f79e681b 100644 --- a/eval.scm +++ b/eval.scm @@ -74,6 +74,7 @@ (define-constant core-chicken-modules '((chicken . chicken-syntax) + (chicken.bitwise . library) (chicken.continuation . continuation) (chicken.data-structures . data-structures) (chicken.eval . eval) diff --git a/library.scm b/library.scm index 49688678..5f56b3d4 100644 --- a/library.scm +++ b/library.scm @@ -1406,21 +1406,21 @@ EOF ((4) (values 2 0)) (else (error "this should never happen"))) (let*-values - (((len/4) (fxshr (fx+ (integer-length a) 1) 2)) + (((len/4) (fxshr (fx+ (chicken.bitwise#integer-length a) 1) 2)) ((len/2) (fxshl len/4 1)) ((s^ r^) (##sys#exact-integer-sqrt - (arithmetic-shift a (fxneg len/2)))) - ((mask) (- (arithmetic-shift 1 len/4) 1)) - ((a0) (bitwise-and a mask)) - ((a1) (bitwise-and (arithmetic-shift a (fxneg len/4)) mask)) + (chicken.bitwise#arithmetic-shift a (fxneg len/2)))) + ((mask) (- (chicken.bitwise#arithmetic-shift 1 len/4) 1)) + ((a0) (chicken.bitwise#bitwise-and a mask)) + ((a1) (chicken.bitwise#bitwise-and (chicken.bitwise#arithmetic-shift a (fxneg len/4)) mask)) ((q u) ((##core#primitive "C_u_integer_quotient_and_remainder") - (+ (arithmetic-shift r^ len/4) a1) - (arithmetic-shift s^ 1))) - ((s) (+ (arithmetic-shift s^ len/4) q)) - ((r) (+ (arithmetic-shift u len/4) (- a0 (* q q))))) + (+ (chicken.bitwise#arithmetic-shift r^ len/4) a1) + (chicken.bitwise#arithmetic-shift s^ 1))) + ((s) (+ (chicken.bitwise#arithmetic-shift s^ len/4) q)) + ((r) (+ (chicken.bitwise#arithmetic-shift u len/4) (- a0 (* q q))))) (if (negative? r) (values (- s 1) - (- (+ r (arithmetic-shift s 1)) 1)) + (- (+ r (chicken.bitwise#arithmetic-shift s 1)) 1)) (values s r))))) (define (exact-integer-sqrt x) @@ -1465,12 +1465,12 @@ EOF (define (##sys#exact-integer-nth-root/loc loc k n) (if (or (eq? 0 k) (eq? 1 k) (eq? 1 n)) ; Maybe call exact-integer-sqrt on n=2? (values k 0) - (let ((len (integer-length k))) + (let ((len (chicken.bitwise#integer-length k))) (if (< len n) ; Idea from Gambit: 2^{len-1} <= k < 2^{len} (values 1 (- k 1)) ; Since x >= 2, we know x^{n} can't exist ;; Set initial guess to (at least) 2^ceil(ceil(log2(k))/n) (let* ((shift-amount (inexact->exact (ceiling (/ (fx+ len 1) n)))) - (g0 (arithmetic-shift 1 shift-amount)) + (g0 (chicken.bitwise#arithmetic-shift 1 shift-amount)) (n-1 (- n 1))) (let lp ((g0 g0) (g1 (quotient @@ -1492,7 +1492,7 @@ EOF (cond ((eq? e2 0) res) ((even? e2) ; recursion is faster than iteration here - (* res (square (lp 1 (arithmetic-shift e2 -1))))) + (* res (square (lp 1 (chicken.bitwise#arithmetic-shift e2 -1))))) (else (lp (* res base) (- e2 1))))))) @@ -1637,12 +1637,12 @@ EOF (if (not (negative? point)) (exact->inexact (* mant (##sys#integer-power 10 point))) (let* ((scl (##sys#integer-power 10 (abs point))) - (bex (fx- (fx- (integer-length mant) (integer-length scl)) + (bex (fx- (fx- (chicken.bitwise#integer-length mant) (chicken.bitwise#integer-length scl)) flonum-precision))) (if (fx< bex 0) - (let* ((num (arithmetic-shift mant (fxneg bex))) + (let* ((num (chicken.bitwise#arithmetic-shift mant (fxneg bex))) (quo (round-quotient num scl))) - (cond ((> (integer-length quo) flonum-precision) + (cond ((> (chicken.bitwise#integer-length quo) flonum-precision) ;; Too many bits of quotient; readjust (set! bex (fx+ 1 bex)) (set! quo (round-quotient num (* scl 2))))) @@ -4164,15 +4164,17 @@ EOF ;;; Bitwise operations: ;; From SRFI-33 -(define (integer-length x) (##core#inline "C_i_integer_length" x)) -(define (bit-set? n i) (##core#inline "C_i_bit_setp" n i)) +(module chicken.bitwise * +(import scheme chicken) (define bitwise-and (##core#primitive "C_bitwise_and")) (define bitwise-ior (##core#primitive "C_bitwise_ior")) (define bitwise-xor (##core#primitive "C_bitwise_xor")) (define (bitwise-not n) (##core#inline_allocate ("C_s_a_i_bitwise_not" 6) n)) +(define (bit-set? n i) (##core#inline "C_i_bit_setp" n i)) +(define (integer-length x) (##core#inline "C_i_integer_length" x)) (define (arithmetic-shift n m) - (##core#inline_allocate ("C_s_a_i_arithmetic_shift" 6) n m)) + (##core#inline_allocate ("C_s_a_i_arithmetic_shift" 6) n m))) ;;; String ports: ; diff --git a/manual/Unit library b/manual/Unit library index e915cc3e..9064dd19 100644 --- a/manual/Unit library +++ b/manual/Unit library @@ -19,6 +19,9 @@ Adds/subtracts 1 from {{N}}. ==== Binary integer operations +Binary integer operations are provided by the {{(chicken bitwise)}} +module. + <procedure>(bitwise-and N1 ...)</procedure> <procedure>(bitwise-ior N1 ...)</procedure> <procedure>(bitwise-xor N1 ...)</procedure> diff --git a/modules.scm b/modules.scm index 32a66a40..367c07fd 100644 --- a/modules.scm +++ b/modules.scm @@ -931,6 +931,7 @@ (##sys#register-primitive-module 'r5rs-null '() r4rs-syntax)) (##sys#register-module-alias 'r5rs 'scheme) +(##sys#register-module-alias 'bitwise 'chicken.bitwise) (##sys#register-module-alias 'continuation 'chicken.continuation) (##sys#register-module-alias 'data-structures 'chicken.data-structures) (##sys#register-module-alias 'extras 'chicken.extras) diff --git a/posixunix.scm b/posixunix.scm index 899ead6a..5773fc7d 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -87,7 +87,8 @@ utc-time->seconds with-input-from-pipe with-output-to-pipe) (import scheme chicken) -(import chicken.files +(import chicken.bitwise + chicken.files chicken.foreign chicken.irregex chicken.ports) diff --git a/posixwin.scm b/posixwin.scm index dbdd9160..9990881d 100644 --- a/posixwin.scm +++ b/posixwin.scm @@ -712,7 +712,8 @@ EOF utc-time->seconds with-input-from-pipe with-output-to-pipe) (import scheme chicken) -(import chicken.data-structures +(import chicken.bitwise + chicken.data-structures chicken.extras chicken.files chicken.foreign diff --git a/rules.make b/rules.make index fa77c327..a2644962 100644 --- a/rules.make +++ b/rules.make @@ -85,8 +85,9 @@ DISTFILES = $(filter-out runtime.c,$(LIBCHICKEN_OBJECTS_1:=.c)) \ $(IMPORT_LIBRARIES:=.import.c) \ $(DYNAMIC_IMPORT_LIBRARIES:=.import.scm) \ $(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \ + $(foreach lib,$(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \ $(foreach lib,$(filter-out chicken,$(COMPILER_OBJECTS_1)),chicken.compiler.$(lib).import.scm) \ - $(POSIX_IMPORT_LIBRARY:=.import.scm) posixunix.c posixwin.c + posixunix.c posixwin.c # Remove the duplicate $(POSIXFILE) entry: DISTFILES := $(sort $(DISTFILES)) @@ -492,34 +493,32 @@ endif define declare-emitted-import-lib-dependency .SECONDARY: $(1).import.scm -$(1).import.scm: $(1).c +$(1).import.scm: $(2).c endef define declare-emitted-chicken-import-lib-dependency -.SECONDARY: chicken.$(1).import.scm -chicken.$(1).import.scm: $(1).c +$(call declare-emitted-import-lib-dependency,chicken.$(1),$(1)) endef define declare-emitted-compiler-import-lib-dependency -.SECONDARY: chicken.compiler.$(1).import.scm -chicken.compiler.$(1).import.scm: $(1).c +$(call declare-emitted-import-lib-dependency,chicken.compiler.$(1),$(1)) endef $(foreach lib, $(SETUP_API_OBJECTS_1),\ - $(eval $(call declare-emitted-import-lib-dependency,$(lib)))) + $(eval $(call declare-emitted-import-lib-dependency,$(lib),$(lib)))) $(foreach lib, $(DYNAMIC_IMPORT_LIBRARIES),\ - $(eval $(call declare-emitted-import-lib-dependency,$(lib)))) + $(eval $(call declare-emitted-import-lib-dependency,$(lib),$(lib)))) -$(foreach lib, $(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),\ +$(foreach lib, $(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),\ $(eval $(call declare-emitted-chicken-import-lib-dependency,$(lib)))) $(foreach lib, $(filter-out chicken,$(COMPILER_OBJECTS_1)),\ $(eval $(call declare-emitted-compiler-import-lib-dependency,$(lib)))) -# posix declared manually, as it varies based on POSIXFILE -.SECONDARY: chicken.posix.import.scm -chicken.posix.import.scm: $(POSIXFILE).c +# special cases for modules not corresponding directly to units +$(eval $(call declare-emitted-import-lib-dependency,chicken.posix,$(POSIXFILE))) +$(eval $(call declare-emitted-import-lib-dependency,chicken.bitwise,library)) chicken.c: chicken.scm mini-srfi-1.scm \ chicken.compiler.batch-driver.import.scm \ @@ -549,6 +548,7 @@ c-backend.c: c-backend.scm mini-srfi-1.scm \ chicken.compiler.c-platform.import.scm \ chicken.compiler.support.import.scm \ chicken.compiler.core.import.scm \ + chicken.bitwise.import.scm \ chicken.data-structures.import.scm \ chicken.extras.import.scm core.c: core.scm mini-srfi-1.scm \ @@ -659,12 +659,18 @@ setup-download.c: setup-download.scm \ chicken.tcp.import.scm \ chicken.utils.import.scm \ setup-api.import.scm +srfi-4.c: srfi-4.scm \ + chicken.bitwise.import.scm \ + chicken.expand.import.scm \ + chicken.foreign.import.scm posixunix.c: posixunix.scm \ + chicken.bitwise.import.scm \ chicken.files.import.scm \ chicken.foreign.import.scm \ chicken.irregex.import.scm \ chicken.ports.import.scm posixwin.c: posixwin.scm \ + chicken.bitwise.import.scm \ chicken.files.import.scm \ chicken.foreign.import.scm \ chicken.irregex.import.scm \ @@ -706,7 +712,7 @@ endef bootstrap-lib = $(CHICKEN) $(call profile-flags, $@) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ library.c: $(SRCDIR)library.scm $(SRCDIR)banner.scm $(SRCDIR)common-declarations.scm - $(bootstrap-lib) + $(bootstrap-lib) -emit-import-library chicken.bitwise internal.c: $(SRCDIR)internal.scm $(SRCDIR)mini-srfi-1.scm $(bootstrap-lib) -emit-import-library chicken.internal eval.c: $(SRCDIR)eval.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm diff --git a/srfi-4.scm b/srfi-4.scm index fffdd73f..5d77a7b4 100644 --- a/srfi-4.scm +++ b/srfi-4.scm @@ -79,7 +79,8 @@ EOF write-u8vector) (import scheme chicken) -(import chicken.expand +(import chicken.bitwise + chicken.expand chicken.foreign) (include "common-declarations.scm") diff --git a/tests/compiler-tests.scm b/tests/compiler-tests.scm index 33f2d65c..037ae156 100644 --- a/tests/compiler-tests.scm +++ b/tests/compiler-tests.scm @@ -1,8 +1,8 @@ ;;;; compiler-tests.scm -(import (chicken foreign) srfi-4) -(import-for-syntax data-structures (chicken expand)) +(import bitwise foreign srfi-4) +(import-for-syntax data-structures expand) ;; test dropping of previous toplevel assignments diff --git a/tests/fft.scm b/tests/fft.scm index a0030619..d0c2aacc 100644 --- a/tests/fft.scm +++ b/tests/fft.scm @@ -8,7 +8,8 @@ (extended-bindings) (block) (not safe))) - (else)) + (else + (use bitwise))) ;;; All the following redefinitions are *ignored* by the Gambit compiler ;;; because of the declarations above. diff --git a/tests/library-tests.scm b/tests/library-tests.scm index b6c3879d..5d860f53 100644 --- a/tests/library-tests.scm +++ b/tests/library-tests.scm @@ -1,6 +1,6 @@ ;;;; library-tests.scm -(use extras ports) +(use bitwise extras ports) (define-syntax assert-fail (syntax-rules () diff --git a/tests/numbers-test-ashinn.scm b/tests/numbers-test-ashinn.scm index bbedff1c..16913566 100644 --- a/tests/numbers-test-ashinn.scm +++ b/tests/numbers-test-ashinn.scm @@ -1,5 +1,7 @@ (include "test.scm") +(use bitwise) + (current-test-epsilon 0) ;; We want exact comparisons by default ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/tests/numbers-test-gauche.scm b/tests/numbers-test-gauche.scm index 2d4b5f15..8dd9079c 100644 --- a/tests/numbers-test-gauche.scm +++ b/tests/numbers-test-gauche.scm @@ -47,6 +47,9 @@ (+ (expt 2 (expt 2 n)) 1)) ;; Gauche compat + +(use bitwise) + (define (greatest-fixnum) most-positive-fixnum) (define (least-fixnum) most-negative-fixnum) (define (fixnum-width) fixnum-precision) diff --git a/tests/numbers-test.scm b/tests/numbers-test.scm index dcee51fe..527f809e 100644 --- a/tests/numbers-test.scm +++ b/tests/numbers-test.scm @@ -1,7 +1,7 @@ ;;;; numbers-test.scm (include "test.scm") -(use extras posix) +(use bitwise extras posix) ;; The default "comparator" doesn't know how to deal with extended number types (current-test-comparator diff --git a/tests/runtests.sh b/tests/runtests.sh index b279ae88..41aaa2e1 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -39,6 +39,7 @@ for x in \ chicken.import.so csi.import.so types.db \ setup-api.so setup-api.import.so srfi-4.import.so \ setup-download.so setup-download.import.so \ + chicken.bitwise.import.so \ chicken.continuation.import.so \ chicken.data-structures.import.so \ chicken.extras.import.so \ diff --git a/types.db b/types.db index 93cd59f5..5cc68e5e 100644 --- a/types.db +++ b/types.db @@ -870,13 +870,15 @@ (argc+argv (#(procedure #:clean) argc+argv () fixnum pointer)) (argv (#(procedure #:clean) argv () (list-of string))) -(integer-length (#(procedure #:clean #:enforce #:foldable) integer-length (integer) fixnum) + +(chicken.bitwise#integer-length + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#integer-length (integer) fixnum) ((fixnum) (##core#inline "C_i_fixnum_length" #(1))) ((*) (##core#inline "C_i_integer_length" #(1)))) -(arithmetic-shift (#(procedure #:clean #:enforce #:foldable) arithmetic-shift (integer fixnum) integer) - ((* *) (##core#inline_allocate ("C_s_a_i_arithmetic_shift" 6) - #(1) #(2)))) +(chicken-bitwise#arithmetic-shift + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#arithmetic-shift (integer fixnum) integer) + ((* *) (##core#inline_allocate ("C_s_a_i_arithmetic_shift" 6) #(1) #(2)))) (exact-integer-nth-root (#(procedure #:clean #:enforce #:foldable) exact-integer-nth-root (integer integer) integer integer) ((integer integer) (##sys#exact-integer-nth-root/loc 'exact-integer-nth-root #(1) #(2)))) @@ -886,32 +888,37 @@ (bignum? (#(procedure #:pure #:predicate bignum) bignum? (*) boolean)) -(bit-set? (#(procedure #:clean #:enforce #:foldable) bit-set? (integer integer) boolean) +(chicken.bitwise#bit-set? + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#bit-set? (integer integer) boolean) ((fixnum fixnum) (##core#inline "C_i_fixnum_bit_setp" #(1) #(2))) ((* *) (##core#inline "C_i_bit_setp" #(1) #(2)))) -(bitwise-and (#(procedure #:clean #:enforce #:foldable) bitwise-and (#!rest integer) integer) +(chicken.bitwise#bitwise-and + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#bitwise-and (#!rest integer) integer) (() '-1) ((fixnum) (fixnum) #(1)) ((integer) #(1)) ((fixnum fixnum) (fixnum) (##core#inline "C_u_fixnum_and" #(1) #(2))) ((* *) (##core#inline_allocate ("C_s_a_i_bitwise_and" 6) #(1) #(2)))) -(bitwise-ior (#(procedure #:clean #:enforce #:foldable) bitwise-ior (#!rest integer) integer) +(chicken.bitwise#bitwise-ior + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#bitwise-ior (#!rest integer) integer) (() '0) ((fixnum) (fixnum) #(1)) ((integer) #(1)) ((fixnum fixnum) (fixnum) (##core#inline "C_u_fixnum_or" #(1) #(2))) ((* *) (##core#inline_allocate ("C_s_a_i_bitwise_ior" 6) #(1) #(2)))) -(bitwise-xor (#(procedure #:clean #:enforce #:foldable) bitwise-xor (#!rest integer) integer) +(chicken.bitwise#bitwise-xor + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#bitwise-xor (#!rest integer) integer) (() '0) ((fixnum) (fixnum) #(1)) ((integer) #(1)) ((fixnum fixnum) (fixnum) (##core#inline "C_fixnum_xor" #(1) #(2))) ((* *) (##core#inline_allocate ("C_s_a_i_bitwise_xor" 6) #(1) #(2)))) -(bitwise-not (#(procedure #:clean #:enforce #:foldable) bitwise-not (integer) integer) +(chicken.bitwise#bitwise-not + (#(procedure #:clean #:enforce #:foldable) chicken.bitwise#bitwise-not (integer) integer) ((* *) (##core#inline_allocate ("C_s_a_i_bitwise_not" 6) #(1)))) (blob->string (#(procedure #:clean #:enforce) blob->string (blob) string))Trap