   [^MikronBuffer buffer]
   (set-le buffer (take-boolean buffer))
   {:diffed? (take-boolean buffer)})
+  (->MikronBuffer (->MikronBitBuffer 0 0 -1) (-wrap byte-buffer-factory binary)))
 
 ;; Multimethod abstractions for other consumers (e.g. tests)
 

                   to   (unchecked-add position n)]
               (set! position to)
               (.slice (.-buffer buffer) from to))))
  (put-bytes* [_ value]
    #?(:clj  (.put buffer value)
       :cljs (do (.copy (.from NativeJsBuffer value) buffer position)
                 (set! position (unchecked-add position (.-byteLength value))))))

  (take-bytes-all* [_]
    #?(:clj  (let [bytes (byte-array (.position buffer))]
               (.position buffer (unchecked-int 0))
               (.get buffer bytes)
               bytes)
       :cljs (.slice (.-buffer buffer) 0 position)))

  (get-position* [_]
    #?(:clj  (.position buffer)
       :cljs position))
  (set-position* [_ value]
    #?(:clj  (.position buffer (unchecked-int value))
       :cljs (set! position value)))

  (get-le* [_]
    #?(:clj  (identical? ByteOrder/LITTLE_ENDIAN (.order buffer))
       :cljs le))
  (set-le* [_ value]
    #?(:clj  (.order buffer (if value ByteOrder/LITTLE_ENDIAN ByteOrder/BIG_ENDIAN))
       :cljs (set! le value))))


            ^long ^:unsynchronized-mutable position
            ^boolean ^:unsynchronized-mutable le])
  IMikronByteBuffer
  (-take-byte [_]
    #?(:clj  (unchecked-long (.get buffer))
       :cljs (with-delta position 1 (.readInt8 buffer position true))))
  (-put-byte [_ value]
    #?(:clj  (.put buffer (unchecked-byte value))
       :cljs (with-delta position 1 (.writeInt8 buffer value position true))))

  (-take-short [_]
    #?(:clj  (unchecked-long (.getShort buffer))
       :cljs (with-delta position 2 (with-le le (.readInt16 buffer position true)))))
  (-put-short [_ value]
    #?(:clj  (.putShort buffer (unchecked-short value))
       :cljs (with-delta position 2 (with-le le (.writeInt16 buffer value position true)))))

  (-take-int [_]
    #?(:clj  (.getInt buffer)
       :cljs (with-delta position 4 (with-le le (.readInt32 buffer position true)))))
  (-put-int [_ value]
    #?(:clj  (.putInt buffer (unchecked-int value))
       :cljs (with-delta position 4 (with-le le (.writeInt32 buffer value position true)))))

  (-take-long [this]
    #?(:clj  (.getLong buffer)
       :cljs (math/to (let [u (-take-int this)
                            v (-take-int this)]
                        (if le (math/from u v) (math/from v u))))))
  (-put-long [this value]
    #?(:clj  (.putLong buffer value)
       :cljs (let [value (math/from value)
                   low   (.getLowBits value)
                   high  (.getHighBits value)]
               (if le
                 (do (-put-int this low)  (-put-int this high))
                 (do (-put-int this high) (-put-int this low))))))

  (-take-float [_]
    #?(:clj  (double (.getFloat buffer))
       :cljs (with-delta position 4 (with-le le (.readFloat buffer position true)))))
  (-put-float [_ value]
    #?(:clj  (.putFloat buffer (unchecked-float value))
       :cljs (with-delta position 4 (with-le le (.writeFloat buffer value position true)))))

  (-take-double [_]
    #?(:clj  (.getDouble buffer)
       :cljs (with-delta position 8 (with-le le (.readDouble buffer position true)))))
  (-put-double [_ value]
    #?(:clj  (.putDouble buffer value)
       :cljs (with-delta position 8 (with-le le (.writeDouble buffer value position true)))))

  (-take-bytes [_ n]
    #?(:clj  (let [value (byte-array n)]
               (.get buffer value)
               value)
