/usr/include/osl/misc/slowBsf.h is in libosl-dev 0.6.0-3.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* slowBsf.h
*/
#ifndef OSL_SLOWBSF_H
#define OSL_SLOWBSF_H
namespace osl
{
namespace misc
{
/**
* non-0 の時に呼ぶべし.
* やはりどう考えても遅い
*/
inline int slowbsf(unsigned int mask){
assert(mask);
int mask0= (static_cast<int>(-(mask&0xffff)))>>31;
mask&=(mask0^0xffff0000);
int mask1= (static_cast<int>(-(mask&0xff00ff)))>>31;
mask&=(mask1^0xff00ff00);
int mask2= (static_cast<int>(-(mask&0xf0f0f0f)))>>31;
mask&=(mask2^0xf0f0f0f0);
int mask3= (static_cast<int>(-(mask&0x33333333)))>>31;
mask&=(mask3^0xcccccccc);
int mask4= (static_cast<int>(-(mask&0x55555555)))>>31;
return 31+(mask0&0xfffffff0)+(mask1&0xfffffff8)+
(mask2&0xfffffffc)+(mask3&0xfffffffe)+mask4;
}
} // namespace misc
} // namespace osl
#endif /* OSL_SLOWBSF_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|