emacs-devel
[Top][All Lists]
Advanced

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

Re: struct.el -- a package to encode/decode binary data


From: Eli Zaretskii
Subject: Re: struct.el -- a package to encode/decode binary data
Date: Fri, 22 Mar 2002 13:04:11 +0200

> From: "Stefan Monnier" <monnier+gnu/address@hidden>
> Date: Thu, 21 Mar 2002 20:05:09 -0500
> 
> > Most of them, those between 160 and 255 _are_ represented as a single
> > byte, even in a multibyte string/buffer.  That's the eight-bit-graphic
> > character set.
> 
> Interesting.  It still means that binary values between 128 and 160
> (i.e. from eight-bit-control) are posing problems when calling `aset'.

Yes, that's true.  So moving through a multibyte buffer/string with
binary data is slightly less efficient than with unibyte buffer/string
(assuming a uniform distribution of possible 8-bit values in the range
[0..255]).  Moving *back* through such buffers/strings is especially
painful, since you cannot in advance find the head of the multibyte
sequence, which tells how many bytes to move to skip the character.

However, I think in code that constructs numbers from binary data you
don't normally need to move back, or use aset.  You normally need to
move/scan forward a small number of bytes, while you accumulate their
values into a number.  That should be reasonably efficient, and so
using unibyte strings doesn't seem to be justified.



reply via email to

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