/** * Check if a floating point type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkFloatSupported( final int bits) throws UnsupportedOperationException { if (!isFloatSupported(bits)) { return unsupported(bits, "float", SUPPORTED_FLOAT); } return bits; }
/** * Check if a signed integer type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkIntegerSignedSupported( final int bits) throws UnsupportedOperationException { if (!isIntegerSignedSupported(bits)) { return unsupported(bits, "signed integer", SUPPORTED_INTEGER_SIGNED); } return bits; }
/** * Check if an unsigned integer type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkIntegerUnsignedSupported( final int bits) throws UnsupportedOperationException { if (!isIntegerUnsignedSupported(bits)) { return unsupported(bits, "unsigned integer", SUPPORTED_INTEGER_UNSIGNED); } return bits; }
SMFSupportedSizes.checkIntegerSignedSupported(this.componentSizeBits()); break; SMFSupportedSizes.checkIntegerUnsignedSupported(this.componentSizeBits()); break; SMFSupportedSizes.checkFloatSupported(this.componentSizeBits()); break;
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { SMFSupportedSizes.checkIntegerUnsignedSupported( Math.toIntExact(this.triangleIndexSizeBits())); } }
SMFSupportedSizes.checkIntegerSignedSupported(this.componentSizeBits()); break; SMFSupportedSizes.checkIntegerUnsignedSupported(this.componentSizeBits()); break; SMFSupportedSizes.checkFloatSupported(this.componentSizeBits()); break;
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { SMFSupportedSizes.checkIntegerUnsignedSupported( this.triangleIndexSizeBits()); } }
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { SMFSupportedSizes.checkIntegerUnsignedSupported( this.triangleIndexSizeBits()); } }
/** * Check if a floating point type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkFloatSupported( final int bits) throws UnsupportedOperationException { if (!isFloatSupported(bits)) { return unsupported(bits, "float", SUPPORTED_FLOAT); } return bits; }
/** * Check if an unsigned integer type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkIntegerUnsignedSupported( final int bits) throws UnsupportedOperationException { if (!isIntegerUnsignedSupported(bits)) { return unsupported(bits, "unsigned integer", SUPPORTED_INTEGER_UNSIGNED); } return bits; }
/** * Check if a signed integer type with the given size is supported. * * @param bits The size in bits * * @return {@code bits} * * @throws UnsupportedOperationException If the size is not supported */ public static int checkIntegerSignedSupported( final int bits) throws UnsupportedOperationException { if (!isIntegerSignedSupported(bits)) { return unsupported(bits, "signed integer", SUPPORTED_INTEGER_SIGNED); } return bits; }
/** * Construct a packer. * * @param in_events A receiver of errors and warnings * @param in_triangle_buffer The byte buffer that will contain triangle data * @param in_size The size in bits of a single triangle index * @param in_triangles The number of triangles that will be packed */ public SMFByteBufferTrianglePacker( final SMFParserEventsErrorType in_events, final ByteBuffer in_triangle_buffer, final int in_size, final long in_triangles) { final ByteBuffer buffer = NullCheck.notNull(in_triangle_buffer, "Triangle Buffer"); final int size = SMFSupportedSizes.checkIntegerUnsignedSupported(in_size); final int stride = Math.multiplyExact(size / 8, 3); this.cursor = SMFByteBufferCursors.createUnsigned3Raw( buffer, in_size, 0, stride); this.triangles = in_triangles; this.events = NullCheck.notNull(in_events, "in_events"); }