mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-26 04:20:30 +00:00
Rename _bsr/_bsf to bsr/bsf
Now that these functions are behind _COSMO_SOURCE there's no reason for having the ugly underscore anymore. To use these functions, you need to pass -mcosmo to cosmocc.
This commit is contained in:
parent
a6baba1b07
commit
8bfd56b59e
53 changed files with 110 additions and 93 deletions
2
third_party/chibicc/as.c
vendored
2
third_party/chibicc/as.c
vendored
|
@ -2028,7 +2028,7 @@ static int ParseModrm(struct As *a, int *disp) {
|
|||
if (((reg & 070) >> 3) == 2) modrm |= HASASZ; // asz
|
||||
if (IsComma(a)) {
|
||||
++a->i;
|
||||
modrm |= (_bsr(GetInt(a)) & 3) << 6;
|
||||
modrm |= (bsr(GetInt(a)) & 3) << 6;
|
||||
}
|
||||
}
|
||||
ConsumePunct(a, ')');
|
||||
|
|
14
third_party/chibicc/asm.c
vendored
14
third_party/chibicc/asm.c
vendored
|
@ -301,7 +301,7 @@ static void PickAsmRegisters(Asm *a) {
|
|||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= regset)) CouldNotAllocateRegister(&a->ops[i], "rm");
|
||||
pick = 1 << (a->ops[i].reg = _bsf(m));
|
||||
pick = 1 << (a->ops[i].reg = bsf(m));
|
||||
if (pick & PRECIOUS) a->regclob |= pick;
|
||||
regset &= ~pick;
|
||||
a->ops[i].regmask = 0;
|
||||
|
@ -309,14 +309,14 @@ static void PickAsmRegisters(Asm *a) {
|
|||
case kAsmXmm:
|
||||
if (!(m = a->ops[i].regmask)) break;
|
||||
if (!(m &= xmmset)) CouldNotAllocateRegister(&a->ops[i], "xmm");
|
||||
xmmset &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
xmmset &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
a->ops[i].regmask = 0;
|
||||
break;
|
||||
case kAsmFpu:
|
||||
if (!(m = a->ops[i].x87mask)) break;
|
||||
if (popcnt(m) != j) break;
|
||||
if (!(m &= x87sts)) CouldNotAllocateRegister(&a->ops[i], "fpu");
|
||||
x87sts &= ~(1 << (a->ops[i].reg = _bsf(m)));
|
||||
x87sts &= ~(1 << (a->ops[i].reg = bsf(m)));
|
||||
a->ops[i].x87mask = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -540,7 +540,7 @@ static char *HandleAsmSpecifier(Asm *a, char *p) {
|
|||
if ((i = c - '0') >= a->n) {
|
||||
error_tok(a->tok, "bad asm reference at offset %d", p - a->str);
|
||||
}
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
if (z > 3 && a->ops[i].type == kAsmReg) {
|
||||
error_tok(a->tok, "bad asm op size");
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
println("\tset%s\t(%%rax)", a->ops[i].str + a->ops[i].predicate);
|
||||
break;
|
||||
case kAsmReg:
|
||||
z = _bsr(a->ops[i].node->ty->size);
|
||||
z = bsr(a->ops[i].node->ty->size);
|
||||
if (a->ops[i].reg) {
|
||||
gen_addr(a->ops[i].node);
|
||||
if (z > 3) error_tok(a->tok, "bad asm out size");
|
||||
|
@ -734,7 +734,7 @@ static void StoreAsmOutputs(Asm *a) {
|
|||
static void PushClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = _bsf(regs);
|
||||
i = bsf(regs);
|
||||
pushreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ static void PushClobbers(Asm *a) {
|
|||
static void PopClobbers(Asm *a) {
|
||||
int i, regs = a->regclob & PRECIOUS;
|
||||
while (regs) {
|
||||
i = _bsr(regs);
|
||||
i = bsr(regs);
|
||||
popreg(kGreg[3][i]);
|
||||
regs &= ~(1 << i);
|
||||
}
|
||||
|
|
2
third_party/chibicc/dox2.c
vendored
2
third_party/chibicc/dox2.c
vendored
|
@ -281,7 +281,7 @@ static int CompareDoxIndexEntry(const void *p1, const void *p2, void *arg) {
|
|||
}
|
||||
|
||||
static unsigned long roundup2pow(unsigned long x) {
|
||||
return x > 1 ? 2ul << _bsrl(x - 1) : x ? 1 : 0;
|
||||
return x > 1 ? 2ul << bsrl(x - 1) : x ? 1 : 0;
|
||||
}
|
||||
|
||||
static void IndexDox(struct Dox *dox) {
|
||||
|
|
4
third_party/chibicc/file.c
vendored
4
third_party/chibicc/file.c
vendored
|
@ -67,7 +67,7 @@ void canonicalize_newline(char *p) {
|
|||
p += 16;
|
||||
q += 16;
|
||||
} else {
|
||||
m = _bsf(m);
|
||||
m = bsf(m);
|
||||
memmove(q, p, m);
|
||||
p += m;
|
||||
q += m;
|
||||
|
@ -126,7 +126,7 @@ void remove_backslash_newline(char *p) {
|
|||
i += 16;
|
||||
j += 16;
|
||||
} else {
|
||||
m = _bsf(m);
|
||||
m = bsf(m);
|
||||
memmove(p + j, p + i, m);
|
||||
i += m;
|
||||
j += m;
|
||||
|
|
2
third_party/chibicc/test/implicit_test.c
vendored
2
third_party/chibicc/test/implicit_test.c
vendored
|
@ -9,7 +9,7 @@ implicit_functions_are_long() {
|
|||
}
|
||||
|
||||
external_functions_are_long() {
|
||||
if (_bsrl(0x0001000000000000) != 48) {
|
||||
if (bsrl(0x0001000000000000) != 48) {
|
||||
__builtin_trap();
|
||||
}
|
||||
}
|
||||
|
|
2
third_party/chibicc/tokenize.c
vendored
2
third_party/chibicc/tokenize.c
vendored
|
@ -680,7 +680,7 @@ static void convert_universal_chars(char *p) {
|
|||
p += 16;
|
||||
q += 16;
|
||||
} else {
|
||||
m = _bsf(m);
|
||||
m = bsf(m);
|
||||
memmove(q, p, m);
|
||||
p += m;
|
||||
q += m;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue