From: John Wolfe Date: Tue, 18 Aug 2020 14:14:11 +0000 (-0700) Subject: Change to common header files not applicable to open-vm-tools. X-Git-Tag: stable-11.2.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e860f4aaaac89aa0043a948ae79ac1b2a8dab6b4;p=thirdparty%2Fopen-vm-tools.git Change to common header files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/vm_basic_asm_arm64.h b/open-vm-tools/lib/include/vm_basic_asm_arm64.h index 369020d13..c28ca3fda 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_arm64.h +++ b/open-vm-tools/lib/include/vm_basic_asm_arm64.h @@ -500,19 +500,16 @@ Mul64x6464(uint64 multiplicand, uint64 multiplier, uint32 shift) { - uint64 resLow, resHi; - - asm("mul %0, %2, %3" "\n\t" - "umulh %1, %2, %3" - : "=&r" (resLow), "=r" (resHi) - : "r" (multiplicand), "r" (multiplier)); - if (shift == 0) { - return resLow; + return multiplicand * multiplier; } else { - return (resLow >> shift) + - (resHi << (64 - shift)) + - ((resLow >> (shift - 1)) & 1); + uint64 lo, hi; + + asm("mul %0, %2, %3" "\n\t" + "umulh %1, %2, %3" + : "=&r" (lo), "=r" (hi) + : "r" (multiplicand), "r" (multiplier)); + return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1); } } @@ -540,19 +537,16 @@ Muls64x64s64(int64 multiplicand, int64 multiplier, uint32 shift) { - uint64 resLow, resHi; - - asm("mul %0, %2, %3" "\n\t" - "smulh %1, %2, %3" - : "=&r" (resLow), "=r" (resHi) - : "r" (multiplicand), "r" (multiplier)); - if (shift == 0) { - return resLow; + return multiplicand * multiplier; } else { - return (resLow >> shift) + - (resHi << (64 - shift)) + - ((resLow >> (shift - 1)) & 1); + uint64 lo, hi; + + asm("mul %0, %2, %3" "\n\t" + "smulh %1, %2, %3" + : "=&r" (lo), "=r" (hi) + : "r" (multiplicand), "r" (multiplier)); + return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1); } } diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h index 5229d6b5a..21ec721ac 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h @@ -399,13 +399,13 @@ Mul64x6464(uint64 multiplicand, * discarded by the shift. * Return the low-order 64 bits of the above. */ - uint64 tmplo, tmphi; - tmplo = _umul128(multiplicand, multiplier, &tmphi); if (shift == 0) { - return tmplo; + return multiplicand * multiplier; } else { - return __shiftright128(tmplo, tmphi, (uint8) shift) + - ((tmplo >> (shift - 1)) & 1); + uint64 lo, hi; + + lo = _umul128(multiplicand, multiplier, &hi); + return __shiftright128(lo, hi, (uint8)shift) + (lo >> (shift - 1) & 1); } } @@ -486,13 +486,13 @@ Muls64x64s64(int64 multiplicand, * Note: using an unsigned shift is correct because shift < 64 and * we return only the low 64 bits of the shifted result. */ - int64 tmplo, tmphi; - tmplo = _mul128(multiplicand, multiplier, &tmphi); if (shift == 0) { - return tmplo; + return multiplicand * multiplier; } else { - return __shiftright128(tmplo, tmphi, (uint8) shift) + - ((tmplo >> (shift - 1)) & 1); + int64 lo, hi; + + lo = _mul128(multiplicand, multiplier, &hi); + return __shiftright128(lo, hi, (uint8)shift) + (lo >> (shift - 1) & 1); } }