mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-21 19:20:21 +02:00
Rewrite jit_regset_scan1 for easier optimization.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h, include/lightning/jit_hppa.h, include/lightning/jit_ia64.h, include/lightning/jit_mips.h, include/lightning/jit_ppc.h, include/lightning/jit_s390x.h, include/lightning/jit_sparc.h, include/lightning/jit_x86.h: Change jit_regset_t to an unsigned type, to allow safe right shift. * lib/lightning.c: Rewrite jit_regset_scan1 to allow easier compiler optimization.
This commit is contained in:
parent
b1d3217b63
commit
6e75c0352d
11 changed files with 33 additions and 16 deletions
|
@ -496,10 +496,15 @@ jit_regset_scan1(jit_regset_t *set, jit_int32_t offset)
|
|||
unsigned long
|
||||
jit_regset_scan1(jit_regset_t *set, jit_int32_t offset)
|
||||
{
|
||||
jit_regset_t mask;
|
||||
assert(offset >= 0 && offset <= 63);
|
||||
for (; offset < 64; offset++) {
|
||||
if (*set & (1LL << offset))
|
||||
return (offset);
|
||||
if ((mask = *set >> offset)) {
|
||||
for (;;) {
|
||||
if (mask & 1)
|
||||
return (offset);
|
||||
mask >>= 1;
|
||||
++offset;
|
||||
}
|
||||
}
|
||||
return (ULONG_MAX);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue