ams: revamp assertion system

This commit is contained in:
Michael Scire 2020-02-22 23:05:14 -08:00
parent 9572fb2ce3
commit 40400aee1f
168 changed files with 1014 additions and 696 deletions

View file

@ -29,7 +29,7 @@ namespace ams::os {
void MessageQueue::SendInternal(uintptr_t data) {
/* Ensure we don't corrupt the queue, but this should never happen. */
AMS_ASSERT(this->count < this->capacity);
AMS_ABORT_UNLESS(this->count < this->capacity);
/* Write data to tail of queue. */
this->buffer[(this->count++ + this->offset) % this->capacity] = data;
@ -37,7 +37,7 @@ namespace ams::os {
void MessageQueue::SendNextInternal(uintptr_t data) {
/* Ensure we don't corrupt the queue, but this should never happen. */
AMS_ASSERT(this->count < this->capacity);
AMS_ABORT_UNLESS(this->count < this->capacity);
/* Write data to head of queue. */
this->offset = (this->offset + this->capacity - 1) % this->capacity;
@ -47,7 +47,7 @@ namespace ams::os {
uintptr_t MessageQueue::ReceiveInternal() {
/* Ensure we don't corrupt the queue, but this should never happen. */
AMS_ASSERT(this->count > 0);
AMS_ABORT_UNLESS(this->count > 0);
uintptr_t data = this->buffer[this->offset];
this->offset = (this->offset + 1) % this->capacity;
@ -57,7 +57,7 @@ namespace ams::os {
inline uintptr_t MessageQueue::PeekInternal() {
/* Ensure we don't corrupt the queue, but this should never happen. */
AMS_ASSERT(this->count > 0);
AMS_ABORT_UNLESS(this->count > 0);
return this->buffer[this->offset];
}