]>
git.proxmox.com Git - efi-boot-shim.git/blob - gnu-efi/lib/aarch64/math.c
2 * Copright (C) 2014 Linaro Ltd.
3 * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice and this list of conditions, without modification.
10 * 2. The name of the author may not be used to endorse or promote products
11 * derived from this software without specific prior written permission.
13 * Alternatively, this software may be distributed under the terms of the
14 * GNU General Public License as published by the Free Software Foundation;
15 * either version 2 of the License, or (at your option) any later version.
25 // Left shift 64bit by 32bit and get a 64bit result
27 return Operand
<< Count
;
35 // Right shift 64bit by 32bit and get a 64bit result
37 return Operand
>> Count
;
43 IN UINT64 Multiplicand
,
46 // Multiple 64bit by 32bit and get a 64bit result
48 return Multiplicand
* Multiplier
;
55 OUT UINTN
*Remainder OPTIONAL
57 // divide 64bit by 32bit and get a 64bit result
58 // N.B. only works for 31bit divisors!!
61 *Remainder
= Dividend
% Divisor
;
62 return Dividend
/ Divisor
;