@@ -95,10 +95,10 @@ LIBC_INLINE constexpr DoubleWide<word> mul2(word a, word b) {
95
95
#endif
96
96
else {
97
97
using half_word = half_width_t <word>;
98
- const auto shiftl = [](word value) -> word {
98
+ constexpr auto shiftl = [](word value) -> word {
99
99
return value << cpp::numeric_limits<half_word>::digits;
100
100
};
101
- const auto shiftr = [](word value) -> word {
101
+ constexpr auto shiftr = [](word value) -> word {
102
102
return value >> cpp::numeric_limits<half_word>::digits;
103
103
};
104
104
// Here we do a one digit multiplication where 'a' and 'b' are of type
@@ -111,19 +111,19 @@ LIBC_INLINE constexpr DoubleWide<word> mul2(word a, word b) {
111
111
// c result
112
112
// We convert 'lo' and 'hi' from 'half_word' to 'word' so multiplication
113
113
// doesn't overflow.
114
- const word a_lo = lo (a);
115
- const word b_lo = lo (b);
116
- const word a_hi = hi (a);
117
- const word b_hi = hi (b);
118
- const word step1 = b_lo * a_lo; // no overflow;
119
- const word step2 = b_lo * a_hi; // no overflow;
120
- const word step3 = b_hi * a_lo; // no overflow;
121
- const word step4 = b_hi * a_hi; // no overflow;
114
+ word a_lo = lo (a);
115
+ word b_lo = lo (b);
116
+ word a_hi = hi (a);
117
+ word b_hi = hi (b);
118
+ word step1 = b_lo * a_lo; // no overflow;
119
+ word step2 = b_lo * a_hi; // no overflow;
120
+ word step3 = b_hi * a_lo; // no overflow;
121
+ word step4 = b_hi * a_hi; // no overflow;
122
122
word lo_digit = step1;
123
123
word hi_digit = step4;
124
- const word no_carry = 0 ;
125
- word carry;
126
- word _; // unused carry variable.
124
+ word no_carry = 0 ;
125
+ word carry = 0 ;
126
+ [[maybe_unused]] word _ = 0 ; // unused carry variable.
127
127
lo_digit = add_with_carry<word>(lo_digit, shiftl (step2), no_carry, carry);
128
128
hi_digit = add_with_carry<word>(hi_digit, shiftr (step2), carry, _);
129
129
lo_digit = add_with_carry<word>(lo_digit, shiftl (step3), no_carry, carry);
0 commit comments