aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Vrabel <dv02@dv02pc01.europe.root.pri>2008-10-10 11:47:31 +0100
committerDavid Vrabel <dv02@dv02pc01.europe.root.pri>2008-10-10 11:47:31 +0100
commit99ee3a6d4577e7633c66304e4aefeca5489c8d5c (patch)
tree94dbf1db8b2efb6b4fdaf6fdaa86de655c64ff1c /lib
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
parentedfa042c880f62848aa55b3e71e538fe383929da (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb into for-upstream
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 06fb57c86de..c2006bfeea4 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -1007,3 +1007,25 @@ int bitmap_allocate_region(unsigned long *bitmap, int pos, int order)
return 0;
}
EXPORT_SYMBOL(bitmap_allocate_region);
+
+/**
+ * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
+ * @dst: destination buffer
+ * @src: bitmap to copy
+ * @nbits: number of bits in the bitmap
+ *
+ * Require nbits % BITS_PER_LONG == 0.
+ */
+void bitmap_copy_le(void *dst, const unsigned long *src, int nbits)
+{
+ unsigned long *d = dst;
+ int i;
+
+ for (i = 0; i < nbits/BITS_PER_LONG; i++) {
+ if (BITS_PER_LONG == 64)
+ d[i] = cpu_to_le64(src[i]);
+ else
+ d[i] = cpu_to_le32(src[i]);
+ }
+}
+EXPORT_SYMBOL(bitmap_copy_le);