emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] Add module functions to convert from and to big integers


From: Eli Zaretskii
Subject: Re: [PATCH 2/2] Add module functions to convert from and to big integers.
Date: Tue, 23 Apr 2019 17:30:37 +0300

> From: Philipp Stephani <address@hidden>
> Date: Tue, 23 Apr 2019 15:17:42 +0200
> Cc: Philipp Stephani <address@hidden>
> 
> address@hidden Function bool extract_big_integer (emacs_env address@hidden, 
> emacs_value @var{arg}, int address@hidden, ptrdiff_t address@hidden, unsigned 
> char address@hidden)
> +This function, which is available since Emacs 27, extracts the
> +integral value of @var{arg}.  If @var{sign} is not @code{NULL}, it
> +stores the sign of @var{arg} (-1, 0, or +1) into @code{*sign}.  The
> +magnitude is stored into @var{magnitude} as follows.  If @var{size}
> +and @var{magnitude} are bot address@hidden, then @var{magnitude} must
> +point to an array of at least @code{*size} bytes.  If @var{magnitude}
> +is large enough to hold the magnitude of @var{arg}, then this function
> +writes the magnitude into the @var{magnitude} array in little-endian
> +form, stores the number of bytes written into @code{*size}, and
> +returns @code{true}.  If @var{magnitude} is not large enough, it
> +stores the required size into @code{*size}, signals an error, and
> +returns @code{false}.  If @var{size} is not @code{NULL} and
> address@hidden is @code{NULL}, then the function stores the required
> +size into @code{*size} and returns @code{true}.
> address@hidden deftypefn

I think this text should tell more about how magnitude is put into the
MAGNITUDE array.  I needed to look at the implementation to find the
answer to that question.  Since the caller will have to make sure the
array is "large enough", I think the reader needs to know more about
this than this text reveals.

> address@hidden Function emacs_value make_big_integer (emacs_env 
> address@hidden, int sign, ptrdiff_t size, unsigned char *magnitude)
> +This function, which is available since Emacs 27, takes an
> +arbitrary-sized integer argument and returns a corresponding
> address@hidden object.

Same here.  In particular, the text mentions "integer argument", but
it's unclear to what exactly that alludes, as there's no "argument" in
the function's signature as shown.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]