MCPcopy Create free account
hub / github.com/NetSys/bess / ShiftBytesRightSmall

Function ShiftBytesRightSmall

core/utils/bits.h:84–89  ·  view source on GitHub ↗

TODO(melvinw): add support for shifting at bit granularity Shifts `buf` to the right by `len` bytes and fills in with zeroes using std::memmove() and std::memset().

Source from the content-addressed store, hash-verified

82// Shifts `buf` to the right by `len` bytes and fills in with zeroes using
83// std::memmove() and std::memset().
84static inline void ShiftBytesRightSmall(uint8_t *buf, const size_t len,
85 size_t shift) {
86 shift = std::min(shift, len);
87 memmove(buf + shift, buf, len - shift);
88 memset(buf, 0, shift);
89}
90
91// TODO(melvinw): add support for shifting at bit granularity
92// Shifts `buf` to the right by `len` bytes and fills in with zeroes.

Callers 2

ShiftBytesRightFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68