MCPcopy Create free account
hub / github.com/Shopify/go-lua / init

Function init

undump.go:256–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

254}
255
256func init() {
257 copy(header.Signature[:], Signature)
258 header.Version = VersionMajor<<4 | VersionMinor
259 header.Format = 0
260 if endianness() == binary.LittleEndian {
261 header.Endianness = 1
262 } else {
263 header.Endianness = 0
264 }
265 header.IntSize = 4
266 header.PointerSize = byte(1+^uintptr(0)>>32&1) * 4
267 header.InstructionSize = byte(1+^instruction(0)>>32&1) * 4
268 header.NumberSize = 8
269 header.IntegralNumber = 0
270 tail := "\x19\x93\r\n\x1a\n"
271 copy(header.Tail[:], tail)
272
273 // The uintptr numeric type is implementation-specific
274 uintptrBitCount := byte(0)
275 for bits := ^uintptr(0); bits != 0; bits >>= 1 {
276 uintptrBitCount++
277 }
278 if uintptrBitCount != header.PointerSize*8 {
279 panic(fmt.Sprintf("invalid pointer size (%d)", uintptrBitCount))
280 }
281}
282
283func endianness() binary.ByteOrder {
284 if x := 1; *(*byte)(unsafe.Pointer(&x)) == 1 {

Callers

nothing calls this directly

Calls 2

endiannessFunction · 0.85
instructionTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…