Skip to content

Instantly share code, notes, and snippets.

@tamaskenez
Created November 29, 2022 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamaskenez/f63c3054e4c7593c525397dc42fae657 to your computer and use it in GitHub Desktop.
Save tamaskenez/f63c3054e4c7593c525397dc42fae657 to your computer and use it in GitHub Desktop.
Same complicated conditions with holds_alternative and macro
void std() {
skip = std::holds_alternative<XferMode::Target>(lumaMatchMode) &&
inColorspace == ColorspaceMode::RGB;
skip = skip || (!std::holds_alternative<XferMode::Target>(self.colorMatchMode) &&
std::holds_alternative<XferMode::Reference>(self.lumaMatchMode));
skip = skip || (std::holds_alternative<XferMode::Target>(self.contrastMatchMode) &&
std::holds_alternative<XferMode::Target>(self.lumaMatchMode) &&
!std::holds_alternative<XferMode::Reference>(self.colorMatchMode));
skip = skip || (std::holds_alternative<XferMode::Target>(self.colorMatchMode) &&
std::holds_alternative<XferMode::Reference>(self.lumaMatchMode));
}
void macro() {
skip = lumaMatchMode IS_(XferMode::Target) && inColorspace == ColorspaceMode::RGB;
skip = skip || self.colorMatchMode IS_NOT(XferMode::Target) &&
self.lumaMatchMode IS_(XferMode::Reference);
skip = skip || (self.contrastMatchMode IS_(XferMode::Target) &&
self.lumaMatchMode IS_(XferMode::Target) &&
self.colorMatchMode IS_NOT_(XferMode::Reference));
skip = skip || (self.colorMatchMode IS_(XferMode::Target) &&
self.lumaMatchMode IS_(XferMode::Reference));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment