;;; SRFI-143 — Fixnums ;;; ;;; Author: John Cowan ;;; ;;; Copyright (c) 2016 John Cowan. All Rights Reserved. ;;; ;;; Permission is hereby granted, free of charge, to any person obtaining a ;;; copy of this software and associated documentation files (the "Software"), ;;; to deal in the Software without restriction, including without limitation ;;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;;; and/or sell copies of the Software, and to permit persons to whom the ;;; Software is furnished to do so, subject to the following conditions: ;;; ;;; The above copyright notice and this permission notice shall be included in ;;; all copies or substantial portions of the Software. ;;; ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;;; DEALINGS IN THE SOFTWARE. (define-library (srfi 143) (import (scheme base)) (cond-expand (chicken-5 (import (rename (only (chicken fixnum) fxmax fxmin fx= fx< fx> fx<= fx>= fx/ fx+ fx- fx* fxlen fxrem fxshl fxshr fixnum-bits most-positive-fixnum most-negative-fixnum fxneg fxand fxior fxxor fxnot fxodd? fxeven?) (fx< fx fx>?) (fx<= fx<=?) (fx>= fx>=?) (fx= fx=?) (fxlen fxlength) (fxrem fxremainder) (fxshl fxarithmetic-shift-left) (fxshr fxarithmetic-shift-right) (fixnum-bits fx-width) (most-positive-fixnum fx-greatest) (most-negative-fixnum fx-least)) (only (chicken bitwise) bit->boolean) (rename (only (chicken base) fixnum? exact-integer-sqrt) (exact-integer-sqrt fxsqrt)) (only (chicken platform) register-feature!))) (else (error "This implementation of SRFI-143 is specific to CHICKEN Scheme."))) (export fx-width fx-greatest fx-least) (export fixnum? fx=? fx? fx<=? fx>=? fxzero? fxpositive? fxnegative? fxodd? fxeven? fxmax fxmin) (export fx+ fx- fxneg fx* fx/ fxquotient fxremainder fxabs fxsquare fxsqrt) (export fx+/carry fx-/carry fx*/carry) (export fxnot fxand fxior fxxor fxarithmetic-shift fxarithmetic-shift-left fxarithmetic-shift-right fxbit-count fxlength fxif fxbit-set? fxcopy-bit fxfirst-set-bit fxbit-field fxbit-field-rotate fxbit-field-reverse) (include "srfi-143.scm") (begin (register-feature! 'srfi-143)) ;; End of module )