Mercurial > vec
comparison src/impl/fallback.c @ 31:bf6ad516f1e6
Backed out changeset c6c99ab1088a
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 25 Apr 2025 17:40:33 -0400 |
| parents | c6c99ab1088a |
| children | 8b5e0974fd41 |
comparison
equal
deleted
inserted
replaced
| 30:641d8c79b1da | 31:bf6ad516f1e6 |
|---|---|
| 1 /** | |
| 2 * vec - a tiny SIMD vector library in C99 | |
| 3 * | |
| 4 * Copyright (c) 2024 Paper | |
| 5 * | |
| 6 * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 7 * of this software and associated documentation files (the "Software"), to deal | |
| 8 * in the Software without restriction, including without limitation the rights | |
| 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 10 * copies of the Software, and to permit persons to whom the Software is | |
| 11 * furnished to do so, subject to the following conditions: | |
| 12 * | |
| 13 * The above copyright notice and this permission notice shall be included in all | |
| 14 * copies or substantial portions of the Software. | |
| 15 * | |
| 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 22 * SOFTWARE. | |
| 23 **/ | |
| 24 | |
| 25 #include "vec/impl/fallback.h" | 1 #include "vec/impl/fallback.h" |
| 26 | 2 |
| 27 #include <string.h> | 3 #include <string.h> |
| 28 | 4 |
| 29 // Fallback implementations - this is what an implementation should use if it | 5 // Fallback implementations - this is what an implementation should use if it |
| 30 // doesn't support a specific function *and* the actual representation in | 6 // doesn't support a specific function *and* the actual representation in |
| 31 // memory is unknown or yields incorrect results from the generic functions. | 7 // memory is unknown or yields incorrect results from the generic functions. |
| 32 // This is *extremely* unlikely; for x86 the layout is exactly the same in | 8 // This is *extremely* unlikely; for x86 the layout is exactly the same in |
| 33 // memory as the generic functions (i.e. it is literally stored as an array of | 9 // memory as the generic functions (i.e. it is literally stored as an array of |
| 34 // integers). This is also true for AltiVec. This is likely true for NEON as well, | 10 // integers). This is likely true for AltiVec and NEON as well, but those |
| 35 // but that isn't tested for now. | 11 // aren't tested for now. |
| 36 | 12 |
| 37 #define VEC_FALLBACK_OPERATION(op, sign, csign, bits, size) \ | 13 #define VEC_FALLBACK_OPERATION(op, sign, csign, bits, size) \ |
| 38 do { \ | 14 do { \ |
| 39 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(varr1); \ | 15 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(varr1); \ |
| 40 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(varr2); \ | 16 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(varr2); \ |
