Merge pull request #56 from 9hvn9yt2vk-netizen/find-input-underflow
shader: look up an input channel without underflowing
This commit is contained in:
2 files changed
+58
-1
No files matched your search
@@ -1018,8 +1018,10 @@ impl<'a> Lower<'a> {
|
||||
fn find_input(&self, row: u8, channel: u8) -> Option<(usize, u8)> {
|
||||
self.s.inputs.iter().enumerate().find_map(|(id, e)| {
|
||||
let r = e.row?;
|
||||
// `then`, not `then_some`: the channel is only past `col` when
|
||||
// the condition holds.
|
||||
(r == u32::from(row) && channel >= e.col && channel < e.col + e.cols)
|
||||
.then_some((id, channel - e.col))
|
||||
.then(|| (id, channel - e.col))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user