]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ia32/MultU64x32.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / MultU64x32.c
CommitLineData
e1f414b6 1/** @file\r
2 Calculate the product of a 64-bit integer and a 32-bit integer\r
3\r
bb817c56 4 Copyright (c) 2006 - 2008, 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 Multiples a 64-bit unsigned integer by a 32-bit unsigned integer\r
14 and generates a 64-bit unsigned result.\r
15\r
16 This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r
17 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r
18 bit unsigned result is returned.\r
19\r
20 @param Multiplicand A 64-bit unsigned value.\r
21 @param Multiplier A 32-bit unsigned value.\r
22\r
23 @return Multiplicand * Multiplier\r
24\r
25**/\r
e1f414b6 26UINT64\r
27EFIAPI\r
28InternalMathMultU64x32 (\r
29 IN UINT64 Multiplicand,\r
30 IN UINT32 Multiplier\r
31 )\r
32{\r
33 _asm {\r
34 mov ecx, Multiplier\r
35 mov eax, ecx\r
36 imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable\r
37 mul dword ptr [Multiplicand + 0]\r
38 add edx, ecx\r
39 }\r
40}\r
41\r