public static void Int32ToBytes(Int32 x, LongByteArray resultbuf, long bufoffset) { resultbuf[bufoffset + 0] = (byte)x; resultbuf[bufoffset + 1] = (byte)((UInt32)x >> 8); resultbuf[bufoffset + 2] = (byte)((UInt32)x >> 16); resultbuf[bufoffset + 3] = (byte)((UInt32)x >> 24); }
public static Int32 BytesToInt32(LongByteArray x, long offset) { Int32 result = 0; result |= x[offset + 0]; result |= (Int32)((UInt32)x[offset + 1] << 8); result |= (Int32)((UInt32)x[offset + 2] << 16); result |= (Int32)((UInt32)x[offset + 3] << 24); return(result); }
public static void Int64ToBytes(Int64 x, LongByteArray resultbuf, long bufoffset) { resultbuf[bufoffset + 0] = (byte)x; resultbuf[bufoffset + 1] = (byte)((UInt64)x >> 8); resultbuf[bufoffset + 2] = (byte)((UInt64)x >> 16); resultbuf[bufoffset + 3] = (byte)((UInt64)x >> 24); resultbuf[bufoffset + 4] = (byte)((UInt64)x >> 32); resultbuf[bufoffset + 5] = (byte)((UInt64)x >> 40); resultbuf[bufoffset + 6] = (byte)((UInt64)x >> 48); resultbuf[bufoffset + 7] = (byte)((UInt64)x >> 56); }
public static Int64 BytesToInt64(LongByteArray x, long offset) { Int64 result = 0; result |= x[offset + 0]; result |= (Int64)((UInt64)x[offset + 1] << 8); result |= (Int64)((UInt64)x[offset + 2] << 16); result |= (Int64)((UInt64)x[offset + 3] << 24); result |= (Int64)((UInt64)x[offset + 4] << 32); result |= (Int64)((UInt64)x[offset + 5] << 40); result |= (Int64)((UInt64)x[offset + 6] << 48); result |= (Int64)((UInt64)x[offset + 7] << 56); return(result); }
public TwoDInt32(long x, long y) { btable = new LongByteArray((x * y) << 2); rowsize = y; }
public OneDInt64(long numelements) { btable = new LongByteArray(numelements << 3); }
public OneDInt32(long numelements) { btable = new LongByteArray(numelements << 2); }
public static Int64 BytesToInt64(LongByteArray x) { return(BytesToInt64(x, 0)); }
public static Int32 BytesToInt32(LongByteArray x) { return(BytesToInt32(x, 0)); }