Add fmt:"s,0" to allow arrays and multi-pointers to be printed with NUL termination
This commit is contained in:
1 parent
35fd8e7f68
commit
d04f732e68
2 files changed
+63
-12
No files matched your search
@@ -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