C# Class Nintenlord.Utility.ByteExtensions

Extensions for byte and arrays of it
Show file Open project: Diegoisawesome/AwesomeMapEditor-old

Public Methods

Method Description
And ( this array, byte array2 ) : byte[]
AndWith ( this array, byte array2 ) : void
Clamp ( this i, byte min, byte max ) : int
GetBits ( this i, int position, int length ) : byte
GetBits ( this i, int position, int length ) : byte[]
GetMask ( int position, int length ) : byte
GetMaskArray ( int position, int length ) : byte[]
IsInRange ( this i, byte min, byte max ) : bool
Neg ( this array ) : byte[]
NegWith ( this array ) : void
Or ( this array, byte array2 ) : byte[]
OrWith ( this array, byte array2 ) : void
Shift ( this i, int amount ) : byte
Shift ( this array, int toShift ) : byte[]

Shifts bytes in array. Assumes bytes are in little endian order and low priority bits are first

Could be made faster with using uints...

ToHexString ( this i, string prefix ) : string
ToString ( this i, int bytesPerWord ) : string
WriteTo ( this array, int destination, byte source, int length ) : void
Xor ( this array, byte array2 ) : byte[]
XorWith ( this array, byte array2 ) : void

Private Methods

Method Description
ShiftLeft ( this array, int toShift ) : byte[]
ShiftRight ( this array, int toShift ) : byte[]

Method Details

And() public static method

public static And ( this array, byte array2 ) : byte[]
array this
array2 byte
return byte[]

AndWith() public static method

public static AndWith ( this array, byte array2 ) : void
array this
array2 byte
return void

Clamp() public static method

public static Clamp ( this i, byte min, byte max ) : int
i this
min byte
max byte
return int

GetBits() public static method

public static GetBits ( this i, int position, int length ) : byte
i this
position int
length int
return byte

GetBits() public static method

public static GetBits ( this i, int position, int length ) : byte[]
i this
position int
length int
return byte[]

GetMask() public static method

public static GetMask ( int position, int length ) : byte
position int
length int
return byte

GetMaskArray() public static method

public static GetMaskArray ( int position, int length ) : byte[]
position int
length int
return byte[]

IsInRange() public static method

public static IsInRange ( this i, byte min, byte max ) : bool
i this
min byte
max byte
return bool

Neg() public static method

public static Neg ( this array ) : byte[]
array this
return byte[]

NegWith() public static method

public static NegWith ( this array ) : void
array this
return void

Or() public static method

public static Or ( this array, byte array2 ) : byte[]
array this
array2 byte
return byte[]

OrWith() public static method

public static OrWith ( this array, byte array2 ) : void
array this
array2 byte
return void

Shift() public static method

public static Shift ( this i, int amount ) : byte
i this
amount int
return byte

Shift() public static method

Shifts bytes in array. Assumes bytes are in little endian order and low priority bits are first
Could be made faster with using uints...
public static Shift ( this array, int toShift ) : byte[]
array this Array to shift
toShift int Positive means left shifting, negative right
return byte[]

ToHexString() public static method

public static ToHexString ( this i, string prefix ) : string
i this
prefix string
return string

ToString() public static method

public static ToString ( this i, int bytesPerWord ) : string
i this
bytesPerWord int
return string

WriteTo() public static method

public static WriteTo ( this array, int destination, byte source, int length ) : void
array this
destination int
source byte
length int
return void

Xor() public static method

public static Xor ( this array, byte array2 ) : byte[]
array this
array2 byte
return byte[]

XorWith() public static method

public static XorWith ( this array, byte array2 ) : void
array this
array2 byte
return void