Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stdlib] Fix chr impl taking funcs to string_slice and separating #3506

Closed

Conversation

martinvuyk
Copy link
Contributor

Fix chr implementation taking funcs to string_slice and separating their respective functionalities.

This code will be used elsewhere e.g., PR #3496

Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk requested a review from a team as a code owner September 19, 2024 14:31
return int((sizes < c).cast[DType.uint8]().reduce_add())


fn _shift_unicode_to_utf8(ptr: UnsafePointer[UInt8], c: Int, num_bytes: Int):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure of this argument ordering but I don't know if we have any such sort of convention yet

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no convention yet, I could make a case either way: weak preference towards putting num_bytes as the second argument.

return int((sizes < c).cast[DType.uint8]().reduce_add())


fn _shift_unicode_to_utf8(ptr: UnsafePointer[UInt8], c: Int, num_bytes: Int):
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no convention yet, I could make a case either way: weak preference towards putting num_bytes as the second argument.

@JoeLoser
Copy link
Collaborator

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Sep 19, 2024
@modularbot
Copy link
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added the merged-internally Indicates that this pull request has been merged internally label Sep 21, 2024
modularbot added a commit that referenced this pull request Sep 22, 2024
…arating (#47532)

[External] [stdlib] Fix chr impl taking funcs to string_slice and
separating

Fix `chr` implementation taking funcs to `string_slice` and separating their
respective functionalities.

This code will be used elsewhere e.g., PR
[#3496](#3496 (comment))

ORIGINAL_AUTHOR=martinvuyk
<110240700+martinvuyk@users.noreply.github.com>
PUBLIC_PR_LINK=#3506

Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Closes #3506
MODULAR_ORIG_COMMIT_REV_ID: dc8c96e58f5e272d01e3c26f6daf3ffe8f7c0b36
@modularbot modularbot added the merged-externally Merged externally in public mojo repo label Sep 22, 2024
@modularbot
Copy link
Collaborator

Landed in 38ed691! Thank you for your contribution 🎉

@modularbot modularbot closed this Sep 22, 2024
@martinvuyk martinvuyk deleted the fix-chr-implementation branch October 16, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants