 
 (defn take-ubyte
   "Takes an unsigned byte from `buffer`."
-  {:inline (fn [buffer] `(bit-and (take-byte ~buffer) 0xFF))}
+  #?(:clj {:inline (fn [buffer] `(bit-and (take-byte ~buffer) 0xFF))})
   ^long [^Buffer buffer]
    (bit-and (take-byte buffer) 0xFF))
 
 (defn put-ubyte
   "Puts an unsigned byte `value` to `buffer`."
-  {:inline (fn [buffer value] `(put-byte ~buffer (unchecked-byte (bit-and ~value 0xFF))))}
+  #?(:clj {:inline (fn [buffer value] `(put-byte ~buffer (unchecked-byte (bit-and ~value 0xFF))))})
   [^Buffer buffer ^long value]
   (put-byte buffer (unchecked-byte (bit-and value 0xFF))))
 
 (defn take-ushort
   "Takes an unsigned short from `buffer`."
-  {:inline (fn [buffer] `(bit-and (take-short ~buffer) 0xFFFF))}
+  #?(:clj {:inline (fn [buffer] `(bit-and (take-short ~buffer) 0xFFFF))})
   ^long [^Buffer buffer]
   (bit-and (take-short buffer) 0xFFFF))
 
 (defn put-ushort
   "Puts an unsigned short `value` to `buffer`."
-  {:inline (fn [buffer value] `(put-short ~buffer (unchecked-short (bit-and ~value 0xFFFF))))}
+  #?(:clj {:inline (fn [buffer value] `(put-short ~buffer (unchecked-short (bit-and ~value 0xFFFF))))})
   [^Buffer buffer ^long value]
   (put-short buffer (unchecked-short (bit-and value 0xFFFF))))
 
 (defn take-uint
   "Takes an unsigned int from `buffer`."
-  {:inline (fn [buffer] #?(:clj  `(bit-and (take-int ~buffer) 0xFFFFFFFF)
-                           :cljs `(unsigned-bit-shift-right (take-int ~buffer) 0)))}
+  #?(:clj {:inline (fn [buffer] #?(:clj  `(bit-and (take-int ~buffer) 0xFFFFFFFF)
+                                   :cljs `(unsigned-bit-shift-right (take-int ~buffer) 0)))})
   ^long [^Buffer buffer]
   #?(:clj  (bit-and (take-int buffer) 0xFFFFFFFF)
      :cljs (unsigned-bit-shift-right (take-int buffer) 0)))
 
 (defn put-uint
   "Puts an unsigned int `value` to `buffer`."
-  {:inline (fn [buffer value] `(put-int ~buffer (unchecked-int (bit-and ~value 0xFFFFFFFF))))}
+  #?(:clj {:inline (fn [buffer value] `(put-int ~buffer (unchecked-int (bit-and ~value 0xFFFFFFFF))))})
   [^Buffer buffer ^long value]
   (put-int buffer (unchecked-int (bit-and value 0xFFFFFFFF))))
 


(defn get-bit-buffer
  "Gets the bit buffer of `buffer`."
  {:inline (fn [buffer] `(.-bit-buffer ~(vary-meta buffer assoc :tag `Buffer)))}
  ^mikron.runtime.buffer.IMikronBitBuffer [^Buffer buffer]
  (.-bit-buffer buffer))

(defn get-byte-buffer
  "Gets the byte buffer of `buffer`."
  {:inline (fn [buffer] `(.-byte-buffer ~(vary-meta buffer assoc :tag `Buffer)))}
  ^mikron.runtime.buffer.IMikronByteBuffer [^Buffer buffer]
  (.-byte-buffer buffer))

(defn get-bit-pos
  "Gets the bit position of `buffer`."
  {:inline (fn [buffer] `(get-bit-pos* (get-bit-buffer ~buffer)))}
  ^long [^Buffer buffer]
  (get-bit-pos* (get-bit-buffer buffer)))

(defn set-bit-pos
  "Sets the bit position of `buffer` to `value`."
  {:inline (fn [buffer value] `(set-bit-pos* (get-bit-buffer ~buffer) ~value))}
  [^Buffer buffer ^long value]
  (set-bit-pos* (get-bit-buffer buffer) value))

