Skip to content

Commit

Permalink
3.12.04 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Nov 3, 2018
1 parent 6f90e81 commit edb6b86
Show file tree
Hide file tree
Showing 72 changed files with 3,807 additions and 3,378 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tags
cscope.out
**/*.swp
**/*.swo
.swp
Expand Down
42 changes: 19 additions & 23 deletions benchmark/source/BenchmarkVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ namespace
return *this;
}

#if EASTL_MOVE_SEMANTICS_ENABLED
MovableType(MovableType&& x) EA_NOEXCEPT : mpData(x.mpData)
{ x.mpData = NULL; }
MovableType(MovableType&& x) EA_NOEXCEPT : mpData(x.mpData)
{ x.mpData = NULL; }

MovableType& operator=(MovableType&& x)
{
eastl::swap(mpData, x.mpData); // In practice it may not be right to do a swap, depending on the case.
return *this;
}
#endif
MovableType& operator=(MovableType&& x)
{
eastl::swap(mpData, x.mpData); // In practice it may not be right to do a swap, depending on the case.
return *this;
}

~MovableType()
{ delete[] mpData; }
Expand Down Expand Up @@ -123,21 +121,19 @@ namespace
return *this;
}

#if EASTL_MOVE_SEMANTICS_ENABLED
AutoRefCount(AutoRefCount&& x) EA_NOEXCEPT : mpObject(x.mpObject)
{
x.mpObject = NULL;
}
AutoRefCount(AutoRefCount&& x) EA_NOEXCEPT : mpObject(x.mpObject)
{
x.mpObject = NULL;
}

AutoRefCount& operator=(AutoRefCount&& x)
{
if(mpObject)
mpObject->Release();
mpObject = x.mpObject;
x.mpObject = NULL;
return *this;
}
#endif
AutoRefCount& operator=(AutoRefCount&& x)
{
if(mpObject)
mpObject->Release();
mpObject = x.mpObject;
x.mpObject = NULL;
return *this;
}

~AutoRefCount()
{
Expand Down
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
build_folder=build
mkdir $build_folder
pushd $build_folder
cmake .. -DEASTL_BUILD_TESTS:BOOL=ON -DEASTL_BUILD_BENCHMARK:BOOL=OFF
cmake --build . --config Release
# cmake --build . --config Debug
# cmake --build . --config RelWithDebInfo
# cmake --build . --config MinSizeRel
pushd test
ctest -C Release
# ctest -C Debug
# ctest -C RelWithDebInfo
# ctest -C MinSizeRel
popd
popd
8 changes: 8 additions & 0 deletions doc/EASTL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,13 @@
<DisplayString Condition="($T3) == 5" Optional="true">({mFirst}, {mSecond})</DisplayString>
</Type>

<Type Name="eastl::optional&lt;*&gt;">
<Intrinsic Name="value" Expression="*($T1*)&amp;val"/>
<DisplayString Condition="!engaged">nullopt</DisplayString>
<DisplayString Condition="engaged">{value()}</DisplayString>
<Expand>
<Item Condition="engaged" Name="value">value()</Item>
</Expand>
</Type>

</AutoVisualizer>
58 changes: 25 additions & 33 deletions include/EASTL/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1158,27 +1158,25 @@ namespace eastl
/// Rand randInstance;
/// shuffle(pArrayBegin, pArrayEnd, randInstance);
///
#if EASTL_MOVE_SEMANTICS_ENABLED
// See the C++11 Standard, 26.5.1.3, Uniform random number generator requirements.
// Also http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution
// See the C++11 Standard, 26.5.1.3, Uniform random number generator requirements.
// Also http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution

template <typename RandomAccessIterator, typename UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& urng)
template <typename RandomAccessIterator, typename UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& urng)
{
if(first != last)
{
if(first != last)
{
typedef typename eastl::iterator_traits<RandomAccessIterator>::difference_type difference_type;
typedef typename eastl::make_unsigned<difference_type>::type unsigned_difference_type;
typedef typename eastl::uniform_int_distribution<unsigned_difference_type> uniform_int_distribution;
typedef typename uniform_int_distribution::param_type uniform_int_distribution_param_type;
typedef typename eastl::iterator_traits<RandomAccessIterator>::difference_type difference_type;
typedef typename eastl::make_unsigned<difference_type>::type unsigned_difference_type;
typedef typename eastl::uniform_int_distribution<unsigned_difference_type> uniform_int_distribution;
typedef typename uniform_int_distribution::param_type uniform_int_distribution_param_type;

uniform_int_distribution uid;
uniform_int_distribution uid;

for(RandomAccessIterator i = first + 1; i != last; ++i)
iter_swap(i, first + uid(urng, uniform_int_distribution_param_type(0, i - first)));
}
for(RandomAccessIterator i = first + 1; i != last; ++i)
iter_swap(i, first + uid(urng, uniform_int_distribution_param_type(0, i - first)));
}
#endif
}


