2018-01-29 15:14:50 +00:00
|
|
|
// types.h
|
|
|
|
//
|
|
|
|
// Author: J.A. de Jong - ASCEE
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
// Typedefs and namespace pollution for stuff that is almost always
|
|
|
|
// needed.
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
2018-02-23 19:40:45 +00:00
|
|
|
#ifndef LASP_TYPES_H
|
|
|
|
#define LASP_TYPES_H
|
2018-02-09 10:56:49 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
// // Branch prediction performance improvement
|
|
|
|
#if !defined(likely)
|
2018-02-23 19:40:45 +00:00
|
|
|
#if defined(__GNUC__) && !defined(LASP_DEBUG)
|
2018-02-06 11:01:27 +00:00
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
#else
|
|
|
|
#define likely(x) (x)
|
|
|
|
#define unlikely(x) (x)
|
2018-02-23 19:40:45 +00:00
|
|
|
#endif // if defined(__GNUC__) && !defined(LASP_DEBUG)
|
2018-02-09 10:56:49 +00:00
|
|
|
|
|
|
|
#endif // !defined(likely)
|
2018-02-06 11:01:27 +00:00
|
|
|
|
2018-01-29 15:14:50 +00:00
|
|
|
/// We often use boolean values
|
|
|
|
#include <stdbool.h> // true, false
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <complex.h>
|
|
|
|
typedef size_t us; /* Size type I always use */
|
|
|
|
|
|
|
|
// To change the whole code to 32-bit floating points, change this to
|
|
|
|
// float.
|
2018-02-23 19:40:45 +00:00
|
|
|
#if LASP_FLOAT == 32
|
2018-01-29 15:14:50 +00:00
|
|
|
typedef float d; /* Shortcut for double */
|
|
|
|
typedef float complex c;
|
2018-02-23 19:40:45 +00:00
|
|
|
#elif LASP_FLOAT == 64
|
2018-01-29 15:14:50 +00:00
|
|
|
typedef double d; /* Shortcut for double */
|
|
|
|
typedef double complex c;
|
|
|
|
#else
|
2018-02-23 19:40:45 +00:00
|
|
|
#error LASP_FLOAT should be either 32 or 64
|
2018-01-29 15:14:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/// I need these numbers so often, that they can be in the global
|
|
|
|
/// namespace.
|
|
|
|
#define SUCCESS 0
|
|
|
|
#define INTERRUPTED (-3)
|
|
|
|
#define MALLOC_FAILED (-1)
|
|
|
|
#define FAILURE -2
|
|
|
|
|
|
|
|
|
2018-02-23 19:40:45 +00:00
|
|
|
#endif // LASP_TYPES_H
|
2018-01-29 15:14:50 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|