public static float ToValue(byte[] table, int index) { UnionFloat bt = new UnionFloat(); bt.SetBytes(table, index); return(bt.value); }
public static byte[] ToBytes(float val) { UnionFloat bt = new UnionFloat(); bt.value = val; return(bt.bytes); }
private static void EncodeFloatBE(Buffer res, float key) { res.Length = 4; var buffer = res.Content; var value_uint = new UnionFloat() { Value = key }.Binary; buffer[0] = unchecked ((byte)((value_uint >> 24) & 0xFF)); buffer[1] = unchecked ((byte)((value_uint >> 16) & 0xFF)); buffer[2] = unchecked ((byte)((value_uint >> 8) & 0xFF)); buffer[3] = unchecked ((byte)((value_uint >> 0) & 0xFF)); }
public static byte[] ToBytes(float val) { return(UnionFloat.ToBytes(val)); }
public static int ToValue(out float ret, byte[] bytes, int index) { ret = UnionFloat.ToValue(bytes, index); return(UnionFloat.Size); }