From a93c3571415fa650c0f5d4fa4f2d53a842d21509 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Sun, 7 May 2023 19:06:35 +0100 Subject: [PATCH] Fix clang-tidy readability-simplify-boolean-expr warnings --- examples/naming/object-names.cc | 2 +- examples/tcp/tcp-validation.cc | 2 +- examples/tutorial/seventh.cc | 2 +- .../udp-client-server/udp-client-server.cc | 2 +- .../udp-trace-client-server.cc | 2 +- examples/udp/udp-echo.cc | 2 +- examples/wireless/mixed-wired-wireless.cc | 2 +- examples/wireless/wifi-simple-adhoc-grid.cc | 2 +- src/aodv/model/aodv-routing-protocol.cc | 6 +-- src/applications/model/udp-client.cc | 8 +-- src/applications/model/udp-echo-client.cc | 8 +-- src/applications/model/udp-trace-client.cc | 12 ++--- .../outdoor-group-mobility-example.cc | 2 +- src/config-store/model/raw-text-config.cc | 6 +-- src/config-store/model/xml-config.cc | 6 +-- src/core/model/callback.h | 7 +-- src/core/model/default-simulator-impl.cc | 13 ++--- src/core/model/object-factory.cc | 6 +-- src/core/model/pointer.h | 6 +-- src/core/model/realtime-simulator-impl.cc | 21 +++----- src/core/model/test.cc | 6 +-- src/core/model/time.cc | 6 +-- src/core/model/wall-clock-synchronizer.cc | 2 +- .../test/random-variable-stream-test-suite.cc | 2 +- src/core/test/simulator-test-suite.cc | 18 +------ src/core/test/trickle-timer-test-suite.cc | 2 +- src/csma/model/csma-channel.cc | 9 +--- src/csma/model/csma-net-device.cc | 12 ++--- src/dsdv/model/dsdv-routing-protocol.cc | 18 +++---- src/dsdv/model/dsdv-rtable.cc | 18 ++----- src/dsr/model/dsr-options.cc | 6 +-- src/dsr/model/dsr-routing.cc | 3 +- src/fd-net-device/examples/fd-emu-send.cc | 2 +- src/fd-net-device/model/fd-net-device.cc | 2 +- src/internet-apps/model/dhcp-client.cc | 2 +- src/internet-apps/model/dhcp-header.cc | 16 +++--- src/internet-apps/model/radvd.cc | 2 +- src/internet/helper/internet-stack-helper.cc | 4 +- src/internet/model/arp-cache.cc | 6 +-- src/internet/model/arp-l3-protocol.cc | 2 +- .../model/global-route-manager-impl.cc | 2 +- src/internet/model/global-router-interface.cc | 4 +- src/internet/model/icmpv6-l4-protocol.cc | 4 +- src/internet/model/ipv4-global-routing.cc | 2 +- src/internet/model/ipv4-l3-protocol.cc | 23 ++++---- src/internet/model/ipv4-list-routing.cc | 6 +-- src/internet/model/ipv4-raw-socket-impl.cc | 6 +-- .../model/ipv4-routing-table-entry.cc | 27 ++-------- src/internet/model/ipv4-static-routing.cc | 2 +- src/internet/model/ipv6-l3-protocol.cc | 14 ++--- src/internet/model/ipv6-list-routing.cc | 2 +- src/internet/model/ipv6-raw-socket-impl.cc | 6 +-- .../model/ipv6-routing-table-entry.cc | 18 ++----- src/internet/model/ipv6-static-routing.cc | 2 +- src/internet/model/rip.cc | 7 ++- src/internet/model/ripng.cc | 8 +-- src/internet/model/tcp-dctcp.cc | 6 +-- src/internet/model/tcp-socket-base.cc | 8 +-- src/internet/model/tcp-tx-buffer.cc | 8 +-- src/internet/model/udp-socket-impl.cc | 10 ++-- .../test/ipv4-global-routing-test-suite.cc | 2 +- src/internet/test/tcp-endpoint-bug2211.cc | 4 +- src/internet/test/tcp-pacing-test.cc | 9 +--- src/internet/test/tcp-test.cc | 2 +- src/lr-wpan/helper/lr-wpan-helper.cc | 2 +- src/lr-wpan/model/lr-wpan-mac.cc | 15 ++---- src/lr-wpan/model/lr-wpan-phy.cc | 2 +- src/lte/examples/lena-radio-link-failure.cc | 2 +- src/lte/helper/lte-helper.cc | 6 +-- src/lte/helper/lte-stats-calculator.cc | 18 +------ src/lte/helper/mac-stats-calculator.cc | 12 ++--- src/lte/helper/phy-rx-stats-calculator.cc | 8 +-- src/lte/helper/phy-stats-calculator.cc | 10 ++-- src/lte/helper/phy-tx-stats-calculator.cc | 8 +-- .../helper/radio-bearer-stats-calculator.cc | 2 +- src/lte/model/cqa-ff-mac-scheduler.cc | 44 +++++++-------- src/lte/model/epc-gtpu-header.cc | 16 +++--- src/lte/model/fdbet-ff-mac-scheduler.cc | 34 +++++------- src/lte/model/fdmt-ff-mac-scheduler.cc | 34 +++++------- src/lte/model/fdtbfq-ff-mac-scheduler.cc | 46 +++++++--------- src/lte/model/lte-anr.cc | 2 +- src/lte/model/lte-enb-phy.cc | 2 +- src/lte/model/lte-enb-rrc.cc | 25 ++++----- .../model/lte-ffr-distributed-algorithm.cc | 2 +- src/lte/model/lte-ffr-enhanced-algorithm.cc | 10 ++-- src/lte/model/lte-ffr-soft-algorithm.cc | 6 +-- src/lte/model/lte-interference.cc | 6 +-- src/lte/model/lte-spectrum-phy.cc | 2 +- src/lte/model/lte-ue-mac.cc | 2 +- src/lte/model/lte-ue-rrc.cc | 2 +- src/lte/model/pf-ff-mac-scheduler.cc | 46 +++++++--------- src/lte/model/pss-ff-mac-scheduler.cc | 48 ++++++++--------- src/lte/model/rr-ff-mac-scheduler.cc | 36 ++++++------- src/lte/model/tdbet-ff-mac-scheduler.cc | 32 +++++------ src/lte/model/tdmt-ff-mac-scheduler.cc | 34 +++++------- src/lte/model/tdtbfq-ff-mac-scheduler.cc | 46 +++++++--------- src/lte/model/tta-ff-mac-scheduler.cc | 34 +++++------- src/lte/test/lte-test-frequency-reuse.cc | 14 ++--- src/mesh/model/dot11s/ie-dot11s-id.cc | 12 +---- src/mesh/model/mesh-point-device.cc | 2 +- .../reference-point-group-mobility-example.cc | 2 +- src/mobility/helper/ns2-mobility-helper.cc | 11 +--- .../examples/simple-distributed-empty-node.cc | 2 +- .../examples/simple-distributed-mpi-comm.cc | 2 +- src/mpi/examples/simple-distributed.cc | 2 +- src/mpi/examples/third-distributed.cc | 2 +- src/mpi/model/distributed-simulator-impl.cc | 13 ++--- src/mpi/model/null-message-simulator-impl.cc | 13 ++--- src/netanim/model/animation-interface.cc | 21 ++------ src/network/model/buffer.cc | 2 +- src/network/model/packet-metadata.cc | 9 +--- src/network/utils/bit-deserializer.cc | 2 +- src/network/utils/ipv4-address.cc | 9 +--- src/network/utils/ipv6-address.cc | 30 ++--------- src/network/utils/lollipop-counter.h | 30 ++--------- src/network/utils/mac16-address.cc | 12 +---- src/network/utils/packet-socket.cc | 6 +-- src/network/utils/packetbb.cc | 7 +-- src/network/utils/pcap-file.cc | 2 +- src/network/utils/simple-net-device.cc | 24 ++------- src/olsr/model/olsr-routing-protocol.cc | 2 +- .../model/point-to-point-net-device.cc | 4 +- src/sixlowpan/model/sixlowpan-header.cc | 40 +++++++------- src/sixlowpan/model/sixlowpan-net-device.cc | 18 +++---- src/sixlowpan/test/mock-net-device.cc | 12 +---- src/spectrum/model/aloha-noack-net-device.cc | 6 +-- src/spectrum/model/three-gpp-channel-model.cc | 9 +--- src/stats/model/sqlite-output.cc | 54 ++++--------------- src/tap-bridge/model/tap-bridge.cc | 2 +- .../model/rocketfuel-topology-reader.cc | 4 +- .../examples/codel-vs-pfifo-asymmetric.cc | 4 +- .../model/fq-cobalt-queue-disc.cc | 2 +- .../model/fq-codel-queue-disc.cc | 2 +- .../model/fq-pie-queue-disc.cc | 2 +- src/traffic-control/model/pie-queue-disc.cc | 7 +-- src/traffic-control/model/queue-disc.cc | 10 ++-- src/traffic-control/model/tbf-queue-disc.cc | 2 +- .../test/cobalt-queue-disc-test-suite.cc | 6 +-- .../test/codel-queue-disc-test-suite.cc | 6 +-- .../test/pie-queue-disc-test-suite.cc | 6 +-- .../test/red-queue-disc-test-suite.cc | 6 +-- src/uan/model/uan-mac-cw.cc | 2 +- .../model/virtual-net-device.cc | 12 +---- src/visualizer/model/pyviz.cc | 18 +------ src/wave/model/default-channel-scheduler.cc | 27 ++-------- src/wifi/examples/wifi-manager-example.cc | 2 +- src/wifi/helper/wifi-helper.cc | 2 +- .../model/he/he-frame-exchange-manager.cc | 6 +-- src/wifi/model/ht/ht-capabilities.cc | 8 +-- src/wifi/model/ht/ht-operation.cc | 6 +-- src/wifi/model/mac-rx-middle.cc | 17 ++---- src/wifi/model/phy-entity.cc | 6 +-- src/wifi/model/qos-txop.cc | 8 +-- .../model/rate-control/aarf-wifi-manager.cc | 2 +- .../model/rate-control/aarfcd-wifi-manager.cc | 2 +- .../model/rate-control/amrr-wifi-manager.cc | 2 +- .../model/rate-control/aparf-wifi-manager.cc | 2 +- .../model/rate-control/arf-wifi-manager.cc | 2 +- .../model/rate-control/cara-wifi-manager.cc | 2 +- .../rate-control/minstrel-ht-wifi-manager.cc | 17 ++---- .../rate-control/minstrel-wifi-manager.cc | 2 +- .../model/rate-control/onoe-wifi-manager.cc | 2 +- .../model/rate-control/parf-wifi-manager.cc | 2 +- .../model/rate-control/rraa-wifi-manager.cc | 2 +- .../model/rate-control/rrpaa-wifi-manager.cc | 2 +- src/wifi/model/simple-frame-capture-model.cc | 8 +-- src/wifi/model/ssid.cc | 12 +---- src/wifi/model/supported-rates.cc | 12 ++--- src/wifi/model/txop.cc | 4 +- src/wifi/model/wifi-acknowledgment.cc | 52 +++--------------- src/wifi/model/wifi-default-ack-manager.cc | 10 ++-- src/wifi/model/wifi-phy.cc | 2 +- src/wifi/model/wifi-ppdu.cc | 6 +-- src/wifi/test/wifi-phy-ofdma-test.cc | 2 +- src/wimax/model/bs-net-device.cc | 4 +- src/wimax/model/bs-scheduler-simple.cc | 2 +- src/wimax/model/bs-uplink-scheduler-mbqos.cc | 2 +- src/wimax/model/bs-uplink-scheduler-rtps.cc | 2 +- src/wimax/model/bs-uplink-scheduler-simple.cc | 2 +- src/wimax/model/simple-ofdm-wimax-phy.cc | 11 +--- .../model/snr-to-block-error-rate-manager.cc | 8 +-- src/wimax/model/ss-net-device.cc | 2 +- src/wimax/model/ul-job.h | 18 +------ src/wimax/test/phy-test.cc | 4 +- src/wimax/test/qos-test.cc | 10 ++-- 185 files changed, 587 insertions(+), 1203 deletions(-) diff --git a/examples/naming/object-names.cc b/examples/naming/object-names.cc index f26d8a82a..1238ade94 100644 --- a/examples/naming/object-names.cc +++ b/examples/naming/object-names.cc @@ -214,7 +214,7 @@ main(int argc, char* argv[]) outputValidated = false; } - if (outputValidated == false) + if (!outputValidated) { std::cerr << "Program internal checking failed; returning with error" << std::endl; return (1); diff --git a/examples/tcp/tcp-validation.cc b/examples/tcp/tcp-validation.cc index 0ba5774dd..b9a8c023d 100644 --- a/examples/tcp/tcp-validation.cc +++ b/examples/tcp/tcp-validation.cc @@ -746,7 +746,7 @@ main(int argc, char* argv[]) firstTcpTypeId = TcpDctcp::GetTypeId(); Config::SetDefault("ns3::CoDelQueueDisc::CeThreshold", TimeValue(ceThreshold)); Config::SetDefault("ns3::FqCoDelQueueDisc::CeThreshold", TimeValue(ceThreshold)); - if (queueUseEcn == false) + if (!queueUseEcn) { std::cout << "Warning: using DCTCP with queue ECN disabled" << std::endl; } diff --git a/examples/tutorial/seventh.cc b/examples/tutorial/seventh.cc index f4b61be1e..b17824474 100644 --- a/examples/tutorial/seventh.cc +++ b/examples/tutorial/seventh.cc @@ -125,7 +125,7 @@ main(int argc, char* argv[]) Address anyAddress; std::string probeType; std::string tracePath; - if (useV6 == false) + if (!useV6) { Ipv4AddressHelper address; address.SetBase("10.1.1.0", "255.255.255.0"); diff --git a/examples/udp-client-server/udp-client-server.cc b/examples/udp-client-server/udp-client-server.cc index 44c14a9c9..515561656 100644 --- a/examples/udp-client-server/udp-client-server.cc +++ b/examples/udp-client-server/udp-client-server.cc @@ -74,7 +74,7 @@ main(int argc, char* argv[]) NetDeviceContainer d = csma.Install(n); NS_LOG_INFO("Assign IP Addresses."); - if (useV6 == false) + if (!useV6) { Ipv4AddressHelper ipv4; ipv4.SetBase("10.1.1.0", "255.255.255.0"); diff --git a/examples/udp-client-server/udp-trace-client-server.cc b/examples/udp-client-server/udp-trace-client-server.cc index 03e922e33..dccc61702 100644 --- a/examples/udp-client-server/udp-trace-client-server.cc +++ b/examples/udp-client-server/udp-trace-client-server.cc @@ -73,7 +73,7 @@ main(int argc, char* argv[]) NetDeviceContainer d = csma.Install(n); NS_LOG_INFO("Assign IP Addresses."); - if (useV6 == false) + if (!useV6) { Ipv4AddressHelper ipv4; ipv4.SetBase("10.1.1.0", "255.255.255.0"); diff --git a/examples/udp/udp-echo.cc b/examples/udp/udp-echo.cc index e5e2ec6d8..177ff1f51 100644 --- a/examples/udp/udp-echo.cc +++ b/examples/udp/udp-echo.cc @@ -81,7 +81,7 @@ main(int argc, char* argv[]) // We've got the "hardware" in place. Now we need to add IP addresses. // NS_LOG_INFO("Assign IP Addresses."); - if (useV6 == false) + if (!useV6) { Ipv4AddressHelper ipv4; ipv4.SetBase("10.1.1.0", "255.255.255.0"); diff --git a/examples/wireless/mixed-wired-wireless.cc b/examples/wireless/mixed-wired-wireless.cc index 1760457f6..e800b1d01 100644 --- a/examples/wireless/mixed-wired-wireless.cc +++ b/examples/wireless/mixed-wired-wireless.cc @@ -414,7 +414,7 @@ main(int argc, char* argv[]) // pcap trace on the application data sink wifiPhy.EnablePcap("mixed-wireless", appSink->GetId(), 0); - if (useCourseChangeCallback == true) + if (useCourseChangeCallback) { Config::Connect("/NodeList/*/$ns3::MobilityModel/CourseChange", MakeCallback(&CourseChangeCallback)); diff --git a/examples/wireless/wifi-simple-adhoc-grid.cc b/examples/wireless/wifi-simple-adhoc-grid.cc index d722ed193..8de6b70f9 100644 --- a/examples/wireless/wifi-simple-adhoc-grid.cc +++ b/examples/wireless/wifi-simple-adhoc-grid.cc @@ -255,7 +255,7 @@ main(int argc, char* argv[]) InetSocketAddress remote = InetSocketAddress(i.GetAddress(sinkNode, 0), 80); source->Connect(remote); - if (tracing == true) + if (tracing) { AsciiTraceHelper ascii; wifiPhy.EnableAsciiAll(ascii.CreateFileStream("wifi-simple-adhoc-grid.tr")); diff --git a/src/aodv/model/aodv-routing-protocol.cc b/src/aodv/model/aodv-routing-protocol.cc index aa069d8a6..94cb44489 100644 --- a/src/aodv/model/aodv-routing-protocol.cc +++ b/src/aodv/model/aodv-routing-protocol.cc @@ -558,7 +558,7 @@ RoutingProtocol::RouteInput(Ptr p, } UpdateRouteLifeTime(origin, m_activeRouteTimeout); Ptr packet = p->Copy(); - if (lcb.IsNull() == false) + if (!lcb.IsNull()) { NS_LOG_LOGIC("Broadcast local delivery to " << iface.GetLocal()); lcb(p, header, iif); @@ -617,7 +617,7 @@ RoutingProtocol::RouteInput(Ptr p, UpdateRouteLifeTime(toOrigin.GetNextHop(), m_activeRouteTimeout); m_nb.Update(toOrigin.GetNextHop(), m_activeRouteTimeout); } - if (lcb.IsNull() == false) + if (!lcb.IsNull()) { NS_LOG_LOGIC("Unicast local delivery to " << dst); lcb(p, header, iif); @@ -632,7 +632,7 @@ RoutingProtocol::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, header, Socket::ERROR_NOROUTETOHOST); diff --git a/src/applications/model/udp-client.cc b/src/applications/model/udp-client.cc index 56d3ba3e4..1d374d9f4 100644 --- a/src/applications/model/udp-client.cc +++ b/src/applications/model/udp-client.cc @@ -133,7 +133,7 @@ UdpClient::StartApplication() { TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); m_socket = Socket::CreateSocket(GetNode(), tid); - if (Ipv4Address::IsMatchingType(m_peerAddress) == true) + if (Ipv4Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -142,7 +142,7 @@ UdpClient::StartApplication() m_socket->Connect( InetSocketAddress(Ipv4Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (Ipv6Address::IsMatchingType(m_peerAddress) == true) + else if (Ipv6Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { @@ -151,7 +151,7 @@ UdpClient::StartApplication() m_socket->Connect( Inet6SocketAddress(Ipv6Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (InetSocketAddress::IsMatchingType(m_peerAddress) == true) + else if (InetSocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -159,7 +159,7 @@ UdpClient::StartApplication() } m_socket->Connect(m_peerAddress); } - else if (Inet6SocketAddress::IsMatchingType(m_peerAddress) == true) + else if (Inet6SocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { diff --git a/src/applications/model/udp-echo-client.cc b/src/applications/model/udp-echo-client.cc index ef7531d57..abf302002 100644 --- a/src/applications/model/udp-echo-client.cc +++ b/src/applications/model/udp-echo-client.cc @@ -141,7 +141,7 @@ UdpEchoClient::StartApplication() { TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); m_socket = Socket::CreateSocket(GetNode(), tid); - if (Ipv4Address::IsMatchingType(m_peerAddress) == true) + if (Ipv4Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -150,7 +150,7 @@ UdpEchoClient::StartApplication() m_socket->Connect( InetSocketAddress(Ipv4Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (Ipv6Address::IsMatchingType(m_peerAddress) == true) + else if (Ipv6Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { @@ -159,7 +159,7 @@ UdpEchoClient::StartApplication() m_socket->Connect( Inet6SocketAddress(Ipv6Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (InetSocketAddress::IsMatchingType(m_peerAddress) == true) + else if (InetSocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -167,7 +167,7 @@ UdpEchoClient::StartApplication() } m_socket->Connect(m_peerAddress); } - else if (Inet6SocketAddress::IsMatchingType(m_peerAddress) == true) + else if (Inet6SocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { diff --git a/src/applications/model/udp-trace-client.cc b/src/applications/model/udp-trace-client.cc index d279e2d10..1a94ee863 100644 --- a/src/applications/model/udp-trace-client.cc +++ b/src/applications/model/udp-trace-client.cc @@ -258,7 +258,7 @@ UdpTraceClient::StartApplication() { TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); m_socket = Socket::CreateSocket(GetNode(), tid); - if (Ipv4Address::IsMatchingType(m_peerAddress) == true) + if (Ipv4Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -267,7 +267,7 @@ UdpTraceClient::StartApplication() m_socket->Connect( InetSocketAddress(Ipv4Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (Ipv6Address::IsMatchingType(m_peerAddress) == true) + else if (Ipv6Address::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { @@ -276,7 +276,7 @@ UdpTraceClient::StartApplication() m_socket->Connect( Inet6SocketAddress(Ipv6Address::ConvertFrom(m_peerAddress), m_peerPort)); } - else if (InetSocketAddress::IsMatchingType(m_peerAddress) == true) + else if (InetSocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind() == -1) { @@ -284,7 +284,7 @@ UdpTraceClient::StartApplication() } m_socket->Connect(m_peerAddress); } - else if (Inet6SocketAddress::IsMatchingType(m_peerAddress) == true) + else if (Inet6SocketAddress::IsMatchingType(m_peerAddress)) { if (m_socket->Bind6() == -1) { @@ -329,11 +329,11 @@ UdpTraceClient::SendPacket(uint32_t size) p->AddHeader(seqTs); std::stringstream addressString; - if (Ipv4Address::IsMatchingType(m_peerAddress) == true) + if (Ipv4Address::IsMatchingType(m_peerAddress)) { addressString << Ipv4Address::ConvertFrom(m_peerAddress); } - else if (Ipv6Address::IsMatchingType(m_peerAddress) == true) + else if (Ipv6Address::IsMatchingType(m_peerAddress)) { addressString << Ipv6Address::ConvertFrom(m_peerAddress); } diff --git a/src/buildings/examples/outdoor-group-mobility-example.cc b/src/buildings/examples/outdoor-group-mobility-example.cc index e7ccfa54b..d9c657cbe 100644 --- a/src/buildings/examples/outdoor-group-mobility-example.cc +++ b/src/buildings/examples/outdoor-group-mobility-example.cc @@ -176,7 +176,7 @@ main(int argc, char* argv[]) // configuration. int64_t streamIndex = 1; - if (useHelper == false) + if (!useHelper) { // The reference (parent) mobility model starts at coordinate (10, 10, 0) // and performs a buildings-aware random walk. diff --git a/src/config-store/model/raw-text-config.cc b/src/config-store/model/raw-text-config.cc index 4c8d90ca6..68794e10a 100644 --- a/src/config-store/model/raw-text-config.cc +++ b/src/config-store/model/raw-text-config.cc @@ -105,8 +105,7 @@ RawTextConfigSave::Default() NS_LOG_WARN("Global attribute " << m_typeId << "::" << name << " was not saved because it is OBSOLETE"); } - else if ((supportLevel == TypeId::SupportLevel::DEPRECATED) && - (m_saveDeprecated == false)) + else if (supportLevel == TypeId::SupportLevel::DEPRECATED && !m_saveDeprecated) { NS_LOG_WARN("Global attribute " << m_typeId << "::" << name << " was not saved because it is DEPRECATED"); @@ -181,8 +180,7 @@ RawTextConfigSave::Attributes() NS_LOG_WARN("Attribute " << GetCurrentPath() << " was not saved because it is OBSOLETE"); } - else if ((supportLevel == TypeId::SupportLevel::DEPRECATED) && - (m_saveDeprecated == false)) + else if (supportLevel == TypeId::SupportLevel::DEPRECATED && !m_saveDeprecated) { NS_LOG_WARN("Attribute " << GetCurrentPath() << " was not saved because it is DEPRECATED"); diff --git a/src/config-store/model/xml-config.cc b/src/config-store/model/xml-config.cc index 72a0510e3..a2f3a3c1c 100644 --- a/src/config-store/model/xml-config.cc +++ b/src/config-store/model/xml-config.cc @@ -145,8 +145,7 @@ XmlConfigSave::Default() << " was not saved because it is OBSOLETE"); return; } - else if ((supportLevel == TypeId::SupportLevel::DEPRECATED) && - (m_saveDeprecated == false)) + else if (supportLevel == TypeId::SupportLevel::DEPRECATED && !m_saveDeprecated) { NS_LOG_WARN("Global attribute " << m_typeid << "::" << name << " was not saved because it is DEPRECATED"); @@ -225,8 +224,7 @@ XmlConfigSave::Attributes() << " was not saved because it is OBSOLETE"); return; } - else if ((supportLevel == TypeId::SupportLevel::DEPRECATED) && - (m_saveDeprecated == false)) + else if (supportLevel == TypeId::SupportLevel::DEPRECATED && !m_saveDeprecated) { NS_LOG_WARN("Attribute " << GetCurrentPath() << " was not saved because it is DEPRECATED"); diff --git a/src/core/model/callback.h b/src/core/model/callback.h index 989ee19c3..67655506e 100644 --- a/src/core/model/callback.h +++ b/src/core/model/callback.h @@ -184,12 +184,7 @@ class CallbackComponent : public CallbackComponentBase auto p = std::dynamic_pointer_cast>(other); // other must have the same type and value as ours - if (p == nullptr || p->m_comp != m_comp) - { - return false; - } - - return true; + return !(p == nullptr || p->m_comp != m_comp); } private: diff --git a/src/core/model/default-simulator-impl.cc b/src/core/model/default-simulator-impl.cc index 7014c3373..b269a3ff1 100644 --- a/src/core/model/default-simulator-impl.cc +++ b/src/core/model/default-simulator-impl.cc @@ -375,16 +375,9 @@ DefaultSimulatorImpl::IsExpired(const EventId& id) const } return true; } - if (id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || - (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || - id.PeekEventImpl()->IsCancelled()) - { - return true; - } - else - { - return false; - } + return id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || + (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || + id.PeekEventImpl()->IsCancelled(); } Time diff --git a/src/core/model/object-factory.cc b/src/core/model/object-factory.cc index 6e086a2bf..de9f23d20 100644 --- a/src/core/model/object-factory.cc +++ b/src/core/model/object-factory.cc @@ -55,11 +55,7 @@ ObjectFactory::SetTypeId(std::string tid) bool ObjectFactory::IsTypeIdSet() const { - if (m_tid.GetUid() != 0) - { - return true; - } - return false; + return m_tid.GetUid() != 0; } void diff --git a/src/core/model/pointer.h b/src/core/model/pointer.h index 3708d1375..e14cbe461 100644 --- a/src/core/model/pointer.h +++ b/src/core/model/pointer.h @@ -140,11 +140,7 @@ class PointerChecker : public ns3::PointerChecker return true; } T* ptr = dynamic_cast(PeekPointer(value->GetObject())); - if (ptr == nullptr) - { - return false; - } - return true; + return ptr; } std::string GetValueTypeName() const override diff --git a/src/core/model/realtime-simulator-impl.cc b/src/core/model/realtime-simulator-impl.cc index 6ca7ed893..23974dcf8 100644 --- a/src/core/model/realtime-simulator-impl.cc +++ b/src/core/model/realtime-simulator-impl.cc @@ -125,12 +125,12 @@ RealtimeSimulatorImpl::Destroy() // means shutting down the workers and doing a Join() before calling the // Simulator::Destroy(). // - while (m_destroyEvents.empty() == false) + while (!m_destroyEvents.empty()) { Ptr ev = m_destroyEvents.front().PeekEventImpl(); m_destroyEvents.pop_front(); NS_LOG_LOGIC("handle destroy " << ev); - if (ev->IsCancelled() == false) + if (!ev->IsCancelled()) { ev->Invoke(); } @@ -149,7 +149,7 @@ RealtimeSimulatorImpl::SetScheduler(ObjectFactory schedulerFactory) if (m_events) { - while (m_events->IsEmpty() == false) + while (!m_events->IsEmpty()) { Scheduler::Event next = m_events->RemoveNext(); scheduler->Insert(next); @@ -738,7 +738,7 @@ RealtimeSimulatorImpl::Remove(const EventId& id) void RealtimeSimulatorImpl::Cancel(const EventId& id) { - if (IsExpired(id) == false) + if (!IsExpired(id)) { id.PeekEventImpl()->Cancel(); } @@ -773,16 +773,9 @@ RealtimeSimulatorImpl::IsExpired(const EventId& id) const // // The same is true for the next line involving the m_currentUid. // - if (id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || - (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || - id.PeekEventImpl()->IsCancelled()) - { - return true; - } - else - { - return false; - } + return id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || + (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || + id.PeekEventImpl()->IsCancelled(); } Time diff --git a/src/core/model/test.cc b/src/core/model/test.cc index 688e2c8b6..98f9efb14 100644 --- a/src/core/model/test.cc +++ b/src/core/model/test.cc @@ -63,11 +63,7 @@ TestDoubleIsEqual(const double x1, const double x2, const double epsilon) delta = std::ldexp(epsilon, exponent); difference = x1 - x2; - if (difference > delta || difference < -delta) - { - return false; - } - return true; + return difference <= delta && difference >= -delta; } /** diff --git a/src/core/model/time.cc b/src/core/model/time.cc index 671079247..54d2fb285 100644 --- a/src/core/model/time.cc +++ b/src/core/model/time.cc @@ -338,7 +338,7 @@ Time::Mark(Time* const time) ret = g_markingTimes->insert(time); NS_LOG_LOGIC("\t[" << g_markingTimes->size() << "] recording " << time); - if (ret.second == false) + if (!ret.second) { NS_LOG_WARN("already recorded " << time << "!"); } @@ -388,8 +388,8 @@ Time::ConvertTimes(const Unit unit) for (MarkedTimes::iterator it = g_markingTimes->begin(); it != g_markingTimes->end(); it++) { Time* const tp = *it; - if (!((tp->m_data == std::numeric_limits::min()) || - (tp->m_data == std::numeric_limits::max()))) + if (!(tp->m_data == std::numeric_limits::min() || + tp->m_data == std::numeric_limits::max())) { tp->m_data = tp->ToInteger(unit); } diff --git a/src/core/model/wall-clock-synchronizer.cc b/src/core/model/wall-clock-synchronizer.cc index eb3f15bdd..ea8b87546 100644 --- a/src/core/model/wall-clock-synchronizer.cc +++ b/src/core/model/wall-clock-synchronizer.cc @@ -227,7 +227,7 @@ WallClockSynchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) // interrupted by a Signal. In this case, we need to return and let the // simulator re-evaluate what to do. // - if (SleepWait((numberJiffies - 3) * m_jiffy) == false) + if (!SleepWait((numberJiffies - 3) * m_jiffy)) { NS_LOG_INFO("SleepWait interrupted"); return false; diff --git a/src/core/test/random-variable-stream-test-suite.cc b/src/core/test/random-variable-stream-test-suite.cc index 610ea0d26..d9e7c3d0a 100644 --- a/src/core/test/random-variable-stream-test-suite.cc +++ b/src/core/test/random-variable-stream-test-suite.cc @@ -316,7 +316,7 @@ class TestCaseBase : public TestCase */ void SetTestSuiteSeed() { - if (m_seedSet == false) + if (!m_seedSet) { uint32_t seed; if (RngSeedManager::GetRun() == 0) diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc index e0824ea6b..178bc71f1 100644 --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -115,14 +115,7 @@ SimulatorEventsTestCase::EventA(int /* a */) void SimulatorEventsTestCase::EventB(int b) { - if (b != 2 || NowUs() != 11) - { - m_b = false; - } - else - { - m_b = true; - } + m_b = !(b != 2 || NowUs() != 11); Simulator::Remove(m_idC); Simulator::Schedule(MicroSeconds(10), &SimulatorEventsTestCase::EventD, this, 4); } @@ -136,14 +129,7 @@ SimulatorEventsTestCase::EventC(int /* c */) void SimulatorEventsTestCase::EventD(int d) { - if (d != 4 || NowUs() != (11 + 10)) - { - m_d = false; - } - else - { - m_d = true; - } + m_d = !(d != 4 || NowUs() != (11 + 10)); } void diff --git a/src/core/test/trickle-timer-test-suite.cc b/src/core/test/trickle-timer-test-suite.cc index b3ccd3204..b27b8a190 100644 --- a/src/core/test/trickle-timer-test-suite.cc +++ b/src/core/test/trickle-timer-test-suite.cc @@ -96,7 +96,7 @@ TrickleTimerTestCase::TrickleTimerTestCase() void TrickleTimerTestCase::ExpireTimer() { - if (m_enableDataCollection == false) + if (!m_enableDataCollection) { return; } diff --git a/src/csma/model/csma-channel.cc b/src/csma/model/csma-channel.cc index 9f1fad3ce..9c9f253a6 100644 --- a/src/csma/model/csma-channel.cc +++ b/src/csma/model/csma-channel.cc @@ -310,14 +310,7 @@ CsmaChannel::GetDeviceNum(Ptr device) bool CsmaChannel::IsBusy() { - if (m_state == IDLE) - { - return false; - } - else - { - return true; - } + return m_state != IDLE; } DataRate diff --git a/src/csma/model/csma-net-device.cc b/src/csma/model/csma-net-device.cc index 33d555e15..bb0b93894 100644 --- a/src/csma/model/csma-net-device.cc +++ b/src/csma/model/csma-net-device.cc @@ -459,7 +459,7 @@ CsmaNetDevice::TransmitStart() // // Only transmit if the send side of net device is enabled // - if (IsSendEnabled() == false) + if (!IsSendEnabled()) { m_phyTxDropTrace(m_currentPkt); m_currentPkt = nullptr; @@ -512,7 +512,7 @@ CsmaNetDevice::TransmitStart() // The channel is free, transmit the packet // m_phyTxBeginTrace(m_currentPkt); - if (m_channel->TransmitStart(m_currentPkt, m_deviceId) == false) + if (!m_channel->TransmitStart(m_currentPkt, m_deviceId)) { NS_LOG_WARN("Channel TransmitStart returns an error"); m_phyTxDropTrace(m_currentPkt); @@ -718,7 +718,7 @@ CsmaNetDevice::Receive(Ptr packet, Ptr senderDevice) // // Only receive if the send side of net device is enabled // - if (IsReceiveEnabled() == false) + if (!IsReceiveEnabled()) { m_phyRxDropTrace(packet); return; @@ -974,7 +974,7 @@ CsmaNetDevice::SendFrom(Ptr packet, // // Only transmit if send side of net device is enabled // - if (IsSendEnabled() == false) + if (!IsSendEnabled()) { m_macTxDropTrace(packet); return false; @@ -990,7 +990,7 @@ CsmaNetDevice::SendFrom(Ptr packet, // Place the packet to be sent on the send queue. Note that the // queue may fire a drop trace, but we will too. // - if (m_queue->Enqueue(packet) == false) + if (!m_queue->Enqueue(packet)) { m_macTxDropTrace(packet); return false; @@ -1003,7 +1003,7 @@ CsmaNetDevice::SendFrom(Ptr packet, // if (m_txMachineState == READY) { - if (m_queue->IsEmpty() == false) + if (!m_queue->IsEmpty()) { Ptr packet = m_queue->Dequeue(); NS_ASSERT_MSG(packet, diff --git a/src/dsdv/model/dsdv-routing-protocol.cc b/src/dsdv/model/dsdv-routing-protocol.cc index 22b430884..85080b221 100644 --- a/src/dsdv/model/dsdv-routing-protocol.cc +++ b/src/dsdv/model/dsdv-routing-protocol.cc @@ -419,7 +419,7 @@ RoutingProtocol::RouteInput(Ptr p, } // Deferred route request - if (EnableBuffering == true && idev == m_lo) + if (EnableBuffering && idev == m_lo) { DeferredRouteOutputTag tag; if (p->PeekPacketTag(tag)) @@ -449,7 +449,7 @@ RoutingProtocol::RouteInput(Ptr p, if (dst == iface.GetBroadcast() || dst.IsBroadcast()) { Ptr packet = p->Copy(); - if (lcb.IsNull() == false) + if (!lcb.IsNull()) { NS_LOG_LOGIC("Broadcast local delivery to " << iface.GetLocal()); lcb(p, header, iif); @@ -482,7 +482,7 @@ RoutingProtocol::RouteInput(Ptr p, if (m_ipv4->IsDestinationAddress(dst, iif)) { - if (lcb.IsNull() == false) + if (!lcb.IsNull()) { NS_LOG_LOGIC("Unicast local delivery to " << dst); lcb(p, header, iif); @@ -497,7 +497,7 @@ RoutingProtocol::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, header, Socket::ERROR_NOROUTETOHOST); @@ -627,7 +627,7 @@ RoutingProtocol::RecvDsdv(Ptr socket) EventId event; bool permanentTableVerifier = m_routingTable.LookupRoute(dsdvHeader.GetDst(), fwdTableEntry); - if (permanentTableVerifier == false) + if (!permanentTableVerifier) { if (dsdvHeader.GetDstSeqno() % 2 != 1) { @@ -860,8 +860,8 @@ RoutingProtocol::SendTriggeredUpdate() << " SeqNo:" << i->second.GetSeqNo() << " HopCount:" << i->second.GetHop() + 1); RoutingTableEntry temp = i->second; - if ((i->second.GetEntriesChanged() == true) && - (!m_advRoutingTable.AnyRunningEvent(temp.GetDestination()))) + if (i->second.GetEntriesChanged() && + !m_advRoutingTable.AnyRunningEvent(temp.GetDestination())) { dsdvHeader.SetDst(i->second.GetDestination()); dsdvHeader.SetDstSeqno(i->second.GetSeqNo()); @@ -1287,8 +1287,8 @@ RoutingProtocol::MergeTriggerPeriodicUpdates() ++i) { RoutingTableEntry advEntry = i->second; - if ((advEntry.GetEntriesChanged() == true) && - (!m_advRoutingTable.AnyRunningEvent(advEntry.GetDestination()))) + if (advEntry.GetEntriesChanged() && + !m_advRoutingTable.AnyRunningEvent(advEntry.GetDestination())) { if (!(advEntry.GetSeqNo() % 2)) { diff --git a/src/dsdv/model/dsdv-rtable.cc b/src/dsdv/model/dsdv-rtable.cc index 47a2e9c75..18dc1af0b 100644 --- a/src/dsdv/model/dsdv-rtable.cc +++ b/src/dsdv/model/dsdv-rtable.cc @@ -101,7 +101,7 @@ RoutingTable::LookupRoute(Ipv4Address id, RoutingTableEntry& rt, bool forRouteIn { return false; } - if (forRouteInput == true && id == i->second.GetInterface().GetBroadcast()) + if (forRouteInput && id == i->second.GetInterface().GetBroadcast()) { return false; } @@ -112,12 +112,7 @@ RoutingTable::LookupRoute(Ipv4Address id, RoutingTableEntry& rt, bool forRouteIn bool RoutingTable::DeleteRoute(Ipv4Address dst) { - if (m_ipv4AddressEntry.erase(dst) != 0) - { - // NS_LOG_DEBUG("Route erased"); - return true; - } - return false; + return m_ipv4AddressEntry.erase(dst) != 0; } uint32_t @@ -329,14 +324,7 @@ RoutingTable::AnyRunningEvent(Ipv4Address address) return false; } event = i->second; - if (event.IsRunning()) - { - return true; - } - else - { - return false; - } + return event.IsRunning(); } bool diff --git a/src/dsr/model/dsr-options.cc b/src/dsr/model/dsr-options.cc index 600933d87..01aefe6f8 100644 --- a/src/dsr/model/dsr-options.cc +++ b/src/dsr/model/dsr-options.cc @@ -171,11 +171,7 @@ DsrOptions::ReverseRoutes(std::vector& vec) vec.push_back(*ri); } - if ((vec.size() == vec2.size()) && (vec.front() == vec2.back())) - { - return true; - } - return false; + return (vec.size() == vec2.size()) && (vec.front() == vec2.back()); } Ipv4Address diff --git a/src/dsr/model/dsr-routing.cc b/src/dsr/model/dsr-routing.cc index 8989c9686..7f811f0d8 100644 --- a/src/dsr/model/dsr-routing.cc +++ b/src/dsr/model/dsr-routing.cc @@ -3688,8 +3688,7 @@ DsrRouting::Receive(Ptr p, const Ipv4Header& ip, Ptr inco case IpL4Protocol::RX_CSUM_FAILED: break; case IpL4Protocol::RX_ENDPOINT_UNREACH: - if (ip.GetDestination().IsBroadcast() == true || - ip.GetDestination().IsMulticast() == true) + if (ip.GetDestination().IsBroadcast() || ip.GetDestination().IsMulticast()) { break; // Do not reply to broadcast or multicast } diff --git a/src/fd-net-device/examples/fd-emu-send.cc b/src/fd-net-device/examples/fd-emu-send.cc index 948af676a..be6e0cc2a 100644 --- a/src/fd-net-device/examples/fd-emu-send.cc +++ b/src/fd-net-device/examples/fd-emu-send.cc @@ -99,7 +99,7 @@ Send(Ptr dev, int level, std::string emuMode) if (level == 1) { - if (device->SendFrom(packet, sender, receiver, 0) == false) + if (!device->SendFrom(packet, sender, receiver, 0)) { failed++; } diff --git a/src/fd-net-device/model/fd-net-device.cc b/src/fd-net-device/model/fd-net-device.cc index 5c14f0299..127441f44 100644 --- a/src/fd-net-device/model/fd-net-device.cc +++ b/src/fd-net-device/model/fd-net-device.cc @@ -570,7 +570,7 @@ FdNetDevice::SendFrom(Ptr packet, NS_LOG_FUNCTION(this << packet << src << dest << protocolNumber); NS_LOG_LOGIC("packet: " << packet << " UID: " << packet->GetUid()); - if (IsLinkUp() == false) + if (!IsLinkUp()) { m_macTxDropTrace(packet); return false; diff --git a/src/internet-apps/model/dhcp-client.cc b/src/internet-apps/model/dhcp-client.cc index cc1744ea6..31c9bbf22 100644 --- a/src/internet-apps/model/dhcp-client.cc +++ b/src/internet-apps/model/dhcp-client.cc @@ -369,7 +369,7 @@ DhcpClient::OfferHandler(DhcpHeader header) NS_LOG_FUNCTION(this << header); m_offerList.push_back(header); - if (m_offered == false) + if (!m_offered) { m_discoverEvent.Cancel(); m_offered = true; diff --git a/src/internet-apps/model/dhcp-header.cc b/src/internet-apps/model/dhcp-header.cc index bbda04932..6022c9c15 100644 --- a/src/internet-apps/model/dhcp-header.cc +++ b/src/internet-apps/model/dhcp-header.cc @@ -75,7 +75,7 @@ DhcpHeader::~DhcpHeader() void DhcpHeader::SetType(uint8_t type) { - if (m_opt[OP_MSGTYPE] == false) + if (!m_opt[OP_MSGTYPE]) { m_len += 3; m_opt[OP_MSGTYPE] = true; @@ -154,7 +154,7 @@ DhcpHeader::GetYiaddr() const void DhcpHeader::SetDhcps(Ipv4Address addr) { - if (m_opt[OP_SERVID] == false) + if (!m_opt[OP_SERVID]) { m_len += 6; m_opt[OP_SERVID] = true; @@ -171,7 +171,7 @@ DhcpHeader::GetDhcps() const void DhcpHeader::SetReq(Ipv4Address addr) { - if (m_opt[OP_ADDREQ] == false) + if (!m_opt[OP_ADDREQ]) { m_len += 6; m_opt[OP_ADDREQ] = true; @@ -188,7 +188,7 @@ DhcpHeader::GetReq() const void DhcpHeader::SetMask(uint32_t addr) { - if (m_opt[OP_MASK] == false) + if (!m_opt[OP_MASK]) { m_len += 6; m_opt[OP_MASK] = true; @@ -205,7 +205,7 @@ DhcpHeader::GetMask() const void DhcpHeader::SetRouter(Ipv4Address addr) { - if (m_opt[OP_ROUTE] == false) + if (!m_opt[OP_ROUTE]) { m_len += 6; m_opt[OP_ROUTE] = true; @@ -222,7 +222,7 @@ DhcpHeader::GetRouter() const void DhcpHeader::SetLease(uint32_t time) { - if (m_opt[OP_LEASE] == false) + if (!m_opt[OP_LEASE]) { m_len += 6; m_opt[OP_LEASE] = true; @@ -239,7 +239,7 @@ DhcpHeader::GetLease() const void DhcpHeader::SetRenew(uint32_t time) { - if (m_opt[OP_RENEW] == false) + if (!m_opt[OP_RENEW]) { m_len += 6; m_opt[OP_RENEW] = true; @@ -256,7 +256,7 @@ DhcpHeader::GetRenew() const void DhcpHeader::SetRebind(uint32_t time) { - if (m_opt[OP_REBIND] == false) + if (!m_opt[OP_REBIND]) { m_len += 6; m_opt[OP_REBIND] = true; diff --git a/src/internet-apps/model/radvd.cc b/src/internet-apps/model/radvd.cc index dd1a2e781..bb9f92d09 100644 --- a/src/internet-apps/model/radvd.cc +++ b/src/internet-apps/model/radvd.cc @@ -192,7 +192,7 @@ Radvd::Send(Ptr config, Ipv6Address dst, bool reschedule) { NS_LOG_FUNCTION(this << dst << reschedule); - if (reschedule == true) + if (reschedule) { config->SetLastRaTxTime(Simulator::Now()); } diff --git a/src/internet/helper/internet-stack-helper.cc b/src/internet/helper/internet-stack-helper.cc index 11d182825..fffa5e41e 100644 --- a/src/internet/helper/internet-stack-helper.cc +++ b/src/internet/helper/internet-stack-helper.cc @@ -303,7 +303,7 @@ InternetStackHelper::Install(Ptr node) const CreateAndAggregateObjectFromTypeId(node, "ns3::ArpL3Protocol"); CreateAndAggregateObjectFromTypeId(node, "ns3::Ipv4L3Protocol"); CreateAndAggregateObjectFromTypeId(node, "ns3::Icmpv4L4Protocol"); - if (m_ipv4ArpJitterEnabled == false) + if (!m_ipv4ArpJitterEnabled) { Ptr arp = node->GetObject(); NS_ASSERT(arp); @@ -325,7 +325,7 @@ InternetStackHelper::Install(Ptr node) const /* IPv6 stack */ CreateAndAggregateObjectFromTypeId(node, "ns3::Ipv6L3Protocol"); CreateAndAggregateObjectFromTypeId(node, "ns3::Icmpv6L4Protocol"); - if (m_ipv6NsRsJitterEnabled == false) + if (!m_ipv6NsRsJitterEnabled) { Ptr icmpv6l4 = node->GetObject(); NS_ASSERT(icmpv6l4); diff --git a/src/internet/model/arp-cache.cc b/src/internet/model/arp-cache.cc index cbae1b33c..84ac49f9f 100644 --- a/src/internet/model/arp-cache.cc +++ b/src/internet/model/arp-cache.cc @@ -551,11 +551,7 @@ ArpCache::Entry::IsExpired() const Time timeout = GetTimeout(); Time delta = Simulator::Now() - m_lastSeen; NS_LOG_DEBUG("delta=" << delta.GetSeconds() << "s"); - if (delta > timeout) - { - return true; - } - return false; + return delta > timeout; } ArpCache::Ipv4PayloadHeaderPair diff --git a/src/internet/model/arp-l3-protocol.cc b/src/internet/model/arp-l3-protocol.cc index 958684326..3031246fc 100644 --- a/src/internet/model/arp-l3-protocol.cc +++ b/src/internet/model/arp-l3-protocol.cc @@ -276,7 +276,7 @@ ArpL3Protocol::Receive(Ptr device, break; } } - if (found == false) + if (!found) { NS_LOG_LOGIC("node=" << m_node->GetId() << ", got request from " << arp.GetSourceIpv4Address() << " for unknown address " diff --git a/src/internet/model/global-route-manager-impl.cc b/src/internet/model/global-route-manager-impl.cc index 48c2815ec..1630113a3 100644 --- a/src/internet/model/global-route-manager-impl.cc +++ b/src/internet/model/global-route-manager-impl.cc @@ -1216,7 +1216,7 @@ GlobalRouteManagerImpl::SPFGetNextLink(SPFVertex* v, // skipped a previous link and moved forward to the next (which is then the // one we want). // - if (skip == false) + if (!skip) { NS_LOG_LOGIC("Returning the found link"); return l; diff --git a/src/internet/model/global-router-interface.cc b/src/internet/model/global-router-interface.cc index f6bafd730..f39a2f7f7 100644 --- a/src/internet/model/global-router-interface.cc +++ b/src/internet/model/global-router-interface.cc @@ -791,7 +791,7 @@ GlobalRouter::ProcessSingleBroadcastLink(Ptr nd, // is a transit network. // ClearBridgesVisited(); - if (AnotherRouterOnLink(nd) == false) + if (!AnotherRouterOnLink(nd)) { // // This is a net device connected to a stub network @@ -1290,7 +1290,7 @@ GlobalRouter::FindAllNonBridgedDevicesOnLink(Ptr ch) const Ptr nd = ch->GetDevice(i); NS_LOG_LOGIC("checking to see if the device " << nd << " is bridged"); Ptr bnd = NetDeviceIsBridged(nd); - if (bnd && BridgeHasAlreadyBeenVisited(bnd) == false) + if (bnd && !BridgeHasAlreadyBeenVisited(bnd)) { NS_LOG_LOGIC("Device is bridged by BridgeNetDevice " << bnd << " with " << bnd->GetNBridgePorts() << " ports"); diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index 90fba2f0b..c68af7918 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -446,7 +446,7 @@ Icmpv6L4Protocol::HandleRA(Ptr packet, defaultRouter = src; } - while (next == true) + while (next) { uint8_t type = 0; p->CopyData(&type, sizeof(type)); @@ -688,7 +688,7 @@ Icmpv6L4Protocol::HandleNS(Ptr packet, bool next = true; bool hasSllao = false; - while (next == true) + while (next) { uint8_t type; packet->CopyData(&type, sizeof(type)); diff --git a/src/internet/model/ipv4-global-routing.cc b/src/internet/model/ipv4-global-routing.cc index 14e131569..23019a338 100644 --- a/src/internet/model/ipv4-global-routing.cc +++ b/src/internet/model/ipv4-global-routing.cc @@ -504,7 +504,7 @@ Ipv4GlobalRouting::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, header, Socket::ERROR_NOROUTETOHOST); diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index 75178e841..7122a1fcd 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -539,11 +539,10 @@ Ipv4L3Protocol::IsDestinationAddress(Ipv4Address address, uint32_t iif) const #ifdef NOTYET if (MulticastCheckGroup(iif, address)) #endif - if (true) - { - NS_LOG_LOGIC("For me (Ipv4Addr multicast address)"); - return true; - } + { + NS_LOG_LOGIC("For me (Ipv4Addr multicast address)"); + return true; + } } if (address.IsBroadcast()) @@ -961,7 +960,7 @@ Ipv4L3Protocol::BuildHeader(Ipv4Address source, uint64_t srcDst = dst | (src << 32); std::pair key = std::make_pair(srcDst, protocol); - if (mayFragment == true) + if (mayFragment) { ipHeader.SetMayFragment(); ipHeader.SetIdentification(m_identification[key]); @@ -1090,8 +1089,7 @@ Ipv4L3Protocol::IpForward(Ptr rtentry, Ptr p, const Ipv if (ipHeader.GetTtl() == 0) { // Do not reply to multicast/broadcast IP address - if (ipHeader.GetDestination().IsBroadcast() == false && - ipHeader.GetDestination().IsMulticast() == false) + if (!ipHeader.GetDestination().IsBroadcast() && !ipHeader.GetDestination().IsMulticast()) { Ptr icmp = GetIcmp(); icmp->SendTimeExceededTtl(ipHeader, packet, false); @@ -1127,7 +1125,7 @@ Ipv4L3Protocol::LocalDeliver(Ptr packet, const Ipv4Header& ip, uin NS_LOG_LOGIC("Received a fragment, processing " << *p); bool isPacketComplete; isPacketComplete = ProcessFragment(p, ipHeader, iif); - if (isPacketComplete == false) + if (!isPacketComplete) { return; } @@ -1154,8 +1152,7 @@ Ipv4L3Protocol::LocalDeliver(Ptr packet, const Ipv4Header& ip, uin case IpL4Protocol::RX_CSUM_FAILED: break; case IpL4Protocol::RX_ENDPOINT_UNREACH: - if (ipHeader.GetDestination().IsBroadcast() == true || - ipHeader.GetDestination().IsMulticast() == true) + if (ipHeader.GetDestination().IsBroadcast() || ipHeader.GetDestination().IsMulticast()) { break; // Do not reply to broadcast or multicast } @@ -1171,7 +1168,7 @@ Ipv4L3Protocol::LocalDeliver(Ptr packet, const Ipv4Header& ip, uin subnetDirected = true; } } - if (subnetDirected == false) + if (!subnetDirected) { GetIcmp()->SendDestUnreachPort(ipHeader, copy); } @@ -1266,7 +1263,7 @@ Ipv4L3Protocol::SourceAddressSelection(uint32_t interfaceIdx, Ipv4Address dest) Ipv4InterfaceAddress test = GetAddress(interfaceIdx, i); if (test.GetLocal().CombineMask(test.GetMask()) == dest.CombineMask(test.GetMask())) { - if (test.IsSecondary() == false) + if (!test.IsSecondary()) { return test.GetLocal(); } diff --git a/src/internet/model/ipv4-list-routing.cc b/src/internet/model/ipv4-list-routing.cc index 619b4da72..5da214eba 100644 --- a/src/internet/model/ipv4-list-routing.cc +++ b/src/internet/model/ipv4-list-routing.cc @@ -151,7 +151,7 @@ Ipv4ListRouting::RouteInput(Ptr p, uint32_t iif = m_ipv4->GetInterfaceForDevice(idev); retVal = m_ipv4->IsDestinationAddress(header.GetDestination(), iif); - if (retVal == true) + if (retVal) { NS_LOG_LOGIC("Address " << header.GetDestination() << " is a match for local delivery"); if (header.GetDestination().IsMulticast()) @@ -168,7 +168,7 @@ Ipv4ListRouting::RouteInput(Ptr p, } } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, header, Socket::ERROR_NOROUTETOHOST); @@ -178,7 +178,7 @@ Ipv4ListRouting::RouteInput(Ptr p, // If we have already delivered a packet locally (e.g. multicast) // we suppress further downstream local delivery by nulling the callback LocalDeliverCallback downstreamLcb = lcb; - if (retVal == true) + if (retVal) { downstreamLcb = MakeNullCallback, const Ipv4Header&, uint32_t>(); } diff --git a/src/internet/model/ipv4-raw-socket-impl.cc b/src/internet/model/ipv4-raw-socket-impl.cc index 63742292b..8bfb37e5b 100644 --- a/src/internet/model/ipv4-raw-socket-impl.cc +++ b/src/internet/model/ipv4-raw-socket-impl.cc @@ -526,11 +526,7 @@ bool Ipv4RawSocketImpl::SetAllowBroadcast(bool allowBroadcast) { NS_LOG_FUNCTION(this << allowBroadcast); - if (!allowBroadcast) - { - return false; - } - return true; + return allowBroadcast; } bool diff --git a/src/internet/model/ipv4-routing-table-entry.cc b/src/internet/model/ipv4-routing-table-entry.cc index 787e4ff64..e4ec9115e 100644 --- a/src/internet/model/ipv4-routing-table-entry.cc +++ b/src/internet/model/ipv4-routing-table-entry.cc @@ -99,14 +99,7 @@ bool Ipv4RoutingTableEntry::IsHost() const { NS_LOG_FUNCTION(this); - if (m_destNetworkMask == Ipv4Mask::GetOnes()) - { - return true; - } - else - { - return false; - } + return m_destNetworkMask == Ipv4Mask::GetOnes(); } Ipv4Address @@ -127,14 +120,7 @@ bool Ipv4RoutingTableEntry::IsDefault() const { NS_LOG_FUNCTION(this); - if (m_dest == Ipv4Address::GetZero()) - { - return true; - } - else - { - return false; - } + return m_dest == Ipv4Address::GetZero(); } Ipv4Address @@ -155,14 +141,7 @@ bool Ipv4RoutingTableEntry::IsGateway() const { NS_LOG_FUNCTION(this); - if (m_gateway == Ipv4Address::GetZero()) - { - return false; - } - else - { - return true; - } + return m_gateway != Ipv4Address::GetZero(); } Ipv4Address diff --git a/src/internet/model/ipv4-static-routing.cc b/src/internet/model/ipv4-static-routing.cc index 517267508..2b832cd35 100644 --- a/src/internet/model/ipv4-static-routing.cc +++ b/src/internet/model/ipv4-static-routing.cc @@ -558,7 +558,7 @@ Ipv4StaticRouting::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, ipHeader, Socket::ERROR_NOROUTETOHOST); diff --git a/src/internet/model/ipv6-l3-protocol.cc b/src/internet/model/ipv6-l3-protocol.cc index 4cb35e71d..ad34151ae 100644 --- a/src/internet/model/ipv6-l3-protocol.cc +++ b/src/internet/model/ipv6-l3-protocol.cc @@ -1389,7 +1389,7 @@ Ipv6L3Protocol::IpForward(Ptr idev, NS_LOG_WARN("TTL exceeded. Drop."); m_dropTrace(ipHeader, packet, DROP_TTL_EXPIRED, this, 0); // Do not reply to multicast IPv6 address - if (ipHeader.GetDestination().IsMulticast() == false) + if (!ipHeader.GetDestination().IsMulticast()) { packet->AddHeader(ipHeader); GetIcmpv6()->SendErrorTimeExceeded(packet, @@ -1791,11 +1791,7 @@ Ipv6L3Protocol::IsRegisteredMulticastAddress(Ipv6Address address, uint32_t inter Ipv6RegisteredMulticastAddressKey_t key = std::make_pair(address, interface); Ipv6RegisteredMulticastAddressCIter_t iter = m_multicastAddresses.find(key); - if (iter == m_multicastAddresses.end()) - { - return false; - } - return true; + return iter != m_multicastAddresses.end(); } bool @@ -1806,11 +1802,7 @@ Ipv6L3Protocol::IsRegisteredMulticastAddress(Ipv6Address address) const Ipv6RegisteredMulticastAddressNoInterfaceCIter_t iter = m_multicastAddressesNoInterface.find(address); - if (iter == m_multicastAddressesNoInterface.end()) - { - return false; - } - return true; + return iter != m_multicastAddressesNoInterface.end(); } bool diff --git a/src/internet/model/ipv6-list-routing.cc b/src/internet/model/ipv6-list-routing.cc index 1663b0336..619f49113 100644 --- a/src/internet/model/ipv6-list-routing.cc +++ b/src/internet/model/ipv6-list-routing.cc @@ -120,7 +120,7 @@ Ipv6ListRouting::RouteInput(Ptr p, // Check if input device supports IP forwarding uint32_t iif = m_ipv6->GetInterfaceForDevice(idev); - if (m_ipv6->IsForwarding(iif) == false) + if (!m_ipv6->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); ecb(p, header, Socket::ERROR_NOROUTETOHOST); diff --git a/src/internet/model/ipv6-raw-socket-impl.cc b/src/internet/model/ipv6-raw-socket-impl.cc index 4e7ed766c..6da3c906e 100644 --- a/src/internet/model/ipv6-raw-socket-impl.cc +++ b/src/internet/model/ipv6-raw-socket-impl.cc @@ -510,11 +510,7 @@ Ipv6RawSocketImpl::ForwardUp(Ptr p, Ipv6Header hdr, Ptr bool Ipv6RawSocketImpl::SetAllowBroadcast(bool allowBroadcast) { - if (!allowBroadcast) - { - return false; - } - return true; + return allowBroadcast; } bool diff --git a/src/internet/model/ipv6-routing-table-entry.cc b/src/internet/model/ipv6-routing-table-entry.cc index 9d146a9a4..94464d117 100644 --- a/src/internet/model/ipv6-routing-table-entry.cc +++ b/src/internet/model/ipv6-routing-table-entry.cc @@ -121,11 +121,7 @@ Ipv6RoutingTableEntry::~Ipv6RoutingTableEntry() bool Ipv6RoutingTableEntry::IsHost() const { - if (m_destNetworkPrefix == Ipv6Prefix::GetOnes()) - { - return true; - } - return false; + return m_destNetworkPrefix == Ipv6Prefix::GetOnes(); } Ipv6Address @@ -155,11 +151,7 @@ Ipv6RoutingTableEntry::IsNetwork() const bool Ipv6RoutingTableEntry::IsDefault() const { - if (m_dest == Ipv6Address::GetZero()) - { - return true; - } - return false; + return m_dest == Ipv6Address::GetZero(); } Ipv6Address @@ -177,11 +169,7 @@ Ipv6RoutingTableEntry::GetDestNetworkPrefix() const bool Ipv6RoutingTableEntry::IsGateway() const { - if (m_gateway == Ipv6Address::GetZero()) - { - return false; - } - return true; + return m_gateway != Ipv6Address::GetZero(); } Ipv6Address diff --git a/src/internet/model/ipv6-static-routing.cc b/src/internet/model/ipv6-static-routing.cc index 1ba58f79e..8e484697e 100644 --- a/src/internet/model/ipv6-static-routing.cc +++ b/src/internet/model/ipv6-static-routing.cc @@ -750,7 +750,7 @@ Ipv6StaticRouting::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv6->IsForwarding(iif) == false) + if (!m_ipv6->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); if (!ecb.IsNull()) diff --git a/src/internet/model/rip.cc b/src/internet/model/rip.cc index c13405efb..aff909d7c 100644 --- a/src/internet/model/rip.cc +++ b/src/internet/model/rip.cc @@ -153,7 +153,7 @@ Rip::DoInitialize() for (uint32_t j = 0; j < m_ipv4->GetNAddresses(i); j++) { Ipv4InterfaceAddress address = m_ipv4->GetAddress(i, j); - if (address.GetScope() != Ipv4InterfaceAddress::HOST && activeInterface == true) + if (address.GetScope() != Ipv4InterfaceAddress::HOST && activeInterface) { NS_LOG_LOGIC("RIP: adding socket to " << address.GetLocal()); TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); @@ -290,7 +290,7 @@ Rip::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv4->IsForwarding(iif) == false) + if (!m_ipv4->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); if (!ecb.IsNull()) @@ -365,8 +365,7 @@ Rip::NotifyInterfaceUp(uint32_t i) { Ipv4InterfaceAddress address = m_ipv4->GetAddress(i, j); - if (address.GetScope() != Ipv4InterfaceAddress::HOST && sendSocketFound == false && - activeInterface == true) + if (address.GetScope() != Ipv4InterfaceAddress::HOST && !sendSocketFound && activeInterface) { NS_LOG_LOGIC("RIP: adding sending socket to " << address.GetLocal()); TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); diff --git a/src/internet/model/ripng.cc b/src/internet/model/ripng.cc index 43976ac65..8952fad53 100644 --- a/src/internet/model/ripng.cc +++ b/src/internet/model/ripng.cc @@ -147,7 +147,7 @@ RipNg::DoInitialize() for (uint32_t j = 0; j < m_ipv6->GetNAddresses(i); j++) { Ipv6InterfaceAddress address = m_ipv6->GetAddress(i, j); - if (address.GetScope() == Ipv6InterfaceAddress::LINKLOCAL && activeInterface == true) + if (address.GetScope() == Ipv6InterfaceAddress::LINKLOCAL && activeInterface) { NS_LOG_LOGIC("RIPng: adding socket to " << address.GetAddress()); TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); @@ -263,7 +263,7 @@ RipNg::RouteInput(Ptr p, } // Check if input device supports IP forwarding - if (m_ipv6->IsForwarding(iif) == false) + if (!m_ipv6->IsForwarding(iif)) { NS_LOG_LOGIC("Forwarding disabled for this interface"); if (!ecb.IsNull()) @@ -332,8 +332,8 @@ RipNg::NotifyInterfaceUp(uint32_t i) { Ipv6InterfaceAddress address = m_ipv6->GetAddress(i, j); - if (address.GetScope() == Ipv6InterfaceAddress::LINKLOCAL && sendSocketFound == false && - activeInterface == true) + if (address.GetScope() == Ipv6InterfaceAddress::LINKLOCAL && !sendSocketFound && + activeInterface) { NS_LOG_LOGIC("RIPng: adding sending socket to " << address.GetAddress()); TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory"); diff --git a/src/internet/model/tcp-dctcp.cc b/src/internet/model/tcp-dctcp.cc index 86138993c..e0d1f9382 100644 --- a/src/internet/model/tcp-dctcp.cc +++ b/src/internet/model/tcp-dctcp.cc @@ -142,7 +142,7 @@ TcpDctcp::PktsAcked(Ptr tcb, uint32_t segmentsAcked, const Time& { m_ackedBytesEcn += segmentsAcked * tcb->m_segmentSize; } - if (m_nextSeqFlag == false) + if (!m_nextSeqFlag) { m_nextSeq = tcb->m_nextTxSequence; m_nextSeqFlag = true; @@ -196,7 +196,7 @@ TcpDctcp::CeState0to1(Ptr tcb) tcb->m_rxBuffer->SetNextRxSequence(tmpRcvNxt); } - if (m_priorRcvNxtFlag == false) + if (!m_priorRcvNxtFlag) { m_priorRcvNxtFlag = true; } @@ -223,7 +223,7 @@ TcpDctcp::CeState1to0(Ptr tcb) tcb->m_rxBuffer->SetNextRxSequence(tmpRcvNxt); } - if (m_priorRcvNxtFlag == false) + if (!m_priorRcvNxtFlag) { m_priorRcvNxtFlag = true; } diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 8f672f5be..cf7a80ca0 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -709,7 +709,7 @@ TcpSocketBase::Connect(const Address& address) // a v4 address and re-call this function Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom(address); Ipv6Address v6Addr = transport.GetIpv6(); - if (v6Addr.IsIpv4MappedAddress() == true) + if (v6Addr.IsIpv4MappedAddress()) { Ipv4Address v4Addr = v6Addr.GetIpv4MappedAddress(); return Connect(InetSocketAddress(v4Addr, transport.GetPort())); @@ -786,7 +786,7 @@ TcpSocketBase::Close() if (m_txBuffer->SizeFromSequence(m_tcb->m_nextTxSequence) > 0) { // App close with pending data must wait until all data transmitted - if (m_closeOnEmpty == false) + if (!m_closeOnEmpty) { m_closeOnEmpty = true; NS_LOG_INFO("Socket " << this << " deferring close, state " << TcpStateName[m_state]); @@ -3267,7 +3267,7 @@ TcpSocketBase::UpdateRttHistory(const SequenceNumber32& seq, uint32_t sz, bool i NS_LOG_FUNCTION(this); // update the history of sequence numbers used to calculate the RTT - if (isRetransmission == false) + if (!isRetransmission) { // This is the next expected one, just log at end m_history.emplace_back(seq, sz, Simulator::Now()); } @@ -4410,7 +4410,7 @@ TcpSocketBase::UpdateWindowSize(const TcpHeader& header) m_highRxMark = header.GetSequenceNumber(); update = true; } - if (update == true) + if (update) { m_rWnd = receivedWindow; NS_LOG_LOGIC("updating rWnd to " << m_rWnd); diff --git a/src/internet/model/tcp-tx-buffer.cc b/src/internet/model/tcp-tx-buffer.cc index d50947f04..c63a798b2 100644 --- a/src/internet/model/tcp-tx-buffer.cc +++ b/src/internet/model/tcp-tx-buffer.cc @@ -943,13 +943,13 @@ TcpTxBuffer::IsLost(const SequenceNumber32& seq) const // Search for the right iterator before calling IsLost() if (beginOfCurrentPacket >= seq) { - if ((*it)->m_lost == true) + if ((*it)->m_lost) { NS_LOG_INFO("seq=" << seq << " is lost because of lost flag"); return true; } - if ((*it)->m_sacked == true) + if ((*it)->m_sacked) { NS_LOG_INFO("seq=" << seq << " is not lost because of sacked flag"); return false; @@ -991,7 +991,7 @@ TcpTxBuffer::NextSeg(SequenceNumber32* seq, SequenceNumber32* seqHigh, bool isRe item = *it; // Condition 1.a , 1.b , and 1.c - if (item->m_retrans == false && item->m_sacked == false) + if (!item->m_retrans && !item->m_sacked) { if (item->m_lost) { @@ -1166,7 +1166,7 @@ TcpTxBuffer::IsLostRFC(const SequenceNumber32& seq, const PacketList::const_iter Ptr current; SequenceNumber32 beginOfCurrentPacket = seq; - if ((*segment)->m_sacked == true) + if ((*segment)->m_sacked) { return false; } diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc index a34ac7971..adb6c4b89 100644 --- a/src/internet/model/udp-socket-impl.cc +++ b/src/internet/model/udp-socket-impl.cc @@ -390,7 +390,7 @@ int UdpSocketImpl::Close() { NS_LOG_FUNCTION(this); - if (m_shutdownRecv == true && m_shutdownSend == true) + if (m_shutdownRecv && m_shutdownSend) { m_errno = Socket::ERROR_BADF; return -1; @@ -406,7 +406,7 @@ int UdpSocketImpl::Connect(const Address& address) { NS_LOG_FUNCTION(this << address); - if (InetSocketAddress::IsMatchingType(address) == true) + if (InetSocketAddress::IsMatchingType(address)) { InetSocketAddress transport = InetSocketAddress::ConvertFrom(address); m_defaultAddress = Address(transport.GetIpv4()); @@ -415,7 +415,7 @@ UdpSocketImpl::Connect(const Address& address) m_connected = true; NotifyConnectionSucceeded(); } - else if (Inet6SocketAddress::IsMatchingType(address) == true) + else if (Inet6SocketAddress::IsMatchingType(address)) { Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom(address); m_defaultAddress = Address(transport.GetIpv6()); @@ -457,7 +457,7 @@ int UdpSocketImpl::DoSend(Ptr p) { NS_LOG_FUNCTION(this << p); - if ((m_endPoint == nullptr) && (Ipv4Address::IsMatchingType(m_defaultAddress) == true)) + if (m_endPoint == nullptr && Ipv4Address::IsMatchingType(m_defaultAddress)) { if (Bind() == -1) { @@ -466,7 +466,7 @@ UdpSocketImpl::DoSend(Ptr p) } NS_ASSERT(m_endPoint != nullptr); } - else if ((m_endPoint6 == nullptr) && (Ipv6Address::IsMatchingType(m_defaultAddress) == true)) + else if (m_endPoint6 == nullptr && Ipv6Address::IsMatchingType(m_defaultAddress)) { if (Bind6() == -1) { diff --git a/src/internet/test/ipv4-global-routing-test-suite.cc b/src/internet/test/ipv4-global-routing-test-suite.cc index 56932ecda..5f257af86 100644 --- a/src/internet/test/ipv4-global-routing-test-suite.cc +++ b/src/internet/test/ipv4-global-routing-test-suite.cc @@ -940,7 +940,7 @@ Ipv4DynamicGlobalRoutingTestCase::HandleRead(Ptr socket) void Ipv4DynamicGlobalRoutingTestCase::SendData(uint8_t index) { - if (m_sendSocks[index].second == false) + if (!m_sendSocks[index].second) { return; } diff --git a/src/internet/test/tcp-endpoint-bug2211.cc b/src/internet/test/tcp-endpoint-bug2211.cc index d220664b0..026938629 100644 --- a/src/internet/test/tcp-endpoint-bug2211.cc +++ b/src/internet/test/tcp-endpoint-bug2211.cc @@ -119,7 +119,7 @@ TcpEndPointBug2211Test::DoRun() TypeId tid = TcpSocketFactory::GetTypeId(); Ptr sink = Socket::CreateSocket(node, tid); - if (m_v6 == false) + if (!m_v6) { sink->Bind(InetSocketAddress(Ipv4Address::GetAny(), 9)); } @@ -135,7 +135,7 @@ TcpEndPointBug2211Test::DoRun() source->Bind(); source->SetConnectCallback(MakeCallback(&TcpEndPointBug2211Test::HandleConnect, this), MakeNullCallback>()); - if (m_v6 == false) + if (!m_v6) { source->Connect(InetSocketAddress(Ipv4Address::GetLoopback(), 9)); } diff --git a/src/internet/test/tcp-pacing-test.cc b/src/internet/test/tcp-pacing-test.cc index 8f2b4a2d6..5c53212bb 100644 --- a/src/internet/test/tcp-pacing-test.cc +++ b/src/internet/test/tcp-pacing-test.cc @@ -336,14 +336,7 @@ TcpPacingTest::Tx(const Ptr p, const TcpHeader& h, SocketWho who) // so add an additional m_segmentSize to bytesInFlight uint32_t soonBytesInFlight = m_bytesInFlight + m_segmentSize; bool canPacketBeSent = ((m_curCwnd - soonBytesInFlight) >= m_segmentSize); - if (!canPacketBeSent || (m_curCwnd == 0)) - { - m_isFullCwndSent = true; - } - else - { - m_isFullCwndSent = false; - } + m_isFullCwndSent = (!canPacketBeSent || m_curCwnd == 0); m_nextPacketInterval = m_expectedInterval; NS_LOG_DEBUG("Next expected interval (s): " << m_nextPacketInterval.GetSeconds()); } diff --git a/src/internet/test/tcp-test.cc b/src/internet/test/tcp-test.cc index ee79b9a49..8a6af9e4f 100644 --- a/src/internet/test/tcp-test.cc +++ b/src/internet/test/tcp-test.cc @@ -226,7 +226,7 @@ TcpTestCase::DoRun() memset(m_sourceRxPayload, 0, m_totalBytes); memset(m_serverRxPayload, 0, m_totalBytes); - if (m_useIpv6 == true) + if (m_useIpv6) { SetupDefaultSim6(); } diff --git a/src/lr-wpan/helper/lr-wpan-helper.cc b/src/lr-wpan/helper/lr-wpan-helper.cc index a4d72efe9..0f73ab867 100644 --- a/src/lr-wpan/helper/lr-wpan-helper.cc +++ b/src/lr-wpan/helper/lr-wpan-helper.cc @@ -361,7 +361,7 @@ LrWpanHelper::EnablePcapInternal(std::string prefix, Ptr file = pcapHelper.CreateFile(filename, std::ios::out, PcapHelper::DLT_IEEE802_15_4); - if (promiscuous == true) + if (promiscuous) { device->GetMac()->TraceConnectWithoutContext("PromiscSniffer", MakeBoundCallback(&PcapSniffLrWpan, file)); diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 56b1558ff..7fb4fd334 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -1992,16 +1992,9 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) else if (receivedMacHdr.GetShortDstAddr().IsBroadcast() || receivedMacHdr.GetShortDstAddr().IsMulticast()) { - // broadcast or multicast - if (receivedMacHdr.IsAckReq()) - { - // discard broadcast/multicast with the ACK bit set - acceptFrame = false; - } - else - { - acceptFrame = true; - } + // Broadcast or multicast. + // Discard broadcast/multicast with the ACK bit set. + acceptFrame = !receivedMacHdr.IsAckReq(); } else { @@ -2045,7 +2038,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) if (receivedMacPayload.GetCommandFrameType() == CommandPayloadHeader::ASSOCIATION_REQ && - !(m_macAssociationPermit == true && m_panCoor == true)) + !(m_macAssociationPermit && m_panCoor)) { acceptFrame = false; } diff --git a/src/lr-wpan/model/lr-wpan-phy.cc b/src/lr-wpan/model/lr-wpan-phy.cc index 81e17a8bf..f0f9ad606 100644 --- a/src/lr-wpan/model/lr-wpan-phy.cc +++ b/src/lr-wpan/model/lr-wpan-phy.cc @@ -1484,7 +1484,7 @@ LrWpanPhy::EndTx() NS_ABORT_IF((m_trxState != IEEE_802_15_4_PHY_BUSY_TX) && (m_trxState != IEEE_802_15_4_PHY_TRX_OFF)); - if (m_currentTxPacket.second == false) + if (!m_currentTxPacket.second) { NS_LOG_DEBUG("Packet successfully transmitted"); m_phyTxEndTrace(m_currentTxPacket.first); diff --git a/src/lte/examples/lena-radio-link-failure.cc b/src/lte/examples/lena-radio-link-failure.cc index e007da944..5f73b87f9 100644 --- a/src/lte/examples/lena-radio-link-failure.cc +++ b/src/lte/examples/lena-radio-link-failure.cc @@ -318,7 +318,7 @@ Throughput(bool firstWrite, Time binSize, std::string fileName) { std::ofstream output; - if (firstWrite == true) + if (firstWrite) { output.open(fileName, std::ofstream::out); firstWrite = false; diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 08337c317..2d84337e2 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -739,7 +739,7 @@ LteHelper::InstallSingleEnbDevice(Ptr n) it->first, DynamicCast(it->second)->GetMac()->GetLteMacSapProvider()); - if (ccmTest == false) + if (!ccmTest) { NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders"); } @@ -987,7 +987,7 @@ LteHelper::InstallSingleUeDevice(Ptr n) ccmUe->SetComponentCarrierMacSapProviders(it->first, it->second->GetMac()->GetLteMacSapProvider()); - if (ccmTest == false) + if (!ccmTest) { NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders"); } @@ -1572,7 +1572,7 @@ int64_t LteHelper::AssignStreams(NetDeviceContainer c, int64_t stream) { int64_t currentStream = stream; - if (m_fadingModel && (m_fadingStreamsAssigned == false)) + if (m_fadingModel && !m_fadingStreamsAssigned) { Ptr tflm = m_fadingModel->GetObject(); if (tflm) diff --git a/src/lte/helper/lte-stats-calculator.cc b/src/lte/helper/lte-stats-calculator.cc index 456f9d840..d760109ea 100644 --- a/src/lte/helper/lte-stats-calculator.cc +++ b/src/lte/helper/lte-stats-calculator.cc @@ -82,14 +82,7 @@ LteStatsCalculator::GetDlOutputFilename() bool LteStatsCalculator::ExistsImsiPath(std::string path) { - if (m_pathImsiMap.find(path) == m_pathImsiMap.end()) - { - return false; - } - else - { - return true; - } + return m_pathImsiMap.find(path) != m_pathImsiMap.end(); } void @@ -108,14 +101,7 @@ LteStatsCalculator::GetImsiPath(std::string path) bool LteStatsCalculator::ExistsCellIdPath(std::string path) { - if (m_pathCellIdMap.find(path) == m_pathCellIdMap.end()) - { - return false; - } - else - { - return true; - } + return m_pathCellIdMap.find(path) != m_pathCellIdMap.end(); } void diff --git a/src/lte/helper/mac-stats-calculator.cc b/src/lte/helper/mac-stats-calculator.cc index 0339fc16f..297ad71bb 100644 --- a/src/lte/helper/mac-stats-calculator.cc +++ b/src/lte/helper/mac-stats-calculator.cc @@ -110,7 +110,7 @@ MacStatsCalculator::DlScheduling(uint16_t cellId, << (uint32_t)dlSchedulingCallbackInfo.mcsTb2 << dlSchedulingCallbackInfo.sizeTb2); NS_LOG_INFO("Write DL Mac Stats in " << GetDlOutputFilename()); - if (m_dlFirstWrite == true) + if (m_dlFirstWrite) { m_dlOutFile.open(GetDlOutputFilename()); if (!m_dlOutFile.is_open()) @@ -151,7 +151,7 @@ MacStatsCalculator::UlScheduling(uint16_t cellId, << size); NS_LOG_INFO("Write UL Mac Stats in " << GetUlOutputFilename()); - if (m_ulFirstWrite == true) + if (m_ulFirstWrite) { m_ulOutFile.open(GetUlOutputFilename()); if (!m_ulOutFile.is_open()) @@ -185,7 +185,7 @@ MacStatsCalculator::DlSchedulingCallback(Ptr macStats, std::ostringstream pathAndRnti; std::string pathEnb = path.substr(0, path.find("/ComponentCarrierMap")); pathAndRnti << pathEnb << "/LteEnbRrc/UeMap/" << dlSchedulingCallbackInfo.rnti; - if (macStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (macStats->ExistsImsiPath(pathAndRnti.str())) { imsi = macStats->GetImsiPath(pathAndRnti.str()); } @@ -195,7 +195,7 @@ MacStatsCalculator::DlSchedulingCallback(Ptr macStats, macStats->SetImsiPath(pathAndRnti.str(), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(pathAndRnti.str()) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str())) { cellId = macStats->GetCellIdPath(pathAndRnti.str()); } @@ -224,7 +224,7 @@ MacStatsCalculator::UlSchedulingCallback(Ptr macStats, std::ostringstream pathAndRnti; std::string pathEnb = path.substr(0, path.find("/ComponentCarrierMap")); pathAndRnti << pathEnb << "/LteEnbRrc/UeMap/" << rnti; - if (macStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (macStats->ExistsImsiPath(pathAndRnti.str())) { imsi = macStats->GetImsiPath(pathAndRnti.str()); } @@ -234,7 +234,7 @@ MacStatsCalculator::UlSchedulingCallback(Ptr macStats, macStats->SetImsiPath(pathAndRnti.str(), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(pathAndRnti.str()) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str())) { cellId = macStats->GetCellIdPath(pathAndRnti.str()); } diff --git a/src/lte/helper/phy-rx-stats-calculator.cc b/src/lte/helper/phy-rx-stats-calculator.cc index 447edb8be..cd108dc69 100644 --- a/src/lte/helper/phy-rx-stats-calculator.cc +++ b/src/lte/helper/phy-rx-stats-calculator.cc @@ -106,7 +106,7 @@ PhyRxStatsCalculator::DlPhyReception(PhyReceptionStatParameters params) << params.m_ndi << params.m_correctness); NS_LOG_INFO("Write DL Rx Phy Stats in " << GetDlRxOutputFilename()); - if (m_dlRxFirstWrite == true) + if (m_dlRxFirstWrite) { m_dlRxOutFile.open(GetDlRxOutputFilename()); if (!m_dlRxOutFile.is_open()) @@ -142,7 +142,7 @@ PhyRxStatsCalculator::UlPhyReception(PhyReceptionStatParameters params) << params.m_ndi << params.m_correctness); NS_LOG_INFO("Write UL Rx Phy Stats in " << GetUlRxOutputFilename()); - if (m_ulRxFirstWrite == true) + if (m_ulRxFirstWrite) { m_ulRxOutFile.open(GetUlRxOutputFilename()); if (!m_ulRxOutFile.is_open()) @@ -178,7 +178,7 @@ PhyRxStatsCalculator::DlPhyReceptionCallback(Ptr phyRxStat std::ostringstream pathAndRnti; pathAndRnti << path << "/" << params.m_rnti; std::string pathUePhy = path.substr(0, path.find("/ComponentCarrierMapUe")); - if (phyRxStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (phyRxStats->ExistsImsiPath(pathAndRnti.str())) { imsi = phyRxStats->GetImsiPath(pathAndRnti.str()); } @@ -202,7 +202,7 @@ PhyRxStatsCalculator::UlPhyReceptionCallback(Ptr phyRxStat std::ostringstream pathAndRnti; std::string pathEnb = path.substr(0, path.find("/ComponentCarrierMap")); pathAndRnti << pathEnb << "/LteEnbRrc/UeMap/" << params.m_rnti; - if (phyRxStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (phyRxStats->ExistsImsiPath(pathAndRnti.str())) { imsi = phyRxStats->GetImsiPath(pathAndRnti.str()); } diff --git a/src/lte/helper/phy-stats-calculator.cc b/src/lte/helper/phy-stats-calculator.cc index ffa07a31d..32d516745 100644 --- a/src/lte/helper/phy-stats-calculator.cc +++ b/src/lte/helper/phy-stats-calculator.cc @@ -132,7 +132,7 @@ PhyStatsCalculator::ReportCurrentCellRsrpSinr(uint16_t cellId, NS_LOG_FUNCTION(this << cellId << imsi << rnti << rsrp << sinr); NS_LOG_INFO("Write RSRP/SINR Phy Stats in " << GetCurrentCellRsrpSinrFilename()); - if (m_RsrpSinrFirstWrite == true) + if (m_RsrpSinrFirstWrite) { m_rsrpOutFile.open(GetCurrentCellRsrpSinrFilename()); if (!m_rsrpOutFile.is_open()) @@ -164,7 +164,7 @@ PhyStatsCalculator::ReportUeSinr(uint16_t cellId, NS_LOG_FUNCTION(this << cellId << imsi << rnti << sinrLinear); NS_LOG_INFO("Write SINR Linear Phy Stats in " << GetUeSinrFilename()); - if (m_UeSinrFirstWrite == true) + if (m_UeSinrFirstWrite) { m_ueSinrOutFile.open(GetUeSinrFilename()); if (!m_ueSinrOutFile.is_open()) @@ -190,7 +190,7 @@ PhyStatsCalculator::ReportInterference(uint16_t cellId, Ptr inter NS_LOG_FUNCTION(this << cellId << interference); NS_LOG_INFO("Write Interference Phy Stats in " << GetInterferenceFilename()); - if (m_InterferenceFirstWrite == true) + if (m_InterferenceFirstWrite) { m_interferenceOutFile.open(GetInterferenceFilename()); if (!m_interferenceOutFile.is_open()) @@ -220,7 +220,7 @@ PhyStatsCalculator::ReportCurrentCellRsrpSinrCallback(Ptr ph NS_LOG_FUNCTION(phyStats << path); uint64_t imsi = 0; std::string pathUePhy = path.substr(0, path.find("/ComponentCarrierMapUe")); - if (phyStats->ExistsImsiPath(pathUePhy) == true) + if (phyStats->ExistsImsiPath(pathUePhy)) { imsi = phyStats->GetImsiPath(pathUePhy); } @@ -248,7 +248,7 @@ PhyStatsCalculator::ReportUeSinr(Ptr phyStats, pathAndRnti << path << "/" << rnti; std::string pathEnbMac = path.substr(0, path.find("/ComponentCarrierMap")); pathEnbMac += "/LteEnbMac/DlScheduling"; - if (phyStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (phyStats->ExistsImsiPath(pathAndRnti.str())) { imsi = phyStats->GetImsiPath(pathAndRnti.str()); } diff --git a/src/lte/helper/phy-tx-stats-calculator.cc b/src/lte/helper/phy-tx-stats-calculator.cc index 3cff748cb..afb7b96d4 100644 --- a/src/lte/helper/phy-tx-stats-calculator.cc +++ b/src/lte/helper/phy-tx-stats-calculator.cc @@ -106,7 +106,7 @@ PhyTxStatsCalculator::DlPhyTransmission(PhyTransmissionStatParameters params) << params.m_ndi); NS_LOG_INFO("Write DL Tx Phy Stats in " << GetDlTxOutputFilename()); - if (m_dlTxFirstWrite == true) + if (m_dlTxFirstWrite) { m_dlTxOutFile.open(GetDlOutputFilename()); if (!m_dlTxOutFile.is_open()) @@ -140,7 +140,7 @@ PhyTxStatsCalculator::UlPhyTransmission(PhyTransmissionStatParameters params) << params.m_ndi); NS_LOG_INFO("Write UL Tx Phy Stats in " << GetUlTxOutputFilename()); - if (m_ulTxFirstWrite == true) + if (m_ulTxFirstWrite) { m_ulTxOutFile.open(GetUlTxOutputFilename()); if (!m_ulTxOutFile.is_open()) @@ -177,7 +177,7 @@ PhyTxStatsCalculator::DlPhyTransmissionCallback(Ptr phyTxS std::ostringstream pathAndRnti; std::string pathEnb = path.substr(0, path.find("/ComponentCarrierMap")); pathAndRnti << pathEnb << "/LteEnbRrc/UeMap/" << params.m_rnti; - if (phyTxStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (phyTxStats->ExistsImsiPath(pathAndRnti.str())) { imsi = phyTxStats->GetImsiPath(pathAndRnti.str()); } @@ -201,7 +201,7 @@ PhyTxStatsCalculator::UlPhyTransmissionCallback(Ptr phyTxS std::ostringstream pathAndRnti; pathAndRnti << path << "/" << params.m_rnti; std::string pathUePhy = path.substr(0, path.find("/ComponentCarrierMapUe")); - if (phyTxStats->ExistsImsiPath(pathAndRnti.str()) == true) + if (phyTxStats->ExistsImsiPath(pathAndRnti.str())) { imsi = phyTxStats->GetImsiPath(pathAndRnti.str()); } diff --git a/src/lte/helper/radio-bearer-stats-calculator.cc b/src/lte/helper/radio-bearer-stats-calculator.cc index 9685ac491..55d639cd5 100644 --- a/src/lte/helper/radio-bearer-stats-calculator.cc +++ b/src/lte/helper/radio-bearer-stats-calculator.cc @@ -244,7 +244,7 @@ RadioBearerStatsCalculator::ShowResults() std::ofstream ulOutFile; std::ofstream dlOutFile; - if (m_firstWrite == true) + if (m_firstWrite) { ulOutFile.open(GetUlOutputFilename()); if (!ulOutFile.is_open()) diff --git a/src/lte/model/cqa-ff-mac-scheduler.cc b/src/lte/model/cqa-ff-mac-scheduler.cc index e48d7f672..4109dd2fd 100644 --- a/src/lte/model/cqa-ff-mac-scheduler.cc +++ b/src/lte/model/cqa-ff-mac-scheduler.cc @@ -570,14 +570,8 @@ CqaFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -585,7 +579,7 @@ CqaFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -687,7 +681,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( rbgMap = m_ffrSapProvider->GetAvailableDlRbg(); for (std::vector::iterator it = rbgMap.begin(); it != rbgMap.end(); it++) { - if ((*it) == true) + if (*it) { rbgAllocatedNum++; } @@ -715,7 +709,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( for (std::vector::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++) { - if ((*it) == true) + if (*it) { if (tmpMinBandwidth > maxContinuousUlBandwidth) { @@ -786,7 +780,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -851,7 +845,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -947,7 +941,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -975,7 +969,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1328,7 +1322,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( std::set availableRBGs; for (int i = 0; i < numberOfRBGs; i++) { - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { availableRBGs.insert(i); } @@ -1400,7 +1394,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( std::map::iterator itStats; - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(currentRB, flowId.m_rnti)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(currentRB, flowId.m_rnti)) { continue; } @@ -1688,7 +1682,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1719,7 +1713,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1926,7 +1920,7 @@ CqaFfMacScheduler::DoSchedUlTriggerReq( for (std::vector::iterator it = rbMap.begin(); it != rbMap.end(); it++) { - if ((*it) == true) + if (*it) { rbAllocatedNum++; } @@ -1945,7 +1939,7 @@ CqaFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1986,7 +1980,7 @@ CqaFfMacScheduler::DoSchedUlTriggerReq( for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -2127,12 +2121,12 @@ CqaFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; } - if ((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) == false) + if (!m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) { free = false; break; @@ -2249,7 +2243,7 @@ CqaFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/epc-gtpu-header.cc b/src/lte/model/epc-gtpu-header.cc index 79b69dc1b..f3de6628c 100644 --- a/src/lte/model/epc-gtpu-header.cc +++ b/src/lte/model/epc-gtpu-header.cc @@ -270,16 +270,12 @@ GtpuHeader::SetVersion(uint8_t m_version) bool GtpuHeader::operator==(const GtpuHeader& b) const { - if (m_version == b.m_version && m_protocolType == b.m_protocolType && - m_extensionHeaderFlag == b.m_extensionHeaderFlag && - m_sequenceNumberFlag == b.m_sequenceNumberFlag && m_nPduNumberFlag == b.m_nPduNumberFlag && - m_messageType == b.m_messageType && m_length == b.m_length && m_teid == b.m_teid && - m_sequenceNumber == b.m_sequenceNumber && m_nPduNumber == b.m_nPduNumber && - m_nextExtensionType == b.m_nextExtensionType) - { - return true; - } - return false; + return m_version == b.m_version && m_protocolType == b.m_protocolType && + m_extensionHeaderFlag == b.m_extensionHeaderFlag && + m_sequenceNumberFlag == b.m_sequenceNumberFlag && + m_nPduNumberFlag == b.m_nPduNumberFlag && m_messageType == b.m_messageType && + m_length == b.m_length && m_teid == b.m_teid && m_sequenceNumber == b.m_sequenceNumber && + m_nPduNumber == b.m_nPduNumber && m_nextExtensionType == b.m_nextExtensionType; } } // namespace ns3 diff --git a/src/lte/model/fdbet-ff-mac-scheduler.cc b/src/lte/model/fdbet-ff-mac-scheduler.cc index 3623eb09a..d55e3ace3 100644 --- a/src/lte/model/fdbet-ff-mac-scheduler.cc +++ b/src/lte/model/fdbet-ff-mac-scheduler.cc @@ -390,14 +390,8 @@ FdBetFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -405,7 +399,7 @@ FdBetFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -550,7 +544,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -615,7 +609,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -711,7 +705,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -739,7 +733,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -971,7 +965,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( do { NS_LOG_INFO(this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { // allocate one RBG to current UE std::map>::iterator itMap; @@ -1142,7 +1136,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1172,7 +1166,7 @@ FdBetFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1365,7 +1359,7 @@ FdBetFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1405,7 +1399,7 @@ FdBetFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1541,7 +1535,7 @@ FdBetFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1656,7 +1650,7 @@ FdBetFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/fdmt-ff-mac-scheduler.cc b/src/lte/model/fdmt-ff-mac-scheduler.cc index a2896e773..9fb9ede96 100644 --- a/src/lte/model/fdmt-ff-mac-scheduler.cc +++ b/src/lte/model/fdmt-ff-mac-scheduler.cc @@ -379,14 +379,8 @@ FdMtFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -394,7 +388,7 @@ FdMtFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -539,7 +533,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -604,7 +598,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -700,7 +694,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -728,7 +722,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -887,7 +881,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( for (int i = 0; i < rbgNum; i++) { NS_LOG_INFO(this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { std::set::iterator it; std::set::iterator itMax = m_flowStatsDl.end(); @@ -1129,7 +1123,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1159,7 +1153,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1325,7 +1319,7 @@ FdMtFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1365,7 +1359,7 @@ FdMtFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1500,7 +1494,7 @@ FdMtFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1615,7 +1609,7 @@ FdMtFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/fdtbfq-ff-mac-scheduler.cc b/src/lte/model/fdtbfq-ff-mac-scheduler.cc index 7a47b03ca..1b8995256 100644 --- a/src/lte/model/fdtbfq-ff-mac-scheduler.cc +++ b/src/lte/model/fdtbfq-ff-mac-scheduler.cc @@ -444,14 +444,8 @@ FdTbfqFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -459,7 +453,7 @@ FdTbfqFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -553,7 +547,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( rbgMap = m_ffrSapProvider->GetAvailableDlRbg(); for (std::vector::iterator it = rbgMap.begin(); it != rbgMap.end(); it++) { - if ((*it) == true) + if (*it) { rbgAllocatedNum++; } @@ -581,7 +575,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( for (std::vector::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++) { - if ((*it) == true) + if (*it) { if (tmpMinBandwidth > maxContinuousUlBandwidth) { @@ -652,7 +646,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -717,7 +711,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -813,7 +807,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -841,7 +835,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1092,7 +1086,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( double metric = (((double)(*it).second.counter) / ((double)(*it).second.tokenGenerationRate)); - if (firstRnti == true) + if (firstRnti) { metricMax = metric; itMax = it; @@ -1198,12 +1192,12 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( continue; } - if (rbgMap.at(k) == true) // this RBG is allocated in RACH procedure + if (rbgMap.at(k)) // this RBG is allocated in RACH procedure { continue; } - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(k, (*itMax).first)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(k, (*itMax).first)) { continue; } @@ -1528,7 +1522,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1558,7 +1552,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1722,7 +1716,7 @@ FdTbfqFfMacScheduler::DoSchedUlTriggerReq( for (std::vector::iterator it = rbMap.begin(); it != rbMap.end(); it++) { - if ((*it) == true) + if (*it) { rbAllocatedNum++; } @@ -1741,7 +1735,7 @@ FdTbfqFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1781,7 +1775,7 @@ FdTbfqFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1922,12 +1916,12 @@ FdTbfqFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; } - if ((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) == false) + if (!m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) { free = false; break; @@ -2044,7 +2038,7 @@ FdTbfqFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/lte-anr.cc b/src/lte/model/lte-anr.cc index 73adb7c48..7424386c6 100644 --- a/src/lte/model/lte-anr.cc +++ b/src/lte/model/lte-anr.cc @@ -174,7 +174,7 @@ LteAnr::DoReportUeMeas(LteRrcSap::MeasResults measResults) // Update neighbour relation entry NS_LOG_LOGIC(this << " updating NRT of cell " << m_servingCellId << " with entry of cell " << it->physCellId); - if (itNrt->second.noX2 == false) + if (!itNrt->second.noX2) { NS_LOG_LOGIC(this << " enabling handover" << " from cell " << m_servingCellId << " to cell " diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 22812abf3..234147dd1 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -736,7 +736,7 @@ LteEnbPhy::StartSubFrame() it != rarMsg->RarListEnd(); ++it) { - if (it->rarPayload.m_grant.m_ulDelay == true) + if (it->rarPayload.m_grant.m_ulDelay) { NS_FATAL_ERROR(" RAR delay is not yet implemented"); } diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index d893bd84c..4a60537b2 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -679,7 +679,7 @@ UeManager::PrepareHandover(uint16_t cellId) uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId); LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue anrcrv = m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti); - if (anrcrv.valid == false) + if (!anrcrv.valid) { NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => " "cannot perform HO"); @@ -1145,7 +1145,7 @@ UeManager::RecvRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg) case INITIAL_RANDOM_ACCESS: { m_connectionRequestTimeout.Cancel(); - if (m_rrc->m_admitRrcConnectionRequest == true) + if (m_rrc->m_admitRrcConnectionRequest) { m_imsi = msg.ueIdentity; @@ -1195,7 +1195,7 @@ UeManager::RecvRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupComplete { case CONNECTION_SETUP: m_connectionSetupTimeout.Cancel(); - if (m_caSupportConfigured == false && m_rrc->m_numberOfComponentCarriers > 1) + if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1) { m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration m_pendingStartDataRadioBearers = true; @@ -1610,7 +1610,7 @@ UeManager::BuildRrcConnectionReconfiguration() msg.haveMobilityControlInfo = false; msg.haveMeasConfig = true; msg.measConfig = m_rrc->m_ueMeasConfig; - if (m_caSupportConfigured == false && m_rrc->m_numberOfComponentCarriers > 1) + if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1) { m_caSupportConfigured = true; NS_LOG_FUNCTION(this << "CA not configured. Configure now!"); @@ -1733,11 +1733,11 @@ UeManager::SwitchToState(State newState) break; case CONNECTED_NORMALLY: { - if (m_pendingRrcConnectionReconfiguration == true) + if (m_pendingRrcConnectionReconfiguration) { ScheduleRrcConnectionReconfiguration(); } - if (m_pendingStartDataRadioBearers == true && m_caSupportConfigured == true) + if (m_pendingStartDataRadioBearers && m_caSupportConfigured) { StartDataRadioBearers(); } @@ -2867,7 +2867,7 @@ LteEnbRrc::DoRecvHandoverRequest(EpcX2SapUser::HandoverRequestParams req) NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId); // if no SRS index is available, then do not accept the handover - if (m_admitHandoverRequest == false || IsMaxSrsReached()) + if (!m_admitHandoverRequest || IsMaxSrsReached()) { NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId); EpcX2Sap::HandoverPreparationFailureParams res; @@ -2887,7 +2887,7 @@ LteEnbRrc::DoRecvHandoverRequest(EpcX2SapUser::HandoverRequestParams req) ueManager->SetImsi(req.mmeUeS1apId); LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue anrcrv = m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti); - if (anrcrv.valid == false) + if (!anrcrv.valid) { NS_LOG_INFO( this @@ -3487,14 +3487,7 @@ LteEnbRrc::IsMaxSrsReached() NS_ASSERT(m_srsCurrentPeriodicityId < SRS_ENTRIES); NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set " << m_ueSrsConfigurationIndexSet.size()); - if (m_ueSrsConfigurationIndexSet.size() >= g_srsPeriodicity[m_srsCurrentPeriodicityId]) - { - return true; - } - else - { - return false; - } + return m_ueSrsConfigurationIndexSet.size() >= g_srsPeriodicity[m_srsCurrentPeriodicityId]; } uint8_t diff --git a/src/lte/model/lte-ffr-distributed-algorithm.cc b/src/lte/model/lte-ffr-distributed-algorithm.cc index 352103171..3e74e6a9a 100644 --- a/src/lte/model/lte-ffr-distributed-algorithm.cc +++ b/src/lte/model/lte-ffr-distributed-algorithm.cc @@ -465,7 +465,7 @@ LteFfrDistributedAlgorithm::DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults found = true; } } - if (found == false) + if (!found) { m_neighborCell.push_back(it->physCellId); } diff --git a/src/lte/model/lte-ffr-enhanced-algorithm.cc b/src/lte/model/lte-ffr-enhanced-algorithm.cc index d56578015..e8e53f754 100644 --- a/src/lte/model/lte-ffr-enhanced-algorithm.cc +++ b/src/lte/model/lte-ffr-enhanced-algorithm.cc @@ -486,7 +486,7 @@ LteFfrEnhancedAlgorithm::DoGetAvailableDlRbg() for (uint32_t i = 0; i < rbgMap.size(); i++) { NS_LOG_INFO("\t rbgId: " << i << " available " << (int)rbgAvailableMap.at(i)); - if (rbgAvailableMap.at(i) == true) + if (rbgAvailableMap.at(i)) { rbgMap.at(i) = false; } @@ -546,7 +546,7 @@ LteFfrEnhancedAlgorithm::DoIsDlRbgAvailableForUe(int rbgId, uint16_t rnti) { NS_LOG_INFO("RNTI: " << rnti << " rbgId: " << rbgId << " available: " << it->second.at(rbgId)); - if (it->second.at(rbgId) == true) + if (it->second.at(rbgId)) { return true; } @@ -582,7 +582,7 @@ LteFfrEnhancedAlgorithm::DoGetAvailableUlRbg() for (uint32_t i = 0; i < rbgMap.size(); i++) { NS_LOG_INFO("\t rbgId: " << i << " available " << (int)rbAvailableMap.at(i)); - if (rbAvailableMap.at(i) == true) + if (rbAvailableMap.at(i)) { rbgMap.at(i) = false; } @@ -646,7 +646,7 @@ LteFfrEnhancedAlgorithm::DoIsUlRbgAvailableForUe(int rbgId, uint16_t rnti) { NS_LOG_INFO("RNTI: " << rnti << " rbgId: " << rbgId << " available: " << it->second.at(rbgId)); - if (it->second.at(rbgId) == true) + if (it->second.at(rbgId)) { return true; } @@ -732,7 +732,7 @@ LteFfrEnhancedAlgorithm::DoReportDlCqiInfo( isSecondarySegmentRbg = m_dlSecondarySegmentRbgMap[i]; } - rbgAvailable = (isSecondarySegmentRbg == true) ? rbgAvailable : false; + rbgAvailable = (isSecondarySegmentRbg ? rbgAvailable : false); rbgAvailableMap.push_back(rbgAvailable); } diff --git a/src/lte/model/lte-ffr-soft-algorithm.cc b/src/lte/model/lte-ffr-soft-algorithm.cc index 157ce1fce..0ca1fac35 100644 --- a/src/lte/model/lte-ffr-soft-algorithm.cc +++ b/src/lte/model/lte-ffr-soft-algorithm.cc @@ -601,7 +601,7 @@ LteFfrSoftAlgorithm::DoGetMinContinuousUlBandwidth() for (std::size_t i = 0; i < m_ulCenterRbgMap.size(); i++) { - if (m_ulCenterRbgMap[i] == true) + if (m_ulCenterRbgMap[i]) { centerSubBandwidth++; } @@ -609,7 +609,7 @@ LteFfrSoftAlgorithm::DoGetMinContinuousUlBandwidth() for (std::size_t i = 0; i < m_ulMediumRbgMap.size(); i++) { - if (m_ulMediumRbgMap[i] == true) + if (m_ulMediumRbgMap[i]) { mediumSubBandwidth++; } @@ -617,7 +617,7 @@ LteFfrSoftAlgorithm::DoGetMinContinuousUlBandwidth() for (std::size_t i = 0; i < m_ulEdgeRbgMap.size(); i++) { - if (m_ulEdgeRbgMap[i] == true) + if (m_ulEdgeRbgMap[i]) { edgeSubBandwidth++; } diff --git a/src/lte/model/lte-interference.cc b/src/lte/model/lte-interference.cc index 35c6efd44..8e332ebe8 100644 --- a/src/lte/model/lte-interference.cc +++ b/src/lte/model/lte-interference.cc @@ -66,7 +66,7 @@ void LteInterference::StartRx(Ptr rxPsd) { NS_LOG_FUNCTION(this << *rxPsd); - if (m_receiving == false) + if (!m_receiving) { NS_LOG_LOGIC("first signal"); m_rxSignal = rxPsd->Copy(); @@ -109,7 +109,7 @@ void LteInterference::EndRx() { NS_LOG_FUNCTION(this); - if (m_receiving != true) + if (!m_receiving) { NS_LOG_INFO("EndRx was already evaluated or RX was aborted"); } @@ -235,7 +235,7 @@ LteInterference::SetNoisePowerSpectralDensity(Ptr noisePsd) // reset m_allSignals (will reset if already set previously) // this is needed since this method can potentially change the SpectrumModel m_allSignals = Create(noisePsd->GetSpectrumModel()); - if (m_receiving == true) + if (m_receiving) { // abort rx m_receiving = false; diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index 2c0840601..95a2994a2 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -764,7 +764,7 @@ LteSpectrumPhy::StartRxDlCtrl(Ptr lteDlC // common code for the two states // check presence of PSS for UE measuerements - if (lteDlCtrlRxParams->pss == true) + if (lteDlCtrlRxParams->pss) { if (!m_ltePhyRxPssCallback.IsNull()) { diff --git a/src/lte/model/lte-ue-mac.cc b/src/lte/model/lte-ue-mac.cc index 9ef09f5c6..296f223c4 100644 --- a/src/lte/model/lte-ue-mac.cc +++ b/src/lte/model/lte-ue-mac.cc @@ -921,7 +921,7 @@ LteUeMac::DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo) m_frameNo = frameNo; m_subframeNo = subframeNo; RefreshHarqProcessesPacketBuffer(); - if ((Simulator::Now() >= m_bsrLast + m_bsrPeriodicity) && (m_freshUlBsr == true)) + if ((Simulator::Now() >= m_bsrLast + m_bsrPeriodicity) && m_freshUlBsr) { if (m_componentCarrierId == 0) { diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index 8b8fd7e88..2b5966f64 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -1307,7 +1307,7 @@ LteUeRrc::EvaluateCellForSelection() uint32_t cellCsgId = m_lastSib1.cellAccessRelatedInfo.csgIdentity; bool cellCsgIndication = m_lastSib1.cellAccessRelatedInfo.csgIndication; - isSuitableCell = (cellCsgIndication == false) || (cellCsgId == m_csgWhiteList); + isSuitableCell = (!cellCsgIndication || cellCsgId == m_csgWhiteList); NS_LOG_LOGIC(this << " csg(ue/cell/indication)=" << m_csgWhiteList << "/" << cellCsgId << "/" << cellCsgIndication); diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 474b4f753..eee4b5014 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -392,14 +392,8 @@ PfFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -407,7 +401,7 @@ PfFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -501,7 +495,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( rbgMap = m_ffrSapProvider->GetAvailableDlRbg(); for (std::vector::iterator it = rbgMap.begin(); it != rbgMap.end(); it++) { - if ((*it) == true) + if (*it) { rbgAllocatedNum++; } @@ -529,7 +523,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( for (std::vector::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++) { - if ((*it) == true) + if (*it) { if (tmpMinBandwidth > maxContinuousUlBandwidth) { @@ -600,7 +594,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -665,7 +659,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -761,7 +755,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -789,7 +783,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -948,20 +942,20 @@ PfFfMacScheduler::DoSchedDlTriggerReq( for (int i = 0; i < rbgNum; i++) { NS_LOG_INFO(this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { std::map::iterator it; std::map::iterator itMax = m_flowStatsDl.end(); double rcqiMax = 0.0; for (it = m_flowStatsDl.begin(); it != m_flowStatsDl.end(); it++) { - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) { continue; } std::set::iterator itRnti = rntiAllocated.find((*it).first); - if ((itRnti != rntiAllocated.end()) || (!HarqProcessAvailability((*it).first))) + if (itRnti != rntiAllocated.end() || !HarqProcessAvailability((*it).first)) { // UE already allocated for HARQ or without HARQ process available -> drop it if (itRnti != rntiAllocated.end()) @@ -1206,7 +1200,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1236,7 +1230,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1426,7 +1420,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq( for (std::vector::iterator it = rbMap.begin(); it != rbMap.end(); it++) { - if ((*it) == true) + if (*it) { rbAllocatedNum++; } @@ -1445,7 +1439,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback @@ -1486,7 +1480,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1627,12 +1621,12 @@ PfFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; } - if ((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) == false) + if (!m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) { free = false; break; @@ -1749,7 +1743,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/pss-ff-mac-scheduler.cc b/src/lte/model/pss-ff-mac-scheduler.cc index 18acc2225..4b2df5ba2 100644 --- a/src/lte/model/pss-ff-mac-scheduler.cc +++ b/src/lte/model/pss-ff-mac-scheduler.cc @@ -424,14 +424,8 @@ PssFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -439,7 +433,7 @@ PssFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -533,7 +527,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( rbgMap = m_ffrSapProvider->GetAvailableDlRbg(); for (std::vector::iterator it = rbgMap.begin(); it != rbgMap.end(); it++) { - if ((*it) == true) + if (*it) { rbgAllocatedNum++; } @@ -561,7 +555,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( for (std::vector::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++) { - if ((*it) == true) + if (*it) { if (tmpMinBandwidth > maxContinuousUlBandwidth) { @@ -632,7 +626,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -697,7 +691,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -793,7 +787,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -821,7 +815,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1212,7 +1206,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( for (int i = 0; i < rbgNum; i++) { - if (rbgMap.at(i) == true) + if (rbgMap.at(i)) { continue; } @@ -1221,7 +1215,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( double metricMax = 0.0; for (it = tdUeSet.begin(); it != tdUeSet.end(); it++) { - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) { continue; } @@ -1322,7 +1316,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( // FD scheduler: Proportional Fair scheduled (PFsch) for (int i = 0; i < rbgNum; i++) { - if (rbgMap.at(i) == true) + if (rbgMap.at(i)) { continue; } @@ -1331,7 +1325,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( double metricMax = 0.0; for (it = tdUeSet.begin(); it != tdUeSet.end(); it++) { - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*it).first)) { continue; } @@ -1561,7 +1555,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1591,7 +1585,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1789,7 +1783,7 @@ PssFfMacScheduler::DoSchedUlTriggerReq( for (std::vector::iterator it = rbMap.begin(); it != rbMap.end(); it++) { - if ((*it) == true) + if (*it) { rbAllocatedNum++; } @@ -1808,7 +1802,7 @@ PssFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1848,7 +1842,7 @@ PssFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1989,12 +1983,12 @@ PssFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; } - if ((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) == false) + if (!m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) { free = false; break; @@ -2111,7 +2105,7 @@ PssFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index b1b9332de..af174683b 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -303,7 +303,7 @@ RrFfMacScheduler::DoSchedDlRlcBufferReq( << params.m_rlcRetransmissionQueueSize << " RLC stat size " << params.m_rlcStatusPduSize); // initialize statistics of the flow in case of new flows - if (newLc == true) + if (newLc) { m_p10CqiRxed.insert( std::pair(params.m_rnti, 1)); // only codeword 0 at this stage (SISO) @@ -370,14 +370,8 @@ RrFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -385,7 +379,7 @@ RrFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -525,7 +519,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -590,7 +584,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -686,7 +680,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -714,7 +708,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1043,7 +1037,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( rlcPduSize); newRlcPduLe.push_back(newRlcEl); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1076,7 +1070,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( NS_LOG_INFO("RBG:"); while (i < rbgPerTb) { - if (rbgMap.at(rbgAllocated) == false) + if (!rbgMap.at(rbgAllocated)) { rbgMask = rbgMask + (0x1 << rbgAllocated); NS_LOG_INFO("\t " << rbgAllocated); @@ -1098,7 +1092,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq( newDci.m_tpc = 1; // 1 is mapped to 0 in Accumulated Mode and to -1 in Absolute Mode newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1220,7 +1214,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1260,7 +1254,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1389,7 +1383,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1497,7 +1491,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/tdbet-ff-mac-scheduler.cc b/src/lte/model/tdbet-ff-mac-scheduler.cc index 1e28b7e47..65cf9e177 100644 --- a/src/lte/model/tdbet-ff-mac-scheduler.cc +++ b/src/lte/model/tdbet-ff-mac-scheduler.cc @@ -390,14 +390,8 @@ TdBetFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -405,7 +399,7 @@ TdBetFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -550,7 +544,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -615,7 +609,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -711,7 +705,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -739,7 +733,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1058,7 +1052,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1088,7 +1082,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1281,7 +1275,7 @@ TdBetFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1321,7 +1315,7 @@ TdBetFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1457,7 +1451,7 @@ TdBetFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1572,7 +1566,7 @@ TdBetFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/tdmt-ff-mac-scheduler.cc b/src/lte/model/tdmt-ff-mac-scheduler.cc index 7c1a0ce9f..3c12aceff 100644 --- a/src/lte/model/tdmt-ff-mac-scheduler.cc +++ b/src/lte/model/tdmt-ff-mac-scheduler.cc @@ -379,14 +379,8 @@ TdMtFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -394,7 +388,7 @@ TdMtFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -539,7 +533,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -604,7 +598,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -700,7 +694,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -728,7 +722,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -967,7 +961,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( { NS_LOG_INFO(this << " ALLOCATION for RBG " << i << " of " << rbgNum); NS_LOG_DEBUG(this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { rbgMap.at(i) = true; tempMap.push_back(i); @@ -1058,7 +1052,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1088,7 +1082,7 @@ TdMtFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1254,7 +1248,7 @@ TdMtFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1294,7 +1288,7 @@ TdMtFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1429,7 +1423,7 @@ TdMtFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1544,7 +1538,7 @@ TdMtFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/tdtbfq-ff-mac-scheduler.cc b/src/lte/model/tdtbfq-ff-mac-scheduler.cc index 92eb85d0f..48ac4755e 100644 --- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc +++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc @@ -442,14 +442,8 @@ TdTbfqFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -457,7 +451,7 @@ TdTbfqFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -551,7 +545,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( rbgMap = m_ffrSapProvider->GetAvailableDlRbg(); for (std::vector::iterator it = rbgMap.begin(); it != rbgMap.end(); it++) { - if ((*it) == true) + if (*it) { rbgAllocatedNum++; } @@ -579,7 +573,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( for (std::vector::iterator it = ulRbMap.begin(); it != ulRbMap.end(); it++) { - if ((*it) == true) + if (*it) { if (tmpMinBandwidth > maxContinuousUlBandwidth) { @@ -650,7 +644,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -715,7 +709,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -811,7 +805,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -839,7 +833,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -1080,7 +1074,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( double metric = (((double)(*it).second.counter) / ((double)(*it).second.tokenGenerationRate)); - if (firstRnti == true) + if (firstRnti) { metricMax = metric; itMax = it; @@ -1106,12 +1100,12 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( std::vector tempMap; for (int i = 0; i < rbgNum; i++) { - if (rbgMap.at(i) == true) + if (rbgMap.at(i)) { // this RBG is allocated in RACH procedure continue; } - if ((m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*itMax).first)) == false) + if (!m_ffrSapProvider->IsDlRbgAvailableForUe(i, (*itMax).first)) { continue; } @@ -1244,7 +1238,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1274,7 +1268,7 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1458,7 +1452,7 @@ TdTbfqFfMacScheduler::DoSchedUlTriggerReq( for (std::vector::iterator it = rbMap.begin(); it != rbMap.end(); it++) { - if ((*it) == true) + if (*it) { rbAllocatedNum++; } @@ -1477,7 +1471,7 @@ TdTbfqFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1517,7 +1511,7 @@ TdTbfqFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1658,12 +1652,12 @@ TdTbfqFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; } - if ((m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) == false) + if (!m_ffrSapProvider->IsUlRbgAvailableForUe(j, (*it).first)) { free = false; break; @@ -1780,7 +1774,7 @@ TdTbfqFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/model/tta-ff-mac-scheduler.cc b/src/lte/model/tta-ff-mac-scheduler.cc index 6d151ab17..d67a1ceec 100644 --- a/src/lte/model/tta-ff-mac-scheduler.cc +++ b/src/lte/model/tta-ff-mac-scheduler.cc @@ -379,14 +379,8 @@ TtaFfMacScheduler::HarqProcessAvailability(uint16_t rnti) { i = (i + 1) % HARQ_PROC_NUM; } while (((*itStat).second.at(i) != 0) && (i != (*it).second)); - if ((*itStat).second.at(i) == 0) - { - return (true); - } - else - { - return (false); // return a not valid harq proc id - } + + return (*itStat).second.at(i) == 0; } uint8_t @@ -394,7 +388,7 @@ TtaFfMacScheduler::UpdateHarqProcessId(uint16_t rnti) { NS_LOG_FUNCTION(this << rnti); - if (m_harqOn == false) + if (!m_harqOn) { return (0); } @@ -539,7 +533,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( m_rachAllocationMap.at(i) = (*itRach).m_rnti; } - if (m_harqOn == true) + if (m_harqOn) { // generate UL-DCI for HARQ retransmissions UlDciListElement_s uldci; @@ -604,7 +598,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( m_dlInfoListBuffered = params.m_dlInfoList; } } - if (m_harqOn == false) + if (!m_harqOn) { // Ignore HARQ feedback m_dlInfoListBuffered.clear(); @@ -700,7 +694,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( bool free = true; for (std::size_t j = 0; j < dciRbg.size(); j++) { - if (rbgMap.at(dciRbg.at(j)) == true) + if (rbgMap.at(dciRbg.at(j))) { free = false; break; @@ -728,7 +722,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( std::vector rbgMapCopy = rbgMap; while ((j < dciRbg.size()) && (startRbg != rbgId)) { - if (rbgMapCopy.at(rbgId) == false) + if (!rbgMapCopy.at(rbgId)) { rbgMapCopy.at(rbgId) = true; dciRbg.at(j) = rbgId; @@ -887,7 +881,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( for (int i = 0; i < rbgNum; i++) { NS_LOG_INFO(this << " ALLOCATION for RBG " << i << " of " << rbgNum); - if (rbgMap.at(i) == false) + if (!rbgMap.at(i)) { std::set::iterator it; std::set::iterator itMax = m_flowStatsDl.end(); @@ -1146,7 +1140,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( UpdateDlRlcBufferInfo(newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size); - if (m_harqOn == true) + if (m_harqOn) { // store RLC PDU list for HARQ std::map::iterator itRlcPdu = @@ -1176,7 +1170,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq( newEl.m_dci = newDci; - if (m_harqOn == true) + if (m_harqOn) { // store DCI for HARQ std::map::iterator itDci = @@ -1342,7 +1336,7 @@ TtaFfMacScheduler::DoSchedUlTriggerReq( } } - if (m_harqOn == true) + if (m_harqOn) { // Process UL HARQ feedback for (std::size_t i = 0; i < params.m_ulInfoList.size(); i++) @@ -1382,7 +1376,7 @@ TtaFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; NS_LOG_INFO(this << " BUSY " << j); @@ -1517,7 +1511,7 @@ TtaFfMacScheduler::DoSchedUlTriggerReq( bool free = true; for (int j = rbAllocated; j < rbAllocated + rbPerFlow; j++) { - if (rbMap.at(j) == true) + if (rbMap.at(j)) { free = false; break; @@ -1632,7 +1626,7 @@ TtaFfMacScheduler::DoSchedUlTriggerReq( ret.m_dciList.push_back(uldci); // store DCI for HARQ_PERIOD uint8_t harqId = 0; - if (m_harqOn == true) + if (m_harqOn) { std::map::iterator itProcId; itProcId = m_ulHarqCurrentProcessId.find(uldci.m_rnti); diff --git a/src/lte/test/lte-test-frequency-reuse.cc b/src/lte/test/lte-test-frequency-reuse.cc index cc96b9cfa..93b52a208 100644 --- a/src/lte/test/lte-test-frequency-reuse.cc +++ b/src/lte/test/lte-test-frequency-reuse.cc @@ -487,7 +487,7 @@ LteFrTestCase::DlDataRxStart(Ptr spectrumValue) NS_LOG_DEBUG("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableDlRb[i]); - if (m_availableDlRb[i] == false && power > 0) + if (!m_availableDlRb[i] && power > 0) { m_usedMutedDlRbg = true; } @@ -507,7 +507,7 @@ LteFrTestCase::UlDataRxStart(Ptr spectrumValue) NS_LOG_DEBUG("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableUlRb[i]); - if (m_availableUlRb[i] == false && power > 0) + if (!m_availableUlRb[i] && power > 0) { m_usedMutedUlRbg = true; } @@ -832,11 +832,11 @@ LteFrAreaTestCase::DlDataRxStart(Ptr spectrumValue) << " " << power << " Available: " << m_expectedDlRb[i] << " Expected Power: " << m_expectedDlPower); - if (m_expectedDlRb[i] == false && power > 0) + if (!m_expectedDlRb[i] && power > 0) { m_usedWrongDlRbg = true; } - else if (m_expectedDlRb[i] == true && power > 0) + else if (m_expectedDlRb[i] && power > 0) { NS_TEST_ASSERT_MSG_EQ_TOL(power, m_expectedDlPower, @@ -869,7 +869,7 @@ LteFrAreaTestCase::UlDataRxStart(Ptr spectrumValue) { // Count the RB as active if it is part of // the expected UL RBs and has Power Spectral Density (PSD) > 0 - if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0) + if (m_expectedUlRb[numActiveRbs] && (*it) > 0) { numActiveRbs++; } @@ -883,11 +883,11 @@ LteFrAreaTestCase::UlDataRxStart(Ptr spectrumValue) double power = (*it) * (numActiveRbs * 180000); NS_LOG_DEBUG("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower); - if (m_expectedUlRb[i] == false && power > 0) + if (!m_expectedUlRb[i] && power > 0) { m_usedWrongUlRbg = true; } - else if (m_expectedUlRb[i] == true && power > 0) + else if (m_expectedUlRb[i] && power > 0) { NS_TEST_ASSERT_MSG_EQ_TOL(power, m_expectedUlPower, diff --git a/src/mesh/model/dot11s/ie-dot11s-id.cc b/src/mesh/model/dot11s/ie-dot11s-id.cc index a6b8692ef..5f9d95fe1 100644 --- a/src/mesh/model/dot11s/ie-dot11s-id.cc +++ b/src/mesh/model/dot11s/ie-dot11s-id.cc @@ -67,21 +67,13 @@ IeMeshId::IsEqual(const IeMeshId& o) const { i++; } - if (m_meshId[i] != o.m_meshId[i]) - { - return false; - } - return true; + return m_meshId[i] == o.m_meshId[i]; } bool IeMeshId::IsBroadcast() const { - if (m_meshId[0] == 0) - { - return true; - } - return false; + return m_meshId[0] == 0; } char* diff --git a/src/mesh/model/mesh-point-device.cc b/src/mesh/model/mesh-point-device.cc index 85dca3ae6..68fe8f8ab 100644 --- a/src/mesh/model/mesh-point-device.cc +++ b/src/mesh/model/mesh-point-device.cc @@ -189,7 +189,7 @@ MeshPointDevice::Forward(Ptr inport, packet, protocol, MakeCallback(&MeshPointDevice::DoSend, this)); - if (result == false) + if (!result) { NS_LOG_DEBUG("Request to forward packet " << packet << " to destination " << dst << " failed; dropping packet"); diff --git a/src/mobility/examples/reference-point-group-mobility-example.cc b/src/mobility/examples/reference-point-group-mobility-example.cc index f65f231f6..d2b63f295 100644 --- a/src/mobility/examples/reference-point-group-mobility-example.cc +++ b/src/mobility/examples/reference-point-group-mobility-example.cc @@ -150,7 +150,7 @@ main(int argc, char* argv[]) // configuration. int64_t streamIndex = 1; - if (useHelper == false) + if (!useHelper) { // Assign random variable stream numbers on the parent and each child streamIndex += waypointMm->AssignStreams(streamIndex); diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index 012f94818..eee8221aa 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -651,15 +651,8 @@ HasNodeIdNumber(std::string str) nodeId = str.substr(startNodeId + 1, endNodeId - (startNodeId + 1)); // set node id - // is number is integer is not negative - if (IsNumber(nodeId) && (nodeId.find_first_of('.') == std::string::npos) && (nodeId[0] != '-')) - { - return true; - } - else - { - return false; - } + // is number is integer is not negative + return IsNumber(nodeId) && nodeId.find_first_of('.') == std::string::npos && nodeId[0] != '-'; } std::string diff --git a/src/mpi/examples/simple-distributed-empty-node.cc b/src/mpi/examples/simple-distributed-empty-node.cc index 7b5b58a38..9d24e657b 100644 --- a/src/mpi/examples/simple-distributed-empty-node.cc +++ b/src/mpi/examples/simple-distributed-empty-node.cc @@ -253,7 +253,7 @@ main(int argc, char* argv[]) Ipv4GlobalRoutingHelper::PopulateRoutingTables(); } - if (tracing == true) + if (tracing) { if (systemId == 0) { diff --git a/src/mpi/examples/simple-distributed-mpi-comm.cc b/src/mpi/examples/simple-distributed-mpi-comm.cc index 621d43f2b..f821d9aef 100644 --- a/src/mpi/examples/simple-distributed-mpi-comm.cc +++ b/src/mpi/examples/simple-distributed-mpi-comm.cc @@ -436,7 +436,7 @@ main(int argc, char* argv[]) Ipv4GlobalRoutingHelper::PopulateRoutingTables(); } - if (tracing == true) + if (tracing) { if (systemId == 0) { diff --git a/src/mpi/examples/simple-distributed.cc b/src/mpi/examples/simple-distributed.cc index 9f6f846ce..4a5cdf98f 100644 --- a/src/mpi/examples/simple-distributed.cc +++ b/src/mpi/examples/simple-distributed.cc @@ -226,7 +226,7 @@ main(int argc, char* argv[]) Ipv4GlobalRoutingHelper::PopulateRoutingTables(); } - if (tracing == true) + if (tracing) { if (systemId == 0) { diff --git a/src/mpi/examples/third-distributed.cc b/src/mpi/examples/third-distributed.cc index d540c6639..4b6b7a037 100644 --- a/src/mpi/examples/third-distributed.cc +++ b/src/mpi/examples/third-distributed.cc @@ -264,7 +264,7 @@ main(int argc, char* argv[]) Simulator::Stop(Seconds(10.0)); - if (tracing == true) + if (tracing) { // Depending on the system Id (rank), the pcap information // traced will be different. For example, the ethernet pcap diff --git a/src/mpi/model/distributed-simulator-impl.cc b/src/mpi/model/distributed-simulator-impl.cc index 2eac98979..1c6914639 100644 --- a/src/mpi/model/distributed-simulator-impl.cc +++ b/src/mpi/model/distributed-simulator-impl.cc @@ -609,16 +609,9 @@ DistributedSimulatorImpl::IsExpired(const EventId& id) const } return true; } - if (id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || - (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || - id.PeekEventImpl()->IsCancelled()) - { - return true; - } - else - { - return false; - } + return id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || + (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || + id.PeekEventImpl()->IsCancelled(); } Time diff --git a/src/mpi/model/null-message-simulator-impl.cc b/src/mpi/model/null-message-simulator-impl.cc index a0a1a5e24..03d3ad948 100644 --- a/src/mpi/model/null-message-simulator-impl.cc +++ b/src/mpi/model/null-message-simulator-impl.cc @@ -532,16 +532,9 @@ NullMessageSimulatorImpl::IsExpired(const EventId& id) const } return true; } - if (id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || - (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || - id.PeekEventImpl()->IsCancelled()) - { - return true; - } - else - { - return false; - } + return id.PeekEventImpl() == nullptr || id.GetTs() < m_currentTs || + (id.GetTs() == m_currentTs && id.GetUid() <= m_currentUid) || + id.PeekEventImpl()->IsCancelled(); } Time diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 974f44fcd..f207812d2 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -471,16 +471,8 @@ bool AnimationInterface::NodeHasMoved(Ptr n, Vector newLocation) { Vector oldLocation = GetPosition(n); - bool moved = true; - if ((ceil(oldLocation.x) == ceil(newLocation.x)) && - (ceil(oldLocation.y) == ceil(newLocation.y))) - { - moved = false; - } - else - { - moved = true; - } + bool moved = !((ceil(oldLocation.x) == ceil(newLocation.x)) && + (ceil(oldLocation.y) == ceil(newLocation.y))); return moved; } @@ -2153,14 +2145,7 @@ AnimationInterface::WriteNodeEnergies() bool AnimationInterface::IsInTimeWindow() { - if ((Simulator::Now() >= m_startTime) && (Simulator::Now() <= m_stopTime)) - { - return true; - } - else - { - return false; - } + return Simulator::Now() >= m_startTime && Simulator::Now() <= m_stopTime; } void diff --git a/src/network/model/buffer.cc b/src/network/model/buffer.cc index ef2623e62..e1328838c 100644 --- a/src/network/model/buffer.cc +++ b/src/network/model/buffer.cc @@ -204,7 +204,7 @@ Buffer::Buffer(uint32_t dataSize) Buffer::Buffer(uint32_t dataSize, bool initialize) { NS_LOG_FUNCTION(this << dataSize << initialize); - if (initialize == true) + if (initialize) { Initialize(dataSize); } diff --git a/src/network/model/packet-metadata.cc b/src/network/model/packet-metadata.cc index 9ff1e4f70..d41da2524 100644 --- a/src/network/model/packet-metadata.cc +++ b/src/network/model/packet-metadata.cc @@ -1079,14 +1079,7 @@ PacketMetadata::ItemIterator::Next() item.currentTrimmedFromStart = extraItem.fragmentStart; item.currentTrimmedFromEnd = extraItem.fragmentEnd - smallItem.size; item.currentSize = extraItem.fragmentEnd - extraItem.fragmentStart; - if (extraItem.fragmentStart != 0 || extraItem.fragmentEnd != smallItem.size) - { - item.isFragment = true; - } - else - { - item.isFragment = false; - } + item.isFragment = (extraItem.fragmentStart != 0 || extraItem.fragmentEnd != smallItem.size); TypeId tid; tid.SetUid(uid); if (uid == 0) diff --git a/src/network/utils/bit-deserializer.cc b/src/network/utils/bit-deserializer.cc index 64e0f0f20..9566d1597 100644 --- a/src/network/utils/bit-deserializer.cc +++ b/src/network/utils/bit-deserializer.cc @@ -85,7 +85,7 @@ void BitDeserializer::PrepareDeserialization() { NS_LOG_FUNCTION(this); - if (m_deserializing == false) + if (!m_deserializing) { m_deserializing = true; for (auto index = m_bytesBlob.begin(); index != m_bytesBlob.end(); index++) diff --git a/src/network/utils/ipv4-address.cc b/src/network/utils/ipv4-address.cc index 9a84b6d14..fd046d80c 100644 --- a/src/network/utils/ipv4-address.cc +++ b/src/network/utils/ipv4-address.cc @@ -77,14 +77,7 @@ bool Ipv4Mask::IsMatch(Ipv4Address a, Ipv4Address b) const { NS_LOG_FUNCTION(this << a << b); - if ((a.Get() & m_mask) == (b.Get() & m_mask)) - { - return true; - } - else - { - return false; - } + return (a.Get() & m_mask) == (b.Get() & m_mask); } uint32_t diff --git a/src/network/utils/ipv6-address.cc b/src/network/utils/ipv6-address.cc index e389e9eb4..e7468ccdf 100644 --- a/src/network/utils/ipv6-address.cc +++ b/src/network/utils/ipv6-address.cc @@ -552,22 +552,14 @@ bool Ipv6Address::IsMulticast() const { NS_LOG_FUNCTION(this); - if (m_address[0] == 0xff) - { - return true; - } - return false; + return m_address[0] == 0xff; } bool Ipv6Address::IsLinkLocalMulticast() const { NS_LOG_FUNCTION(this); - if (m_address[0] == 0xff && m_address[1] == 0x02) - { - return true; - } - return false; + return m_address[0] == 0xff && m_address[1] == 0x02; } bool @@ -610,11 +602,7 @@ Ipv6Address::IsSolicitedMulticast() const NS_LOG_FUNCTION(this); static Ipv6Address documentation("ff02::1:ff00:0"); - if (CombinePrefix(Ipv6Prefix(104)) == documentation) - { - return true; - } - return false; + return CombinePrefix(Ipv6Prefix(104)) == documentation; } bool @@ -652,11 +640,7 @@ Ipv6Address::IsDocumentation() const { NS_LOG_FUNCTION(this); static Ipv6Address documentation("2001:db8::0"); - if (CombinePrefix(Ipv6Prefix(32)) == documentation) - { - return true; - } - return false; + return CombinePrefix(Ipv6Prefix(32)) == documentation; } bool @@ -777,11 +761,7 @@ Ipv6Address::IsLinkLocal() const { NS_LOG_FUNCTION(this); static Ipv6Address linkLocal("fe80::0"); - if (CombinePrefix(Ipv6Prefix(64)) == linkLocal) - { - return true; - } - return false; + return CombinePrefix(Ipv6Prefix(64)) == linkLocal; } bool diff --git a/src/network/utils/lollipop-counter.h b/src/network/utils/lollipop-counter.h index c8336128c..b794cb1f3 100644 --- a/src/network/utils/lollipop-counter.h +++ b/src/network/utils/lollipop-counter.h @@ -182,11 +182,7 @@ class LollipopCounter */ bool IsInit() const { - if (m_value > m_circularRegion) - { - return true; - } - return false; + return m_value > m_circularRegion; } /** @@ -200,11 +196,7 @@ class LollipopCounter NS_ABORT_MSG_IF(lhs.m_sequenceWindow != rhs.m_sequenceWindow, "Can not compare two Lollipop Counters with different sequence windows"); - if (lhs.m_value == rhs.m_value) - { - return true; - } - return false; + return lhs.m_value == rhs.m_value; } /** @@ -263,25 +255,11 @@ class LollipopCounter 1; // this is guaranteed to be positive and between [1...m_lollipopMaxValue]. if (distance > lhs.m_sequenceWindow) { - if (lhsIsHigher) - { - return true; - } - else - { - return false; - } + return lhsIsHigher; } else { - if (lhsIsHigher) - { - return false; - } - else - { - return true; - } + return !lhsIsHigher; } // this should never be reached. diff --git a/src/network/utils/mac16-address.cc b/src/network/utils/mac16-address.cc index f27074ae5..cc2c3c6e0 100644 --- a/src/network/utils/mac16-address.cc +++ b/src/network/utils/mac16-address.cc @@ -228,11 +228,7 @@ bool Mac16Address::IsBroadcast() const { NS_LOG_FUNCTION(this); - if (m_address[0] == 0xff && m_address[1] == 0xff) - { - return true; - } - return false; + return m_address[0] == 0xff && m_address[1] == 0xff; } bool @@ -241,11 +237,7 @@ Mac16Address::IsMulticast() const NS_LOG_FUNCTION(this); uint8_t val = m_address[0]; val >>= 5; - if (val == 0x4) - { - return true; - } - return false; + return val == 0x4; } std::ostream& diff --git a/src/network/utils/packet-socket.cc b/src/network/utils/packet-socket.cc index f041456a3..690efe12a 100644 --- a/src/network/utils/packet-socket.cc +++ b/src/network/utils/packet-socket.cc @@ -520,11 +520,7 @@ bool PacketSocket::SetAllowBroadcast(bool allowBroadcast) { NS_LOG_FUNCTION(this << allowBroadcast); - if (allowBroadcast) - { - return false; - } - return true; + return !allowBroadcast; } bool diff --git a/src/network/utils/packetbb.cc b/src/network/utils/packetbb.cc index 96478c2ea..df35a2b86 100644 --- a/src/network/utils/packetbb.cc +++ b/src/network/utils/packetbb.cc @@ -2417,12 +2417,7 @@ PbbAddressBlock::operator==(const PbbAddressBlock& other) const } } - if (m_addressTlvList != other.m_addressTlvList) - { - return false; - } - - return true; + return m_addressTlvList == other.m_addressTlvList; } bool diff --git a/src/network/utils/pcap-file.cc b/src/network/utils/pcap-file.cc index 4b792a8ba..dd022f02c 100644 --- a/src/network/utils/pcap-file.cc +++ b/src/network/utils/pcap-file.cc @@ -225,7 +225,7 @@ PcapFile::WriteFileHeader() // PcapFileHeader* headerOut = nullptr; - if (m_swapMode == false) + if (!m_swapMode) { headerOut = &m_fileHeader; } diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc index 7be9dd524..e58f8a54b 100644 --- a/src/network/utils/simple-net-device.cc +++ b/src/network/utils/simple-net-device.cc @@ -373,11 +373,7 @@ bool SimpleNetDevice::IsBroadcast() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return false; - } - return true; + return !m_pointToPointMode; } Address @@ -391,11 +387,7 @@ bool SimpleNetDevice::IsMulticast() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return false; - } - return true; + return !m_pointToPointMode; } Address @@ -416,11 +408,7 @@ bool SimpleNetDevice::IsPointToPoint() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return true; - } - return false; + return m_pointToPointMode; } bool @@ -538,11 +526,7 @@ bool SimpleNetDevice::NeedsArp() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return false; - } - return true; + return !m_pointToPointMode; } void diff --git a/src/olsr/model/olsr-routing-protocol.cc b/src/olsr/model/olsr-routing-protocol.cc index 9947d0c81..95249fda1 100644 --- a/src/olsr/model/olsr-routing-protocol.cc +++ b/src/olsr/model/olsr-routing-protocol.cc @@ -3004,7 +3004,7 @@ RoutingProtocol::RouteInput(Ptr p, Ipv4Address origin = header.GetSource(); // Consume self-originated packets - if (IsMyOwnAddress(origin) == true) + if (IsMyOwnAddress(origin)) { return true; } diff --git a/src/point-to-point/model/point-to-point-net-device.cc b/src/point-to-point/model/point-to-point-net-device.cc index 50ca65f86..8b7b53859 100644 --- a/src/point-to-point/model/point-to-point-net-device.cc +++ b/src/point-to-point/model/point-to-point-net-device.cc @@ -256,7 +256,7 @@ PointToPointNetDevice::TransmitStart(Ptr p) Simulator::Schedule(txCompleteTime, &PointToPointNetDevice::TransmitComplete, this); bool result = m_channel->TransmitStart(p, this, txTime); - if (result == false) + if (!result) { m_phyTxDropTrace(p); } @@ -520,7 +520,7 @@ PointToPointNetDevice::Send(Ptr packet, const Address& dest, uint16_t pr // If IsLinkUp() is false it means there is no channel to send any packet // over so we just hit the drop trace on the packet and return an error. // - if (IsLinkUp() == false) + if (!IsLinkUp()) { m_macTxDropTrace(packet); return false; diff --git a/src/sixlowpan/model/sixlowpan-header.cc b/src/sixlowpan/model/sixlowpan-header.cc index e2d758453..93cf77b86 100644 --- a/src/sixlowpan/model/sixlowpan-header.cc +++ b/src/sixlowpan/model/sixlowpan-header.cc @@ -167,7 +167,7 @@ SixLowPanHc1::GetSerializedSize() const break; } - if (m_tcflCompression == false) + if (!m_tcflCompression) { serializedSize += 4; } @@ -253,7 +253,7 @@ SixLowPanHc1::Serialize(Buffer::Iterator start) const break; } - if (m_tcflCompression == false) + if (!m_tcflCompression) { i.WriteU8(m_trafficClass); uint8_t temp[3]; @@ -347,7 +347,7 @@ SixLowPanHc1::Deserialize(Buffer::Iterator start) break; } - if (m_tcflCompression == false) + if (!m_tcflCompression) { m_trafficClass = i.ReadU8(); uint8_t temp[3]; @@ -938,7 +938,7 @@ SixLowPanIphc::GetSerializedSize() const default: break; } - if (GetNh() == false) + if (!GetNh()) { serializedSize++; } @@ -949,7 +949,7 @@ SixLowPanIphc::GetSerializedSize() const switch (GetSam()) { case HC_INLINE: - if (GetSac() == false) + if (!GetSac()) { serializedSize += 16; } @@ -964,12 +964,12 @@ SixLowPanIphc::GetSerializedSize() const default: break; } - if (GetM() == false) + if (!GetM()) { switch (GetDam()) { case HC_INLINE: - if (GetDac() == false) + if (!GetDac()) { serializedSize += 16; } @@ -990,7 +990,7 @@ SixLowPanIphc::GetSerializedSize() const switch (GetDam()) { case HC_INLINE: - if (GetDac() == false) + if (!GetDac()) { serializedSize += 16; } @@ -1000,20 +1000,20 @@ SixLowPanIphc::GetSerializedSize() const } break; case HC_COMPR_64: - if (GetDac() == false) + if (!GetDac()) { serializedSize += 6; } break; case HC_COMPR_16: - if (GetDac() == false) + if (!GetDac()) { serializedSize += 4; } break; case HC_COMPR_0: default: - if (GetDac() == false) + if (!GetDac()) { serializedSize++; } @@ -1065,7 +1065,7 @@ SixLowPanIphc::Serialize(Buffer::Iterator start) const break; } // Next Header - if (GetNh() == false) + if (!GetNh()) { i.WriteU8(m_nextHeader); } @@ -1078,7 +1078,7 @@ SixLowPanIphc::Serialize(Buffer::Iterator start) const switch (GetSam()) { case HC_INLINE: - if (GetSac() == false) + if (!GetSac()) { i.Write(m_srcInlinePart, 16); } @@ -1094,7 +1094,7 @@ SixLowPanIphc::Serialize(Buffer::Iterator start) const break; } // Destination Address - if (GetM() == false) + if (!GetM()) { // unicast switch (GetDam()) @@ -1184,7 +1184,7 @@ SixLowPanIphc::Deserialize(Buffer::Iterator start) break; } // Next Header - if (GetNh() == false) + if (!GetNh()) { m_nextHeader = i.ReadU8(); } @@ -1210,7 +1210,7 @@ SixLowPanIphc::Deserialize(Buffer::Iterator start) switch (GetSam()) { case HC_INLINE: - if (GetSac() == false) + if (!GetSac()) { i.Read(m_srcInlinePart, 16); } @@ -1228,7 +1228,7 @@ SixLowPanIphc::Deserialize(Buffer::Iterator start) // Destination Address memset(m_dstInlinePart, 0x00, sizeof(m_dstInlinePart)); - if (GetM() == false) + if (!GetM()) { // unicast switch (GetDam()) @@ -1552,7 +1552,7 @@ uint32_t SixLowPanNhcExtension::GetSerializedSize() const { uint32_t serializedSize = 2; - if (GetNh() == false) + if (!GetNh()) { serializedSize++; } @@ -1564,7 +1564,7 @@ SixLowPanNhcExtension::Serialize(Buffer::Iterator start) const { Buffer::Iterator i = start; i.WriteU8(m_nhcExtensionHeader); - if (GetNh() == false) + if (!GetNh()) { i.WriteU8(m_nhcNextHeader); } @@ -1577,7 +1577,7 @@ SixLowPanNhcExtension::Deserialize(Buffer::Iterator start) { Buffer::Iterator i = start; m_nhcExtensionHeader = i.ReadU8(); - if (GetNh() == false) + if (!GetNh()) { m_nhcNextHeader = i.ReadU8(); } diff --git a/src/sixlowpan/model/sixlowpan-net-device.cc b/src/sixlowpan/model/sixlowpan-net-device.cc index 333002b4a..080cb7a9c 100644 --- a/src/sixlowpan/model/sixlowpan-net-device.cc +++ b/src/sixlowpan/model/sixlowpan-net-device.cc @@ -1095,7 +1095,6 @@ SixLowPanNetDevice::CompressLowPanIphc(Ptr packet, const Address& src, c uint8_t addressBuf[16]; // This is just to limit the scope of some variables. - if (true) { Ipv6Address srcAddr = ipHeader.GetSource(); uint8_t srcContextId; @@ -1197,7 +1196,6 @@ SixLowPanNetDevice::CompressLowPanIphc(Ptr packet, const Address& src, c } // This is just to limit the scope of some variables. - if (true) { Ipv6Address dstAddr = ipHeader.GetDestination(); dstAddr.GetBytes(addressBuf); @@ -1528,7 +1526,7 @@ SixLowPanNetDevice::DecompressLowPanIphc(Ptr packet, const Address& src, m_contextTable[contextId].contextPrefix.GetBytes(contextPrefix); uint8_t contextLength = m_contextTable[contextId].contextPrefix.GetPrefixLength(); - if (encoding.GetM() == false) + if (!encoding.GetM()) { // unicast uint8_t dstAddress[16] = {}; @@ -1580,7 +1578,7 @@ SixLowPanNetDevice::DecompressLowPanIphc(Ptr packet, const Address& src, else { // Destination address compression uses stateless compression. - if (encoding.GetM() == false) + if (!encoding.GetM()) { // unicast if (encoding.GetDam() == SixLowPanIphc::HC_INLINE) @@ -1697,7 +1695,7 @@ SixLowPanNetDevice::DecompressLowPanIphc(Ptr packet, const Address& src, dst, ipHeader.GetSource(), ipHeader.GetDestination()); - if (retval.second == true) + if (retval.second) { return true; } @@ -2612,11 +2610,7 @@ SixLowPanNetDevice::Fragments::IsEntire() const } } - if (ret && (lastEndOffset == m_packetSize)) - { - return true; - } - return false; + return ret && lastEndOffset == m_packetSize; } Ptr @@ -2873,7 +2867,7 @@ SixLowPanNetDevice::FindUnicastCompressionContext(Ipv6Address address, uint8_t& { ContextEntry context = iter.second; - if ((context.compressionAllowed == true) && (context.validLifetime > Simulator::Now())) + if (context.compressionAllowed && context.validLifetime > Simulator::Now()) { if (address.HasPrefix(context.contextPrefix)) { @@ -2902,7 +2896,7 @@ SixLowPanNetDevice::FindMulticastCompressionContext(Ipv6Address address, uint8_t { ContextEntry context = iter.second; - if ((context.compressionAllowed == true) && (context.validLifetime > Simulator::Now())) + if (context.compressionAllowed && context.validLifetime > Simulator::Now()) { uint8_t contextLength = context.contextPrefix.GetPrefixLength(); diff --git a/src/sixlowpan/test/mock-net-device.cc b/src/sixlowpan/test/mock-net-device.cc index aa266f464..ea06e1482 100644 --- a/src/sixlowpan/test/mock-net-device.cc +++ b/src/sixlowpan/test/mock-net-device.cc @@ -245,11 +245,7 @@ bool MockNetDevice::IsPointToPoint() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return true; - } - return false; + return m_pointToPointMode; } bool @@ -305,11 +301,7 @@ bool MockNetDevice::NeedsArp() const { NS_LOG_FUNCTION(this); - if (m_pointToPointMode) - { - return false; - } - return true; + return !m_pointToPointMode; } void diff --git a/src/spectrum/model/aloha-noack-net-device.cc b/src/spectrum/model/aloha-noack-net-device.cc index 079b1ce1b..d4fcfa055 100644 --- a/src/spectrum/model/aloha-noack-net-device.cc +++ b/src/spectrum/model/aloha-noack-net-device.cc @@ -374,7 +374,7 @@ AlohaNoackNetDevice::SendFrom(Ptr packet, else { NS_LOG_LOGIC("enqueueing new packet"); - if (m_queue->Enqueue(packet) == false) + if (!m_queue->Enqueue(packet)) { m_macTxDropTrace(packet); sendOk = false; @@ -385,7 +385,7 @@ AlohaNoackNetDevice::SendFrom(Ptr packet, { NS_LOG_LOGIC("deferring TX, enqueueing new packet"); NS_ASSERT(m_queue); - if (m_queue->Enqueue(packet) == false) + if (!m_queue->Enqueue(packet)) { m_macTxDropTrace(packet); sendOk = false; @@ -426,7 +426,7 @@ AlohaNoackNetDevice::NotifyTransmissionEnd(Ptr) NS_ASSERT_MSG(m_state == TX, "TX end notified while state != TX"); m_state = IDLE; NS_ASSERT(m_queue); - if (m_queue->IsEmpty() == false) + if (!m_queue->IsEmpty()) { Ptr p = m_queue->Dequeue(); NS_ASSERT(p); diff --git a/src/spectrum/model/three-gpp-channel-model.cc b/src/spectrum/model/three-gpp-channel-model.cc index 0327f3455..384870454 100644 --- a/src/spectrum/model/three-gpp-channel-model.cc +++ b/src/spectrum/model/three-gpp-channel-model.cc @@ -1083,14 +1083,7 @@ bool ThreeGppChannelModel::ChannelMatrixNeedsUpdate(Ptr channelParams, Ptr channelMatrix) { - if (channelParams->m_generatedTime > channelMatrix->m_generatedTime) - { - return true; - } - else - { - return false; - } + return channelParams->m_generatedTime > channelMatrix->m_generatedTime; } Ptr diff --git a/src/stats/model/sqlite-output.cc b/src/stats/model/sqlite-output.cc index 7a51aad10..cd90016ba 100644 --- a/src/stats/model/sqlite-output.cc +++ b/src/stats/model/sqlite-output.cc @@ -132,11 +132,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const Time& value) const { - if (sqlite3_bind_double(stmt, pos, value.GetSeconds()) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_double(stmt, pos, value.GetSeconds()) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -144,11 +140,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const double& value) const { - if (sqlite3_bind_double(stmt, pos, value) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_double(stmt, pos, value) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -156,11 +148,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const uint32_t& value) const { - if (sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -168,11 +156,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const long& value) const { - if (sqlite3_bind_int64(stmt, pos, value) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int64(stmt, pos, value) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -180,11 +164,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const long long& value) const { - if (sqlite3_bind_int64(stmt, pos, value) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int64(stmt, pos, value) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -192,11 +172,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const uint16_t& value) const { - if (sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -204,11 +180,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const uint8_t& value) const { - if (sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int(stmt, pos, static_cast(value)) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -216,11 +188,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const int& value) const { - if (sqlite3_bind_int(stmt, pos, value) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_int(stmt, pos, value) == SQLITE_OK; } //! \copydoc SQLiteOutput::Bind @@ -228,11 +196,7 @@ template <> bool SQLiteOutput::Bind(sqlite3_stmt* stmt, int pos, const std::string& value) const { - if (sqlite3_bind_text(stmt, pos, value.c_str(), -1, SQLITE_STATIC) == SQLITE_OK) - { - return true; - } - return false; + return sqlite3_bind_text(stmt, pos, value.c_str(), -1, SQLITE_STATIC) == SQLITE_OK; } int diff --git a/src/tap-bridge/model/tap-bridge.cc b/src/tap-bridge/model/tap-bridge.cc index 238be0819..cd14f68ad 100644 --- a/src/tap-bridge/model/tap-bridge.cc +++ b/src/tap-bridge/model/tap-bridge.cc @@ -801,7 +801,7 @@ TapBridge::ForwardToBridgedDevice(uint8_t* buf, ssize_t len) // NS_ASSERT_MSG(Mac48Address::ConvertFrom(src) != Mac48Address("ff:ff:ff:ff:ff:ff"), "TapBridge::ForwardToBridgedDevice: Source addr is broadcast"); - if (m_ns3AddressRewritten == false) + if (!m_ns3AddressRewritten) { // // Set the ns-3 device's mac address to the overlying container's diff --git a/src/topology-read/model/rocketfuel-topology-reader.cc b/src/topology-read/model/rocketfuel-topology-reader.cc index 97ff1e4bf..fd28fefa6 100644 --- a/src/topology-read/model/rocketfuel-topology-reader.cc +++ b/src/topology-read/model/rocketfuel-topology-reader.cc @@ -386,7 +386,7 @@ RocketfuelTopologyReader::Read() if (ftype == RF_MAPS) { ret = std::regex_match(line, matches, rocketfuel_maps_regex); - if (ret != true || matches.empty()) + if (!ret || matches.empty()) { NS_LOG_WARN("match failed (maps file): %s" << line); break; @@ -395,7 +395,7 @@ RocketfuelTopologyReader::Read() else if (ftype == RF_WEIGHTS) { ret = std::regex_match(line, matches, rocketfuel_weights_regex); - if (ret != true || matches.empty()) + if (!ret || matches.empty()) { NS_LOG_WARN("match failed (weights file): %s" << line); break; diff --git a/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc b/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc index 8dc17bcf7..0437aa101 100644 --- a/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc +++ b/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc @@ -220,12 +220,12 @@ TraceEveryDrop(std::string everyDropTrFileName) static void DroppingStateTracer(Ptr stream, bool oldVal, bool newVal) { - if (oldVal == false && newVal == true) + if (!oldVal && newVal) { NS_LOG_INFO("Entering the dropping state"); *stream->GetStream() << Simulator::Now().GetSeconds() << " "; } - else if (oldVal == true && newVal == false) + else if (oldVal && !newVal) { NS_LOG_INFO("Leaving the dropping state"); *stream->GetStream() << Simulator::Now().GetSeconds() << std::endl; diff --git a/src/traffic-control/model/fq-cobalt-queue-disc.cc b/src/traffic-control/model/fq-cobalt-queue-disc.cc index 794c426ff..bcb0bf0f5 100644 --- a/src/traffic-control/model/fq-cobalt-queue-disc.cc +++ b/src/traffic-control/model/fq-cobalt-queue-disc.cc @@ -469,7 +469,7 @@ FqCobaltQueueDisc::CheckConfig() if (m_useL4s) { NS_ABORT_MSG_IF(m_ceThreshold == Time::Max(), "CE threshold not set"); - if (m_useEcn == false) + if (!m_useEcn) { NS_LOG_WARN("Enabling ECN as L4S mode is enabled"); } diff --git a/src/traffic-control/model/fq-codel-queue-disc.cc b/src/traffic-control/model/fq-codel-queue-disc.cc index ca934a962..56d27dc40 100644 --- a/src/traffic-control/model/fq-codel-queue-disc.cc +++ b/src/traffic-control/model/fq-codel-queue-disc.cc @@ -440,7 +440,7 @@ FqCoDelQueueDisc::CheckConfig() if (m_useL4s) { NS_ABORT_MSG_IF(m_ceThreshold == Time::Max(), "CE threshold not set"); - if (m_useEcn == false) + if (!m_useEcn) { NS_LOG_WARN("Enabling ECN as L4S mode is enabled"); } diff --git a/src/traffic-control/model/fq-pie-queue-disc.cc b/src/traffic-control/model/fq-pie-queue-disc.cc index 07827ac28..29f3ea84f 100644 --- a/src/traffic-control/model/fq-pie-queue-disc.cc +++ b/src/traffic-control/model/fq-pie-queue-disc.cc @@ -497,7 +497,7 @@ FqPieQueueDisc::CheckConfig() if (m_useL4s) { NS_ABORT_MSG_IF(m_ceThreshold == Time::Max(), "CE threshold not set"); - if (m_useEcn == false) + if (!m_useEcn) { NS_LOG_WARN("Enabling ECN as L4S mode is enabled"); } diff --git a/src/traffic-control/model/pie-queue-disc.cc b/src/traffic-control/model/pie-queue-disc.cc index f27357228..01d1b7f04 100644 --- a/src/traffic-control/model/pie-queue-disc.cc +++ b/src/traffic-control/model/pie-queue-disc.cc @@ -328,12 +328,7 @@ PieQueueDisc::DropEarly(Ptr item, uint32_t qSize) } double u = m_uv->GetValue(); - if (u > p) - { - return false; - } - - return true; + return u <= p; } void diff --git a/src/traffic-control/model/queue-disc.cc b/src/traffic-control/model/queue-disc.cc index a84e11293..0db2a831f 100644 --- a/src/traffic-control/model/queue-disc.cc +++ b/src/traffic-control/model/queue-disc.cc @@ -1108,13 +1108,9 @@ QueueDisc::Transmit(Ptr item) // if the queue disc is empty or the device queue is now stopped, return false so // that the Run method does not attempt to dequeue other packets and exits - if (GetNPackets() == 0 || - (m_devQueueIface && m_devQueueIface->GetTxQueue(item->GetTxQueueIndex())->IsStopped())) - { - return false; - } - - return true; + return !( + GetNPackets() == 0 || + (m_devQueueIface && m_devQueueIface->GetTxQueue(item->GetTxQueueIndex())->IsStopped())); } } // namespace ns3 diff --git a/src/traffic-control/model/tbf-queue-disc.cc b/src/traffic-control/model/tbf-queue-disc.cc index 543a73900..41d0e3db0 100644 --- a/src/traffic-control/model/tbf-queue-disc.cc +++ b/src/traffic-control/model/tbf-queue-disc.cc @@ -261,7 +261,7 @@ TbfQueueDisc::DoDequeue() // A packet gets blocked if the above if() condition is not satisfied: // either or both btoks and ptoks are negative. In that case, we have // to schedule the waking of queue when enough tokens are available. - if (m_id.IsExpired() == true) + if (m_id.IsExpired()) { NS_ASSERT_MSG(m_rate.GetBitRate() > 0, "Rate must be positive"); Time requiredDelayTime; diff --git a/src/traffic-control/test/cobalt-queue-disc-test-suite.cc b/src/traffic-control/test/cobalt-queue-disc-test-suite.cc index 7fd8bbdd1..51f9f80ea 100644 --- a/src/traffic-control/test/cobalt-queue-disc-test-suite.cc +++ b/src/traffic-control/test/cobalt-queue-disc-test-suite.cc @@ -82,11 +82,7 @@ CobaltQueueDiscTestItem::AddHeader() bool CobaltQueueDiscTestItem::Mark() { - if (m_ecnCapablePacket) - { - return true; - } - return false; + return m_ecnCapablePacket; } /** diff --git a/src/traffic-control/test/codel-queue-disc-test-suite.cc b/src/traffic-control/test/codel-queue-disc-test-suite.cc index ef8d20401..ac20d3741 100644 --- a/src/traffic-control/test/codel-queue-disc-test-suite.cc +++ b/src/traffic-control/test/codel-queue-disc-test-suite.cc @@ -104,11 +104,7 @@ CodelQueueDiscTestItem::AddHeader() bool CodelQueueDiscTestItem::Mark() { - if (m_ecnCapablePacket) - { - return true; - } - return false; + return m_ecnCapablePacket; } /** diff --git a/src/traffic-control/test/pie-queue-disc-test-suite.cc b/src/traffic-control/test/pie-queue-disc-test-suite.cc index 1484f9ca4..d664d7400 100644 --- a/src/traffic-control/test/pie-queue-disc-test-suite.cc +++ b/src/traffic-control/test/pie-queue-disc-test-suite.cc @@ -93,11 +93,7 @@ PieQueueDiscTestItem::AddHeader() bool PieQueueDiscTestItem::Mark() { - if (m_ecnCapablePacket) - { - return true; - } - return false; + return m_ecnCapablePacket; } /** diff --git a/src/traffic-control/test/red-queue-disc-test-suite.cc b/src/traffic-control/test/red-queue-disc-test-suite.cc index 2e85ef10c..e0e28d197 100644 --- a/src/traffic-control/test/red-queue-disc-test-suite.cc +++ b/src/traffic-control/test/red-queue-disc-test-suite.cc @@ -73,11 +73,7 @@ RedQueueDiscTestItem::AddHeader() bool RedQueueDiscTestItem::Mark() { - if (m_ecnCapablePacket) - { - return true; - } - return false; + return m_ecnCapablePacket; } /** diff --git a/src/uan/model/uan-mac-cw.cc b/src/uan/model/uan-mac-cw.cc index a1bf9b439..9a50e7d9e 100644 --- a/src/uan/model/uan-mac-cw.cc +++ b/src/uan/model/uan-mac-cw.cc @@ -117,7 +117,7 @@ UanMacCw::Enqueue(Ptr packet, uint16_t protocolNumber, const Address& de case CCABUSY: NS_LOG_DEBUG("Time " << Now().As(Time::S) << " MAC " << GetAddress() << " Starting enqueue CCABUSY"); - if (m_txOngoing == true) + if (m_txOngoing) { NS_LOG_DEBUG("State is TX"); } diff --git a/src/virtual-net-device/model/virtual-net-device.cc b/src/virtual-net-device/model/virtual-net-device.cc index 6b19ef1d7..31518b7dc 100644 --- a/src/virtual-net-device/model/virtual-net-device.cc +++ b/src/virtual-net-device/model/virtual-net-device.cc @@ -255,11 +255,7 @@ bool VirtualNetDevice::Send(Ptr packet, const Address& dest, uint16_t protocolNumber) { m_macTxTrace(packet); - if (m_sendCb(packet, GetAddress(), dest, protocolNumber)) - { - return true; - } - return false; + return m_sendCb(packet, GetAddress(), dest, protocolNumber); } bool @@ -270,11 +266,7 @@ VirtualNetDevice::SendFrom(Ptr packet, { NS_ASSERT(m_supportsSendFrom); m_macTxTrace(packet); - if (m_sendCb(packet, source, dest, protocolNumber)) - { - return true; - } - return false; + return m_sendCb(packet, source, dest, protocolNumber); } Ptr diff --git a/src/visualizer/model/pyviz.cc b/src/visualizer/model/pyviz.cc index d3f4bfd53..632d005ab 100644 --- a/src/visualizer/model/pyviz.cc +++ b/src/visualizer/model/pyviz.cc @@ -371,14 +371,7 @@ PyViz::TransmissionSampleKey::operator<(const PyViz::TransmissionSampleKey& othe { return false; } - if (this->channel < other.channel) - { - return true; - } - else - { - return false; - } + return this->channel < other.channel; } bool @@ -457,14 +450,7 @@ PyViz::FilterPacket(Ptr packet, const PacketCaptureOptions& option missingHeaders.erase(missingIter); } } - if (missingHeaders.empty()) - { - return true; - } - else - { - return false; - } + return missingHeaders.empty(); } default: diff --git a/src/wave/model/default-channel-scheduler.cc b/src/wave/model/default-channel-scheduler.cc index 2ccbefc07..3379c7e43 100644 --- a/src/wave/model/default-channel-scheduler.cc +++ b/src/wave/model/default-channel-scheduler.cc @@ -160,14 +160,7 @@ DefaultChannelScheduler::AssignAlternatingAccess(uint32_t channelNumber, bool im if (m_channelAccess == AlternatingAccess) { - if (m_channelNumber != sch) - { - return false; - } - else - { - return true; - } + return m_channelNumber == sch; } // if we need immediately switch to AlternatingAccess, @@ -196,14 +189,7 @@ DefaultChannelScheduler::AssignContinuousAccess(uint32_t channelNumber, bool imm if (m_channelAccess == ContinuousAccess) { - if (m_channelNumber != sch) - { - return false; - } - else - { - return true; - } + return m_channelNumber == sch; } // if there is already an wait event for previous non-immediate request @@ -269,14 +255,7 @@ DefaultChannelScheduler::AssignExtendedAccess(uint32_t channelNumber, // if current remain extends cannot fulfill the requirement for extends Time remainTime = Simulator::GetDelayLeft(m_extendEvent); uint32_t remainExtends = (remainTime / m_coordinator->GetSyncInterval()).GetHigh(); - if (remainExtends > extends) - { - return true; - } - else - { - return false; - } + return remainExtends > extends; } } diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc index 244380430..94ab19da0 100644 --- a/src/wifi/examples/wifi-manager-example.cc +++ b/src/wifi/examples/wifi-manager-example.cc @@ -277,7 +277,7 @@ main(int argc, char* argv[]) std::cout << "Run 'wifi-manager-example --PrintHelp' to show program options." << std::endl << std::endl; - if (infrastructure == false) + if (!infrastructure) { NS_ABORT_MSG_IF(serverNss != clientNss, "In ad hoc mode, we assume sender and receiver are similarly configured"); diff --git a/src/wifi/helper/wifi-helper.cc b/src/wifi/helper/wifi-helper.cc index fdebb92b0..f3ae1812d 100644 --- a/src/wifi/helper/wifi-helper.cc +++ b/src/wifi/helper/wifi-helper.cc @@ -377,7 +377,7 @@ WifiPhyHelper::GetRadiotapHeader(RadiotapHeader& header, packet->RemoveHeader(hdr); extractedLength = hdr.GetLength(); packet = packet->CreateFragment(0, static_cast(extractedLength)); - if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof() == true && hdr.GetLength() > 0)) + if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof() && hdr.GetLength() > 0)) { ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST; } diff --git a/src/wifi/model/he/he-frame-exchange-manager.cc b/src/wifi/model/he/he-frame-exchange-manager.cc index f9a80110a..4946098d2 100644 --- a/src/wifi/model/he/he-frame-exchange-manager.cc +++ b/src/wifi/model/he/he-frame-exchange-manager.cc @@ -1949,13 +1949,9 @@ HeFrameExchangeManager::IsIntraBssPpdu(Ptr psdu, const WifiTxVec // is disabled (see 26.17.3.3), then the RXVECTOR parameter BSS_COLOR of a PPDU shall not be // used to classify the PPDU") const auto bssColor = m_mac->GetHeConfiguration()->GetBssColor(); - if (bssColor != 0 && bssColor == txVector.GetBssColor()) - { - return true; - } // the other two conditions using the RXVECTOR parameter PARTIAL_AID are not implemented - return false; + return bssColor != 0 && bssColor == txVector.GetBssColor(); } void diff --git a/src/wifi/model/ht/ht-capabilities.cc b/src/wifi/model/ht/ht-capabilities.cc index 82b61cddb..b47152471 100644 --- a/src/wifi/model/ht/ht-capabilities.cc +++ b/src/wifi/model/ht/ht-capabilities.cc @@ -233,11 +233,7 @@ HtCapabilities::GetMaxAmpduLength() const bool HtCapabilities::IsSupportedMcs(uint8_t mcs) const { - if (m_rxMcsBitmask[mcs] == 1) - { - return true; - } - return false; + return m_rxMcsBitmask[mcs] == 1; } uint8_t @@ -249,7 +245,7 @@ HtCapabilities::GetRxHighestSupportedAntennas() const for (uint8_t mcs = (nRx - 1) * 8; mcs <= maxMcs; mcs++) { - if (IsSupportedMcs(mcs) == false) + if (!IsSupportedMcs(mcs)) { return (nRx - 1); } diff --git a/src/wifi/model/ht/ht-operation.cc b/src/wifi/model/ht/ht-operation.cc index 1be7508ac..de8b699ca 100644 --- a/src/wifi/model/ht/ht-operation.cc +++ b/src/wifi/model/ht/ht-operation.cc @@ -280,11 +280,7 @@ HtOperation::GetPhase() const bool HtOperation::IsSupportedMcs(uint8_t mcs) const { - if (m_rxMcsBitmask[mcs] == 1) - { - return true; - } - return false; + return m_rxMcsBitmask[mcs] == 1; } uint16_t diff --git a/src/wifi/model/mac-rx-middle.cc b/src/wifi/model/mac-rx-middle.cc index 6766c54bf..454f83e4f 100644 --- a/src/wifi/model/mac-rx-middle.cc +++ b/src/wifi/model/mac-rx-middle.cc @@ -134,15 +134,8 @@ class OriginatorRxStatus */ bool IsNextFragment(uint16_t sequenceControl) const { - if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4) && - (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f) + 1)) - { - return true; - } - else - { - return false; - } + return (sequenceControl >> 4) == (m_lastSequenceControl >> 4) && + (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f) + 1); } /** @@ -230,11 +223,7 @@ bool MacRxMiddle::IsDuplicate(const WifiMacHeader* hdr, OriginatorRxStatus* originator) const { NS_LOG_FUNCTION(hdr << originator); - if (hdr->IsRetry() && originator->GetLastSequenceControl() == hdr->GetSequenceControl()) - { - return true; - } - return false; + return hdr->IsRetry() && originator->GetLastSequenceControl() == hdr->GetSequenceControl(); } Ptr diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index b2442cb8b..ea4d03101 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -1366,11 +1366,7 @@ PhyEntity::CanStartRx(Ptr ppdu, uint16_t txChannelWidth) const const auto txCenterFreq = ppdu->GetTxCenterFreq(); const auto minTxFreq = txCenterFreq - txChannelWidth / 2; const auto maxTxFreq = txCenterFreq + txChannelWidth / 2; - if (p20MinFreq < minTxFreq || p20MaxFreq > maxTxFreq) - { - return false; - } - return true; + return p20MinFreq >= minTxFreq && p20MaxFreq <= maxTxFreq; } Ptr diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 80bfe991f..fb5233e93 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -357,12 +357,8 @@ QosTxop::IsQosOldPacket(Ptr mpdu) return false; } - if (QosUtilsIsOldPacket(GetBaStartingSequence(recipient, tid), - mpdu->GetHeader().GetSequenceNumber())) - { - return true; - } - return false; + return QosUtilsIsOldPacket(GetBaStartingSequence(recipient, tid), + mpdu->GetHeader().GetSequenceNumber()); } Ptr diff --git a/src/wifi/model/rate-control/aarf-wifi-manager.cc b/src/wifi/model/rate-control/aarf-wifi-manager.cc index cf0fcf784..0b78ee80d 100644 --- a/src/wifi/model/rate-control/aarf-wifi-manager.cc +++ b/src/wifi/model/rate-control/aarf-wifi-manager.cc @@ -297,7 +297,7 @@ AarfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/aarfcd-wifi-manager.cc b/src/wifi/model/rate-control/aarfcd-wifi-manager.cc index 1f7bf002b..e910165b0 100644 --- a/src/wifi/model/rate-control/aarfcd-wifi-manager.cc +++ b/src/wifi/model/rate-control/aarfcd-wifi-manager.cc @@ -366,7 +366,7 @@ AarfcdWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/amrr-wifi-manager.cc b/src/wifi/model/rate-control/amrr-wifi-manager.cc index 70548257d..b3055515f 100644 --- a/src/wifi/model/rate-control/amrr-wifi-manager.cc +++ b/src/wifi/model/rate-control/amrr-wifi-manager.cc @@ -411,7 +411,7 @@ AmrrWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) } UpdateMode(station); WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/aparf-wifi-manager.cc b/src/wifi/model/rate-control/aparf-wifi-manager.cc index 672132d81..63e7b1829 100644 --- a/src/wifi/model/rate-control/aparf-wifi-manager.cc +++ b/src/wifi/model/rate-control/aparf-wifi-manager.cc @@ -402,7 +402,7 @@ AparfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/arf-wifi-manager.cc b/src/wifi/model/rate-control/arf-wifi-manager.cc index 5396d8e2a..3931d2477 100644 --- a/src/wifi/model/rate-control/arf-wifi-manager.cc +++ b/src/wifi/model/rate-control/arf-wifi-manager.cc @@ -274,7 +274,7 @@ ArfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/cara-wifi-manager.cc b/src/wifi/model/rate-control/cara-wifi-manager.cc index 4a690dee3..d8366b9d6 100644 --- a/src/wifi/model/rate-control/cara-wifi-manager.cc +++ b/src/wifi/model/rate-control/cara-wifi-manager.cc @@ -245,7 +245,7 @@ CaraWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc index 9086ee810..d10142607 100644 --- a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc @@ -511,20 +511,9 @@ MinstrelHtWifiManager::DoCreateStation() const station->m_ampduLen = 0; station->m_ampduPacketCount = 0; - // If the device supports HT - if (GetHtSupported()) - { - /** - * Assume the station is HT. - * When correct information available it will be checked. - */ - station->m_isHt = true; - } - // Use the variable in the station to indicate that the device do not support HT - else - { - station->m_isHt = false; - } + // Use the variable in the station to indicate whether the device supports HT. + // When correct information available it will be checked. + station->m_isHt = GetHtSupported(); return station; } diff --git a/src/wifi/model/rate-control/minstrel-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-wifi-manager.cc index 63f5c84f6..768f0f6d2 100644 --- a/src/wifi/model/rate-control/minstrel-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-wifi-manager.cc @@ -424,7 +424,7 @@ MinstrelWifiManager::GetRtsTxVector(MinstrelWifiRemoteStation* station) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/onoe-wifi-manager.cc b/src/wifi/model/rate-control/onoe-wifi-manager.cc index c5a4b3057..fe37cc0ef 100644 --- a/src/wifi/model/rate-control/onoe-wifi-manager.cc +++ b/src/wifi/model/rate-control/onoe-wifi-manager.cc @@ -371,7 +371,7 @@ OnoeWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) } UpdateMode(station); WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/parf-wifi-manager.cc b/src/wifi/model/rate-control/parf-wifi-manager.cc index 4df3c00bb..9222cd81d 100644 --- a/src/wifi/model/rate-control/parf-wifi-manager.cc +++ b/src/wifi/model/rate-control/parf-wifi-manager.cc @@ -371,7 +371,7 @@ ParfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/rraa-wifi-manager.cc b/src/wifi/model/rate-control/rraa-wifi-manager.cc index e78e106dd..1cd4943fb 100644 --- a/src/wifi/model/rate-control/rraa-wifi-manager.cc +++ b/src/wifi/model/rate-control/rraa-wifi-manager.cc @@ -395,7 +395,7 @@ RraaWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/rate-control/rrpaa-wifi-manager.cc b/src/wifi/model/rate-control/rrpaa-wifi-manager.cc index 85c137d80..09f85e251 100644 --- a/src/wifi/model/rate-control/rrpaa-wifi-manager.cc +++ b/src/wifi/model/rate-control/rrpaa-wifi-manager.cc @@ -448,7 +448,7 @@ RrpaaWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) channelWidth = 20; } WifiMode mode; - if (GetUseNonErpProtection() == false) + if (!GetUseNonErpProtection()) { mode = GetSupported(station, 0); } diff --git a/src/wifi/model/simple-frame-capture-model.cc b/src/wifi/model/simple-frame-capture-model.cc index 761661faf..07969158f 100644 --- a/src/wifi/model/simple-frame-capture-model.cc +++ b/src/wifi/model/simple-frame-capture-model.cc @@ -79,12 +79,8 @@ bool SimpleFrameCaptureModel::CaptureNewFrame(Ptr currentEvent, Ptr newEvent) const { NS_LOG_FUNCTION(this); - if ((WToDbm(currentEvent->GetRxPowerW()) + GetMargin()) < WToDbm(newEvent->GetRxPowerW()) && - (IsInCaptureWindow(currentEvent->GetStartTime()))) - { - return true; - } - return false; + return WToDbm(currentEvent->GetRxPowerW()) + GetMargin() < WToDbm(newEvent->GetRxPowerW()) && + IsInCaptureWindow(currentEvent->GetStartTime()); } } // namespace ns3 diff --git a/src/wifi/model/ssid.cc b/src/wifi/model/ssid.cc index fabc7bc01..bbca333d0 100644 --- a/src/wifi/model/ssid.cc +++ b/src/wifi/model/ssid.cc @@ -65,21 +65,13 @@ Ssid::IsEqual(const Ssid& o) const { i++; } - if (m_ssid[i] != o.m_ssid[i]) - { - return false; - } - return true; + return m_ssid[i] == o.m_ssid[i]; } bool Ssid::IsBroadcast() const { - if (m_ssid[0] == 0) - { - return true; - } - return false; + return m_ssid[0] == 0; } char* diff --git a/src/wifi/model/supported-rates.cc b/src/wifi/model/supported-rates.cc index fdbcd447b..7981b9e0b 100644 --- a/src/wifi/model/supported-rates.cc +++ b/src/wifi/model/supported-rates.cc @@ -183,14 +183,10 @@ bool AllSupportedRates::IsBssMembershipSelectorRate(uint64_t bs) const { NS_LOG_FUNCTION(this << bs); - if ((bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY || - (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_VHT_PHY || - (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HE_PHY || - (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_EHT_PHY) - { - return true; - } - return false; + return (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY || + (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_VHT_PHY || + (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HE_PHY || + (bs & 0x7f) == BSS_MEMBERSHIP_SELECTOR_EHT_PHY; } uint8_t diff --git a/src/wifi/model/txop.cc b/src/wifi/model/txop.cc index e739b7003..efbef04a5 100644 --- a/src/wifi/model/txop.cc +++ b/src/wifi/model/txop.cc @@ -246,7 +246,7 @@ Txop::SetMinCw(uint32_t minCw, uint8_t linkId) auto& link = GetLink(linkId); bool changed = (link.cwMin != minCw); link.cwMin = minCw; - if (changed == true) + if (changed) { ResetCw(linkId); } @@ -275,7 +275,7 @@ Txop::SetMaxCw(uint32_t maxCw, uint8_t linkId) auto& link = GetLink(linkId); bool changed = (link.cwMax != maxCw); link.cwMax = maxCw; - if (changed == true) + if (changed) { ResetCw(linkId); } diff --git a/src/wifi/model/wifi-acknowledgment.cc b/src/wifi/model/wifi-acknowledgment.cc index 83d591f09..154f3672c 100644 --- a/src/wifi/model/wifi-acknowledgment.cc +++ b/src/wifi/model/wifi-acknowledgment.cc @@ -78,11 +78,7 @@ WifiNoAck::CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const { - if (ackPolicy == WifiMacHeader::NO_ACK || ackPolicy == WifiMacHeader::BLOCK_ACK) - { - return true; - } - return false; + return ackPolicy == WifiMacHeader::NO_ACK || ackPolicy == WifiMacHeader::BLOCK_ACK; } void @@ -111,11 +107,7 @@ WifiNormalAck::CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const { - if (ackPolicy == WifiMacHeader::NORMAL_ACK) - { - return true; - } - return false; + return ackPolicy == WifiMacHeader::NORMAL_ACK; } void @@ -144,11 +136,7 @@ WifiBlockAck::CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const { - if (ackPolicy == WifiMacHeader::NORMAL_ACK) - { - return true; - } - return false; + return ackPolicy == WifiMacHeader::NORMAL_ACK; } void @@ -177,11 +165,7 @@ WifiBarBlockAck::CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const { - if (ackPolicy == WifiMacHeader::BLOCK_ACK) - { - return true; - } - return false; + return ackPolicy == WifiMacHeader::BLOCK_ACK; } void @@ -228,12 +212,7 @@ WifiDlMuBarBaSequence::CheckQosAckPolicy(Mac48Address receiver, return false; } - if (ackPolicy == WifiMacHeader::BLOCK_ACK) - { - return true; - } - - return false; + return ackPolicy == WifiMacHeader::BLOCK_ACK; } void @@ -277,12 +256,7 @@ WifiDlMuTfMuBar::CheckQosAckPolicy(Mac48Address receiver, WifiMacHeader::QosAckPolicy ackPolicy) const { // the only admitted ack policy is Block Ack because stations need to wait for a MU-BAR - if (ackPolicy == WifiMacHeader::BLOCK_ACK) - { - return true; - } - - return false; + return ackPolicy == WifiMacHeader::BLOCK_ACK; } void @@ -318,12 +292,7 @@ WifiDlMuAggregateTf::CheckQosAckPolicy(Mac48Address receiver, WifiMacHeader::QosAckPolicy ackPolicy) const { // the only admitted ack policy is No explicit acknowledgment or TB PPDU Ack policy - if (ackPolicy == WifiMacHeader::NO_EXPLICIT_ACK) - { - return true; - } - - return false; + return ackPolicy == WifiMacHeader::NO_EXPLICIT_ACK; } void @@ -393,12 +362,7 @@ WifiAckAfterTbPpdu::CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const { - if (ackPolicy == WifiMacHeader::NORMAL_ACK) - { - return true; - } - - return false; + return ackPolicy == WifiMacHeader::NORMAL_ACK; } void diff --git a/src/wifi/model/wifi-default-ack-manager.cc b/src/wifi/model/wifi-default-ack-manager.cc index 1d053bdb6..e37256106 100644 --- a/src/wifi/model/wifi-default-ack-manager.cc +++ b/src/wifi/model/wifi-default-ack-manager.cc @@ -154,7 +154,8 @@ WifiDefaultAckManager::IsResponseNeeded(Ptr mpdu, // a case, a Block Ack is not going to be requested anytime soon) // * this is the initial frame of a transmission opportunity and it is not // protected by RTS/CTS (see Annex G.3 of IEEE 802.11-2016) - if (m_baThreshold > 0 && + return !( + m_baThreshold > 0 && GetMaxDistFromStartingSeq(mpdu, txParams) < m_baThreshold * edca->GetBaBufferSize(receiver, tid) && (edca->GetWifiMacQueue()->GetNPackets({WIFI_QOSDATA_QUEUE, WIFI_UNICAST, receiver, tid}) - @@ -162,12 +163,7 @@ WifiDefaultAckManager::IsResponseNeeded(Ptr mpdu, 1) && !(edca->GetTxopLimit(m_linkId).IsStrictlyPositive() && edca->GetRemainingTxop(m_linkId) == edca->GetTxopLimit(m_linkId) && - !(txParams.m_protection && txParams.m_protection->method == WifiProtection::RTS_CTS))) - { - return false; - } - - return true; + !(txParams.m_protection && txParams.m_protection->method == WifiProtection::RTS_CTS))); } bool diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index fe4ec2684..7d9c56197 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1175,8 +1175,8 @@ WifiPhy::DoChannelSwitch() NS_LOG_FUNCTION(this); // Update unspecified parameters with default values - if (auto& [number, width, band, primary20] = m_channelSettings; true) { + auto& [number, width, band, primary20] = m_channelSettings; if (band == static_cast(WIFI_PHY_BAND_UNSPECIFIED)) { band = static_cast(GetDefaultPhyBand(m_standard)); diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index ec31de5f4..b36d77fa1 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -186,11 +186,7 @@ WifiPpdu::DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const * │ Channel │ * └──────────────────────────────┘ */ - if (minTxFreq >= maxFreq || maxTxFreq <= minFreq) - { - return false; - } - return true; + return minTxFreq < maxFreq && maxTxFreq > minFreq; } uint64_t diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 47434f1fe..4ad19ba41 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -3374,7 +3374,7 @@ TestUlOfdmaPhyTransmission::SetTrigVector(uint8_t bssColor, TrigVectorInfo error txVector.SetMode(HePhy::GetHeMcs7(), aid1); txVector.SetNss(1, aid1); - HeRu::RuSpec ru2(ruType, (channelWidth == 160 ? 1 : 2), (channelWidth == 160 ? false : true)); + HeRu::RuSpec ru2(ruType, (channelWidth == 160 ? 1 : 2), (channelWidth != 160)); txVector.SetRu(ru2, aid2); txVector.SetMode(HePhy::GetHeMcs7(), aid2); txVector.SetNss(1, aid2); diff --git a/src/wimax/model/bs-net-device.cc b/src/wimax/model/bs-net-device.cc index d96435031..cee21dfa5 100644 --- a/src/wimax/model/bs-net-device.cc +++ b/src/wimax/model/bs-net-device.cc @@ -716,7 +716,7 @@ BaseStationNetDevice::DoReceive(Ptr packet) packet->RemoveHeader(gnrcMacHdr); if (gnrcMacHdr.GetHt() == MacHeaderType::HEADER_TYPE_GENERIC) { - if (gnrcMacHdr.check_hcs() == false) + if (!gnrcMacHdr.check_hcs()) { // The header is noisy m_bsRxDropTrace(packet); @@ -882,7 +882,7 @@ BaseStationNetDevice::DoReceive(Ptr packet) packet->RemoveHeader(bwRequestHdr); NS_ASSERT_MSG(bwRequestHdr.GetHt() == MacHeaderType::HEADER_TYPE_BANDWIDTH, "A bandwidth request should be carried by a bandwidth header type"); - if (bwRequestHdr.check_hcs() == false) + if (!bwRequestHdr.check_hcs()) { // The header is noisy NS_LOG_INFO("BS:Header HCS ERROR"); diff --git a/src/wimax/model/bs-scheduler-simple.cc b/src/wimax/model/bs-scheduler-simple.cc index 3f8cc2180..3cca7acfc 100644 --- a/src/wimax/model/bs-scheduler-simple.cc +++ b/src/wimax/model/bs-scheduler-simple.cc @@ -187,7 +187,7 @@ BSSchedulerSimple::Schedule() else { burst = Create(); - while (connection->HasPackets() == true) + while (connection->HasPackets()) { uint32_t FirstPacketSize = connection->GetQueue()->GetFirstPacketRequiredByte( MacHeaderType::HEADER_TYPE_GENERIC); diff --git a/src/wimax/model/bs-uplink-scheduler-mbqos.cc b/src/wimax/model/bs-uplink-scheduler-mbqos.cc index cf5aab26d..c702df38a 100644 --- a/src/wimax/model/bs-uplink-scheduler-mbqos.cc +++ b/src/wimax/model/bs-uplink-scheduler-mbqos.cc @@ -1079,7 +1079,7 @@ UplinkSchedulerMBQoS::SetupServiceFlow(SSRecord* ssRecord, ServiceFlow* serviceF switch (serviceFlow->GetSchedulingType()) { case ServiceFlow::SF_TYPE_UGS: { - if (serviceFlow->GetIsMulticast() == true) + if (serviceFlow->GetIsMulticast()) { modulation = serviceFlow->GetModulation(); } diff --git a/src/wimax/model/bs-uplink-scheduler-rtps.cc b/src/wimax/model/bs-uplink-scheduler-rtps.cc index a6e495fe4..d21473a04 100644 --- a/src/wimax/model/bs-uplink-scheduler-rtps.cc +++ b/src/wimax/model/bs-uplink-scheduler-rtps.cc @@ -697,7 +697,7 @@ UplinkSchedulerRtps::SetupServiceFlow(SSRecord* ssRecord, ServiceFlow* serviceFl switch (serviceFlow->GetSchedulingType()) { case ServiceFlow::SF_TYPE_UGS: { - if (serviceFlow->GetIsMulticast() == true) + if (serviceFlow->GetIsMulticast()) { modulation = serviceFlow->GetModulation(); } diff --git a/src/wimax/model/bs-uplink-scheduler-simple.cc b/src/wimax/model/bs-uplink-scheduler-simple.cc index d03d10f20..4c9fbc00a 100644 --- a/src/wimax/model/bs-uplink-scheduler-simple.cc +++ b/src/wimax/model/bs-uplink-scheduler-simple.cc @@ -542,7 +542,7 @@ UplinkSchedulerSimple::SetupServiceFlow(SSRecord* ssRecord, ServiceFlow* service switch (serviceFlow->GetSchedulingType()) { case ServiceFlow::SF_TYPE_UGS: { - if (serviceFlow->GetIsMulticast() == true) + if (serviceFlow->GetIsMulticast()) { modulation = serviceFlow->GetModulation(); } diff --git a/src/wimax/model/simple-ofdm-wimax-phy.cc b/src/wimax/model/simple-ofdm-wimax-phy.cc index f9330b56b..65f17f655 100644 --- a/src/wimax/model/simple-ofdm-wimax-phy.cc +++ b/src/wimax/model/simple-ofdm-wimax-phy.cc @@ -319,14 +319,7 @@ SimpleOfdmWimaxPhy::StartSendDummyFecBlock(bool isFirstBlock, dynamic_cast(PeekPointer(GetChannel())); NS_ASSERT(channel != nullptr); - if (m_nrRemainingBlocksToSend == 1) - { - isLastFecBlock = true; - } - else - { - isLastFecBlock = false; - } + isLastFecBlock = (m_nrRemainingBlocksToSend == 1); channel->Send(m_blockTime, m_currentBurstSize, this, @@ -471,7 +464,7 @@ SimpleOfdmWimaxPhy::EndReceiveFecBlock(uint32_t burstSize, SetState(PHY_STATE_IDLE); m_nrReceivedFecBlocks++; - if (drop == true) + if (drop) { m_nbErroneousBlock++; } diff --git a/src/wimax/model/snr-to-block-error-rate-manager.cc b/src/wimax/model/snr-to-block-error-rate-manager.cc index 7901e168c..070748536 100644 --- a/src/wimax/model/snr-to-block-error-rate-manager.cc +++ b/src/wimax/model/snr-to-block-error-rate-manager.cc @@ -98,7 +98,7 @@ SNRToBlockErrorRateManager::LoadTraces() traceFilePath << m_traceFilePath << "/modulation" << i << ".txt"; traceFile.open(traceFilePath.str(), std::ifstream::in); - if (traceFile.good() == false) + if (!traceFile.good()) { NS_LOG_INFO("Unable to load " << traceFilePath.str() << "!! Loading default traces..."); LoadDefaultTraces(); @@ -237,7 +237,7 @@ SNRToBlockErrorRateManager::ReLoadTraces() traceFilePath << m_traceFilePath << "/Modulation" << i << ".txt"; traceFile.open(traceFilePath.str(), std::ifstream::in); - if (traceFile.good() == false) + if (!traceFile.good()) { NS_LOG_INFO("Unable to load " << traceFilePath.str() << "!!Loading default traces..."); LoadDefaultTraces(); @@ -275,7 +275,7 @@ SNRToBlockErrorRateManager::GetTraceFilePath() double SNRToBlockErrorRateManager::GetBlockErrorRate(double SNR, uint8_t modulation) { - if (m_activateLoss == false) + if (!m_activateLoss) { return 0; } @@ -312,7 +312,7 @@ SNRToBlockErrorRateManager::GetBlockErrorRate(double SNR, uint8_t modulation) SNRToBlockErrorRateRecord* SNRToBlockErrorRateManager::GetSNRToBlockErrorRateRecord(double SNR, uint8_t modulation) { - if (m_activateLoss == false) + if (!m_activateLoss) { return new SNRToBlockErrorRateRecord(SNR, 0, 0, 0, 0, 0); } diff --git a/src/wimax/model/ss-net-device.cc b/src/wimax/model/ss-net-device.cc index 45a1fa629..ce2a9a566 100644 --- a/src/wimax/model/ss-net-device.cc +++ b/src/wimax/model/ss-net-device.cc @@ -819,7 +819,7 @@ SubscriberStationNetDevice::DoReceive(Ptr packet) if (gnrcMacHdr.GetHt() == MacHeaderType::HEADER_TYPE_GENERIC) { - if (gnrcMacHdr.check_hcs() == false) + if (!gnrcMacHdr.check_hcs()) { // The header is noisy NS_LOG_INFO("Header HCS ERROR"); diff --git a/src/wimax/model/ul-job.h b/src/wimax/model/ul-job.h index 18ff65ea2..1529aa14a 100644 --- a/src/wimax/model/ul-job.h +++ b/src/wimax/model/ul-job.h @@ -220,14 +220,7 @@ struct SortProcess left.GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged(); int32_t rightBacklogged = left.GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged(); - if (leftBacklogged <= rightBacklogged) - { - return true; - } - else - { - return false; - } + return leftBacklogged <= rightBacklogged; } else { @@ -257,14 +250,7 @@ struct SortProcessPtr left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged(); int32_t rightBacklogged = left->GetUlJob()->GetServiceFlow()->GetRecord()->GetBacklogged(); - if (leftBacklogged <= rightBacklogged) - { - return true; - } - else - { - return false; - } + return leftBacklogged <= rightBacklogged; } else { diff --git a/src/wimax/test/phy-test.cc b/src/wimax/test/phy-test.cc index d55af2588..c61a27ec1 100644 --- a/src/wimax/test/phy-test.cc +++ b/src/wimax/test/phy-test.cc @@ -96,7 +96,7 @@ Ns3WimaxSimpleOFDMTestCase::DoRunOnce(double FrameDuration) Simulator::Run(); for (int i = 0; i < 3; i++) { - if (ssDevs.Get(i)->GetObject()->IsRegistered() == false) + if (!ssDevs.Get(i)->GetObject()->IsRegistered()) { NS_LOG_DEBUG("SS[" << i << "] not registered"); return true; // Test fail because SS[i] is not registered @@ -113,7 +113,7 @@ Ns3WimaxSimpleOFDMTestCase::DoRun() for (int i = 0; i < 7; i++) { NS_LOG_DEBUG("Frame Duration = " << frameDuratioTab[i]); - if (DoRunOnce(frameDuratioTab[i]) != false) + if (DoRunOnce(frameDuratioTab[i])) { return; } diff --git a/src/wimax/test/qos-test.cc b/src/wimax/test/qos-test.cc index be92e5ced..bc5afb25d 100644 --- a/src/wimax/test/qos-test.cc +++ b/src/wimax/test/qos-test.cc @@ -154,11 +154,11 @@ Ns3WimaxSchedulingTestCase::DoRunOnce(WimaxHelper::SchedulerType scheduler) void Ns3WimaxSchedulingTestCase::DoRun() { - if (DoRunOnce(WimaxHelper::SCHED_TYPE_SIMPLE) == true) + if (DoRunOnce(WimaxHelper::SCHED_TYPE_SIMPLE)) { return; } - if (DoRunOnce(WimaxHelper::SCHED_TYPE_RTPS) == true) + if (DoRunOnce(WimaxHelper::SCHED_TYPE_RTPS)) { return; } @@ -284,15 +284,15 @@ Ns3WimaxSFTypeTestCase::DoRunOnce(ServiceFlow::SchedulingType schedulingType) void Ns3WimaxSFTypeTestCase::DoRun() { - if (DoRunOnce(ServiceFlow::SF_TYPE_UGS) == true) + if (DoRunOnce(ServiceFlow::SF_TYPE_UGS)) { return; } - if (DoRunOnce(ServiceFlow::SF_TYPE_RTPS) == true) + if (DoRunOnce(ServiceFlow::SF_TYPE_RTPS)) { return; } - if (DoRunOnce(ServiceFlow::SF_TYPE_BE) == true) + if (DoRunOnce(ServiceFlow::SF_TYPE_BE)) { return; }