From b116b86bcad7c35b3b9c1853055a4ace97bea232 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 1 Nov 2019 22:55:39 +0100 Subject: [PATCH] Avoid "suggest explicit braces to avoid ambiguous 'else'" warnings. --- src/integer/conv/cl_I_from_L.cc | 12 +++++------ src/integer/conv/cl_I_from_L2.cc | 12 +++++------ src/integer/conv/cl_I_from_Q.cc | 12 +++++------ src/integer/conv/cl_I_from_Q2.cc | 12 +++++------ src/integer/conv/cl_I_from_UL.cc | 6 +++--- src/integer/conv/cl_I_from_UL2.cc | 6 +++--- src/integer/conv/cl_I_from_UQ.cc | 6 +++--- src/integer/conv/cl_I_to_L.cc | 36 +++++++++++++++---------------- src/integer/conv/cl_I_to_Q.cc | 36 +++++++++++++++---------------- src/integer/conv/cl_I_to_UL.cc | 20 ++++++++--------- src/integer/conv/cl_I_to_UQ.cc | 18 ++++++++-------- 11 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/integer/conv/cl_I_from_L.cc b/src/integer/conv/cl_I_from_L.cc index bf1af07..f54ca9f 100644 --- a/src/integer/conv/cl_I_from_L.cc +++ b/src/integer/conv/cl_I_from_L.cc @@ -45,10 +45,10 @@ cl_private_thing cl_I_constructor_from_L (sint32 wert) } if (wert >= 0) { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 32)) \ - if (!((i+1)*intDsize <= 32) \ + if ((bn_minlength <= i) && (i*intDsize <= 32) \ + && (!((i+1)*intDsize <= 32) \ || ((uint32)wert < (uint32)bitc(i*intDsize-1)) \ - ) + ) ) #if (intDsize <= 32) IF_LENGTH(1) bignum1: @@ -88,10 +88,10 @@ cl_private_thing cl_I_constructor_from_L (sint32 wert) #undef IF_LENGTH } else { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 32)) \ - if (!((i+1)*intDsize <= 32) \ + if ((bn_minlength <= i) && (i*intDsize <= 32) \ + && (!((i+1)*intDsize <= 32) \ || ((uint32)wert >= (uint32)(-bitc(i*intDsize-1))) \ - ) + ) ) #if (intDsize <= 32) IF_LENGTH(1) goto bignum1; diff --git a/src/integer/conv/cl_I_from_L2.cc b/src/integer/conv/cl_I_from_L2.cc index be5a00d..7e28cf6 100644 --- a/src/integer/conv/cl_I_from_L2.cc +++ b/src/integer/conv/cl_I_from_L2.cc @@ -68,12 +68,12 @@ cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo) #endif if (wert_hi >= 0) { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 64)) \ - if (!((i+1)*intDsize <= 64) \ + if ((bn_minlength <= i) && (i*intDsize <= 64) \ + && (!((i+1)*intDsize <= 64) \ || (i*intDsize-1 < 32 \ ? ((wert_hi == 0) && (wert_lo < (uint32)bitc(i*intDsize-1))) \ : ((uint32)wert_hi < (uint32)bitc(i*intDsize-1-32)) \ - ) ) + ) ) ) #define ALLOC(i) \ var cl_heap_bignum* ptr = allocate_bignum(i); #define OK \ @@ -103,12 +103,12 @@ cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo) #undef IF_LENGTH } else { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 64)) \ - if (!((i+1)*intDsize <= 64) \ + if ((bn_minlength <= i) && (i*intDsize <= 64) \ + && (!((i+1)*intDsize <= 64) \ || (i*intDsize-1 < 32 \ ? ((wert_hi == ~(sint32)0) && (wert_lo >= (uint32)(-bitc(i*intDsize-1)))) \ : ((uint32)wert_hi >= (uint32)(-bitc(i*intDsize-1-32))) \ - ) ) + ) ) ) IF_LENGTH(1) goto bignum1; #if (intDsize <= 32) diff --git a/src/integer/conv/cl_I_from_Q.cc b/src/integer/conv/cl_I_from_Q.cc index 47c879a..ca9f735 100644 --- a/src/integer/conv/cl_I_from_Q.cc +++ b/src/integer/conv/cl_I_from_Q.cc @@ -27,10 +27,10 @@ cl_private_thing cl_I_constructor_from_Q (sint64 wert) // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt) if (wert >= 0) { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 64)) \ - if (!((i+1)*intDsize <= 64) \ + if ((bn_minlength <= i) && (i*intDsize <= 64) \ + && (!((i+1)*intDsize <= 64) \ || ((uint64)wert < ((uint64)1 << (i*intDsize-1))) \ - ) + ) ) IF_LENGTH(1) bignum1: { var cl_heap_bignum* ptr = allocate_bignum(1); @@ -116,10 +116,10 @@ cl_private_thing cl_I_constructor_from_Q (sint64 wert) #undef IF_LENGTH } else { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 64)) \ - if (!((i+1)*intDsize <= 64) \ + if ((bn_minlength <= i) && (i*intDsize <= 64) \ + && (!((i+1)*intDsize <= 64) \ || ((uint64)wert >= ((uint64)(-1) << (i*intDsize-1))) \ - ) + ) ) IF_LENGTH(1) goto bignum1; #if (intDsize <= 32) diff --git a/src/integer/conv/cl_I_from_Q2.cc b/src/integer/conv/cl_I_from_Q2.cc index fe7ca0e..6535f36 100644 --- a/src/integer/conv/cl_I_from_Q2.cc +++ b/src/integer/conv/cl_I_from_Q2.cc @@ -92,12 +92,12 @@ cl_private_thing cl_I_constructor_from_Q2 (sint64 wert_hi, uint64 wert_lo) #endif if (wert_hi >= 0) { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 128)) \ - if (!((i+1)*intDsize <= 128) \ + if ((bn_minlength <= i) && (i*intDsize <= 128) \ + && (!((i+1)*intDsize <= 128) \ || (i*intDsize-1 < 64 \ ? ((wert_hi == 0) && (wert_lo < (uint64)bitc(i*intDsize-1))) \ : ((uint64)wert_hi < (uint64)bitc(i*intDsize-1-64)) \ - ) ) + ) ) ) #define ALLOC(i) \ var cl_heap_bignum* ptr = allocate_bignum(i); #define OK \ @@ -143,12 +143,12 @@ cl_private_thing cl_I_constructor_from_Q2 (sint64 wert_hi, uint64 wert_lo) #undef IF_LENGTH } else { #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i*intDsize <= 128)) \ - if (!((i+1)*intDsize <= 128) \ + if ((bn_minlength <= i) && (i*intDsize <= 128) \ + && (!((i+1)*intDsize <= 128) \ || (i*intDsize-1 < 64 \ ? ((wert_hi == ~(sint64)0) && (wert_lo >= (uint64)(-bitc(i*intDsize-1)))) \ : ((uint64)wert_hi >= (uint64)(-bitc(i*intDsize-1-64))) \ - ) ) + ) ) ) IF_LENGTH(1) goto bignum1; IF_LENGTH(2) diff --git a/src/integer/conv/cl_I_from_UL.cc b/src/integer/conv/cl_I_from_UL.cc index be95e46..e3a5bdd 100644 --- a/src/integer/conv/cl_I_from_UL.cc +++ b/src/integer/conv/cl_I_from_UL.cc @@ -27,10 +27,10 @@ cl_private_thing cl_I_constructor_from_UL (uint32 wert) // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) #define UL_maxlength ceiling(32+1,intDsize) #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i <= UL_maxlength)) \ - if (!(i+1 <= UL_maxlength) \ + if ((bn_minlength <= i) && (i <= UL_maxlength) \ + && (!(i+1 <= UL_maxlength) \ || ((uint32)wert < (uint32)bitc(i*intDsize-1)) \ - ) + ) ) IF_LENGTH(1) { var cl_heap_bignum* ptr = allocate_bignum(1); arrayLSref(ptr->data,1,0) = wert; diff --git a/src/integer/conv/cl_I_from_UL2.cc b/src/integer/conv/cl_I_from_UL2.cc index 3be44a1..fbf431f 100644 --- a/src/integer/conv/cl_I_from_UL2.cc +++ b/src/integer/conv/cl_I_from_UL2.cc @@ -68,12 +68,12 @@ cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo) #define FILL_9 FILL_1_DIGIT(9,8,0); FILL_4_DIGIT(9,4,wert_hi); FILL_4_DIGIT(9,0,wert_lo); #endif #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i <= UL2_maxlength)) \ - if (!(i+1 <= UL2_maxlength) \ + if ((bn_minlength <= i) && (i <= UL2_maxlength) \ + && (!(i+1 <= UL2_maxlength) \ || (i*intDsize-1 < 32 \ ? ((wert_hi == 0) && (wert_lo < (uint32)bitc(i*intDsize-1))) \ : (wert_hi < (uint32)bitc(i*intDsize-1-32)) \ - ) ) + ) ) ) #define ALLOC(i) \ var cl_heap_bignum* ptr = allocate_bignum(i); #define OK \ diff --git a/src/integer/conv/cl_I_from_UQ.cc b/src/integer/conv/cl_I_from_UQ.cc index d4b3091..6eaf349 100644 --- a/src/integer/conv/cl_I_from_UQ.cc +++ b/src/integer/conv/cl_I_from_UQ.cc @@ -26,10 +26,10 @@ cl_private_thing cl_I_constructor_from_UQ (uint64 wert) // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) #define UQ_maxlength ceiling(64+1,intDsize) #define IF_LENGTH(i) \ - if ((bn_minlength <= i) && (i <= UQ_maxlength)) \ - if (!(i+1 <= UQ_maxlength) \ + if ((bn_minlength <= i) && (i <= UQ_maxlength) \ + && (!(i+1 <= UQ_maxlength) \ || ((uint64)wert < ((uint64)1 << (i*intDsize-1 < 64 ? i*intDsize-1 : 0))) \ - ) + ) ) IF_LENGTH(1) { var cl_heap_bignum* ptr = allocate_bignum(1); arrayLSref(ptr->data,1,0) = (uintD)wert; diff --git a/src/integer/conv/cl_I_to_L.cc b/src/integer/conv/cl_I_to_L.cc index d67e185..07b581b 100644 --- a/src/integer/conv/cl_I_to_L.cc +++ b/src/integer/conv/cl_I_to_L.cc @@ -35,15 +35,15 @@ sint32 cl_I_to_L (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) >= 0) { // Bignum > 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ - if ( (i*intDsize > 32) \ - && ( ((i-1)*intDsize >= 32) \ - || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(31-(i-1)*intDsize)) \ - ) ) \ - goto bad; \ - else + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ + && ( (i*intDsize > 32) \ + && ( ((i-1)*intDsize >= 32) \ + || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(31-(i-1)*intDsize)) \ + ) ) ) \ + goto bad; \ + else IF_LENGTH(1) return get_uint1D_Dptr(arrayLSDptr(bn->data,1)); IF_LENGTH(2) @@ -56,15 +56,15 @@ sint32 cl_I_to_L (const cl_I& obj) } else { // Bignum < 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ - if ( (i*intDsize > 32) \ - && ( ((i-1)*intDsize >= 32) \ - || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(31-(i-1)*intDsize))) \ - ) ) \ - goto bad; \ - else + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ + && ( (i*intDsize > 32) \ + && ( ((i-1)*intDsize >= 32) \ + || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(31-(i-1)*intDsize))) \ + ) ) ) \ + goto bad; \ + else IF_LENGTH(1) return get_sint1D_Dptr(arrayLSDptr(bn->data,1)); IF_LENGTH(2) diff --git a/src/integer/conv/cl_I_to_Q.cc b/src/integer/conv/cl_I_to_Q.cc index 2d3a6e0..40cec5c 100644 --- a/src/integer/conv/cl_I_to_Q.cc +++ b/src/integer/conv/cl_I_to_Q.cc @@ -31,15 +31,15 @@ sint64 cl_I_to_Q (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) >= 0) { // Bignum > 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ - if ( (i*intDsize > 64) \ - && ( ((i-1)*intDsize >= 64) \ - || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(63-(i-1)*intDsize)) \ - ) ) \ - goto bad; \ - else + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ + && ( (i*intDsize > 64) \ + && ( ((i-1)*intDsize >= 64) \ + || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(63-(i-1)*intDsize)) \ + ) ) ) \ + goto bad; \ + else #if (intDsize==64) IF_LENGTH(1) return (uint64)arrayLSref(bn->data,1,0); @@ -82,15 +82,15 @@ sint64 cl_I_to_Q (const cl_I& obj) } else { // Bignum < 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ - if ( (i*intDsize > 64) \ - && ( ((i-1)*intDsize >= 64) \ - || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(63-(i-1)*intDsize))) \ - ) ) \ - goto bad; \ - else + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ + && ( (i*intDsize > 64) \ + && ( ((i-1)*intDsize >= 64) \ + || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(63-(i-1)*intDsize))) \ + ) ) ) \ + goto bad; \ + else #if (intDsize==64) IF_LENGTH(1) return (sint64)arrayLSref(bn->data,1,0); diff --git a/src/integer/conv/cl_I_to_UL.cc b/src/integer/conv/cl_I_to_UL.cc index b5d5706..cc43a7c 100644 --- a/src/integer/conv/cl_I_to_UL.cc +++ b/src/integer/conv/cl_I_to_UL.cc @@ -35,16 +35,16 @@ uint32 cl_I_to_UL (const cl_I& obj) var uintC len = bn->length; if ((sintD)mspref(arrayMSDptr(bn->data,len),0) < 0) goto bad; - #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ - if ( (i*intDsize-1 > 32) \ - && ( ((i-1)*intDsize-1 >= 32) \ - || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(32-(i-1)*intDsize)) \ - ) ) \ - goto bad; \ - else + #define IF_LENGTH(i) \ + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ + && ( (i*intDsize-1 > 32) \ + && ( ((i-1)*intDsize-1 >= 32) \ + || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(32-(i-1)*intDsize)) \ + ) ) ) \ + goto bad; \ + else IF_LENGTH(1) return get_uint1D_Dptr(arrayLSDptr(bn->data,1)); IF_LENGTH(2) diff --git a/src/integer/conv/cl_I_to_UQ.cc b/src/integer/conv/cl_I_to_UQ.cc index 8192a49..19f0a52 100644 --- a/src/integer/conv/cl_I_to_UQ.cc +++ b/src/integer/conv/cl_I_to_UQ.cc @@ -34,15 +34,15 @@ uint64 cl_I_to_UQ (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) < 0) goto bad; #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ - if (len == i) /* genau i Digits? */ \ - /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ - if ( (i*intDsize-1 > 64) \ - && ( ((i-1)*intDsize-1 >= 64) \ - || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(64-(i-1)*intDsize)) \ - ) ) \ - goto bad; \ - else + if ((bn_minlength <= i) /* genau i Digits überhaupt möglich? */ \ + && (len == i) /* genau i Digits? */ \ + /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ + && ( (i*intDsize-1 > 64) \ + && ( ((i-1)*intDsize-1 >= 64) \ + || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(64-(i-1)*intDsize)) \ + ) ) ) \ + goto bad; \ + else #if (intDsize==64) IF_LENGTH(1) return (uint64)arrayLSref(bn->data,1,0); -- 2.49.0