29 #include "xcp_macros.h" 32 void XcpUtl_MemCopy(
void *dst,
void const *src,
34 uint8_t *pd = (uint8_t *)dst;
35 uint8_t
const *ps = (uint8_t
const *)src;
37 XCP_ASSERT(dst != XCP_NULL);
39 XCP_ASSERT(len != 0UL);
46 void XcpUtl_MemSet(
void *dest, uint8_t fill_char, uint32_t len) {
47 uint8_t *p = (uint8_t *)dest;
49 XCP_ASSERT(XCP_NULL != dest);
56 bool XcpUtl_MemCmp(
void const *lhs,
void const *rhs,
58 uint8_t
const *pl = (uint8_t
const *)lhs;
59 uint8_t
const *pr = (uint8_t
const *)rhs;
61 XCP_ASSERT(XCP_NULL != lhs);
62 XCP_ASSERT(XCP_NULL != rhs);
64 if (len == UINT32(0)) {
67 while ((*pl++ == *pr++) && (len != UINT32(0))) {
70 return (
bool)(len == UINT32(0));
73 #if XCP_BUILD_TYPE == XCP_DEBUG_BUILD 74 void XcpUtl_Hexdump( uint8_t
const *buf, uint16_t sz) {
77 for (idx = UINT16(0); idx < sz; ++idx) {
78 DBG_PRINT2(
"%02X ", buf[idx]);
83 void XcpUtl_Itoa(uint32_t value, uint8_t base, uint8_t *buf) {
85 uint8_t pos = (uint8_t)0x00, swap_pos = (uint8_t)0x00;
89 if (((int32_t)value) < 0L && base == (uint8_t)10) {
90 value = (uint32_t)((int32_t)value * -1L);
103 buf[pos++] =
'0' + mod;
105 buf[pos++] =
'A' + mod - (uint8_t)10;
110 while (pos > swap_pos) {
112 buf[swap_pos] = buf[pos];