Updates from internal copy. Better branch prediction, ability to set Brotli quality on ConvertTTFToWOFF2
This commit is contained in:
@@ -33,8 +33,15 @@ inline size_t StoreU32(uint8_t* dst, size_t offset, uint32_t x) {
|
||||
}
|
||||
|
||||
inline size_t Store16(uint8_t* dst, size_t offset, int x) {
|
||||
#if (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
*reinterpret_cast<uint16_t*>(dst + offset) =
|
||||
((x & 0xFF) << 8) | ((x & 0xFF00) >> 8);
|
||||
#elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
|
||||
*reinterpret_cast<uint16_t*>(dst + offset) = reinterpret_cast<uint16_t>(x);
|
||||
#else
|
||||
dst[offset] = x >> 8;
|
||||
dst[offset + 1] = x;
|
||||
#endif
|
||||
return offset + 2;
|
||||
}
|
||||
|
||||
@@ -46,8 +53,18 @@ inline void StoreU32(uint32_t val, size_t* offset, uint8_t* dst) {
|
||||
}
|
||||
|
||||
inline void Store16(int val, size_t* offset, uint8_t* dst) {
|
||||
#if (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
*reinterpret_cast<uint16_t*>(dst + *offset) =
|
||||
((val & 0xFF) << 8) | ((val & 0xFF00) >> 8);
|
||||
*offset += 2;
|
||||
#elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
|
||||
*reinterpret_cast<uint16_t*>(dst + *offset) =
|
||||
reinterpret_cast<uint16_t>(val);
|
||||
*offset += 2;
|
||||
#else
|
||||
dst[(*offset)++] = val >> 8;
|
||||
dst[(*offset)++] = val;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void StoreBytes(const uint8_t* data, size_t len,
|
||||
|
||||
Reference in New Issue
Block a user