Mesa (master): mesa: Simplify a bit of _mesa_add_state_reference using memcmp.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Oct 8 17:25:39 UTC 2010
Module: Mesa
Branch: master
Commit: e310c22bb738e024faadca8dba16fa53e7215a3e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e310c22bb738e024faadca8dba16fa53e7215a3e
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 7 22:24:38 2010 -0700
mesa: Simplify a bit of _mesa_add_state_reference using memcmp.
---
src/mesa/program/prog_parameter.c | 15 +++------------
1 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 6bf8a08..3570cab 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -378,18 +378,9 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
/* Check if the state reference is already in the list */
for (index = 0; index < (GLint) paramList->NumParameters; index++) {
- GLuint i, match = 0;
- for (i = 0; i < STATE_LENGTH; i++) {
- if (paramList->Parameters[index].StateIndexes[i] == stateTokens[i]) {
- match++;
- }
- else {
- break;
- }
- }
- if (match == STATE_LENGTH) {
- /* this state reference is already in the parameter list */
- return index;
+ if (!memcmp(paramList->Parameters[index].StateIndexes,
+ stateTokens, STATE_LENGTH * sizeof(gl_state_index))) {
+ return index;
}
}
More information about the mesa-commit
mailing list