misc optimization

list initial size is 4; oftentimes it's greater, and always padded
This commit is contained in:
Kurt
2018-08-19 16:26:08 -07:00
parent c0b5d3eef7
commit d307a30cad

View File

@@ -146,7 +146,7 @@ public static byte[] SetString1(string value, int maxLength, bool jp, int padTo
if (value.StartsWith(G1TradeOTStr)) // Handle "[TRAINER]"
return new[] { dict[G1TradeOT], dict[G1Terminator] };
List<byte> arr = new List<byte>();
var arr = new List<byte>(padTo);
foreach (char c in value)
{
if (!dict.TryGetValue(c, out byte val))
@@ -177,7 +177,7 @@ public static byte[] SetString2KOR(string value, int maxLength, int padTo = 0, u
if (value.StartsWith(G1TradeOTStr)) // Handle "[TRAINER]"
return new[] { dict[G1TradeOT], dict[G1Terminator] };
List<byte> arr = new List<byte>();
var arr = new List<byte>(padTo);
foreach (char c in value)
{
bool koreanChar = false;