/** * @param e The expression * @param range The valid size range * @param value The size * * @return An exception * * @see JPRACheckerErrorCode#BOOLEAN_SET_SIZE_INVALID */ public static JPRACompilerCheckerException booleanSetSizeInvalid( final TypeExprBooleanSet<IdentifierType, Untyped> e, final RangeInclusiveB range, final BigInteger value) { final StringBuilder sb = new StringBuilder(128); sb.append("Invalid boolean set size."); sb.append(System.lineSeparator()); sb.append(" Size: "); sb.append(value); sb.append(System.lineSeparator()); sb.append(" Valid sizes: ["); sb.append(range.getLower()); sb.append(", "); sb.append(range.getUpper()); sb.append("]"); return new JPRACompilerCheckerException( e.getLexicalInformation(), JPRACheckerErrorCode.BOOLEAN_SET_SIZE_INVALID, sb.toString()); }
/** * Construct a new immutable {@code RangeInclusiveB} instance. * @param lower The value for the {@code lower} attribute * @param upper The value for the {@code upper} attribute * @return An immutable RangeInclusiveB instance */ public static RangeInclusiveB of(BigInteger lower, BigInteger upper) { return validate(new RangeInclusiveB(lower, upper)); }
@Override public boolean isPackedIntegerSizeBitsSupported(final BigInteger size) { return this.packed_integer_sizes.anySatisfy(r -> r.includesValue(size)); }
Objects.requireNonNull(range_name, "Range name"); if (range.includesValue(x)) { return x; range.lower(), x_name, x, range.upper(), range_name); assert message != null;
NullCheck.notNull(range_name, "Range name"); if (range.includesValue(x)) { return x; range.getLower(), x_name, x, range.getUpper(), range_name); assert message != null;
/** * Builds a new {@link RangeInclusiveB RangeInclusiveB}. * @return An immutable instance of RangeInclusiveB * @throws java.lang.IllegalStateException if any required attributes are missing */ public RangeInclusiveB build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return RangeInclusiveB.validate(new RangeInclusiveB(null, lower, upper)); }
final String mask = JPRAMasks.createOneMask( container_size.intValue(), 0, field_size.intValue() - 1); final BigInteger shift = fv.getBitRange().getLower();
Objects.requireNonNull(outer_name, "Outer range name"); if (inner.isIncludedIn(outer)) { return inner;
/** * Creates an immutable copy of a {@link RangeInclusiveBType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable RangeInclusiveB instance */ public static RangeInclusiveB copyOf(RangeInclusiveBType instance) { if (instance instanceof RangeInclusiveB) { return (RangeInclusiveB) instance; } return RangeInclusiveB.builder() .from(instance) .build(); }
@Override public ImmutableList<RangeInclusiveB> getMatrixIntegerSizeSupported() { return Lists.immutable.of( new RangeInclusiveB( BigInteger.valueOf(32L), BigInteger.valueOf(32L))); }
NullCheck.notNull(outer_name, "Outer range name"); if (inner.isIncludedIn(outer)) { return inner;
/** * @param e The expression * @param range The valid size range * @param value The size * * @return An exception * * @see JPRACheckerErrorCode#BOOLEAN_SET_SIZE_INVALID */ public static JPRACompilerCheckerException booleanSetSizeInvalid( final TypeExprBooleanSet<IdentifierType, Untyped> e, final RangeInclusiveB range, final BigInteger value) { final StringBuilder sb = new StringBuilder(128); sb.append("Invalid boolean set size."); sb.append(System.lineSeparator()); sb.append(" Size: "); sb.append(value); sb.append(System.lineSeparator()); sb.append(" Valid sizes: ["); sb.append(range.getLower()); sb.append(", "); sb.append(range.getUpper()); sb.append("]"); return new JPRACompilerCheckerException( e.getLexicalInformation(), JPRACheckerErrorCode.BOOLEAN_SET_SIZE_INVALID, sb.toString()); }
@Override public boolean isRecordIntegerSizeBitsSupported(final BigInteger size) { return this.record_integer_sizes.anySatisfy(r -> r.includesValue(size)); }
/** * Copy the current immutable object by setting a value for the {@link RangeInclusiveBType#lower() lower} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for lower * @return A modified copy of the {@code this} object */ public final RangeInclusiveB withLower(BigInteger value) { if (this.lower.equals(value)) return this; BigInteger newValue = Objects.requireNonNull(value, "lower"); return validate(new RangeInclusiveB(this, newValue, this.upper)); }
s.add(new RangeInclusiveB(b2, b64)); this.packed_integer_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b8, b8)); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.record_integer_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.record_float_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b2, b2)); s.add(new RangeInclusiveB(b3, b3)); s.add(new RangeInclusiveB(b4, b4)); this.vector_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.vector_float_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.vector_integer_sizes = s.toImmutable(); final RangeInclusiveB r2 = new RangeInclusiveB(b2, b2);
@Override public boolean isRecordIntegerSizeBitsSupported(final BigInteger size) { return this.record_integer_sizes.anySatisfy(r -> r.includesValue(size)); }
/** * Copy the current immutable object by setting a value for the {@link RangeInclusiveBType#upper() upper} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for upper * @return A modified copy of the {@code this} object */ public final RangeInclusiveB withUpper(BigInteger value) { if (this.upper.equals(value)) return this; BigInteger newValue = Objects.requireNonNull(value, "upper"); return validate(new RangeInclusiveB(this, this.lower, newValue)); }
s.add(new RangeInclusiveB(b2, b64)); this.packed_integer_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b8, b8)); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.record_integer_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.record_float_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b2, b2)); s.add(new RangeInclusiveB(b3, b3)); s.add(new RangeInclusiveB(b4, b4)); this.vector_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b16, b16)); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.vector_float_sizes = s.toImmutable(); s.add(new RangeInclusiveB(b32, b32)); s.add(new RangeInclusiveB(b64, b64)); this.vector_integer_sizes = s.toImmutable(); final RangeInclusiveB r2 = new RangeInclusiveB(b2, b2);