[macstl-dev] gcc 3.3 on YellowDogLinux

Glen Low glen.low at pixelglow.com
Mon Mar 28 02:07:03 WST 2005

  • Previous message: [macstl-dev] gcc 3.3 on YellowDogLinux
  • Next message: [macstl-dev] gcc 3.3 on YellowDogLinux
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]


On 26/03/2005, at 12:09 AM, Michael LeBlanc wrote:

> Here's a version that hides the casting inside generator.  I added a 
> template parameter R, the desired return type.  See line 15 where, 
> now, the legal cast form works.  static_cast still won't work.
>
> This would ding every use of generator.  Do you create generator.h 
> from a higher level form?  I'm an AWK junkie.
>
>      1  #include <altivec.h>
>      2
>      3  template <unsigned int v0, typename R>
>      4  struct generator
>      5      {
>      6      R
>      7      operator() () const
>      8          {
>      9          union union_type
>     10              {
>     11              unsigned int val [4];
>     12              __vector unsigned int vec;
>     13              };
>     14          static const union_type un = {v0, v0, v0, v0};
>     15          return (R) (un.vec);
>     16          }
>     17      };
>     18
>     19  __vector unsigned char zz =
>     20      generator <0,__vector unsigned char> () ()
>     21      ;
>

That looks good, however it would make all the explicit specializations 
of generator into partial specializations, which may in turn slow the 
compiler down.

Is it at all possible to compile

__vector unsigned char zz = (__vector unsigned char) generator <0> () 
(); // declared "template <unsigned int v0> struct generator"

The compiler should parse this as a cast to vector of the result of 
generator <0> () () -- and not having any brackets around generator <0> 
() () it should not think it is a vector initialization.

If that doesn't work, looks like we will go with your suggestion.

Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen




  • Previous message: [macstl-dev] gcc 3.3 on YellowDogLinux
  • Next message: [macstl-dev] gcc 3.3 on YellowDogLinux
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the macstl-dev mailing list