BitField

class BitField(    val integerSlot: IntegerSlotsEnum,     val shift: Int,     val bits: Int,     val presenter: (Int) -> String?? = null) : Comparable<BitField?>

A BitField is constructed at class loading time and contains any cached information needed to efficiently access a range of up to 32 contiguous bits from an integer slot.

Author

Mark van Gulik

Constructors

Link copied to clipboard
fun BitField(    integerSlot: IntegerSlotsEnum,     shift: Int,     bits: Int,     presenter: (Int) -> String?? = null)

Functions

Link copied to clipboard
open operator override fun compareTo(other: BitField?): Int

Compare two BitFields for sorting. They must be for the same slot. Order by descending shift values.

Link copied to clipboard
fun extractFromLong(longValue: Long): Int

Extract this BitField from the given Long.

Link copied to clipboard
fun isSamePlaceAs(bitField: BitField): Boolean

Answer whether the receiver and the passed BitField occupy the same span of bits at the same integer slot number.

Link copied to clipboard
fun replaceBits(longValue: Long, bitFieldValue: Int): Long

Given a Long field value, replace the bits occupied by this BitField with the supplied Int value, returning the resulting Long.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val bits: Int

The number of bits that this BitField occupies within a Long.

Link copied to clipboard
var enumField: EnumField? = null

The EnumField with which this BitField is annotated, if any. This is populated by the default printing mechanism.

Link copied to clipboard
val integerSlot: IntegerSlotsEnum

The integer slot within which this BitField occurs.

Link copied to clipboard
val integerSlotIndex: Int

The zero-based integer slot within which this bit field occurs.

Link copied to clipboard
var name: String? = null

The name of this BitField. This is filled in as needed by the default object printing mechanism.

Link copied to clipboard
val presenter: (Int) -> String?? = null

An optional function that converts an Int value for this field into a suitable String for presenting this BitField value. If the function is present and produces null, don't show this value.

Link copied to clipboard
val shift: Int

The lowest bit position that this BitField occupies. Zero (0) is the rightmost or lowest order bit.