Commit a9e194f7 authored by Etienne Renault's avatar Etienne Renault
Browse files

bricks: add support for gcc prior to 4.9

* bricks/brick-bitlevel, bricks/brick-hashset,
bricks/brick-shmem, bricks/brick-types: here.
parent e4de35fc
......@@ -88,7 +88,10 @@ struct bvpair
constexpr bvpair( L l, H h = 0 ) : low( l ), high( h ) {}
constexpr bvpair() = default;
explicit constexpr operator bool() const { return low || high; }
constexpr bvpair operator<<( int s ) const
#if ((__GNUC__ >= 4 && __GNUC_MINOR__ > 9) || (__clang_major__ == 3 && __clang_minor__ >= 6))
constexpr
#endif
bvpair operator<<( int s ) const
{
int rem = 8 * sizeof( low ) - s;
int unshift = std::max( rem, 0 );
......@@ -96,7 +99,10 @@ struct bvpair
H carry = ( low & ~ones< L >( unshift ) ) >> unshift;
return bvpair( low << s, ( high << s ) | ( carry << shift ) );
}
constexpr bvpair operator>>( int s ) const
#if ((__GNUC__ >= 4 && __GNUC_MINOR__ > 9) || (__clang_major__ == 3 && __clang_minor__ >= 6))
constexpr
#endif
bvpair operator>>( int s ) const
{
int rem = 8 * sizeof( low ) - s;
int unshift = std::max( rem, 0 );
......
......@@ -43,7 +43,7 @@ using hash::hash128_t;
struct DefaultHasher
{
auto hash( int64_t v ) const
auto hash( int64_t v ) const -> std::pair<int64_t, int64_t>
{
return std::make_pair( v, ~v );
}
......
......@@ -188,7 +188,7 @@ struct AsyncLoop : Thread< LoopWrapper< T > >
};
template< typename L >
auto async_loop( L &&l )
auto async_loop( L &&l ) -> AsyncLoop< LambdaWrapper< L > >&&
{
AsyncLoop< LambdaWrapper< L > > al( std::forward< L >( l ) );
al._start_on_move = true;
......@@ -196,7 +196,7 @@ auto async_loop( L &&l )
}
template< typename L >
auto thread( L &&l )
auto thread( L &&l ) -> Thread< LambdaWrapper< L > >
{
Thread< LambdaWrapper< L > > thr( std::forward< L >( l ) );
thr._start_on_move = true;
......
......@@ -533,9 +533,10 @@ struct Union : Comparable {
return _discriminator == 0;
}
template< typename T >
explicit operator bool() const
{
auto rv = const_cast< Union* >( this )->apply( []( const auto & x ) -> bool { return !!x; } );
auto rv = const_cast< Union* >( this )->apply( []( const T & x ) -> bool { return !!x; } );
if ( rv.isNothing() )
return false;
return true;
......@@ -1385,6 +1386,7 @@ struct StrongEnumFlagsTest {
ASSERT( !e1 );
ASSERT( e2 );
#if ((__GNUC__ >= 4 && __GNUC_MINOR__ > 9) || (__clang_major__ == 3 && __clang_minor__ >= 6))
ASSERT( e1 | e2 );
ASSERT( Enum::X | Enum::Y );
ASSERT( e2 | Enum::Z );
......@@ -1396,6 +1398,7 @@ struct StrongEnumFlagsTest {
ASSERT( Enum::X | Enum::Y | Enum::Z );
ASSERT( !( Enum::X & Enum::Y & Enum::Z ) );
ASSERT( ( Enum::X | Enum::Y | Enum::Z ) & Enum::X );
#endif
}
// we don't want to break classical enums and ints by out operators
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment