half: fix -Wformat warnings (#1927)

Avoid casting to `uint64_t` in some places; instead keep the types as
`size_t` and use the `%z` length modifier, or as
`uint32_t` and use the `%u` specifier.

For printing of 64-bit types, use the `PRI*64` macros from <cinttypes>
to ensure portability across 32 and 64-bit builds.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2024-03-27 14:46:27 +01:00
committed by GitHub
parent 96361171ed
commit 83203db6e2
4 changed files with 26 additions and 10 deletions

View File

@@ -16,6 +16,7 @@
#include <string.h>
#include <algorithm>
#include <cinttypes>
#include "cl_utils.h"
#include "tests.h"
@@ -232,7 +233,10 @@ int test_roundTrip( cl_device_id device, cl_context context, cl_command_queue qu
if( IsHalfSubnormal(u2[j]) && ( (u1[j] == 0) || (u1[j] == 0x8000) ) )
continue;
vlog_error( "%lld) (of %lld) Failure at 0x%4.4x: 0x%4.4x vector_size = %d \n", j, (uint64_t)count, u2[j], u1[j], (g_arrVecSizes[vectorSize]) );
vlog_error("%" PRId64 ") (of %u) Failure at 0x%4.4x: "
"0x%4.4x vector_size = %d \n",
j, count, u2[j], u1[j],
(g_arrVecSizes[vectorSize]));
gFailCount++;
error = -1;
goto exit;
@@ -282,7 +286,10 @@ int test_roundTrip( cl_device_id device, cl_context context, cl_command_queue qu
if( IsHalfSubnormal(u2[j]) && ( (u1[j] == 0) || (u1[j] == 0x8000) ) )
continue;
vlog_error( "%lld) Failure at 0x%4.4x: 0x%4.4x vector_size = %d (double precsion)\n", j, u2[j], u1[j], (g_arrVecSizes[vectorSize]) );
vlog_error(
"%" PRId64 ") Failure at 0x%4.4x: 0x%4.4x "
"vector_size = %d (double precision)\n",
j, u2[j], u1[j], (g_arrVecSizes[vectorSize]));
gFailCount++;
error = -1;
goto exit;