changeset 4516:95b9760d19e3

(ring-mod): Remove, since floor and mod now subsume them. All callers changed.
author Paul Eggert <eggert@twinsun.com>
date Tue, 10 Aug 1993 04:14:17 +0000
parents 85426a9911c0
children 45e3868140f1
files lisp/emacs-lisp/ring.el
diffstat 1 files changed, 4 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/ring.el	Tue Aug 10 04:14:17 1993 +0000
+++ b/lisp/emacs-lisp/ring.el	Tue Aug 10 04:14:17 1993 +0000
@@ -68,8 +68,8 @@
   (= 0 (car (cdr ring))))
 
 (defun ring-index (index head ringlen veclen)
-  (setq index (ring-mod index ringlen))
-  (ring-mod (1- (+ head (- ringlen index))) veclen))
+  (setq index (mod index ringlen))
+  (mod (1- (+ head (- ringlen index))) veclen))
 
 (defun ring-insert (ring item)
   "Insert a new item onto the ring. If the ring is full, dump the oldest
@@ -79,7 +79,7 @@
 	 (hd (car ring))
 	 (ln (car (cdr ring))))
     (prog1
-	(aset vec (ring-mod (+ hd ln) veclen) item)
+	(aset vec (mod (+ hd ln) veclen) item)
       (if (= ln veclen)
 	  (setcar ring (ring-plus1 hd veclen))
 	(setcar (cdr ring) (1+ ln))))))
@@ -94,7 +94,7 @@
 	  (ln (car (cdr ring)))
 	  (vec (cdr (cdr ring)))
 	  (veclen (length vec))
-	  (tl (ring-mod (1- (+ hd ln)) veclen))
+	  (tl (mod (1- (+ hd ln)) veclen))
 	  oldelt)
       (if (null index)
 	  (setq index (1- ln)))
@@ -107,14 +107,6 @@
       (setcar (cdr ring) (1- ln))
       oldelt)))
 
-(defun ring-mod (n m)
-  "Returns N mod M.  M is positive.
-Answer is guaranteed to be non-negative, and less than m."
-  (let ((n (% n m)))
-    (if (>= n 0) n
-	(+ n
-	   (if (>= m 0) m (- m)))))) ; (abs m)
-
 (defun ring-ref (ring index)
   "Returns RING's INDEX element.
 INDEX need not be <= the ring length, the appropriate modulo operation