/// random_shuffle
Expand All @@ -1199,23 +1197,18 @@ namespace eastl
/// Rand randInstance;
/// random_shuffle(pArrayBegin, pArrayEnd, randInstance);
///
#if EASTL_MOVE_SEMANTICS_ENABLED
template <typename RandomAccessIterator, typename RandomNumberGenerator>
inline void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator&& rng)
#else
template <typename RandomAccessIterator, typename RandomNumberGenerator>
inline void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rng)
#endif
{
typedef typename eastl::iterator_traits<RandomAccessIterator>::difference_type difference_type;
template <typename RandomAccessIterator, typename RandomNumberGenerator>
inline void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator&& rng)
{
typedef typename eastl::iterator_traits<RandomAccessIterator>::difference_type difference_type;

// We must do 'rand((i - first) + 1)' here and cannot do 'rand(last - first)',
// as it turns out that the latter results in unequal distribution probabilities.
// http://www.cigital.com/papers/download/developer_gambling.php
// We must do 'rand((i - first) + 1)' here and cannot do 'rand(last - first)',
// as it turns out that the latter results in unequal distribution probabilities.
// http://www.cigital.com/papers/download/developer_gambling.php

for(RandomAccessIterator i = first + 1; i < last; ++i)
iter_swap(i, first + (difference_type)rng((eastl_size_t)((i - first) + 1)));
}
for(RandomAccessIterator i = first + 1; i < last; ++i)
iter_swap(i, first + (difference_type)rng((eastl_size_t)((i - first) + 1)));
}


/// random_shuffle
Expand Down Expand Up @@ -1997,8 +1990,7 @@ namespace eastl
/// We should verify that such a thing results in an improvement.
///
template <typename InputIterator1, typename InputIterator2>
inline bool
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
EA_CPP14_CONSTEXPR inline bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
{
for(; first1 != last1; ++first1, ++first2)
{
Expand Down
24 changes: 6 additions & 18 deletions include/EASTL/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
#include <stddef.h>


#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4189) // local variable is initialized but not referenced
#endif

#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
#endif
Expand Down Expand Up @@ -167,14 +162,9 @@ namespace eastl

#ifndef EASTL_USER_DEFINED_ALLOCATOR // If the user hasn't declared that he has defined a different allocator implementation elsewhere...

#ifdef _MSC_VER
#pragma warning(push, 0)
#pragma warning(disable: 4265 4365 4836 4548)
#include <new>
#pragma warning(pop)
#else
#include <new>
#endif
EA_DISABLE_ALL_VC_WARNINGS()
#include <new>
EA_RESTORE_ALL_VC_WARNINGS()

#if !EASTL_DLL // If building a regular library and not building EASTL as a DLL...
// It is expected that the application define the following
Expand Down Expand Up @@ -376,17 +366,15 @@ namespace eastl
{
result = EASTLAllocAligned(a, n, alignment, alignmentOffset);
// Ensure the result is correctly aligned. An assertion here may indicate a bug in the allocator.
EASTL_ASSERT((reinterpret_cast<size_t>(result)& ~(alignment - 1)) == reinterpret_cast<size_t>(result));
auto resultMinusOffset = (char*)result - alignmentOffset;
EA_UNUSED(resultMinusOffset);
EASTL_ASSERT((reinterpret_cast<size_t>(resultMinusOffset)& ~(alignment - 1)) == reinterpret_cast<size_t>(resultMinusOffset));
}
return result;
}

}

#ifdef _MSC_VER
#pragma warning(pop)
#endif


#endif // Header include guard

Expand Down
Loading

0 comments on commit edb6b86

Please sign in to comment.