32位 STM32 打印 uint64_t 类型

32位 STM32 打印 uint64_t 类型

  • 32位 STM32 打印 uint64_t 类型

32位 STM32 打印 uint64_t 类型

测试代码,未整理,可参考!

    uint64_t cnt = 0x1122334455667788;
    uint32_t test1 = (uint32_t)(cnt >> 32);
    uint64_t test2 = (uint64_t)(cnt & 0x00000000FFFFFFFF);
    LOG(LOG_LVL_INFO, "0x%llx; 0x%08x_%08x\r\n", cnt, test1, (uint32_t)test2);
    hexdump(0, "uint64_t", &cnt, 8);

    char buf[100];
    memset(buf, 0, sizeof(buf));
    snprintf(buf, sizeof(buf), "0x%llx, 0x%08x_%08x\r\n", cnt, test1, (uint32_t)test2);
    LOG(LOG_LVL_INFO, "%s", buf);
    LOG(LOG_LVL_INFO, "%"PRId64"\r\n", cnt);

32位 STM32 打印 uint64_t 类型_第1张图片

32位 STM32 打印 uint64_t 类型_第2张图片

你可能感兴趣的:(嵌入式,物联网,stm32,嵌入式硬件)