[ create a new paste ] login | about

Link: http://codepad.org/gRW8BTyI    [ raw code | fork ]

Evetro - C, pasted on Jul 9:
/// halves-optimized, 32-bit using bswap + rotation
unsigned rbH5 (unsigned arg)
{
  __asm
  {
    mov edx, arg

    mov eax, edx  // roling edx
    rol edx, 2
    and eax, 0AAAAAAAAH
    and edx,  55555555H
    or eax, edx

    mov edx, eax  // roling eax
    rol eax, 4
    and edx,  99999999H
    and eax,  66666666H
    or edx, eax

    mov eax, edx  // roling edx
    rol edx, 8
    and eax,  87878787H
    and edx,  78787878H
    or eax, edx
    ror eax, 7    // rotate back by 1+2+4 bits

    bswap eax
  }
  // return eax
}


Create a new paste based on this one


Comments: