C# Class Disruptor.Util

Set of common functions used by the Disruptor
Show file Open project: disruptor-net/Disruptor-net

Public Methods

Method Description
CeilingNextPowerOfTwo ( this x ) : int

Calculate the next power of 2, greater than or equal to x.

GetMinimumSequence ( ISequence sequences, long minimum = long.MaxValue ) : long

Get the minimum sequence from an array of Sequences.

GetSequencesFor ( ) : ISequence[]

Get an array of Sequences for the passed IEventProcessors

IsPowerOf2 ( this x ) : bool

Test whether a given integer is a power of 2

Log2 ( int i ) : int

Calculate the log base 2 of the supplied integer, essentially reports the location of the highest bit.

Method Details

CeilingNextPowerOfTwo() public static method

Calculate the next power of 2, greater than or equal to x.
public static CeilingNextPowerOfTwo ( this x ) : int
x this Value to round up
return int

GetMinimumSequence() public static method

Get the minimum sequence from an array of Sequences.
public static GetMinimumSequence ( ISequence sequences, long minimum = long.MaxValue ) : long
sequences ISequence sequences to compare.
minimum long an initial default minimum. If the array is empty this value will returned.
return long

GetSequencesFor() public static method

Get an array of Sequences for the passed IEventProcessors
public static GetSequencesFor ( ) : ISequence[]
return ISequence[]

IsPowerOf2() public static method

Test whether a given integer is a power of 2
public static IsPowerOf2 ( this x ) : bool
x this
return bool

Log2() public static method

Calculate the log base 2 of the supplied integer, essentially reports the location of the highest bit.
public static Log2 ( int i ) : int
i int Value to calculate log2 for.
return int