mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-14 12:08:40 +00:00
Speed dropped_percent() common case, ensure dropped>0 returns >0%.
This commit is contained in:
parent
be9f3362da
commit
dc8c34487f
@ -26,6 +26,7 @@
|
||||
#include <cstddef>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#include "baseband_packet.hpp"
|
||||
#include "ert_packet.hpp"
|
||||
@ -429,7 +430,12 @@ struct CaptureConfig {
|
||||
}
|
||||
|
||||
size_t dropped_percent() const {
|
||||
return baseband_bytes_dropped * 100U / baseband_bytes_received;
|
||||
if( baseband_bytes_dropped == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
const size_t percent = baseband_bytes_dropped * 100U / baseband_bytes_received;
|
||||
return std::max(1U, percent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user