dcapwell commented on code in PR #4078:
URL: https://github.com/apache/cassandra/pull/4078#discussion_r2040321319


##########
src/java/org/apache/cassandra/db/marshal/ByteBufferAccessor.java:
##########
@@ -318,13 +318,13 @@ public int putFloat(ByteBuffer dst, int offset, float 
value)
     @Override
     public int putLeastSignificantBytes(ByteBuffer dst, int offset, long 
register, int bytes)
     {
-        if (dst.remaining() < Long.BYTES)
+        int pos = dst.position() + offset;

Review Comment:
   i added the below test to `ValueAccessorTest`
   
   ```
   @Test
       public void leastSignificantBytes()
       {
           ByteBuffer bb = ByteBuffer.allocate(Long.BYTES * 2);
           byte[] array = new byte[bb.capacity()];
           Property.qt().forAll(Gens.longs().all()).check(expected -> {
               int expectedSize = 
DataOutputInputPlusTest.numberOfBytes(expected);
               for (int offset = 0; offset + expectedSize < array.length; 
offset++) {
                   ByteBufferAccessor.instance.putLeastSignificantBytes(bb, 
offset, expected, expectedSize);
                   
Assertions.assertThat(ByteBufferAccessor.instance.getLeastSignificantBytes(bb, 
offset, expectedSize)).isEqualTo(expected);
                   
                   ByteArrayAccessor.instance.putLeastSignificantBytes(array, 
offset, expected, expectedSize);
                   
Assertions.assertThat(ByteArrayAccessor.instance.getLeastSignificantBytes(array,
 offset, expectedSize)).isEqualTo(expected);
               }
           });
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to