Merge pull request #708 from Izaron/bytestream

Removed builtin code in Matroska
This commit is contained in:
Carlos Fernandez Sanz 2017-03-05 10:03:54 -08:00 committed by GitHub
commit ceed0e42b3

View File

@ -33,11 +33,13 @@ UBYTE mkv_read_byte(FILE* file) {
ULLONG read_vint_length(FILE* file) { ULLONG read_vint_length(FILE* file) {
UBYTE ch = mkv_read_byte(file); UBYTE ch = mkv_read_byte(file);
#ifdef _WIN32 int cnt = 0;
int cnt = 8 - __lzcnt16(ch); for (int i = 7; i >= 0; i--) {
#else if ((ch & (1 << i)) != 0) {
int cnt = __builtin_clz(ch) - 24 + 1; cnt = 8 - i;
#endif break;
}
}
ch ^= (1 << (8 - cnt)); ch ^= (1 << (8 - cnt));
ULLONG ret = ch; ULLONG ret = ch;
for (int i = 1; i < cnt; i++) { for (int i = 1; i < cnt; i++) {