We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b911c3 commit bf954d1Copy full SHA for bf954d1
plugins/primus_lisp/lisp/ascii.lisp
@@ -10,8 +10,11 @@
10
(= s 32)))
11
12
(defun ascii-sign (s)
13
- "(ascii-sign S) is 1 if S is + and -1 otherwise"
14
- (if (= s ?+) 1 -1))
+ "(ascii-sign S) is 1 if S is +, -1 if it -, or 0 otherwise"
+ (case s
15
+ ?- -1
16
+ ?+ 1
17
+ 0))
18
19
(defun ascii-is-digit (s)
20
"(ascii-is-digit s) is true if S is an ascii representation of decimal digit"
plugins/primus_lisp/lisp/atoi.lisp
@@ -14,6 +14,9 @@
(skip-all atoi-prefix s)
(let ((v 0)
(sign (ascii-sign (memory-read s))))
+ (if (= sign 0)
+ (set sign 1)
+ (incr s))
(while (ascii-is-digit (memory-read s))
21
(set v (+ (* v 10) (atoi-read-digit s)))
22
(incr s))
0 commit comments