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

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Apr 15 03:05:32 AEST 2020



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?

Zoltan.




More information about the reviews mailing list