[ld24xx] Make two_byte_to_uint16 constexpr

Enable compile-time evaluation when called with constant arguments.
This commit is contained in:
J. Nick Koston
2026-02-28 09:14:23 -10:00
parent cfb6c4e9d4
commit f383ec7f09
+1 -1
View File
@@ -40,7 +40,7 @@
namespace esphome::ld24xx {
/// Parse a little-endian 16-bit unsigned value from two bytes.
static inline uint16_t two_byte_to_uint16(uint8_t low, uint8_t high) { return ((uint16_t) high << 8) | low; }
static constexpr uint16_t two_byte_to_uint16(uint8_t low, uint8_t high) { return ((uint16_t) high << 8) | low; }
// Helper to find index of value in constexpr array
template<size_t N> optional<size_t> find_index(const uint32_t (&arr)[N], uint32_t value) {