JCL Help:SetBit@Byte@TBitRange

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Sets a bit in an integer-type value.


Pascal

 function SetBit(const Value: Byte; const Bit: TBitRange): Byte; overload;
function SetBit(const Value: Shortint; const Bit: TBitRange): Shortint; overload;
function SetBit(const Value: Smallint; const Bit: TBitRange): Smallint; overload;
function SetBit(const Value: Word; const Bit: TBitRange): Word; overload;
function SetBit(const Value: Cardinal; const Bit: TBitRange): Cardinal; overload;
function SetBit(const Value: Integer; const Bit: TBitRange): Integer; overload;
function SetBit(const Value: Int64; const Bit: TBitRange): Int64; overload;


Parameters

Parameters Description
const Value: Byte The integer-typed variable for which to set a bit.
const Bit: TBitRange The 0 based bit position of the bit to set. This is a modulo N bit position where N is the number of bits in the Value parameter. For example, if Value is a Byte, then Bit position is interpreted as Bit mod 8.


Return Value

Copy of Value with the bit at position Bit set.


Description

SetBit sets the specified bit position of the supplied integer typed variable. In other words it sets the bit at position Bit for Value to 1.


See Also

TestBit ClearBit ToggleBit TestBits


About

Unit

JclLogic


Donator

Marcel van Brakel


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