Skip to content

Commit

Permalink
Merge branch '3.18.00'
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Mitchell committed Oct 20, 2021
2 parents b9ad2e0 + 7c29937 commit e8bdd55
Show file tree
Hide file tree
Showing 83 changed files with 2,982 additions and 821 deletions.
70 changes: 70 additions & 0 deletions doc/EASTL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,76 @@
<DisplayString>{mFlag.mAtomic}</DisplayString>
</Type>

<Type Name="eastl::variant&lt;*&gt;">
<Intrinsic Name="index" Expression="(int)mIndex"/>
<DisplayString Condition="index() == size_t(-1)">[valueless_by_exception]</DisplayString>
<DisplayString Condition="index() == 0" Optional="true">{{ index=0, value={($T1*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 1" Optional="true">{{ index=1, value={($T2*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 2" Optional="true">{{ index=2, value={($T3*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 3" Optional="true">{{ index=3, value={($T4*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 4" Optional="true">{{ index=4, value={($T5*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 5" Optional="true">{{ index=5, value={($T6*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 6" Optional="true">{{ index=6, value={($T7*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 7" Optional="true">{{ index=7, value={($T8*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 8" Optional="true">{{ index=8, value={($T9*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 9" Optional="true">{{ index=9, value={($T10*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 10" Optional="true">{{ index=10, value={($T11*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 11" Optional="true">{{ index=11, value={($T12*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 12" Optional="true">{{ index=12, value={($T13*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 13" Optional="true">{{ index=13, value={($T14*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 14" Optional="true">{{ index=14, value={($T15*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 15" Optional="true">{{ index=15, value={($T16*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 16" Optional="true">{{ index=16, value={($T17*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 17" Optional="true">{{ index=17, value={($T18*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 18" Optional="true">{{ index=18, value={($T19*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 19" Optional="true">{{ index=19, value={($T20*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 20" Optional="true">{{ index=20, value={($T21*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 21" Optional="true">{{ index=21, value={($T22*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 22" Optional="true">{{ index=22, value={($T23*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 23" Optional="true">{{ index=23, value={($T24*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 24" Optional="true">{{ index=24, value={($T25*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 25" Optional="true">{{ index=25, value={($T26*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 26" Optional="true">{{ index=26, value={($T27*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 27" Optional="true">{{ index=27, value={($T28*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 28" Optional="true">{{ index=28, value={($T29*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 29" Optional="true">{{ index=29, value={($T30*)mStorage.mBuffer.mCharData}}</DisplayString>
<DisplayString Condition="index() == 30" Optional="true">{{ index=30, value={($T31*)mStorage.mBuffer.mCharData}}</DisplayString>
<Expand>
<Item Name="index">index()</Item>
<Item Name="[value]" Condition="index() == 0" Optional="true">($T1*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 1" Optional="true">($T2*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 2" Optional="true">($T3*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 3" Optional="true">($T4*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 4" Optional="true">($T5*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 5" Optional="true">($T6*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 6" Optional="true">($T7*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 7" Optional="true">($T8*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 8" Optional="true">($T9*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 9" Optional="true">($T10*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 10" Optional="true">($T11*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 11" Optional="true">($T12*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 12" Optional="true">($T13*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 13" Optional="true">($T14*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 14" Optional="true">($T15*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 15" Optional="true">($T16*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 16" Optional="true">($T17*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 17" Optional="true">($T18*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 18" Optional="true">($T19*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 19" Optional="true">($T20*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 20" Optional="true">($T21*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 21" Optional="true">($T22*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 22" Optional="true">($T23*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 23" Optional="true">($T24*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 24" Optional="true">($T25*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 25" Optional="true">($T26*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 26" Optional="true">($T27*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 27" Optional="true">($T28*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 28" Optional="true">($T29*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 29" Optional="true">($T30*)mStorage.mBuffer.mCharData</Item>
<Item Name="[value]" Condition="index() == 30" Optional="true">($T31*)mStorage.mBuffer.mCharData</Item>
</Expand>
</Type>


<!-- TODO eastl::tuple -->

Expand Down
2 changes: 1 addition & 1 deletion include/EASTL/allocator_malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#endif
#elif defined(EA_PLATFORM_BSD)
#include <malloc/malloc.h>
#elif defined(EA_COMPILER_CLANG)
#elif defined(__clang__)
#if __has_include(<malloc/malloc.h>)
#include <malloc/malloc.h>
#elif __has_include(<malloc.h>)
Expand Down
35 changes: 0 additions & 35 deletions include/EASTL/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::reference
array<T, N>::operator[](size_type i)
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(i >= N))
EASTL_FAIL_MSG("array::operator[] -- out of range");
#endif

EA_ANALYSIS_ASSUME(i < N);
return mValue[i];
}

Expand All @@ -293,13 +287,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::const_reference
array<T, N>::operator[](size_type i) const
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(i >= N))
EASTL_FAIL_MSG("array::operator[] -- out of range");

#endif

EA_ANALYSIS_ASSUME(i < N);
return mValue[i];
}

Expand All @@ -308,11 +295,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::reference
array<T, N>::front()
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(empty())) // We don't allow the user to reference an empty container.
EASTL_FAIL_MSG("array::front -- empty array");
#endif

return mValue[0];
}

Expand All @@ -321,11 +303,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::const_reference
array<T, N>::front() const
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(empty())) // We don't allow the user to reference an empty container.
EASTL_FAIL_MSG("array::front -- empty array");
#endif

return mValue[0];
}

Expand All @@ -334,11 +311,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::reference
array<T, N>::back()
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(empty())) // We don't allow the user to reference an empty container.
EASTL_FAIL_MSG("array::back -- empty array");
#endif

return mValue[N - 1];
}

Expand All @@ -347,11 +319,6 @@ namespace eastl
EA_CPP14_CONSTEXPR inline typename array<T, N>::const_reference
array<T, N>::back() const
{
#if EASTL_ASSERT_ENABLED
if(EASTL_UNLIKELY(empty())) // We don't allow the user to reference an empty container.
EASTL_FAIL_MSG("array::back -- empty array");
#endif

return mValue[N - 1];
}

Expand Down Expand Up @@ -381,7 +348,6 @@ namespace eastl
EASTL_FAIL_MSG("array::at -- out of range");
#endif

EA_ANALYSIS_ASSUME(i < N);
return static_cast<const_reference>(mValue[i]);
}

Expand All @@ -397,7 +363,6 @@ namespace eastl
EASTL_FAIL_MSG("array::at -- out of range");
#endif

EA_ANALYSIS_ASSUME(i < N);
return static_cast<reference>(mValue[i]);
}

Expand Down
65 changes: 65 additions & 0 deletions include/EASTL/bit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////

#ifndef EASTL_BIT_H
#define EASTL_BIT_H

#include <EASTL/internal/config.h>

#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif

#include <EASTL/internal/memory_base.h>
#include <EASTL/type_traits.h>
#include <string.h> // memcpy

namespace eastl
{
// eastl::bit_cast
// Obtains a value of type To by reinterpreting the object representation of 'from'.
// Every bit in the value representation of the returned To object is equal to the
// corresponding bit in the object representation of 'from'.
//
// In order for bit_cast to be constexpr, the compiler needs to explicitly support
// it by providing the __builtin_bit_cast builtin. If that builtin is not available,
// then we memcpy into aligned storage at runtime and return that instead.
//
// Both types To and From must be equal in size, and must be trivially copyable.

#if defined(EASTL_CONSTEXPR_BIT_CAST_SUPPORTED) && EASTL_CONSTEXPR_BIT_CAST_SUPPORTED

template<typename To, typename From,
typename = eastl::enable_if_t<
sizeof(To) == sizeof(From)
&& eastl::is_trivially_copyable<To>::value
&& eastl::is_trivially_copyable<From>::value
>
>
EA_CONSTEXPR To bit_cast(const From& from) EA_NOEXCEPT
{
return __builtin_bit_cast(To, from);
}

#else

template<typename To, typename From,
typename = eastl::enable_if_t<
sizeof(To) == sizeof(From)
&& eastl::is_trivially_copyable<To>::value
&& eastl::is_trivially_copyable<From>::value
>
>
inline To bit_cast(const From& from) EA_NOEXCEPT
{
typename eastl::aligned_storage<sizeof(To), alignof(To)>::type to;
::memcpy(eastl::addressof(to), eastl::addressof(from), sizeof(To));
return reinterpret_cast<To&>(to);
}

#endif // EASTL_CONSTEXPR_BIT_CAST_SUPPORTED

} // namespace eastl

#endif // EASTL_BIT_H
2 changes: 1 addition & 1 deletion include/EASTL/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ EA_RESTORE_GCC_WARNING()
inline typename BitsetBase<2, WordType>::size_type
BitsetBase<2, WordType>::count() const
{
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 304) // GCC 3.4 or later
#if (defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 304)) || defined(__clang__) // GCC 3.4 or later
#if(EA_PLATFORM_WORD_SIZE == 4)
return (size_type)__builtin_popcountl(mWord[0]) + (size_type)__builtin_popcountl(mWord[1]);
#else
Expand Down
3 changes: 1 addition & 2 deletions include/EASTL/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,7 @@ namespace chrono
timespec ts;
int result = clock_gettime(CLOCK_MONOTONIC, &ts);

if(result == EINVAL
)
if (result == -1 && errno == EINVAL)
result = clock_gettime(CLOCK_REALTIME, &ts);

const uint64_t nNanoseconds = (uint64_t)ts.tv_nsec + ((uint64_t)ts.tv_sec * UINT64_C(1000000000));
Expand Down
36 changes: 21 additions & 15 deletions include/EASTL/fixed_hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -267,11 +267,13 @@ namespace eastl
{
EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));

if(!bEnableOverflow)
if (!bEnableOverflow)
{
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.
}

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -288,11 +290,13 @@ namespace eastl
{
EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));

if(!bEnableOverflow)
if (!bEnableOverflow)
{
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.
}

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -314,7 +318,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand Down Expand Up @@ -377,7 +381,7 @@ namespace eastl
mAllocator.copy_overflow_allocator(x.mAllocator);

#if EASTL_NAME_ENABLED
mAllocator.set_name(x.mAllocator.get_name());
mAllocator.set_name(x.mAllocator.get_name());
#endif

EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
Expand All @@ -402,7 +406,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand Down Expand Up @@ -532,8 +536,10 @@ namespace eastl
{
EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));

if(!bEnableOverflow)
if (!bEnableOverflow)
{
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.
}

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
Expand All @@ -556,7 +562,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -577,7 +583,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -599,7 +605,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand All @@ -616,7 +622,7 @@ namespace eastl
mAllocator.copy_overflow_allocator(x.mAllocator);

#if EASTL_NAME_ENABLED
mAllocator.set_name(x.mAllocator.get_name());
mAllocator.set_name(x.mAllocator.get_name());
#endif

EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
Expand Down Expand Up @@ -662,7 +668,7 @@ namespace eastl
mAllocator.copy_overflow_allocator(x.mAllocator);

#if EASTL_NAME_ENABLED
mAllocator.set_name(x.mAllocator.get_name());
mAllocator.set_name(x.mAllocator.get_name());
#endif

EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
Expand All @@ -687,7 +693,7 @@ namespace eastl
base_type::set_max_load_factor(10000.f); // Set it so that we will never resize.

#if EASTL_NAME_ENABLED
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
mAllocator.set_name(EASTL_FIXED_HASH_MULTIMAP_DEFAULT_NAME);
#endif

mAllocator.reset(mNodeBuffer);
Expand Down
Loading

0 comments on commit e8bdd55

Please sign in to comment.