]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | Calculate the quotient of a 64-bit integer by a 32-bit integer\r | |
3 | \r | |
35a17154 | 4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e1f414b6 | 6 | \r |
7 | **/\r | |
8 | \r | |
1efcc4ae | 9 | \r |
f734a10a | 10 | \r |
e1f414b6 | 11 | \r |
42eedea9 | 12 | /**\r |
13 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
14 | generates a 64-bit unsigned result.\r | |
15 | \r | |
16 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
17 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
18 | function returns the 64-bit unsigned quotient.\r | |
19 | \r | |
35a17154 | 20 | @param Dividend A 64-bit unsigned value.\r |
42eedea9 | 21 | @param Divisor A 32-bit unsigned value.\r |
22 | \r | |
23 | @return Dividend / Divisor\r | |
24 | \r | |
25 | **/\r | |
e1f414b6 | 26 | UINT64\r |
27 | EFIAPI\r | |
28 | InternalMathDivU64x32 (\r | |
29 | IN UINT64 Dividend,\r | |
30 | IN UINT32 Divisor\r | |
31 | )\r | |
32 | {\r | |
33 | _asm {\r | |
34 | mov eax, dword ptr [Dividend + 4]\r | |
35 | mov ecx, Divisor\r | |
36 | xor edx, edx\r | |
37 | div ecx\r | |
38 | push eax ; save quotient on stack\r | |
39 | mov eax, dword ptr [Dividend]\r | |
40 | div ecx\r | |
41 | pop edx ; restore high-order dword of the quotient\r | |
42 | }\r | |
43 | }\r | |
44 | \r |