mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/goglfw: refactoring: use unsafe.Add
This commit is contained in:
parent
1035b1d182
commit
50b68a0427
@ -602,8 +602,9 @@ func bytePtrToString(p *byte) string {
|
||||
// Find NUL terminator.
|
||||
n := 0
|
||||
for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
|
||||
ptr = unsafe.Pointer(uintptr(ptr) + 1)
|
||||
ptr = unsafe.Add(ptr, 1)
|
||||
}
|
||||
|
||||
// unsafe.String(p, n) is available as of Go 1.20.
|
||||
return string(unsafe.Slice(p, n))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user