LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_types.h
Go to the documentation of this file.
1// types.h
2//
3// Author: J.A. de Jong - ASCEE
4//
5// Description:
6// Typedefs and namespace pollution for stuff that is almost always
7// needed.
9#pragma once
10#include "lasp_config.h"
11#include <stddef.h>
12
13// // Branch prediction performance improvement
14#if !defined(islikely) && defined(__GNUC__) && !defined(LASP_DEBUG)
15#define islikely(x) __builtin_expect(!!(x), 1)
16#define isunlikely(x) __builtin_expect(!!(x), 0)
17#else
18#define islikely(x) (x)
19#define isunlikely(x) (x)
20#endif // !defined(likely)
21
23#ifndef __cplusplus
24#include <stdbool.h> // true, false
25#include <stddef.h>
26#endif
27
28static_assert(sizeof(size_t) == 8);
29typedef size_t us; /* Size type I always use */
30
31// To change the whole code to 32-bit floating points, change this to
32// float.
33#if LASP_FLOAT_SIZE == 32
34typedef float d; /* Shortcut for floating point - single precision */
35#elif LASP_FLOAT_SIZE == 64
36typedef double d; /* Shortcut for floating point - double precision */
37#else
38#error LASP_FLOAT_SIZE should be either 32 or 64
39#endif
40
41#ifdef __cplusplus
42 #include <complex>
43 typedef std::complex<d> c;
44#else
45 #include <complex.h>
46 #if LASP_FLOAT_SIZE == 32
47 typedef float complex c;
48 #else
49 typedef double complex c;
50#endif
51
52#endif
53
54
double complex c
Definition lasp_types.h:49
size_t us
We often use boolean values.
Definition lasp_types.h:29