I'm trying to follow a simple sample altivec initialization like this:
1 // Example1.c
2 #include <stdio.h>
#include <altivec.h>
3
4 int main()
5 {
6 __vector unsigned char v1;
7
8 // Assign 16 8-bit elements to vector v1
9 v1 = (__vector unsigned char)(
10 '0', '1', '2', '3',
11 '4', '5', '6', '7',
12 '8', '9', 'A', 'B',
13 'C', 'D', 'E', 'F');
14
15 // Print out the contents of v1 char by char
16 // &v1 is casted to (unsigned char *)
17 for(int i = 0; i < 16; i++)
18 printf("%c", ((unsigned char *)(&v1))[i]);;
19
20
21 return 0;
22 }
However, when I compile I get an error saying error: can't convert between vector values of different size.
Would anyone know why this is so? My gcc version is 4.4.6.
I get it working now with Paul's solution.
HOwever, when I try to print it, it's giving me error as I commented under Paul's comment.
Would anyone know why thi sis so?