diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-20 10:18:34 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-20 10:18:34 +0100 |
| commit | b5cdb331b0776d61de705620751aeea0afdd4d15 (patch) | |
| tree | efaeea31b764c2695c787ae4381fd07de6dc826b | |
| parent | fa4f3aa7ad3f9530f78f22bd8d0e00d168ab2509 (diff) | |
Add `mem.reinterpret`
| -rw-r--r-- | core/mem/mem.odin | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/mem/mem.odin b/core/mem/mem.odin index ecf232557..aaea98437 100644 --- a/core/mem/mem.odin +++ b/core/mem/mem.odin @@ -245,6 +245,10 @@ context_from_allocator :: proc(a: Allocator) -> type_of(context) { return context; } +reinterpret :: proc($T: typeid, ptr: rawptr) -> (value: T) { + copy(&value, ptr, size_of(T)); + return; +} Fixed_Byte_Buffer :: distinct [dynamic]byte; |