From 1a35ccb8d2e76630af193c92f21b97afdd493cc5 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 16 Nov 2019 15:01:40 -0800 Subject: [PATCH] Use euclidean/ from division package as pointed out by Taylor. Also fix typo. --- src/runtime/primitive-arithmetic.scm | 35 ---------------------------- src/runtime/runtime.pkg | 1 - 2 files changed, 36 deletions(-) diff --git a/src/runtime/primitive-arithmetic.scm b/src/runtime/primitive-arithmetic.scm index 11e03ecdc..df2bdd310 100644 --- a/src/runtime/primitive-arithmetic.scm +++ b/src/runtime/primitive-arithmetic.scm @@ -170,41 +170,6 @@ USA. (values (+ q 1) (- x (* (+ q 1) y)))) (else (values (- q 1) (- x (* (- q 1) y))))))) - -(define (euclidean/ n d) - (if (and (exact-integer? n) (exact-integer? d)) - (cond ((and (negative? n) (negative? d)) - (ceiling-/- n d)) - ((negative? n) - (floor-/+ n d)) - ((negative? d) - (let ((d (- 0 d))) - (values (- 0 (quotient n d)) - (remainder n d)))) - (else - (values (quotient n d) - (remainder n d)))) - (let ((q - (if (negative? d) - (ceiling (/ n d)) - (floor (/ n d))))) - (values q (- n (* d q)))))) - -(define (floor-/+ n d) - (let ((n (- 0 n))) - (let ((q (quotient n d)) - (r (remainder n d))) - (if (zero? r) - (values (- 0 q) r) - (values (- (- 0 q) 1) (- d r)))))) - -(define (ceiling-/- n d) - (let ((n (- 0 n)) (d (- 0 d))) - (let ((q (quotient n d)) - (r (remainder n d))) - (if (zero? r) - (values q r) - (values (+ q 1) (- d r)))))) (define (fxif mask i j) (fxior (fxand mask i) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 927c6380a..8e6aa938d 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -311,7 +311,6 @@ USA. fx>? ;SRFI-143 fxabs ;SRFI-143 fxand ;SRFI-143 - fxandc fxarithmetic-shift ;SRFI-143 fxarithmetic-shift-right ;SRFI-143 fxbit-count ;SRFI-143 -- 2.25.1