private static void Normalize(uint[] u, int l, uint[] un, int shift) {
Debug.Assert(un.Length == l || un.Length == l + 1);
Debug.Assert(un.Length == l + 1 || ((u[l - 1] << shift) >> shift) == u[l - 1]);
Debug.Assert(0 <= shift && shift < 32);
uint carry = 0;
int i;
if (shift > 0) {
int rshift = BitsPerDigit - shift;
for (i = 0; i < l; i++) {
uint ui = u[i];
un[i] = (ui << shift) | carry;
carry = ui >> rshift;
}
} else {
for (i = 0; i < l; i++) {
un[i] = u[i];
}
}
while (i < un.Length) {
un[i++] = 0;
}
if (carry != 0) {
Debug.Assert(l == un.Length - 1);
un[l] = carry;
}
TestNormalize(u, un, shift);
}