-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
GenericsNative.VectorD.cpp
76 lines (62 loc) · 2.28 KB
/
GenericsNative.VectorD.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include <stdio.h>
#include <stdint.h>
#include <xplatform.h>
#include <platformdefines.h>
typedef struct {
double e00;
double e01;
} VectorD128;
typedef struct {
double e00;
double e01;
double e02;
double e03;
} VectorD256;
static VectorD128 VectorD128Value = { };
static VectorD256 VectorD256Value = { };
extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE GetVectorD128(double e00, double e01)
{
double value[2] = { e00, e01 };
return *reinterpret_cast<VectorD128*>(value);
}
extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX GetVectorD256(double e00, double e01, double e02, double e03)
{
double value[4] = { e00, e01, e02, e03 };
return *reinterpret_cast<VectorD256*>(value);
}
extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorD128Out(double e00, double e01, VectorD128* pValue)
{
*pValue = GetVectorD128(e00, e01);
}
extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVectorD256Out(double e00, double e01, double e02, double e03, VectorD256* pValue)
{
*pValue = GetVectorD256(e00, e01, e02, e03);
}
extern "C" DLL_EXPORT const VectorD128* STDMETHODCALLTYPE GetVectorD128Ptr(double e00, double e01)
{
GetVectorD128Out(e00, e01, &VectorD128Value);
return &VectorD128Value;
}
extern "C" DLL_EXPORT const VectorD256* STDMETHODCALLTYPE ENABLE_AVX GetVectorD256Ptr(double e00, double e01, double e02, double e03)
{
GetVectorD256Out(e00, e01, e02, e03, &VectorD256Value);
return &VectorD256Value;
}
extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE AddVectorD128(VectorD128 lhs, VectorD128 rhs)
{
throw "P/Invoke for Vector<char> should be unsupported.";
}
extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX AddVectorD256(VectorD256 lhs, VectorD256 rhs)
{
throw "P/Invoke for Vector<char> should be unsupported.";
}
extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE AddVectorD128s(const VectorD128* pValues, double count)
{
throw "P/Invoke for Vector<char> should be unsupported.";
}
extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX AddVectorD256s(const VectorD256* pValues, double count)
{
throw "P/Invoke for Vector<char> should be unsupported.";
}