summaryrefslogtreecommitdiff
path: root/zp/include/zp/mem
blob: 8404cc05cd66736a3c5a0b67c6ab52108e98a0e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
	Copyright 2022-2023 Gabriel Jensen.
	This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
	If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/

#ifndef zp_priv_cxxhdr_mem
#define zp_priv_cxxhdr_mem

#include <zp/bs>
#include <zp/mem.h>

namespace zp {
	template<typename dsttyp,typename srctyp> struct cpyret {
		dsttyp * dst;
		srctyp * src;
	};

	template<typename dsttyp,typename srctyp> zp_iln inline auto memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyret<dsttyp,srctyp>;

	template<typename ltyp,typename rtyp> zp_useres zp_iln inline auto memequ(ltyp const * lbuf,rtyp const * rbuf,::zp::sz const num) noexcept -> bool;

	template<typename typ> zp_iln inline auto memfil(typ * dst,char unsigned val,::zp::sz const num) noexcept -> void;

	template<typename typ> zp_useres zp_iln inline auto memsrh(typ *       buf,char unsigned val,::zp::sz const num) noexcept -> typ *;
	template<typename typ> zp_useres zp_iln inline auto memsrh(typ const * buf,char unsigned val,::zp::sz const num) noexcept -> typ const *;

	template<typename typ> constexpr auto cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyret<typ,typ>;

	template<typename typ> zp_useres constexpr auto equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) noexcept -> bool;

	template<typename typ> constexpr auto fil(typ * dst,typ const val,::zp::sz const num) noexcept -> void;

	template<typename typ> zp_useres constexpr auto srh(typ *       buf,typ const val,::zp::sz const num) noexcept -> typ *;
	template<typename typ> zp_useres constexpr auto srh(typ const * buf,typ const val,::zp::sz const num) noexcept -> typ const *;
}

#include <zp/mem.d/cpy.ii>
#include <zp/mem.d/equ.ii>
#include <zp/mem.d/fil.ii>
#include <zp/mem.d/memcpy.ii>
#include <zp/mem.d/memequ.ii>
#include <zp/mem.d/memfil.ii>
#include <zp/mem.d/memsrh.ii>
#include <zp/mem.d/srh.ii>

#endif