[m-rev.] diff: fix div and mod for 32-bit uints in the Java backend

Julien Fischer jfischer at opturion.com
Fri Aug 13 02:53:28 AEST 2021


Fix div and mod for 32-bit uints in the Java backend.

These were broken by commit 9a2c9dc which accidently removed a suffix and
turned a mask constant from a long into an int.

compiler/mlds_to_java_data.m:
      Add the missing suffixes.

Julien.

diff --git a/compiler/mlds_to_java_data.m b/compiler/mlds_to_java_data.m
index 51fa68b..40c43b4 100644
--- a/compiler/mlds_to_java_data.m
+++ b/compiler/mlds_to_java_data.m
@@ -623,8 +623,8 @@ output_int_binop_for_java(Info, Stream, Op, X, Y, !IO) :-
          ;
              ( Type = int_type_uint8,    Cast = "(byte)",    Mask = "0xff"
              ; Type = int_type_uint16,   Cast = "(short)",   Mask = "0xffff"
-            ; Type = int_type_uint32,   Cast = "(int)",     Mask = "0xffffffff"
-            ; Type = int_type_uint,     Cast = "(int)",     Mask = "0xffffffff"
+            ; Type = int_type_uint32,   Cast = "(int)",     Mask = "0xffffffffL"
+            ; Type = int_type_uint,     Cast = "(int)",     Mask = "0xffffffffL"
              ),
              io.format(Stream, "(%s ", [s(Cast)], !IO),
              output_basic_binop_with_mask_for_java(Info, Stream,


More information about the reviews mailing list