mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(big): add SBigShr
This commit is contained in:
parent
4a1b6a0f19
commit
af0d9ec60e
5 changed files with 202 additions and 0 deletions
|
|
@ -170,6 +170,24 @@ void SetZero(BigBuffer& buffer) {
|
|||
buffer.Clear();
|
||||
}
|
||||
|
||||
void Shr(BigBuffer& a, const BigBuffer& b, uint32_t shift) {
|
||||
auto v4 = shift >> 5;
|
||||
auto v9 = shift & 0x1F;
|
||||
|
||||
uint32_t i = 0;
|
||||
for (i = 0; b.IsUsed(i + v4); i++) {
|
||||
auto v6 = b[i + v4] >> v9;
|
||||
|
||||
if (v9) {
|
||||
v6 += b[i + v4 + 1] << (32 - v9);
|
||||
}
|
||||
|
||||
a[i] = v6;
|
||||
}
|
||||
|
||||
a.SetCount(i);
|
||||
}
|
||||
|
||||
void Square(BigBuffer& a, const BigBuffer& b, BigStack& stack) {
|
||||
auto& aa = stack.MakeDistinct(a, &a == &b);
|
||||
aa.Clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue