]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
CryptoPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / 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) 2014, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11
12 /*
13 * Shifts a 64-bit signed value left by a particular number of bits.
14 */
15 __declspec(naked) void __cdecl _allshl (void)
16 {
17 _asm {
18 ;
19 ; Handle shifting of 64 or more bits (return 0)
20 ;
21 cmp cl, 64
22 jae short ReturnZero
23
24 ;
25 ; Handle shifting of between 0 and 31 bits
26 ;
27 cmp cl, 32
28 jae short More32
29 shld edx, eax, cl
30 shl eax, cl
31 ret
32
33 ;
34 ; Handle shifting of between 32 and 63 bits
35 ;
36 More32:
37 mov edx, eax
38 xor eax, eax
39 and cl, 31
40 shl edx, cl
41 ret
42
43 ReturnZero:
44 xor eax,eax
45 xor edx,edx
46 ret
47 }
48 }