forked from h2zero/esp-nimble-cpp
Bit shift length for resize
This commit is contained in:
@ -500,7 +500,7 @@ const char* NimBLEUtils::gapEventToString(uint8_t eventType) {
|
||||
std::string NimBLEUtils::dataToHexString(const uint8_t* source, uint8_t length) {
|
||||
constexpr char hexmap[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
std::string str{};
|
||||
str.resize(length * 2);
|
||||
str.resize(length << 1);
|
||||
|
||||
for (uint8_t i = 0; i < length; i++) {
|
||||
str[2 * i] = hexmap[(source[i] & 0xF0) >> 4];
|
||||
|
Reference in New Issue
Block a user