Skip to content

Commit

Permalink
create in situ for nqp::chr if it fits into 8bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Nov 15, 2017
1 parent 1c4aba1 commit 1afd45e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/strings/ops.c
Expand Up @@ -2555,9 +2555,8 @@ MVMString * MVM_string_chr(MVMThreadContext *tc, MVMint64 cp) {

s = (MVMString *)REPR(tc->instance->VMString)->allocate(tc, STABLE(tc->instance->VMString));
if (can_fit_into_8bit(g)) {
s->body.storage_type = MVM_STRING_GRAPHEME_8;
s->body.storage.blob_8 = MVM_malloc(sizeof(MVMGrapheme8));
s->body.storage.blob_8[0] = g;
s->body.storage_type = MVM_STRING_IN_SITU;
s->body.storage.in_situ[0] = g;
} else {
s->body.storage_type = MVM_STRING_GRAPHEME_32;
s->body.storage.blob_32 = MVM_malloc(sizeof(MVMGrapheme32));
Expand Down

0 comments on commit 1afd45e

Please sign in to comment.