mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
Add _mesa_ffsll() for compatibility on OSes without ffsll(), and use it.
This commit is contained in:
parent
dbb54b234c
commit
869b8ad499
3 changed files with 25 additions and 1 deletions
|
|
@ -414,7 +414,7 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
|
|||
*/
|
||||
|
||||
while (tmp) {
|
||||
GLuint i = ffsll(tmp)-1;
|
||||
GLuint i = _mesa_ffsll(tmp)-1;
|
||||
struct brw_vertex_element *input = &brw->vb.inputs[i];
|
||||
|
||||
tmp &= ~((GLuint64EXT)1<<i);
|
||||
|
|
|
|||
|
|
@ -574,6 +574,27 @@ _mesa_ffs(int i)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
_mesa_ffsll(long long val)
|
||||
{
|
||||
#ifdef ffsll
|
||||
return ffsll(val);
|
||||
#else
|
||||
int bit;
|
||||
|
||||
assert(sizeof(val) == 8);
|
||||
|
||||
bit = ffs(val);
|
||||
if (bit != 0)
|
||||
return bit;
|
||||
|
||||
bit = ffs(val >> 32);
|
||||
if (bit != 0)
|
||||
return 32 + bit;
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of bits set in given GLuint.
|
||||
|
|
|
|||
|
|
@ -688,6 +688,9 @@ _mesa_pow(double x, double y);
|
|||
extern int
|
||||
_mesa_ffs(int i);
|
||||
|
||||
extern int
|
||||
_mesa_ffsll(long long i);
|
||||
|
||||
extern unsigned int
|
||||
_mesa_bitcount(unsigned int n);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue