xref: /DragonStub/lib/arm/math.c (revision 333bf05da904010c4df3fbc002f6b829c67bd545)
1 /*
2  * Copright (C) 2014 Linaro Ltd.
3  * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
12  *
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.
16  */
17 
18 #include "lib.h"
19 
20 UINT64
21 LShiftU64 (
22     IN UINT64   Operand,
23     IN UINTN    Count
24     )
25 // Left shift 64bit by 32bit and get a 64bit result
26 {
27     return Operand << Count;
28 }
29 
30 UINT64
31 RShiftU64 (
32     IN UINT64   Operand,
33     IN UINTN    Count
34     )
35 // Right shift 64bit by 32bit and get a 64bit result
36 {
37     return Operand >> Count;
38 }
39 
40 
41 UINT64
42 MultU64x32 (
43     IN UINT64   Multiplicand,
44     IN UINTN    Multiplier
45     )
46 // Multiple 64bit by 32bit and get a 64bit result
47 {
48     return Multiplicand * Multiplier;
49 }
50