8000 Remove unused big-endian/byteswap support by tribal-tec · Pull Request #206 · Eyescale/Collage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove unused big-endian/byteswap support #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# Copyright (c) 2010-2016 Daniel Pfeifer <daniel@pfeifer-mail.de>
# Copyright (c) 2010-2017 Daniel Pfeifer <daniel@pfeifer-mail.de>
# Stefan Eilemann <eile@eyescale.ch>

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(Collage VERSION 1.6.0)
set(Collage_VERSION_ABI 6)
project(Collage VERSION 1.7.0)
set(Collage_VERSION_ABI 7)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
${CMAKE_SOURCE_DIR}/CMake/common)
Expand Down
6 changes: 3 additions & 3 deletions co/bufferCache.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Copyright (c) 2006-2014, Stefan Eilemann <eile@equalizergraphics.com>
* 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
*
Expand Down Expand Up @@ -257,7 +257,7 @@ std::ostream& operator << ( std::ostream& os, const BufferCache& cache )
{
Buffer* buffer = *i;
if( !buffer->isFree( ))
os << ICommand( 0, 0, buffer, false /*swap*/ ) << std::endl;
os << ICommand( 0, 0, buffer ) << std::endl;
}
return os << lunchbox::enableHeader << lunchbox::exdent
<< lunchbox::enableFlush;
Expand Down
12 changes: 3 additions & 9 deletions co/commands.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Copyright (c) 2005-2013, Stefan Eilemann <eile@equalizergraphics.com>
* 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
*
Expand All @@ -21,7 +21,7 @@
#ifndef CO_COMMANDS_H
#define CO_COMMANDS_H

#include <lunchbox/bitOperation.h> // byteswap inline impl
#include <lunchbox/types.h>

namespace co
{
Expand Down Expand Up @@ -53,10 +53,4 @@ static const size_t COMMAND_MINSIZE = 256;
static const size_t COMMAND_ALLOCSIZE = 4096; // Bigger than minSize!
}

namespace lunchbox
{
template<> inline void byteswap( co::CommandType& value )
{ byteswap( reinterpret_cast< uint32_t& >( value )); }
}

#endif // CO_COMMANDS_H
10 changes: 2 additions & 8 deletions co/connection.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
* 2012-2014, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
*
Expand Down Expand Up @@ -325,10 +325,4 @@ class Connection : public lunchbox::Referenced, public boost::noncopyable
CO_API std::ostream& operator << ( std::ostream&, const Connection& );
}

namespace lunchbox
{
template<> inline void byteswap( co::Connection*& ) { /*NOP*/ }
template<> inline void byteswap( co::ConnectionPtr& ) { /*NOP*/ }
}

#endif //CO_CONNECTION_H
32 changes: 4 additions & 28 deletions co/dataIStream.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
Expand Down Expand Up @@ -38,11 +38,10 @@ namespace detail
class DataIStream
{
public:
explicit DataIStream( const bool swap_ )
DataIStream()
: input( 0 )
, inputSize( 0 )
, position( 0 )
, swap( swap_ )
{}

void initCompressor( const CompressorInfo& info )
Expand All @@ -66,16 +65,11 @@ class DataIStream
CompressorPtr compressor; //!< current decompressor
CompressorInfo compressorInfo; //!< current decompressor data
lunchbox::Bufferb data; //!< decompressed buffer
bool swap; //!< Invoke endian conversion
};
}

DataIStream::DataIStream( const bool swap_ )
: _impl( new detail::DataIStream( swap_ ))
{}

DataIStream::DataIStream( const DataIStream& rhs )
: _impl( new detail::DataIStream( rhs._impl->swap ))
DataIStream::DataIStream()
: _impl( new detail::DataIStream( ))
{}

DataIStream::~DataIStream()
Expand All @@ -84,29 +78,11 @@ DataIStream::~DataIStream()
delete _impl;
}

DataIStream& DataIStream::operator = ( const DataIStream& rhs )
{
_reset();
setSwapping( rhs.isSwapping( ));
return *this;
}

void DataIStream::setSwapping( const bool onOff )
{
_impl->swap = onOff;
}

bool DataIStream::isSwapping() const
{
return _impl->swap;
}

void DataIStream::_reset()
{
_impl->input = 0;
_impl->inputSize = 0;
_impl->position = 0;
_impl->swap = false;
}

void DataIStream::_read( void* data, uint64_t size )
Expand Down
37 changes: 3 additions & 34 deletions co/dataIStream.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
Expand Down

Expand Up

@@ -48,9 +48,6 @@ class DataIStream

virtual uint128_t getVersion() const = 0; //!< @internal
virtual void reset() { _reset(); } //!< @internal
void setSwapping( const bool onOff ); //!< @internal enable endian swap
CO_API bool isSwapping() const; //!< @internal
DataIStream& operator = ( const DataIStream& rhs ); //!< @internal
//@}

/** @name Data input */
Expand Down Expand Up @@ -93,19 +90,6 @@ class DataIStream
/** Read a stde::hash_set of serializable items. @version 1.0 */
template< class T > DataIStream& operator >> ( stde::hash_set< T >& );

