]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | 64-bit left shift function for IA-32.\r | |
3 | \r | |
88a75d26 | 4 | Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e1f414b6 | 6 | \r |
7 | **/\r | |
8 | \r | |
42eedea9 | 9 | /**\r |
10 | Shifts a 64-bit integer left between 0 and 63 bits. The low bits\r | |
11 | are filled with zeros. The shifted value is returned.\r | |
12 | \r | |
13 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
14 | low Count bits are set to zero. The shifted value is returned.\r | |
15 | \r | |
16 | @param Operand The 64-bit operand to shift left.\r | |
17 | @param Count The number of bits to shift left.\r | |
18 | \r | |
19 | @return Operand << Count\r | |
20 | \r | |
21 | **/\r | |
e1f414b6 | 22 | UINT64\r |
23 | EFIAPI\r | |
24 | InternalMathLShiftU64 (\r | |
2f88bd3a MK |
25 | IN UINT64 Operand,\r |
26 | IN UINTN Count\r | |
e1f414b6 | 27 | )\r |
28 | {\r | |
29 | _asm {\r | |
30 | mov cl, byte ptr [Count]\r | |
31 | xor eax, eax\r | |
32 | mov edx, dword ptr [Operand + 0]\r | |
33 | test cl, 32 // Count >= 32?\r | |
88a75d26 MK |
34 | jnz L0\r |
35 | mov eax, edx\r | |
36 | mov edx, dword ptr [Operand + 4]\r | |
37 | L0:\r | |
e1f414b6 | 38 | shld edx, eax, cl\r |
39 | shl eax, cl\r | |
40 | }\r | |
41 | }\r |