mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(big): add SBigIsZero
This commit is contained in:
parent
c9826d2336
commit
1cad63b7f2
5 changed files with 33 additions and 0 deletions
|
|
@ -81,6 +81,10 @@ int32_t SBigIsOne(BigData* a) {
|
|||
return IsOne(a->Primary());
|
||||
}
|
||||
|
||||
int32_t SBigIsZero(BigData* a) {
|
||||
return IsZero(a->Primary());
|
||||
}
|
||||
|
||||
void SBigMod(BigData* a, BigData* b, BigData* c) {
|
||||
uint32_t allocCount = 0;
|
||||
auto& scratch = a->Stack().Alloc(&allocCount);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ int32_t SBigIsOdd(BigData* a);
|
|||
|
||||
int32_t SBigIsOne(BigData* a);
|
||||
|
||||
int32_t SBigIsZero(BigData* a);
|
||||
|
||||
void SBigMod(BigData* a, BigData* b, BigData* c);
|
||||
|
||||
void SBigMul(BigData* a, BigData* b, BigData* c);
|
||||
|
|
|
|||
|
|
@ -225,6 +225,11 @@ int32_t IsOne(const BigBuffer &num) {
|
|||
return num.Count() == 1 && num[0] == 1;
|
||||
}
|
||||
|
||||
int32_t IsZero(const BigBuffer &num) {
|
||||
num.Trim();
|
||||
return num.Count() == 0;
|
||||
}
|
||||
|
||||
uint64_t MakeLarge(uint32_t low, uint32_t high) {
|
||||
return low + (static_cast<uint64_t>(high) << 32);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ int32_t IsOdd(const BigBuffer &num);
|
|||
|
||||
int32_t IsOne(const BigBuffer &num);
|
||||
|
||||
int32_t IsZero(const BigBuffer &num);
|
||||
|
||||
uint64_t MakeLarge(uint32_t low, uint32_t high);
|
||||
|
||||
void Mul(BigBuffer& a, const BigBuffer& b, uint64_t c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue