Skip to content

Commit

Permalink
Make Entity::to_bits const (bevyengine#6559)
Browse files Browse the repository at this point in the history
# Objective
Fix bevyengine#6548. Most of these methods were already made `const` in bevyengine#5688. `Entity::to_bits` is the only one that remained.

## Solution
Make it const.
  • Loading branch information
james7132 authored and ItsDoot committed Feb 1, 2023
1 parent 8b174fc commit 8edc264
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/entity/mod.rs
Expand Up @@ -176,8 +176,8 @@ impl Entity {
/// for serialization between runs.
///
/// No particular structure is guaranteed for the returned bits.
pub fn to_bits(self) -> u64 {
u64::from(self.generation) << 32 | u64::from(self.index)
pub const fn to_bits(self) -> u64 {
(self.generation as u64) << 32 | self.index as u64
}

/// Reconstruct an `Entity` previously destructured with [`Entity::to_bits`].
Expand Down

0 comments on commit 8edc264

Please sign in to comment.