Revision 82e14b02 target-arm/helper-a64.c

b/target-arm/helper-a64.c
49 49
{
50 50
    return clz64(x);
51 51
}
52

  
53
uint64_t HELPER(rbit64)(uint64_t x)
54
{
55
    /* assign the correct byte position */
56
    x = bswap64(x);
57

  
58
    /* assign the correct nibble position */
59
    x = ((x & 0xf0f0f0f0f0f0f0f0ULL) >> 4)
60
        | ((x & 0x0f0f0f0f0f0f0f0fULL) << 4);
61

  
62
    /* assign the correct bit position */
63
    x = ((x & 0x8888888888888888ULL) >> 3)
64
        | ((x & 0x4444444444444444ULL) >> 1)
65
        | ((x & 0x2222222222222222ULL) << 1)
66
        | ((x & 0x1111111111111111ULL) << 3);
67

  
68
    return x;
69
}

Also available in: Unified diff