This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with extended asm syntax and related topics


On Sat, 11 Oct 2008 17:43:33 -0400
John Fine <johnsfine@verizon.net> wrote:

> typedef unsigned int uint;
> template <class Ts, class Tc, class Tv>
> inline void foo(uint k, uint n, double const& m, Ts s, Tc c, Tv v) {
> #pragma ivdep
> while (++k < n) s[ c[k] ] -= m * v[k]; }

> 4)  Ts, Tc and Tv are various types at various points the call is
> made. But Ts is always something that can be cast to double*,
> similarly Tc to uint const*, and Tv to double const*.  But if I put
> those in the function declaration, the compiler won't make the cast.
> Instead it will select the more general template.  Do you know a
> cleaner solution to that ??? (not on my main topic, but I'd like to
> know that too).

How about this?

typedef unsigned int uint;
inline void foo0(uint k, uint n, double const& m, double* s, uint const*
c, double const* v) { #pragma ivdep
while (++k < n) s[ c[k] ] -= m * v[k]; }

template <class Ts, class Tc, class Tv>
inline void foo(uint k, uint n, double const& m, Ts s, Tc c, Tv v)
{ foo0(k, n, m, s, c, v); }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]