Code simplified

pull/199/head
Marcin Kondej 2023-12-14 14:27:17 +01:00 zatwierdzone przez GitHub
rodzic bb97176e89
commit d7fab7646c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -352,7 +352,7 @@ Transmitter::~Transmitter() {
cv.wait(lock, [&]() -> bool { cv.wait(lock, [&]() -> bool {
return !enable; return !enable;
}); });
if (output != nullptr) { if (output) {
delete output; delete output;
} }
} }
@ -365,7 +365,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
} }
auto finally = [&]() { auto finally = [&]() {
if (!preserveCarrier && (output != nullptr)) { if (!preserveCarrier && output) {
delete output; delete output;
output = nullptr; output = nullptr;
} }
@ -382,7 +382,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
unsigned clockDivisor = static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / frequency)); unsigned clockDivisor = static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / frequency));
unsigned divisorRange = clockDivisor - static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / (frequency + 0.0005f * bandwidth))); unsigned divisorRange = clockDivisor - static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / (frequency + 0.0005f * bandwidth)));
if (output == nullptr) { if (!output) {
output = new ClockOutput(clockDivisor); output = new ClockOutput(clockDivisor);
} }