diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-30 20:42:16 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-30 20:42:16 +0000 |
| commit | db632b7e22a5ee1cd5ebe0c8642f6efa2f084592 (patch) | |
| tree | c087d91774a53cc6a87e48e9bdcf870f849041c7 | |
| parent | 1a75dfe07513359352985429d6c687327a4b0b73 (diff) | |
`buffer_from_slice`
| -rw-r--r-- | core/_preload.odin | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/_preload.odin b/core/_preload.odin index def5f8cf9..e51de8029 100644 --- a/core/_preload.odin +++ b/core/_preload.odin @@ -621,6 +621,30 @@ panic :: proc "contextless" (message := "", args: ...any, using loc := #caller_l } +buffer_from_slice :: proc(backing: $T/[]$E) -> [dynamic]E { + s := transmute(raw.Slice)backing; + d := raw.Dynamic_Array{ + data = s.data, + len = 0, + cap = s.len, + allocator = nil_allocator(), + }; + return transmute([dynamic]E)d; +} + + + + + + + + + + + + + + __string_eq :: proc "contextless" (a, b: string) -> bool { switch { case len(a) != len(b): return false; |