]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/DivS64x64Remainder.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / DivS64x64Remainder.c
1 /** @file
2 Math worker functions.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "BaseLibInternals.h"
10
11 /**
12 Divides a 64-bit signed integer by a 64-bit signed integer and generates a
13 64-bit signed result and a optional 64-bit signed remainder.
14
15 This function divides the 64-bit signed value Dividend by the 64-bit signed
16 value Divisor and generates a 64-bit signed quotient. If Remainder is not
17 NULL, then the 64-bit signed remainder is returned in Remainder. This
18 function returns the 64-bit signed quotient.
19
20 It is the caller's responsibility to not call this function with a Divisor of 0.
21 If Divisor is 0, then the quotient and remainder should be assumed to be
22 the largest negative integer.
23
24 If Divisor is 0, then ASSERT().
25
26 @param Dividend A 64-bit signed value.
27 @param Divisor A 64-bit signed value.
28 @param Remainder A pointer to a 64-bit signed value. This parameter is
29 optional and may be NULL.
30
31 @return Dividend / Divisor
32
33 **/
34 INT64
35 EFIAPI
36 DivS64x64Remainder (
37 IN INT64 Dividend,
38 IN INT64 Divisor,
39 OUT INT64 *Remainder OPTIONAL
40 )
41 {
42 ASSERT (Divisor != 0);
43 return InternalMathDivRemS64x64 (Dividend, Divisor, Remainder);
44 }