-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skrifa] tthint: use cvar table #839
Conversation
Applies cvar deltas to the cvt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -171,13 +171,40 @@ impl HintInstance { | |||
Definition::default(), | |||
); | |||
self.cvt.clear(); | |||
if let Some(cvar) = outlines.cvar.as_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure it's useful here, but something that I have found helpful for the idea of "I need both of these optional things to exist" is,
if let Some((one, two)) = opt1.zip(opt2) {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, hadn't seen this before. I don't see how I'd use it here but will definitely add it to the toolbox!
if let Ok(var_data) = cvar.variation_data(axis_count) { | ||
for (tuple, scalar) in var_data.active_tuples_at(coords) { | ||
for delta in tuple.deltas() { | ||
let ix = delta.position as usize; | ||
if let Some(value) = self.cvt.get_mut(ix) { | ||
*value += delta.apply_scalar(scalar).to_bits(); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's easy to imagine a little helper method that handles accumulating the deltas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call. I'll add this to the cvar table
helper method in cvar for delta accumulation
Applies cvar deltas to the cvt.