From 96c9c60f806906c85b52183d60c2f78a743cb925 Mon Sep 17 00:00:00 2001 From: targrub Date: Sat, 5 Nov 2022 14:12:04 +0000 Subject: [PATCH] Use `cbrt()` instead of `powf(1./3.)` (#6481) # Objective - Use cube root library function instead of handrolling. ## Solution - Instead of `powf(1./3.)` use `cbrt()`. --- crates/bevy_ui/src/render/mod.rs | 2 +- examples/ecs/iter_combinations.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index f7484fe76fc16..988364a0a8189 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -349,7 +349,7 @@ pub fn extract_text_uinodes( .get(&text_glyph.atlas_info.texture_atlas) .unwrap(); let texture = atlas.texture.clone_weak(); - let index = text_glyph.atlas_info.glyph_index as usize; + let index = text_glyph.atlas_info.glyph_index; let rect = atlas.textures[index]; let atlas_size = Some(atlas.size); diff --git a/examples/ecs/iter_combinations.rs b/examples/ecs/iter_combinations.rs index cfb0812b1282f..fa0ab75419866 100644 --- a/examples/ecs/iter_combinations.rs +++ b/examples/ecs/iter_combinations.rs @@ -73,7 +73,7 @@ fn generate_bodies( rng.gen_range(-1.0..1.0), ) .normalize() - * rng.gen_range(0.2f32..1.0).powf(1. / 3.) + * rng.gen_range(0.2f32..1.0).cbrt() * 15.; commands.spawn(BodyBundle {