MCPcopy Create free account
hub / github.com/facebook/time / BytesToPacket

Function BytesToPacket

ntp/protocol/packet.go:135–138  ·  view source on GitHub ↗

BytesToPacket converts []bytes to Packet

(ntpPacketBytes []byte)

Source from the content-addressed store, hash-verified

133
134// putHeader writes the fixed 48-octet NTP header (RFC 5905) into dst in wire
135// order, big-endian. dst must be at least PacketSizeBytes long. This hand-rolled
136// codec replaces reflection-based binary.Write over a []any field list, keeping
137// the hot request/response path allocation-free.
138func (p *Packet) putHeader(dst []byte) {
139 _ = dst[PacketSizeBytes-1] // bounds-check hint: panic early if dst too short
140 dst[0] = p.Settings
141 dst[1] = p.Stratum

Callers 5

ReadNTPPacketFunction · 0.85
TestBytesToPacketFunction · 0.85
TestBytesToPacketErrorFunction · 0.85
FuzzBytesToPacketFunction · 0.85

Calls 1

UnmarshalBinaryMethod · 0.95

Tested by 4

TestBytesToPacketFunction · 0.68
TestBytesToPacketErrorFunction · 0.68
FuzzBytesToPacketFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…