MCPcopy Create free account
hub / github.com/facebook/CacheLib / safeInc

Function safeInc

cachelib/navy/block_cache/SparseMapIndex.cpp:29–34  ·  view source on GitHub ↗

increase val if no overflow, otherwise do nothing

Source from the content-addressed store, hash-verified

27namespace {
28// increase val if no overflow, otherwise do nothing
29uint8_t safeInc(uint8_t val) {
30 if (val < std::numeric_limits<uint8_t>::max()) {
31 return val + 1;
32 }
33 return val;
34}
35} // namespace
36
37class SparseMapIndex::IteratorImpl final : public Index::Iterator::Impl {

Callers 1

lookupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected