diff options
author | Thomas Guillemard <me@thog.eu> | 2019-07-04 17:20:40 +0200 |
---|---|---|
committer | Ac_K <Acoustik666@gmail.com> | 2019-07-04 17:20:40 +0200 |
commit | 708620252e837f2111213c6e36d5f8cc8cfd03e8 (patch) | |
tree | bf05e304312382f059b418f003b251d7bb28e3fb /Ryujinx.HLE/Utilities/StringUtils.cs | |
parent | 789cdba8b51f310399752f7a1309e489fadf8dc1 (diff) |
ITimeZoneService rewrite (#722)
* Clean up ITimeZoneService
Add error codes and simplify parsing
* Add accurate timezone logic
TOOD: LoadTimeZoneRule and location name cmds.
* Integrate the new TimeZone logic
* SCREAMING_UNIX_CASE => PascalCase
* Address comments
* Reduce use of pointer in the LoadTimeZoneRule logic
* Address comments
* Realign tzIfStream logic in LoadTimeZoneRule
* Address gdk's comments
Diffstat (limited to 'Ryujinx.HLE/Utilities/StringUtils.cs')
-rw-r--r-- | Ryujinx.HLE/Utilities/StringUtils.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index ad18192e..4ce0823c 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -95,5 +95,31 @@ namespace Ryujinx.HLE.Utilities return Encoding.UTF8.GetString(ms.ToArray()); } } + + public static unsafe int CompareCStr(char* s1, char* s2) + { + int s1Index = 0; + int s2Index = 0; + + while (s1[s1Index] != 0 && s2[s2Index] != 0 && s1[s1Index] == s2[s2Index]) + { + s1Index += 1; + s2Index += 1; + } + + return s2[s2Index] - s1[s1Index]; + } + + public static unsafe int LengthCstr(char* s) + { + int i = 0; + + while (s[i] != '\0') + { + i++; + } + + return i; + } } } |