Table of Contents

Class BitwiseUtils

Namespace
NanoByte.Common
Assembly
NanoByte.Common.dll

Provides utility functions for bitwise operations.

public static class BitwiseUtils
Inheritance
object
BitwiseUtils

Methods

CombineHiLoNibble(int, int)

Combines a high nibble and a low nibble (4 bits) into a single byte.

[Pure]
public static byte CombineHiLoNibble(int high, int low)

Parameters

high int
low int

Returns

byte

HiNibble(byte)

Extracts the high-order nibble (first 4 bits) of a byte.

[Pure]
public static int HiNibble(byte b)

Parameters

b byte

The byte to extract from.

Returns

int

The high-order nibble as an integer.

HiWord(int)

Extracts the high-order word (last 16 bits) of a 32-bit integer.

[Pure]
public static short HiWord(int l)

Parameters

l int

Returns

short

HiWord(uint)

Extracts the high-order word (last 16 bits) of a 32-bit integer.

[CLSCompliant(false)]
[Pure]
public static short HiWord(uint l)

Parameters

l uint

Returns

short

LoNibble(byte)

Extracts the low-order nibble (last 4 bits) of a byte.

[Pure]
public static int LoNibble(byte b)

Parameters

b byte

The byte to extract from.

Returns

int

The low-order nibble as an integer.

LoWord(int)

Extracts the low-order word (first 16 bits) of a 32-bit integer.

[Pure]
public static short LoWord(int l)

Parameters

l int

Returns

short

LoWord(uint)

Extracts the low-order word (first 16 bits) of a 32-bit integer.

[CLSCompliant(false)]
[Pure]
public static short LoWord(uint l)

Parameters

l uint

Returns

short

XOr(byte[], byte[])

Combines two byte arrays via Exclusive Or.

[Pure]
public static byte[] XOr(byte[] array1, byte[] array2)

Parameters

array1 byte[]
array2 byte[]

Returns

byte[]