Add constants for byte orders
This commit is contained in:
parent
39e316f0a4
commit
faca63b50c
1 changed files with 19 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s])
|
[clojure.spec.alpha :as s])
|
||||||
(:import
|
(:import
|
||||||
|
(java.nio ByteOrder)
|
||||||
(jdk.incubator.foreign
|
(jdk.incubator.foreign
|
||||||
Addressable
|
Addressable
|
||||||
CLinker
|
CLinker
|
||||||
|
|
@ -205,6 +206,24 @@
|
||||||
(map #(slice segment (* % size) size)
|
(map #(slice segment (* % size) size)
|
||||||
(range num-segments))))
|
(range num-segments))))
|
||||||
|
|
||||||
|
(def big-endian
|
||||||
|
"The big-endian [[ByteOrder]].
|
||||||
|
|
||||||
|
See [[little-endian]], [[native-endian]]."
|
||||||
|
ByteOrder/BIG_ENDIAN)
|
||||||
|
|
||||||
|
(def little-endian
|
||||||
|
"The little-endian [[ByteOrder]].
|
||||||
|
|
||||||
|
See [[big-endian]], [[native-endian]]"
|
||||||
|
ByteOrder/LITTLE_ENDIAN)
|
||||||
|
|
||||||
|
(def native-endian
|
||||||
|
"The [[ByteOrder]] for the native endianness of the current hardware.
|
||||||
|
|
||||||
|
See [[big-endian]], [[little-endian]]."
|
||||||
|
(ByteOrder/nativeOrder))
|
||||||
|
|
||||||
(defn- type-dispatch
|
(defn- type-dispatch
|
||||||
"Gets a type dispatch value from a (potentially composite) type."
|
"Gets a type dispatch value from a (potentially composite) type."
|
||||||
[type]
|
[type]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue