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

30 lines
960 B
C++
Raw Permalink Normal View History

2024-03-26 10:32:56 -03:00
#ifndef XNA_CSHARP_BUFFER_HPP
#define XNA_CSHARP_BUFFER_HPP
#include <string>
#include <vector>
namespace xna {
2024-05-29 09:42:18 -03:00
//A simplified port of the System.Buffer class.
2024-03-26 10:32:56 -03:00
class Buffer {
public:
2024-11-08 15:26:57 -03:00
//Copies from one primitive array to another primitive array without respecting types.
2024-03-26 10:32:56 -03:00
template <typename T>
2024-11-08 15:26:57 -03:00
static inline void BlockCopy(T const* src, rsize_t srcOffset, T* dst, rsize_t dstOffset, rsize_t byteCount) {
2024-03-26 10:32:56 -03:00
memmove_s(dst + dstOffset, byteCount, src + srcOffset, byteCount);
2024-05-04 21:07:39 -03:00
}
2024-11-08 15:26:57 -03:00
//Copies from one primitive array to another primitive array without respecting types.
2024-05-04 21:07:39 -03:00
template <typename TSOURCE, typename TDEST>
2024-11-08 15:26:57 -03:00
static inline void BlockCopy(TSOURCE const* src, rsize_t srcOffset, TDEST* dst, rsize_t dstOffset, rsize_t byteCount) {
2024-05-04 21:07:39 -03:00
memmove_s(dst + dstOffset, byteCount, src + srcOffset, byteCount);
}
2024-03-26 10:32:56 -03:00
private:
constexpr Buffer() = default;
constexpr Buffer(Buffer&&) = default;
constexpr Buffer(const Buffer&) = default;
};
}
#endif