Skip to content
Snippets Groups Projects
Commit 441c691c authored by Moe Jette's avatar Moe Jette
Browse files

modify bit_fmt to use brackets whenever there is more than one bit

   set rather than one _set of_ consecutive bits. For example
   "1-3" is now printed as "[1-3]" and "3" stays the same, and
   "[1-3,5-6]" also stays the same
parent bc2f3423
No related branches found
No related tags found
No related merge requests found
......@@ -920,8 +920,10 @@ bit_fmt(char *str, int len, bitstr_t *b)
if (bit_test(b, bit)) {
count++;
start = bit;
while (bit+1 < _bitstr_bits(b) && bit_test(b, bit+1))
while (bit+1 < _bitstr_bits(b) && bit_test(b, bit+1)) {
bit++;
count++;
}
if (bit == start) /* add single bit position */
ret = snprintf(str+strlen(str),
len-strlen(str),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment