-
Notifications
You must be signed in to change notification settings - Fork 65
Logic Toolbox #308
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
Logic Toolbox #308
Conversation
- negative numbers can now be displayed in 2's compliment binary
|
|
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Yaya-Cout
left a comment
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.
LGTM
|
||.text|.rodata|.bss|.data|Total (RAM)|Total (ROM)|%0A|-|-:|-:|-:|-:|-:|-:|%0A|Base|822852 bytes|478609 bytes|226512 bytes|1820 bytes|228332 bytes|1303281 bytes|%0A|Head|835508 bytes|487325 bytes|226504 bytes|1820 bytes|228324 bytes|1324653 bytes|%0A||+12656 bytes|+8716 bytes|-8 bytes|+0 bytes|-8 bytes|+21372 bytes|%0A||+1.5 %25|+1.8 %25|-0.0 %25|+0.0 %25|-0.0 %25|+1.6 %25|%0A |
Binary Logic Toolbox
Numworks is about to release some basic binary functions in Epsilon. I tried them out, and they are honestly pretty useless, with inputs of just 'True' and 'False' and just AND/OR/NOT functions. Here's my take on a toolbox with much more powerful logic functions to be used on both unsigned and signed integers. I have also extended the '...' (Additional Results) display to show the 2's complement binary/hex of negative numbers.
Additional Results
Negative integers can now be displayed in binary/hex. Simply navigate to the ellipsis ('...') on the right of a negative integer result to see a 2's complement representation of the number:
Functions Implemented
Basic Logic Operations
AND
OR
XOR - Exclusive OR
NOT
Bit Shifts
Shift Logical Left
Shift Logical Right
Arithmetic Shift Right
Rotate Left
Rotate Right
Setting And Clearing Bits
Get Bit
Set Bit
Clear Bit
Flip Bit
Clear 'a' With 'b'
Logic Operations (With Explicit Number of Bits)
Some logic operations (like NOT) end up generating large 32-bit numbers as the default precision is 32 bits. This adds frustration when 32 bits of precision is undesired. So some of the functions have overridden methods that have an extra argument that allows the user to control the number of output bits.
2'S Compliment Conversions/Helpers
2's Compliment Equivalent
Ceiling Log2
Other Information