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

Function ShiftBytesLeftSmall

core/utils/bits.h:46–51  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

44// Shifts `buf` to the left by `len` bytes and fills in with zeroes using
45// std::memmove() and std::memset().
46static inline void ShiftBytesLeftSmall(uint8_t *buf, const size_t len,
47 size_t shift) {
48 shift = std::min(shift, len);
49 memmove(buf, buf + shift, len - shift);
50 memset(buf + len - shift, 0, shift);
51}
52
53// TODO(melvinw): add support for shifting at bit granularity
54// Shifts `buf` to the left by `len` bytes and fills in with zeroes.

Callers 2

ShiftBytesLeftFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68