• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package flatbuffers
2
3import (
4	"unsafe"
5)
6
7const (
8	// See http://golang.org/ref/spec#Numeric_types
9
10	// SizeUint8 is the byte size of a uint8.
11	SizeUint8 = 1
12	// SizeUint16 is the byte size of a uint16.
13	SizeUint16 = 2
14	// SizeUint32 is the byte size of a uint32.
15	SizeUint32 = 4
16	// SizeUint64 is the byte size of a uint64.
17	SizeUint64 = 8
18
19	// SizeInt8 is the byte size of a int8.
20	SizeInt8 = 1
21	// SizeInt16 is the byte size of a int16.
22	SizeInt16 = 2
23	// SizeInt32 is the byte size of a int32.
24	SizeInt32 = 4
25	// SizeInt64 is the byte size of a int64.
26	SizeInt64 = 8
27
28	// SizeFloat32 is the byte size of a float32.
29	SizeFloat32 = 4
30	// SizeFloat64 is the byte size of a float64.
31	SizeFloat64 = 8
32
33	// SizeByte is the byte size of a byte.
34	// The `byte` type is aliased (by Go definition) to uint8.
35	SizeByte = 1
36
37	// SizeBool is the byte size of a bool.
38	// The `bool` type is aliased (by flatbuffers convention) to uint8.
39	SizeBool = 1
40
41	// SizeSOffsetT is the byte size of an SOffsetT.
42	// The `SOffsetT` type is aliased (by flatbuffers convention) to int32.
43	SizeSOffsetT = 4
44	// SizeUOffsetT is the byte size of an UOffsetT.
45	// The `UOffsetT` type is aliased (by flatbuffers convention) to uint32.
46	SizeUOffsetT = 4
47	// SizeVOffsetT is the byte size of an VOffsetT.
48	// The `VOffsetT` type is aliased (by flatbuffers convention) to uint16.
49	SizeVOffsetT = 2
50)
51
52// byteSliceToString converts a []byte to string without a heap allocation.
53func byteSliceToString(b []byte) string {
54	return *(*string)(unsafe.Pointer(&b))
55}
56