mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
libc changes: unify c and libc types; Add [^]T where appropriate
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
//+build wasm32
|
||||
//+private
|
||||
package runtime
|
||||
|
||||
@(link_name="memset")
|
||||
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr {
|
||||
if ptr == nil || len == 0 {
|
||||
return ptr;
|
||||
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr #no_bounds_check {
|
||||
if ptr != nil && len != 0 {
|
||||
b := byte(val)
|
||||
p := ([^]byte)(ptr)[:len]
|
||||
for v in &p {
|
||||
v = b
|
||||
}
|
||||
}
|
||||
b := byte(val);
|
||||
|
||||
p_start := uintptr(ptr);
|
||||
p_end := p_start + uintptr(max(len, 0));
|
||||
for p := p_start; p < p_end; p += 1 {
|
||||
(^byte)(p)^ = b;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
return ptr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user