This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bitstrings (sets in Chill and Pascal)
Hi!
Sorry for the late answer, but I overlooked this message at the
beginning of September.
Per Bothner wrote:
> (a) Do we pad the length of a bitstring to a multiple of some
> fixed word size? We at least want to pad to a multiple of
> a byte, but for performance reasons it makes sense to use
> a larger multiple.
For Pascal, we have been using units of BITS_PER_WORD bits.
These days, I changed it to BITS_PER_UNIT for compatibility
with Chill, but I'd prefer to set it back. (It's only one
line to change anyway ...:)
> (b) What alignment do you use? I.e. if you have a Pascal
> set S of type 3..10, is S aligned so that (3 IN S) checks
> bit 3 of the representing word, or bit 0? If your language
> allows you to AND a set of 3..10 with one of 5..20, it is
> obviously easier to do this if both are aligned the same way.
> I believe this is an issue for Pascal, but not Chill.
It is an issue for Pascal, and we align our sets.
> (c) Which bit is bit #0? There are two plausible choices:
> Little-endien order on all platforms, or machine order.
For Pascal, we are using Little-endian.
> Using a fixed little-endian order is easiest to implement,
> but it does require a consistent word-size.
Exactly.
> I don't believe those old constraints are an issue any more,
> so we are free to re-define a bitstring representation that
> makes sense. If e do that, it should take into account the
> needs for Pascal sets: It would make sense to use the same
> representation for both languages.
Agreed. :)
> I don't know if that
> is possible; my impression is Pascal implementations use a
> more complex representation, but presumably they could still
> build on top of a consistent array-of-words model.
Currently, the only sets we have are bitstrings like in Chill.
We are planning to support non-constant bounds, sparse sets and
other complicated stuff in the future.
> Partly in frustration over the situation, I started work on
> what I optimistically called "the GNU BitString Library".
Hmm... meanwhile we have something similar in the GPC runtime
library.
Peter
--
http://home.pages.de/~Peter.Gerwinski/ - G-N-U GmbH: http://www.g-n-u.de
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118
GnuPG key fingerprint: 9E7C 0FC4 8A62 5536 1730 A932 9834 65DB 2143 9422
keys: ftp://ftp.gerwinski.de/pub/keys/ - AntiSpam: http://spam.abuse.net