| commit | a75e5f2ffc46ac771e41a273cc2a9d932a52fc67 | [log] [tgz] |
|---|---|---|
| author | Bimba Shrestha <bimbashrestha@fb.com> | Thu Mar 05 11:52:15 2020 -0800 |
| committer | Bimba Shrestha <bimbashrestha@fb.com> | Thu Mar 05 11:52:15 2020 -0800 |
| tree | 78e89d3b14c1f79b38bff536baea408942e08323 | |
| parent | bc0e10ae78e8cff899e20a2feb56f36b26620f72 [diff] [blame] |
bitscan add undef check
diff --git a/lib/common/bitstream.h b/lib/common/bitstream.h index fe3148e..c84c0ed 100644 --- a/lib/common/bitstream.h +++ b/lib/common/bitstream.h
@@ -162,8 +162,7 @@ { # if defined(_MSC_VER) /* Visual */ unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + _BitScanReverse ( &r, val ) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # elif defined(__ICCARM__) /* IAR Intrinsic */