From e0e53b2f1b7aaf341ddb629ce861e02b2ac95fad Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Fri, 4 Feb 2011 09:06:04 +0100 Subject: bitmap: add a generic bitmap and bitops library Add most used bitmap and bitops functions into bitmap.c and bitops.c. Theses functions are mostly copied from Linux kernel source. Some of these functions are already redefined in the VNC server. Some of them could be used for some block stuff. The yet yo be submitted NUMA work also need bitmaps. bitops_ffsl() and bitops_flsl() are here because bitops/bitmap works on unsigned long, not int, and we can't use current code because: * ffs only works on int * qemu_fls only works on int * ffsl is a GNU extension Signed-off-by: Corentin Chary Signed-off-by: Anthony Liguori --- osdep.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'osdep.h') diff --git a/osdep.h b/osdep.h index 8bd30d764..27eedcf10 100644 --- a/osdep.h +++ b/osdep.h @@ -57,6 +57,10 @@ #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#endif + #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif -- cgit v1.2.3