Class Position

java.lang.Object
icyllis.arc3d.compiler.Position

public final class Position extends Object
Represents a position that encapsulates the offset and length. It's packed as a int value to reduce object allocation. This class provides static methods to pack and unpack positions.
  • Field Details

  • Method Details

    • range

      public static int range(int start, int end)
      Pack a range into a position, the position is valid only if start >= 0 && start <= end && end <= 0x7FFFFF.
      • 0-24 bits: offset, signed, -1 means invalid
      • 24-32 bits: length, unsigned, saturate at 0xFF
      Returns:
      the position
    • getStartOffset

      public static int getStartOffset(int pos)
    • getEndOffset

      public static int getEndOffset(int pos)
    • getLine

      public static int getLine(int pos, char[] source)