MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / DecompressAmount

Function DecompressAmount

src/compressor.cpp:169–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169uint64_t DecompressAmount(uint64_t x)
170{
171 // x = 0 OR x = 1+10*(9*n + d - 1) + e OR x = 1+10*(n - 1) + 9
172 if (x == 0)
173 return 0;
174 x--;
175 // x = 10*(9*n + d - 1) + e
176 int e = x % 10;
177 x /= 10;
178 uint64_t n = 0;
179 if (e < 9) {
180 // x = 9*n + d - 1
181 int d = (x % 9) + 1;
182 x /= 9;
183 // x = n
184 n = x*10 + d;
185 } else {
186 n = x+1;
187 }
188 while (e) {
189 n *= 10;
190 e--;
191 }
192 return n;
193}

Callers 4

SerializationOpMethod · 0.85
TestEncodeFunction · 0.85
TestDecodeFunction · 0.85
TestPairFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestEncodeFunction · 0.68
TestDecodeFunction · 0.68
TestPairFunction · 0.68