[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp a3b816f 4/5: * lisp/emacs-lisp/comp-cstr.el (comp-cs
From: |
Andrea Corallo |
Subject: |
feature/native-comp a3b816f 4/5: * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Better `comp-value-to-cstr'. |
Date: |
Tue, 29 Dec 2020 11:52:00 -0500 (EST) |
branch: feature/native-comp
commit a3b816ff8ce17ec559043b053e60b631e5dc5eb8
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* lisp/emacs-lisp/comp-cstr.el (comp-cstr): Better `comp-value-to-cstr'.
---
lisp/emacs-lisp/comp-cstr.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index ce70242..c03056e 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -61,7 +61,11 @@
'((- . +))))))
(:constructor comp-value-to-cstr
(value &aux
- (valset (list value))
+ (integer (integerp value))
+ (valset (unless integer
+ (list value)))
+ (range (when integer
+ `((,value . ,value))))
(typeset ())))
(:constructor comp-irange-to-cstr
(irange &aux
@@ -170,9 +174,8 @@ Return them as multiple value."
collect cstr into positives
finally return (cl-values positives negatives)))
-(defvar comp-cstr-one (make-comp-cstr :typeset ()
- :range '((1 . 1)))
- "Represent the integer immediate one (1).")
+(defvar comp-cstr-one (comp-value-to-cstr 1)
+ "Represent the integer immediate one.")
(defun comp-pred-to-cstr (predicate)
"Given PREDICATE return the correspondig constraint."