Use __builtin_memmove for trivially copyable types
[official-gcc.git] / libgo / go / syscall / syscall_linux.go
blob338a9717f01f90711947ede4b204c9d7f86678b2
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package syscall
7 import "unsafe"
9 func direntIno(buf []byte) (uint64, bool) {
10 return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
13 func direntReclen(buf []byte) (uint64, bool) {
14 return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
17 func direntNamlen(buf []byte) (uint64, bool) {
18 reclen, ok := direntReclen(buf)
19 if !ok {
20 return 0, false
22 return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true