Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use built-in fns for readability

  • Loading branch information...
commit a5990e4737046e6df7cb15fbf4816d434405f326 1 parent fe9d4c4
Devin Walters authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/clj_dcpu16/core.clj
6 src/clj_dcpu16/core.clj
View
@@ -41,7 +41,7 @@
(defn change-memory
[address value]
- (let [address (if (not= address :push)
+ (let [address (if-not (= address :push)
address
(do (dec-memory :sp)
(get-memory :sp)))]
@@ -96,7 +96,7 @@
(defmethod execute 0x3 [word]
;; SUB a from b
(let [[a b out] (process word)]
- (if (< 0 (- a b))
+ (if (pos? (- a b))
(change-memory :o 0xFFFF)
(change-memory :o 0))
(change-memory out (bit-and 0xFFFF (- a b)))
@@ -116,7 +116,7 @@
(defmethod execute 0x6 [word]
;; MOD a = a % b
(let [[a b out] (process word)]
- (if (= 0 b)
+ (if (zero? b)
(change-memory out 0)
(change-memory out (bit-and 0xFFFF (mod a b))))
(inc-memory :pc)))
Please sign in to comment.
Something went wrong with that request. Please try again.