BAN: Add min, max and clamp

This commit is contained in:
2022-12-30 19:52:16 +02:00
parent ef0b2010e0
commit b60af90538
4 changed files with 30 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include <BAN/Errors.h>
#include <BAN/Math.h>
#include <BAN/Memory.h>
#include <assert.h>
#include <string.h>
#include <sys/param.h>
namespace BAN
{
@@ -208,7 +208,7 @@ namespace BAN
{
if (m_capasity >= size)
return {};
size_type new_cap = MAX(size, m_capasity * 1.5f);
size_type new_cap = BAN::max<size_type>(size, m_capasity * 1.5f);
void* new_data = BAN::allocator(new_cap * sizeof(T));
if (new_data == nullptr)
return Error::FromString("Vector: Could not allocate memory");