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: NJose Ricardo Ziviani <joserz@linux.vnet.ibm.com> Reviewed-by: NEric Blake <eblake@redhat.com> [dwg: Added test-shift128 to .gitignore] Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
Showing
tests/test-shift128.c
0 → 100644
想要评论请 注册 或 登录