Document pcu_lsb() function

While at it, fix a typo in the test output.

This function is nowadays only used in ms_current_pacch_slots(), which
is used only to print the PACCH TS (the first common UL & DL TS).

Change-Id: Id1d0b681f6866618f9f3a8c64d6a6c809ca50ea7
This commit is contained in:
Pau Espin 2023-05-31 21:19:24 +02:00 committed by laforge
parent ba8918aae8
commit 2549c1e696
3 changed files with 6 additions and 3 deletions

View File

@ -72,6 +72,9 @@ inline unsigned int pcu_bitcount(unsigned long long x)
return __builtin_popcountll(x);
}
/* Trim all 1 bits except the Least Significat Bit, which is kept.
* equivalent of (1 << ffs(u)) / 2
*/
static inline uint8_t pcu_lsb(uint8_t x)
{
return x & -x;

View File

@ -937,10 +937,10 @@ static void test_lsb()
{
uint8_t u = 0;
printf("Testing LBS utility...\n");
printf("Testing LSB utility...\n");
do {
uint8_t x = pcu_lsb(u); /* equivalent of (1 << ffs(u)) / 2 */
uint8_t x = pcu_lsb(u);
printf("%2X " OSMO_BIT_SPEC ": {%d} %3d\n",
u, OSMO_BIT_PRINT(u), pcu_bitcount(u), x);
u++;

View File

@ -18,7 +18,7 @@ show_rbb: IIRRIIIR
06 3f 10 0d 23 6d 7f 03 18 23 00 46 a0 08 00 17 44 0b 2b 2b 2b 2b 2b
assignment reject: 06 3a 10 7f 06 36 14 7f 06 36 14 7f 06 36 14 7f 06 36 14 c0 2b 2b
assignment reject: 06 3a 10 70 06 36 14 70 06 36 14 70 06 36 14 70 06 36 14 0b 2b 2b
Testing LBS utility...
Testing LSB utility...
0 ........: {0} 0
1 .......1: {1} 1
2 ......1.: {1} 2