unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Byte swapping and bindat
Date: Sat, 11 Jun 2022 08:45:16 +0300	[thread overview]
Message-ID: <83fskbzrbn.fsf@gnu.org> (raw)
In-Reply-To: <jwvpmjgfbf2.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Fri, 10 Jun 2022 17:42:41 -0400)

> 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?



      parent reply	other threads:[~2022-06-11  5:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87pmjglllc.fsf.ref@yahoo.com>
     [not found] ` <87pmjglllc.fsf@yahoo.com>
     [not found]   ` <jwv8rq4hcou.fsf-monnier+emacs@gnu.org>
     [not found]     ` <83mtekzf9f.fsf@gnu.org>
2022-06-10 21:42       ` Byte swapping and bindat Stefan Monnier
2022-06-11  0:55         ` Po Lu
2022-06-11  5:45         ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fskbzrbn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).