Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions stl/inc/atomic
Comment thread
AlexGuteniev marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ struct _Atomic_storage_traits { // properties for how _Ty is stored in an atomic
: sizeof(_Ty) == 2 ? 2
: sizeof(_Ty) <= 4 ? 4
: sizeof(_Ty) <= 8 ? 8
#if defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM64EC)
#ifdef _WIN64
: sizeof(_Ty) <= 16 ? 16
#endif // 64 bits
#endif // ^^^ 64-bit ^^^
: sizeof(_Ty);

static constexpr size_t _Padding_size = _Storage_size - sizeof(_Ty);
Expand Down Expand Up @@ -515,7 +515,7 @@ inline bool __stdcall _Atomic_wait_compare_16_bytes(const void* _Storage, void*
return _InterlockedCompareExchange128_nf(_Dest, _Tmp[1], _Tmp[0], _Tmp) != 0;
#endif // ^^^ ARM64, _M_ARM64EC ^^^
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^
#endif // _HAS_CXX20
#endif // TRANSITION, ABI

Expand Down Expand Up @@ -1295,7 +1295,7 @@ struct _Atomic_storage<_Ty&, 16> { // lock-free using 16-byte intrinsics

typename _Atomic_storage_types<_Ty&>::_TStorage _Storage;
};
#endif // defined(_WIN64)
#endif // ^^^ 64-bit ^^^

template <class _Ty, size_t = sizeof(_Ty)>
struct _Atomic_integral; // not defined
Expand Down Expand Up @@ -1942,13 +1942,13 @@ struct _Atomic_pointer : _Atomic_storage<_Ty> {
const ptrdiff_t _Shift_bytes =
static_cast<ptrdiff_t>(static_cast<size_t>(_Diff) * sizeof(remove_pointer_t<_Ty>));
ptrdiff_t _Result;
#if defined(_M_IX86)
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd,
_STD _Atomic_address_as<long>(this->_Storage), _Shift_bytes);
#else // ^^^ 32 bits / 64 bits vvv
#ifdef _WIN64
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd64,
_STD _Atomic_address_as<long long>(this->_Storage), _Shift_bytes);
#endif // ^^^ 64 bits ^^^
#else // ^^^ 64-bit / 32-bit vvv
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd,
_STD _Atomic_address_as<long>(this->_Storage), _Shift_bytes);
#endif // ^^^ 32-bit ^^^
return reinterpret_cast<_Ty>(_Result);
}

