From 321a2b65f83575b59d4a33760b0023e219feeba6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 2 Feb 2016 20:44:16 +0100 Subject: [PATCH] wide-int.cc (canonize_uhwi): New function. * wide-int.cc (canonize_uhwi): New function. (wi::divmod_internal): Use it. From-SVN: r233092 --- gcc/ChangeLog | 5 +++++ gcc/wide-int.cc | 31 ++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cb84561855..8c59956e30b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-02-02 Jakub Jelinek + + * wide-int.cc (canonize_uhwi): New function. + (wi::divmod_internal): Use it. + 2016-02-02 James Norris HOST_BITS_PER_WIDE_INT) + { + val[1] = 0; + return 2; + } + return 1; +} + /* * Conversion routines in and out of wide_int. */ @@ -1793,25 +1807,12 @@ wi::divmod_internal (HOST_WIDE_INT *quotient, unsigned int *remainder_len, if (quotient) { quotient[0] = o0 / o1; - if (o1 == 1 - && (HOST_WIDE_INT) o0 < 0 - && dividend_prec > HOST_BITS_PER_WIDE_INT) - { - quotient[1] = 0; - quotient_len = 2; - } + quotient_len = canonize_uhwi (quotient, dividend_prec); } if (remainder) { remainder[0] = o0 % o1; - if ((HOST_WIDE_INT) remainder[0] < 0 - && dividend_prec > HOST_BITS_PER_WIDE_INT) - { - remainder[1] = 0; - *remainder_len = 2; - } - else - *remainder_len = 1; + *remainder_len = canonize_uhwi (remainder, dividend_prec); } return quotient_len; } -- 2.30.2