]> Git Repo - qemu.git/commit
host-utils: Implement unsigned quadword left/right shift and unit tests
authorJose Ricardo Ziviani <[email protected]>
Tue, 10 Jan 2017 02:10:09 +0000 (00:10 -0200)
committerDavid Gibson <[email protected]>
Mon, 30 Jan 2017 23:10:14 +0000 (10:10 +1100)
commitf539fbe33753fb1549e28c56225d0ab7a8cb0669
tree2944e5725ea7a9f77c4c5811961ecb1d2f610a4c
parent6758c192b063515b5c7bd2b0086217825c5b6d00
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 <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[dwg: Added test-shift128 to .gitignore]
Signed-off-by: David Gibson <[email protected]>
include/qemu/host-utils.h
tests/.gitignore
tests/Makefile.include
tests/test-shift128.c [new file with mode: 0644]
util/host-utils.c
This page took 0.026399 seconds and 4 git commands to generate.