[C#] Fix and improve project files (#6142)

* [C#] Fix and improve project files

* "net35" target included for Unity 5
* "net46" target included for Unity 2017
* "netstandard2.0" target included for Unity 2018 and general use
* "netstandard2.1" target included for Span<T> support

Included project properties for defining UNSAFE_BYTEBUFFER, BYTEBUFFER_NO_BOUNDS_CHECK, and ENABLE_SPAN_T conditional compilation symbols.

* Add documentation on building for C#
This commit is contained in:
Conan Chen
2020-09-28 14:56:59 -04:00
committed by GitHub
parent 2eedc769d5
commit 0bdf2fa156
5 changed files with 142 additions and 83 deletions

View File

@@ -14,24 +14,25 @@
* limitations under the License.
*/
// There are 3 #defines that have an impact on performance / features of this ByteBuffer implementation
// There are three conditional compilation symbols that have an impact on performance/features of this ByteBuffer implementation.
//
// UNSAFE_BYTEBUFFER
// UNSAFE_BYTEBUFFER
// This will use unsafe code to manipulate the underlying byte array. This
// can yield a reasonable performance increase.
//
// BYTEBUFFER_NO_BOUNDS_CHECK
// This will disable the bounds check asserts to the byte array. This can
// yield a small performance gain in normal code..
// yield a small performance gain in normal code.
//
// ENABLE_SPAN_T
// This will enable reading and writing blocks of memory with a Span<T> instead if just
// This will enable reading and writing blocks of memory with a Span<T> instead of just
// T[]. You can also enable writing directly to shared memory or other types of memory
// by providing a custom implementation of ByteBufferAllocator.
// ENABLE_SPAN_T also requires UNSAFE_BYTEBUFFER to be defined
// ENABLE_SPAN_T also requires UNSAFE_BYTEBUFFER to be defined, or .NET
// Standard 2.1.
//
// Using UNSAFE_BYTEBUFFER and BYTEBUFFER_NO_BOUNDS_CHECK together can yield a
// performance gain of ~15% for some operations, however doing so is potentially
// performance gain of ~15% for some operations, however doing so is potentially
// dangerous. Do so at your own risk!
//