projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
82ec1d7
)
added: Allocator.move to move a value into an allocator
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Fri, 16 Jun 2023 21:11:47 +0000
(16:11 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Fri, 16 Jun 2023 21:11:47 +0000
(16:11 -0500)
core/builtin.onyx
patch
|
blob
|
history
diff --git
a/core/builtin.onyx
b/core/builtin.onyx
index 379cedd4680d43ea0804bd97a94235332397c7e0..cdb3dc8f10248388bbe4193a91f7e0d4a2c68b3b 100644
(file)
--- a/
core/builtin.onyx
+++ b/
core/builtin.onyx
@@
-267,6
+267,12
@@
raw_free :: (use a: Allocator, ptr: rawptr) {
alloc :: raw_alloc
resize :: raw_resize
free :: raw_free
+
+ move :: macro (use a: Allocator, v: $V) -> &V {
+ out := cast(&V) a->alloc(sizeof V);
+ *out = v;
+ return out;
+ }
}
//