From 6a2c2649b2b28a2843a3ac9034bcf2872ece3d7b Mon Sep 17 00:00:00 2001 From: ketmar Date: Fri, 13 Dec 2013 10:40:26 +0200 Subject: [PATCH] using __UINT64_C() gcc macro for unsigned 64-bit constants --- src/intio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/intio.c b/src/intio.c index 29b4a36..bcc442e 100644 --- a/src/intio.c +++ b/src/intio.c @@ -37,19 +37,19 @@ static __attribute__((unused)) int iio_write_integer (const void *src, int size, int bcnt = 1; /* now move bytes to appropriate place */ #ifdef IIO_ENDIANNESS_INTEL - num.i = (sp[0]&0x80 ? 0xffffffffffffffffULL : 0); /* clear */ + num.i = (sp[0]&0x80 ? __UINT64_C(0xffffffffffffffff) : 0); /* clear */ for (int f = 0; f < size; ++f) num.b[f] = sp[f]; #else - num.i = (sp[size-1]&0x80 ? 0xffffffffffffffffULL : 0); /* clear */ + num.i = (sp[size-1]&0x80 ? __UINT64_C(0xffffffffffffffff) : 0); /* clear */ for (int f = 0; f < size; ++f) num.b[8-size+f] = sp[f]; #endif /* check for special case: 0x80* */ - if (num.i == 0x8000000000000000ULL) return (putb == NULL || putb(0x80, udata) == 0 ? 1 : -1); /* yeah, this is the special case */ + if (num.i == __UINT64_C(0x8000000000000000)) return (putb == NULL || putb(0x80, udata) == 0 ? 1 : -1); /* yeah, this is the special case */ /* negative? negate */ - if (num.i&0x8000000000000000ULL) { + if (num.i&__UINT64_C(0x8000000000000000)) { c = 0x80; /* this is negation in two's complement arithmetic; it can't overflow, 'cause special case is already processed */ - num.i ^= 0xffffffffffffffffULL; + num.i ^= __UINT64_C(0xffffffffffffffff); ++num.i; } else { c = 0; @@ -87,7 +87,7 @@ static __attribute__((unused)) int iio_read_integer (void *dest, int size, iio_g if ((c = getb(udata)) < 0) return -1; /* special case? */ if (c == 0x80) { - num.i = 0x8000000000000000ULL; + num.i = __UINT64_C(0x8000000000000000); } else { int neg = (c&0x80); num.i = c&0x3f; @@ -105,7 +105,7 @@ static __attribute__((unused)) int iio_read_integer (void *dest, int size, iio_g } if (neg) { /* this is negation in two's complement arithmetic; it can't overflow, 'cause special case is already processed */ - num.i ^= 0xffffffffffffffffULL; + num.i ^= __UINT64_C(0xffffffffffffffff); ++num.i; } } -- 2.11.4.GIT