Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToBase64_CalculateAndValidateOutputLength()

static int System.Convert.ToBase64_CalculateAndValidateOutputLength ( int inputLength,
bool insertLineBreaks )
inlinestaticprivate

Definition at line 2881 of file Convert.cs.

2882 {
2883 long num = ((long)inputLength + 2L) / 3 * 4;
2884 if (num == 0L)
2885 {
2886 return 0;
2887 }
2888 if (insertLineBreaks)
2889 {
2890 var (num2, num3) = Math.DivRem(num, 76L);
2891 if (num3 == 0L)
2892 {
2893 num2--;
2894 }
2895 num += num2 * 2;
2896 }
2897 if (num > int.MaxValue)
2898 {
2899 throw new OutOfMemoryException();
2900 }
2901 return (int)num;
2902 }

References System.Math.DivRem(), and System.L.

Referenced by System.Convert.ToBase64CharArray(), System.Convert.ToBase64String(), and System.Convert.TryToBase64Chars().