]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / Ia32 / MathRShiftU64.c
1 /** @file
2 64-bit Math Worker Function.
3 The 32-bit versions of C compiler generate calls to library routines
4 to handle 64-bit math. These functions use non-standard calling conventions.
5
6 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 /*
12 * Shifts a 64-bit unsigned value right by a certain number of bits.
13 */
14 __declspec(naked) void __cdecl
15 _aullshr (
16 void
17 )
18 {
19 _asm {
20 ;
21 ; Checking: Only handle 64bit shifting or more
22 ;
23 cmp cl, 64
24 jae _Exit
25
26 ;
27 ; Handle shifting between 0 and 31 bits
28 ;
29 cmp cl, 32
30 jae More32
31 shrd eax, edx, cl
32 shr edx, cl
33 ret
34
35 ;
36 ; Handle shifting of 32-63 bits
37 ;
38 More32:
39 mov eax, edx
40 xor edx, edx
41 and cl, 31
42 shr eax, cl
43 ret
44
45 ;
46 ; Invalid number (less then 32bits), return 0
47 ;
48
49 _Exit:
50 xor eax, eax
51 xor edx, edx
52 ret
53 }
54 }