Skip to content

Add simdutf_utf8_length_from_utf32 to C API#937

Merged
lemire merged 1 commit intosimdutf:masterfrom
triallax:c-api-missing-func
Feb 12, 2026
Merged

Add simdutf_utf8_length_from_utf32 to C API#937
lemire merged 1 commit intosimdutf:masterfrom
triallax:c-api-missing-func

Conversation

@triallax
Copy link
Copy Markdown
Contributor

@triallax triallax commented Feb 8, 2026

Short title (summary): Add simdutf_utf8_length_from_utf32 to C API

Description

  • What did you change and why? (1-3 sentences)
    Added simdutf_utf8_length_from_utf32 to the C API, it appears to have been missed when the header was introduced
  • Issue reproduced / related issue: None

Type of change

  • Bug fix
  • Optimization
  • New feature
  • Refactor / cleanup
  • Documentation / tests
  • Other (please describe):

Checklist before submitting

  • I added/updated tests covering my change (if applicable)
    Don't think adding a test is necessary as this is a simple wrapper
  • Code builds locally and passes my check
  • Documentation / README updated if needed
    Don't think this is needed
  • Commits are atomic and messages are clear
  • I linked the related issue (if applicable)
    None

Comment thread src/simdutf_c.cpp
}
size_t simdutf_utf8_length_from_utf32(const char32_t *input, size_t length) {
return simdutf::utf8_length_from_utf32(
reinterpret_cast<const char32_t *>(input), length);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this cast here because it's used in some other functions like simdutf_utf8_length_from_utf16_with_replacement, but I wonder if it's really necessary? In both this and the other functions the cast is to the same type of input so it seems unnecessary to me

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original code was made with AI.

I agree this is unnecessary, please remove it (and at the other places too, if you have time).

@lemire lemire merged commit 65b574a into simdutf:master Feb 12, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants