BSPParser
Simple and modern library for parsing the Valve BSP format
Loading...
Searching...
No Matches
check-bounds.hpp
1#pragma once
2
3#include "../errors.hpp"
4#include <cstddef>
5
6namespace BspParser::Internal {
7 inline void checkBounds(const size_t offset, const size_t count, const size_t rangeSize, const char* errorMessage) {
8 if (offset >= rangeSize || offset + count > rangeSize) {
9 throw Errors::OutOfBoundsAccess(Enums::Lump::None, errorMessage);
10 }
11 }
12}