1 /**
2  * Aften: A/52 audio encoder
3  * Copyright (c) 2007, David Conrad
4  * Copyright (c) 2006, Ryan C. Gordon
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef ALTIVEC_COMMON_H
22 #define ALTIVEC_COMMON_H
23 
24 typedef vector unsigned char  vec_u8_t;
25 typedef vector signed char    vec_s8_t;
26 typedef vector unsigned short vec_u16_t;
27 typedef vector signed short   vec_s16_t;
28 typedef vector unsigned int   vec_u32_t;
29 typedef vector signed int     vec_s32_t;
30 
31 #define VPERMUTE4(a,b,c,d) (vec_u8_t) \
32                              ( (a*4)+0, (a*4)+1, (a*4)+2, (a*4)+3, \
33                                (b*4)+0, (b*4)+1, (b*4)+2, (b*4)+3, \
34                                (c*4)+0, (c*4)+1, (c*4)+2, (c*4)+3, \
35                                (d*4)+0, (d*4)+1, (d*4)+2, (d*4)+3 )
36 
vec_ld_float(const float * a)37 static inline vector float vec_ld_float(const float *a)
38 {
39     switch((int)a & 0xc) {
40         case 4:  return vec_splat(vec_lde(0, a), 1);
41         case 8:  return vec_splat(vec_lde(0, a), 2);
42         case 12: return vec_splat(vec_lde(0, a), 3);
43     }
44     return vec_splat(vec_lde(0, a), 0);
45 }
46 
47 #endif
48