public override int SingleToInt32Bits(float value) { int fmant; int i; int t; int fconv = new Int32SingleUnion(value).AsInt32; if (fconv != 0) { fmant = (0x007fffff & fconv) | 0x00800000; t = ((0x7f800000 & fconv) >> 23) - 126; while ((t & 0x3) != 0) { ++t; fmant >>= 1; } fconv = (int)(0x80000000 & fconv) | (((t >> 2) + 64) << 24) | fmant; } fconv = (fconv << 24) | ((fconv >> 24) & 0xff) | ((fconv & 0xff00) << 8) | ((fconv & 0xff0000) >> 8); int to = fconv; return(to); }
public int SingleToInt32Bits(float value) { Int32SingleUnion union = new Int32SingleUnion(value); return union.AsInt32; }
public float Int32BitsToSingle(int value) { Int32SingleUnion union = new Int32SingleUnion(value); return union.AsSingle; }
public int SingleToInt32Bits(float value) { Int32SingleUnion union = new Int32SingleUnion(value); return(union.AsInt32); }
public float Int32BitsToSingle(int value) { Int32SingleUnion union = new Int32SingleUnion(value); return(union.AsSingle); }
public static void WriteSingle(byte[] data, int startIndex, float value) { var union = new Int32SingleUnion(value); WriteInt32(data, startIndex, union.i); }
public static float ReadSingle(byte[] data, int startIndex) { var union = new Int32SingleUnion(ReadInt32(data, startIndex)); return(union.f); }