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

Method alignCheckedRead

alignedbuff/alignedbuff.go:272–278  ·  view source on GitHub ↗

alignCheckedRead aligns the (read) position if necessary and suitable according to the specified alignment mask. alignCheckedRead returns an error if after any necessary alignment there isn't enough data left to be read into a value of the size corresponding to the specified alignment mask.

(m int)

Source from the content-addressed store, hash-verified

270// if after any necessary alignment there isn't enough data left to be read into
271// a value of the size corresponding to the specified alignment mask.
272func (a *AlignedBuff) alignCheckedRead(m int) error {
273 a.pos = (a.pos + m) & ^m
274 if a.pos > len(a.data)-(m+1) {
275 return ErrEOF
276 }
277 return nil
278}
279
280// alignWrite aligns the (write) position if necessary and suitable according to
281// the specified alignment mask. It doubles as final payload padding helpmate in

Callers 6

BytesAligned32Method · 0.95
Uint16Method · 0.95
Uint16BEMethod · 0.95
Uint32Method · 0.95
Uint64Method · 0.95
Int32Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected