Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 public static float ToFloat(int value, ref FloatConverter converter)
 {
     converter.i = value;
     return(converter.f);
 }
Ejemplo n.º 4
0
 public static int ToInt(float value, ref FloatConverter converter)
 {
     converter.f = value;
     return(converter.i);
 }
Ejemplo n.º 5
0
 public static float intBitsToFloat(int bits)
 {
     IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter();
     return(IKVM.Runtime.FloatConverter.ToFloat(bits, ref converter));
 }
Ejemplo n.º 6
0
 public static int floatToRawIntBits(float value)
 {
     IKVM.Runtime.FloatConverter converter = new IKVM.Runtime.FloatConverter();
     return(IKVM.Runtime.FloatConverter.ToInt(value, ref converter));
 }