2 ms·
He would still have to call out to the C++ function.
by imtringued 3y ago
He would still have to call out to the C++ function.
- neonsunset 3y agoAssuming it is "sort for 128bit records", that's something C# does really well - writing optimized code with structs / Vector128<T> / pointer arithmetic when really needed without going through FFI and having to maintain separate build step and project parts for a different platform. But even if it was needed, such records can be commonly represented by the same structs both at C#'s and C++'s sides without overhead. An array of such could be passed as is as a pointer, or vice versa - a buffer of struts allocated in C/C++ can be wrapped in a Span<Record128> and transparently interact with the rest of standard library without having to touch unsafe (aside from eventually freeing it, should that be necessary).