• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include <altivec.h>
3 
4 union si_overlay
5 {
6   vector signed int v;
7   int ints[4];
8 };
9 
10 vector signed int
vec_init()11 vec_init ()
12 {
13   vector signed int v;
14   static int count = 1;
15 
16   ((union si_overlay *) &v)->ints[0] = count++;
17   ((union si_overlay *) &v)->ints[1] = count++;
18   ((union si_overlay *) &v)->ints[2] = count++;
19   ((union si_overlay *) &v)->ints[3] = count++;
20   return v;
21 }
22 
23 void
vec_print(vector signed int v)24 vec_print (vector signed int v)
25 {
26   printf ("%08x %08x %08x %08x",
27 	 ((union si_overlay *) &v)->ints[0],
28 	 ((union si_overlay *) &v)->ints[1],
29 	 ((union si_overlay *) &v)->ints[2],
30 	 ((union si_overlay *) &v)->ints[3]);
31 }
32 
33