Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
memory.cpp
Go to the documentation of this file.
1
#include <
sysio/chain/webassembly/interface.hpp
>
2
3
namespace
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
16
int32_t
interface::memcmp
(
memcmp_params
args )
const
{
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
SYS_ASSERT
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition
exceptions.hpp:7
sysio::chain::webassembly::interface::memset
void * memset(memset_params) const
Definition
memory.cpp:22
sysio::chain::webassembly::interface::memmove
void * memmove(memcpy_params) const
Definition
memory.cpp:11
sysio::chain::webassembly::interface::memcmp
int32_t memcmp(memcmp_params) const
Definition
memory.cpp:16
sysio::chain::webassembly::interface::memcpy
void * memcpy(memcpy_params) const
Definition
memory.cpp:4
interface.hpp
sysio
Definition
abi_serializer.cpp:8
value
#define value
Definition
pkcs11.h:157
int32_t
signed int int32_t
Definition
stdint.h:123
sysio::chain::memcmp_params
Definition
common.hpp:46
sysio::chain::memcpy_params
Definition
common.hpp:40
sysio::chain::memset_params
Definition
common.hpp:52
ret
CK_RV ret
Definition
yubihsm_pkcs11.c:973
libraries
chain
webassembly
memory.cpp
Generated by
1.12.0