belliottsmith commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1106806624
##########
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:
So you're talking about the reverse conversion. The annotated code is not
protected at all, and so there is no reason to box the value here. But, yes,
protection in the reverse direction can be easily reproduced with a static
method for converting from long to int, that confirms the upper bits are unset,
i.e. simply checks (value & 0xffffffff00000000L) == 0.
There is no reason to use a boxing method for this.
--
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]