Apply .clangformat to all repo source files
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
Этот коммит содержится в:
+214
-429
@@ -28,521 +28,306 @@ extern "C" float __ocml_rint_f32(float);
|
||||
extern "C" float __ocml_ceil_f32(float);
|
||||
extern "C" float __ocml_trunc_f32(float);
|
||||
|
||||
__device__ float __double2float_rd(double x)
|
||||
{
|
||||
return (double)x;
|
||||
__device__ float __double2float_rd(double x) { return (double)x; }
|
||||
__device__ float __double2float_rn(double x) { return (double)x; }
|
||||
__device__ float __double2float_ru(double x) { return (double)x; }
|
||||
__device__ float __double2float_rz(double x) { return (double)x; }
|
||||
|
||||
|
||||
__device__ int __double2hiint(double x) {
|
||||
static_assert(sizeof(double) == 2 * sizeof(int), "");
|
||||
|
||||
int tmp[2];
|
||||
__builtin_memcpy(tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp[1];
|
||||
}
|
||||
__device__ float __double2float_rn(double x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ float __double2float_ru(double x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ float __double2float_rz(double x)
|
||||
{
|
||||
return (double)x;
|
||||
__device__ int __double2loint(double x) {
|
||||
static_assert(sizeof(double) == 2 * sizeof(int), "");
|
||||
|
||||
int tmp[2];
|
||||
__builtin_memcpy(tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp[0];
|
||||
}
|
||||
|
||||
|
||||
__device__ int __double2hiint(double x)
|
||||
{
|
||||
static_assert(sizeof(double) == 2 * sizeof(int), "");
|
||||
__device__ int __double2int_rd(double x) { return (int)x; }
|
||||
__device__ int __double2int_rn(double x) { return (int)x; }
|
||||
__device__ int __double2int_ru(double x) { return (int)x; }
|
||||
__device__ int __double2int_rz(double x) { return (int)x; }
|
||||
|
||||
int tmp[2];
|
||||
__builtin_memcpy(tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp[1];
|
||||
}
|
||||
__device__ int __double2loint(double x)
|
||||
{
|
||||
static_assert(sizeof(double) == 2 * sizeof(int), "");
|
||||
|
||||
int tmp[2];
|
||||
__builtin_memcpy(tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp[0];
|
||||
}
|
||||
__device__ long long int __double2ll_rd(double x) { return (long long int)x; }
|
||||
__device__ long long int __double2ll_rn(double x) { return (long long int)x; }
|
||||
__device__ long long int __double2ll_ru(double x) { return (long long int)x; }
|
||||
__device__ long long int __double2ll_rz(double x) { return (long long int)x; }
|
||||
|
||||
|
||||
__device__ int __double2int_rd(double x)
|
||||
{
|
||||
return (int)x;
|
||||
}
|
||||
__device__ int __double2int_rn(double x)
|
||||
{
|
||||
return (int)x;
|
||||
}
|
||||
__device__ int __double2int_ru(double x)
|
||||
{
|
||||
return (int)x;
|
||||
}
|
||||
__device__ int __double2int_rz(double x)
|
||||
{
|
||||
return (int)x;
|
||||
__device__ unsigned int __double2uint_rd(double x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __double2uint_rn(double x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __double2uint_ru(double x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __double2uint_rz(double x) { return (unsigned int)x; }
|
||||
|
||||
__device__ unsigned long long int __double2ull_rd(double x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __double2ull_rn(double x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __double2ull_ru(double x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __double2ull_rz(double x) { return (unsigned long long int)x; }
|
||||
|
||||
__device__ long long int __double_as_longlong(double x) {
|
||||
static_assert(sizeof(long long) == sizeof(double), "");
|
||||
|
||||
long long tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ long long int __double2ll_rd(double x)
|
||||
{
|
||||
return (long long int)x;
|
||||
__device__ int __float2int_rd(float x) { return (int)__ocml_floor_f32(x); }
|
||||
__device__ int __float2int_rn(float x) { return (int)__ocml_rint_f32(x); }
|
||||
__device__ int __float2int_ru(float x) { return (int)__ocml_ceil_f32(x); }
|
||||
__device__ int __float2int_rz(float x) { return (int)__ocml_trunc_f32(x); }
|
||||
|
||||
__device__ long long int __float2ll_rd(float x) { return (long long int)x; }
|
||||
__device__ long long int __float2ll_rn(float x) { return (long long int)x; }
|
||||
__device__ long long int __float2ll_ru(float x) { return (long long int)x; }
|
||||
__device__ long long int __float2ll_rz(float x) { return (long long int)x; }
|
||||
|
||||
__device__ unsigned int __float2uint_rd(float x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __float2uint_rn(float x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __float2uint_ru(float x) { return (unsigned int)x; }
|
||||
__device__ unsigned int __float2uint_rz(float x) { return (unsigned int)x; }
|
||||
|
||||
__device__ unsigned long long int __float2ull_rd(float x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __float2ull_rn(float x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __float2ull_ru(float x) { return (unsigned long long int)x; }
|
||||
__device__ unsigned long long int __float2ull_rz(float x) { return (unsigned long long int)x; }
|
||||
|
||||
__device__ int __float_as_int(float x) {
|
||||
static_assert(sizeof(int) == sizeof(float), "");
|
||||
|
||||
int tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
__device__ long long int __double2ll_rn(double x)
|
||||
{
|
||||
return (long long int)x;
|
||||
__device__ unsigned int __float_as_uint(float x) {
|
||||
static_assert(sizeof(unsigned int) == sizeof(float), "");
|
||||
|
||||
unsigned int tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
__device__ long long int __double2ll_ru(double x)
|
||||
{
|
||||
return (long long int)x;
|
||||
__device__ double __hiloint2double(int32_t hi, int32_t lo) {
|
||||
static_assert(sizeof(double) == sizeof(uint64_t), "");
|
||||
|
||||
uint64_t tmp0 = (static_cast<uint64_t>(hi) << 32ull) | static_cast<uint32_t>(lo);
|
||||
double tmp1;
|
||||
__builtin_memcpy(&tmp1, &tmp0, sizeof(tmp0));
|
||||
|
||||
return tmp1;
|
||||
}
|
||||
__device__ long long int __double2ll_rz(double x)
|
||||
{
|
||||
return (long long int)x;
|
||||
__device__ double __int2double_rn(int x) { return (double)x; }
|
||||
|
||||
__device__ float __int2float_rd(int x) { return (float)x; }
|
||||
__device__ float __int2float_rn(int x) { return (float)x; }
|
||||
__device__ float __int2float_ru(int x) { return (float)x; }
|
||||
__device__ float __int2float_rz(int x) { return (float)x; }
|
||||
|
||||
__device__ float __int_as_float(int x) {
|
||||
static_assert(sizeof(float) == sizeof(int), "");
|
||||
|
||||
float tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ double __ll2double_rd(long long int x) { return (double)x; }
|
||||
__device__ double __ll2double_rn(long long int x) { return (double)x; }
|
||||
__device__ double __ll2double_ru(long long int x) { return (double)x; }
|
||||
__device__ double __ll2double_rz(long long int x) { return (double)x; }
|
||||
|
||||
__device__ unsigned int __double2uint_rd(double x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __double2uint_rn(double x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __double2uint_ru(double x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __double2uint_rz(double x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
__device__ float __ll2float_rd(long long int x) { return (float)x; }
|
||||
__device__ float __ll2float_rn(long long int x) { return (float)x; }
|
||||
__device__ float __ll2float_ru(long long int x) { return (float)x; }
|
||||
__device__ float __ll2float_rz(long long int x) { return (float)x; }
|
||||
|
||||
__device__ double __longlong_as_double(long long int x) {
|
||||
static_assert(sizeof(double) == sizeof(long long), "");
|
||||
|
||||
double tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
__device__ unsigned long long int __double2ull_rd(double x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __double2ull_rn(double x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __double2ull_ru(double x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __double2ull_rz(double x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
__device__ double __uint2double_rn(int x) { return (double)x; }
|
||||
|
||||
__device__ float __uint2float_rd(unsigned int x) { return (float)x; }
|
||||
__device__ float __uint2float_rn(unsigned int x) { return (float)x; }
|
||||
__device__ float __uint2float_ru(unsigned int x) { return (float)x; }
|
||||
__device__ float __uint2float_rz(unsigned int x) { return (float)x; }
|
||||
|
||||
__device__ float __uint_as_float(unsigned int x) {
|
||||
static_assert(sizeof(float) == sizeof(unsigned int), "");
|
||||
|
||||
float tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ long long int __double_as_longlong(double x)
|
||||
{
|
||||
static_assert(sizeof(long long) == sizeof(double), "");
|
||||
__device__ double __ull2double_rd(unsigned long long int x) { return (double)x; }
|
||||
__device__ double __ull2double_rn(unsigned long long int x) { return (double)x; }
|
||||
__device__ double __ull2double_ru(unsigned long long int x) { return (double)x; }
|
||||
__device__ double __ull2double_rz(unsigned long long int x) { return (double)x; }
|
||||
|
||||
long long tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ int __float2int_rd(float x)
|
||||
{
|
||||
return (int)__ocml_floor_f32(x);
|
||||
}
|
||||
__device__ int __float2int_rn(float x)
|
||||
{
|
||||
return (int)__ocml_rint_f32(x);
|
||||
}
|
||||
__device__ int __float2int_ru(float x)
|
||||
{
|
||||
return (int)__ocml_ceil_f32(x);
|
||||
}
|
||||
__device__ int __float2int_rz(float x)
|
||||
{
|
||||
return (int)__ocml_trunc_f32(x);
|
||||
}
|
||||
|
||||
__device__ long long int __float2ll_rd(float x)
|
||||
{
|
||||
return (long long int)x;
|
||||
}
|
||||
__device__ long long int __float2ll_rn(float x)
|
||||
{
|
||||
return (long long int)x;
|
||||
}
|
||||
__device__ long long int __float2ll_ru(float x)
|
||||
{
|
||||
return (long long int)x;
|
||||
}
|
||||
__device__ long long int __float2ll_rz(float x)
|
||||
{
|
||||
return (long long int)x;
|
||||
}
|
||||
|
||||
__device__ unsigned int __float2uint_rd(float x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __float2uint_rn(float x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __float2uint_ru(float x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
__device__ unsigned int __float2uint_rz(float x)
|
||||
{
|
||||
return (unsigned int)x;
|
||||
}
|
||||
|
||||
__device__ unsigned long long int __float2ull_rd(float x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __float2ull_rn(float x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __float2ull_ru(float x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
__device__ unsigned long long int __float2ull_rz(float x)
|
||||
{
|
||||
return (unsigned long long int)x;
|
||||
}
|
||||
|
||||
__device__ int __float_as_int(float x)
|
||||
{
|
||||
static_assert(sizeof(int) == sizeof(float), "");
|
||||
|
||||
int tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
__device__ unsigned int __float_as_uint(float x)
|
||||
{
|
||||
static_assert(sizeof(unsigned int) == sizeof(float), "");
|
||||
|
||||
unsigned int tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
__device__ double __hiloint2double(int32_t hi, int32_t lo)
|
||||
{
|
||||
static_assert(sizeof(double) == sizeof(uint64_t), "");
|
||||
|
||||
uint64_t tmp0 =
|
||||
(static_cast<uint64_t>(hi) << 32ull) | static_cast<uint32_t>(lo);
|
||||
double tmp1;
|
||||
__builtin_memcpy(&tmp1, &tmp0, sizeof(tmp0));
|
||||
|
||||
return tmp1;
|
||||
}
|
||||
__device__ double __int2double_rn(int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
__device__ float __int2float_rd(int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __int2float_rn(int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __int2float_ru(int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __int2float_rz(int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
|
||||
__device__ float __int_as_float(int x)
|
||||
{
|
||||
static_assert(sizeof(float) == sizeof(int), "");
|
||||
|
||||
float tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ double __ll2double_rd(long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ll2double_rn(long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ll2double_ru(long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ll2double_rz(long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
__device__ float __ll2float_rd(long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ll2float_rn(long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ll2float_ru(long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ll2float_rz(long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
|
||||
__device__ double __longlong_as_double(long long int x)
|
||||
{
|
||||
static_assert(sizeof(double) == sizeof(long long), "");
|
||||
|
||||
double tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
__device__ double __uint2double_rn(int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
__device__ float __uint2float_rd(unsigned int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __uint2float_rn(unsigned int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __uint2float_ru(unsigned int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __uint2float_rz(unsigned int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
|
||||
__device__ float __uint_as_float(unsigned int x)
|
||||
{
|
||||
static_assert(sizeof(float) == sizeof(unsigned int), "");
|
||||
|
||||
float tmp;
|
||||
__builtin_memcpy(&tmp, &x, sizeof(tmp));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__device__ double __ull2double_rd(unsigned long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ull2double_rn(unsigned long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ull2double_ru(unsigned long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
__device__ double __ull2double_rz(unsigned long long int x)
|
||||
{
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
__device__ float __ull2float_rd(unsigned long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ull2float_rn(unsigned long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ull2float_ru(unsigned long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ull2float_rz(unsigned long long int x)
|
||||
{
|
||||
return (float)x;
|
||||
}
|
||||
__device__ float __ull2float_rd(unsigned long long int x) { return (float)x; }
|
||||
__device__ float __ull2float_rn(unsigned long long int x) { return (float)x; }
|
||||
__device__ float __ull2float_ru(unsigned long long int x) { return (float)x; }
|
||||
__device__ float __ull2float_rz(unsigned long long int x) { return (float)x; }
|
||||
|
||||
/*
|
||||
Integer Intrinsics
|
||||
*/
|
||||
|
||||
// integer intrinsic function __poc __clz __ffs __brev
|
||||
__device__ unsigned int __popc( unsigned int input)
|
||||
{
|
||||
return hc::__popcount_u32_b32(input);
|
||||
}
|
||||
__device__ unsigned int __popc(unsigned int input) { return hc::__popcount_u32_b32(input); }
|
||||
|
||||
__device__ unsigned int __popcll( unsigned long long int input)
|
||||
{
|
||||
__device__ unsigned int __popcll(unsigned long long int input) {
|
||||
return hc::__popcount_u32_b64(input);
|
||||
}
|
||||
|
||||
__device__ unsigned int __clz(unsigned int input)
|
||||
{
|
||||
__device__ unsigned int __clz(unsigned int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return input == 0 ? 32 : hc::__firstbit_u32_u32( input);
|
||||
return input == 0 ? 32 : hc::__firstbit_u32_u32(input);
|
||||
#else
|
||||
return hc::__firstbit_u32_u32( input);
|
||||
return hc::__firstbit_u32_u32(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __clzll(unsigned long long int input)
|
||||
{
|
||||
__device__ unsigned int __clzll(unsigned long long int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return input == 0 ? 64 : hc::__firstbit_u32_u64( input);
|
||||
return input == 0 ? 64 : hc::__firstbit_u32_u64(input);
|
||||
#else
|
||||
return hc::__firstbit_u32_u64( input);
|
||||
return hc::__firstbit_u32_u64(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __clz( int input)
|
||||
{
|
||||
__device__ unsigned int __clz(int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return input == 0 ? 32 : hc::__firstbit_u32_s32( input);
|
||||
return input == 0 ? 32 : hc::__firstbit_u32_s32(input);
|
||||
#else
|
||||
return hc::__firstbit_u32_s32( input);
|
||||
return hc::__firstbit_u32_s32(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __clzll( long long int input)
|
||||
{
|
||||
__device__ unsigned int __clzll(long long int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return input == 0 ? 64 : hc::__firstbit_u32_s64( input);
|
||||
return input == 0 ? 64 : hc::__firstbit_u32_s64(input);
|
||||
#else
|
||||
return hc::__firstbit_u32_s64( input);
|
||||
return hc::__firstbit_u32_s64(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __ffs(unsigned int input)
|
||||
{
|
||||
__device__ unsigned int __ffs(unsigned int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return hc::__lastbit_u32_u32( input)+1;
|
||||
return hc::__lastbit_u32_u32(input) + 1;
|
||||
#else
|
||||
return hc::__lastbit_u32_u32( input);
|
||||
return hc::__lastbit_u32_u32(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __ffsll(unsigned long long int input)
|
||||
{
|
||||
__device__ unsigned int __ffsll(unsigned long long int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return hc::__lastbit_u32_u64( input)+1;
|
||||
return hc::__lastbit_u32_u64(input) + 1;
|
||||
#else
|
||||
return hc::__lastbit_u32_u64( input);
|
||||
return hc::__lastbit_u32_u64(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __ffs( int input)
|
||||
{
|
||||
__device__ unsigned int __ffs(int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return hc::__lastbit_u32_s32( input)+1;
|
||||
return hc::__lastbit_u32_s32(input) + 1;
|
||||
#else
|
||||
return hc::__lastbit_u32_s32( input);
|
||||
return hc::__lastbit_u32_s32(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __ffsll( long long int input)
|
||||
{
|
||||
__device__ unsigned int __ffsll(long long int input) {
|
||||
#ifdef NVCC_COMPAT
|
||||
return hc::__lastbit_u32_s64( input)+1;
|
||||
return hc::__lastbit_u32_s64(input) + 1;
|
||||
#else
|
||||
return hc::__lastbit_u32_s64( input);
|
||||
return hc::__lastbit_u32_s64(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
__device__ unsigned int __brev( unsigned int input)
|
||||
{
|
||||
return hc::__bitrev_b32( input);
|
||||
}
|
||||
__device__ unsigned int __brev(unsigned int input) { return hc::__bitrev_b32(input); }
|
||||
|
||||
__device__ unsigned long long int __brevll( unsigned long long int input)
|
||||
{
|
||||
return hc::__bitrev_b64( input);
|
||||
__device__ unsigned long long int __brevll(unsigned long long int input) {
|
||||
return hc::__bitrev_b64(input);
|
||||
}
|
||||
|
||||
struct ucharHolder {
|
||||
union {
|
||||
unsigned char c[4];
|
||||
unsigned int ui;
|
||||
};
|
||||
}__attribute__((aligned(4)));
|
||||
union {
|
||||
unsigned char c[4];
|
||||
unsigned int ui;
|
||||
};
|
||||
} __attribute__((aligned(4)));
|
||||
|
||||
struct uchar2Holder {
|
||||
union {
|
||||
unsigned int ui[2];
|
||||
unsigned char c[8];
|
||||
};
|
||||
}__attribute__((aligned(8)));
|
||||
union {
|
||||
unsigned int ui[2];
|
||||
unsigned char c[8];
|
||||
};
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
struct intHolder {
|
||||
union {
|
||||
signed int si[2];
|
||||
signed int long sl;
|
||||
};
|
||||
}__attribute__((aligned(8)));
|
||||
union {
|
||||
signed int si[2];
|
||||
signed int long sl;
|
||||
};
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
struct uintHolder {
|
||||
union {
|
||||
signed int ui[2];
|
||||
signed int long ul;
|
||||
};
|
||||
}__attribute__((aligned(8)));
|
||||
union {
|
||||
signed int ui[2];
|
||||
signed int long ul;
|
||||
};
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
|
||||
__device__ unsigned int __byte_perm(unsigned int x, unsigned int y, unsigned int s)
|
||||
{
|
||||
struct uchar2Holder cHoldVal;
|
||||
struct ucharHolder cHoldKey;
|
||||
struct ucharHolder cHoldOut;
|
||||
cHoldKey.ui = s;
|
||||
cHoldVal.ui[0] = x;
|
||||
cHoldVal.ui[1] = y;
|
||||
cHoldOut.c[0] = cHoldVal.c[cHoldKey.c[0]];
|
||||
cHoldOut.c[1] = cHoldVal.c[cHoldKey.c[1]];
|
||||
cHoldOut.c[2] = cHoldVal.c[cHoldKey.c[2]];
|
||||
cHoldOut.c[3] = cHoldVal.c[cHoldKey.c[3]];
|
||||
return cHoldOut.ui;
|
||||
__device__ unsigned int __byte_perm(unsigned int x, unsigned int y, unsigned int s) {
|
||||
struct uchar2Holder cHoldVal;
|
||||
struct ucharHolder cHoldKey;
|
||||
struct ucharHolder cHoldOut;
|
||||
cHoldKey.ui = s;
|
||||
cHoldVal.ui[0] = x;
|
||||
cHoldVal.ui[1] = y;
|
||||
cHoldOut.c[0] = cHoldVal.c[cHoldKey.c[0]];
|
||||
cHoldOut.c[1] = cHoldVal.c[cHoldKey.c[1]];
|
||||
cHoldOut.c[2] = cHoldVal.c[cHoldKey.c[2]];
|
||||
cHoldOut.c[3] = cHoldVal.c[cHoldKey.c[3]];
|
||||
return cHoldOut.ui;
|
||||
}
|
||||
|
||||
__device__ long long __mul64hi(long long int x, long long int y)
|
||||
{
|
||||
struct intHolder iHold1;
|
||||
struct intHolder iHold2;
|
||||
iHold1.sl = x;
|
||||
iHold2.sl = y;
|
||||
iHold1.sl = iHold1.si[1] * iHold2.si[1];
|
||||
return iHold1.sl;
|
||||
__device__ long long __mul64hi(long long int x, long long int y) {
|
||||
struct intHolder iHold1;
|
||||
struct intHolder iHold2;
|
||||
iHold1.sl = x;
|
||||
iHold2.sl = y;
|
||||
iHold1.sl = iHold1.si[1] * iHold2.si[1];
|
||||
return iHold1.sl;
|
||||
}
|
||||
|
||||
__device__ unsigned long long __umul64hi(unsigned long long int x, unsigned long long int y)
|
||||
{
|
||||
struct uintHolder uHold1;
|
||||
struct uintHolder uHold2;
|
||||
uHold1.ul = x;
|
||||
uHold2.ul = y;
|
||||
uHold1.ul = uHold1.ui[1] * uHold2.ui[1];
|
||||
return uHold1.ul;
|
||||
__device__ unsigned long long __umul64hi(unsigned long long int x, unsigned long long int y) {
|
||||
struct uintHolder uHold1;
|
||||
struct uintHolder uHold2;
|
||||
uHold1.ul = x;
|
||||
uHold2.ul = y;
|
||||
uHold1.ul = uHold1.ui[1] * uHold2.ui[1];
|
||||
return uHold1.ul;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Ссылка в новой задаче
Block a user