1 /*
2  ** Copyright 2003-2010, VisualOn, Inc.
3  **
4  ** Licensed under the Apache License, Version 2.0 (the "License");
5  ** you may not use this file except in compliance with the License.
6  ** You may obtain a copy of the License at
7  **
8  **     http://www.apache.org/licenses/LICENSE-2.0
9  **
10  ** Unless required by applicable law or agreed to in writing, software
11  ** distributed under the License is distributed on an "AS IS" BASIS,
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ** See the License for the specific language governing permissions and
14  ** limitations under the License.
15  */
16 
17 /***********************************************************************
18 *       File: util.c                                                   *
19 *                                                                      *
20 *       Description: Reset and Copy buffer                             *
21 *                                                                      *
22 ************************************************************************/
23 
24 #include "typedef.h"
25 #include "basic_op.h"
26 
27 /***********************************************************************
28 * Function:  Set_zero()                                             *
29 * Description: Set vector x[] to zero                               *
30 ************************************************************************/
31 
Set_zero(Word16 x[],Word16 L)32 void Set_zero(
33 		Word16 x[],                           /* (o)    : vector to clear     */
34 		Word16 L                              /* (i)    : length of vector    */
35 	     )
36 {
37 	Word32 num = (Word32)L;
38 	do{
39 		*x++ = 0;
40 	}while(--num !=0);
41 }
42 
43 
44 /*********************************************************************
45 * Function: Copy()                                                   *
46 *                                                                    *
47 * Description: Copy vector x[] to y[]                                *
48 *********************************************************************/
49 
Copy(Word16 x[],Word16 y[],Word16 L)50 void Copy(
51 		Word16 x[],                           /* (i)   : input vector   */
52 		Word16 y[],                           /* (o)   : output vector  */
53 		Word16 L                              /* (i)   : vector length  */
54 	 )
55 {
56 	Word32	temp1,temp2,num;
57 	if(L&1)
58 	{
59 		temp1 = *x++;
60 		*y++ = temp1;
61 	}
62 	num = (Word32)(L>>1);
63 	temp1 = *x++;
64 	temp2 = *x++;
65 	do{
66 		*y++ = temp1;
67 		*y++ = temp2;
68 		temp1 = *x++;
69 		temp2 = *x++;
70 	}while(--num!=0);
71 }
72 
73 
74 
75