Skip to content

Commit

Permalink
perf(interval_size_extension): cache abs() value
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 committed May 7, 2023
1 parent 70a6999 commit 838c7ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/interval/interval_size_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ extension IntervalSizeExtension on int {
/// ```
bool get isPerfect {
assert(this != 0, 'Size must be non-zero');
final sizeAbs = abs();

return (abs() + abs() ~/ 8) % 4 < 2;
return (sizeAbs + sizeAbs ~/ 8) % 4 < 2;
}

/// Returns whether this [Interval.size] is greater than an octave.
Expand Down

0 comments on commit 838c7ab

Please sign in to comment.