JCL Help:BitsHighest@Byte

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Returns the highest bit set in the supplied value.


Pascal

 function BitsHighest(X: Byte): Integer; overload;
function BitsHighest(X: ShortInt): Integer; overload;
function BitsHighest(X: SmallInt): Integer; overload;
function BitsHighest(X: Word): Integer; overload;
function BitsHighest(X: Integer): Integer; overload;
function BitsHighest(X: Cardinal): Integer; overload;
function BitsHighest(X: Int64): Integer; overload;


Parameters

Parameters Description
X: Byte The value for which to return the highest set bit.


Return Value

The index of the highest bit set, or -1 if no bits are set.


Description

BitsHighest returns the index of the highest bit which is set in the supplied value. Note that bits are numbered right to left starting with 0. For example, BitsHighest(5) returns 2 (5 equals 00000101 in binary).


See Also

BitsLowest CountBitsSet


About

Unit

JclLogic


Donator

Michael Schnell


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page