]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/MultU64x32.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / MultU64x32.c
1 /** @file
2 Calculate the product of a 64-bit integer and a 32-bit integer
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9
10
11
12 /**
13 Multiples a 64-bit unsigned integer by a 32-bit unsigned integer
14 and generates a 64-bit unsigned result.
15
16 This function multiples the 64-bit unsigned value Multiplicand by the 32-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 32-bit unsigned value.
22
23 @return Multiplicand * Multiplier
24
25 **/
26 UINT64
27 EFIAPI
28 InternalMathMultU64x32 (
29 IN UINT64 Multiplicand,
30 IN UINT32 Multiplier
31 )
32 {
33 _asm {
34 mov ecx, Multiplier
35 mov eax, ecx
36 imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable
37 mul dword ptr [Multiplicand + 0]
38 add edx, ecx
39 }
40 }
41