]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / ARShiftU64.c
CommitLineData
e1f414b6 1/** @file\r
2 64-bit arithmetic 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. The high bits\r
11 are filled with original integer's bit 63. 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 bit 63 of Operand. 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
35a17154 19 @return Operand arithmetically shifted right by Count.\r
42eedea9 20\r
21**/\r
e1f414b6 22UINT64\r
23EFIAPI\r
24InternalMathARShiftU64 (\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 mov eax, dword ptr [Operand + 4]\r
32 cdq\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
37L0:\r
e1f414b6 38 shrd eax, edx, cl\r
39 sar edx, cl\r
40 }\r
41}\r