blob: 105d27ddb7ddbc733427d248e2c8c5d3727e53e6 [file] [log] [blame]
khenaidooab1f7bd2019-11-14 14:00:27 -05001package bbolt
2
3import "unsafe"
4
5// maxMapSize represents the largest mmap size supported by Bolt.
6const maxMapSize = 0x7FFFFFFF // 2GB
7
8// maxAllocSize is the size used when creating array pointers.
9const maxAllocSize = 0xFFFFFFF
10
11// Are unaligned load/stores broken on this arch?
12var brokenUnaligned bool
13
14func init() {
15 // Simple check to see whether this arch handles unaligned load/stores
16 // correctly.
17
18 // ARM9 and older devices require load/stores to be from/to aligned
19 // addresses. If not, the lower 2 bits are cleared and that address is
20 // read in a jumbled up order.
21
22 // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html
23
24 raw := [6]byte{0xfe, 0xef, 0x11, 0x22, 0x22, 0x11}
25 val := *(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&raw)) + 2))
26
27 brokenUnaligned = val != 0x11222211
28}