https://codereview.appspot.com/253410043/diff/1/lily/parser.yy File lily/parser.yy (right): https://codereview.appspot.com/253410043/diff/1/lily/parser.yy#newcode4061 lily/parser.yy:4061: while (step < 1) On 2015/07/24 11:56:40, Dan Eble ...
9 years, 10 months ago
(2015-07-24 12:27:35 UTC)
#2
https://codereview.appspot.com/253410043/diff/1/lily/parser.yy
File lily/parser.yy (right):
https://codereview.appspot.com/253410043/diff/1/lily/parser.yy#newcode4061
lily/parser.yy:4061: while (step < 1)
On 2015/07/24 11:56:40, Dan Eble wrote:
> Can't this be done in O(1) with some formula containing a modulo? (Yes, I see
> it was this way before, but since you're working so close by...)
ANSI C does not specify modulo behavior for negative numbers. C++ does, but
it's not really "modulo" behavior but "remainder". As a result, you need to
treat negative numbers specially anyway, and you need to concoct weird formulas
for doing so. As division is a potentially expensive operation anyway and input
cannot easily be negative either considering where it is coming from, it seems
pointless to add this further obfuscation for the sake of an efficiency that
more likely than not is a lie.
https://codereview.appspot.com/253410043/diff/1/lily/parser.yy#newcode4064
lily/parser.yy:4064: if (step % 7 == 0)
On 2015/07/24 11:56:40, Dan Eble wrote:
> "I say not unto thee, Until seven times: but, Until seventy times seven." :-)
I was considering ((step - 1) % 7 == 6) for clarity but then decided "what the
heck". Maybe I should really write it that way. It does seem more obvious.
Issue 253410043: Issue 4433: chord step 14 should be flat by default
(Closed)
Created 9 years, 10 months ago by dak
Modified 9 years, 8 months ago
Reviewers: Dan Eble
Base URL:
Comments: 4