Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/dyninst/dataflowAPI/rose/rangemap.C
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

167 lines
3.5 KiB
C++

#include "rangemap.h"
#include <cmath>
#ifdef _MSC_VER
#include <float.h>
#define isnan(x) _isnan(x)
#define INFINITY (DBL_MAX+DBL_MAX)
#define NAN (INFINITY-INFINITY)
#else
#define isnan(x) std::isnan(x)
#endif
/******************************************************************************************************************************
* Specializations for Range<double>
******************************************************************************************************************************/
template<>
Range<double>::Range(): r_first(0), r_last(NAN) {}
template<>
bool
Range<double>::empty() const {
return isnan(r_last);
}
template<>
void
Range<double>::clear() {
r_last = NAN;
}
template<>
// DQ (9/3/2015): Intel v14 compiler warns that use of "const" is meaningless.
// I think this is correct since this is being returned by value.
// const double
double
Range<double>::relaxed_first() const {
return r_first;
}
template<>
double
Range<double>::size() const {
return empty() ? 0 : r_last-r_first;
}
template<>
void
Range<double>::resize(const double &new_size) {
assert(!empty());
if (new_size<0) {
clear();
} else {
r_last = r_first + new_size;
}
}
template<>
void
Range<double>::relaxed_resize(const double &new_size) {
if (new_size<0) {
clear();
} else {
r_last = r_first + new_size;
}
}
template<>
Range<double>::Pair
Range<double>::split_range_at(const double &at) const {
assert(!empty());
assert(at>=first() && at<=last());
Range<double> left = Range<double>::inin(first(), at);
Range<double> right = Range<double>::inin(at, last());
return std::make_pair(left, right);
}
template<>
double
Range<double>::minimum() {
return -INFINITY;
}
template<>
double
Range<double>::maximum() {
return INFINITY;
}
/******************************************************************************************************************************
* Specializations for Range<float>
******************************************************************************************************************************/
template<>
Range<float>::Range(): r_first(0), r_last(NAN) {}
template<>
bool
Range<float>::empty() const {
return isnan(r_last);
}
template<>
void
Range<float>::clear() {
r_last = NAN;
}
template<>
// DQ (9/3/2015): Intel v14 compiler warns that use of "const" is meaningless.
// I think this is correct since this is being returned by value.
// const float
float
Range<float>::relaxed_first() const {
return r_first;
}
template<>
float
Range<float>::size() const {
return empty() ? 0 : r_last-r_first;
}
template<>
void
Range<float>::resize(const float &new_size) {
assert(!empty());
if (new_size<0) {
clear();
} else {
r_last = r_first + new_size;
}
}
template<>
void
Range<float>::relaxed_resize(const float &new_size) {
if (new_size<0) {
clear();
} else {
r_last = r_first + new_size;
}
}
template<>
Range<float>::Pair
Range<float>::split_range_at(const float &at) const {
assert(!empty());
assert(at>=first() && at<=last());
Range<float> left = Range<float>::inin(first(), at);
Range<float> right = Range<float>::inin(at, last());
return std::make_pair(left, right);
}
template<>
float
Range<float>::minimum() {
return -INFINITY;
}
template<>
float
Range<float>::maximum() {
return INFINITY;
}