[macstl-dev] gcc 3.3 on YellowDogLinux
Michael LeBlanc
leblanc at skycomputers.com
Sat Mar 26 00:09:40 WST 2005
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 ;
More information about the macstl-dev
mailing list