Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/45739 )
Change subject: base: Eliminate macros in base/inet.hh|cc.
......................................................................
base: Eliminate macros in base/inet.hh|cc.
The macro in base/inet.hh, HOME_ADDRESS_OPTION, was not used by
anything. The IP6_EXTENSION macro was replaced with a static inline
function called ip6Extension. The awkward nested ternary operator was
replaced with an equivalent ||.
Change-Id: I100894811159b39b964a49c43a09d493d1268739
---
M src/base/inet.cc
M src/base/inet.hh
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/base/inet.cc b/src/base/inet.cc
index 7ae36c3..bc9c516 100644
--- a/src/base/inet.cc
+++ b/src/base/inet.cc
@@ -274,12 +274,18 @@
return true;
}
-#define IP6_EXTENSION(nxt) (nxt == IP_PROTO_HOPOPTS) ? true : \
- (nxt == IP_PROTO_ROUTING) ? true : \
- (nxt == IP_PROTO_FRAGMENT) ? true : \
- (nxt == IP_PROTO_AH) ? true : \
- (nxt == IP_PROTO_ESP) ? true: \
- (nxt == IP_PROTO_DSTOPTS) ? true : false
+namespace
+{
+
+bool
+ip6Extension(uint8_t nxt)
+{
+ return nxt == IP_PROTO_HOPOPTS || nxt == IP_PROTO_ROUTING ||
+ nxt == IP_PROTO_FRAGMENT || nxt == IP_PROTO_AH ||
+ nxt == IP_PROTO_ESP || nxt == IP_PROTO_DSTOPTS;
+}
+
+} // anonymous namespace
/* Scan the IP6 header for all header extensions
* and return the number of headers found
@@ -292,7 +298,7 @@
int len = 0;
int all = plen();
- while (IP6_EXTENSION(nxt)) {
+ while (ip6Extension(nxt)) {
const Ip6Opt *ext = (const Ip6Opt *)data;
nxt = ext->nxt();
len += ext->len();
@@ -315,7 +321,7 @@
Ip6Opt* opt = NULL;
int all = plen();
- while (IP6_EXTENSION(nxt)) {
+ while (ip6Extension(nxt)) {
opt = (Ip6Opt *)data;
if (nxt == ext_type) {
break;
@@ -340,7 +346,7 @@
uint8_t nxt = ip6_nxt;
int all = plen();
- while (IP6_EXTENSION(nxt)) {
+ while (ip6Extension(nxt)) {
const Ip6Opt *ext = (const Ip6Opt *)data;
nxt = ext->nxt();
data += ext->len();
diff --git a/src/base/inet.hh b/src/base/inet.hh
index b9c0c1c..f0d1f75 100644
--- a/src/base/inet.hh
+++ b/src/base/inet.hh
@@ -565,7 +565,6 @@
ip6_addr_t addr;
};
-#define HOME_ADDRESS_OPTION 0xC9
struct GEM5_PACKED ip6_opt_dstopts
{
uint8_t type;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45739
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I100894811159b39b964a49c43a09d493d1268739
Gerrit-Change-Number: 45739
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s