mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Add fmt:"s,0" to allow arrays and multi-pointers to be printed with NUL termination
This commit is contained in:
@@ -109,6 +109,12 @@ check_zero_ptr :: proc(ptr: rawptr, len: int) -> bool {
|
||||
case ptr == nil:
|
||||
return true
|
||||
}
|
||||
switch len {
|
||||
case 1: return (^u8)(ptr)^ == 0
|
||||
case 2: return intrinsics.unaligned_load((^u16)(ptr)) == 0
|
||||
case 4: return intrinsics.unaligned_load((^u32)(ptr)) == 0
|
||||
case 8: return intrinsics.unaligned_load((^u64)(ptr)) == 0
|
||||
}
|
||||
|
||||
start := uintptr(ptr)
|
||||
start_aligned := align_forward_uintptr(start, align_of(uintptr))
|
||||
|
||||
Reference in New Issue
Block a user