summaryrefslogtreecommitdiff
path: root/libguile/bytevectors.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-03 21:45:34 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-03 21:48:48 +0100
commitd65514a2de2ef922d3613f0e35dea27a88313392 (patch)
tree7019c09ba8b323b0de16c0871a4b1b1373eb2226 /libguile/bytevectors.c
parent9ae9debbd35505ef4040c1a876f7bd64434d6d14 (diff)
downloadguile-d65514a2de2ef922d3613f0e35dea27a88313392.tar.gz
RTL compiler supports static bitvectors
* libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): For bitvectors, round up the length to 32-bit units, as they are stored internally. Otherwise I think this probably does the wrong thing for the last word on big-endian systems. * libguile/bitvectors.c (BITVECTOR_LENGTH, BITVECTOR_BITS): (scm_c_make_bitvector): Reorder the length and pointer words to match the layout of bytevectors. * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/system/vm/assembler.scm (br-if-bitvector): * module/system/vm/disassembler.scm (code-annotation): Add bitvector test support. * module/system/vm/assembler.scm (<uniform-vector-backing-store>): Add an element-size field. (intern-constant): Adapt make-uniform-vector-backing-store call. Use uniform-array->bytevector, as the old compiler did. (link-data): Add bitvector cases.
Diffstat (limited to 'libguile/bytevectors.c')
-rw-r--r--libguile/bytevectors.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index f91b8451c..064c427ed 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -649,8 +649,9 @@ SCM_DEFINE (scm_uniform_array_to_bytevector, "uniform-array->bytevector",
if (sz >= 8 && ((sz % 8) == 0))
byte_len = len * (sz / 8);
else if (sz < 8)
- /* byte_len = ceil (len * sz / 8) */
- byte_len = (len * sz + 7) / 8;
+ /* Elements of sub-byte size (bitvectors) are addressed in 32-bit
+ units. */
+ byte_len = ((len * sz + 31) / 32) * 4;
else
/* an internal guile error, really */
SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole bytes", SCM_EOL);