update stdlib memory and reflection helpers
This commit is contained in:
+1
-4
@@ -184,10 +184,7 @@ hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size
|
|||||||
if new_size < copy_size {
|
if new_size < copy_size {
|
||||||
copy_size = new_size
|
copy_size = new_size
|
||||||
}
|
}
|
||||||
i usize = 0
|
memcopy!(new_bytes[..copy_size], old_memory[..copy_size])
|
||||||
while i < copy_size : i += 1 {
|
|
||||||
new_bytes[i] = old_memory[i]
|
|
||||||
}
|
|
||||||
c.free(old_memory)
|
c.free(old_memory)
|
||||||
}
|
}
|
||||||
return new_memory
|
return new_memory
|
||||||
|
|||||||
+3
-3
@@ -43,9 +43,9 @@ TypeInfo :: union(enum) {
|
|||||||
EnumFieldStruct func($E, $Field type, $default ?Field) type {
|
EnumFieldStruct func($E, $Field type, $default ?Field) type {
|
||||||
match typeinfo!(E) {
|
match typeinfo!(E) {
|
||||||
.enum |info|: {
|
.enum |info|: {
|
||||||
names [field!(typeinfo!(E), "enum").fields.len]mut []u8 = undefined
|
names [info.fields.len]mut []u8 = undefined
|
||||||
field_types [field!(typeinfo!(E), "enum").fields.len]mut type = undefined
|
field_types [info.fields.len]mut type = undefined
|
||||||
defaults [field!(typeinfo!(E), "enum").fields.len]mut ?Field = undefined
|
defaults [info.fields.len]mut ?Field = undefined
|
||||||
expand for info.fields |field, index| {
|
expand for info.fields |field, index| {
|
||||||
names[index] = field.name
|
names[index] = field.name
|
||||||
field_types[index] = Field
|
field_types[index] = Field
|
||||||
|
|||||||
Reference in New Issue
Block a user