mirror of
https://github.com/esphome/esphome.git
synced 2025-08-05 09:57:47 +00:00
preen
This commit is contained in:
parent
084ecf93a7
commit
c745140835
@ -662,14 +662,10 @@ void ProtoMessage::calculate_size(uint32_t &total_size) const {
|
|||||||
// For fixed-size types, we can calculate size more efficiently
|
// For fixed-size types, we can calculate size more efficiently
|
||||||
if (type == ProtoFieldType::TYPE_FIXED32 || type == ProtoFieldType::TYPE_SFIXED32 ||
|
if (type == ProtoFieldType::TYPE_FIXED32 || type == ProtoFieldType::TYPE_SFIXED32 ||
|
||||||
type == ProtoFieldType::TYPE_FLOAT) {
|
type == ProtoFieldType::TYPE_FLOAT) {
|
||||||
if (count > 0) {
|
total_size += count * (repeated_fields[i].get_precalced_size() + 4);
|
||||||
total_size += count * (repeated_fields[i].get_precalced_size() + 4);
|
|
||||||
}
|
|
||||||
} else if (type == ProtoFieldType::TYPE_FIXED64 || type == ProtoFieldType::TYPE_SFIXED64 ||
|
} else if (type == ProtoFieldType::TYPE_FIXED64 || type == ProtoFieldType::TYPE_SFIXED64 ||
|
||||||
type == ProtoFieldType::TYPE_DOUBLE) {
|
type == ProtoFieldType::TYPE_DOUBLE) {
|
||||||
if (count > 0) {
|
total_size += count * (repeated_fields[i].get_precalced_size() + 8);
|
||||||
total_size += count * (repeated_fields[i].get_precalced_size() + 8);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// For variable-size types, calculate each element
|
// For variable-size types, calculate each element
|
||||||
for (size_t j = 0; j < count; j++) {
|
for (size_t j = 0; j < count; j++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user