mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(big): add SBigMul
This commit is contained in:
parent
e74654800d
commit
6e96e0a767
11 changed files with 179 additions and 0 deletions
29
storm/big/BigStack.cpp
Normal file
29
storm/big/BigStack.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue