This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Help with extended asm syntax and related topics
- From: Kai Henningsen <kai dot extern at googlemail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 12 Oct 2008 18:18:56 +0200
- Subject: Re: Help with extended asm syntax and related topics
- References: <48F11E05.9090407@verizon.net>
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); }