• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	while (num > 0) {
39 		*x++ = 0;
40                 --num;
41 	}
42 }
43 
44 
45 /*********************************************************************
46 * Function: Copy()                                                   *
47 *                                                                    *
48 * Description: Copy vector x[] to y[]                                *
49 *********************************************************************/
50 
Copy(Word16 x[],Word16 y[],Word16 L)51 void Copy(
52 		Word16 x[],                           /* (i)   : input vector   */
53 		Word16 y[],                           /* (o)   : output vector  */
54 		Word16 L                              /* (i)   : vector length  */
55 	 )
56 {
57 	Word32	temp1,temp2,num;
58         if (L <= 0) {
59                 return;
60         }
61 	if(L&1)
62 	{
63 		temp1 = *x++;
64 		*y++ = temp1;
65 	}
66 	num = (Word32)(L>>1);
67 	while (num > 0) {
68 		temp1 = *x++;
69 		temp2 = *x++;
70 		*y++ = temp1;
71 		*y++ = temp2;
72                 --num;
73 	}
74 }
75 
76 
77 
78