This commit is contained in:
2021-12-30 22:05:42 +08:00
parent 4618b97a2e
commit ac4fee1977
7 changed files with 162 additions and 5 deletions

View File

@@ -42,3 +42,13 @@ int cstr_tolowercase(const char* str, size_t input_len, char** output) {
*output = tmp;
return 1;
}
uint32_t cstr_read_uint32(const uint8_t* bytes, int big) {
if (!bytes) return 0;
return big ? (bytes[0] << 24) + (bytes[1] << 16) + (bytes[2] << 8) + bytes[3] : bytes[0] + (bytes[1] << 8) + (bytes[2] << 16) + (bytes[3] << 24);
}
int32_t cstr_read_int32(const uint8_t* bytes, int big) {
if (!bytes) return 0;
return cstr_read_uint32(bytes, big);
}