From 869b8ad499717eda4a1be04de4e516134123402c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 20 Jan 2007 18:06:38 -0800 Subject: [PATCH] Add _mesa_ffsll() for compatibility on OSes without ffsll(), and use it. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +- src/mesa/main/imports.c | 21 +++++++++++++++++++++ src/mesa/main/imports.h | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 57ee294f0cf..08741ad90f6 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -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<> 32); + if (bit != 0) + return 32 + bit; + + return 0; +#endif +} /** * Return number of bits set in given GLuint. diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 19a9478f76a..d9885dbeec4 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -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); -- 2.30.2