Skip to content

Commit

Permalink
utils - introduce memcpy_le32toh function
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSableCZ committed Sep 13, 2024
1 parent 3717722 commit f352e83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/ipfixprobe/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ std::string vec2str(const std::vector<T> &vec) {
return ss.str();
}

/**
* @brief Copy uint32 in little endian byte order to destination in host byte order
*/
void memcpy_le32toh(uint32_t* dest, const uint32_t* src);

}

#endif /* IPXP_UTILS_HPP */
5 changes: 5 additions & 0 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,9 @@ uint64_t timeval2usec(const struct timeval& tv)
return tv.tv_sec * usec_in_sec + tv.tv_usec;
}

void memcpy_le32toh(uint32_t* dest, const uint32_t* src)
{
*dest = le32toh(*src);
}

} // namespace ipxp

0 comments on commit f352e83

Please sign in to comment.