Merge branch 'xenia-canary:canary_experimental' into command_processor_optimizations
This commit is contained in:
@@ -29,6 +29,16 @@ void BitStream::SetOffset(size_t offset_bits) {
|
||||
|
||||
size_t BitStream::BitsRemaining() { return size_bits_ - offset_bits_; }
|
||||
|
||||
bool BitStream::IsOffsetValid(size_t num_bits) {
|
||||
size_t offset_bytes = offset_bits_ >> 3;
|
||||
size_t rel_offset_bits = offset_bits_ - (offset_bytes << 3);
|
||||
|
||||
if (rel_offset_bits && int32_t(num_bits - 8 - rel_offset_bits) < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t BitStream::Peek(size_t num_bits) {
|
||||
// FYI: The reason we can't copy more than 57 bits is:
|
||||
// 57 = 7 * 8 + 1 - that can only span a maximum of 8 bytes.
|
||||
|
||||
@@ -28,6 +28,7 @@ class BitStream {
|
||||
void Advance(size_t num_bits);
|
||||
void SetOffset(size_t offset_bits);
|
||||
size_t BitsRemaining();
|
||||
bool IsOffsetValid(size_t num_bits);
|
||||
|
||||
// Note: num_bits MUST be in the range 0-57 (inclusive)
|
||||
uint64_t Peek(size_t num_bits);
|
||||
|
||||
Reference in New Issue
Block a user