Clean-up reverse_bits helpers (#3011)

This commit is contained in:
Oxan van Leeuwen
2022-01-06 12:54:58 +01:00
committed by GitHub
parent 5e1e543b06
commit a4931f5d78
4 changed files with 20 additions and 22 deletions

View File

@@ -187,17 +187,6 @@ void delay_microseconds_safe(uint32_t us) { // avoids CPU locks that could trig
;
}
uint8_t reverse_bits_8(uint8_t x) {
x = ((x & 0xAA) >> 1) | ((x & 0x55) << 1);
x = ((x & 0xCC) >> 2) | ((x & 0x33) << 2);
x = ((x & 0xF0) >> 4) | ((x & 0x0F) << 4);
return x;
}
uint16_t reverse_bits_16(uint16_t x) {
return uint16_t(reverse_bits_8(x & 0xFF) << 8) | uint16_t(reverse_bits_8(x >> 8));
}
uint32_t fnv1_hash(const std::string &str) {
uint32_t hash = 2166136261UL;
for (char c : str) {
@@ -210,10 +199,6 @@ bool str_equals_case_insensitive(const std::string &a, const std::string &b) {
return strcasecmp(a.c_str(), b.c_str()) == 0;
}
template<uint32_t> uint32_t reverse_bits(uint32_t x) {
return uint32_t(reverse_bits_16(x & 0xFFFF) << 16) | uint32_t(reverse_bits_16(x >> 16));
}
static int high_freq_num_requests = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
void HighFrequencyLoopRequester::start() {