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

Added file for left and right shift rotation #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AnshumanAryan24
Copy link

Added the following:
Bit-Manipulation: Rotate right and rotate left.
Note: Only applicable for positive integers

  1. rotate_right(num, times): rotate num(passed as decimal) "times" times towards right and return
    eg.: rotate_right(12, 1) --> 6
  2. rotate_left(num, times): rotate num(passed as decimal) "times" times towards left and return
    eg.: rotate_left(12, 2) --> 3
    Additional functions:
  3. unsigned dec_to_bin(num): return decimal form of binary format number
    eg.: dec_to_bin(12) --> 1100
  4. unsigned bin_to_dec(bin): return binary form of decimal format number
    eg.: bin_to_dec(1100) --> 12

Added the following:
Bit-Manipulation: Rotate right and rotate left.
Note: Only applicable for positive integers
1. rotate_right(num, times): rotate num(passed as decimal) "times" times towards right and return
eg.: rotate_right(12, 1) --> 6
2. rotate_left(num, times): rotate num(passed as decimal) "times" times towards left and return
eg.: rotate_left(12, 2) --> 3
Additional functions: 
3. unsigned dec_to_bin(num): return decimal form of binary format number
eg.: dec_to_bin(12) --> 1100
4. unsigned bin_to_dec(bin): return binary form of decimal format number
eg.: bin_to_dec(1100) --> 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant