Skip to content
Snippets Groups Projects
Commit 6d7f0a76 authored by Aaron Councilman's avatar Aaron Councilman
Browse files

Normalize min of zero

parent 73bcb539
No related branches found
No related tags found
2 merge requests!139Edge detection,!137Dynamic Constant Normalization
Pipeline #201279 passed
......@@ -95,15 +95,16 @@ pub trait DynamicConstantView {
}
if let Some(const_val) = constant_val {
fields.insert(self.add_dynconst(DynamicConstant::Constant(const_val)));
// Since dynamic constants are non-negative, ignore the constant if it is 0
if const_val != 0 {
fields.insert(self.add_dynconst(DynamicConstant::Constant(const_val)));
}
}
assert!(
fields.len() > 0,
"Min of 0 dynamic constant expressions is undefined"
);
if fields.len() <= 1 {
if fields.len() == 0 {
// The minimum of 0 dynamic constants is 0 since dynamic constants are non-negative
self.add_dynconst(DynamicConstant::Constant(0))
} else if fields.len() <= 1 {
*fields.first().unwrap()
} else {
self.add_dynconst(DynamicConstant::Min(fields.into_iter().collect()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment