CRYPTO-C
v1.1.3
C/C++ Documentation
utildev.h
Go to the documentation of this file.
1
14
/* include guard */
15
#ifndef CRYPTO_UTILS_H
16
#define CRYPTO_UTILS_H
17
18
19
#include <stddef.h>
/* for size_t */
20
#include <stdint.h>
/* for standard integer types */
21
22
/* check for CUDA compiler */
23
#if defined(__NVCC__)
24
/* ensure CUDA definition exists */
25
#undef CUDA
26
#define CUDA
27
/* dynamic library includes for MSVC */
28
#ifdef _WIN32
29
#pragma comment(lib, "cudart.lib"
)
30
#pragma comment(lib, "nvml.lib"
)
31
#endif
32
/* library header includes */
33
#include <cuda_runtime.h>
34
#include <nvml.h>
35
36
/* end CUDA compilation */
37
/* #elif defined(__OPENCL_CPP_VERSION__) */
38
/* currently NOT IMPLEMENTED */
39
/* #define OPENCL_ENABLED */
40
41
/* end OPENCL compilation */
42
#endif
43
50
#ifdef __CUDA_ARCH__
51
#define bswap32(x) __byte_perm(x, 0, 0x0123)
52
53
#else
54
#define bswap32(x) \
55
( (rol32(x, 24) & 0xFF00FF00) | (rol32(x, 8) & 0x00FF00FF) )
56
57
/* end #ifdef __CUDA_ARCH__... else... */
58
#endif
59
66
#define rol32(x, n) ( ((x) << (n)) | ((x) >> (32 - (n))) )
67
74
#define rol64(x, n) ( ((x) << (n)) | ((x) >> (64 - (n))) )
75
82
#define ror32(x, n) ( ((x) >> (n)) | ((x) << (32 - (n))) )
83
90
#define ror64(x, n) ( ((x) >> (n)) | ((x) << (64 - (n))) )
91
101
#define xandx(a, b, c) ( ((a) & ((b) ^ (c))) ^ (c) )
102
110
#define xor3(a, b, c) ( (a) ^ (b) ^ (c) )
111
120
#define xor4(a, b, c, d) ( (a) ^ (b) ^ (c) ^ (d) )
121
122
/* end include guard */
123
#endif
src
utildev.h
Generated by
1.9.3