dsp: bios_table: Branchless implementation of pad_size_get()
This is a minor logic cleanup. The equivalence can be tested as follows:
```python
>>> def pad0(x): return (4 - x % 4) if (x % 4) != 0 else 0
...
>>> def pad1(x): return (4 - (x % 4)) % 4
...
>>> for i in range(0, 5):
... print("{}: {} == {} ? {}".format(i, pad0(i), pad1(i), pad0(i) == pad1(i)))
...
0: 0 == 0 ? True
1: 3 == 3 ? True
2: 2 == 2 ? True
3: 1 == 1 ? True
4: 0 == 0 ? True
```
Change-Id: Ieee40178a93bcfd2a47fd7c1a6f47f8e0884700e
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/src/dsp/bios_table.c b/src/dsp/bios_table.c
index e595c00..f7c1206 100644
--- a/src/dsp/bios_table.c
+++ b/src/dsp/bios_table.c
@@ -887,7 +887,7 @@
static size_t pad_size_get(size_t size_without_pad)
{
- return ((size_without_pad % 4) ? (4 - size_without_pad % 4) : 0);
+ return (4 - (size_without_pad % 4)) % 4;
}
static uint8_t *pad_append(uint8_t *table_end, size_t pad_size)