X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Fqvm%2Ftest%2Finterop_test.cpp;h=b08716ef08911a369c9339077c22180773285a00;hb=3a9019d971a194e002b14eebff7e21327a178f29;hp=37d67fc5acc73ebde381831a39c17ef6ba69a6e4;hpb=5291e62e2c8c6a6d67a76e452142e9f71427378e;p=ceph.git diff --git a/ceph/src/boost/libs/qvm/test/interop_test.cpp b/ceph/src/boost/libs/qvm/test/interop_test.cpp index 37d67fc5a..b08716ef0 100644 --- a/ceph/src/boost/libs/qvm/test/interop_test.cpp +++ b/ceph/src/boost/libs/qvm/test/interop_test.cpp @@ -1,435 +1,435 @@ -//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include - -namespace -my_stuff - { - struct - mat - { - float a[3][3]; - }; - - struct - vec - { - float a[3]; - }; - - struct - quat - { - float a[4]; - }; - } - -namespace -boost - { - namespace - qvm - { - template <> - struct - mat_traits - { - typedef float scalar_type; - static int const rows=3; - static int const cols=3; - - template - static - scalar_type & - write_element( my_stuff::mat & m ) - { - BOOST_QVM_STATIC_ASSERT(R>=0); - BOOST_QVM_STATIC_ASSERT(R=0); - BOOST_QVM_STATIC_ASSERT(C - static - scalar_type - read_element( my_stuff::mat const & m ) - { - BOOST_QVM_STATIC_ASSERT(R>=0); - BOOST_QVM_STATIC_ASSERT(R=0); - BOOST_QVM_STATIC_ASSERT(C=0); - BOOST_QVM_ASSERT(r=0); - BOOST_QVM_ASSERT(c=0); - BOOST_QVM_ASSERT(r=0); - BOOST_QVM_ASSERT(c - struct - vec_traits - { - static int const dim=3; - typedef float scalar_type; - - template - static - scalar_type & - write_element( my_stuff::vec & m ) - { - BOOST_QVM_STATIC_ASSERT(I>=0); - BOOST_QVM_STATIC_ASSERT(I - static - scalar_type - read_element( my_stuff::vec const & m ) - { - BOOST_QVM_STATIC_ASSERT(I>=0); - BOOST_QVM_STATIC_ASSERT(I=0); - BOOST_QVM_ASSERT(i=0); - BOOST_QVM_ASSERT(i - struct - quat_traits - { - typedef float scalar_type; - - template - static - scalar_type & - write_element( my_stuff::quat & m ) - { - BOOST_QVM_STATIC_ASSERT(I>=0); - BOOST_QVM_STATIC_ASSERT(I<4); - return m.a[I]; - } - - template - static - scalar_type - read_element( my_stuff::quat const & m ) - { - BOOST_QVM_STATIC_ASSERT(I>=0); - BOOST_QVM_STATIC_ASSERT(I<4); - return m.a[I]; - } - }; - } - } - -namespace -my_stuff - { - mat & - operator/=( mat & x, float y ) - { - return boost::qvm::operator/=(x,y); - } - - vec & - operator/=( vec & x, float y ) - { - return boost::qvm::operator/=(x,y); - } - - quat & - operator/=( quat & x, float y ) - { - return boost::qvm::operator/=(x,y); - } - - mat & - operator*=( mat & x, float y ) - { - return boost::qvm::operator*=(x,y); - } - - vec & - operator*=( vec & x, float y ) - { - return boost::qvm::operator*=(x,y); - } - - quat & - operator*=( quat & x, float y ) - { - return boost::qvm::operator*=(x,y); - } - - mat - operator/( mat const & x, float y ) - { - return boost::qvm::operator/(x,y); - } - - vec - operator/( vec const & x, float y ) - { - return boost::qvm::operator/(x,y); - } - - quat - operator/( quat const & x, float y ) - { - return boost::qvm::operator/(x,y); - } - - mat - operator*( mat const & x, float y ) - { - return boost::qvm::operator*(x,y); - } - - vec - operator*( vec const & x, float y ) - { - return boost::qvm::operator*(x,y); - } - - quat - operator*( quat const & x, float y ) - { - return boost::qvm::operator*(x,y); - } - - mat & - operator*=( mat & x, mat const & y ) - { - return boost::qvm::operator*=(x,y); - } - - mat - operator*=( mat const & x, mat const & y ) - { - return boost::qvm::operator*(x,y); - } - - vec - operator*( mat const & x, vec const & y ) - { - return boost::qvm::operator*(x,y); - } - - vec - operator*( quat const & x, vec const & y ) - { - return boost::qvm::operator*(x,y); - } - - vec - operator*( vec const & x, mat const & y ) - { - return boost::qvm::operator*(x,y); - } - - bool - operator==( mat const & x, mat const & y ) - { - return boost::qvm::operator==(x,y); - } - - bool - operator!=( mat const & x, mat const & y ) - { - return boost::qvm::operator!=(x,y); - } - - bool - operator==( vec const & x, vec const & y ) - { - return boost::qvm::operator==(x,y); - } - - bool - operator!=( vec const & x, vec const & y ) - { - return boost::qvm::operator!=(x,y); - } - - bool - operator==( quat const & x, quat const & y ) - { - return boost::qvm::operator==(x,y); - } - - bool - operator!=( quat const & x, quat const & y ) - { - return boost::qvm::operator!=(x,y); - } - } - -int -main() - { - using namespace boost::qvm::sfinae; - using namespace my_stuff; - typedef boost::qvm::mat mat2; - typedef boost::qvm::vec vec2; - typedef boost::qvm::quat quat2; - - mat ma1, mb1; set_zero(ma1); set_zero(mb1); - vec va1, vb1; set_zero(va1); set_zero(vb1); - quat qa1, qb1; set_zero(qa1); set_zero(qb1); - mat2 ma2, mb2; set_zero(ma2); set_zero(mb2); - vec2 va2, vb2; set_zero(va2); set_zero(vb2); - quat2 qa2, qb2; set_zero(qa2); set_zero(qb2); - - set_zero(ma1); - set_zero(mb1); - set_zero(va1); - set_zero(vb1); - set_zero(qa1); - set_zero(qb1); - set_zero(ma2); - set_zero(mb2); - set_zero(va2); - set_zero(vb2); - set_zero(qa2); - set_zero(qb2); - - ma1/=2; - va1/=2; - qa1/=2; - ma2/=2; - va2/=2; - qa2/=2; - - ma1*=2; - va1*=2; - qa1*=2; - ma2*=2; - va2*=2; - qa2*=2; - - mb1=ma1/2; - vb1=va1/2; - qb1=qb1/2; - mb2=convert_to(ma1/2); - vb2=convert_to(va1/2); - qb2=convert_to(qa1/2); - mb1=scalar_cast(ma2/2); - vb1=scalar_cast(va2/2); - qb1=scalar_cast(qa2/2); - - mb1=ma1*2; - vb1=va1*2; - qb1=qa1*2; - mb2=convert_to(ma1*2); - vb2=convert_to(va1*2); - qb2=convert_to(qa1*2); - mb1=scalar_cast(ma2*2); - vb1=scalar_cast(va2*2); - qb1=scalar_cast(qa2*2); - - ma1*=mb1; - ma1*=scalar_cast(ma2); - ma2*=ma1; - - va1=ma1*va1; - va1=qa1*va1; - va1=scalar_cast(ma2*va1); - va1=scalar_cast(ma1*va2); - va1=scalar_cast(ma2*va2); - va1=scalar_cast(qa2*va1); - va1=scalar_cast(qa1*va2); - va1=scalar_cast(qa2*va2); - - va2=convert_to(ma1*va1); - va2=convert_to(qa1*va1); - va2=ma2*va1; - va2=ma1*va2; - va2=ma2*va2; - va2=qa2*va1; - va2=qa1*va2; - va2=qa2*va2; - - va1=va1*ma1; - va1=scalar_cast(va1*ma2); - va1=scalar_cast(va2*ma1); - va1=scalar_cast(va2*ma2); - - va2=convert_to(va1*ma1); - va2=va1*ma2; - va2=va2*ma1; - va2=va2*ma2; - - (void) (ma1==mb1); - (void) (ma1==ma2); - (void) (ma2==ma1); - - (void) (ma1!=mb1); - (void) (ma1!=ma2); - (void) (ma2!=ma1); - - (void) (va1==vb1); - (void) (va1==va2); - (void) (va2==va1); - - (void) (va1!=vb1); - (void) (va1!=va2); - (void) (va2!=va1); - - (void) (qa1==qb1); - (void) (qa1==qa2); - (void) (qa2==qa1); - - (void) (qa1!=qb1); - (void) (qa1!=qa2); - (void) (qa2!=qa1); - - return 0; - } +//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include + +namespace +my_stuff + { + struct + mat + { + float a[3][3]; + }; + + struct + vec + { + float a[3]; + }; + + struct + quat + { + float a[4]; + }; + } + +namespace +boost + { + namespace + qvm + { + template <> + struct + mat_traits + { + typedef float scalar_type; + static int const rows=3; + static int const cols=3; + + template + static + scalar_type & + write_element( my_stuff::mat & m ) + { + BOOST_QVM_STATIC_ASSERT(R>=0); + BOOST_QVM_STATIC_ASSERT(R=0); + BOOST_QVM_STATIC_ASSERT(C + static + scalar_type + read_element( my_stuff::mat const & m ) + { + BOOST_QVM_STATIC_ASSERT(R>=0); + BOOST_QVM_STATIC_ASSERT(R=0); + BOOST_QVM_STATIC_ASSERT(C=0); + BOOST_QVM_ASSERT(r=0); + BOOST_QVM_ASSERT(c=0); + BOOST_QVM_ASSERT(r=0); + BOOST_QVM_ASSERT(c + struct + vec_traits + { + static int const dim=3; + typedef float scalar_type; + + template + static + scalar_type & + write_element( my_stuff::vec & m ) + { + BOOST_QVM_STATIC_ASSERT(I>=0); + BOOST_QVM_STATIC_ASSERT(I + static + scalar_type + read_element( my_stuff::vec const & m ) + { + BOOST_QVM_STATIC_ASSERT(I>=0); + BOOST_QVM_STATIC_ASSERT(I=0); + BOOST_QVM_ASSERT(i=0); + BOOST_QVM_ASSERT(i + struct + quat_traits + { + typedef float scalar_type; + + template + static + scalar_type & + write_element( my_stuff::quat & m ) + { + BOOST_QVM_STATIC_ASSERT(I>=0); + BOOST_QVM_STATIC_ASSERT(I<4); + return m.a[I]; + } + + template + static + scalar_type + read_element( my_stuff::quat const & m ) + { + BOOST_QVM_STATIC_ASSERT(I>=0); + BOOST_QVM_STATIC_ASSERT(I<4); + return m.a[I]; + } + }; + } + } + +namespace +my_stuff + { + mat & + operator/=( mat & x, float y ) + { + return boost::qvm::operator/=(x,y); + } + + vec & + operator/=( vec & x, float y ) + { + return boost::qvm::operator/=(x,y); + } + + quat & + operator/=( quat & x, float y ) + { + return boost::qvm::operator/=(x,y); + } + + mat & + operator*=( mat & x, float y ) + { + return boost::qvm::operator*=(x,y); + } + + vec & + operator*=( vec & x, float y ) + { + return boost::qvm::operator*=(x,y); + } + + quat & + operator*=( quat & x, float y ) + { + return boost::qvm::operator*=(x,y); + } + + mat + operator/( mat const & x, float y ) + { + return boost::qvm::operator/(x,y); + } + + vec + operator/( vec const & x, float y ) + { + return boost::qvm::operator/(x,y); + } + + quat + operator/( quat const & x, float y ) + { + return boost::qvm::operator/(x,y); + } + + mat + operator*( mat const & x, float y ) + { + return boost::qvm::operator*(x,y); + } + + vec + operator*( vec const & x, float y ) + { + return boost::qvm::operator*(x,y); + } + + quat + operator*( quat const & x, float y ) + { + return boost::qvm::operator*(x,y); + } + + mat & + operator*=( mat & x, mat const & y ) + { + return boost::qvm::operator*=(x,y); + } + + mat + operator*=( mat const & x, mat const & y ) + { + return boost::qvm::operator*(x,y); + } + + vec + operator*( mat const & x, vec const & y ) + { + return boost::qvm::operator*(x,y); + } + + vec + operator*( quat const & x, vec const & y ) + { + return boost::qvm::operator*(x,y); + } + + vec + operator*( vec const & x, mat const & y ) + { + return boost::qvm::operator*(x,y); + } + + bool + operator==( mat const & x, mat const & y ) + { + return boost::qvm::operator==(x,y); + } + + bool + operator!=( mat const & x, mat const & y ) + { + return boost::qvm::operator!=(x,y); + } + + bool + operator==( vec const & x, vec const & y ) + { + return boost::qvm::operator==(x,y); + } + + bool + operator!=( vec const & x, vec const & y ) + { + return boost::qvm::operator!=(x,y); + } + + bool + operator==( quat const & x, quat const & y ) + { + return boost::qvm::operator==(x,y); + } + + bool + operator!=( quat const & x, quat const & y ) + { + return boost::qvm::operator!=(x,y); + } + } + +int +main() + { + using namespace boost::qvm::sfinae; + using namespace my_stuff; + typedef boost::qvm::mat mat2; + typedef boost::qvm::vec vec2; + typedef boost::qvm::quat quat2; + + mat ma1, mb1; set_zero(ma1); set_zero(mb1); + vec va1, vb1; set_zero(va1); set_zero(vb1); + quat qa1, qb1; set_zero(qa1); set_zero(qb1); + mat2 ma2, mb2; set_zero(ma2); set_zero(mb2); + vec2 va2, vb2; set_zero(va2); set_zero(vb2); + quat2 qa2, qb2; set_zero(qa2); set_zero(qb2); + + set_zero(ma1); + set_zero(mb1); + set_zero(va1); + set_zero(vb1); + set_zero(qa1); + set_zero(qb1); + set_zero(ma2); + set_zero(mb2); + set_zero(va2); + set_zero(vb2); + set_zero(qa2); + set_zero(qb2); + + ma1/=2; + va1/=2; + qa1/=2; + ma2/=2; + va2/=2; + qa2/=2; + + ma1*=2; + va1*=2; + qa1*=2; + ma2*=2; + va2*=2; + qa2*=2; + + mb1=ma1/2; + vb1=va1/2; + qb1=qb1/2; + mb2=convert_to(ma1/2); + vb2=convert_to(va1/2); + qb2=convert_to(qa1/2); + mb1=scalar_cast(ma2/2); + vb1=scalar_cast(va2/2); + qb1=scalar_cast(qa2/2); + + mb1=ma1*2; + vb1=va1*2; + qb1=qa1*2; + mb2=convert_to(ma1*2); + vb2=convert_to(va1*2); + qb2=convert_to(qa1*2); + mb1=scalar_cast(ma2*2); + vb1=scalar_cast(va2*2); + qb1=scalar_cast(qa2*2); + + ma1*=mb1; + ma1*=scalar_cast(ma2); + ma2*=ma1; + + va1=ma1*va1; + va1=qa1*va1; + va1=scalar_cast(ma2*va1); + va1=scalar_cast(ma1*va2); + va1=scalar_cast(ma2*va2); + va1=scalar_cast(qa2*va1); + va1=scalar_cast(qa1*va2); + va1=scalar_cast(qa2*va2); + + va2=convert_to(ma1*va1); + va2=convert_to(qa1*va1); + va2=ma2*va1; + va2=ma1*va2; + va2=ma2*va2; + va2=qa2*va1; + va2=qa1*va2; + va2=qa2*va2; + + va1=va1*ma1; + va1=scalar_cast(va1*ma2); + va1=scalar_cast(va2*ma1); + va1=scalar_cast(va2*ma2); + + va2=convert_to(va1*ma1); + va2=va1*ma2; + va2=va2*ma1; + va2=va2*ma2; + + (void) (ma1==mb1); + (void) (ma1==ma2); + (void) (ma2==ma1); + + (void) (ma1!=mb1); + (void) (ma1!=ma2); + (void) (ma2!=ma1); + + (void) (va1==vb1); + (void) (va1==va2); + (void) (va2==va1); + + (void) (va1!=vb1); + (void) (va1!=va2); + (void) (va2!=va1); + + (void) (qa1==qb1); + (void) (qa1==qa2); + (void) (qa2==qa1); + + (void) (qa1!=qb1); + (void) (qa1!=qa2); + (void) (qa2!=qa1); + + return 0; + }