summaryrefslogtreecommitdiffstats
path: root/sys/geom/stripe
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-08-19 22:10:19 +0000
committerpjd <pjd@FreeBSD.org>2005-08-19 22:10:19 +0000
commit863deb3c00d07683cfba7aca2e35643099e42dd7 (patch)
treee6549a4db754594b874a82ce52323ca5ea203760 /sys/geom/stripe
parentcb1c3eea784bed67621adba223b0549ec5730a77 (diff)
downloadFreeBSD-src-863deb3c00d07683cfba7aca2e35643099e42dd7.zip
FreeBSD-src-863deb3c00d07683cfba7aca2e35643099e42dd7.tar.gz
Avoid code duplication and implement bitcount32() function in systm.h only.
Reviewed by: cperciva MFC after: 3 days
Diffstat (limited to 'sys/geom/stripe')
-rw-r--r--sys/geom/stripe/g_stripe.c2
-rw-r--r--sys/geom/stripe/g_stripe.h6
2 files changed, 1 insertions, 7 deletions
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 3f66102..eea2ad1 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -792,7 +792,7 @@ g_stripe_create(struct g_class *mp, const struct g_stripe_metadata *md,
sc->sc_id = md->md_id;
sc->sc_stripesize = md->md_stripesize;
- sc->sc_stripebits = BITCOUNT(sc->sc_stripesize - 1);
+ sc->sc_stripebits = bitcount32(sc->sc_stripesize - 1);
sc->sc_ndisks = md->md_all;
sc->sc_disks = malloc(sizeof(struct g_consumer *) * sc->sc_ndisks,
M_STRIPE, M_WAITOK | M_ZERO);
diff --git a/sys/geom/stripe/g_stripe.h b/sys/geom/stripe/g_stripe.h
index b343e23..1b6e2e5 100644
--- a/sys/geom/stripe/g_stripe.h
+++ b/sys/geom/stripe/g_stripe.h
@@ -120,10 +120,4 @@ stripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)
md->md_provsize = le64dec(data + 64);
}
-#ifndef BITCOUNT
-#define BITCOUNT(x) (((BX_(x) + (BX_(x) >> 4)) & 0x0F0F0F0F) % 255)
-#define BX_(x) ((x) - (((x) >> 1) & 0x77777777) - \
- (((x) >> 2) & 0x33333333) - (((x) >> 3) & 0x11111111))
-#endif
-
#endif /* _G_STRIPE_H_ */
OpenPOWER on IntegriCloud