@@ -1850,7 +1850,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
18501850 state .popChecked (V128_TYPE );
18511851 load (state , V128_TYPE , 8 , longMultiResult );
18521852 final byte laneIndex = read1 ();
1853- if (Byte .toUnsignedInt (laneIndex ) >= 16 ) {
1853+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . BYTE_LENGTH ) {
18541854 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.load8_lane" , Byte .toUnsignedInt (laneIndex ));
18551855 }
18561856 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_LOAD8_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1861,7 +1861,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
18611861 state .popChecked (V128_TYPE );
18621862 load (state , V128_TYPE , 16 , longMultiResult );
18631863 final byte laneIndex = read1 ();
1864- if (Byte .toUnsignedInt (laneIndex ) >= 8 ) {
1864+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . SHORT_LENGTH ) {
18651865 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.load16_lane" , Byte .toUnsignedInt (laneIndex ));
18661866 }
18671867 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_LOAD16_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1872,7 +1872,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
18721872 state .popChecked (V128_TYPE );
18731873 load (state , V128_TYPE , 32 , longMultiResult );
18741874 final byte laneIndex = read1 ();
1875- if (Byte .toUnsignedInt (laneIndex ) >= 4 ) {
1875+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . INT_LENGTH ) {
18761876 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.load32_lane" , Byte .toUnsignedInt (laneIndex ));
18771877 }
18781878 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_LOAD32_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1883,7 +1883,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
18831883 state .popChecked (V128_TYPE );
18841884 load (state , V128_TYPE , 64 , longMultiResult );
18851885 final byte laneIndex = read1 ();
1886- if (Byte .toUnsignedInt (laneIndex ) >= 2 ) {
1886+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . DOUBLE_LENGTH ) {
18871887 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.load64_lane" , Byte .toUnsignedInt (laneIndex ));
18881888 }
18891889 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_LOAD64_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1893,7 +1893,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
18931893 case Instructions .VECTOR_V128_STORE8_LANE : {
18941894 store (state , V128_TYPE , 8 , longMultiResult );
18951895 final byte laneIndex = read1 ();
1896- if (Byte .toUnsignedInt (laneIndex ) >= 16 ) {
1896+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . BYTE_LENGTH ) {
18971897 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.store8_lane" , Byte .toUnsignedInt (laneIndex ));
18981898 }
18991899 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_STORE8_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1903,7 +1903,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
19031903 case Instructions .VECTOR_V128_STORE16_LANE : {
19041904 store (state , V128_TYPE , 16 , longMultiResult );
19051905 final byte laneIndex = read1 ();
1906- if (Byte .toUnsignedInt (laneIndex ) >= 8 ) {
1906+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . SHORT_LENGTH ) {
19071907 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.store16_lane" , Byte .toUnsignedInt (laneIndex ));
19081908 }
19091909 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_STORE16_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1913,7 +1913,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
19131913 case Instructions .VECTOR_V128_STORE32_LANE : {
19141914 store (state , V128_TYPE , 32 , longMultiResult );
19151915 final byte laneIndex = read1 ();
1916- if (Byte .toUnsignedInt (laneIndex ) >= 4 ) {
1916+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . INT_LENGTH ) {
19171917 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.store32_lane" , Byte .toUnsignedInt (laneIndex ));
19181918 }
19191919 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_STORE32_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1923,7 +1923,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
19231923 case Instructions .VECTOR_V128_STORE64_LANE : {
19241924 store (state , V128_TYPE , 64 , longMultiResult );
19251925 final byte laneIndex = read1 ();
1926- if (Byte .toUnsignedInt (laneIndex ) >= 2 ) {
1926+ if (Byte .toUnsignedInt (laneIndex ) >= Vector128 . LONG_LENGTH ) {
19271927 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for v128.store64_lane" , Byte .toUnsignedInt (laneIndex ));
19281928 }
19291929 state .addVectorMemoryLaneInstruction (Bytecode .VECTOR_V128_STORE64_LANE , (int ) longMultiResult [0 ], longMultiResult [1 ], module .memoryHasIndexType64 ((int ) longMultiResult [0 ]),
@@ -1939,7 +1939,7 @@ private void readNumericInstructions(ParserState state, int opcode) {
19391939 case Instructions .VECTOR_I8X16_SHUFFLE : {
19401940 final Vector128 indices = readUnsignedInt128 ();
19411941 for (byte index : indices .getBytes ()) {
1942- if (Byte .toUnsignedInt (index ) >= 32 ) {
1942+ if (Byte .toUnsignedInt (index ) >= 2 * Vector128 . BYTE_LENGTH ) {
19431943 fail (Failure .INVALID_LANE_INDEX , "Lane index %d out of bounds for i8x16.shuffle" , Byte .toUnsignedInt (index ));
19441944 }
19451945 }
@@ -3185,8 +3185,8 @@ private long readSignedInt64() {
31853185 }
31863186
31873187 private Vector128 readUnsignedInt128 () {
3188- byte [] bytes = new byte [16 ];
3189- for (int i = 0 ; i < 16 ; i ++) {
3188+ byte [] bytes = new byte [Vector128 . BYTES ];
3189+ for (int i = 0 ; i < Vector128 . BYTES ; i ++) {
31903190 bytes [i ] = read1 ();
31913191 }
31923192 return new Vector128 (bytes );
0 commit comments