liyujie
2025-08-28 b3810562527858a3b3d98ffa6e9c9c5b0f4a9a8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright (C) 2003 - 2016 Sony Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#ifndef _STRUCT_H
#define _STRUCT_H
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
/***************************************************************************************************
    Macro Definition
***************************************************************************************************/
 
#define DECLFUNC static
#define UNUSED_ATTR __attribute__((unused))
 
#ifndef PI
#ifdef M_PI
#define PI M_PI
#else /* M_PI */
#define PI (double)(3.14159265358979323846)
#endif /* M_PI */
#endif /* PI */
 
/***************************************************************************************************
    Type Definition
***************************************************************************************************/
typedef unsigned char STREAM;
 
typedef short          INT16;
typedef int            INT32;
typedef unsigned int  UINT32;
typedef long long      INT64;
 
typedef float         SCALAR;
#define _scalar(x) x##f
typedef union {
    float f;
    int i;
} IEEE754_FI;
 
/***************************************************************************************************
    Macro Functions
***************************************************************************************************/
/* Buffer Operations */
#define clear_data_ldac(p, n)      memset((p), 0, (n))
#define clear_seq_s_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(short))
#define clear_seq_l_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(int))
#define clear_seq_f_ldac(p, n)     memset((char *)(p), 0, (n)*sizeof(SCALAR))
 
#if _MSC_VER >=1400
/* Secured CRT Functions */
#define copy_data_ldac(p1, p2, n)  memcpy_s((p2), (n), (p1), (n))
#define copy_seq_s_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(short), (p1), (n)*sizeof(short))
#define copy_seq_l_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(int), (p1), (n)*sizeof(int))
#define copy_seq_f_ldac(p1, p2, n) memcpy_s((p2), (n)*sizeof(SCALAR), (p1), (n)*sizeof(SCALAR))
#define move_seq_f_ldac(p1, p2, n) memmove_s((p2), (n)*sizeof(SCALAR), (p1), (n)*sizeof(SCALAR))
#else
#define copy_data_ldac(p1, p2, n)  memcpy((p2), (p1), (n))
#define copy_seq_s_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(short))
#define copy_seq_l_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(int))
#define copy_seq_f_ldac(p1, p2, n) memcpy((p2), (p1), (n)*sizeof(SCALAR))
#define move_seq_f_ldac(p1, p2, n) memmove((p2), (p1), (n)*sizeof(SCALAR))
#endif
 
#endif /* _STRUCT_H */