DataTools
Bit Generator
This is a value generator in bit unit. By designed bit shifting method, it can generate over 37m-length non-repeated pattern bit values.
uint startValue = 0b110100101;
int requestLength = 32;
// returning IEnumerable<byte>
BitGenerator.Generate(startValue, requestLength );
Data Union 32 / 64
This is a fastest way to get same memory address as different value type.
DataUnion32 dataUnion = new();
dataUnion.Int = -38546243;
var asFloat = dataUnion.Float;
this is not changing type of value, please read Microsoft official document for details.
you may also see related google results about StructLayout of c#.
Last updated