Skip to content

Commit

Permalink
Merge branch 'v1.13' into merge-v1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
nievesj committed Apr 25, 2024
2 parents 5816122 + 178c751 commit 8f6d5f6
Show file tree
Hide file tree
Showing 369 changed files with 12,363 additions and 2,418 deletions.
4 changes: 2 additions & 2 deletions .github/actions/DownloadFBuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
version:
description: Version to download
required: false
default: 1.09
default: "1.11"

runs:
using: composite
Expand All @@ -15,7 +15,7 @@ runs:
run: |
case "${{ runner.os }}" in
Linux) FN="FASTBuild-Linux-x64-v${{ inputs.version }}.zip" FBUILD=fbuild ;;
macOS) FN="FASTBuild-OSX-x64-v${{ inputs.version }}.zip" FBUILD=FBuild ;;
macOS) FN="FASTBuild-OSX-x64+ARM-v${{ inputs.version }}.zip" FBUILD=FBuild ;;
Windows) FN="FASTBuild-Windows-x64-v${{ inputs.version }}.zip" FBUILD=FBuild.exe ;;
esac
curl -fL "https://fastbuild.org/downloads/v${{ inputs.version }}/${FN}" -o "${FN}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
continue-on-error: ${{ matrix.can-fail || false }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/actions/DownloadFBuild

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/OSX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/actions/DownloadFBuild

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/actions/DownloadFBuild

Expand Down
39 changes: 4 additions & 35 deletions Code/Core/Containers/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Array
explicit Array( const Array< T > & other );
explicit Array( Array< T > && other );
explicit Array( const T * otherBegin, const T * otherEnd );
explicit Array( size_t initialCapacity, bool resizeable = false );
explicit Array( size_t initialCapacity );
~Array();

void Destruct();
Expand Down Expand Up @@ -109,9 +109,6 @@ class Array
T * m_Begin;
uint32_t m_Size;
uint32_t m_CapacityAndFlags;
#if defined( ASSERTS_ENABLED )
bool m_Resizeable;
#endif
};

// CONSTRUCTOR
Expand All @@ -121,9 +118,6 @@ Array< T >::Array()
: m_Begin( nullptr )
, m_Size( 0 )
, m_CapacityAndFlags( 0 )
#if defined( ASSERTS_ENABLED )
, m_Resizeable( true )
#endif
{
}

