Skip to content

Commit a07e7fe

Browse files
VolkerVolker
authored andcommitted
Fix the signum of numeric operations in the text format.
1 parent 5f0c24f commit a07e7fe

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,17 @@ protected void writeGlobalAccess( boolean load, FunctionName name, ConstantRef r
187187
@Override
188188
protected void writeNumericOperator( NumericOperator numOp, @Nullable ValueType valueType ) throws IOException {
189189
newline( methodOutput );
190-
methodOutput.append( valueType ).append( '.' ).append( numOp );
190+
String op = numOp.toString();
191+
switch( valueType ) {
192+
case i32:
193+
case i64:
194+
switch( numOp ) {
195+
case div:
196+
case rem:
197+
op += "_s";
198+
}
199+
}
200+
methodOutput.append( valueType ).append( '.' ).append( op );
191201
}
192202

193203
/**

0 commit comments

Comments
 (0)