MCPcopy Create free account
hub / github.com/encodeous/nylon / calculatePaddingSize

Function calculatePaddingSize

polyamide/device/send.go:383–396  ·  view source on GitHub ↗
(packetSize, mtu int)

Source from the content-addressed store, hash-verified

381}
382
383func calculatePaddingSize(packetSize, mtu int) int {
384 lastUnit := packetSize
385 if mtu == 0 {
386 return ((lastUnit + PaddingMultiple - 1) & ^(PaddingMultiple - 1)) - lastUnit
387 }
388 if lastUnit > mtu {
389 lastUnit %= mtu
390 }
391 paddedSize := ((lastUnit + PaddingMultiple - 1) & ^(PaddingMultiple - 1))
392 if paddedSize > mtu {
393 paddedSize = mtu
394 }
395 return paddedSize - lastUnit
396}
397
398/* Encrypts the elements in the queue
399 * and marks them for sequential consumption (by releasing the mutex)

Callers 1

RoutineEncryptionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected