X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FRRotU64.c;fp=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FRRotU64.c;h=78ac484afcbf26d531f4691eb3727c0ca3b8c324;hb=23086ba84cbb13350a2464b857b197eef67f1361;hp=0000000000000000000000000000000000000000;hpb=b0537818290619c85993136877afae37492fe5e0;p=mirror_edk2.git diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.c b/MdePkg/Library/BaseLib/Ia32/RRotU64.c new file mode 100644 index 0000000000..78ac484afc --- /dev/null +++ b/MdePkg/Library/BaseLib/Ia32/RRotU64.c @@ -0,0 +1,39 @@ +/** @file + 64-bit right rotation for Ia32 + + Copyright (c) 2006, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#if _MSC_EXTENSIONS + +UINT64 +EFIAPI +InternalMathRRotU64 ( + IN UINT64 Operand, + IN UINTN Count + ) +{ + _asm { + mov cl, byte ptr [Count] + mov eax, dword ptr [Operand + 0] + mov edx, dword ptr [Operand + 4] + shrd ebx, eax, cl + shrd eax, edx, cl + rol ebx, cl + shrd edx, ebx, cl + test cl, 32 // Count >= 32? + cmovnz ecx, eax + cmovnz eax, edx + cmovnz edx, ecx + } +} + +#endif