]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / Ia32 / MathLShiftS64.c
CommitLineData
97f98500
HT
1/** @file\r
2 64-bit Math Worker Function.\r
3 The 32-bit versions of C compiler generate calls to library routines\r
4 to handle 64-bit math. These functions use non-standard calling conventions.\r
5\r
2ac68e8b 6Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
2009f6b4 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
97f98500
HT
8\r
9**/\r
10\r
97f98500
HT
11/*\r
12 * Shifts a 64-bit signed value left by a particular number of bits.\r
13 */\r
7c342378
MK
14__declspec(naked) void __cdecl\r
15_allshl (\r
16 void\r
17 )\r
97f98500
HT
18{\r
19 _asm {\r
20 ;\r
21 ; Handle shifting of 64 or more bits (return 0)\r
22 ;\r
7c342378 23\r
97f98500
HT
24 cmp cl, 64\r
25 jae short ReturnZero\r
26\r
27 ;\r
28 ; Handle shifting of between 0 and 31 bits\r
29 ;\r
2ac68e8b 30 cmp cl, 32\r
97f98500
HT
31 jae short More32\r
32 shld edx, eax, cl\r
33 shl eax, cl\r
34 ret\r
35\r
36 ;\r
37 ; Handle shifting of between 32 and 63 bits\r
38 ;\r
39More32:\r
40 mov edx, eax\r
41 xor eax, eax\r
42 and cl, 31\r
43 shl edx, cl\r
44 ret\r
45\r
46ReturnZero:\r
47 xor eax,eax\r
48 xor edx,edx\r
49 ret\r
50 }\r
51}\r