Last change
on this file since 109247 was 99404, checked in by vboxsync, 2 years ago |
Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643
|
-
Property svn:eol-style
set to
native
|
File size:
866 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 | #include "BaseLibInternals.h"
|
---|
10 |
|
---|
11 | /**
|
---|
12 | Returns the bit position of the lowest bit set in a 64-bit value.
|
---|
13 |
|
---|
14 | This function computes the bit position of the lowest bit set in the 64-bit
|
---|
15 | value specified by Operand. If Operand is zero, then -1 is returned.
|
---|
16 | Otherwise, a value between 0 and 63 is returned.
|
---|
17 |
|
---|
18 | @param Operand The 64-bit operand to evaluate.
|
---|
19 |
|
---|
20 | @retval 0..63 The lowest bit set in Operand was found.
|
---|
21 | @retval -1 Operand is zero.
|
---|
22 |
|
---|
23 |
|
---|
24 | **/
|
---|
25 | INTN
|
---|
26 | EFIAPI
|
---|
27 | LowBitSet64 (
|
---|
28 | IN UINT64 Operand
|
---|
29 | )
|
---|
30 | {
|
---|
31 | INTN BitIndex;
|
---|
32 |
|
---|
33 | if (Operand == 0) {
|
---|
34 | return -1;
|
---|
35 | }
|
---|
36 |
|
---|
37 | for (BitIndex = 0;
|
---|
38 | (Operand & 1) == 0;
|
---|
39 | BitIndex++, Operand = RShiftU64 (Operand, 1))
|
---|
40 | {
|
---|
41 | }
|
---|
42 |
|
---|
43 | return BitIndex;
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.