xb format --all (we are now format clean). Buildbot will yell at you.
This commit is contained in:
@@ -66,9 +66,7 @@ void* Arena::Alloc(size_t size) {
|
||||
return p;
|
||||
}
|
||||
|
||||
void Arena::Rewind(size_t size) {
|
||||
active_chunk_->offset -= size;
|
||||
}
|
||||
void Arena::Rewind(size_t size) { active_chunk_->offset -= size; }
|
||||
|
||||
void* Arena::CloneContents() {
|
||||
size_t total_length = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
namespace xe {
|
||||
|
||||
template <typename T, size_t N>
|
||||
size_t countof(T (&arr)[N]) {
|
||||
size_t countof(T(&arr)[N]) {
|
||||
return std::extent<T[N]>::value;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
namespace xe {
|
||||
|
||||
RingBuffer::RingBuffer(uint8_t* buffer, size_t capacity)
|
||||
: buffer_(buffer)
|
||||
, capacity_(capacity)
|
||||
, read_offset_(0)
|
||||
, write_offset_(0) {}
|
||||
: buffer_(buffer), capacity_(capacity), read_offset_(0), write_offset_(0) {}
|
||||
|
||||
size_t RingBuffer::Read(uint8_t* buffer, size_t count) {
|
||||
count = std::min(count, capacity_);
|
||||
@@ -60,4 +57,4 @@ size_t RingBuffer::Write(uint8_t* buffer, size_t count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace xe
|
||||
} // namespace xe
|
||||
|
||||
@@ -17,52 +17,48 @@
|
||||
namespace xe {
|
||||
|
||||
class RingBuffer {
|
||||
public:
|
||||
RingBuffer(uint8_t* buffer, size_t capacity);
|
||||
public:
|
||||
RingBuffer(uint8_t* buffer, size_t capacity);
|
||||
|
||||
size_t Read(uint8_t* buffer, size_t count);
|
||||
size_t Write(uint8_t* buffer, size_t count);
|
||||
size_t Read(uint8_t* buffer, size_t count);
|
||||
size_t Write(uint8_t* buffer, size_t count);
|
||||
|
||||
uint8_t* buffer() { return buffer_; }
|
||||
size_t capacity() { return capacity_; }
|
||||
uint8_t* buffer() { return buffer_; }
|
||||
size_t capacity() { return capacity_; }
|
||||
|
||||
size_t read_offset() { return read_offset_; }
|
||||
size_t read_count() {
|
||||
if (read_offset_ == write_offset_) {
|
||||
return 0;
|
||||
} else if (read_offset_ < write_offset_) {
|
||||
return write_offset_ - read_offset_;
|
||||
} else {
|
||||
return (capacity_ - read_offset_) + write_offset_;
|
||||
}
|
||||
size_t read_offset() { return read_offset_; }
|
||||
size_t read_count() {
|
||||
if (read_offset_ == write_offset_) {
|
||||
return 0;
|
||||
} else if (read_offset_ < write_offset_) {
|
||||
return write_offset_ - read_offset_;
|
||||
} else {
|
||||
return (capacity_ - read_offset_) + write_offset_;
|
||||
}
|
||||
}
|
||||
|
||||
size_t write_offset() { return write_offset_; }
|
||||
size_t write_count() {
|
||||
if (read_offset_ == write_offset_) {
|
||||
return capacity_;
|
||||
} else if (write_offset_ < read_offset_) {
|
||||
return read_offset_ - write_offset_;
|
||||
} else {
|
||||
return (capacity_ - write_offset_) + read_offset_;
|
||||
}
|
||||
size_t write_offset() { return write_offset_; }
|
||||
size_t write_count() {
|
||||
if (read_offset_ == write_offset_) {
|
||||
return capacity_;
|
||||
} else if (write_offset_ < read_offset_) {
|
||||
return read_offset_ - write_offset_;
|
||||
} else {
|
||||
return (capacity_ - write_offset_) + read_offset_;
|
||||
}
|
||||
}
|
||||
|
||||
void set_read_offset(size_t offset) {
|
||||
read_offset_ = offset % capacity_;
|
||||
}
|
||||
void set_read_offset(size_t offset) { read_offset_ = offset % capacity_; }
|
||||
|
||||
void set_write_offset(size_t offset) {
|
||||
write_offset_ = offset % capacity_;
|
||||
}
|
||||
void set_write_offset(size_t offset) { write_offset_ = offset % capacity_; }
|
||||
|
||||
private:
|
||||
uint8_t* buffer_;
|
||||
size_t capacity_;
|
||||
size_t read_offset_;
|
||||
size_t write_offset_;
|
||||
private:
|
||||
uint8_t* buffer_;
|
||||
size_t capacity_;
|
||||
size_t read_offset_;
|
||||
size_t write_offset_;
|
||||
};
|
||||
|
||||
} // namespace xe
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_BASE_RING_BUFFER_H_
|
||||
#endif // XENIA_BASE_RING_BUFFER_H_
|
||||
Reference in New Issue
Block a user