-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Move float_ord from bevy_core to bevy_utils #4189
Conversation
@@ -41,12 +41,12 @@ impl Hash for FloatOrd { | |||
fn hash<H: Hasher>(&self, state: &mut H) { | |||
if self.0.is_nan() { | |||
// Ensure all NaN representations hash to the same value | |||
state.write(bytemuck::bytes_of(&f32::NAN)); | |||
state.write(&f32::to_ne_bytes(f32::NAN)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bevy_utils doesn't use bytemuck (currently, at least), so rather than add a bytemuck dep I just wrote the equivalent code with std support.
If it's preferred, we could just add bytemuck to bevy_utils, but it is in fact equivalent either way.
(It might be plausible that the bytemuck reëxport moves from bevy_core to bevy_utils as well, but I'm unsure about that one and just wanted to move FloatOrd
here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me; I'm content not to pull in the dependency here.
One quick question. I like this change though; it's clearly the right organization and the rest lgtm. |
bors try |
@CAD97 can you rebase? |
Rebased. |
bors r+ |
# Objective Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils. A step in addressing #2931 and splitting bevy_core into more specific locations. ## Solution Move FloatOrd into bevy_utils. Fix the compile errors. As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
This should be labeled as a breaking change: those who import single items from Bevy instead of the prelude will have their builds broken. |
@CAD97 can you add a quick migration guide to this? |
# Objective Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils. A step in addressing bevyengine#2931 and splitting bevy_core into more specific locations. ## Solution Move FloatOrd into bevy_utils. Fix the compile errors. As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
# Objective Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils. A step in addressing bevyengine#2931 and splitting bevy_core into more specific locations. ## Solution Move FloatOrd into bevy_utils. Fix the compile errors. As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
Objective
Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils.
A step in addressing #2931 and splitting bevy_core into more specific locations.
Solution
Move FloatOrd into bevy_utils. Fix the compile errors.
As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for
FloatOrd
previously).Migration guide
Replace imports of
bevy::core::FloatOrd
withbevy::utils::FloatOrd
.