dd3c6d1303
After some discussion with PVH I realise that the repo structure in the last reorg was very rust-centric. In an attempt to put each language on a level footing move the rust code and project files into ./rust
15 lines
386 B
C
15 lines
386 B
C
#include <stdio.h>
|
|
#include <stdint.h>
|
|
|
|
/* local */
|
|
#include "str_utils.h"
|
|
|
|
void hex_to_bytes(char const* hex_str, uint8_t* src, size_t const count) {
|
|
unsigned int byte;
|
|
char const* next = hex_str;
|
|
for (size_t index = 0; *next && index != count; next += 2, ++index) {
|
|
if (sscanf(next, "%02x", &byte) == 1) {
|
|
src[index] = (uint8_t)byte;
|
|
}
|
|
}
|
|
}
|