[m-rev.] for review: Avoid 0xffffffff in code to shorten overlong identifiers.

Peter Wang novalazy at gmail.com
Wed Apr 15 10:46:20 AEST 2020


On Wed, 15 Apr 2020 03:05:32 +1000 (AEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 
> On Tue, 14 Apr 2020 16:45:36 +1000, Peter Wang <novalazy at gmail.com> wrote:
> > diff --git a/compiler/mlds_to_java_class.m b/compiler/mlds_to_java_class.m
> > index e79d96505..c480df1d9 100644
> > --- a/compiler/mlds_to_java_class.m
> > +++ b/compiler/mlds_to_java_class.m
> > @@ -391,9 +393,9 @@ shorten_class_name(ClassName0) = ClassName :-
> >          % characters by underscores. The s_ prefix avoids having f_ as the
> >          % prefix which is used to indicate a mangled name.
> >          Left = string.left(ClassName0, 44),
> > +        Middle = c_util.hex_hash32(ClassName0),
> >          Right = string.right(ClassName0, 44),
> > -        Hash = string.hash(ClassName0) /\ 0xffffffff,
> > -        GenName = string.format("s_%s_%08x_%s", [s(Left), i(Hash), s(Right)]),
> > +        GenName = "s_" ++ Left ++ Middle ++ Right,
> >          GenList = string.to_char_list(GenName),
> >          FilterList = list.map(replace_non_alphanum_underscore, GenList),
> >          ClassName = string.from_char_list(FilterList)
> 
> Did you *intend* to remove the underscores around Middle?

No, it was unintentional. Fixed, thanks.

Peter


More information about the reviews mailing list