summaryrefslogtreecommitdiff
path: root/iflag.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-11-26 15:21:15 -0800
committerH. Peter Anvin <hpa@zytor.com>2013-11-26 15:21:15 -0800
commit80d18b55551e43f0c3e390550ecd396b90265fd3 (patch)
tree08cf085a5917431df2e01ccf1677699f6ababea6 /iflag.h
parent4b47c77d89adac7abd81f6a99a04d85d853d84d9 (diff)
downloadnasm-80d18b55551e43f0c3e390550ecd396b90265fd3.tar.gz
nasm-80d18b55551e43f0c3e390550ecd396b90265fd3.tar.bz2
nasm-80d18b55551e43f0c3e390550ecd396b90265fd3.zip
iflag: In iflag_cmp() scan from the most significant word down
In order for iflag_cmp() to return an ordering that makes sense, we need to scan from the most significant word downward. That way the bits with the higher index consistently are the more significant. This fixes the disassembler vendor selection algorithm. While we are doing that, make that dependency more explicit in the comments. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'iflag.h')
-rw-r--r--iflag.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/iflag.h b/iflag.h
index 0764a05..b1144be 100644
--- a/iflag.h
+++ b/iflag.h
@@ -43,9 +43,9 @@ static inline void iflag_set_all(iflag_t *f)
static inline int iflag_cmp(const iflag_t *a, const iflag_t *b)
{
- unsigned int i;
+ int i;
- for (i = 0; i < sizeof(a->field) / sizeof(a->field[0]); i++) {
+ for (i = sizeof(a->field) / sizeof(a->field[0]) - 1; i >= 0; i--) {
if (a->field[i] < b->field[i])
return -1;
else if (a->field[i] > b->field[i])