1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-26 11:38:02 +02:00

UTF8 changes to consistently use int8 for codepoint widths

This commit is contained in:
Brian Fiete 2024-10-26 06:25:39 -04:00
parent 0e2f49fd12
commit 1226810984
3 changed files with 7 additions and 7 deletions

View file

@ -2799,7 +2799,7 @@ namespace System
return (c32, idx, len);
}
public (int startIdx, int length) GetCodePointSpan(int idx)
public (int startIdx, int8 length) GetCodePointSpan(int idx)
{
char8* ptr = Ptr;
int startIdx = idx;
@ -4178,7 +4178,7 @@ namespace System
return .(this)[range];
}
public (char32, int) GetChar32(int idx)
public (char32 c, int8 length) GetChar32(int idx)
{
Debug.Assert((uint)idx < (uint)mLength);
char8* ptr = Ptr;
@ -4190,7 +4190,7 @@ namespace System
return UTF8.Decode(ptr + idx, mLength - idx);
}
public (char32, int, int) GetChar32WithBacktrack(int idx)
public (char32 c, int idx, int8 length) GetChar32WithBacktrack(int idx)
{
Debug.Assert((uint)idx < (uint)mLength);
char8* ptr = Ptr;

View file

@ -34,13 +34,13 @@ namespace System.Text
return 5;
}
public static int GetDecodedLength(char8* buf)
public static int8 GetDecodedLength(char8* buf)
{
char32 c = *buf;
return UTF8.sTrailingBytesForUTF8[c] + 1;
}
public static int GetDecodedLength(char8 firstChar)
public static int8 GetDecodedLength(char8 firstChar)
{
return UTF8.sTrailingBytesForUTF8[firstChar] + 1;
}