CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
139 lines
3.1 KiB
C++
139 lines
3.1 KiB
C++
/*
|
|
* Copyright 2008-2013 NVIDIA Corporation
|
|
* Copyright 2013 Filipe RNC Maia
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/*
|
|
* ====================================================
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
*
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software is freely granted, provided that this notice
|
|
* is preserved.
|
|
* ====================================================
|
|
*/
|
|
|
|
/* adapted from FreeBSD:
|
|
* lib/msun/src/math_private.h
|
|
*/
|
|
#pragma once
|
|
|
|
#include <thrust/detail/config.h>
|
|
|
|
#include <thrust/complex.h>
|
|
|
|
#include <cstdint>
|
|
|
|
THRUST_NAMESPACE_BEGIN
|
|
namespace detail
|
|
{
|
|
namespace complex
|
|
{
|
|
|
|
using thrust::complex;
|
|
|
|
using ieee_float_shape_type = union
|
|
{
|
|
float value;
|
|
uint32_t word;
|
|
};
|
|
|
|
THRUST_HOST_DEVICE inline void get_float_word(uint32_t& i, float d)
|
|
{
|
|
ieee_float_shape_type gf_u;
|
|
gf_u.value = (d);
|
|
(i) = gf_u.word;
|
|
}
|
|
|
|
THRUST_HOST_DEVICE inline void get_float_word(int32_t& i, float d)
|
|
{
|
|
ieee_float_shape_type gf_u;
|
|
gf_u.value = (d);
|
|
(i) = gf_u.word;
|
|
}
|
|
|
|
THRUST_HOST_DEVICE inline void set_float_word(float& d, uint32_t i)
|
|
{
|
|
ieee_float_shape_type sf_u;
|
|
sf_u.word = (i);
|
|
(d) = sf_u.value;
|
|
}
|
|
|
|
// Assumes little endian ordering
|
|
using ieee_double_shape_type = union
|
|
{
|
|
double value;
|
|
struct
|
|
{
|
|
uint32_t lsw;
|
|
uint32_t msw;
|
|
} parts;
|
|
struct
|
|
{
|
|
uint64_t w;
|
|
} xparts;
|
|
};
|
|
|
|
THRUST_HOST_DEVICE inline void get_high_word(uint32_t& i, double d)
|
|
{
|
|
ieee_double_shape_type gh_u;
|
|
gh_u.value = (d);
|
|
(i) = gh_u.parts.msw;
|
|
}
|
|
|
|
/* Set the more significant 32 bits of a double from an int. */
|
|
THRUST_HOST_DEVICE inline void set_high_word(double& d, uint32_t v)
|
|
{
|
|
ieee_double_shape_type sh_u;
|
|
sh_u.value = (d);
|
|
sh_u.parts.msw = (v);
|
|
(d) = sh_u.value;
|
|
}
|
|
|
|
THRUST_HOST_DEVICE inline void insert_words(double& d, uint32_t ix0, uint32_t ix1)
|
|
{
|
|
ieee_double_shape_type iw_u;
|
|
iw_u.parts.msw = (ix0);
|
|
iw_u.parts.lsw = (ix1);
|
|
(d) = iw_u.value;
|
|
}
|
|
|
|
/* Get two 32 bit ints from a double. */
|
|
THRUST_HOST_DEVICE inline void extract_words(uint32_t& ix0, uint32_t& ix1, double d)
|
|
{
|
|
ieee_double_shape_type ew_u;
|
|
ew_u.value = (d);
|
|
(ix0) = ew_u.parts.msw;
|
|
(ix1) = ew_u.parts.lsw;
|
|
}
|
|
|
|
/* Get two 32 bit ints from a double. */
|
|
THRUST_HOST_DEVICE inline void extract_words(int32_t& ix0, int32_t& ix1, double d)
|
|
{
|
|
ieee_double_shape_type ew_u;
|
|
ew_u.value = (d);
|
|
(ix0) = ew_u.parts.msw;
|
|
(ix1) = ew_u.parts.lsw;
|
|
}
|
|
|
|
} // namespace complex
|
|
|
|
} // namespace detail
|
|
|
|
THRUST_NAMESPACE_END
|
|
|
|
#include <thrust/detail/complex/c99math.h>
|