2019-05-04 02:39:09 +00:00
|
|
|
//
|
|
|
|
// MemoryPacker.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 03/05/2019.
|
|
|
|
// Copyright © 2019 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef MemoryPacker_hpp
|
|
|
|
#define MemoryPacker_hpp
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Memory {
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Copies the bytes from @c source into @c target, interpreting them
|
|
|
|
as big-endian 16-bit data.
|
|
|
|
*/
|
|
|
|
void PackBigEndian16(const std::vector<uint8_t> &source, uint16_t *target);
|
|
|
|
|
2019-12-09 01:20:13 +00:00
|
|
|
/*!
|
|
|
|
Copies the bytes from @c source to @c target, interpreting them as
|
|
|
|
big-endian 16-bit data, and writing them as host-endian 16-bit data.
|
|
|
|
*/
|
|
|
|
void PackBigEndian16(const std::vector<uint8_t> &source, uint8_t *target);
|
|
|
|
|
2019-10-05 02:38:46 +00:00
|
|
|
/*!
|
|
|
|
Copies the bytes from @c source into @c target, interpreting them
|
2023-05-16 20:40:09 +00:00
|
|
|
as big-endian 16-bit data and writing them as host-endian 16-bit data.
|
2021-07-17 01:07:12 +00:00
|
|
|
|
|
|
|
@c target will be resized to the proper size exactly to contain the contents
|
|
|
|
of @c source.
|
2019-10-05 02:38:46 +00:00
|
|
|
*/
|
|
|
|
void PackBigEndian16(const std::vector<uint8_t> &source, std::vector<uint16_t> &target);
|
|
|
|
|
2019-12-09 01:20:13 +00:00
|
|
|
/*!
|
|
|
|
Copies the bytes from @c source into @c target, interpreting them
|
|
|
|
as big-endian 16-bit data and writing them as host-endian 16-bit data.
|
|
|
|
@c target will be resized to the proper size exactly to contain the contents of @c source.
|
|
|
|
*/
|
|
|
|
void PackBigEndian16(const std::vector<uint8_t> &source, std::vector<uint8_t> &target);
|
|
|
|
|
2019-05-04 02:39:09 +00:00
|
|
|
}
|
|
|
|
#endif /* MemoryPacker_hpp */
|