]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | 64-bit logical right 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 right between 0 and 63 bits. This high 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 right by Count bits. The\r | |
14 | high Count bits are set to zero. The shifted value is returned.\r | |
15 | \r | |
16 | @param Operand The 64-bit operand to shift right.\r | |
17 | @param Count The number of bits to shift right.\r | |
18 | \r | |
19 | @return Operand >> Count\r | |
20 | \r | |
21 | **/\r | |
e1f414b6 | 22 | UINT64\r |
23 | EFIAPI\r | |
24 | InternalMathRShiftU64 (\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 edx, edx\r | |
32 | mov eax, dword ptr [Operand + 4]\r | |
33 | test cl, 32\r | |
88a75d26 MK |
34 | jnz L0\r |
35 | mov edx, eax\r | |
36 | mov eax, dword ptr [Operand + 0]\r | |
37 | L0:\r | |
e1f414b6 | 38 | shrd eax, edx, cl\r |
39 | shr edx, cl\r | |
40 | }\r | |
41 | }\r |