public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/libdm/datastruct bitset.c
@ 2010-07-08 12:16 zkabelac
0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2010-07-08 12:16 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-07-08 12:16:16
Modified files:
libdm/datastruct: bitset.c
Log message:
Minor optimalization of _test_word.
Skip ffs() if (test >> bit) is 0.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/bitset.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/libdm/datastruct/bitset.c 2010/04/20 13:58:23 1.10
+++ LVM2/libdm/datastruct/bitset.c 2010/07/08 12:16:16 1.11
@@ -69,9 +69,9 @@
static int _test_word(uint32_t test, int bit)
{
- int next_set_bit;
+ uint32_t tb = test >> bit;
- return ((next_set_bit = ffs(test >> bit)) ? next_set_bit + bit - 1 : -1);
+ return (tb ? ffs(tb) + bit - 1 : -1);
}
int dm_bit_get_next(dm_bitset_t bs, int last_bit)
^ permalink raw reply [flat|nested] 2+ messages in thread
* LVM2/libdm/datastruct bitset.c
@ 2010-04-19 21:08 agk
0 siblings, 0 replies; 2+ messages in thread
From: agk @ 2010-04-19 21:08 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2010-04-19 21:08:32
Modified files:
libdm/datastruct: bitset.c
Log message:
Simplify dm_bitset_create. (ejt)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/bitset.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
--- LVM2/libdm/datastruct/bitset.c 2010/04/19 17:17:55 1.6
+++ LVM2/libdm/datastruct/bitset.c 2010/04/19 21:08:32 1.7
@@ -26,17 +26,14 @@
if (mem)
bs = dm_pool_zalloc(mem, size);
- else
- bs = dm_malloc(size);
+ else if ((bs = dm_malloc(size)))
+ memset(mem, 0, size);
if (!bs)
return NULL;
*bs = num_bits;
- if (!mem)
- dm_bit_clear_all(bs);
-
return bs;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-08 12:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08 12:16 LVM2/libdm/datastruct bitset.c zkabelac
-- strict thread matches above, loose matches on Subject: below --
2010-04-19 21:08 agk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).