Revision 6d59fec1

b/block.c
930 930
        bit = start % (sizeof(unsigned long) * 8);
931 931
        val = bs->dirty_bitmap[idx];
932 932
        if (dirty) {
933
            if (!(val & (1 << bit))) {
933
            if (!(val & (1UL << bit))) {
934 934
                bs->dirty_count++;
935
                val |= 1 << bit;
935
                val |= 1UL << bit;
936 936
            }
937 937
        } else {
938
            if (val & (1 << bit)) {
938
            if (val & (1UL << bit)) {
939 939
                bs->dirty_count--;
940
                val &= ~(1 << bit);
940
                val &= ~(1UL << bit);
941 941
            }
942 942
        }
943 943
        bs->dirty_bitmap[idx] = val;
......
2685 2685

  
2686 2686
    if (bs->dirty_bitmap &&
2687 2687
        (sector << BDRV_SECTOR_BITS) < bdrv_getlength(bs)) {
2688
        return bs->dirty_bitmap[chunk / (sizeof(unsigned long) * 8)] &
2689
            (1 << (chunk % (sizeof(unsigned long) * 8)));
2688
        return !!(bs->dirty_bitmap[chunk / (sizeof(unsigned long) * 8)] &
2689
            (1UL << (chunk % (sizeof(unsigned long) * 8))));
2690 2690
    } else {
2691 2691
        return 0;
2692 2692
    }

Also available in: Unified diff