[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/7] bitset: style: use consistent names
From: |
Akim Demaille |
Subject: |
[PATCH 3/7] bitset: style: use consistent names |
Date: |
Sun, 29 Nov 2020 17:42:17 +0100 |
* bitset/list.c (lbitset_list_reverse): Rename 'bcount' as 'bitcnt',
and 'boffset' as 'bitoff', for consistency with the other
implementations.
* bitset/table.c (tbitset_list_reverse): Likewise.
---
ChangeLog | 8 ++++++++
lib/bitset/list.c | 24 ++++++++++++------------
lib/bitset/table.c | 20 ++++++++++----------
3 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7f83f5e1d..48d6191dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-29 Akim Demaille <akim@lrde.epita.fr>
+
+ bitset: style: use consistent names
+ * bitset/list.c (lbitset_list_reverse): Rename 'bcount' as 'bitcnt',
+ and 'boffset' as 'bitoff', for consistency with the other
+ implementations.
+ * bitset/table.c (tbitset_list_reverse): Likewise.
+
2020-11-29 Akim Demaille <akim@lrde.epita.fr>
bitset: style: sort header
diff --git a/lib/bitset/list.c b/lib/bitset/list.c
index 96f163087..e931fe1ca 100644
--- a/lib/bitset/list.c
+++ b/lib/bitset/list.c
@@ -580,21 +580,21 @@ lbitset_list_reverse (bitset bset, bitset_bindex *list,
if (!elt)
return 0;
- unsigned bcount;
+ unsigned bitcnt;
if (windex >= elt->index + LBITSET_ELT_WORDS)
{
/* We are trying to start in no-mans land so start
at end of current elt. */
- bcount = BITSET_WORD_BITS - 1;
+ bitcnt = BITSET_WORD_BITS - 1;
windex = elt->index + LBITSET_ELT_WORDS - 1;
}
else
{
- bcount = bitno % BITSET_WORD_BITS;
+ bitcnt = bitno % BITSET_WORD_BITS;
}
bitset_bindex count = 0;
- bitset_bindex boffset = windex * BITSET_WORD_BITS;
+ bitset_bindex bitoff = windex * BITSET_WORD_BITS;
/* If num is 1, we could speed things up with a binary search
of the word of interest. */
@@ -604,20 +604,20 @@ lbitset_list_reverse (bitset bset, bitset_bindex *list,
bitset_word *srcp = elt->words;
for (; (windex - elt->index) < LBITSET_ELT_WORDS;
- windex--, boffset -= BITSET_WORD_BITS,
- bcount = BITSET_WORD_BITS - 1)
+ windex--, bitoff -= BITSET_WORD_BITS,
+ bitcnt = BITSET_WORD_BITS - 1)
{
bitset_word word =
- srcp[windex - elt->index] << (BITSET_WORD_BITS - 1 - bcount);
+ srcp[windex - elt->index] << (BITSET_WORD_BITS - 1 - bitcnt);
- for (; word; bcount--)
+ for (; word; bitcnt--)
{
if (word & BITSET_MSB)
{
- list[count++] = boffset + bcount;
+ list[count++] = bitoff + bitcnt;
if (count >= num)
{
- *next = n_bits - (boffset + bcount);
+ *next = n_bits - (bitoff + bitcnt);
return count;
}
}
@@ -629,11 +629,11 @@ lbitset_list_reverse (bitset bset, bitset_bindex *list,
if (elt)
{
windex = elt->index + LBITSET_ELT_WORDS - 1;
- boffset = windex * BITSET_WORD_BITS;
+ bitoff = windex * BITSET_WORD_BITS;
}
}
- *next = n_bits - (boffset + 1);
+ *next = n_bits - (bitoff + 1);
return count;
}
diff --git a/lib/bitset/table.c b/lib/bitset/table.c
index 3643b6074..48c88e02b 100644
--- a/lib/bitset/table.c
+++ b/lib/bitset/table.c
@@ -550,8 +550,8 @@ tbitset_list_reverse (bitset bset, bitset_bindex *list,
/* If num is 1, we could speed things up with a binary search
of the word of interest. */
bitset_bindex count = 0;
- unsigned bcount = bitno % BITSET_WORD_BITS;
- bitset_bindex boffset = windex * BITSET_WORD_BITS;
+ unsigned bitcnt = bitno % BITSET_WORD_BITS;
+ bitset_bindex bitoff = windex * BITSET_WORD_BITS;
do
{
@@ -562,32 +562,32 @@ tbitset_list_reverse (bitset bset, bitset_bindex *list,
do
{
- for (bitset_word word = srcp[woffset] << (BITSET_WORD_BITS - 1 -
bcount);
- word; bcount--)
+ for (bitset_word word = srcp[woffset] << (BITSET_WORD_BITS - 1 -
bitcnt);
+ word; bitcnt--)
{
if (word & BITSET_MSB)
{
- list[count++] = boffset + bcount;
+ list[count++] = bitoff + bitcnt;
if (count >= num)
{
- *next = n_bits - (boffset + bcount);
+ *next = n_bits - (bitoff + bitcnt);
return count;
}
}
word <<= 1;
}
- boffset -= BITSET_WORD_BITS;
- bcount = BITSET_WORD_BITS - 1;
+ bitoff -= BITSET_WORD_BITS;
+ bitcnt = BITSET_WORD_BITS - 1;
}
while (woffset--);
}
woffset = TBITSET_ELT_WORDS - 1;
- boffset = eindex * TBITSET_ELT_BITS - BITSET_WORD_BITS;
+ bitoff = eindex * TBITSET_ELT_BITS - BITSET_WORD_BITS;
}
while (eindex--);
- *next = n_bits - (boffset + 1);
+ *next = n_bits - (bitoff + 1);
return count;
}
--
2.29.2
- [PATCH 0/7] bitset: use integrer_length in reverse iterations, Akim Demaille, 2020/11/29
- [PATCH 1/7] bitset: tests: check BITSET_FOR_EACH_REVERSE, Akim Demaille, 2020/11/29
- [PATCH 2/7] bitset: style: sort header, Akim Demaille, 2020/11/29
- [PATCH 3/7] bitset: style: use consistent names,
Akim Demaille <=
- [PATCH 4/7] bitset: use integrer_length in array implementation, Akim Demaille, 2020/11/29
- [PATCH 5/7] bitset: use integrer_length in vector implementation, Akim Demaille, 2020/11/29
- [PATCH 6/7] bitset: use integrer_length in list implementation, Akim Demaille, 2020/11/29
- [PATCH 7/7] bitset: use integrer_length in table implementation, Akim Demaille, 2020/11/29