The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

sys.go 639B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2017 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.
  4. package socket
  5. import (
  6. "encoding/binary"
  7. "unsafe"
  8. )
  9. var (
  10. // NativeEndian is the machine native endian implementation of
  11. // ByteOrder.
  12. NativeEndian binary.ByteOrder
  13. kernelAlign int
  14. )
  15. func init() {
  16. i := uint32(1)
  17. b := (*[4]byte)(unsafe.Pointer(&i))
  18. if b[0] == 1 {
  19. NativeEndian = binary.LittleEndian
  20. } else {
  21. NativeEndian = binary.BigEndian
  22. }
  23. kernelAlign = probeProtocolStack()
  24. }
  25. func roundup(l int) int {
  26. return (l + kernelAlign - 1) & ^(kernelAlign - 1)
  27. }