mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-12 09:00:40 -08:00
* Fix some comp-vec logic
* lisp/emacs-lisp/comp.el (comp-vec-length, comp-vec-append) (comp-vec-prepend): Fix logic. (comp-vec-aref): Fix indentation.
This commit is contained in:
parent
9ae48ae714
commit
3a31fca5db
1 changed files with 4 additions and 4 deletions
|
|
@ -617,7 +617,7 @@ Useful to hook into pass checkers.")
|
||||||
|
|
||||||
(defsubst comp-vec-length (vec)
|
(defsubst comp-vec-length (vec)
|
||||||
"Return the number of elements of VEC."
|
"Return the number of elements of VEC."
|
||||||
(+ (comp-vec-beg vec) (comp-vec-end vec)))
|
(- (comp-vec-end vec) (comp-vec-beg vec)))
|
||||||
|
|
||||||
(defsubst comp-vec--verify-idx (vec idx)
|
(defsubst comp-vec--verify-idx (vec idx)
|
||||||
"Check idx is in bounds for VEC."
|
"Check idx is in bounds for VEC."
|
||||||
|
|
@ -635,14 +635,14 @@ Useful to hook into pass checkers.")
|
||||||
(defsubst comp-vec-append (vec elt)
|
(defsubst comp-vec-append (vec elt)
|
||||||
"Append ELT into VEC.
|
"Append ELT into VEC.
|
||||||
ELT is returned."
|
ELT is returned."
|
||||||
(puthash (comp-vec-end vec) elt (comp-vec-aref vec))
|
(puthash (comp-vec-end vec) elt (comp-vec-data vec))
|
||||||
(cl-incf (comp-vec-end vec))
|
(cl-incf (comp-vec-end vec))
|
||||||
elt)
|
elt)
|
||||||
|
|
||||||
(defsubst comp-vec-prepend (vec elt)
|
(defsubst comp-vec-prepend (vec elt)
|
||||||
"Prepend ELT into VEC.
|
"Prepend ELT into VEC.
|
||||||
ELT is returned."
|
ELT is returned."
|
||||||
(puthash (comp-vec-beg vec) elt (comp-vec-aref vec))
|
(puthash (1- (comp-vec-beg vec)) elt (comp-vec-data vec))
|
||||||
(cl-decf (comp-vec-beg vec))
|
(cl-decf (comp-vec-beg vec))
|
||||||
elt)
|
elt)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue