[m-rev.] for post-commit review: int32.from_int64

Julien Fischer jfischer at opturion.com
Sat Mar 7 14:06:04 AEDT 2026


On Sat, 7 Mar 2026 at 04:07, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> Add from_int64 and det_from_int64 to int32.m.

...

> diff --git a/library/int32.m b/library/int32.m
> index 84a9647af..7a5c9328b 100644
> --- a/library/int32.m
> +++ b/library/int32.m
> @@ -119,6 +119,20 @@
>      %
>  :- func cast_to_int64(int32) = int64.
>
> +    % from_int(I64, I32):

That should be: from_int64

> +    %
> +    % Convert an int64 to an int32.
> +    % Fail if I64 is not in the range [-(2^31), 2^31 - 1].
> +    %
> +:- pred from_int64(int64::in, int32::out) is semidet.
> +
> +    % det_from_int(I64) = I32:

That should be: det_from_int64.

> +    %
> +    % Convert an int64 to an int32.
> +    % Throw an exception if I64 is not in the range [-(2^31), 2^31 - 1].
> +    %
> +:- func det_from_int64(int64) = int32.
> +
>      % cast_from_int64(I64) = I32:
>      %
>      % Convert an int64 to an int32.

That looks fine otherwise.

Julien.


More information about the reviews mailing list