mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
Convert bitvectors to use inline-only word-size units
* libguile/bitvectors.h: Unit of bitvectors is scm_t_bits, not uint32_t. * libguile/bitvectors.c: Adapt implementation. (make_bitvector): Malloc pointerless instead, with inline bits. * libguile/posix.c (scm_setaffinity): * libguile/bytevectors.c (uniform-array->bytevector): Adapt to unit size change. * module/system/vm/assembler.scm (intern-constant, link-data): Adapt to bitvector representation change.
This commit is contained in:
parent
9ff7c0651c
commit
d6e59a1d3e
5 changed files with 303 additions and 208 deletions
|
@ -2341,12 +2341,13 @@ SCM_DEFINE (scm_setaffinity, "setaffinity", 2, 0, 0,
|
|||
{
|
||||
cpu_set_t cs;
|
||||
scm_t_array_handle handle;
|
||||
const uint32_t *c_mask;
|
||||
const scm_t_bits *c_mask;
|
||||
size_t len, off, cpu;
|
||||
ssize_t inc;
|
||||
int err;
|
||||
|
||||
c_mask = scm_bitvector_elements (mask, &handle, &off, &len, &inc);
|
||||
size_t bits_per_word = sizeof (scm_t_bits) * 8;
|
||||
|
||||
CPU_ZERO (&cs);
|
||||
for (cpu = 0; cpu < len; cpu++)
|
||||
|
@ -2354,7 +2355,7 @@ SCM_DEFINE (scm_setaffinity, "setaffinity", 2, 0, 0,
|
|||
size_t idx;
|
||||
|
||||
idx = cpu * inc + off;
|
||||
if (c_mask[idx / 32] & (1UL << (idx % 32)))
|
||||
if (c_mask[idx / bits_per_word] & (1UL << (idx % bits_per_word)))
|
||||
CPU_SET (cpu, &cs);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue