From: Juan Quintela Date: Tue, 8 Oct 2013 14:12:17 +0000 (+0200) Subject: bitmap: Add bitmap_zero_extend operation X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~386^2~42^2~242^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=164590a60fd685399da259ac41b338d9a0b9d6c0;p=sdk%2Femulator%2Fqemu.git bitmap: Add bitmap_zero_extend operation Signed-off-by: Juan Quintela Reviewed-by: Eric Blake Reviewed-by: Orit Wasserman --- diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index afdd257d8f..1babd5d812 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -220,4 +220,13 @@ unsigned long bitmap_find_next_zero_area(unsigned long *map, unsigned long nr, unsigned long align_mask); +static inline unsigned long *bitmap_zero_extend(unsigned long *old, + long old_nbits, long new_nbits) +{ + long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long); + unsigned long *new = g_realloc(old, new_len); + bitmap_clear(new, old_nbits, new_nbits - old_nbits); + return new; +} + #endif /* BITMAP_H */