From 652653af0b0f1a5b2dbb010782939c54bf105bb2 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 21 Jun 2020 23:50:49 +0200 Subject: [PATCH] Fix some warnings by casting for compilers which cannot detect the affectations as ok. --- m-genint.h | 2 +- m-serial-bin.h | 6 +++--- m-shared.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/m-genint.h b/m-genint.h index 70efec90..0168fbd5 100644 --- a/m-genint.h +++ b/m-genint.h @@ -114,7 +114,7 @@ genint_init(genint_t s, unsigned int n) } s->n = n; s->data = ptr; - s->max = alloc-1; + s->max = (unsigned int) (alloc-1); s->mask0 = (index == 0) ? -GENINT_ONE : ~((GENINT_ONE<<(GENINT_LIMBSIZE-index))-1); s->mask_master = (((GENINT_ONE << alloc) - 1) << (GENINT_LIMBSIZE-alloc)) >> GENINT_ABA_CPT; atomic_init (&s->master, (genint_limb_t)0); diff --git a/m-serial-bin.h b/m-serial-bin.h index 61647d38..2d667b3a 100644 --- a/m-serial-bin.h +++ b/m-serial-bin.h @@ -160,13 +160,13 @@ m_serial_bin_write_float(m_serial_write_t serial, const long double data, const FILE *f = (FILE *)serial->data[0].p; if (size_of_type == sizeof f1) { - f1 = data; + f1 = (float) data; n = fwrite (M_ASSIGN_CAST(const void*, &f1), sizeof f1, 1, f); } else if (size_of_type == sizeof f2) { - f2 = data; + f2 = (double) data; n = fwrite (M_ASSIGN_CAST(const void*, &f2), sizeof f2, 1, f); } else if (size_of_type == sizeof f3) { - f3 = data; + f3 = (long double) data; n = fwrite (M_ASSIGN_CAST(const void*, &f3), sizeof f3, 1, f); } else { M_ASSERT_INIT(false, "a float of suitable size"); diff --git a/m-shared.h b/m-shared.h index 68e66d60..9ee5f0d6 100644 --- a/m-shared.h +++ b/m-shared.h @@ -366,7 +366,7 @@ static inline int sharedi_integer_cref(int *p) { return *p; } M_CALL_INIT(oplist, s->buffer[i].x); \ atomic_init (&s->buffer[i].cpt, 0U); \ } \ - genint_init(s->core, n); \ + genint_init(s->core, (unsigned int) n); \ SHAREDI_RESOURCE_CONTRACT(s); \ } \ \