Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 64edfc9

Browse files
committed
Use Math.DivRem in another place in mscorlib
Went through all uses of % looking for places DivRem could be used. This looks like it's the only one of note.
1 parent bd1f21d commit 64edfc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/mscorlib/src/System/Globalization/IdnMapping.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,10 @@ static String punycode_encode(String unicode)
710710
k >= bias + tmax ? tmax : k - bias;
711711
if (q < t) break;
712712
Contract.Assert(punycodeBase != t, "[IdnMapping.punycode_encode]Expected punycodeBase (36) to be != t");
713-
output.Append(encode_digit(t + (q - t) % (punycodeBase - t)));
714-
q = (q - t) / (punycodeBase - t);
713+
714+
int mod;
715+
q = Math.DivRem(q - t, punycodeBase - t, out mod);
716+
output.Append(encode_digit(t + mod));
715717
}
716718

717719
output.Append(encode_digit(q));

0 commit comments

Comments
 (0)