]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/CRT/Ia32/llshl.c
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / LibC / CRT / Ia32 / llshl.c
CommitLineData
2aa62f2b 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
6 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License which accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT 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
33 cmp cl, 32\r
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