mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-22 11:43:41 +01:00
Add test utils for idstring checking
This commit is contained in:
parent
633672eefe
commit
114de803f6
@ -307,6 +307,10 @@ static inline int min_s32(int32_t a, int32_t b) { return a < b ? a : b; }
|
||||
//align32, align16, clamp16, etc
|
||||
#endif
|
||||
|
||||
static inline const int is_id32be(off_t offset, STREAMFILE* sf, const char* s) {
|
||||
return read_u32be(offset, sf) == get_id32be(s);
|
||||
}
|
||||
|
||||
//TODO: maybe move to streamfile.c
|
||||
/* guess byte endianness from a given value, return true if big endian and false if little endian */
|
||||
static inline int guess_endianness16bit(off_t offset, STREAMFILE* sf) {
|
||||
|
@ -98,6 +98,10 @@ static inline int clamp16(int32_t val) {
|
||||
else return val;
|
||||
}
|
||||
|
||||
static inline const uint32_t get_id32be(const char* s) {
|
||||
return (uint32_t)(s[0] << 24) | (s[1] << 16) | (s[2] << 8) | (s[3] << 0);
|
||||
}
|
||||
|
||||
/* less common functions, no need to inline */
|
||||
|
||||
int round10(int val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user