(defn get-bit-index
  "Gets the bit index of `buffer`."
  {:inline (fn [buffer] `(get-bit-index* (get-bit-buffer ~buffer)))}
  ^long [^Buffer buffer]
  (get-bit-index* (get-bit-buffer buffer)))

(defn set-bit-index
  "Sets the bit index of `buffer` to `value`."
  {:inline (fn [buffer value] `(set-bit-index* (get-bit-buffer ~buffer) ~value))}
  [^Buffer buffer ^long value]
  (set-bit-index* (get-bit-buffer buffer) value))

(defn get-bit-value
  "Gets the bit value of `buffer`."
  {:inline (fn [buffer] `(get-bit-value* (get-bit-buffer ~buffer)))}
  ^long [^Buffer buffer]
  (get-bit-value* (get-bit-buffer buffer)))

(defn set-bit-value
  "Sets the bit value of `buffer` to `value`."
  {:inline (fn [buffer value] `(set-bit-value* (get-bit-buffer ~buffer) ~value))}
  [^Buffer buffer ^long value]
  (set-bit-value* (get-bit-buffer buffer) value))



(defn take-byte
  "Takes a byte from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-byte* (get-byte-buffer ~buffer)))})
  ^long [^Buffer buffer]
  (take-byte* (get-byte-buffer buffer)))

(defn put-byte
  "Puts a byte `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-byte* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^long value]
  (put-byte* (get-byte-buffer buffer) value))

(defn take-short
  "Takes a short from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-short* (get-byte-buffer ~buffer)))})
  ^long [^Buffer buffer]
  (take-short* (get-byte-buffer buffer)))

(defn put-short
  "Puts a short `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-short* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^long value]
  (put-short* (get-byte-buffer buffer) value))

(defn take-int
  "Takes an int from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-int* (get-byte-buffer ~buffer)))})
  ^long [^Buffer buffer]
  (take-int* (get-byte-buffer buffer)))

(defn put-int
  "Puts an int `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-int* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^long value]
  (put-int* (get-byte-buffer buffer) value))

(defn take-long
  "Takes a long from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-long* (get-byte-buffer ~buffer)))})
  ^long [^Buffer buffer]
  (take-long* (get-byte-buffer buffer)))

(defn put-long
  "Puts a long `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-long* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^long value]
  (put-long* (get-byte-buffer buffer) value))

(defn take-float
  "Takes a float from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-float* (get-byte-buffer ~buffer)))})
  ^double [^Buffer buffer]
  (take-float* (get-byte-buffer buffer)))

(defn put-float
  "Puts a float `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-float* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^double value]
  (put-float* (get-byte-buffer buffer) value))

(defn take-double
  "Takes a double from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-double* (get-byte-buffer ~buffer)))})
  ^double [^Buffer buffer]
  (take-double* (get-byte-buffer buffer)))

(defn put-double
  "Puts a double `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-double* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^double value]
  (put-double* (get-byte-buffer buffer) value))

(defn take-bytes
  "Takes `n` bytes from `buffer`."
  #?(:clj {:inline (fn [buffer n] `(take-bytes* (get-byte-buffer ~buffer) ~n))})
  ^bytes [^Buffer buffer ^long n]
  (take-bytes* (get-byte-buffer buffer) n))

(defn put-bytes
  "Puts some bytes `value` to `buffer`."
  #?(:clj {:inline (fn [buffer value] `(put-bytes* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^bytes value]
  (put-bytes* (get-byte-buffer buffer) value))

(defn take-bytes-all
  "Takes all bytes from `buffer`."
  #?(:clj {:inline (fn [buffer] `(take-bytes-all* (get-byte-buffer ~buffer)))})
  ^bytes [^Buffer buffer]
  (take-bytes-all* (get-byte-buffer buffer)))

(defn get-pos
  "Gets the position of `buffer`."
  #?(:clj {:inline (fn [buffer] `(get-pos* (get-byte-buffer ~buffer)))})
  ^long [^Buffer buffer]
  (get-pos* (get-byte-buffer buffer)))

(defn set-pos
  "Sets the position of `buffer`."
  #?(:clj {:inline (fn [buffer value] `(set-pos* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer ^long value]
  (set-pos* (get-byte-buffer buffer) value))

(defn get-le
  "Gets the endianness of `buffer`."
  #?(:clj {:inline (fn [buffer] `(get-le* (get-byte-buffer ~buffer)))})
  [^Buffer buffer]
  (get-le* (get-byte-buffer buffer)))

(defn set-le
  "Sets the endianness of `buffer`."
  #?(:clj {:inline (fn [buffer value] `(set-le* (get-byte-buffer ~buffer) ~value))})
  [^Buffer buffer value]
  (set-le* (get-byte-buffer buffer) value))

