Browse Source

Add `mem.reinterpret`

gingerBill 4 years ago
parent
commit
b5cdb331b0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      core/mem/mem.odin

+ 4 - 0
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;