public static void floatsToBytes(float[] src, int srcpos, byte[] dst, int dstpos, int nfloats) { IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter(); for (int i = 0; i < nfloats; i++) { int v = IKVM.Runtime.FloatConverter.ToInt(src[srcpos++], ref converter); dst[dstpos++] = (byte)(v >> 24); dst[dstpos++] = (byte)(v >> 16); dst[dstpos++] = (byte)(v >> 8); dst[dstpos++] = (byte)(v >> 0); } }
public static void bytesToFloats(byte[] src, int srcpos, float[] dst, int dstpos, int nfloats) { IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter(); for (int i = 0; i < nfloats; i++) { int v = src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; dst[dstpos++] = IKVM.Runtime.FloatConverter.ToFloat(v, ref converter); } }
public static float ToFloat(int value, ref FloatConverter converter) { converter.i = value; return(converter.f); }
public static int ToInt(float value, ref FloatConverter converter) { converter.f = value; return(converter.i); }
public static float intBitsToFloat(int bits) { IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter(); return(IKVM.Runtime.FloatConverter.ToFloat(bits, ref converter)); }
public static int floatToRawIntBits(float value) { IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter(); return(IKVM.Runtime.FloatConverter.ToInt(value, ref converter)); }