LAL  7.5.0.1-08ee4f4
Sequence.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2007 Kipp Cannon, Josh Willis
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13  * Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #include <string.h>
22 #include <lal/Date.h>
23 #include <lal/LALDatatypes.h>
24 #include <lal/LALStdlib.h>
25 #include <lal/LALStatusMacros.h>
26 #include <lal/LALError.h>
27 #include <lal/Sequence.h>
28 #include <lal/XLALError.h>
29 #include <lal/LALConfig.h> /* So we know whether we're aligning memory */
30 
31 /*
32  * Shift the bytes in the buffer buff, whose length is length, count bytes to
33  * higher addresses. If the magnitude of count is greater than or equal to
34  * that of length, then nothing is done.
35  */
36 
37 
38 static void memshift(void *buff, size_t length, int count)
39 {
40  if(count >= 0) {
41  if(length > (size_t) count)
42  memmove((char *) buff + count, buff, length - count);
43  } else {
44  if(length > (size_t) -count)
45  memmove(buff, (char *) buff - count, length + count);
46  }
47 }
48 
49 
50 /*
51  * Begin library functions...
52  */
53 
54 #define DATATYPE REAL4
55 #define SQUAREDATATYPE REAL4
56 #ifdef LAL_FFTW3_MEMALIGN_ENABLED
57 #define USE_ALIGNED_MEMORY_ROUTINES
58 #endif
59 #include "Sequence_source.c"
60 #undef USE_ALIGNED_MEMORY_ROUTINES
61 #undef DATATYPE
62 #undef SQUAREDATATYPE
63 
64 #define DATATYPE REAL8
65 #define SQUAREDATATYPE REAL8
66 #ifdef LAL_FFTW3_MEMALIGN_ENABLED
67 #define USE_ALIGNED_MEMORY_ROUTINES
68 #endif
69 #include "Sequence_source.c"
70 #undef USE_ALIGNED_MEMORY_ROUTINES
71 #undef DATATYPE
72 #undef SQUAREDATATYPE
73 
74 #define DATATYPE COMPLEX8
75 #define SQUAREDATATYPE REAL4
76 #define CONJ conjf
77 #ifdef LAL_FFTW3_MEMALIGN_ENABLED
78 #define USE_ALIGNED_MEMORY_ROUTINES
79 #endif
80 #include "Sequence_source.c"
81 #include "SequenceComplex_source.c"
82 #undef USE_ALIGNED_MEMORY_ROUTINES
83 #undef DATATYPE
84 #undef SQUAREDATATYPE
85 #undef CONJ
86 
87 #define DATATYPE COMPLEX16
88 #define SQUAREDATATYPE REAL8
89 #define CONJ conj
90 #ifdef LAL_FFTW3_MEMALIGN_ENABLED
91 #define USE_ALIGNED_MEMORY_ROUTINES
92 #endif
93 #include "Sequence_source.c"
94 #include "SequenceComplex_source.c"
95 #undef USE_ALIGNED_MEMORY_ROUTINES
96 #undef DATATYPE
97 #undef SQUAREDATATYPE
98 #undef CONJ
99 
100 #define DATATYPE INT2
101 #define SQUAREDATATYPE UINT2
102 #include "Sequence_source.c"
103 #undef DATATYPE
104 #undef SQUAREDATATYPE
105 
106 #define DATATYPE UINT2
107 #define SQUAREDATATYPE UINT2
108 #include "Sequence_source.c"
109 #undef DATATYPE
110 #undef SQUAREDATATYPE
111 
112 #define DATATYPE INT4
113 #define SQUAREDATATYPE UINT4
114 #include "Sequence_source.c"
115 #undef DATATYPE
116 #undef SQUAREDATATYPE
117 
118 #define DATATYPE UINT4
119 #define SQUAREDATATYPE UINT4
120 #include "Sequence_source.c"
121 #undef DATATYPE
122 #undef SQUAREDATATYPE
123 
124 #define DATATYPE INT8
125 #define SQUAREDATATYPE UINT8
126 #include "Sequence_source.c"
127 #undef DATATYPE
128 #undef SQUAREDATATYPE
129 
130 #define DATATYPE UINT8
131 #define SQUAREDATATYPE UINT8
132 #include "Sequence_source.c"
133 #undef DATATYPE
134 #undef SQUAREDATATYPE
static void memshift(void *buff, size_t length, int count)
Definition: Sequence.c:38