From a12762e74b26d556e57b9d2c1a12424d0b67036f Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 14 Jan 2019 07:44:17 +0000 Subject: [PATCH] Teach assembler about MODULO. XXX Should maybe do EUCLIDEAN-REMAINDER or the full gamut of division operators, but this is all I need for now. --- src/compiler/back/bitutl.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/back/bitutl.scm b/src/compiler/back/bitutl.scm index 7cb117b05..433071660 100644 --- a/src/compiler/back/bitutl.scm +++ b/src/compiler/back/bitutl.scm @@ -130,7 +130,8 @@ USA. (* . ,(lambda () interval:*)) (/ . ,(lambda () interval:/)) (QUOTIENT . ,(lambda () interval:quotient)) - (REMAINDER . ,(lambda () interval:remainder)))) + (REMAINDER . ,(lambda () interval:remainder)) + (MODULO . ,(lambda () interval:modulo)))) (define-integrable (->machine-pc pc) (paranoid-quotient pc addressing-granularity)) @@ -271,6 +272,11 @@ USA. (if (or (interval? a) (interval? b)) (error "REMAINDER doesn't do intervals:" a b)) (remainder a b)) + +(define (interval:modulo a b) + (if (or (interval? a) (interval? b)) + (error "MODULO doesn't do intervals:" a b)) + (modulo a b)) ;;; A segment consists of an ending point and a coefficient. ;;; The ending point has a minimum and maximum non-negative integer value. -- 2.25.1