mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-14 15:09:09 +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
|
@ -32,7 +32,7 @@ static int tpdecode(const char *s, wint_t *out) {
|
|||
if ((wc = s[i++] & 255) == -1) return -1;
|
||||
}
|
||||
if (!(0 <= wc && wc <= 0x7F)) {
|
||||
msb = wc < 252 ? _bsr(~wc & 0xff) : 1;
|
||||
msb = wc < 252 ? bsr(~wc & 0xff) : 1;
|
||||
need = 7 - msb;
|
||||
wc &= ((1u << msb) - 1) | 0003;
|
||||
for (j = 1; j < need; ++j) {
|
||||
|
|
|
@ -190,6 +190,9 @@
|
|||
"__integer_pack"
|
||||
"__is_same"))
|
||||
|
||||
(cuda-builtin-types
|
||||
'("__syncthreads"))
|
||||
|
||||
(cosmopolitan-builtin-defines
|
||||
'("COSMOPOLITAN_CXX_START_"
|
||||
"COSMOPOLITAN_CXX_END_"
|
||||
|
@ -225,6 +228,7 @@
|
|||
gcc-builtin-functions-sync
|
||||
gcc-builtin-functions-ia32
|
||||
gxx-builtin-type-traits
|
||||
cuda-builtin-types
|
||||
cosmopolitan-builtin-defines
|
||||
cosmopolitan-builtin-functions))
|
||||
"\\_>")))
|
||||
|
|
|
@ -74,11 +74,13 @@
|
|||
"_OPENMP"))
|
||||
|
||||
(cuda
|
||||
'("__NVCC__"))
|
||||
'("__NVCC__"
|
||||
"__CUDA_ARCH__"))
|
||||
|
||||
(hip
|
||||
'("__HIP__"
|
||||
"__HIPCC__"
|
||||
"__HIP_PLATFORM_AMD__"
|
||||
"__HIP_DEVICE_COMPILE__"
|
||||
"__AMD__"
|
||||
"__AMDGCN__"
|
||||
|
|
|
@ -342,7 +342,7 @@ int LuaPopcnt(lua_State *L) {
|
|||
int LuaBsr(lua_State *L) {
|
||||
long x;
|
||||
if ((x = luaL_checkinteger(L, 1))) {
|
||||
lua_pushinteger(L, _bsrl(x));
|
||||
lua_pushinteger(L, bsrl(x));
|
||||
return 1;
|
||||
} else {
|
||||
luaL_argerror(L, 1, "zero");
|
||||
|
@ -353,7 +353,7 @@ int LuaBsr(lua_State *L) {
|
|||
int LuaBsf(lua_State *L) {
|
||||
long x;
|
||||
if ((x = luaL_checkinteger(L, 1))) {
|
||||
lua_pushinteger(L, _bsfl(x));
|
||||
lua_pushinteger(L, bsfl(x));
|
||||
return 1;
|
||||
} else {
|
||||
luaL_argerror(L, 1, "zero");
|
||||
|
|
|
@ -2147,7 +2147,7 @@ static void FreeStrings(struct Strings *l) {
|
|||
}
|
||||
|
||||
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 IndexAssets(void) {
|
||||
|
@ -2943,7 +2943,7 @@ static int GetDecimalWidth(long x) {
|
|||
}
|
||||
|
||||
static int GetOctalWidth(int x) {
|
||||
return !x ? 1 : x < 8 ? 2 : 1 + _bsr(x) / 3;
|
||||
return !x ? 1 : x < 8 ? 2 : 1 + bsr(x) / 3;
|
||||
}
|
||||
|
||||
static const char *DescribeCompressionRatio(char rb[8], uint8_t *zcf) {
|
||||
|
|
|
@ -93,7 +93,7 @@ int Census(struct Gc *G) {
|
|||
if (!~G->M[j]) {
|
||||
l += DWBITS;
|
||||
} else {
|
||||
l += _bsfl(~G->M[j]);
|
||||
l += bsfl(~G->M[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void Sweep(struct Gc *G) {
|
|||
for (; i < G->n; ++i) {
|
||||
m = G->M[i];
|
||||
if (~m) {
|
||||
j = _bsfl(~m);
|
||||
j = bsfl(~m);
|
||||
m >>= j;
|
||||
m <<= j;
|
||||
d -= j;
|
||||
|
@ -136,7 +136,7 @@ void Sweep(struct Gc *G) {
|
|||
}
|
||||
for (; i < G->n; b -= DWBITS, m = G->M[++i]) {
|
||||
for (; m; m &= ~((dword)1 << j)) {
|
||||
a = b + ~(j = _bsfl(m));
|
||||
a = b + ~(j = bsfl(m));
|
||||
Set(--d, MAKE(Relocate(G, LO(Get(a))), Relocate(G, HI(Get(a)))));
|
||||
SetShadow(d, MAKE(LO(GetShadow(a)), Relocate(G, HI(GetShadow(a)))));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ COSMOPOLITAN_C_START_
|
|||
#define HISTO(H, X) \
|
||||
do { \
|
||||
uint64_t x_ = X; \
|
||||
x_ = x_ ? _bsrl(x_) + 1 : x_; \
|
||||
x_ = x_ ? bsrl(x_) + 1 : x_; \
|
||||
++H[MIN(x_, ARRAYLEN(H) - 1)]; \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ int PrintChar(int fd, int s) {
|
|||
if (c == L'\n') Flush(fd);
|
||||
} else {
|
||||
d = c;
|
||||
e = kTpEnc[_bsrl(d) - 7];
|
||||
e = kTpEnc[bsrl(d) - 7];
|
||||
i = n = e & 255;
|
||||
do g_buffer[fd][bp[fd] + i--] = 0200 | (d & 077);
|
||||
while (d >>= 6, i);
|
||||
|
|
|
@ -51,7 +51,7 @@ void PrintBar(unsigned char *p, size_t n) {
|
|||
}
|
||||
for (i = 0; i < j; ++i) {
|
||||
if (p[i]) {
|
||||
fputwc(u"░░▒▒▓▓██"[_bsr(p[i])], stdout);
|
||||
fputwc(u"░░▒▒▓▓██"[bsr(p[i])], stdout);
|
||||
} else {
|
||||
fputc(' ', stdout);
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ void *BilinearScale(long dcw, long dyw, long dxw,
|
|||
DCHECK_LE(sxn, sxw);
|
||||
DCHECK_LE(dyn, dyw);
|
||||
DCHECK_LE(dxn, dxw);
|
||||
DCHECK_LT(_bsrl(cn) + _bsrl(syn) + _bsrl(sxn), 32);
|
||||
DCHECK_LT(_bsrl(cn) + _bsrl(dyn) + _bsrl(dxn), 32);
|
||||
DCHECK_LT(bsrl(cn) + bsrl(syn) + bsrl(sxn), 32);
|
||||
DCHECK_LT(bsrl(cn) + bsrl(dyn) + bsrl(dxn), 32);
|
||||
BilinearScaler(dcw, dyw, dxw, dst, scw, syw, sxw, src, c0, cn, dyn, dxn,
|
||||
syn, sxn, ry, rx, oy, ox,
|
||||
gc(xmemalign(64, ROUNDUP(sizeof(int) * (dyn + 1), 64))),
|
||||
|
|
|
@ -84,11 +84,11 @@ struct YCbCr {
|
|||
};
|
||||
|
||||
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 unsigned long rounddown2pow(unsigned long x) {
|
||||
return x ? 1ul << _bsrl(x) : 0;
|
||||
return x ? 1ul << bsrl(x) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,7 +190,7 @@ static void LeaveScreen(void) {
|
|||
}
|
||||
|
||||
static unsigned long rounddown2pow(unsigned long x) {
|
||||
return x ? 1ul << _bsrl(x) : 0;
|
||||
return x ? 1ul << bsrl(x) : 0;
|
||||
}
|
||||
|
||||
static void GetTtySize(void) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue