aboutsummaryrefslogtreecommitdiff
path: root/src/f64/float.rs
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-08 01:20:14 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-08 01:20:14 +0000
commit274c25b2b4272e0085686e6932cfb71f2aef2011 (patch)
treef180a22cde2ef26fbc2b1c0d81d69f4bae8b34ac /src/f64/float.rs
parenta80b03b75d5249131c6fb554d6852044a58d4e91 (diff)
parent18bdbf00dc7d41bf4549b0542ced9c11d813e9b9 (diff)
downloadglam-274c25b2b4272e0085686e6932cfb71f2aef2011.tar.gz
Snap for 11421525 from 18bdbf00dc7d41bf4549b0542ced9c11d813e9b9 to simpleperf-releasesimpleperf-release
Change-Id: I5683e0ee4352eb4c9aa41785575aa10d0e271a10
Diffstat (limited to 'src/f64/float.rs')
-rw-r--r--src/f64/float.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/f64/float.rs b/src/f64/float.rs
new file mode 100644
index 0000000..219c8b0
--- /dev/null
+++ b/src/f64/float.rs
@@ -0,0 +1,21 @@
+// Generated from float.rs.tera template. Edit the template, not the generated file.
+
+use crate::float::FloatExt;
+
+impl FloatExt for f64 {
+ #[inline]
+ fn lerp(self, rhs: f64, t: f64) -> f64 {
+ self + (rhs - self) * t
+ }
+
+ #[inline]
+ fn inverse_lerp(a: f64, b: f64, v: f64) -> f64 {
+ (v - a) / (b - a)
+ }
+
+ #[inline]
+ fn remap(self, in_start: f64, in_end: f64, out_start: f64, out_end: f64) -> f64 {
+ let t = f64::inverse_lerp(in_start, in_end, self);
+ f64::lerp(out_start, out_end, t)
+ }
+}