]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/ModU64x32.c
26a19cbd93fa4d5e57fefeb29bcdd257b5c39c98
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / ModU64x32.c
1 /** @file
2 Calculate the remainder of a 64-bit integer by 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 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
14 generates a 32-bit unsigned remainder.
15
16 This function divides the 64-bit unsigned value Dividend by the 32-bit
17 unsigned value Divisor and generates a 32-bit remainder. This function
18 returns the 32-bit unsigned remainder.
19
20 @param Dividend A 64-bit unsigned value.
21 @param Divisor A 32-bit unsigned value.
22
23 @return Dividend % Divisor
24
25 **/
26 UINT32
27 EFIAPI
28 InternalMathModU64x32 (
29 IN UINT64 Dividend,
30 IN UINT32 Divisor
31 )
32 {
33 _asm {
34 mov eax, dword ptr [Dividend + 4]
35 mov ecx, Divisor
36 xor edx, edx
37 div ecx
38 mov eax, dword ptr [Dividend + 0]
39 div ecx
40 mov eax, edx
41 }
42 }