     (-meta [_] meta)
 
     IEmptyableCollection
-    (-empty [_] (BTSet. (Leaf. (array)) 0 0 comparator meta uninitialized-hash))
+    (-empty [_] (BTSet. (Leaf. (shim/array)) 0 0 comparator meta uninitialized-hash))
 
     IEquiv
     (-equiv [this other]

(def ^:const path-mask (dec (bit-shift-left 1 level-shift)))
(def ^:const empty-path 0)

(defn path-get ^long [path level]
  (bit-and path-mask
           (unsigned-bit-shift-right path level)))

(defn path-set ^long [path level idx]
  (bit-or path 
          (bit-shift-left idx level)))

(defn binary-search-l [cmp arr l r k]
  ;; TODO less loop args?
  (if (<= l r)
    (let [m  (shim/half (+ l r))
          mk (shim/aget arr m)]
      (if (neg? (cmp mk k))
        (recur cmp arr (inc m) r k)
        (recur cmp arr l (dec m) k)))
    l))


(defn binary-search-r [cmp arr l r k]
  ;; TODO less loop args?
  (if (<= l r)
    (let [m  (shim/half (+ l r))
          mk (shim/aget arr m)]
      (if (pos? (cmp mk k))
        (recur cmp arr l (dec m) k)
        (recur cmp arr (inc m) r k)))
    l))

(defn lookup-exact [cmp arr key]
  (let [arr-l (shim/alength arr)
        idx   (binary-search-l cmp arr 0 (dec arr-l) key)]
    (if (and (< idx arr-l)
             (== 0 (cmp (shim/aget arr idx) key)))
      idx
      -1)))

(defn lookup-range [cmp arr key]
  (let [arr-l (shim/alength arr)
        idx   (binary-search-l cmp arr 0 (dec arr-l) key)]
    (if (== idx arr-l)
      -1
      idx)))

        (shim/aget keys idx))))

  (node-conj [_ cmp key]
    (let [idx    (binary-search-l cmp keys (dec (shim/alength keys)) key)
          keys-l (shim/alength keys)]
      (cond
        ;; element already here
