]>
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 | |
42eedea9 | 9 | /**\r |
10 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
11 | generates a 64-bit unsigned result.\r | |
12 | \r | |
13 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
14 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
15 | function returns the 64-bit unsigned quotient.\r | |
16 | \r | |
35a17154 | 17 | @param Dividend A 64-bit unsigned value.\r |
42eedea9 | 18 | @param Divisor A 32-bit unsigned value.\r |
19 | \r | |
20 | @return Dividend / Divisor\r | |
21 | \r | |
22 | **/\r | |
e1f414b6 | 23 | UINT64\r |
24 | EFIAPI\r | |
25 | InternalMathDivU64x32 (\r | |
2f88bd3a MK |
26 | IN UINT64 Dividend,\r |
27 | IN UINT32 Divisor\r | |
e1f414b6 | 28 | )\r |
29 | {\r | |
30 | _asm {\r | |
31 | mov eax, dword ptr [Dividend + 4]\r | |
32 | mov ecx, Divisor\r | |
33 | xor edx, edx\r | |
34 | div ecx\r | |
35 | push eax ; save quotient on stack\r | |
36 | mov eax, dword ptr [Dividend]\r | |
37 | div ecx\r | |
38 | pop edx ; restore high-order dword of the quotient\r | |
39 | }\r | |
40 | }\r |