@@ -4117,7 +4117,7 @@ private void i32_trunc_f32_u(VirtualFrame frame, int stackPointer) {
4117
4117
enterErrorBranch ();
4118
4118
throw WasmException .create (Failure .INT_OVERFLOW );
4119
4119
}
4120
- final int result = ( int ) WasmMath . truncFloatToUnsignedLong (x );
4120
+ final int result = ExactMath . truncateToUnsignedInt (x );
4121
4121
pushInt (frame , stackPointer - 1 , result );
4122
4122
}
4123
4123
@@ -4143,7 +4143,7 @@ private void i32_trunc_f64_u(VirtualFrame frame, int stackPointer) {
4143
4143
enterErrorBranch ();
4144
4144
throw WasmException .create (Failure .INT_OVERFLOW );
4145
4145
}
4146
- final int result = ( int ) WasmMath . truncDoubleToUnsignedLong (x );
4146
+ final int result = ExactMath . truncateToUnsignedInt (x );
4147
4147
pushInt (frame , stackPointer - 1 , result );
4148
4148
}
4149
4149
@@ -4155,14 +4155,7 @@ private static void i32_trunc_sat_f32_s(VirtualFrame frame, int stackPointer) {
4155
4155
4156
4156
private static void i32_trunc_sat_f32_u (VirtualFrame frame , int stackPointer ) {
4157
4157
final float x = popFloat (frame , stackPointer - 1 );
4158
- final int result ;
4159
- if (Float .isNaN (x ) || x < MIN_FLOAT_TRUNCATABLE_TO_U_INT ) {
4160
- result = 0 ;
4161
- } else if (x > MAX_FLOAT_TRUNCATABLE_TO_U_INT ) {
4162
- result = 0xffff_ffff ;
4163
- } else {
4164
- result = (int ) WasmMath .truncFloatToUnsignedLong (x );
4165
- }
4158
+ final int result = ExactMath .truncateToUnsignedInt (x );
4166
4159
pushInt (frame , stackPointer - 1 , result );
4167
4160
}
4168
4161
@@ -4174,14 +4167,7 @@ private static void i32_trunc_sat_f64_s(VirtualFrame frame, int stackPointer) {
4174
4167
4175
4168
private static void i32_trunc_sat_f64_u (VirtualFrame frame , int stackPointer ) {
4176
4169
final double x = popDouble (frame , stackPointer - 1 );
4177
- final int result ;
4178
- if (Double .isNaN (x ) || x < MIN_DOUBLE_TRUNCATABLE_TO_U_INT ) {
4179
- result = 0 ;
4180
- } else if (x > MAX_DOUBLE_TRUNCATABLE_TO_U_INT ) {
4181
- result = 0xffff_ffff ;
4182
- } else {
4183
- result = (int ) WasmMath .truncDoubleToUnsignedLong (x );
4184
- }
4170
+ final int result = ExactMath .truncateToUnsignedInt (x );
4185
4171
pushInt (frame , stackPointer - 1 , result );
4186
4172
}
4187
4173
@@ -4218,7 +4204,7 @@ private void i64_trunc_f32_u(VirtualFrame frame, int stackPointer) {
4218
4204
enterErrorBranch ();
4219
4205
throw WasmException .create (Failure .INT_OVERFLOW );
4220
4206
}
4221
- final long result = WasmMath . truncFloatToUnsignedLong (x );
4207
+ final long result = ExactMath . truncateToUnsignedLong (x );
4222
4208
pushLong (frame , stackPointer - 1 , result );
4223
4209
}
4224
4210
@@ -4244,7 +4230,7 @@ private void i64_trunc_f64_u(VirtualFrame frame, int stackPointer) {
4244
4230
enterErrorBranch ();
4245
4231
throw WasmException .create (Failure .INT_OVERFLOW );
4246
4232
}
4247
- final long result = WasmMath . truncDoubleToUnsignedLong (x );
4233
+ final long result = ExactMath . truncateToUnsignedLong (x );
4248
4234
pushLong (frame , stackPointer - 1 , result );
4249
4235
}
4250
4236
@@ -4256,12 +4242,7 @@ private static void i64_trunc_sat_f32_s(VirtualFrame frame, int stackPointer) {
4256
4242
4257
4243
private static void i64_trunc_sat_f32_u (VirtualFrame frame , int stackPointer ) {
4258
4244
final float x = popFloat (frame , stackPointer - 1 );
4259
- final long result ;
4260
- if (Float .isNaN (x ) || x < MIN_FLOAT_TRUNCATABLE_TO_U_LONG ) {
4261
- result = 0 ;
4262
- } else {
4263
- result = WasmMath .truncFloatToUnsignedLong (x );
4264
- }
4245
+ final long result = ExactMath .truncateToUnsignedLong (x );
4265
4246
pushLong (frame , stackPointer - 1 , result );
4266
4247
}
4267
4248
@@ -4273,12 +4254,7 @@ private static void i64_trunc_sat_f64_s(VirtualFrame frame, int stackPointer) {
4273
4254
4274
4255
private static void i64_trunc_sat_f64_u (VirtualFrame frame , int stackPointer ) {
4275
4256
final double x = popDouble (frame , stackPointer - 1 );
4276
- final long result ;
4277
- if (Double .isNaN (x ) || x < MIN_DOUBLE_TRUNCATABLE_TO_U_LONG ) {
4278
- result = 0 ;
4279
- } else {
4280
- result = WasmMath .truncDoubleToUnsignedLong (x );
4281
- }
4257
+ final long result = ExactMath .truncateToUnsignedLong (x );
4282
4258
pushLong (frame , stackPointer - 1 , result );
4283
4259
}
4284
4260
@@ -4300,7 +4276,7 @@ private static void f32_convert_i64_s(VirtualFrame frame, int stackPointer) {
4300
4276
4301
4277
private static void f32_convert_i64_u (VirtualFrame frame , int stackPointer ) {
4302
4278
long x = popLong (frame , stackPointer - 1 );
4303
- float result = WasmMath . unsignedLongToFloat (x );
4279
+ float result = ExactMath . unsignedToFloat (x );
4304
4280
pushFloat (frame , stackPointer - 1 , result );
4305
4281
}
4306
4282
@@ -4327,7 +4303,7 @@ private static void f64_convert_i64_s(VirtualFrame frame, int stackPointer) {
4327
4303
4328
4304
private static void f64_convert_i64_u (VirtualFrame frame , int stackPointer ) {
4329
4305
long x = popLong (frame , stackPointer - 1 );
4330
- double result = WasmMath . unsignedLongToDouble (x );
4306
+ double result = ExactMath . unsignedToDouble (x );
4331
4307
pushDouble (frame , stackPointer - 1 , result );
4332
4308
}
4333
4309
0 commit comments