1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 07:03:55 +00:00

remove dead code

This commit is contained in:
J. Nick Koston
2025-10-28 15:33:45 -05:00
parent b476cba83d
commit 175c19f29e

View File

@@ -487,6 +487,34 @@ class ProtoSize {
}
}
/**
* @brief Calculates the size in bytes needed to encode a uint64_t value as a varint
*
* @param value The uint64_t value to calculate size for
* @return The number of bytes needed to encode the value
*/
static constexpr uint32_t varint(uint64_t value) {
// Most uint64 values fit in uint32 range (field IDs, lengths, etc.)
if (value <= UINT32_MAX) {
return varint(static_cast<uint32_t>(value));
}
// True 64-bit values (bluetooth addresses, UUIDs)
if (value < (1ULL << 35)) {
return 5;
} else if (value < (1ULL << 42)) {
return 6;
} else if (value < (1ULL << 49)) {
return 7;
} else if (value < (1ULL << 56)) {
return 8;
} else if (value < (1ULL << 63)) {
return 9;
} else {
return 10;
}
}
/**
* @brief Calculates the size in bytes needed to encode an int32_t value as a varint
*