BufferSlice<U> An alias of the same slice, but reinterpreted as the target type.
Reinterpret the slice as having a different data type (type punning), but does not check if the reinterpret is valid.
Performs unchecked reinterpretation of the buffer slice to view the same memory as a different type. This method skips all validation and should only be used when you are certain the reinterpretation is valid.
Use Cases:
Warning: This method can lead to undefined behavior, memory corruption, or crashes if used incorrectly. Prefer SafeReinterpret unless you have specific performance requirements.
Additional resources: SafeReinterpret for validated reinterpretation.
// Performance-critical reinterpretation var floatSlice = new BufferSlice<float>(buffer, 0);
// Unsafe reinterpret for maximum performance // WARNING: No validation - ensure this is safe! var byteSlice = floatSlice.UnsafeReinterpret<byte>();
// Use with caution - misaligned access could crash var intSlice = floatSlice.UnsafeReinterpret<int>(); // OK: same size var doubleSlice = floatSlice.UnsafeReinterpret<double>(); // DANGEROUS: different size