/**
* @define CO_IGNORE_BYTESWAP: If set, no byteswapping of transmitted data
* is performed. Enable when you get unresolved symbols for
* lunchbox::byteswap and you don't care about mixed-endian environments.
*/
# ifdef CO_IGNORE_BYTESWAP
/** Byte-swap a plain data item. @version 1.0 */
template< class T > static void swap( T& ) { /* nop */ }
# else
/** Byte-swap a plain data item. @version 1.0 */
template< class T > static void swap( T& v ) { lunchbox::byteswap(v); }
# endif

/** @internal
* Deserialize child objects.
*
Expand Down Expand Up @@ -164,8 +148,7 @@ class DataIStream
protected:
/** @name Internal */
//@{
CO_API explicit DataIStream( const bool swap );
explicit DataIStream( const DataIStream& );
CO_API DataIStream();
CO_API virtual ~DataIStream();

virtual bool getNextBuffer( CompressorInfo& info, uint32_t& nChunks,
Expand Down Expand Up @@ -202,13 +185,9 @@ class DataIStream
return *this;
}

/** Byte-swap a plain data item. */
template< class T > void _swap( T& value ) const
{ if( isSwapping( )) swap( value ); }

/** Read a plain data item. */
template< class T > void _read( T& value, const boost::true_type& )
{ _read( &value, sizeof( value )); _swap( value ); }
{ _read( &value, sizeof( value )); }

/** Read a non-plain data item. */
template< class T > void _read( T& value, const boost::false_type& )
Expand All @@ -222,16 +201,6 @@ class DataIStream

/** Read an Array of non-POD data */
template< class T > void _readArray( Array< T >, const boost::false_type& );

/** Byte-swap a C array. @version 1.0 */
template< class T > void _swap( Array< T > array ) const
{
if( !isSwapping( ))
return;
#pragma omp parallel for
for( ssize_t i = 0; i < ssize_t( array.num ); ++i )
swap( array.data[i] );
}
};
}

Expand Down
3 changes: 1 addition & 2 deletions co/dataIStream.ipp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* Copyright (c) 2012-2016, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2012-2017, Daniel Nachbaur <danielnachbaur@gmail.com>
* Stefan.Eilemann@epfl.ch
*
* This library is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -67,7 +67,6 @@ template< class T >
void DataIStream::_readArray( Array< T > array, const boost::true_type& )
{
_read( array.data, array.getNumBytes( ));
_swap( array );
}

/** Read an Array of non-POD data */
Expand Down
8 changes: 2 additions & 6 deletions co/features.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2006-2014, Stefan Eilemann <eile@equalizergraphics.com>
* 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
*
Expand Down Expand Up @@ -62,9 +62,5 @@
* <img src="http://www.equalizergraphics.com/documents/design/images/collage.png">

*/
#ifdef CO_IGNORE_ENDIANNESS
namespace lunchbox
{ template< class T > inline void byteswap( T& value ) { /*NOP*/ }}
#endif

#endif // CO_FEATURES_H
12 changes: 5 additions & 7 deletions co/iCommand.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
Expand Down Expand Up @@ -69,14 +69,13 @@ class ICommand
} // detail namespace

ICommand::ICommand()
: DataIStream( false )
: DataIStream()
, _impl( new detail::ICommand )
{
}

ICommand::ICommand( LocalNodePtr local, NodePtr remote, ConstBufferPtr buffer,
const bool swap_ )
: DataIStream( swap_ )
ICommand::ICommand( LocalNodePtr local, NodePtr remote, ConstBufferPtr buffer )
: DataIStream()
, _impl( new detail::ICommand( local, remote, buffer ))
{
if( _impl->buffer )
Expand All @@ -89,7 +88,7 @@ ICommand::ICommand( LocalNodePtr local, NodePtr remote, ConstBufferPtr buffer,
}

ICommand::ICommand( const ICommand& rhs )
: DataIStream( rhs )
: DataIStream()
, _impl( new detail::ICommand( *rhs._impl ))
{
_impl->consumed = false;
Expand All @@ -100,7 +99,6 @@ ICommand& ICommand::operator = ( const ICommand& rhs )
{
if( this != &rhs )
{
DataIStream::operator = ( rhs );
*_impl = *rhs._impl;
_impl->consumed = false;
_skipHeader();
Expand Down
4 changes: 2 additions & 2 deletions co/iCommand.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This file is part of Collage <https://github.com/Eyescale/Collage>
Expand Down Expand Up @@ -45,7 +45,7 @@ class ICommand : public DataIStream
public:
CO_API ICommand(); //!< @internal
CO_API ICommand( LocalNodePtr local, NodePtr remote,
ConstBufferPtr buffer, const bool swap ); //!<@internal
ConstBufferPtr buffer ); //!<@internal
CO_API ICommand( const ICommand& rhs ); //!< @internal

CO_API virtual ~ICommand(); //!< @internal
Expand Down
Loading
0