VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/LowBitSet64.c@ 80924

Last change on this file since 80924 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: 907 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 bit position of the lowest bit set in a 64-bit value.
16
17 This function computes the bit position of the lowest bit set in the 64-bit
18 value specified by Operand. If Operand is zero, then -1 is returned.
19 Otherwise, a value between 0 and 63 is returned.
20
21 @param Operand The 64-bit operand to evaluate.
22
23 @retval 0..63 The lowest bit set in Operand was found.
24 @retval -1 Operand is zero.
25
26
27**/
28INTN
29EFIAPI
30LowBitSet64 (
31 IN UINT64 Operand
32 )
33{
34 INTN BitIndex;
35
36 if (Operand == 0) {
37 return -1;
38 }
39
40 for (BitIndex = 0;
41 (Operand & 1) == 0;
42 BitIndex++, Operand = RShiftU64 (Operand, 1));
43 return BitIndex;
44}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette