2025-03-07 09:25:11 +01:00
|
|
|
#include "global.h"
|
|
|
|
|
|
2025-03-06 06:25:31 +01:00
|
|
|
#include "internal.hpp"
|
|
|
|
|
|
2025-03-07 09:25:11 +01:00
|
|
|
ABC_NAMESPACE_IMPL_START
|
|
|
|
|
|
2025-03-06 06:25:31 +01:00
|
|
|
namespace CaDiCaL {
|
|
|
|
|
|
|
|
|
|
Arena::Arena (Internal *i) {
|
|
|
|
|
memset (this, 0, sizeof *this);
|
|
|
|
|
internal = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Arena::~Arena () {
|
|
|
|
|
delete[] from.start;
|
|
|
|
|
delete[] to.start;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Arena::prepare (size_t bytes) {
|
|
|
|
|
LOG ("preparing 'to' space of arena with %zd bytes", bytes);
|
2025-03-07 09:25:11 +01:00
|
|
|
CADICAL_assert (!to.start);
|
2025-03-06 06:25:31 +01:00
|
|
|
to.top = to.start = new char[bytes];
|
|
|
|
|
to.end = to.start + bytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Arena::swap () {
|
|
|
|
|
delete[] from.start;
|
|
|
|
|
LOG ("delete 'from' space of arena with %zd bytes",
|
|
|
|
|
(size_t) (from.end - from.start));
|
|
|
|
|
from = to;
|
|
|
|
|
to.start = to.top = to.end = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace CaDiCaL
|
2025-03-07 09:25:11 +01:00
|
|
|
|
|
|
|
|
ABC_NAMESPACE_IMPL_END
|