Skip to content

Commit

Permalink
Fix off-by-one error
Browse files Browse the repository at this point in the history
In practice it would not have caused problems since the 255 case is
handled separately, but we may as well fix it.
  • Loading branch information
YgorSouza committed Oct 2, 2024
1 parent be724ca commit 3e5f9df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/ecolor/src/color32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Color32 {
static LOOKUP_TABLE: OnceLock<Box<[u8]>> = OnceLock::new();
let lut = LOOKUP_TABLE.get_or_init(|| {
use crate::{gamma_u8_from_linear_f32, linear_f32_from_gamma_u8};
(0..u16::MAX)
(0..=u16::MAX)
.map(|i| {
let [value, alpha] = i.to_ne_bytes();
let value_lin = linear_f32_from_gamma_u8(value);
Expand Down

0 comments on commit 3e5f9df

Please sign in to comment.