{
return &( m_buffer[0].v );
}
+
+ /// Returns <tt> idx % capacity() </tt>
+ /**
+ If the buffer size is a power of two, binary arithmethics is used
+ instead of modulo arithmetics
+ */
+ size_t mod( size_t idx )
+ {
+ static_if( c_bExp2 )
+ return idx & ( capacity() - 1 );
+ else
+ return idx % capacity();
+ }
+
+ //@cond
+ template <typename I>
+ typename std::enable_if< sizeof(I) != sizeof(size_t), size_t >::type mod( I idx )
+ {
+ static_if( c_bExp2 )
+ return static_cast<size_t>( idx & static_cast<I>( capacity() - 1 ));
+ else
+ return static_cast<size_t>( idx % capacity());
+ }
+ //@endcond
};
/// Static initialized buffer
{
return m_buffer;
}
+
+ /// Returns <tt> idx % capacity() </tt>
+ /**
+ If the buffer size is a power of two, binary arithmethics is used
+ instead of modulo arithmetics
+ */
+ size_t mod( size_t idx )
+ {
+ static_if( c_bExp2 )
+ return idx & ( capacity() - 1 );
+ else
+ return idx % capacity();
+ }
+
+ //@cond
+ template <typename I>
+ typename std::enable_if< sizeof( I ) != sizeof( size_t ), size_t >::type mod( I idx )
+ {
+ static_if( c_bExp2 )
+ return static_cast<size_t>( idx & static_cast<I>( capacity() - 1 ));
+ else
+ return static_cast<size_t>( idx % capacity());
+ }
+ //@endcond
};
/// Dynamically allocated uninitialized buffer
{
return m_buffer;
}
+
+ /// Returns <tt> idx % capacity() </tt>
+ /**
+ If the buffer size is a power of two, binary arithmethics is used
+ instead of modulo arithmetics
+ */
+ size_t mod( size_t idx )
+ {
+ static_if ( c_bExp2 )
+ return idx & ( capacity() - 1 );
+ else
+ return idx % capacity();
+ }
+
+ //@cond
+ template <typename I>
+ typename std::enable_if< sizeof( I ) != sizeof( size_t ), size_t >::type mod( I idx )
+ {
+ static_if ( c_bExp2 )
+ return static_cast<size_t>( idx & static_cast<I>( capacity() - 1 ));
+ else
+ return static_cast<size_t>( idx % capacity());
+ }
+ //@endcond
};
{
return m_buffer;
}
+
+ /// Returns <tt> idx % capacity() </tt>
+ /**
+ If the buffer size is a power of two, binary arithmethics is used
+ instead of modulo arithmetics
+ */
+ size_t mod( size_t idx )
+ {
+ static_if( c_bExp2 )
+ return idx & ( capacity() - 1 );
+ else
+ return idx % capacity();
+ }
+
+ //@cond
+ template <typename I>
+ typename std::enable_if< sizeof( I ) != sizeof( size_t ), size_t >::type mod( I idx )
+ {
+ static_if( c_bExp2 )
+ return static_cast<size_t>( idx & static_cast<I>( capacity() - 1 ));
+ else
+ return static_cast<size_t>( idx % capacity());
+ }
+ //@endcond
};
} // namespace v