return false;
if (unusedBits > 0) {
- if ((bitmap->map[sz] & ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
- != ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+ if ((bitmap->map[sz] & ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+ != ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
return false;
}
return ret;
}
+static int test7(const void *v ATTRIBUTE_UNUSED)
+{
+ virBitmapPtr bitmap;
+ size_t i;
+ size_t maxBit[] = {
+ 1, 8, 31, 32, 63, 64, 95, 96, 127, 128, 159, 160
+ };
+ size_t nmaxBit = 12;
+
+ for (i = 0; i < nmaxBit; i++) {
+ bitmap = virBitmapNew(maxBit[i]);
+ if (!bitmap)
+ goto error;
+
+ if (virBitmapIsAllSet(bitmap))
+ goto error;
+
+ ignore_value(virBitmapSetBit(bitmap, 1));
+ if (virBitmapIsAllSet(bitmap))
+ goto error;
+
+ virBitmapSetAll(bitmap);
+ if (!virBitmapIsAllSet(bitmap))
+ goto error;
+
+ virBitmapFree(bitmap);
+ }
+
+ return 0;
+
+error:
+ virBitmapFree(bitmap);
+ return -1;
+}
+
static int
mymain(void)
{
ret = -1;
if (virtTestRun("test6", 1, test6, NULL) < 0)
ret = -1;
+ if (virtTestRun("test7", 1, test7, NULL) < 0)
+ ret = -1;
return ret;