adelapena commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1106930320


##########
src/java/org/apache/cassandra/db/rows/Cell.java:
##########
@@ -59,14 +68,24 @@
 
     public interface Factory<V>
     {
-        Cell<V> create(ColumnMetadata column, long timestamp, int ttl, int 
localDeletionTime, V value, CellPath path);
+        Cell<V> create(ColumnMetadata column, long timestamp, int ttl, long 
localDeletionTime, V value, CellPath path);
     }
 
     protected Cell(ColumnMetadata column)
     {
         super(column);
     }
 
+    public static int deletionTimeLongToGuavaUint(long deletionTime)
+    {
+        return deletionTime == NO_DELETION_TIME ? 
UnsignedInteger.MAX_VALUE.intValue() : 
UnsignedInteger.valueOf(deletionTime).intValue();
+    }
+
+    public static long deletionTimeGuavaUintToLong(int deletionTimeGuavaUint)
+    {
+        return deletionTimeGuavaUint == UnsignedInteger.MAX_VALUE.intValue() ? 
NO_DELETION_TIME : 
UnsignedInteger.fromIntBits(deletionTimeGuavaUint).longValue();

Review Comment:
   Agree, `UnsignedInteger` provides validation for the long -> uint 
conversion, but not for the uint -> long conversion discussed here. 
`UnsignedInteger.fromIntBits(deletionTimeGuavaUint).longValue()` doesn't do any 
validation, and it's equivalent to `UnsignedInts.toLong(deletionTimeGuavaUint)` 
or `deletionTimeGuavaUint & 0xffffffffL`.



-- 
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