move hide behind @ and specify with :
This commit is contained in:
+7
-7
@@ -119,11 +119,11 @@ empty func($T type) []mut T {
|
||||
return empty_slice(T, 0)
|
||||
}
|
||||
|
||||
hide empty_storage [1]mut u64 := [0]
|
||||
@hide empty_storage [1]mut u64 := [0]
|
||||
|
||||
hide malloc_alignment usize :: 16 # ponytail: aarch64-macos libc malloc alignment assumption.
|
||||
@hide malloc_alignment usize :: 16 # ponytail: aarch64-macos libc malloc alignment assumption.
|
||||
|
||||
hide power_of_two func(value usize) bool {
|
||||
@hide power_of_two func(value usize) bool {
|
||||
if (value == 0) return false
|
||||
current usize := value
|
||||
while current > 1 {
|
||||
@@ -134,7 +134,7 @@ hide power_of_two func(value usize) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 {
|
||||
@hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 {
|
||||
if (power_of_two(alignment) == false) return null
|
||||
|
||||
if alignment <= malloc_alignment {
|
||||
@@ -148,7 +148,7 @@ hide c_alloc func(_ ?@mut anyopaque, size usize, alignment usize) ?*mut u8 {
|
||||
return ptrcast!(u8, memory[0])
|
||||
}
|
||||
|
||||
hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 {
|
||||
@hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 {
|
||||
if (power_of_two(alignment) == false) return null
|
||||
|
||||
if new_size == 0 {
|
||||
@@ -174,11 +174,11 @@ hide c_realloc func(_ ?@mut anyopaque, memory ?*mut u8, old_size usize, new_size
|
||||
return c_alloc(null, new_size, alignment)
|
||||
}
|
||||
|
||||
hide c_free func(_ ?@mut anyopaque, memory ?*mut u8, _ usize, _ usize) void {
|
||||
@hide c_free func(_ ?@mut anyopaque, memory ?*mut u8, _ usize, _ usize) void {
|
||||
c.free(memory)
|
||||
}
|
||||
|
||||
hide c_vtable AllocatorVTable :: AllocatorVTable {
|
||||
@hide c_vtable AllocatorVTable :: AllocatorVTable {
|
||||
alloc = c_alloc,
|
||||
realloc = c_realloc,
|
||||
free = c_free,
|
||||
|
||||
Reference in New Issue
Block a user