]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/LRotU32.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / LRotU32.c
1 /** @file
2 Math worker functions.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "BaseLibInternals.h"
10
11 /**
12 Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
13 with the high bits that were rotated.
14
15 This function rotates the 32-bit value Operand to the left by Count bits. The
16 low Count bits are fill with the high Count bits of Operand. The rotated
17 value is returned.
18
19 If Count is greater than 31, then ASSERT().
20
21 @param Operand The 32-bit operand to rotate left.
22 @param Count The number of bits to rotate left.
23
24 @return Operand << Count
25
26 **/
27 UINT32
28 EFIAPI
29 LRotU32 (
30 IN UINT32 Operand,
31 IN UINTN Count
32 )
33 {
34 ASSERT (Count < 32);
35 return (Operand << Count) | (Operand >> (32 - Count));
36 }