mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
heap: Fix priority in shex() bit shift
This commit is contained in:
@ -34,22 +34,22 @@ static esp_alloc_failed_hook_t alloc_failed_callback;
|
|||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS
|
#ifdef CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS
|
||||||
IRAM_ATTR static void shex(char buf[8], uint32_t n)
|
IRAM_ATTR static void hex_to_str(char buf[8], uint32_t n)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
uint8_t b4 = (n >> 28 - (i * 4)) & 0b1111;
|
uint8_t b4 = (n >> (28 - i * 4)) & 0b1111;
|
||||||
buf[i] = b4 <= 9 ? '0' + b4 : 'a' + b4 - 10;
|
buf[i] = b4 <= 9 ? '0' + b4 : 'a' + b4 - 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IRAM_ATTR static void fmt_abort_str(char dest[48], size_t size, uint32_t caps)
|
IRAM_ATTR static void fmt_abort_str(char dest[48], size_t size, uint32_t caps)
|
||||||
{
|
{
|
||||||
char sSize[8];
|
char sSize[8];
|
||||||
char sCaps[8];
|
char sCaps[8];
|
||||||
shex(sSize,size);
|
hex_to_str(sSize, size);
|
||||||
shex(sCaps,caps);
|
hex_to_str(sCaps, caps);
|
||||||
memcpy(dest, "Mem alloc fail. size 0x00000000 caps 0x00000000", 48);
|
memcpy(dest, "Mem alloc fail. size 0x00000000 caps 0x00000000", 48);
|
||||||
memcpy(dest+23, sSize, 8);
|
memcpy(dest + 23, sSize, 8);
|
||||||
memcpy(dest+39, sCaps, 8);
|
memcpy(dest + 39, sCaps, 8);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user