mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 09:25:09 +08:00
[esp32_ble] Inline ble_addr_to_uint64 to eliminate call overhead (#14591)
This commit is contained in:
@@ -727,17 +727,6 @@ void ESP32BLE::dump_config() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ble_addr_to_uint64(const esp_bd_addr_t address) {
|
|
||||||
uint64_t u = 0;
|
|
||||||
u |= uint64_t(address[0] & 0xFF) << 40;
|
|
||||||
u |= uint64_t(address[1] & 0xFF) << 32;
|
|
||||||
u |= uint64_t(address[2] & 0xFF) << 24;
|
|
||||||
u |= uint64_t(address[3] & 0xFF) << 16;
|
|
||||||
u |= uint64_t(address[4] & 0xFF) << 8;
|
|
||||||
u |= uint64_t(address[5] & 0xFF) << 0;
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
|
|
||||||
ESP32BLE *global_ble = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
ESP32BLE *global_ble = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
||||||
} // namespace esphome::esp32_ble
|
} // namespace esphome::esp32_ble
|
||||||
|
|||||||
@@ -35,7 +35,16 @@ static constexpr uint8_t MAX_BLE_QUEUE_SIZE = 100; // 64 + 36 (ring buffer size
|
|||||||
static constexpr uint8_t MAX_BLE_QUEUE_SIZE = 88; // 64 + 24 (ring buffer size without PSRAM)
|
static constexpr uint8_t MAX_BLE_QUEUE_SIZE = 88; // 64 + 24 (ring buffer size without PSRAM)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t ble_addr_to_uint64(const esp_bd_addr_t address);
|
inline uint64_t ble_addr_to_uint64(const esp_bd_addr_t address) {
|
||||||
|
uint64_t u = 0;
|
||||||
|
u |= uint64_t(address[0] & 0xFF) << 40;
|
||||||
|
u |= uint64_t(address[1] & 0xFF) << 32;
|
||||||
|
u |= uint64_t(address[2] & 0xFF) << 24;
|
||||||
|
u |= uint64_t(address[3] & 0xFF) << 16;
|
||||||
|
u |= uint64_t(address[4] & 0xFF) << 8;
|
||||||
|
u |= uint64_t(address[5] & 0xFF) << 0;
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
// NOLINTNEXTLINE(modernize-use-using)
|
// NOLINTNEXTLINE(modernize-use-using)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user