Expand Down Expand Up @@ -2040,13 +2040,13 @@ struct _Atomic_pointer<_Ty&> : _Atomic_storage<_Ty&> {
const ptrdiff_t _Shift_bytes =
static_cast<ptrdiff_t>(static_cast<size_t>(_Diff) * sizeof(remove_pointer_t<_Ty>));
ptrdiff_t _Result;
#if defined(_M_IX86)
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd,
_STD _Atomic_address_as<long>(this->_Storage), _Shift_bytes);
#else // ^^^ 32 bits / 64 bits vvv
#ifdef _WIN64
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd64,
_STD _Atomic_address_as<long long>(this->_Storage), _Shift_bytes);
#endif // ^^^ 64 bits ^^^
#else // ^^^ 64-bit / 32-bit vvv
_ATOMIC_CHOOSE_INTRINSIC(static_cast<unsigned int>(_Order), _Result, _InterlockedExchangeAdd,
_STD _Atomic_address_as<long>(this->_Storage), _Shift_bytes);
#endif // ^^^ 32-bit ^^^
return reinterpret_cast<_TVal>(_Result);
}

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -2843,9 +2843,9 @@ inline size_t _Get_stable_sort_tree_height(const size_t _Count, const size_t _Hw
const size_t _Log_ideal_chunks = _Floor_of_log_2(_Ideal_chunks);
#ifdef _WIN64
constexpr size_t _Max_tree_height = 62; // to avoid ptrdiff_t overflow
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv
#else // ^^^ 64-bit / 32-bit vvv
constexpr size_t _Max_tree_height = 30;
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^
const size_t _Clamped_ideal_chunks = (_STD min) (_Max_tree_height, _Log_ideal_chunks);

// similarly, if _Clamped_ideal_chunks is odd, that would break our 2 to even power invariant,
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -2412,13 +2412,13 @@ _NODISCARD constexpr bool _Bitmask_includes_all(_Bitmask _Left, _Bitmask _Elemen

// These FNV-1a utility functions are extremely performance sensitive,
// check examples like that in VSO-653642 before making changes.
#if defined(_WIN64)
#ifdef _WIN64
_INLINE_VAR constexpr size_t _FNV_offset_basis = 14695981039346656037ULL;
_INLINE_VAR constexpr size_t _FNV_prime = 1099511628211ULL;
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv
#else // ^^^ 64-bit / 32-bit vvv
_INLINE_VAR constexpr size_t _FNV_offset_basis = 2166136261U;
_INLINE_VAR constexpr size_t _FNV_prime = 16777619U;
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^

_NODISCARD inline size_t _Fnv1a_append_bytes(size_t _Val, const unsigned char* const _First,
const size_t _Count) noexcept { // accumulate range [_First, _First + _Count) into partial FNV-1a hash _Val
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/xlocnum
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ protected:
char* _Ep;
#ifdef _WIN64
_Val = reinterpret_cast<void*>(_CSTD _Stoullx(_Ac, &_Ep, _Parse_result._Base, &_Errno));
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv
#else // ^^^ 64-bit / 32-bit vvv
_Val = reinterpret_cast<void*>(_CSTD _Stoulx(_Ac, &_Ep, _Parse_result._Base, &_Errno));
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^
if (_Ep == _Ac || _Errno != 0) { // N4950 [facet.num.get.virtuals]/3
_State = ios_base::failbit;
_Val = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/xmemory
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ _INLINE_VAR constexpr size_t _Non_user_size = sizeof(void*) + _Big_allocation_al

#ifdef _WIN64
_INLINE_VAR constexpr size_t _Big_allocation_sentinel = 0xFAFAFAFAFAFAFAFAULL;
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv
#else // ^^^ 64-bit / 32-bit vvv
_INLINE_VAR constexpr size_t _Big_allocation_sentinel = 0xFAFAFAFAUL;
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^

template <class _Traits>
__declspec(allocator) void* _Allocate_manually_vector_aligned(const size_t _Bytes) {
Expand Down Expand Up @@ -2782,7 +2782,7 @@ _NODISCARD _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { // used by bot

#ifdef _WIN64
auto _UVal_trunc = _UVal;
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv
#else // ^^^ 64-bit / 32-bit vvv

if constexpr (sizeof(_UTy) > 4) { // For 64-bit numbers, work in chunks to avoid 64-bit divisions.
while (_UVal > 0xFFFFFFFFU) {
Expand All @@ -2802,7 +2802,7 @@ _NODISCARD _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { // used by bot
}

auto _UVal_trunc = static_cast<unsigned long>(_UVal);
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^

// If we have a single digit, print [0, 9] and return. (This is necessary to correctly handle 0.)
if (_UVal_trunc < 10) {
Expand Down
12 changes: 6 additions & 6 deletions stl/src/vector_algorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9614,10 +9614,10 @@ __declspec(noalias) void __stdcall __std_replace_8(
#ifdef _WIN64
const __m256i _Comparand = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(_Old_val));
const __m256i _Replacement = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(_New_val));
#else // ^^^ defined(_WIN64) / !defined(_WIN64), workaround, _mm_cvtsi64_si128 does not compile vvv
#else // ^^^ 64-bit / 32-bit, workaround, _mm_cvtsi64_si128 does not compile vvv
const __m256i _Comparand = _mm256_set1_epi64x(_Old_val);
const __m256i _Replacement = _mm256_set1_epi64x(_New_val);
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^
const size_t _Full_length = _Byte_length(_First, _Last);

void* _Stop_at = _First;
Expand Down Expand Up @@ -10729,9 +10729,9 @@ namespace {
static __m256i _Broadcast(const uint64_t _Data) noexcept {
#ifdef _WIN64
return _mm256_broadcastq_epi64(_mm_cvtsi64_si128(_Data));
#else // ^^^ defined(_WIN64) / !defined(_WIN64), workaround, _mm_cvtsi64_si128 does not compile vvv
#else // ^^^ 64-bit / 32-bit, workaround, _mm_cvtsi64_si128 does not compile vvv
return _mm256_set1_epi64x(_Data);
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^
}

static __m256i _Cmp_gt(const __m256i _First, const __m256i _Second) noexcept {
Expand Down Expand Up @@ -10813,9 +10813,9 @@ namespace {
static __m128i _Broadcast(const uint64_t _Data) noexcept {
#ifdef _WIN64
return _mm_shuffle_epi32(_mm_cvtsi64_si128(_Data), _MM_SHUFFLE(1, 0, 1, 0));
#else // ^^^ defined(_WIN64) / !defined(_WIN64), workaround, _mm_cvtsi64_si128 does not compile vvv
#else // ^^^ 64-bit / 32-bit, workaround, _mm_cvtsi64_si128 does not compile vvv
return _mm_set1_epi64x(_Data);
#endif // ^^^ !defined(_WIN64) ^^^
#endif // ^^^ 32-bit ^^^
}

static __m128i _Cmp_gt(const __m128i _First, const __m128i _Second) noexcept {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ void test_LWG_2156() {

#ifndef _WIN64
// make it so rehash can't meet its postcondition, even when not asking for more buckets
// skip on 64 bit because creating reasonable container sizes to trigger this problem there
// skip on 64-bit because creating reasonable container sizes to trigger this problem there
// consumes too much RAM.
x.max_load_factor(FLT_EPSILON);
assert_throws<length_error>([&] { x.rehash(0); });
#endif // !_WIN64
#endif // ^^^ 32-bit ^^^
}

void test_bad_rehash_size() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ using cpv_const_difference_t = range_difference_t<const cartesian_product_view<R

#ifdef _WIN64
constexpr bool is_64_bit = true;
#else // ^^^ 64 bit / 32 bit vvv
#else // ^^^ 64-bit / 32-bit vvv
constexpr bool is_64_bit = false;
#endif // ^^^ 32 bit ^^^
#endif // ^^^ 32-bit ^^^

constexpr void check_array() {
// Check '_Compile_time_max_size' type trait
Expand Down Expand Up @@ -265,7 +265,7 @@ constexpr void check_join_view() {
static_assert(_Compile_time_max_size<const V3> == (numeric_limits<size_t>::max)());
static_assert(sizeof(cpv_const_difference_t<V3>) <= sizeof(ptrdiff_t));
static_assert(sizeof(cpv_const_difference_t<V3, V3, V3>) > sizeof(ptrdiff_t));
#endif // ^^^ 64 bit ^^^
#endif // ^^^ 64-bit ^^^
}

constexpr void check_join_with_view() {
Expand Down Expand Up @@ -297,7 +297,7 @@ constexpr void check_join_with_view() {
static_assert(_Compile_time_max_size<const V3> == (numeric_limits<size_t>::max)());
static_assert(sizeof(cpv_const_difference_t<V3>) <= sizeof(ptrdiff_t));
static_assert(sizeof(cpv_const_difference_t<V3, V3, V3>) > sizeof(ptrdiff_t));
#endif // ^^^ 64 bit ^^^
#endif // ^^^ 64-bit ^^^

// Check '_Compile_time_max_size' when size of joined range is 0
using V4 = ranges::join_with_view<span<span<int, 5>, 0>, span<int, 2>>;
Expand Down Expand Up @@ -425,7 +425,7 @@ constexpr void check_cartesian_product_view() {
static_assert(_Compile_time_max_size<const V3> == (numeric_limits<_Unsigned128>::max)());
static_assert(sizeof(cpv_const_difference_t<V3>) > sizeof(ptrdiff_t));
static_assert(sizeof(cpv_const_difference_t<V3, V3, V3>) > sizeof(ptrdiff_t));
#endif // ^^^ 64 bit ^^^
#endif // ^^^ 64-bit ^^^
}

struct Pred {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class fancy_pointer {
rep += rhs;
return *this;
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

fancy_pointer& operator+=(std::ptrdiff_t rhs) {
rep += rhs;
Expand All @@ -120,7 +120,7 @@ class fancy_pointer {
fancy_pointer operator+(int rhs) const {
return fancy_pointer{rep + rhs};
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

fancy_pointer operator+(std::ptrdiff_t rhs) const {
return fancy_pointer{rep + rhs};
Expand All @@ -135,7 +135,7 @@ class fancy_pointer {
rep -= rhs;
return *this;
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

fancy_pointer& operator-=(std::ptrdiff_t rhs) {
rep -= rhs;
Expand All @@ -151,7 +151,7 @@ class fancy_pointer {
fancy_pointer operator-(int rhs) const {
return fancy_pointer{rep - rhs};
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

fancy_pointer operator-(std::ptrdiff_t rhs) const {
return fancy_pointer{rep - rhs};
Expand All @@ -165,7 +165,7 @@ class fancy_pointer {
std::add_lvalue_reference_t<Val> operator[](int offset) const {
return rep[offset];
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

std::add_lvalue_reference_t<Val> operator[](std::ptrdiff_t offset) const {
return rep[offset];
Expand Down
4 changes: 2 additions & 2 deletions tests/std/tests/VSO_0000000_initialize_everything/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ using namespace std;

#ifdef _WIN64
const size_t bad_size = 0xCCCC'CCCC'CCCC'CCCCULL;
#else // ^^^ _WIN64 / !_WIN64 vvv
#else // ^^^ 64-bit / 32-bit vvv
const size_t bad_size = 0xCCCC'CCCCUL;
#endif // _WIN64
#endif // ^^^ 32-bit ^^^
const unsigned long long default_state = 0xB01DFACEDEBAC1EULL;

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/VSO_0234888_num_get_overflows/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void test_case_void_ptr() {
assert(reinterpret_cast<uintptr_t>(result) == 0xFFFFFFFFFFFFFFFF);
assert(src.rdstate() == ios_base::eofbit);
}
#endif // _WIN64
#endif // ^^^ 64-bit ^^^

{
istringstream src("0x10000000000000000"s);
Expand Down