]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/LShiftU64.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / LShiftU64.c
CommitLineData
3eb9473e 1/*++\r
2\r
4ea9375a
HT
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 LShiftU64.c\r
15\r
16Abstract:\r
17\r
18 64-bit left shift function for IA-32\r
19\r
20--*/\r
21\r
22#include "Tiano.h"\r
23\r
24UINT64\r
25LShiftU64 (\r
26 IN UINT64 Operand,\r
27 IN UINTN Count\r
28 )\r
29/*++\r
30\r
31Routine Description:\r
32 \r
33 This routine allows a 64 bit value to be left shifted by 32 bits and \r
34 returns the shifted value.\r
35 Count is valid up 63. (Only Bits 0-5 is valid for Count)\r
36\r
37Arguments:\r
38\r
39 Operand - Value to be shifted\r
40 Count - Number of times to shift left.\r
41 \r
42Returns:\r
43\r
44 Value shifted left identified by the Count.\r
45\r
46--*/\r
47{\r
48 __asm {\r
49 \r
50 mov eax, dword ptr Operand[0]\r
51 mov edx, dword ptr Operand[4]\r
52 \r
53 ;\r
54 ; CL is valid from 0 - 31. shld will move EDX:EAX by CL times but EAX is not touched\r
55 ; For CL of 32 - 63, it will be shifted 0 - 31 so we will move eax to edx later. \r
56 ;\r
57 mov ecx, Count\r
58 and ecx, 63\r
59 shld edx, eax, cl\r
60 shl eax, cl\r
61 \r
62 ;\r
63 ; Since Count is 32 - 63, eax will have been shifted by 0 - 31 \r
64 ; If shifted by 32 or more, set lower 32 bits to zero.\r
65 ;\r
66 cmp ecx, 32\r
67 jc short _LShiftU64_Done\r
68 \r
69 mov edx, eax\r
70 xor eax, eax\r
71\r
72_LShiftU64_Done:\r
73 }\r
74}\r