]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
CryptoPkg Updates to support RFC3161 timestamp signature verification.
[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
97f98500
HT
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17\r
18/*\r
19 * Shifts a 64-bit signed value left by a particular number of bits.\r
20 */\r
21__declspec(naked) void __cdecl _allshl (void)\r
22{\r
23 _asm {\r
24 ;\r
25 ; Handle shifting of 64 or more bits (return 0)\r
26 ;\r
27 cmp cl, 64\r
28 jae short ReturnZero\r
29\r
30 ;\r
31 ; Handle shifting of between 0 and 31 bits\r
32 ;\r
2ac68e8b 33 cmp cl, 32\r
97f98500
HT
34 jae short More32\r
35 shld edx, eax, cl\r
36 shl eax, cl\r
37 ret\r
38\r
39 ;\r
40 ; Handle shifting of between 32 and 63 bits\r
41 ;\r
42More32:\r
43 mov edx, eax\r
44 xor eax, eax\r
45 and cl, 31\r
46 shl edx, cl\r
47 ret\r
48\r
49ReturnZero:\r
50 xor eax,eax\r
51 xor edx,edx\r
52 ret\r
53 }\r
54}\r