Skip to content

Commit

Permalink
Update to bit shifting constants
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed May 11, 2015
1 parent 69d5899 commit d4e6d89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,23 @@ final class PackedRecordPointer {

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

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

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

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

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

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

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

// TODO: this shifting is probably extremely inefficient; this is just for prototyping

/**
* Pack a record address and partition id into a single word.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package org.apache.spark.shuffle.unsafe;

import org.apache.spark.storage.TempShuffleBlockId;

import java.io.File;

import org.apache.spark.storage.TempShuffleBlockId;

/**
* Metadata for a block of data written by {@link UnsafeShuffleExternalSorter}.
*/
Expand Down

0 comments on commit d4e6d89

Please sign in to comment.