Add align-of

This commit is contained in:
Joshua Suskalo 2022-01-10 13:30:01 -06:00
parent 1b8923bc33
commit 579393f830

View file

@ -349,6 +349,11 @@
[type] [type]
(.byteSize ^MemoryLayout (c-layout type))) (.byteSize ^MemoryLayout (c-layout type)))
(defn align-of
"The alignment in bytes of the given `type`."
[type]
(.byteAlignment ^MemoryLayout (c-layout type)))
(defn alloc-instance (defn alloc-instance
"Allocates a memory segment for the given `type`." "Allocates a memory segment for the given `type`."
([type] (alloc-instance type (connected-scope))) ([type] (alloc-instance type (connected-scope)))