()
| 254 | } |
| 255 | |
| 256 | func 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 | |
| 283 | func endianness() binary.ByteOrder { |
| 284 | if x := 1; *(*byte)(unsafe.Pointer(&x)) == 1 { |
nothing calls this directly
no test coverage detected
searching dependent graphs…