Add array serdes
This commit is contained in:
parent
b9afb254fb
commit
23602dfa18
1 changed files with 22 additions and 0 deletions
|
|
@ -551,6 +551,28 @@
|
||||||
[_segment [_padding _size]]
|
[_segment [_padding _size]]
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
;;; Array types
|
||||||
|
|
||||||
|
(defmethod c-layout ::array
|
||||||
|
[[_array type count]]
|
||||||
|
(MemoryLayout/sequenceLayout
|
||||||
|
count
|
||||||
|
(c-layout type)))
|
||||||
|
|
||||||
|
(defmethod serialize-into ::array
|
||||||
|
[obj [_array type count] segment scope]
|
||||||
|
(dorun
|
||||||
|
(map #(serialize-into %1 type %2 scope)
|
||||||
|
obj
|
||||||
|
(slice-segments (slice segment 0 (* count (size-of type)))
|
||||||
|
(size-of type)))))
|
||||||
|
|
||||||
|
(defmethod deserialize-from ::array
|
||||||
|
[segment [_array type count]]
|
||||||
|
(map #(deserialize-from % type)
|
||||||
|
(slice-segments (slice segment 0 (* count (size-of type)))
|
||||||
|
(size-of type))))
|
||||||
|
|
||||||
;;; FFI Code loading and function access
|
;;; FFI Code loading and function access
|
||||||
|
|
||||||
(defn load-system-library
|
(defn load-system-library
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue