Skip to content
Snippets Groups Projects

WIP: Index vectorization

Closed Slattery, Stuart requested to merge (removed):index_opt into master
+ 20
5
@@ -648,7 +648,10 @@ class AoSoA<MemberDataTypes<Types...>,Properties...>
struct_member_reference_type<M> >::type
access( const int struct_index, const int array_index ) const
{
return accessStructMember<M>( _data[struct_index], array_index );
return
reinterpret_cast<struct_member_array_type<M> >(
static_cast<struct_member_pointer_type<M> >(_data[struct_index]) + struct_index * stride(M)
)[array_index];
}
// Rank 1
@@ -659,7 +662,10 @@ class AoSoA<MemberDataTypes<Types...>,Properties...>
access( const int struct_index, const int array_index,
const int d0 ) const
{
return accessStructMember<M>( _data[struct_index], array_index, d0 );
return
reinterpret_cast<struct_member_array_type<M> >(
static_cast<struct_member_pointer_type<M> >(_data[struct_index]) + struct_index * stride(M)
)[array_index][d0];
}
// Rank 2
@@ -671,7 +677,10 @@ class AoSoA<MemberDataTypes<Types...>,Properties...>
const int d0,
const int d1 ) const
{
return accessStructMember<M>( _data[struct_index], array_index, d0, d1 );
return
reinterpret_cast<struct_member_array_type<M> >(
static_cast<struct_member_pointer_type<M> >(_data[struct_index]) + struct_index * stride(M)
)[array_index][d0][d1];
}
// Rank 3
@@ -684,7 +693,10 @@ class AoSoA<MemberDataTypes<Types...>,Properties...>
const int d1,
const int d2 ) const
{
return accessStructMember<M>( _data[struct_index], array_index, d0, d1, d2 );
return
reinterpret_cast<struct_member_array_type<M> >(
static_cast<struct_member_pointer_type<M> >(_data[struct_index]) + struct_index * stride(M)
)[array_index][d0][d1][d2];
}
// Rank 4
@@ -698,7 +710,10 @@ class AoSoA<MemberDataTypes<Types...>,Properties...>
const int d2,
const int d3 ) const
{
return accessStructMember<M>( _data[struct_index], array_index, d0, d1, d2, d3 );
return
reinterpret_cast<struct_member_array_type<M> >(
static_cast<struct_member_pointer_type<M> >(_data[struct_index]) + struct_index * stride(M)
)[array_index][d0][d1][d2][d3];
}
// -------------------------------
Loading