Skip to content

Commit 411674b

Browse files
committed
coverage: Cast values to fit.
This fixes the following diagnostic produced by the plugin: ``` error: argument 3: Format ‘%x’ requires a ‘int’ or ‘unsigned int’ (32 bits), not ‘long unsigned int’ [size 64] [-Werror=format=] ``` Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent ae11d5d commit 411674b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ports/unix/coverage.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,21 +528,21 @@ static mp_obj_t extra_coverage(void) {
528528

529529
// convert a large integer value (stored in a mpz) to mp_uint_t and to ll;
530530
mp_obj_t obj_bigint = mp_obj_new_int_from_uint((mp_uint_t)0xdeadbeef);
531-
mp_printf(&mp_plat_print, "%x\n", mp_obj_get_uint(obj_bigint));
531+
mp_printf(&mp_plat_print, "%x\n", (int)mp_obj_get_uint(obj_bigint));
532532
obj_bigint = mp_obj_new_int_from_ll(0xc0ffee777c0ffeell);
533533
long long value_ll = mp_obj_get_ll(obj_bigint);
534534
mp_printf(&mp_plat_print, "%x%08x\n", (uint32_t)(value_ll >> 32), (uint32_t)value_ll);
535535

536536
// convert a large integer value (stored via a struct object) to uint and to ll
537537
// `deadbeef` global is an uctypes.struct defined by extra_coverage.py
538538
obj_bigint = mp_load_global(MP_QSTR_deadbeef);
539-
mp_printf(&mp_plat_print, "%x\n", mp_obj_get_uint(obj_bigint));
539+
mp_printf(&mp_plat_print, "%x\n", (int)mp_obj_get_uint(obj_bigint));
540540
value_ll = mp_obj_get_ll(obj_bigint);
541541
mp_printf(&mp_plat_print, "%x%08x\n", (uint32_t)(value_ll >> 32), (uint32_t)value_ll);
542542

543543
// convert a smaller integer value to mp_uint_t and to ll
544544
obj_bigint = mp_obj_new_int_from_uint(0xc0ffee);
545-
mp_printf(&mp_plat_print, "%x\n", mp_obj_get_uint(obj_bigint));
545+
mp_printf(&mp_plat_print, "%x\n", (int)mp_obj_get_uint(obj_bigint));
546546
value_ll = mp_obj_get_ll(obj_bigint);
547547
mp_printf(&mp_plat_print, "%x%08x\n", (uint32_t)(value_ll >> 32), (uint32_t)value_ll);
548548
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy