tdutils: revert tosimple AesBlock::inc implementation

GitOrigin-RevId: 7f894bb710e32b6573603f3500c35daf0752cf02
This commit is contained in:
Arseny Smirnov 2020-06-15 22:38:31 +03:00
parent 132caf5c8f
commit 53b0a74f87

View File

@ -78,13 +78,12 @@ struct alignas(8) AesBlock {
AesBlock inc() const {
AesBlock res;
res.lo = bswap64(bswap64(lo) + 1);
if (res.lo == 0) {
res.hi = bswap64(bswap64(hi) + 1);
} else {
res.hi = hi;
auto ptr = res.raw();
for (int i = 15; i >= 0; i--) {
if (++ptr[i] != 0) {
break;
}
}
return res;
}
};