]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
a9c54a7e1944ba1c46121881f847d1fa6ff025b0
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / DivU64x32Remainder.c
1 /** @file
2 Set error flag for all division functions
3
4 Copyright (c) 2006 - 2007, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 //
16 // Include common header file for this module.
17 //
18 #include "CommonHeader.h"
19
20 UINT64
21 EFIAPI
22 InternalMathDivRemU64x32 (
23 IN UINT64 Dividend,
24 IN UINT32 Divisor,
25 OUT UINT32 *Remainder
26 )
27 {
28 _asm {
29 mov ecx, Divisor
30 mov eax, dword ptr [Dividend + 4]
31 xor edx, edx
32 div ecx
33 push eax
34 mov eax, dword ptr [Dividend + 0]
35 div ecx
36 mov ecx, Remainder
37 jecxz RemainderNull // abandon remainder if Remainder == NULL
38 mov [ecx], edx
39 RemainderNull:
40 pop edx
41 }
42 }
43