Skip to content

Conversation

@steven-johnson
Copy link
Contributor

This allows us to do a bit more at compile time in some cases; e.g., we can more reliably collapse things like t == halide_type_t(int, 8) into t.as_u32() == literal-integer, avoiding temporaries.

It also makes it tractable to to do a switch on a series of halide_type_t, since we can now use halide_type_t::as_u32() as a constexpr. There were a number of places that did this in an ad-hoc manner previously; I updated those, and also converted at least one more repeated-if clause into a switch. (TBH, I'm not sure if I'm wild about the syntax, though; it is a bit weedy to scan. Suggestions welcome.)

This allows us to do a bit more at compile time in some cases; e.g., we can more reliably collapse things like `t == halide_type_t(int, 8)` into `t.as_u32() == literal-integer`, avoiding temporaries.

It also makes it tractable to to do a `switch` on a series of `halide_type_t`, since we can now use halide_type_t::as_u32() as a constexpr. There were a number of places that did this in an ad-hoc manner previously; I updated those, and also converted at least one more repeated-if clause into a switch. (TBH, I'm not sure if I'm wild about the syntax, though; it is a bit weedy to scan. Suggestions welcome.)
@steven-johnson
Copy link
Contributor Author

Monday review ping

@steven-johnson steven-johnson merged commit d6d7bbc into master Oct 26, 2021
@steven-johnson steven-johnson deleted the srj/constexpr branch October 26, 2021 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants