diff options
author | Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> | 2017-01-10 00:10:09 -0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-01-31 10:10:14 +1100 |
commit | f539fbe33753fb1549e28c56225d0ab7a8cb0669 (patch) | |
tree | 2944e5725ea7a9f77c4c5811961ecb1d2f610a4c /target | |
parent | 6758c192b063515b5c7bd2b0086217825c5b6d00 (diff) |
host-utils: Implement unsigned quadword left/right shift and unit tests
Implements 128-bit left shift and right shift as well as their
testcases. By design, shift silently mods by 128, so the caller is
responsible to assert the shift range if necessary.
Left shift sets the overflow flag if any non-zero digit is shifted out.
Examples:
ulshift(&low, &high, 250, &overflow);
equivalent: n << 122
urshift(&low, &high, -2);
equivalent: n << 126
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[dwg: Added test-shift128 to .gitignore]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target')
0 files changed, 0 insertions, 0 deletions