]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/Math.c
Renamed remotely
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Pei / PeiLib / X64 / Math.c
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2005, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 Math.c\r
15\r
16Abstract:\r
17\r
18 64-bit Math worker functions for x64\r
19\r
20--*/\r
21\r
22#include "Efi.h"\r
23#include "Pei.h"\r
24#include "PeiLib.h"\r
25\r
26\r
27UINT64\r
28LShiftU64 (\r
29 IN UINT64 Operand,\r
30 IN UINTN Count\r
31 )\r
32/*++\r
33\r
34Routine Description:\r
35\r
36 This routine allows a 64 bit value to be left shifted by 32 bits and returns the \r
37 shifted value.\r
38 Count is valid up 63. (Only Bits 0-5 is valid for Count)\r
39\r
40Arguments:\r
41\r
42 Operand - Value to be shifted\r
43 \r
44 Count - Number of times to shift left.\r
45 \r
46Returns:\r
47\r
48 Value shifted left identified by the Count.\r
49 \r
50--*/\r
51{\r
52 return Operand << Count;\r
53}\r
54\r
55\r
56UINT64\r
57MultU64x32 (\r
58 IN UINT64 Multiplicand,\r
59 IN UINTN Multiplier\r
60 )\r
61/*++\r
62\r
63Routine Description:\r
64\r
65 This routine allows a 64 bit value to be multiplied with a 32 bit value returns \r
66 64bit result.\r
67 No checking if the result is greater than 64bits\r
68\r
69Arguments:\r
70\r
71 Multiplicand - \r
72 \r
73 Multiplier - \r
74 \r
75Returns:\r
76\r
77 Multiplicand * Multiplier\r
78 \r
79--*/\r
80{\r
81 return Multiplicand * Multiplier;\r
82}\r
83}\r
84\r
85UINT64\r
86DivU64x32 (\r
87 IN UINT64 Dividend,\r
88 IN UINTN Divisor,\r
89 OUT UINTN *Remainder OPTIONAL\r
90 )\r
91/*++\r
92\r
93Routine Description:\r
94\r
95 This routine allows a 64 bit value to be divided with a 32 bit value returns \r
96 64bit result and the Remainder.\r
97\r
98Arguments:\r
99\r
100 Dividend - \r
101 \r
102 Divisor - \r
103 \r
104 Remainder -\r
105 \r
106Returns:\r
107\r
108 Dividend / Divisor\r
109 Remainder = Dividend mod Divisor\r
110 \r
111N.B. only works for 31bit divisors!!\r
112 \r
113--*/\r
114{\r
115 return Dividend/Divisor;\r
116}\r
117\r