Add simple vector implementation to kutil for device_manager

This commit is contained in:
Justin C. Miller
2018-05-07 09:47:34 -07:00
parent abb347e1a8
commit ff3bd640f0
6 changed files with 205 additions and 63 deletions

View File

@@ -8,8 +8,20 @@ using addr_t = uint64_t;
namespace kutil {
/// Fill memory with the given value.
/// \arg p The beginning of the memory area to fill
/// \arg v The byte value to fill memory with
/// \arg n The size in bytes of the memory area
/// \returns A pointer to the filled memory
void * memset(void *p, uint8_t v, size_t n);
/// Copy an area of memory to another
/// \dest The memory to copy to
/// \src The memory to copy from
/// \n The number of bytes to copy
/// \returns A pointer to the destination memory
void * memcpy(void *dest, void *src, size_t n);
template <typename T>
inline T read_from(const void *p) { return *reinterpret_cast<const T *>(p); }