VCTR
Loading...
Searching...
No Matches
PlatformVectorOpsHelpers.h
1/*
2 ==============================================================================
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5 Copyright 2022- by sonible GmbH.
6
7 This file is part of VCTR - Versatile Container Templates Reconceptualized.
8
9 VCTR is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License version 3
11 only, as published by the Free Software Foundation.
12
13 VCTR is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License version 3 for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 version 3 along with VCTR. If not, see <https://www.gnu.org/licenses/>.
20 ==============================================================================
21*/
22
23namespace vctr
24{
25
27inline int sizeToInt (size_t size)
28{
29 // You are evaluating an expression on a very big vector which size exceeds the maximum value of an integer.
30 // The PlatformVectorOp that the implementation attempts to use in this context is however only implemented for int
31 // size arguments, so it's likely to fail on this large vector.
32 // To work around the problem, add a filter expression that avoids invoking the operation and forces the compiler
33 // to choose a different strategy like vctr::useNeonOrAVX.
34 VCTR_ASSERT (size < size_t (std::numeric_limits<int>::max()));
35
36 return int (size);
37}
38
39} // namespace vctr
The main namespace of the VCTR project.
Definition: Array.h:24
int sizeToInt(size_t size)
Casts the size_t argument to an int.
Definition: PlatformVectorOpsHelpers.h:27