-
-
Save samcv/49edd75afe6fc4a84852f8605d99e6b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Returns the codepoint from grapheme iterator at a specific location without doing checks, for internal VM use only. */ | |
MVMGrapheme32 MVM_string_gi_get_grapheme_at(MVMThreadContext *tc, MVMString *a, MVMGraphemeIter *gi, MVMint64 index) { | |
switch (a->body.storage_type) { | |
case MVM_STRING_GRAPHEME_32: | |
return a->body.storage.blob_32[index]; | |
case MVM_STRING_GRAPHEME_ASCII: | |
return a->body.storage.blob_ascii[index]; | |
case MVM_STRING_GRAPHEME_8: | |
return a->body.storage.blob_8[index]; | |
case MVM_STRING_STRAND: { | |
MVM_string_gi_move_to(tc, gi, index); | |
return MVM_string_gi_get_grapheme(tc, gi); | |
} | |
default: | |
MVM_exception_throw_adhoc(tc, "String corruption detected: bad storage type"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment