SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .text
  2.     .global bitrev
  3.     .type   bitrev, @function
  4. bitrev:
  5.     mov %rdi,%rax //num = rax = rdi
  6.     xor %rbx,%rbx
  7.     neg %rbx     //mask = rbx
  8.     mov $0x40,%rsi //s = rsi
  9. while:
  10.     mov %rbx,%rcx //mask = rbx = rcx
  11.     sal %rsi,%rbx
  12.     xor %rcx,%rbx // mask ^ (mask << s)
  13.     mov %rbx,%rcx // mask = rbx
  14.     neg %rcx      // ~mask = rcx
  15.     sar %rsi,%rdi // num >> s
  16.     and %rcx,%rdi //mask & (num >> s)
  17.     sal %rsi,%rax
  18.     and %rcx,%rax
  19.     or %rdi,%rax
  20.     mov %rax,%rdi
  21.     sar %rsi     // s = s/2
  22.     jge while
  23.     ret
  24.  
  25.     .size   bitrev, .-bitrev
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top