rocksdb/util/data_structure.cc
Peter Dillinger 09175119d2 Allow SmallEnumSet on larger enum types (#13657)
Summary:
... to support SmallEnumSet over CompressionType with allowed custom compression types using most of the available byte. This is accomplished using an std::array<uint64_t> in place of just uint64_t. Also adds an std::bitset-like count() operation.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13657

Test Plan: unit tests included

Reviewed By: hx235

Differential Revision: D75827601

Pulled By: pdillinger

fbshipit-source-id: 519ae97ac671fd9885d6485976abbd969d1392d3
2025-06-03 19:03:38 -07:00

18 lines
557 B
C++

// Copyright (c) Meta Platforms, Inc. and affiliates.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include "rocksdb/data_structure.h"
#include "util/math.h"
namespace ROCKSDB_NAMESPACE::detail {
int CountTrailingZeroBitsForSmallEnumSet(uint64_t v) {
return CountTrailingZeroBits(v);
}
int BitsSetToOneForSmallEnumSet(uint64_t v) { return BitsSetToOne(v); }
} // namespace ROCKSDB_NAMESPACE::detail