Skip to content
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

circular shift ops #189

Merged
merged 1 commit into from Nov 16, 2019
Merged

circular shift ops #189

merged 1 commit into from Nov 16, 2019

Conversation

@csboling
Copy link
Collaborator

@csboling csboling commented Nov 16, 2019

What does this PR do?

  • Adds ops for doing circular bit shifts: LROT, RROT, with aliases <<< and >>>. Negative shift amounts are allowed, which shift the opposite direction.
  • Changes LSH and RSH behavior for negative shift amounts: shifting by a negative amount is technically undefined behavior, but in practice this always returned 0. After this change negative amounts are allowed, so LSH X -2 is equivalent to RSH X 2.
  • Also adds a SGN op to get the sign of a value (1, 0, or -1).

Provide links to any related discussion on lines.

https://llllllll.co/t/teletype-3-feature-requests-and-discussion/16219/16
https://llllllll.co/t/bounty-teletype-circular-shift-ops/26956

How should this be manually tested?

LSH 2 -1  # 1
RROT 1 4  # 4096
<<< 1 12  # 4096
EQ LROT 1 100 LROT 1 % 100 16
SGN -100  # 1

Any background context you want to provide?

If the related Github issues aren't referenced in your commits, please link to them here.

I have,

  • updated CHANGELOG.md
  • updated the documentation
  • run make format on each commit
Copy link
Member

@scanner-darkly scanner-darkly left a comment

great additions!

@tehn tehn merged commit ee402bf into monome:master Nov 16, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@csboling csboling deleted the csboling:circular-shift-ops branch Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants