aboutsummaryrefslogtreecommitdiff
path: root/core/runtime/default_allocators.odin
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-20 10:34:41 +0100
committergingerBill <bill@gingerbill.org>2021-04-20 10:34:41 +0100
commite9b1d4f633fea6f1b8627cec7e92bbf5340dfcf6 (patch)
treefd5d3f253f21ba31868cbfecc25b7411e62b5916 /core/runtime/default_allocators.odin
parentba9f0dd55303fbde7fa160d1c1c3d4ddf38182e4 (diff)
Fix #906
Diffstat (limited to 'core/runtime/default_allocators.odin')
-rw-r--r--core/runtime/default_allocators.odin6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/runtime/default_allocators.odin b/core/runtime/default_allocators.odin
index 64229ec6c..b47e60659 100644
--- a/core/runtime/default_allocators.odin
+++ b/core/runtime/default_allocators.odin
@@ -27,10 +27,8 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR || ODIN_OS == "freestanding" {
}
@(private)
-byte_slice :: #force_inline proc "contextless" (data: rawptr, len: int) -> (res: []byte) {
- r := (^Raw_Slice)(&res);
- r.data, r.len = data, len;
- return;
+byte_slice :: #force_inline proc "contextless" (data: rawptr, len: int) -> []byte {
+ return transmute([]u8)Raw_Slice{data=data, len=max(len, 0)};
}