浏览代码

Update qoa.h

pull/2923/head
Ray 2 年前
父节点
当前提交
22287a78c5
共有 1 个文件被更改,包括 16 次插入14 次删除
  1. +16
    -14
      src/external/qoa.h

+ 16
- 14
src/external/qoa.h 查看文件

@ -274,24 +274,26 @@ static inline int qoa_clamp(int v, int min, int max) {
}
static inline qoa_uint64_t qoa_read_u64(const unsigned char *bytes, unsigned int *p) {
qoa_uint64_t v =
(qoa_uint64_t)bytes[(*p)+0] << 56 | (qoa_uint64_t)bytes[(*p)+1] << 48 |
(qoa_uint64_t)bytes[(*p)+2] << 40 | (qoa_uint64_t)bytes[(*p)+3] << 32 |
(qoa_uint64_t)bytes[(*p)+4] << 24 | (qoa_uint64_t)bytes[(*p)+5] << 16 |
(qoa_uint64_t)bytes[(*p)+6] << 8 | (qoa_uint64_t)bytes[(*p)+7];
bytes += *p;
*p += 8;
return v;
return
((qoa_uint64_t)(bytes[0]) << 56) | ((qoa_uint64_t)(bytes[1]) << 48) |
((qoa_uint64_t)(bytes[2]) << 40) | ((qoa_uint64_t)(bytes[3]) << 32) |
((qoa_uint64_t)(bytes[4]) << 24) | ((qoa_uint64_t)(bytes[5]) << 16) |
((qoa_uint64_t)(bytes[6]) << 8) | ((qoa_uint64_t)(bytes[7]) << 0);
}
static inline void qoa_write_u64(qoa_uint64_t v, unsigned char *bytes, unsigned int *p) {
bytes[(*p)++] = (v >> 56) & 0xff;
bytes[(*p)++] = (v >> 48) & 0xff;
bytes[(*p)++] = (v >> 40) & 0xff;
bytes[(*p)++] = (v >> 32) & 0xff;
bytes[(*p)++] = (v >> 24) & 0xff;
bytes[(*p)++] = (v >> 16) & 0xff;
bytes[(*p)++] = (v >> 8) & 0xff;
bytes[(*p)++] = (v >> 0) & 0xff;
bytes += *p;
*p += 8;
bytes[0] = (v >> 56) & 0xff;
bytes[1] = (v >> 48) & 0xff;
bytes[2] = (v >> 40) & 0xff;
bytes[3] = (v >> 32) & 0xff;
bytes[4] = (v >> 24) & 0xff;
bytes[5] = (v >> 16) & 0xff;
bytes[6] = (v >> 8) & 0xff;
bytes[7] = (v >> 0) & 0xff;
}

正在加载...
取消
保存