Expand All @@ -134,9 +128,6 @@ Array< T >::Array( const Array< T > & other )
: m_Begin( nullptr )
, m_Size( 0 )
, m_CapacityAndFlags( 0 )
#if defined( ASSERTS_ENABLED )
, m_Resizeable( true )
#endif
{
*this = other;
}
Expand All @@ -146,10 +137,6 @@ Array< T >::Array( const Array< T > & other )
template < class T >
Array< T >::Array( Array< T > && other )
{
#if defined( ASSERTS_ENABLED )
m_Resizeable = true;
#endif

// If memory cannot be freed it cannot be moved
if ( other.m_CapacityAndFlags & DO_NOT_FREE_MEMORY_FLAG )
{
Expand Down Expand Up @@ -185,13 +172,10 @@ Array< T >::Array( const T * otherBegin, const T * otherEnd )
// CONSTRUCTOR
//------------------------------------------------------------------------------
template < class T >
Array< T >::Array( size_t initialCapacity, bool resizeable )
Array< T >::Array( size_t initialCapacity )
{
if ( initialCapacity )
{
#if defined( ASSERTS_ENABLED )
m_Resizeable = true; // allow initial allocation
#endif
m_Begin = Allocate( initialCapacity );
m_Size = 0;
m_CapacityAndFlags = (uint32_t)initialCapacity;
Expand All @@ -202,11 +186,6 @@ Array< T >::Array( size_t initialCapacity, bool resizeable )
m_Size = 0;
m_CapacityAndFlags = 0;
}
#if defined( ASSERTS_ENABLED )
m_Resizeable = resizeable;
#else
(void)resizeable;
#endif
}

// DESTRUCTOR
Expand Down Expand Up @@ -363,21 +342,12 @@ void Array< T >::Swap( Array< T > & other )
T * tmpBegin = m_Begin;
const uint32_t tmpSize = m_Size;
const uint32_t tmpCapacityAndFlags = m_CapacityAndFlags;
#if defined( ASSERTS_ENABLED )
const bool tmpResizeable = m_Resizeable;
#endif
m_Begin = other.m_Begin;
m_Size = other.m_Size;
m_CapacityAndFlags = other.m_CapacityAndFlags;
#if defined( ASSERTS_ENABLED )
m_Resizeable = other.m_Resizeable;
#endif
other.m_Begin = tmpBegin;
other.m_Size = tmpSize;
other.m_CapacityAndFlags = tmpCapacityAndFlags;
#if defined( ASSERTS_ENABLED )
other.m_Resizeable = tmpResizeable;
#endif
}

// Find
Expand Down Expand Up @@ -670,12 +640,11 @@ Array< T > & Array< T >::operator = ( Array< T > && other )
template < class T >
void Array< T >::Grow()
{
ASSERT( m_Resizeable );

// grow by 1.5 times (but at least by one)
const size_t currentCapacity = GetCapacity();
const size_t size = GetSize();
const size_t newCapacity = ( currentCapacity + ( currentCapacity >> 1 ) + 1 );
ASSERT( newCapacity <= CAPACITY_MASK );
T * newMem = Allocate( newCapacity );

T * src = m_Begin;
Expand All @@ -699,7 +668,7 @@ void Array< T >::Grow()
template < class T >
T * Array< T >::Allocate( size_t numElements ) const
{
ASSERT( m_Resizeable );
ASSERT( numElements <= CAPACITY_MASK );
constexpr size_t align = __alignof( T ) > sizeof( void * ) ? __alignof( T ) : sizeof( void * );
return static_cast< T * >( ALLOC( sizeof( T ) * numElements, align ) );
}
Expand Down
29 changes: 12 additions & 17 deletions Code/Core/Containers/Sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,27 @@ class AscendingCompareDeref
template < class T, class COMPARE >
void ShellSort( T * begin, T * end, const COMPARE & compare )
{
// Ciura, Marcin (2001). "Best Increments for the Average Case of Shellsort".
static const size_t gaps[] = { 510774, 227011, 100894, 44842, 19930, 8858, 3937, 1750, 701, 301, 132, 57, 23, 10, 4, 1 };

const size_t numItems = (size_t)( end - begin );
size_t increment = 3;
while ( increment > 0 )
for ( const size_t increment : gaps )
{
if ( increment > numItems )
{
continue;
}

for ( size_t i = 0; i < numItems; i++ )
{
size_t j = i;
T temp( begin[ i ] );
T temp( Move( begin[ i ] ) );
while ( ( j >= increment ) && ( compare( temp, begin[ j - increment ] ) ) )
{
begin[ j ] = begin[ j - increment ];
begin[ j ] = Move( begin[ j - increment ] );
j = j - increment;
}
begin[ j ] = temp;
}
if ( increment / 2 != 0 )
{
increment = increment / 2;
}
else if ( increment == 1 )
{
increment = 0;
}
else
{
increment = 1;
begin[ j ] = Move( temp );
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Code/Core/Containers/UniquePtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DeleteDeletor

// UniquePtr
//------------------------------------------------------------------------------
template < class T, class DELETOR = FreeDeletor >
template <class T, class DELETOR = DeleteDeletor>
class UniquePtr
{
public:
Expand All @@ -43,11 +43,11 @@ class UniquePtr
// acquire a new pointer
void operator = ( T * newPtr ) { DELETOR::Delete( m_Pointer ); m_Pointer = newPtr; }

// manually intiate deletion
// manually initiate deletion
void Destroy() { DELETOR::Delete( m_Pointer ); m_Pointer = nullptr; }

// free the pointer without deleting it
[[nodiscard]] T * Release() { T * ptr = m_Pointer; m_Pointer = nullptr; return ptr; }
// release ownership of pointer without deleting it
[[nodiscard]] T * ReleaseOwnership() { T * ptr = m_Pointer; m_Pointer = nullptr; return ptr; }
private:
T * m_Pointer;
};
Expand Down
2 changes: 1 addition & 1 deletion Code/Core/Core.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Item Name="[m_Size]" ExcludeView="simple">m_Size</Item>
<Item Name="[m_Capacity]" ExcludeView="simple">(m_CapacityAndFlags % 0x80000000)</Item>
<Item Name="[DoNotFreeMemory]" ExcludeView="simple">(bool)(m_CapacityAndFlags > 0x7FFFFFFF)</Item>
<Item Name="[Resizeable]" ExcludeView="simple">m_Resizeable</Item>
<Item Name="[Resizable]" ExcludeView="simple">m_Resizable</Item>
<ArrayItems>
<Size>m_Size</Size>
<ValuePointer>m_Begin</ValuePointer>
Expand Down
Loading

0 comments on commit 8f6d5f6

Please sign in to comment.