bevy/crates/bevy_ecs/src
Giacomo Stevanato e75c2f8b16
Remove a ptr-to-int cast in CommandQueue::apply (#10475)
# Objective

- `CommandQueue::apply` calculates the address of the end of the
internal buffer as a `usize` rather than as a pointer, requiring two
casts of `cursor` to `usize`. Casting pointers to integers is generally
discouraged and may also prevent optimizations. It's also unnecessary
here.

## Solution

- Calculate the end address as a pointer rather than a `usize`.

Small note:

A trivial translation of the old code to use pointers would have
computed `end_addr` as `cursor.add(self.bytes.len())`, which is not
wrong but is an additional `unsafe` operation that also needs to be
properly documented and proven correct. However this operation is
already implemented in the form of the safe `as_mut_ptr_range`, so I
just used that.
2023-11-09 19:32:33 +00:00
..
entity Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00
query Derive Error for more error types (#10240) 2023-10-28 22:20:37 +00:00
reflect Use EntityHashMap for EntityMapper (#10415) 2023-11-07 08:23:04 +00:00
schedule Remove unnecessary if statement in scheduler (#10446) 2023-11-09 00:57:22 +00:00
storage Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
system Remove a ptr-to-int cast in CommandQueue::apply (#10475) 2023-11-09 19:32:33 +00:00
world Replace all labels with interned labels (#7762) 2023-10-25 21:39:23 +00:00
archetype.rs Add a public API to ArchetypeGeneration/Id (#9825) 2023-10-02 12:54:45 +00:00
bundle.rs Fix some nightly warnings (#9672) 2023-09-02 18:35:06 +00:00
change_detection.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
component.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
event.rs Only run event systems if they have tangible work to do (#7728) 2023-09-24 00:16:33 +00:00
lib.rs Global TaskPool API improvements (#10008) 2023-10-23 20:48:48 +00:00
removal_detection.rs Hide UnsafeWorldCell::unsafe_world (#9741) 2023-10-02 12:46:43 +00:00