Hi fellow programmers,
I am not used to manipulate bytes in my code and I have this piece of code that is written in Java and I would need to convert it to its C# equivalent :
protected static final int putLong(final byte[] b, final int off, final long val) {
b[off + 7] = (byte) (val >>> 0);
b[off + 6] = (byte) (val >>> 8);
b[off + 5] = (byte) (val >>> 16);
b[off + 4] = (byte) (val >>> 24);
b[off + 3] = (byte) (val >>> 32);
b[off + 2] = (byte) (val >>> 40);
b[off + 1] = (byte) (val >>> 48);
b[off + 0] = (byte) (val >>> 56);
return off + 8;
}
Thanks in advance for all your help, I am looking forward to learn from this.
I would also appreciate to know if there is a C# equivalent to the Java function :
Double.doubleToLongBits(val);
edit : found the answer to my second question : BitConverter.DoubleToInt64Bits