1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/xna/csharp/buffer.hpp
2024-11-08 15:26:57 -03:00

30 lines
960 B
C++

#ifndef XNA_CSHARP_BUFFER_HPP
#define XNA_CSHARP_BUFFER_HPP
#include <string>
#include <vector>
namespace xna {
//A simplified port of the System.Buffer class.
class Buffer {
public:
//Copies from one primitive array to another primitive array without respecting types.
template <typename T>
static inline void BlockCopy(T const* src, rsize_t srcOffset, T* dst, rsize_t dstOffset, rsize_t byteCount) {
memmove_s(dst + dstOffset, byteCount, src + srcOffset, byteCount);
}
//Copies from one primitive array to another primitive array without respecting types.
template <typename TSOURCE, typename TDEST>
static inline void BlockCopy(TSOURCE const* src, rsize_t srcOffset, TDEST* dst, rsize_t dstOffset, rsize_t byteCount) {
memmove_s(dst + dstOffset, byteCount, src + srcOffset, byteCount);
}
private:
constexpr Buffer() = default;
constexpr Buffer(Buffer&&) = default;
constexpr Buffer(const Buffer&) = default;
};
}
#endif