* @param num The number of bits from @c value to copy (1-32).
* @param value Up to 32 bits that will be copied to _buffer.
*/
-static inline void buf_set_u32(void *_buffer,
+static inline void buf_set_u32(uint8_t *_buffer,
unsigned first, unsigned num, uint32_t value)
{
- uint8_t *buffer = (uint8_t *)_buffer;
+ uint8_t *buffer = _buffer;
if ((num == 32) && (first == 0)) {
buffer[3] = (value >> 24) & 0xff;
* @param num The number of bits from @c value to copy (1-64).
* @param value Up to 64 bits that will be copied to _buffer.
*/
-static inline void buf_set_u64(void *_buffer,
+static inline void buf_set_u64(uint8_t *_buffer,
unsigned first, unsigned num, uint64_t value)
{
- uint8_t *buffer = (uint8_t *)_buffer;
+ uint8_t *buffer = _buffer;
if ((num == 32) && (first == 0)) {
buffer[3] = (value >> 24) & 0xff;
* @param num The number of bits from @c _buffer to read (1-32).
* @returns Up to 32-bits that were read from @c _buffer.
*/
-static inline uint32_t buf_get_u32(const void *_buffer,
+static inline uint32_t buf_get_u32(const uint8_t *_buffer,
unsigned first, unsigned num)
{
- uint8_t *buffer = (uint8_t *)_buffer;
+ const uint8_t *buffer = _buffer;
if ((num == 32) && (first == 0)) {
return (((uint32_t)buffer[3]) << 24) |
* @param num The number of bits from @c _buffer to read (1-64).
* @returns Up to 64-bits that were read from @c _buffer.
*/
-static inline uint64_t buf_get_u64(const void *_buffer,
+static inline uint64_t buf_get_u64(const uint8_t *_buffer,
unsigned first, unsigned num)
{
- uint8_t *buffer = (uint8_t *)_buffer;
+ const uint8_t *buffer = _buffer;
if ((num == 32) && (first == 0)) {
return 0 + ((((uint32_t)buffer[3]) << 24) | /* Note - zero plus is to avoid a checkpatch bug */
* used in ti-icdi driver and gdb server */
int unhexify(char *bin, const char *hex, int count);
int hexify(char *hex, const char *bin, int count, int out_maxlen);
+void buffer_shr(void *_buf, unsigned buf_len, unsigned count);
#endif /* BINARYBUFFER_H */