• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2003 - 2016 Sony Corporation
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 #ifndef _STRUCT_H
18 #define _STRUCT_H
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <math.h>
24 
25 /***************************************************************************************************
26     Macro Definition
27 ***************************************************************************************************/
28 
29 #define DECLFUNC static
30 #define UNUSED_ATTR __attribute__((unused))
31 
32 #ifndef PI
33 #ifdef M_PI
34 #define PI M_PI
35 #else /* M_PI */
36 #define PI (double)(3.14159265358979323846)
37 #endif /* M_PI */
38 #endif /* PI */
39 
40 /***************************************************************************************************
41     Type Definition
42 ***************************************************************************************************/
43 typedef unsigned char STREAM;
44 
45 typedef short          INT16;
46 typedef int            INT32;
47 typedef unsigned int  UINT32;
48 typedef long long      INT64;
49 
50 typedef float         SCALAR;
51 #define _scalar(x) x##f
52 typedef union {
53     float f;
54     int i;
55 } IEEE754_FI;
56 
57 /***************************************************************************************************
58     Macro Functions
59 ***************************************************************************************************/
60 /* Buffer Operations */
61 #define clear_data_ldac(p, n)      memset((p), 0, (n))
62 #define clear_seq_s_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(short))
63 #define clear_seq_l_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(int))
64 #define clear_seq_f_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(SCALAR))
65 
66 #if _MSC_VER >=1400
67 /* Secured CRT Functions */
68 #define copy_data_ldac(p1, p2, n)  memcpy_s((p2), (n), (p1), (n))
69 #define copy_seq_s_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(short), (p1), (n)*sizeof(short))
70 #define copy_seq_l_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(int), (p1), (n)*sizeof(int))
71 #define copy_seq_f_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(SCALAR), (p1), (n)*sizeof(SCALAR))
72 #define move_seq_f_ldac(p1, p2, n) memmove_s((p2), (n)*sizeof(SCALAR), (p1), (n)*sizeof(SCALAR))
73 #else
74 #define copy_data_ldac(p1, p2, n)  memcpy((p2), (p1), (n))
75 #define copy_seq_s_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(short))
76 #define copy_seq_l_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(int))
77 #define copy_seq_f_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(SCALAR))
78 #define move_seq_f_ldac(p1, p2, n) memmove((p2), (p1), (n)*sizeof(SCALAR))
79 #endif
80 
81 #endif /* _STRUCT_H */
82 
83