Macaulay2 Engine
Loading...
Searching...
No Matches

◆ quotient()

template<class E, bool OC>
void ExponentVector< E, OC >::quotient ( int nvars,
ConstExponents a,
ConstExponents b,
Exponents result )
inlinestatic

Definition at line 159 of file ExponentVector.hpp.

163 {
164 if constexpr (OC)
165 for (int i = nvars; i > 0; i--)
166 {
167 // TODO: if a,b>=0 always, there would never be an overflow
168 assert(*a >= 0 && *b >= 0);
169 *result++ = safe::sub_pos(*a++, *b++);
170 }
171 else
172 for (int i = 0; i < nvars; i++)
173 {
174 Exponent x = *a++;
175 Exponent y = *b++;
176 *result++ = (x <= y ? 0 : x - y);
177 }
178 }
static int32_t sub_pos(int32_t x, int32_t y, const char *msg)
Definition overflow.hpp:172