本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
832B

  1. package bbolt
  2. import "unsafe"
  3. // maxMapSize represents the largest mmap size supported by Bolt.
  4. const maxMapSize = 0x7FFFFFFF // 2GB
  5. // maxAllocSize is the size used when creating array pointers.
  6. const maxAllocSize = 0xFFFFFFF
  7. // Are unaligned load/stores broken on this arch?
  8. var brokenUnaligned bool
  9. func init() {
  10. // Simple check to see whether this arch handles unaligned load/stores
  11. // correctly.
  12. // ARM9 and older devices require load/stores to be from/to aligned
  13. // addresses. If not, the lower 2 bits are cleared and that address is
  14. // read in a jumbled up order.
  15. // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html
  16. raw := [6]byte{0xfe, 0xef, 0x11, 0x22, 0x22, 0x11}
  17. val := *(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&raw)) + 2))
  18. brokenUnaligned = val != 0x11222211
  19. }
上海开阖软件有限公司 沪ICP备12045867号-1