no branches in digit parser
This commit is contained in:
parent
79ac78db85
commit
9d2ff1b9c7
21
vcd_spans.c
21
vcd_spans.c
@ -144,25 +144,10 @@ int onDigit(
|
||||
vcd_parser_t* state,
|
||||
const unsigned char* p,
|
||||
const unsigned char* endp,
|
||||
int value
|
||||
int digit
|
||||
) {
|
||||
state->value *= 2;
|
||||
state->mask *= 2;
|
||||
switch (value) {
|
||||
case 1: {
|
||||
state->value += 1;
|
||||
return 0;
|
||||
}
|
||||
case 2: {
|
||||
state->mask += 1;
|
||||
return 0;
|
||||
}
|
||||
case 3: {
|
||||
state->value += 1;
|
||||
state->mask += 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
state->value = (state->value << 1) + (digit & 1);
|
||||
state->mask = (state->mask << 1) + ((digit >> 1) & 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user