aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-08-20 21:03:24 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-08-20 21:03:24 +0000
commit66fe09eebb813b79e14279df11d723b433a973fb (patch)
tree5e2382045fa4be718fbb51aa9d2405dcc0b4813f /target-i386
parentf143efa60c44c65c22aeeb04217f3501e3d04b22 (diff)
downloadqemu-66fe09eebb813b79e14279df11d723b433a973fb.zip
qemu-66fe09eebb813b79e14279df11d723b433a973fb.tar.gz
qemu-66fe09eebb813b79e14279df11d723b433a973fb.tar.bz2
Use ARRAY_SIZE macro
Replace array size calculations with ARRAY_SIZE macro. Implemented with this Coccinelle semantic patch, adapted from Linux kernel: @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) Some files (*-dis.c, tests/*) had to be filtered out. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpuid.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index dcfd81b..dade145 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -543,7 +543,7 @@ static int check_features_against_host(x86_def_t *guest_def)
~CPUID_EXT3_SVM, ext3_feature_name, 0x80000001}};
cpu_x86_fill_host(&host_def);
- for (rv = 0, i = 0; i < sizeof (ft) / sizeof (ft[0]); ++i)
+ for (rv = 0, i = 0; i < ARRAY_SIZE(ft); ++i)
for (mask = 1; mask; mask <<= 1)
if (ft[i].check_feat & mask && *ft[i].guest_feat & mask &&
!(*ft[i].host_feat & mask)) {