Housekeeping for 0a35b8c

This commit is contained in:
Peter Taoussanis 2015-09-16 00:45:33 +07:00
parent 3f9fe327e0
commit e403c17417

View file

@ -162,14 +162,16 @@
(defmacro write-id [out id] `(.writeByte ~out ~id))
(defmacro write-bytes [out ba & [small?]]
(let [out (with-meta out {:tag 'java.io.DataOutput})
ba (with-meta ba {:tag 'bytes})
;; Optimization, must be known before id's written
;; `byte` to throw on range error
[wc wr] (if small? [byte 'writeByte] [int 'writeInt])]
ba (with-meta ba {:tag 'bytes})]
(if small? ; Optimization, must be known before id's written
`(let [out# ~out, ba# ~ba
size# (alength ba#)]
(. out# ~wr (~wc size#))
(.write out# ba# 0 size#))))
(.writeByte out# (byte size#))
(.write out# ba# 0 size#))
`(let [out# ~out, ba# ~ba
size# (alength ba#)]
(.writeInt out# (int size#))
(.write out# ba# 0 size#)))))
(defmacro write-biginteger [out x]
(let [x (with-meta x {:tag 'java.math.BigInteger})]