mirror of
https://github.com/bevyengine/bevy
synced 2024-12-23 19:43:07 +00:00
79d36e7c28
# Objective - Our crevice is still called "crevice", which we can't use for a release - Users would need to use our "crevice" directly to be able to use the derive macro ## Solution - Rename crevice to bevy_crevice, and crevice-derive to bevy-crevice-derive - Re-export it from bevy_render, and use it from bevy_render everywhere - Fix derive macro to work either from bevy_render, from bevy_crevice, or from bevy ## Remaining - It is currently re-exported as `bevy::render::bevy_crevice`, is it the path we want? - After a brief suggestion to Cart, I changed the version to follow Bevy version instead of crevice, do we want that? - Crevice README.md need to be updated - in the `Cargo.toml`, there are a few things to change. How do we want to change them? How do we keep attributions to original Crevice? ``` authors = ["Lucien Greathouse <me@lpghatguy.com>"] documentation = "https://docs.rs/crevice" homepage = "https://github.com/LPGhatguy/crevice" repository = "https://github.com/LPGhatguy/crevice" ``` Co-authored-by: François <8672791+mockersf@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
40 lines
951 B
Rust
40 lines
951 B
Rust
//! This module is internal to crevice but used by its derive macro. No
|
|
//! guarantees are made about its contents.
|
|
|
|
pub use bytemuck;
|
|
|
|
/// Gives the number of bytes needed to make `offset` be aligned to `alignment`.
|
|
pub const fn align_offset(offset: usize, alignment: usize) -> usize {
|
|
if alignment == 0 || offset % alignment == 0 {
|
|
0
|
|
} else {
|
|
alignment - offset % alignment
|
|
}
|
|
}
|
|
|
|
/// Max of two `usize`. Implemented because the `max` method from `Ord` cannot
|
|
/// be used in const fns.
|
|
pub const fn max(a: usize, b: usize) -> usize {
|
|
if a > b {
|
|
a
|
|
} else {
|
|
b
|
|
}
|
|
}
|
|
|
|
/// Max of an array of `usize`. This function's implementation is funky because
|
|
/// we have no for loops!
|
|
pub const fn max_arr<const N: usize>(input: [usize; N]) -> usize {
|
|
let mut max = 0;
|
|
let mut i = 0;
|
|
|
|
while i < N {
|
|
if input[i] > max {
|
|
max = input[i];
|
|
}
|
|
|
|
i += 1;
|
|
}
|
|
|
|
max
|
|
}
|