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

sys.go 812B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2016 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. // +build darwin dragonfly freebsd netbsd openbsd
  5. package route
  6. import "unsafe"
  7. var (
  8. nativeEndian binaryByteOrder
  9. kernelAlign int
  10. wireFormats map[int]*wireFormat
  11. )
  12. func init() {
  13. i := uint32(1)
  14. b := (*[4]byte)(unsafe.Pointer(&i))
  15. if b[0] == 1 {
  16. nativeEndian = littleEndian
  17. } else {
  18. nativeEndian = bigEndian
  19. }
  20. kernelAlign, wireFormats = probeRoutingStack()
  21. }
  22. func roundup(l int) int {
  23. if l == 0 {
  24. return kernelAlign
  25. }
  26. return (l + kernelAlign - 1) & ^(kernelAlign - 1)
  27. }
  28. type wireFormat struct {
  29. extOff int // offset of header extension
  30. bodyOff int // offset of message body
  31. parse func(RIBType, []byte) (Message, error)
  32. }