diff options
author | Nigel Croxon <nigel.croxon@hpe.com> | 2015-12-23 08:33:02 -0500 |
---|---|---|
committer | Nigel Croxon <nigel.croxon@hpe.com> | 2015-12-23 08:33:02 -0500 |
commit | d119b0d759cc9eabd47352ae6ea69c5d8e40ce66 (patch) | |
tree | 117b831bb997ebe0431d831870688a0e8a024082 /inc | |
parent | 88e3cf95351175bed27a6e714b83b6f2390348f1 (diff) | |
download | gnu-efi-d119b0d759cc9eabd47352ae6ea69c5d8e40ce66.tar.gz |
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2] Replace ARM arithmetic support routines
with EDK2 versions.
Replace the incomplete GPL licensed ARM arithmetic support routines
with the ones from the EDK2 project. These cover long long multiplication
and long long logical shift as well.
Also remove the special case for small dividends in DivU64x32: we can
simply let the compiler handle this, and emit calls to the support
routines where appropriate.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
Diffstat (limited to 'inc')
-rw-r--r-- | inc/arm/efibind.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h index 798212c..cc4b5c5 100644 --- a/inc/arm/efibind.h +++ b/inc/arm/efibind.h @@ -125,13 +125,8 @@ typedef uint32_t UINTN; #define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) #define EFI_FUNCTION -extern UINT64 __DivU64x32(UINT64 Dividend, UINTN Divisor, UINTN *Remainder); - static inline UINT64 DivU64x32(UINT64 Dividend, UINTN Divisor, UINTN *Remainder) { - if (Dividend >> 32) - return __DivU64x32(Dividend, Divisor, Remainder); - /* * GCC turns a division into a multiplication and shift with precalculated * constants if the divisor is constant and the dividend fits into a 32 bit @@ -139,7 +134,7 @@ static inline UINT64 DivU64x32(UINT64 Dividend, UINTN Divisor, UINTN *Remainder) * library functions. */ if (Remainder) - *Remainder = (UINTN)Dividend % Divisor; - Dividend = (UINTN)Dividend / Divisor; + *Remainder = Dividend % Divisor; + Dividend = Dividend / Divisor; return Dividend; } |