diff options
| author | gingerBill <bill@gingerbill.org> | 2021-04-20 10:34:41 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-04-20 10:34:41 +0100 |
| commit | e9b1d4f633fea6f1b8627cec7e92bbf5340dfcf6 (patch) | |
| tree | fd5d3f253f21ba31868cbfecc25b7411e62b5916 /core/runtime/default_allocators.odin | |
| parent | ba9f0dd55303fbde7fa160d1c1c3d4ddf38182e4 (diff) | |
Fix #906
Diffstat (limited to 'core/runtime/default_allocators.odin')
| -rw-r--r-- | core/runtime/default_allocators.odin | 6 |
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)}; } |