[ https://issues.apache.org/jira/browse/CASSANDRA-9499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14588326#comment-14588326 ]
Ariel Weisberg commented on CASSANDRA-9499: ------------------------------------------- I am getting the wrong answer for Integer.MIN_VALUE trying to mask out the long that has the 8-byte value. I get -2357198848. I replaced {noformat} long i = 0; for (int idx = 0; idx < len; idx++) { byte b = buf.get(); i = i << 8; i = i | (b & 0xFF); } {noformat} with {noformat} long i = buf.getLong(buf.position()); i &= (-1L >>> (64 - (len * 8))); {noformat} I guess this comes down to the endianess issue. Right now NIODataInputStream doesn't handle little endian anything. The buffer is private and there is no constructor for providing one nor a method for changing the order of the underlying buffer. Is this a dead end, pick a different implementation depending on byte order? > Introduce writeVInt method to DataOutputStreamPlus > -------------------------------------------------- > > Key: CASSANDRA-9499 > URL: https://issues.apache.org/jira/browse/CASSANDRA-9499 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: Benedict > Assignee: Ariel Weisberg > Priority: Minor > Fix For: 3.0 beta 1 > > > CASSANDRA-8099 really could do with a writeVInt method, for both fixing > CASSANDRA-9498 but also efficiently encoding timestamp/deletion deltas. It > should be possible to make an especially efficient implementation against > BufferedDataOutputStreamPlus. -- This message was sent by Atlassian JIRA (v6.3.4#6332)