Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- size_t read_le_s16(FILE *f, int16_t *buf, size_t num)
- {
- size_t read = fread(buf, sizeof(buf[0]), num, f);
- unsigned char *ptr = (unsigned char *)buf;
- for(size_t i = 0; i < read; ++i) {
- buf[i] = ptr[0] | ptr[1] << 8;
- ptr += sizeof(buf[0]);
- }
- return read;
- }
- size_t read_le_u16(struct slv_stream *stream, uint16_t *buf,
- size_t num)
- {
- return read_le_s16(stream, (int16_t *)buf, num);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement