From 708620252e837f2111213c6e36d5f8cc8cfd03e8 Mon Sep 17 00:00:00 2001 From: Thomas Guillemard Date: Thu, 4 Jul 2019 17:20:40 +0200 Subject: 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 --- Ryujinx.HLE/Utilities/StringUtils.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Ryujinx.HLE/Utilities/StringUtils.cs') 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; + } } } -- cgit v1.2.3