diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-11-10 18:49:55 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-11-10 18:49:55 -0500 |
commit | b64619d5754eb9ae5bb2e31678444a9f9f7d1c8f (patch) | |
tree | 0f351196617406f32aa3df756eb029482ea688eb /base/inet.hh | |
parent | 338513c6812501a4ea3a87d633e16b2ce83923eb (diff) | |
download | gem5-b64619d5754eb9ae5bb2e31678444a9f9f7d1c8f.tar.xz |
Make it so we can cast an EthAddr to a 64-bit integer
--HG--
extra : convert_revision : 2f470d122997fbc375f04e9c2682b6528adef50c
Diffstat (limited to 'base/inet.hh')
-rw-r--r-- | base/inet.hh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/inet.hh b/base/inet.hh index 7ea4de6bb..10b782a6c 100644 --- a/base/inet.hh +++ b/base/inet.hh @@ -81,6 +81,19 @@ struct EthAddr : protected eth_addr bool multicast() const { return data[0] == 0x01; } bool broadcast() const { return data[0] == 0xff; } std::string string() const; + + operator uint64_t() const + { + uint64_t reg = 0; + reg |= ((uint64_t)data[0]) << 40; + reg |= ((uint64_t)data[1]) << 32; + reg |= ((uint64_t)data[2]) << 24; + reg |= ((uint64_t)data[3]) << 16; + reg |= ((uint64_t)data[4]) << 8; + reg |= ((uint64_t)data[5]) << 0; + return reg; + } + }; std::ostream &operator<<(std::ostream &stream, const EthAddr &ea); |