Separate volatile for clarity. Handle assignment.

이 커밋은 다음에 포함됨:
Alex Voicu가 2019-11-02 22:02:08 +02:00를 커밋했습니다
1 부모 758ab23b8f
커밋 ed0d6ec51e
1 파일이 변경됨
+17
+17
파일 보기
@@ -53,11 +53,20 @@ THE SOFTWARE.
struct Address {
const Scalar_accessor* p;
__host__ __device__
operator const T*() const noexcept {
return &reinterpret_cast<const T*>(p)[idx];
}
__host__ __device__
operator const T*() const volatile noexcept {
return &reinterpret_cast<const T*>(p)[idx];
}
__host__ __device__
operator T*() noexcept {
return &reinterpret_cast<T*>(
const_cast<Scalar_accessor*>(p))[idx];
}
__host__ __device__
operator T*() volatile noexcept {
return &reinterpret_cast<T*>(
const_cast<Scalar_accessor*>(p))[idx];
@@ -67,6 +76,8 @@ THE SOFTWARE.
// Idea from https://t0rakka.silvrback.com/simd-scalar-accessor
Vector data;
__host__ __device__
operator T() const noexcept { return data[idx]; }
__host__ __device__
operator T() const volatile noexcept { return data[idx]; }
@@ -79,6 +90,12 @@ THE SOFTWARE.
return *this;
}
__host__ __device__
volatile Scalar_accessor& operator=(T x) volatile noexcept {
data[idx] = x;
return *this;
}
__host__ __device__
Scalar_accessor& operator++() noexcept {