12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- * crt0-efi-aarch64.S - PE/COFF header for Aarch64 EFI applications
- *
- * Copright (C) 2014 Linaro Ltd.
- * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- */
- #include "lib.h"
- UINT64
- LShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
- )
- // Left shift 64bit by 32bit and get a 64bit result
- {
- return Operand << Count;
- }
- UINT64
- RShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
- )
- // Right shift 64bit by 32bit and get a 64bit result
- {
- return Operand >> Count;
- }
- UINT64
- MultU64x32 (
- IN UINT64 Multiplicand,
- IN UINTN Multiplier
- )
- // Multiple 64bit by 32bit and get a 64bit result
- {
- return Multiplicand * Multiplier;
- }
- UINT64
- DivU64x32 (
- IN UINT64 Dividend,
- IN UINTN Divisor,
- OUT UINTN *Remainder OPTIONAL
- )
- // divide 64bit by 32bit and get a 64bit result
- // N.B. only works for 31bit divisors!!
- {
- if (Remainder)
- *Remainder = Dividend % Divisor;
- return Dividend / Divisor;
- }
|