HOPS
HOPS class reference
bytflp.h
Go to the documentation of this file.
1 #include "hops_config.h"
2 #include "mk4_util.h"
3 
4 #ifndef BYTFLP_H
5 #define BYTFLP_H
6 
7 #ifdef BYTFLP
8 
9 #define cp_short(a,b) {a = b; short_reverse (&(a));}
10 #define cp_unsig(a,b) {a = b; unsig_reverse (&(a));}
11 #define cp_int(a,b) {a = b; int_reverse (&(a));}
12 #define cp_uint(a,b) {a = b; uint_reverse (&(a));}
13 #define cp_long(a,b) {a = b; long_reverse (&(a));}
14 #define cp_float(a,b) {a = b; float_reverse (&(a));}
15 #define cp_double(a,b) {a = b; double_reverse (&(a));}
16 
17 #else
18 
19 #define cp_short(a,b) a = b
20 #define cp_unsig(a,b) a = b
21 #define cp_int(a,b) a = b
22 #define cp_uint(a,b) a = b
23 #define cp_long(a,b) a = b
24 #define cp_float(a,b) a = b
25 #define cp_double(a,b) a = b
26 
27 #endif
28 
29 
30 // strncpy/memcpy guard/helper functions
31 // these are needed to avoid undefined behavior in the copy_XXX functions when
32 // source/dest buffers are the same, on AVX-512 machines glibc zeros part of the
33 // buffer which clobbers any in-place string copies
34 #include <string.h>
35 
36 #define cp_strn(a,b,n) do { if ((void *)(a) != (void *)(b)) strncpy (a, b, n); } while (0)
37 #define cp_str(a,b) do { if ((void *)(a) != (void *)(b)) strcpy (a, b); } while (0)
38 #define cp_mem(a,b,n) memmove (a, b, n)
39 
40 #endif