Moritz Heidkamp avatar Moritz Heidkamp committed 892eab0

Remove fx operations for 32 bit compat

Comments (0)

Files changed (1)

persistent-hash-map.scm

 (define (inode-kv-reduce vec f init)
   (let loop ((i 0) (init init))
     (if (< i (vector-length vec))
-        (loop (fx+ i 2)
+        (loop (+ i 2)
               (let ((k (vector-ref vec i)))
                 (if k
-                    (f k (vector-ref vec (fx+ 1 i)) init)
-                    (let ((node (vector-ref vec (fx+ 1 i))))
+                    (f k (vector-ref vec (+ 1 i)) init)
+                    (let ((node (vector-ref vec (+ 1 i))))
                       (if node
                           (-kv-reduce node f init)
                           init)))))
 
 (: arithmetic-shift-right (fixnum fixnum --> fixnum))
 (define (arithmetic-shift-right n x)
-  (arithmetic-shift n (fx- 0 x)))
+  (arithmetic-shift n (- 0 x)))
 
 (: mask (fixnum fixnum --> fixnum))
 (define (mask hash shift)
 (: bit-count (fixnum --> fixnum))
 
 ;; (define (bit-count v)
-;;   (let* ((v (fx- v (bitwise-and (arithmetic-shift v -1) #x55555555)))
-;;          (v (fx+ (bitwise-and v #x33333333) (bitwise-and (arithmetic-shift v -2) #x33333333))))
-;;     (arithmetic-shift (fx* (bitwise-and (fx+ v (arithmetic-shift v -4)) #xF0F0F0F) #x1010101) -24)))
+;;   (let* ((v (- v (bitwise-and (arithmetic-shift v -1) #x55555555)))
+;;          (v (+ (bitwise-and v #x33333333) (bitwise-and (arithmetic-shift v -2) #x33333333))))
+;;     (arithmetic-shift (* (bitwise-and (+ v (arithmetic-shift v -4)) #xF0F0F0F) #x1010101) -24)))
 
 (define bit-count
   (foreign-lambda int __builtin_popcount unsigned-integer))
 
 (: bitmap-indexed-node-index (fixnum fixnum --> fixnum))
 (define (bitmap-indexed-node-index bitmap bit)
-  (bit-count (bitwise-and bitmap (fx- bit 1))))
+  (bit-count (bitwise-and bitmap (- bit 1))))
 
 (: vector-copy* (vector fixnum vector fixnum fixnum -> vector))
 (define (vector-copy* from i to j len)
         to
         (begin
           (vector-set! to j (vector-ref from i))
-          (loop (fx+ 1 i) (fx+ 1 j) (fx- len 1))))))
+          (loop (+ 1 i) (+ 1 j) (- len 1))))))
 
 (: vector-copy (vector -> vector))
 (define (vector-copy vec)
 
 (: vector-copy-downward (vector fixnum vector fixnum fixnum -> vector))
 (define (vector-copy-downward from i to j len)
-  (let loop ((i (fx+ i (fx- len 1)))
-             (j (fx+ j (fx- len 1)))
+  (let loop ((i (+ i (- len 1)))
+             (j (+ j (- len 1)))
              (len len))
     (if (zero? len)
         to
         (begin
           (vector-set! to j (vector-ref from i))
-          (loop (fx- i 1) (fx- j 1) (fx- len 1))))))
+          (loop (- i 1) (- j 1) (- len 1))))))
 
 (: vector-copy-and-set
    (or (vector fixnum * -> vector)
 
 (: remove-pair (vector fixnum -> vector))
 (define (remove-pair vec i)
-  (let ((new-vec (make-vector (fx- (vector-length vec) 2) #f)))
-    (vector-copy* vec 0 new-vec 0 (fx* 2 i))
-    (vector-copy* vec (fx* 2 (fx+ i 1)) new-vec (fx* 2 i) (fx- (vector-length new-vec) (fx* 2 i)))
+  (let ((new-vec (make-vector (- (vector-length vec) 2) #f)))
+    (vector-copy* vec 0 new-vec 0 (* 2 i))
+    (vector-copy* vec (* 2 (+ i 1)) new-vec (* 2 i) (- (vector-length new-vec) (* 2 i)))
     new-vec))
 
 (: hash-collision-node-find-index (vector fixnum * -> fixnum))
 (define (hash-collision-node-find-index vec count key)
-  (let ((lim (fx* 2 count)))
+  (let ((lim (* 2 count)))
     (let loop ((i 0))
       (if (< i lim)
           (if (key-test key (vector-ref vec i))
               i
-              (loop (fx+ i 2)))
+              (loop (+ i 2)))
           -1))))
 
 (define-class (bitmap-indexed-node bi-)
             (if (>= n 16)
                 (let* ((nodes (make-vector 32 #f))
                        (jdx   (mask hash shift)))
-                  (vector-set! nodes jdx (-inode-add +empty-bitmap-indexed-node+ (fx+ shift 5) hash key val added-leaf?))
+                  (vector-set! nodes jdx (-inode-add +empty-bitmap-indexed-node+ (+ shift 5) hash key val added-leaf?))
                   (let loop ((i 0) (j 0))
                     (if (< i 32)
                         (if (zero? (bitwise-and (arithmetic-shift-right (bi-bitmap inode) i) 1))
-                            (loop (fx+ 1 i) j)
+                            (loop (+ 1 i) j)
                             (begin
                               (vector-set! nodes i
                                            (if (vector-ref (bi-vec inode) j)
                                                (-inode-add +empty-bitmap-indexed-node+
-                                                           (fx+ shift 5)
+                                                           (+ shift 5)
                                                            (key-hash (vector-ref (bi-vec inode) j))
                                                            (vector-ref (bi-vec inode) j)
-                                                           (vector-ref (bi-vec inode) (fx+ 1 j))
+                                                           (vector-ref (bi-vec inode) (+ 1 j))
                                                            added-leaf?)
-                                               (vector-ref (bi-vec inode) (fx+ 1 j))))
-                              (loop (fx+ 1 i) (fx+ j 2))))))
-                  (make-v-node #f (fx+ 1 n) nodes))
-                (let ((new-vec (make-vector (fx* 2 (fx+ 1 n)) #f)))
-                  (vector-copy* (bi-vec inode) 0 new-vec 0 (fx* 2 idx))
-                  (vector-set! new-vec (fx* 2 idx) key)
-                  (vector-set! new-vec (fx+ 1 (fx* 2 idx)) val)
-                  (vector-copy* (bi-vec inode) (fx* 2 idx) new-vec (fx* 2 (fx+ 1 idx)) (fx* 2 (fx- n idx)))
+                                               (vector-ref (bi-vec inode) (+ 1 j))))
+                              (loop (+ 1 i) (+ j 2))))))
+                  (make-v-node #f (+ 1 n) nodes))
+                (let ((new-vec (make-vector (* 2 (+ 1 n)) #f)))
+                  (vector-copy* (bi-vec inode) 0 new-vec 0 (* 2 idx))
+                  (vector-set! new-vec (* 2 idx) key)
+                  (vector-set! new-vec (+ 1 (* 2 idx)) val)
+                  (vector-copy* (bi-vec inode) (* 2 idx) new-vec (* 2 (+ 1 idx)) (* 2 (- n idx)))
                   (box-set! added-leaf? #t)
                   (make-bi-node #f (bitwise-ior (bi-bitmap inode) bit) new-vec))))
-          (let ((maybe-key   (vector-ref (bi-vec inode) (fx* 2 idx)))
-                (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx)))))
+          (let ((maybe-key   (vector-ref (bi-vec inode) (* 2 idx)))
+                (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx)))))
             (cond ((not maybe-key)
-                   (let ((n (-inode-add val-or-node (fx+ shift 5) hash key val added-leaf?)))
+                   (let ((n (-inode-add val-or-node (+ shift 5) hash key val added-leaf?)))
                      (if (eq? n val-or-node)
                          inode
-                         (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (fx+ 1 (fx* 2 idx)) n)))))
+                         (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (+ 1 (* 2 idx)) n)))))
                   ((key-test key maybe-key)
                    (if (eq? val val-or-node)
                        inode
-                       (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (fx+ 1 (fx* 2 idx)) val))))
+                       (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (+ 1 (* 2 idx)) val))))
                   (else
                    (box-set! added-leaf? #t)
                    (make-bi-node #f (bi-bitmap inode)
                                  (vector-copy-and-set (bi-vec inode)
-                                                      (fx* 2 idx) #f
-                                                      (fx+ 1 (fx* 2 idx))
-                                                      (create-node (fx+ shift 5) maybe-key val-or-node hash key val)))))))))
+                                                      (* 2 idx) #f
+                                                      (+ 1 (* 2 idx))
+                                                      (create-node (+ shift 5) maybe-key val-or-node hash key val)))))))))
 
   (define-generic (-inode-without shift hash key)
     (let ((bit (bitpos hash shift)))
       (if (zero? (bitwise-and (bi-bitmap inode) bit))
           inode
           (let* ((idx         (bitmap-indexed-node-index (bi-bitmap inode) bit))
-                 (maybe-key   (vector-ref (bi-vec inode) (fx* 2 idx)))
-                 (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx)))))
+                 (maybe-key   (vector-ref (bi-vec inode) (* 2 idx)))
+                 (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx)))))
             (cond ((not maybe-key)
-                   (let ((n (-inode-without val-or-node (fx+ shift 5) hash key)))
+                   (let ((n (-inode-without val-or-node (+ shift 5) hash key)))
                      (cond ((eq? n val-or-node) inode)
-                           (n (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (fx+ 1 (fx* 2 idx)) n)))
-                           ((fx= (bi-bitmap inode) bit) #f)
+                           (n (make-bi-node #f (bi-bitmap inode) (vector-copy-and-set (bi-vec inode) (+ 1 (* 2 idx)) n)))
+                           ((= (bi-bitmap inode) bit) #f)
                            (else (make-bi-node #f (bitwise-xor (bi-bitmap inode) bit) (remove-pair (bi-vec inode) idx))))))
                   ((key-test key maybe-key)
                    (make-bi-node #f (bitwise-xor (bi-bitmap inode) bit) (remove-pair (bi-vec inode) idx)))
       (if (zero? (bitwise-and (bi-bitmap inode) bit))
           not-found
           (let* ((idx (bitmap-indexed-node-index (bi-bitmap inode) bit))
-                 (maybe-key (vector-ref (bi-vec inode) (fx* 2 idx)))
-                 (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx)))))
-            (cond ((not maybe-key) (-inode-lookup val-or-node (fx+ shift 5) hash key not-found))
+                 (maybe-key (vector-ref (bi-vec inode) (* 2 idx)))
+                 (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx)))))
+            (cond ((not maybe-key) (-inode-lookup val-or-node (+ shift 5) hash key not-found))
                   ((key-test key maybe-key) val-or-node)
                   (else not-found))))))
 
   ;;     (if (zero? (bitwise-and (bi-bitmap inode) bit))
   ;;         not-found
   ;;         (let* [(idx (bitmap-indexed-node-index (bi-bitmap inode) bit))
-  ;;                (maybe-key (vector-ref (bi-vec inode) (fx* 2 idx)))
-  ;;                (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx))))]
+  ;;                (maybe-key (vector-ref (bi-vec inode) (* 2 idx)))
+  ;;                (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx))))]
   ;;           (cond ((not maybe-key)
-  ;;                  (-inode-find val-or-node (fx+ shift 5) hash key not-found))
+  ;;                  (-inode-find val-or-node (+ shift 5) hash key not-found))
   ;;                 ((key-test key maybe-key)
   ;;                  (cons maybe-key val-or-node))
   ;;                 (else not-found))))))
     (if (eq? e (bi-edit inode))
         inode
         (let* ((n (bit-count (bi-bitmap inode)))
-               (new-vec (make-vector (if (negative? n) 4 (fx* 2 (fx+ 1 n))) #f)))
-          (vector-copy* (bi-vec inode) 0 new-vec 0 (fx* 2 n))
+               (new-vec (make-vector (if (negative? n) 4 (* 2 (+ 1 n))) #f)))
+          (vector-copy* (bi-vec inode) 0 new-vec 0 (* 2 n))
           (make-bi-node e (bi-bitmap inode) new-vec))))
 
   (define-generic (-ensure-editable e)
     (bi-ensure-editable inode e))
 
   (define (-edit-and-remove-pair e bit i)
-    (if (fx= (bi-bitmap inode) bit)
+    (if (= (bi-bitmap inode) bit)
         #f
         (let* ((editable (bi-ensure-editable inode e))
                (evec     (bi-vec editable))
                (len      (vector-length evec)))
           (bi-bitmap-set! editable (bitwise-xor bit (bi-bitmap editable)))
-          (vector-copy* evec (fx* 2 (fx+ 1 i))
-                        evec (fx* 2 i)
-                        (fx- len (fx* 2 (fx+ 1 i))))
-          (vector-set! evec (fx- len 2) #f)
-          (vector-set! evec (fx- len 1) #f)
+          (vector-copy* evec (* 2 (+ 1 i))
+                        evec (* 2 i)
+                        (- len (* 2 (+ 1 i))))
+          (vector-set! evec (- len 2) #f)
+          (vector-set! evec (- len 1) #f)
           editable)))
 
   (define-generic (-inode-add! edit shift hash key val added-leaf?)
       (if (zero? (bitwise-and (bi-bitmap inode) bit))
           (let ((n (bit-count (bi-bitmap inode))))
             (cond
-             ((< (fx* 2 n) (vector-length (bi-vec inode)))
+             ((< (* 2 n) (vector-length (bi-vec inode)))
               (let* ((editable (bi-ensure-editable inode edit))
                      (evec     (bi-vec editable)))
                 (box-set! added-leaf? #t)
-                (vector-copy-downward evec (fx* 2 idx)
-                                      evec (fx* 2 (fx+ 1 idx))
-                                      (fx* 2 (fx- n idx)))
-                (vector-set! evec (fx* 2 idx) key)
-                (vector-set! evec (fx+ 1 (fx* 2 idx)) val)
+                (vector-copy-downward evec (* 2 idx)
+                                      evec (* 2 (+ 1 idx))
+                                      (* 2 (- n idx)))
+                (vector-set! evec (* 2 idx) key)
+                (vector-set! evec (+ 1 (* 2 idx)) val)
                 (bi-bitmap-set! editable (bitwise-ior (bi-bitmap editable) bit))
                 editable))
              
              ((>= n 16)
               (let ((nodes (make-vector 32 #f))
                     (jdx   (mask hash shift)))
-                (vector-set! nodes jdx (-inode-add! +empty-bitmap-indexed-node+ edit (fx+ shift 5) hash key val added-leaf?))
+                (vector-set! nodes jdx (-inode-add! +empty-bitmap-indexed-node+ edit (+ shift 5) hash key val added-leaf?))
                 (let loop ((i 0) (j 0))
                   (if (< i 32)
                       (if (zero? (bitwise-and (arithmetic-shift-right (bi-bitmap inode) i) 1))
-                          (loop (fx+ 1 i) j)
+                          (loop (+ 1 i) j)
                           (begin
                             (vector-set! nodes i
                                          (if (vector-ref (bi-vec inode) j)
                                              (-inode-add! +empty-bitmap-indexed-node+
                                                           edit
-                                                          (fx+ shift 5)
+                                                          (+ shift 5)
                                                           (key-hash (vector-ref (bi-vec inode) j))
                                                           (vector-ref (bi-vec inode) j)
-                                                          (vector-ref (bi-vec inode) (fx+ 1 j))
+                                                          (vector-ref (bi-vec inode) (+ 1 j))
                                                           added-leaf?)
-                                             (vector-ref (bi-vec inode) (fx+ 1 j))))
-                            (loop (fx+ 1 i) (fx+ j 2))))))
-                (make-v-node edit (fx+ 1 n) nodes)))
+                                             (vector-ref (bi-vec inode) (+ 1 j))))
+                            (loop (+ 1 i) (+ j 2))))))
+                (make-v-node edit (+ 1 n) nodes)))
 
              (else
-              (let ((new-vec (make-vector (fx* 2 (fx+ n 4)) #f)))
-                (vector-copy* (bi-vec inode) 0 new-vec 0 (fx* 2 idx))
-                (vector-set! new-vec (fx* 2 idx) key)
-                (vector-set! new-vec (fx+ 1 (fx* 2 idx)) val)
-                (vector-copy* (bi-vec inode) (fx* 2 idx) new-vec (fx* 2 (fx+ 1 idx)) (fx* 2 (fx- n idx)))
+              (let ((new-vec (make-vector (* 2 (+ n 4)) #f)))
+                (vector-copy* (bi-vec inode) 0 new-vec 0 (* 2 idx))
+                (vector-set! new-vec (* 2 idx) key)
+                (vector-set! new-vec (+ 1 (* 2 idx)) val)
+                (vector-copy* (bi-vec inode) (* 2 idx) new-vec (* 2 (+ 1 idx)) (* 2 (- n idx)))
                 (box-set! added-leaf? #t)
                 (let ((editable (bi-ensure-editable inode edit)))
                   (bi-vec-set! editable new-vec)
                   (bi-bitmap-set! editable (bitwise-ior (bi-bitmap editable) bit))
                   editable)))))
-          (let ((maybe-key (vector-ref (bi-vec inode) (fx* 2 idx)))
-                (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx)))))
+          (let ((maybe-key (vector-ref (bi-vec inode) (* 2 idx)))
+                (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx)))))
             (cond ((not maybe-key)
-                   (let ((n (-inode-add! val-or-node edit (fx+ shift 5) hash key val added-leaf?)))
+                   (let ((n (-inode-add! val-or-node edit (+ shift 5) hash key val added-leaf?)))
                      (if (eq? n val-or-node)
                          inode
-                         (edit-and-set inode edit (fx+ 1 (fx* 2 idx)) n))))
+                         (edit-and-set inode edit (+ 1 (* 2 idx)) n))))
 
                   ((key-test key maybe-key)
                    (if (eq? val val-or-node)
                        inode
-                       (edit-and-set inode edit (fx+ 1 (fx* 2 idx)) val)))
+                       (edit-and-set inode edit (+ 1 (* 2 idx)) val)))
 
                   (else
                    (box-set! added-leaf? #t)
-                   (edit-and-set inode edit (fx* 2 idx) #f (fx+ 1 (fx* 2 idx))
-                                 (create-node edit (fx+ shift 5) maybe-key val-or-node hash key val))))))))
+                   (edit-and-set inode edit (* 2 idx) #f (+ 1 (* 2 idx))
+                                 (create-node edit (+ shift 5) maybe-key val-or-node hash key val))))))))
 
   (define-generic (-inode-without! edit shift hash key removed-leaf?)
     (let ((bit (bitpos hash shift)))
       (if (zero? (bitwise-and (bi-bitmap inode) bit))
           inode
           (let* ((idx (bitmap-indexed-node-index (bi-bitmap inode) bit))
-                 (maybe-key (vector-ref (bi-vec inode) (fx* 2 idx)))
-                 (val-or-node (vector-ref (bi-vec inode) (fx+ 1 (fx* 2 idx)))))
+                 (maybe-key (vector-ref (bi-vec inode) (* 2 idx)))
+                 (val-or-node (vector-ref (bi-vec inode) (+ 1 (* 2 idx)))))
             (cond ((not maybe-key)
-                   (let ((node (-inode-without! val-or-node edit (fx+ shift 5) hash key removed-leaf?)))
+                   (let ((node (-inode-without! val-or-node edit (+ shift 5) hash key removed-leaf?)))
                      (cond ((eq? node val-or-node)
                             inode)
                            (node
-                            (edit-and-set inode edit (fx+ 1 (fx* 2 idx)) node))
-                           ((fx= (bi-bitmap inode) bit)
+                            (edit-and-set inode edit (+ 1 (* 2 idx)) node))
+                           ((= (bi-bitmap inode) bit)
                             #f)
                            (else
                             (-edit-and-remove-pair inode edit bit idx)))))
     (hc-vec inode))
 
   (define-generic (-inode-add shift hash key val added-leaf?)
-    (if (fx= hash (hc-collision-hash inode))
+    (if (= hash (hc-collision-hash inode))
         (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
-          (if (fx= idx -1)
+          (if (= idx -1)
               (let* ((len (vector-length (hc-vec inode)))
-                     (new-vec (make-vector (fx+ len 2) #f)))
+                     (new-vec (make-vector (+ len 2) #f)))
                 (vector-copy* (hc-vec inode) 0 new-vec 0 len)
                 (vector-set! new-vec len key)
-                (vector-set! new-vec (fx+ 1 len) val)
+                (vector-set! new-vec (+ 1 len) val)
                 (box-set! added-leaf? #t)
-                (make-hc-node #f (hc-collision-hash inode) (fx+ 1 (hc-count inode)) new-vec))
-              (if (fx= (vector-ref (hc-vec inode) idx) val)
+                (make-hc-node #f (hc-collision-hash inode) (+ 1 (hc-count inode)) new-vec))
+              (if (= (vector-ref (hc-vec inode) idx) val)
                   inode
-                  (make-hc-node #f (hc-collision-hash inode) (hc-count inode) (vector-copy-and-set (hc-vec inode) (fx+ 1 idx) val)))))
+                  (make-hc-node #f (hc-collision-hash inode) (hc-count inode) (vector-copy-and-set (hc-vec inode) (+ 1 idx) val)))))
         (-inode-add (make-bi-node #f (bitpos (hc-collision-hash inode) shift) (vector #f inode))
                     shift hash key val added-leaf?)))
 
   (define-generic (-inode-without shift hash key)
     (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
-      (cond ((fx= idx -1) inode)
-            ((fx= (hc-count inode) 1) #f)
-            (else (make-hc-node #f (hc-collision-hash inode) (fx- (hc-count inode) 1) (remove-pair (hc-vec inode) (quotient idx 2)))))))
+      (cond ((= idx -1) inode)
+            ((= (hc-count inode) 1) #f)
+            (else (make-hc-node #f (hc-collision-hash inode) (- (hc-count inode) 1) (remove-pair (hc-vec inode) (quotient idx 2)))))))
 
   (define-generic (-inode-lookup shift hash key not-found)
     (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
       (cond ((< idx 0) not-found)
             ((key-test key (vector-ref (hc-vec inode) idx))
-             (vector-ref (hc-vec inode) (fx+ 1 idx)))
+             (vector-ref (hc-vec inode) (+ 1 idx)))
             (else not-found))))
 
   ;; (define-generic (-inode-find shift hash key not-found)
   ;;   (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
   ;;     (cond ((< idx 0) not-found)
   ;;           ((key-test key (vector-ref (hc-vec inode) idx))
-  ;;            (cons (vector-ref (hc-vec inode) idx) (vector-ref (hc-vec inode) (fx+ 1 idx))))
+  ;;            (cons (vector-ref (hc-vec inode) idx) (vector-ref (hc-vec inode) (+ 1 idx))))
   ;;           (else not-found))))
 
   ;; (inode-seq [inode]
   (define (hc-ensure-editable e)
     (if (eq? e (hc-edit inode))
         inode
-        (let ((new-vec (make-vector (fx* 2 (fx+ 1 (hc-count inode))) #f)))
-          (vector-copy* (hc-vec inode) 0 new-vec 0 (fx* 2 (hc-count inode)))
+        (let ((new-vec (make-vector (* 2 (+ 1 (hc-count inode))) #f)))
+          (vector-copy* (hc-vec inode) 0 new-vec 0 (* 2 (hc-count inode)))
           (make-hc-node e (hc-collision-hash inode) (hc-count inode) new-vec))))
 
   (define-generic (-ensure-editable e)
         (make-hc-node (hc-edit inode) (hc-collision-hash inode) count* vec*)))
 
   (define-generic (-inode-add! edit shift hash key val added-leaf?)
-    (if (fx= hash (hc-collision-hash inode))
+    (if (= hash (hc-collision-hash inode))
         (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
-          (if (fx= idx -1)
-              (if (> (vector-length (hc-vec inode)) (fx* 2 (hc-count inode)))
-                  (let ((editable (edit-and-set inode edit (fx* 2 (hc-count inode)) key (fx+ 1 (fx* 2 (hc-count inode))) val)))
+          (if (= idx -1)
+              (if (> (vector-length (hc-vec inode)) (* 2 (hc-count inode)))
+                  (let ((editable (edit-and-set inode edit (* 2 (hc-count inode)) key (+ 1 (* 2 (hc-count inode))) val)))
                     (box-set! added-leaf? #t)
-                    (hc-count-set! editable (fx+ 1 (hc-count editable)))
+                    (hc-count-set! editable (+ 1 (hc-count editable)))
                     editable)
                   (let* ((len (vector-length (hc-vec inode)))
-                         (new-vec (make-vector (fx+ len 2) #f)))
+                         (new-vec (make-vector (+ len 2) #f)))
                     (vector-copy* (hc-vec inode) 0 new-vec 0 len)
                     (vector-set! new-vec len key)
-                    (vector-set! new-vec (fx+ 1 len) val)
+                    (vector-set! new-vec (+ 1 len) val)
                     (box-set! added-leaf? #t)
-                    (-ensure-editable-vector inode edit (fx+ 1 (hc-count inode)) new-vec)))
-              (if (eq? (vector-ref (hc-vec inode) (fx+ 1 idx)) val)
+                    (-ensure-editable-vector inode edit (+ 1 (hc-count inode)) new-vec)))
+              (if (eq? (vector-ref (hc-vec inode) (+ 1 idx)) val)
                   inode
-                  (edit-and-set inode edit (fx+ 1 idx) val))))
+                  (edit-and-set inode edit (+ 1 idx) val))))
         (-inode-add! (make-bi-node edit (bitpos (hc-collision-hash inode) shift) (vector #f inode #f #f))
                      edit shift hash key val added-leaf?)))
 
   (define-generic (-inode-without! edit shift hash key removed-leaf?)
     (let ((idx (hash-collision-node-find-index (hc-vec inode) (hc-count inode) key)))
-      (if (fx= idx -1)
+      (if (= idx -1)
           inode
           (begin
             (box-set! removed-leaf? #t)
-            (and (not (fx= (hc-count inode) 1))
+            (and (not (= (hc-count inode) 1))
                  (let* ((editable (hc-ensure-editable inode edit))
                         (evec     (hc-vec editable))
                         (count    (hc-count inode)))
-                   (vector-set! evec idx (vector-ref evec (fx- (fx* 2 count) 2)))
-                   (vector-set! evec (fx+ 1 idx) (vector-ref evec (fx- (fx* 2 count) 1)))
-                   (vector-set! evec (fx- (fx* 2 count) 1) #f)
-                   (vector-set! evec (fx- (fx* 2 count) 2) #f)
-                   (hc-count-set! editable (fx- (hc-count editable) 1))
+                   (vector-set! evec idx (vector-ref evec (- (* 2 count) 2)))
+                   (vector-set! evec (+ 1 idx) (vector-ref evec (- (* 2 count) 1)))
+                   (vector-set! evec (- (* 2 count) 1) #f)
+                   (vector-set! evec (- (* 2 count) 2) #f)
+                   (hc-count-set! editable (- (hc-count editable) 1))
                    editable))))))
 
   (define-generic (-kv-reduce f init)
   (case-lambda
    ((shift key1 val1 key2hash key2 val2)
     (let ((key1hash (key-hash key1)))
-      (if (fx= key1hash key2hash)
+      (if (= key1hash key2hash)
           (make-hc-node #f key1hash 2 (vector key1 val1 key2 val2))
           (let ((added-leaf? (box #f)))
             (-> +empty-bitmap-indexed-node+
                 (-inode-add shift key2hash key2 val2 added-leaf?))))))
    ((edit shift key1 val1 key2hash key2 val2)
     (let ((key1hash (key-hash key1)))
-      (if (fx= key1hash key2hash)
+      (if (= key1hash key2hash)
           (make-hc-node #f key1hash 2 (vector key1 val1 key2 val2))
           (let ((added-leaf? (box #f)))
             (-> +empty-bitmap-indexed-node+
 
   (define (pack-vector-node edit idx)
     (let* ((vec     (v-vec inode))
-           (len     (fx* 2 (fx- (v-count inode) 1)))
+           (len     (* 2 (- (v-count inode) 1)))
            (new-vec (make-vector len #f)))
       (let loop ((i 0) (j 1) (bitmap 0))
         (if (< i len)
-            (if (and (not (fx= i idx))
+            (if (and (not (= i idx))
                      (vector-ref vec i))
                 (begin
                   (vector-set! new-vec j (vector-ref vec i))
-                  (loop (fx+ 1 i) (fx+ j 2) (bitwise-ior bitmap (arithmetic-shift 1 i))))
-                (loop (fx+ 1 i) j bitmap))
+                  (loop (+ 1 i) (+ j 2) (bitwise-ior bitmap (arithmetic-shift 1 i))))
+                (loop (+ 1 i) j bitmap))
             (make-bi-node edit bitmap new-vec)))))
 
   (define-generic (-inode-add shift hash key val added-leaf?)
     (let* ((idx (mask hash shift))
            (node (vector-ref (v-vec inode) idx)))
       (if (not node)
-          (->> (-inode-add +empty-bitmap-indexed-node+ (fx+ shift 5) hash key val added-leaf?)
+          (->> (-inode-add +empty-bitmap-indexed-node+ (+ shift 5) hash key val added-leaf?)
                (vector-copy-and-set (v-vec inode) idx)
-               (make-v-node #f (fx+ 1 (v-count inode))))
-          (let ((n (-inode-add node (fx+ shift 5) hash key val added-leaf?)))
+               (make-v-node #f (+ 1 (v-count inode))))
+          (let ((n (-inode-add node (+ shift 5) hash key val added-leaf?)))
             (if (eq? n node)
                 inode
                 (make-v-node #f (v-count inode) (vector-copy-and-set (v-vec inode) idx n)))))))
            (node (vector-ref (v-vec inode) idx)))
       (if (not node)
           inode
-          (let ((n (-inode-without node (fx+ shift 5) hash key)))
+          (let ((n (-inode-without node (+ shift 5) hash key)))
             (cond
              ((eq? n node)
               inode)
              ((not n)
               (if (<= (v-count inode) 8)
                   (pack-vector-node inode #f idx)
-                  (make-v-node #f (fx- (v-count inode) 1) (vector-copy-and-set (v-vec inode) idx n))))
+                  (make-v-node #f (- (v-count inode) 1) (vector-copy-and-set (v-vec inode) idx n))))
              (else
               (make-v-node #f (v-count inode) (vector-copy-and-set (v-vec inode) idx n))))))))
 
            (node (vector-ref (v-vec inode) idx)))
       (if (not node)
           not-found
-          (-inode-lookup node (fx+ shift 5) hash key not-found))))
+          (-inode-lookup node (+ shift 5) hash key not-found))))
 
   ;; (define-generic (-inode-find shift hash key not-found)
   ;;   (let* ((idx (mask hash shift))
   ;;          (node (vector-ref (v-vec inode) idx)))
   ;;     (if (not node)
   ;;         not-found
-  ;;         (-inode-find node (fx+ shift 5) hash key not-found))))
+  ;;         (-inode-find node (+ shift 5) hash key not-found))))
 
   ;; (inode-seq [inode]
   ;;            (create-vector-node-seq (v-vec inode)))
     (let* ((idx  (mask hash shift))
            (node (vector-ref (v-vec inode) idx)))
       (if (not node)
-          (let ((editable (edit-and-set inode edit idx (-inode-add! +empty-bitmap-indexed-node+ edit (fx+ shift 5) hash key val added-leaf?))))
-            (v-count-set! editable (fx+ 1 (v-count editable)))
+          (let ((editable (edit-and-set inode edit idx (-inode-add! +empty-bitmap-indexed-node+ edit (+ shift 5) hash key val added-leaf?))))
+            (v-count-set! editable (+ 1 (v-count editable)))
             editable)
-          (let ((n (-inode-add! node edit (fx+ shift 5) hash key val added-leaf?)))
+          (let ((n (-inode-add! node edit (+ shift 5) hash key val added-leaf?)))
             (if (eq? n node)
                 inode
                 (edit-and-set inode edit idx n))))))
            (node (vector-ref (v-vec inode) idx)))
       (if (not node)
           inode
-          (let ((n (-inode-without! node edit (fx+ shift 5) hash key removed-leaf?)))
+          (let ((n (-inode-without! node edit (+ shift 5) hash key removed-leaf?)))
             (cond
              ((eq? n node)
               inode)
               (if (<= (v-count inode) 8)
                   (pack-vector-node inode edit idx)
                   (let ((editable (edit-and-set inode edit idx n)))
-                    (v-count-set! editable (fx- (v-count editable) 1))
+                    (v-count-set! editable (- (v-count editable) 1))
                     editable)))
              (else
               (edit-and-set inode edit idx n)))))))
            (len (vector-length vec)))
       (let loop ((i 0) (init init))
         (if (< i len)
-            (loop (fx+ 1 i)
+            (loop (+ 1 i)
                   (let ((node (vector-ref vec i)))
                     (if node (-kv-reduce node f init) init)))
             init)))))
               (unless (eq? (tm-false-val self) v)
                 (tm-false-val-set! self v))
               (unless (tm-has-false? self)
-                (tm-count-set! self (fx+ 1 (tm-count self)))
+                (tm-count-set! self (+ 1 (tm-count self)))
                 (tm-has-false?-set! self #t))
               self)
             (let* ((added-leaf? (box #f))
               (unless (eq? node (tm-root self))
                 (tm-root-set! self node))
               (when (box-ref added-leaf?)
-                (tm-count-set! self (fx+ 1 (tm-count self))))
+                (tm-count-set! self (+ 1 (tm-count self))))
               self))
         (error "map-add! after persist-map!")))
 
                 (begin
                   (tm-has-false?-set! self #f)
                   (tm-false-val-set! self #f)
-                  (tm-count-set! self (fx- (tm-count self) 1))
+                  (tm-count-set! self (- (tm-count self) 1))
                   self)
                 self)
             (if (not (tm-root self))
                   (unless (eq? node (tm-root self))
                     (tm-root-set! self node))
                   (when (box-ref removed-leaf?)
-                    (tm-count-set! self (fx- (tm-count self) 1)))
+                    (tm-count-set! self (- (tm-count self) 1)))
                   self)))
         (error "map-delete! after persist-map!")))
 
             self
             (make-map (if (pm-has-false? self)
                           (pm-count self)
-                          (fx+ 1 (pm-count self)))
+                          (+ 1 (pm-count self)))
                       (pm-root self)
                       #t
                       v))
           (if (eq? new-root (pm-root self))
               self
               (make-map (if (box-ref added-leaf?)
-                            (fx+ 1 (pm-count self))
+                            (+ 1 (pm-count self))
                             (pm-count self))
                         new-root
                         (pm-has-false? self)
   (define (-delete key)
     (cond ((not key)
            (if (pm-has-false? self)
-               (make-map (fx- (pm-count self) 1) (pm-root self) #f #f)
+               (make-map (- (pm-count self) 1) (pm-root self) #f #f)
                self))
           ((not (pm-root self))
            self)
            (let ((new-root (-inode-without (pm-root self) 0 (key-hash key) key)))
              (if (eq? new-root (pm-root self))
                  self
-                 (make-map (fx- (pm-count self) 1)
+                 (make-map (- (pm-count self) 1)
                            new-root
                            (pm-has-false? self)
                            (pm-false-val self)))))))
 
 (: map-equal? (hash-map hash-map -> boolean))
 (define (map-equal? x y)
-  (and (fx= (map-size x) (map-size y))
+  (and (= (map-size x) (map-size y))
        (call/cc
         (lambda (return)
           (map-reduce
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.