diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index 8c233e8e09c..cdebbcafa73 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -304,7 +304,8 @@ class ProtoEncode { /// data-dependent back-edge branch, which measurably speeds up BLE raw /// advertisement MAC encoding (always 7-byte varints) among other hot paths. template - static inline void encode_varint_raw_loop(uint8_t *__restrict__ &pos PROTO_ENCODE_DEBUG_PARAM, T value) { + static inline void ESPHOME_ALWAYS_INLINE encode_varint_raw_loop(uint8_t *__restrict__ &pos PROTO_ENCODE_DEBUG_PARAM, + T value) { constexpr int MAX_VARINT_BYTES = (sizeof(T) * 8 + 6) / 7; // 5 for u32, 10 for u64 #pragma GCC unroll 10 for (int i = 0; i < MAX_VARINT_BYTES - 1; i++) {