🎉 Add write-bool helper to buffer ns helpers

This commit is contained in:
Andrey Antukh 2025-07-09 11:13:25 +02:00
parent 4e2998a366
commit 22a70eb5b2

View File

@ -74,6 +74,13 @@
(let [target (with-meta target {:tag 'java.nio.ByteBuffer})]
`(.put ~target ~offset (unchecked-byte ~value)))))
(defmacro write-bool
[target offset value]
(if (:ns &env)
`(.setInt8 ~target ~offset (if ~value 0x01 0x00) true)
(let [target (with-meta target {:tag 'java.nio.ByteBuffer})]
`(.put ~target ~offset (unchecked-byte (if ~value 0x01 0x00))))))
(defmacro write-short
[target offset value]
(if (:ns &env)