static void encode_int (byte[] buf, int i, ref int offset) { buf [offset] = (byte)((i >> 24) & 0xff); buf [offset + 1] = (byte)((i >> 16) & 0xff); buf [offset + 2] = (byte)((i >> 8) & 0xff); buf [offset + 3] = (byte)((i >> 0) & 0xff); offset += 4; }