diff options
author | Paul Eggert <eggert@twinsun.com> | 1993-08-10 04:14:17 +0000 |
---|---|---|
committer | Paul Eggert <eggert@twinsun.com> | 1993-08-10 04:14:17 +0000 |
commit | 2ec5af1103139ca401e649266ff6b11e65580b1c (patch) | |
tree | 5f80659b85b5bd08f327427be0d01bd6f2e673a5 /lisp/emacs-lisp/ring.el | |
parent | adb47462305061249b4aa35a6ea9be0a68625fb4 (diff) | |
download | emacs-2ec5af1103139ca401e649266ff6b11e65580b1c.tar.gz |
(ring-mod): Remove, since floor and mod
now subsume them. All callers changed.
Diffstat (limited to 'lisp/emacs-lisp/ring.el')
-rw-r--r-- | lisp/emacs-lisp/ring.el | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el index 28f568d17fd..390aba93da1 100644 --- a/lisp/emacs-lisp/ring.el +++ b/lisp/emacs-lisp/ring.el @@ -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 @@ item to make room." (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 @@ numeric, remove the element indexed." (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 @@ numeric, remove the element indexed." (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 |