Last change
on this file since 89916 was 80721, checked in by vboxsync, 6 years ago |
Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643
|
-
Property svn:eol-style
set to
native
|
File size:
726 bytes
|
Line | |
---|
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 |
|
---|
10 |
|
---|
11 |
|
---|
12 | #include "BaseLibInternals.h"
|
---|
13 |
|
---|
14 | /**
|
---|
15 | Returns the value of the highest bit set in a 32-bit value. Equivalent to
|
---|
16 | 1 << log2(x).
|
---|
17 |
|
---|
18 | This function computes the value of the highest bit set in the 32-bit value
|
---|
19 | specified by Operand. If Operand is zero, then zero is returned.
|
---|
20 |
|
---|
21 | @param Operand The 32-bit operand to evaluate.
|
---|
22 |
|
---|
23 | @return 1 << HighBitSet32(Operand)
|
---|
24 | @retval 0 Operand is zero.
|
---|
25 |
|
---|
26 | **/
|
---|
27 | UINT32
|
---|
28 | EFIAPI
|
---|
29 | GetPowerOfTwo32 (
|
---|
30 | IN UINT32 Operand
|
---|
31 | )
|
---|
32 | {
|
---|
33 | if (0 == Operand) {
|
---|
34 | return 0;
|
---|
35 | }
|
---|
36 |
|
---|
37 | return 1ul << HighBitSet32 (Operand);
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.