Skip to content

[5.0] [stdlib] Fix Unicode.Scalar to String cast on big endian machines #22615

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

Conversation

mundaym
Copy link
Contributor

@mundaym mundaym commented Feb 14, 2019

Backport of #21465 to the 5.0 branch.

This change is needed for Unicode.Scalar to string casts to work on big endian machines. It does not affect the ABI and should be a no-op on little endian machines.

We need to explicity ensure that an integer is in the required byte
order (little-endian in this case) before accessing it as an array
of bytes.

We need to explicity ensure that an integer is in the required byte
order (little-endian in this case) before accessing it as an array
of bytes through an unsafe pointer.
@tkremenek
Copy link
Member

@milseman @airspeedswift please review

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

LGTM!

@milseman
Copy link
Member

@swift-ci please test

@tkremenek
Copy link
Member

@swift-ci clean test

@mundaym mundaym closed this Aug 2, 2019
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.

4 participants