feat(big): add SBigMul

This commit is contained in:
fallenoak 2023-01-30 00:10:52 -06:00 committed by GitHub
parent e74654800d
commit 6e96e0a767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 179 additions and 0 deletions

29
storm/big/BigStack.cpp Normal file
View file

@ -0,0 +1,29 @@
#include "storm/big/BigStack.hpp"
BigBuffer& BigStack::Alloc(uint32_t* count) {
STORM_ASSERT(this->m_used < SIZE);
if (count) {
(*count)++;
}
auto& buffer = this->m_buffer[this->m_used];
this->m_used++;
return buffer;
}
void BigStack::Free(uint32_t count) {
this->m_used -= count;
}
BigBuffer& BigStack::MakeDistinct(BigBuffer& orig, int32_t required) {
return required ? this->Alloc(nullptr) : orig;
}
void BigStack::UnmakeDistinct(BigBuffer& orig, BigBuffer& distinct) {
if (&orig != &distinct) {
orig = distinct;
this->Free(1);
}
}