Skip to content

Commit

Permalink
Add byteswap for unsigned int vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jafet Villafranca committed Jun 25, 2015
1 parent fce6992 commit ae3e470
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions eq/fabric/vmmlib.h
Expand Up @@ -39,8 +39,11 @@ using vmml::Matrix3d; //!< A 3x3 double matrix
using vmml::Matrix4d; //!< A 4x4 double matrix
using vmml::Matrix3f; //!< A 3x3 float matrix
using vmml::Matrix4f; //!< A 4x4 float matrix
using vmml::Vector2ui; //!< A two-component unsigned integer vector
using vmml::Vector2i; //!< A two-component integer vector
using vmml::Vector3ui; //!< A three-component unsigned integer vector
using vmml::Vector3i; //!< A three-component integer vector
using vmml::Vector4ui; //!< A four-component unsigned integer vector
using vmml::Vector4i; //!< A four-component integer vector
using vmml::Vector3d; //!< A three-component double vector
using vmml::Vector4d; //!< A four-component double vector
Expand All @@ -56,12 +59,15 @@ using vmml::AABBf; //!< axis-aligned bounding box

namespace lunchbox
{
template<> inline void byteswap( eq::fabric::Vector2i& value )
template<> inline void byteswap( eq::fabric::Vector2ui& value )
{
byteswap( value.x( ));
byteswap( value.y( ));
}

template<> inline void byteswap( eq::fabric::Vector2i& value )
{ byteswap( reinterpret_cast< eq::fabric::Vector2ui& >( value )); }

template<> inline void byteswap( eq::fabric::Vector2f& value )
{
byteswap( value.x( ));
Expand All @@ -83,14 +89,17 @@ template<> inline void byteswap( eq::fabric::Vector4f& value )
byteswap( value.w( ));
}

template<> inline void byteswap( eq::fabric::Vector4i& value )
template<> inline void byteswap( eq::fabric::Vector4ui& value )
{
byteswap( value.x( ));
byteswap( value.y( ));
byteswap( value.z( ));
byteswap( value.w( ));
}

template<> inline void byteswap( eq::fabric::Vector4i& value )
{ byteswap( reinterpret_cast< eq::fabric::Vector4ui& >( value )); }

template<> inline void byteswap( eq::fabric::Vector4ub& ) { /*NOP*/ }
template<> inline void byteswap( eq::fabric::Vector3ub& ) { /*NOP*/ }

Expand Down

0 comments on commit ae3e470

Please sign in to comment.