Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Vc/common/vector/casts.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*  This file is part of the Vc library. {{{
0002 Copyright © 2014-2015 Matthias Kretz <kretz@kde.org>
0003 
0004 Redistribution and use in source and binary forms, with or without
0005 modification, are permitted provided that the following conditions are met:
0006     * Redistributions of source code must retain the above copyright
0007       notice, this list of conditions and the following disclaimer.
0008     * Redistributions in binary form must reproduce the above copyright
0009       notice, this list of conditions and the following disclaimer in the
0010       documentation and/or other materials provided with the distribution.
0011     * Neither the names of contributing organizations nor the
0012       names of its contributors may be used to endorse or promote products
0013       derived from this software without specific prior written permission.
0014 
0015 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
0016 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0018 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
0019 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
0020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0021 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0022 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0023 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0024 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0025 
0026 }}}*/
0027 
0028 public:
0029     ///////////////////////////////////////////////////////////////////////////////////////////
0030     // casts - implemented in simd_cast_caller.tcc
0031 
0032     // implict conversion from compatible Vector<U>
0033     template <typename U>
0034     Vc_INTRINSIC_L Vector(
0035         U &&x,
0036         enable_if<NEON::is_vector<Traits::decay<U>>::value &&
0037                   !std::is_same<Vector, Traits::decay<U>>::value &&
0038                   Traits::is_implicit_cast_allowed<Traits::entry_type_of<U>, T>::value> =
0039             nullarg) Vc_INTRINSIC_R;
0040 
0041     // static_cast from other types
0042     template <typename U>
0043     Vc_INTRINSIC_L explicit Vector(U &&x,
0044                                    enable_if<Traits::is_simd_vector<U>::value &&
0045                                              !std::is_same<Vector, Traits::decay<U>>::value>>
0046                                    = nullarg) Vc_INTRINSIC_R;
0047 
0048     ///////////////////////////////////////////////////////////////////////////////////////////
0049     // broadcast
0050     Vc_INTRINSIC Vector(EntryType a);
0051     template <typename U>
0052     Vc_INTRINSIC Vector(
0053         U a,
0054         typename std::enable_if<std::is_same<U, int>::value && !std::is_same<U, EntryType>::value,
0055                                 void *>::type = nullptr)
0056         : Vector(static_cast<EntryType>(a))
0057     {
0058     }
0059 
0060     ///////////////////////////////////////////////////////////////////////////////////////////
0061     // explicitly forbid construction from initializer_list
0062     explicit Vector(std::initializer_list<EntryType>)
0063     {
0064         static_assert(std::is_same<EntryType, void>::value,
0065                       "A SIMD vector object cannot be initialized from an initializer list "
0066                       "because the number of entries in the vector is target-dependent.");
0067     }
0068 
0069 // vim: foldmethod=marker