aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/arrayobj.c2
-rw-r--r--src/mesa/main/bitset.h2
-rw-r--r--src/mesa/main/buffers.c4
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp2
-rw-r--r--src/mesa/main/ffvertex_prog.c2
-rw-r--r--src/mesa/main/imports.c15
-rw-r--r--src/mesa/main/imports.h21
-rw-r--r--src/mesa/main/shaderapi.c1
8 files changed, 21 insertions, 28 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4b3e07b8517..29bfed8f51e 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -303,7 +303,7 @@ _mesa_update_array_object_max_element(struct gl_context *ctx,
GLuint min = ~0u;
while (enabled) {
- GLint attrib = _mesa_ffsll(enabled) - 1;
+ GLint attrib = ffsll(enabled) - 1;
enabled &= ~BITFIELD64_BIT(attrib);
min = update_min(min, &arrayObj->VertexAttrib[attrib]);
}
diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
index c27b4c474e0..28b3c127e75 100644
--- a/src/mesa/main/bitset.h
+++ b/src/mesa/main/bitset.h
@@ -88,7 +88,7 @@ __bitset_ffs(const BITSET_WORD *x, int n)
for (i = 0; i < n; i++) {
if (x[i])
- return _mesa_ffs(x[i]) + BITSET_WORDBITS * i;
+ return ffs(x[i]) + BITSET_WORDBITS * i;
}
return 0;
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index adea0f5f78e..46c785fc4dc 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -402,7 +402,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
if (n == 1) {
GLuint count = 0, destMask0 = destMask[0];
while (destMask0) {
- GLint bufIndex = _mesa_ffs(destMask0) - 1;
+ GLint bufIndex = ffs(destMask0) - 1;
if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
updated_drawbuffers(ctx);
fb->_ColorDrawBufferIndexes[count] = bufIndex;
@@ -417,7 +417,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
GLuint count = 0;
for (buf = 0; buf < n; buf++ ) {
if (destMask[buf]) {
- GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
+ GLint bufIndex = ffs(destMask[buf]) - 1;
/* only one bit should be set in the destMask[buf] field */
ASSERT(_mesa_bitcount(destMask[buf]) == 1);
if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 3596a3d3e0c..7b8d1fe9b50 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -295,7 +295,7 @@ need_saturate( GLuint mode )
static GLuint translate_tex_src_bit( GLbitfield bit )
{
ASSERT(bit);
- return _mesa_ffs(bit) - 1;
+ return ffs(bit) - 1;
}
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 19d319a56fe..f1ab7533395 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -378,7 +378,7 @@ static struct ureg swizzle1( struct ureg reg, int x )
static struct ureg get_temp( struct tnl_program *p )
{
- int bit = _mesa_ffs( ~p->temp_in_use );
+ int bit = ffs( ~p->temp_in_use );
if (!bit) {
_mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
exit(1);
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 2469e426595..bbc6ac6e240 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -458,9 +458,8 @@ _mesa_inv_sqrtf(float n)
* Find the first bit set in a word.
*/
int
-_mesa_ffs(int32_t i)
+ffs(int i)
{
-#if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__)
register int bit = 0;
if (i != 0) {
if ((i & 0xffff) == 0) {
@@ -482,9 +481,6 @@ _mesa_ffs(int32_t i)
bit++;
}
return bit;
-#else
- return ffs(i);
-#endif
}
@@ -495,23 +491,24 @@ _mesa_ffs(int32_t i)
* if no bits set.
*/
int
-_mesa_ffsll(int64_t val)
+ffsll(long long int val)
{
int bit;
assert(sizeof(val) == 8);
- bit = _mesa_ffs((int32_t)val);
+ bit = ffs((int) val);
if (bit != 0)
return bit;
- bit = _mesa_ffs((int32_t)(val >> 32));
+ bit = ffs((int) (val >> 32));
if (bit != 0)
return 32 + bit;
return 0;
}
-#endif
+#endif /* __GNUC__ */
+
#if !defined(__GNUC__) ||\
((__GNUC__ * 100 + __GNUC_MINOR__) < 304) /* Not gcc 3.4 or later */
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index b7e87439f4c..bcf125ada76 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -573,10 +573,15 @@ _mesa_init_sqrt_table(void);
#define ffsll __builtin_ffsll
#endif
-#define _mesa_ffs(i) ffs(i)
-#define _mesa_ffsll(i) ffsll(i)
+#else
+
+extern int ffs(int i);
+extern int ffsll(long long int i);
+
+#endif /*__ GNUC__ */
-#if ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */
+
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */
#define _mesa_bitcount(i) __builtin_popcount(i)
#define _mesa_bitcount_64(i) __builtin_popcountll(i)
#else
@@ -586,16 +591,6 @@ extern unsigned int
_mesa_bitcount_64(uint64_t n);
#endif
-#else
-extern int
-_mesa_ffs(int32_t i);
-
-extern int
-_mesa_ffsll(int64_t i);
-
-extern unsigned int
-_mesa_bitcount(unsigned int n);
-#endif
extern GLhalfARB
_mesa_float_to_half(float f);
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 8b68ebf9c87..0e655a0d8ef 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -928,6 +928,7 @@ _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
ctx->Driver.UseProgram(ctx, shProg);
}
+
/**
* Do validation of the given shader program.
* \param errMsg returns error message if validation fails.