aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 482df94ea21e..1338469ac849 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -996,3 +996,25 @@ int bitmap_allocate_region(unsigned long *bitmap, int pos, int order)
996 return 0; 996 return 0;
997} 997}
998EXPORT_SYMBOL(bitmap_allocate_region); 998EXPORT_SYMBOL(bitmap_allocate_region);
999
1000/**
1001 * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
1002 * @dst: destination buffer
1003 * @src: bitmap to copy
1004 * @nbits: number of bits in the bitmap
1005 *
1006 * Require nbits % BITS_PER_LONG == 0.
1007 */
1008void bitmap_copy_le(void *dst, const unsigned long *src, int nbits)
1009{
1010 unsigned long *d = dst;
1011 int i;
1012
1013 for (i = 0; i < nbits/BITS_PER_LONG; i++) {
1014 if (BITS_PER_LONG == 64)
1015 d[i] = cpu_to_le64(src[i]);
1016 else
1017 d[i] = cpu_to_le32(src[i]);
1018 }
1019}
1020EXPORT_SYMBOL(bitmap_copy_le);