]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo32.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / GetPowerOfTwo32.c
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 GetPowerOfTwo32.c
15
16 Abstract:
17
18 Math worker functions.
19
20 --*/
21
22 #include "BaseLibInternals.h"
23
24 /**
25 Returns the value of the highest bit set in a 32-bit value. Equivalent to
26 1 << HighBitSet32(x).
27
28 This function computes the value of the highest bit set in the 32-bit value
29 specified by Operand. If Operand is zero, then zero is returned.
30
31 @param Operand The 32-bit operand to evaluate.
32
33 @return 1 << HighBitSet32(Operand)
34 @retval 0 Operand is zero.
35
36 **/
37 UINT32
38 EFIAPI
39 GetPowerOfTwo32 (
40 IN UINT32 Operand
41 )
42 {
43 if (Operand == 0) {
44 return 0;
45 }
46
47 return 1ul << HighBitSet32 (Operand);
48 }