Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
memory.cpp
Go to the documentation of this file.
2
3namespace sysio { namespace chain { namespace webassembly {
4 void* interface::memcpy( memcpy_params args ) const {
5 auto [dest, src, length] = args;
6 SYS_ASSERT((size_t)(std::abs((ptrdiff_t)(char*)dest - (ptrdiff_t)(const char*)src)) >= length,
7 overlapping_memory_error, "memcpy can only accept non-aliasing pointers");
8 return (char *)std::memcpy((char*)dest, (const char*)src, length);
9 }
10
11 void* interface::memmove( memcpy_params args ) const {
12 auto [dest, src, length] = args;
13 return (char *)std::memmove((char*)dest, (const char*)src, length);
14 }
15
17 auto [dest, src, length] = args;
18 int32_t ret = std::memcmp((const char*)dest, (const char*)src, length);
19 return ret < 0 ? -1 : ret > 0 ? 1 : 0;
20 }
21
22 void* interface::memset( memset_params args ) const {
23 auto [dest, value, length] = args;
24 return (char *)std::memset( (char*)dest, value, length );
25 }
26
27}}} // ns sysio::chain::webassembly
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
void * memset(memset_params) const
Definition memory.cpp:22
void * memmove(memcpy_params) const
Definition memory.cpp:11
int32_t memcmp(memcmp_params) const
Definition memory.cpp:16
void * memcpy(memcpy_params) const
Definition memory.cpp:4
#define value
Definition pkcs11.h:157
signed int int32_t
Definition stdint.h:123
CK_RV ret