authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-09-18 10:16:57 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-09-18 10:16:57 -07:00
logc586d8ba0ca57a50ef2ed5f951b2b4ee9c5361c5
tree499a5cac2cb4ff624b24491312c7b41310b717af
parent68eede0ded013ac7d03dcba3554f30526aba86c9

floating point absolute value is available in @fabs


2 files changed, 1 insertions(+), 5 deletions(-)

sRGB.zig+1-2
......@@ -3,7 +3,6 @@
33const std = @import("std");
44const Self = @This();
55const color = @import("./mod.zig");
6const _x = @import("./x.zig");
76
87r: u8, // red value
98g: u8, // green value
......@@ -123,7 +122,7 @@ pub fn to_hsl(x: Self) color.HSL {
123122 unreachable;
124123 };
125124 const l = (cmax + cmin) / 2;
126 const s = if (delta == 0) 0 else delta / (1 - _x.abs(2 * l - 1));
125 const s = if (delta == 0) 0 else delta / (1 - @fabs(2 * l - 1));
127126 const a = f.a;
128127 return color.HSL.initHSLA(h, s, l, a);
129128}
x.zig deleted-3
......@@ -1,3 +0,0 @@
1pub fn abs(x: f32) f32 {
2 return if (x < 0.0) -x else x;
3}