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