mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 06:03:45 +00:00
[core] Use constexpr when possible
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
size_t const kNumBytes = 256;
|
||||
size_t constexpr kNumBytes = 256;
|
||||
|
||||
// Fake trailing '$' for the BWT, used for original string
|
||||
// reconstruction.
|
||||
uint32_t const kEOS = 256;
|
||||
uint32_t constexpr kEOS = 256;
|
||||
|
||||
// FirstColumn represents the first column in the BWT matrix. As
|
||||
// during reverse BWT we need to reconstruct canonical first column,
|
||||
|
||||
@@ -414,7 +414,7 @@ unique_ptr<CompressedBitVector> CompressedBitVectorBuilder::FromBitPositions(vec
|
||||
// static
|
||||
unique_ptr<CompressedBitVector> CompressedBitVectorBuilder::FromBitGroups(vector<uint64_t> && bitGroups)
|
||||
{
|
||||
static uint64_t const kBlockSize = DenseCBV::kBlockSize;
|
||||
static uint64_t constexpr kBlockSize = DenseCBV::kBlockSize;
|
||||
|
||||
while (!bitGroups.empty() && bitGroups.back() == 0)
|
||||
bitGroups.pop_back();
|
||||
|
||||
@@ -89,7 +89,7 @@ class DenseCBV : public CompressedBitVector
|
||||
{
|
||||
public:
|
||||
friend class CompressedBitVectorBuilder;
|
||||
static uint64_t const kBlockSize = 64;
|
||||
static uint64_t constexpr kBlockSize = 64;
|
||||
|
||||
DenseCBV() = default;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
/// this value.
|
||||
///
|
||||
/// WARNING! Existing sections may not be properly aligned.
|
||||
static uint64_t const kSectionAlignment = 8;
|
||||
static uint64_t constexpr kSectionAlignment = 8;
|
||||
|
||||
bool IsExist(Tag const & tag) const { return GetInfo(tag) != 0; }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace impl
|
||||
{
|
||||
static char const kToHexTable[] = "0123456789ABCDEF";
|
||||
static char constexpr kToHexTable[] = "0123456789ABCDEF";
|
||||
|
||||
void ToHexRaw(void const * src, size_t size, void * dst)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ void HuffmanCoder::SetDepths(Node * root, uint32_t depth)
|
||||
// One would need more than 2^32 symbols to build a code that long.
|
||||
// On the other hand, 32 is short enough for our purposes, so do not
|
||||
// try to shrink the trees beyond this threshold.
|
||||
uint32_t const kMaxDepth = 32;
|
||||
uint32_t constexpr kMaxDepth = 32;
|
||||
|
||||
if (!root)
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t static const kBufferSize = 16 * 1024;
|
||||
uint32_t static constexpr kBufferSize = 16 * 1024;
|
||||
|
||||
uint64_t m_res = 0;
|
||||
uint64_t m_numRead = 0;
|
||||
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
class BlockedTextStorageReader
|
||||
{
|
||||
public:
|
||||
inline static size_t const kDefaultCacheSize = 32;
|
||||
inline static size_t constexpr kDefaultCacheSize = 32;
|
||||
|
||||
BlockedTextStorageReader() : m_cache(kDefaultCacheSize) {}
|
||||
explicit BlockedTextStorageReader(size_t cacheSize) : m_cache(cacheSize) {}
|
||||
|
||||
Reference in New Issue
Block a user