On the statement of implementation strategy.
Zhu Zihao 29 Dec 2025 14:54 UTC
Hi, Schemers.
In the "Implementation" section, this SRFI says:
"Bitvectors are implemented as wrapped SRFI 160 u8vectors; for
simplicity and possibly for speed, they use a whole byte to represent
each bit, as Java and C# do."
It seems to express that Java and C# also implements bitvector (or other
bit container) by using a whole byte to represent each bit.However, I
don't seem to found any evidence to support this argument.
Here's a mirror of the source code of OpenJDK 7, which appeared long
before the finalization of this SRFI.
https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/BitSet.java#L63
The implementation of BitSet class doesn't use one byte for one bit, it
use long[] (which is 64 byte) and pack bits into it.
And here's the implementation of BitSet in newest OpenJDK
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/BitSet.java#L68
The implementation doesn't change too much.
And here's the implementation of BitArray in .NET framework.
https://github.com/microsoft/referencesource/blob/main/mscorlib/system/collections/bitarray.cs
Neither of them use "one byte for one bit".
Therefore, I hope the author of this SRFI can elaborate on this
statement.
--
Retrieve my PGP public key:
执行下列命令以获取我的 PGP 公有密钥:
gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC
Zihao / 閱卜錄