public static void doublesToBytes(double[] src, int srcpos, byte[] dst, int dstpos, int ndoubles) { IKVM.Runtime.DoubleConverter converter = new IKVM.Runtime.DoubleConverter(); for (int i = 0; i < ndoubles; i++) { long v = IKVM.Runtime.DoubleConverter.ToLong(src[srcpos++], ref converter); dst[dstpos++] = (byte)(v >> 56); dst[dstpos++] = (byte)(v >> 48); dst[dstpos++] = (byte)(v >> 40); dst[dstpos++] = (byte)(v >> 32); dst[dstpos++] = (byte)(v >> 24); dst[dstpos++] = (byte)(v >> 16); dst[dstpos++] = (byte)(v >> 8); dst[dstpos++] = (byte)(v >> 0); } }
public static void bytesToDoubles(byte[] src, int srcpos, double[] dst, int dstpos, int ndoubles) { IKVM.Runtime.DoubleConverter converter = new IKVM.Runtime.DoubleConverter(); for (int i = 0; i < ndoubles; i++) { long v = src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; v = (v << 8) | src[srcpos++]; dst[dstpos++] = IKVM.Runtime.DoubleConverter.ToDouble(v, ref converter); } }
public static double ToDouble(long value, ref DoubleConverter converter) { converter.l = value; return(converter.d); }
public static long ToLong(double value, ref DoubleConverter converter) { converter.d = value; return(converter.l); }
public static double longBitsToDouble(long bits) { IKVM.Runtime.DoubleConverter converter = new IKVM.Runtime.DoubleConverter(); return(IKVM.Runtime.DoubleConverter.ToDouble(bits, ref converter)); }
public static long doubleToRawLongBits(double value) { IKVM.Runtime.DoubleConverter converter = new IKVM.Runtime.DoubleConverter(); return(IKVM.Runtime.DoubleConverter.ToLong(value, ref converter)); }