diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index 6f52b6c47..70e94ba24 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -314,17 +314,17 @@ SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint16_t c return v; } -uint32_t +uint16_t SpectrumWifiPhy::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const { NS_LOG_FUNCTION (this << txVector); - uint32_t centerFrequencyForSupportedWidth = GetFrequency (); + uint16_t centerFrequencyForSupportedWidth = GetFrequency (); uint16_t supportedWidth = GetChannelWidth (); uint16_t currentWidth = txVector.GetChannelWidth (); if (currentWidth != supportedWidth) { - uint32_t startingFrequency = centerFrequencyForSupportedWidth - static_cast (supportedWidth / 2); - return startingFrequency + static_cast (currentWidth / 2); // primary channel is in the lower part (for the time being) + uint16_t startingFrequency = centerFrequencyForSupportedWidth - (supportedWidth / 2); + return startingFrequency + (currentWidth / 2); // primary channel is in the lower part (for the time being) } return centerFrequencyForSupportedWidth; } diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 36ad6bfdb..1dcebf56c 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -109,7 +109,7 @@ public: * \param txVector the TXVECTOR that has the channel width that is to be used * \return the center frequency corresponding to the channel width to be used */ - uint32_t GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const; + uint16_t GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const; /** * Method to encapsulate the creation of the WifiSpectrumPhyInterface