[Ns-bugs] [Bug 86] add missing functions to Mac48Address code
bugzilla-daemon@nsnam-www.ece.gatech.edu
bugzilla-daemon at nsnam-www.ece.gatech.edu
Wed Oct 10 03:58:14 PDT 2007
http://www.nsnam.org/bugzilla/show_bug.cgi?id=86
gjcarneiro at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gjcarneiro at gmail.com
------- Comment #3 from gjcarneiro at gmail.com 2007-10-10 06:58 -------
(In reply to comment #2)
> (In reply to comment #1)
> > +bool operator < (const Mac48Address &a, const Mac48Address &b)
> > +{
> > + uint8_t aP[6];
> > + uint8_t bP[6];
> > + a.CopyTo (aP);
> > + b.CopyTo (bP);
> >
> > Isn't it easier/faster to compare directly m_data of a and b? I think you can
> > do it if only operator < is a member of the class... (in C++ you can access
> > private members of other instances of the same class!).
>
> you can make the non-member function be a friend of the class. But, clearly,
> the goal was not performance here.
I have no proof of this, but I think "operator <" is going to be performance
sensitive because it is used by stl::map and stl::set, for example.
I have another idea; why not make Mac48Address store a uint64_t internally?
This way comparison could become very fast on 64 bit processors, and probably
also even in 32 bit ones (compiler optimisation). That is assuming support for
64 bit integers is portable, of course (I have no idea).
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs
mailing list