summaryrefslogtreecommitdiff
path: root/cesar/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/tools')
-rw-r--r--cesar/tools/sniffer_phy/src/lowlevel.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/cesar/tools/sniffer_phy/src/lowlevel.c b/cesar/tools/sniffer_phy/src/lowlevel.c
index 1b79f412f0..36383e9d05 100644
--- a/cesar/tools/sniffer_phy/src/lowlevel.c
+++ b/cesar/tools/sniffer_phy/src/lowlevel.c
@@ -90,8 +90,12 @@ lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av,
/ symbol_tck[mpdu->tm->gil] + 2);
/* Compute number of PB. */
uint bits_per_pb = mpdu->tm->bits_per_pb[PHY_PB_SIZE_520];
- mpdu->pb_nb = ((symb_nb - 1) * mpdu->tm->bits_per_symbol
- + bits_per_pb) / bits_per_pb;
+ uint bits_per_symbol = mpdu->tm->bits_per_symbol;
+ if (bits_per_pb >= bits_per_symbol)
+ mpdu->pb_nb = symb_nb * bits_per_symbol / bits_per_pb;
+ else
+ mpdu->pb_nb = ((symb_nb - 1) * bits_per_symbol
+ + bits_per_pb) / bits_per_pb;
}
break;
default:
@@ -102,8 +106,9 @@ lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av,
if (mpdu->pb_nb)
{
uint bits_per_pb = mpdu->tm->bits_per_pb[mpdu->pb_size];
- mpdu->symbol_nb = (1 * bits_per_pb + mpdu->tm->bits_per_symbol -
- 1) / mpdu->tm->bits_per_symbol;
+ uint bits_per_symbol = mpdu->tm->bits_per_symbol;
+ mpdu->symbol_nb = (mpdu->pb_nb * bits_per_pb
+ + bits_per_symbol - 1) / bits_per_symbol;
}
}
}