]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/RRotU64.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / RRotU64.nasm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Module Name:
7 ;
8 ; RRotU64.nasm
9 ;
10 ; Abstract:
11 ;
12 ; 64-bit right rotation for Ia32
13 ;
14 ;------------------------------------------------------------------------------
15
16 SECTION .text
17
18 ;------------------------------------------------------------------------------
19 ; UINT64
20 ; EFIAPI
21 ; InternalMathRRotU64 (
22 ; IN UINT64 Operand,
23 ; IN UINTN Count
24 ; );
25 ;------------------------------------------------------------------------------
26 global ASM_PFX(InternalMathRRotU64)
27 ASM_PFX(InternalMathRRotU64):
28 push ebx
29 mov cl, [esp + 16]
30 mov eax, [esp + 8]
31 mov edx, [esp + 12]
32 shrd ebx, eax, cl
33 shrd eax, edx, cl
34 rol ebx, cl
35 shrd edx, ebx, cl
36 test cl, 32 ; Count >= 32?
37 jz .0
38 mov ecx, eax ; switch eax & edx if Count >= 32
39 mov eax, edx
40 mov edx, ecx
41 .0:
42 pop ebx
43 ret
44