MCPcopy Create free account
hub / github.com/google/nftables / alignWrite

Method alignWrite

alignedbuff/alignedbuff.go:283–289  ·  view source on GitHub ↗

alignWrite aligns the (write) position if necessary and suitable according to the specified alignment mask. It doubles as final payload padding helpmate in order to keep the kernel happy.

(m int)

Source from the content-addressed store, hash-verified

281// the specified alignment mask. It doubles as final payload padding helpmate in
282// order to keep the kernel happy.
283func (a *AlignedBuff) alignWrite(m int) {
284 pos := (a.pos + m) & ^m
285 if pos != a.pos {
286 a.data = append(a.data, padding[:pos-a.pos]...)
287 a.pos = pos
288 }
289}
290
291// This is ... ugly.
292var uint16AlignMask = int(unsafe.Alignof(uint16(0)) - 1)

Callers 7

DataMethod · 0.95
PutBytesAligned32Method · 0.95
PutUint16Method · 0.95
PutUint16BEMethod · 0.95
PutUint32Method · 0.95
PutUint64Method · 0.95
PutInt32Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected