Skip to content

Commit d4e6d89

Browse files
committed
Update to bit shifting constants
1 parent 69d5899 commit d4e6d89

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

core/src/main/java/org/apache/spark/shuffle/unsafe/PackedRecordPointer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,23 @@ final class PackedRecordPointer {
3737

3838
static final int MAXIMUM_PAGE_SIZE_BYTES = 1 << 27; // 128 megabytes
3939

40-
static final int MAXIMUM_PARTITION_ID = 1 << 24; // 16777216
40+
static final int MAXIMUM_PARTITION_ID = (1 << 24) - 1; // 16777215
4141

4242
/** Bit mask for the lower 40 bits of a long. */
43-
private static final long MASK_LONG_LOWER_40_BITS = 0xFFFFFFFFFFL;
43+
private static final long MASK_LONG_LOWER_40_BITS = (1L << 40) - 1;
4444

4545
/** Bit mask for the upper 24 bits of a long */
4646
private static final long MASK_LONG_UPPER_24_BITS = ~MASK_LONG_LOWER_40_BITS;
4747

4848
/** Bit mask for the lower 27 bits of a long. */
49-
private static final long MASK_LONG_LOWER_27_BITS = 0x7FFFFFFL;
49+
private static final long MASK_LONG_LOWER_27_BITS = (1L << 27) - 1;
5050

5151
/** Bit mask for the lower 51 bits of a long. */
52-
private static final long MASK_LONG_LOWER_51_BITS = 0x7FFFFFFFFFFFFL;
52+
private static final long MASK_LONG_LOWER_51_BITS = (1L << 51) - 1;
5353

5454
/** Bit mask for the upper 13 bits of a long */
5555
private static final long MASK_LONG_UPPER_13_BITS = ~MASK_LONG_LOWER_51_BITS;
5656

57-
// TODO: this shifting is probably extremely inefficient; this is just for prototyping
58-
5957
/**
6058
* Pack a record address and partition id into a single word.
6159
*

core/src/main/java/org/apache/spark/shuffle/unsafe/SpillInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
package org.apache.spark.shuffle.unsafe;
1919

20-
import org.apache.spark.storage.TempShuffleBlockId;
21-
2220
import java.io.File;
2321

22+
import org.apache.spark.storage.TempShuffleBlockId;
23+
2424
/**
2525
* Metadata for a block of data written by {@link UnsafeShuffleExternalSorter}.
2626
*/

0 commit comments

Comments
 (0)