optimize type range checks in freeze-to-out* (10x faster)
This commit is contained in:
parent
140171393c
commit
f2f8b419b1
1 changed files with 6 additions and 6 deletions
|
|
@ -292,13 +292,13 @@
|
|||
Freezable
|
||||
(freeze-to-out* [x ^DataOutput out]
|
||||
(cond
|
||||
(<= Byte/MIN_VALUE x Byte/MAX_VALUE)
|
||||
(and (<= Byte/MIN_VALUE x) (<= x Byte/MAX_VALUE))
|
||||
(do (write-id out id-byte-as-long) (.writeByte out x))
|
||||
|
||||
(<= Short/MIN_VALUE x Short/MAX_VALUE)
|
||||
(and (<= Short/MIN_VALUE x) (<= x Short/MAX_VALUE))
|
||||
(do (write-id out id-short-as-long) (.writeShort out x))
|
||||
|
||||
(<= Integer/MIN_VALUE x Integer/MAX_VALUE)
|
||||
(and (<= Integer/MIN_VALUE x) (<= x Integer/MAX_VALUE))
|
||||
(do (write-id out id-int-as-long) (.writeInt out x))
|
||||
|
||||
:else (do (write-id out id-long) (.writeLong out x)))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue