[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Byte swapping and bindat
From: |
Eli Zaretskii |
Subject: |
Re: Byte swapping and bindat |
Date: |
Sat, 11 Jun 2022 08:45:16 +0300 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: EMACS development team <emacs-devel@gnu.org>
> Date: Fri, 10 Jun 2022 17:42:41 -0400
>
> > It would be nice to have sint documented in the ELisp manual...
>
> Good point. I think it would also be nice to unify `uint` and `uintr`.
>
> What about the patch below?
Thanks.
> -@item uint @var{bitlen}
> -Unsigned integer in network byte order, with @var{bitlen} bits.
> +@item uint @var{bitlen} &optional @var{le}
> +Unsigned integer in network byte order (big-endian), with @var{bitlen} bits.
> @var{bitlen} has to be a multiple of 8.
> +If @var{le} is non-@code{nil}, then use little-endian.
^^^^^^^^^^^^^^^^^
"use little-endian byte order" is more clear.
> -@item uintr @var{bitlen}
> -Unsigned integer in little endian order, with @var{bitlen} bits.
> +@item sint @var{bitlen} @var{le}
> +Signed integer in network byte order (big-endian), with @var{bitlen} bits.
> @var{bitlen} has to be a multiple of 8.
> +If @var{le} is non-@code{nil}, then use little-endian.
Same here.
> @@ -849,8 +852,7 @@ bindat-type
> "Return the Bindat type value to pack&unpack TYPE.
> TYPE is a Bindat type expression. It can take the following forms:
>
> - uint BITLEN - Big-endian unsigned integer
> - uintr BITLEN - Little-endian unsigned integer
> + uint BITLEN [LE] - unsigned integer (big-endian if LE is nil)
> str LEN - Byte string
> strz [LEN] - Zero-terminated byte-string
> bits LEN - Bit vector (LEN is counted in bytes)
Do we want to say in the doc string that uintr is supported for
backward compatibility?