3380 {
3381 byte* digitsPointer = number.GetDigitsPointer();
3382 int j;
3383 for (j = 0; j < pos && digitsPointer[j] != 0; j++)
3384 {
3385 }
3386 if (j == pos &&
ShouldRoundUp(digitsPointer, j, number.Kind, isCorrectlyRounded))
3387 {
3388 while (j > 0 && digitsPointer[j - 1] == 57)
3389 {
3390 j--;
3391 }
3392 if (j > 0)
3393 {
3394 byte* num = digitsPointer + (j - 1);
3395 (*num)++;
3396 }
3397 else
3398 {
3399 number.Scale++;
3400 *digitsPointer = 49;
3401 j = 1;
3402 }
3403 }
3404 else
3405 {
3406 while (j > 0 && digitsPointer[j - 1] == 48)
3407 {
3408 j--;
3409 }
3410 }
3411 if (j == 0)
3412 {
3413 if (number.Kind != NumberBufferKind.FloatingPoint)
3414 {
3415 number.IsNegative = false;
3416 }
3417 number.Scale = 0;
3418 }
3419 digitsPointer[j] = 0;
3420 number.DigitsCount = j;
3421 unsafe
static bool ShouldRoundUp(
byte* dig,
int i, NumberBufferKind numberKind,
bool isCorrectlyRounded)
3422 {
3424 if (b == 0 || isCorrectlyRounded)
3425 {
3426 return false;
3427 }
3428 return b >= 53;
3429 }
3430 }
static bool ShouldRoundUp(bool lsbBit, bool roundBit, bool hasTailBits)