Re: [PATCH] hwint: Simplify add_hwi/mul_hwi.
Andrea Pinski <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <CALvbMcDKEpqwWkacaE12NCeikQYtD3XoxXQd7y9ZiiJwL0dJuA@mail.gmail.com> |
On Sun, Aug 9, 2026 at 3:02 PM Kael Andrew Alonzo Franco <[email protected]> wrote: > > This combines duplicated C++ code so any C++ compiler compiles this > header file faster. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > > gcc/ChangeLog: > > * hwint.h (add_hwi, mul_hwi): Combine return result. Ok. > > Signed-off-by: Kael Andrew Franco <[email protected]> > --- > gcc/hwint.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/gcc/hwint.h b/gcc/hwint.h > index 454ee0efdcb..ebb4253e89d 100644 > --- a/gcc/hwint.h > +++ b/gcc/hwint.h > @@ -365,12 +365,11 @@ add_hwi (HOST_WIDE_INT a, HOST_WIDE_INT b, bool *overflow) > *overflow = true; > else > *overflow = false; > - return result; > #else > HOST_WIDE_INT result; > *overflow = __builtin_add_overflow (a, b, &result); > - return result; > #endif > + return result; > } > > /* Compute the product of signed A and B and indicate in *OVERFLOW whether > @@ -386,12 +385,11 @@ mul_hwi (HOST_WIDE_INT a, HOST_WIDE_INT b, bool *overflow) > *overflow = true; > else > *overflow = false; > - return result; > #else > HOST_WIDE_INT result; > *overflow = __builtin_mul_overflow (a, b, &result); > - return result; > #endif > + return result; > } > > /* Compute the saturated sum of signed A and B, i.e. upon overflow clamp > -- > 2.55.0 >