mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 10:18:31 +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
|
@ -22,7 +22,7 @@
|
|||
* Returns position of first bit set.
|
||||
*
|
||||
* ctz(𝑥) 31^clz(𝑥) clz(𝑥)
|
||||
* uint32 𝑥 _bsf(𝑥) tzcnt(𝑥) ffs(𝑥) _bsr(𝑥) lzcnt(𝑥)
|
||||
* uint32 𝑥 bsf(𝑥) tzcnt(𝑥) ffs(𝑥) bsr(𝑥) lzcnt(𝑥)
|
||||
* 0x00000000 wut 32 0 wut 32
|
||||
* 0x00000001 0 0 1 0 31
|
||||
* 0x80000001 0 0 1 31 0
|
||||
|
@ -35,7 +35,7 @@
|
|||
* @param 𝑥 is a 64-bit integer
|
||||
* @return number in range 0..63 or undefined if 𝑥 is 0
|
||||
*/
|
||||
int(_bsfl)(long x) {
|
||||
int(bsfl)(long x) {
|
||||
unsigned l, r;
|
||||
x &= -x;
|
||||
l = x | x >> 32;
|
||||
|
@ -52,7 +52,7 @@ int(_bsfl)(long x) {
|
|||
* Returns position of first bit set.
|
||||
*
|
||||
* ctz(𝑥) 31^clz(𝑥) clz(𝑥)
|
||||
* uint32 𝑥 _bsf(𝑥) tzcnt(𝑥) ffs(𝑥) _bsr(𝑥) lzcnt(𝑥)
|
||||
* uint32 𝑥 bsf(𝑥) tzcnt(𝑥) ffs(𝑥) bsr(𝑥) lzcnt(𝑥)
|
||||
* 0x00000000 wut 32 0 wut 32
|
||||
* 0x00000001 0 0 1 0 31
|
||||
* 0x80000001 0 0 1 31 0
|
||||
|
@ -65,8 +65,8 @@ int(_bsfl)(long x) {
|
|||
* @param x is a 32-bit integer
|
||||
* @return number in range 0..31 or undefined if 𝑥 is 0
|
||||
*/
|
||||
int(_bsf)(int x) {
|
||||
return _bsf((unsigned)x);
|
||||
int(bsf)(int x) {
|
||||
return bsf((unsigned)x);
|
||||
}
|
||||
|
||||
__weak_reference(_bsfl, _bsfll);
|
||||
__weak_reference(bsfl, bsfll);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue