|
Boost : |
Subject: Re: [boost] Proposal/InterestCheck: Boost.Geom
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-01-27 12:44:15
Anis Benyelloul wrote:
> (such as if you
> are packing the X and Y coordinates in the same machine word,
> geom::point<>::operator==() will be able to compare both coordinates with the
> same operation, instead of the generic x1==x2 && y1==y2).
I have wondered about this particular optimisation before and your
mention made me investigate. gcc for ARM seems to make the
optimisation but surprisingly the x86 version doesn't. Test code:
struct pair {
short a;
short b;
};
int compare_pair(struct pair p1, struct pair p2)
{
return p1.a==p2.a && p1.b==p2.b;
}
int compare_int(int i1, int i2)
{
return i1==i2;
}
Is there anything in the language that makes this sort of thing
difficult for the compiler? I don't think so.
Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk