mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 23:24:56 +00:00
HV:treewide:Update return type for function fls64 and clz64
Change the return type of function fls64 and clz64 as uint16_t;
When the input is zero, INVALID_ID_INDEX is returned;
Update temporary variable type and return value check of caller
when it call fls64 or clz64;
When input value is zero, clz64 returns 64 directly.
V1-->V2:
INVALID_BIT_INDEX instead of INVALID_NUMBER;
Partly revert apicv_pending_intr udpates;
Add type conversion as needed;
Coding style fixing.
V2-->V3:
Correct type conversion;
fls64 return INVALID_BIT_INDEX directly when
the input value is zero.
V3-->V4:
No updates for this part in PATCH V4.
Note: For instruction "bsrq", destination register value
is undefined when source register value is zero.
Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -94,7 +94,7 @@ int udiv64(uint64_t dividend, uint64_t divisor, struct udiv_result *res)
|
||||
*/
|
||||
|
||||
/* align divisor and dividend. */
|
||||
bits = clz64(divisor) - clz64(dividend);
|
||||
bits = (uint64_t)(clz64(divisor) - clz64(dividend));
|
||||
divisor <<= bits;
|
||||
mask = 1UL << bits;
|
||||
/* division loop */
|
||||
|
||||
Reference in New Issue
Block a user