-
Notifications
You must be signed in to change notification settings - Fork 4
/
erp_utilities.h
67 lines (54 loc) · 2.7 KB
/
erp_utilities.h
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
/***************************************************************************
* Copyright (C) 2008 by Oliver Bock *
* oliver.bock[AT]aei.mpg.de *
* *
* This file is part of Einstein@Home (Radio Pulsar Edition). *
* *
* Einstein@Home is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 2 of the License. *
* *
* Einstein@Home is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Einstein@Home. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef ERP_UTILITIES_H
#define ERP_UTILITIES_H
#define ERP_LITTLE_ENDIAN 0
#define ERP_BIG_ENDIAN 1
#define ERP_SINCOS_LUT_RES 64
#define ERP_SINCOS_LUT_SIZE (ERP_SINCOS_LUT_RES + 1)
#define ERP_SINCOS_LUT_RES_F (1.0f * ERP_SINCOS_LUT_RES)
#define ERP_SINCOS_LUT_RES_F_INV (1.0f / ERP_SINCOS_LUT_RES)
#define ERP_TWO_PI 6.283185f
#define ERP_TWO_PI_INV (1.0f/ERP_TWO_PI)
#include <stdarg.h>
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
error = 1,
warn = 2,
info = 3,
debug = 4
} ERP_LOGLEVEL;
extern int check_byte_order();
extern void endian_swap(uint8_t* pdata, const size_t dsize, const size_t nelements);
extern void logMessage(const ERP_LOGLEVEL logLevel, const bool showLevel, const char* msg, ...);
extern void sincosLUTInitialize(float **sinLUT, float **cosLUT);
extern bool sincosLUTLookup(float x, float *sinX, float *cosX);
extern int resolveFilename(const char *logical, char *physical, int maxLength);
extern int dumpFloatBufferToTextFile(const float *buffer, const size_t size, const char *filename);
extern int findNextPowerofTwo(int value);
#ifdef __cplusplus
}
#endif
#endif