]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/MultU64x64.c
806cbd565acdad4e3101a15b4a6531d59b1c189b
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / MultU64x64.c
1 /** @file
2 Calculate the product of a 64-bit integer and another 64-bit integer
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9
10
11
12 /**
13 Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
14 and generates a 64-bit unsigned result.
15
16 This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit
17 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
18 bit unsigned result is returned.
19
20 @param Multiplicand A 64-bit unsigned value.
21 @param Multiplier A 64-bit unsigned value.
22
23 @return Multiplicand * Multiplier
24
25 **/
26 UINT64
27 EFIAPI
28 InternalMathMultU64x64 (
29 IN UINT64 Multiplicand,
30 IN UINT64 Multiplier
31 )
32 {
33 _asm {
34 mov ebx, dword ptr [Multiplicand + 0]
35 mov edx, dword ptr [Multiplier + 0]
36 mov ecx, ebx
37 mov eax, edx
38 imul ebx, dword ptr [Multiplier + 4]
39 imul edx, dword ptr [Multiplicand + 4]
40 add ebx, edx
41 mul ecx
42 add edx, ebx
43 }
44 }
45