47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#ifndef COMMON_HEADERS_H
|
|
#define COMMON_HEADERS_H
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include <stdint.h>
|
|
#include <assert.h>
|
|
#include <ctype.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <immintrin.h>
|
|
#include <emmintrin.h>
|
|
#include <omp.h>
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <set>
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
#include <cstdlib>
|
|
#include <cmath>
|
|
#include <fenv.h>
|
|
|
|
extern uint64_t exceptions_array[128];
|
|
extern FILE* g_debug_fptr;
|
|
#define STORE_FP_EXCEPTIONS(flagp, exceptions_array) \
|
|
fegetexceptflag(&flagp, FE_ALL_EXCEPT | __FE_DENORM); \
|
|
exceptions_array[FE_INVALID] += ((flagp & FE_INVALID)); \
|
|
exceptions_array[__FE_DENORM] += ((flagp & __FE_DENORM) >> 1); \
|
|
exceptions_array[FE_DIVBYZERO] += ((flagp & FE_DIVBYZERO) >> 2); \
|
|
exceptions_array[FE_OVERFLOW] += ((flagp & FE_OVERFLOW) >> 3); \
|
|
exceptions_array[FE_UNDERFLOW] += ((flagp & FE_UNDERFLOW) >> 4); \
|
|
feclearexcept(FE_ALL_EXCEPT | __FE_DENORM);
|
|
|
|
#define CONVERT_AND_PRINT(X) \
|
|
g_converter.f = (X); \
|
|
fwrite(&(g_converter.i),4,1,g_debug_fptr); \
|
|
|
|
#endif
|