| 1361 | } |
| 1362 | |
| 1363 | void Integer::Decode(const byte *input, unsigned int inputLen, Signedness s) |
| 1364 | { |
| 1365 | sign = ((s==SIGNED) && (input[0] & 0x80)) ? NEGATIVE : POSITIVE; |
| 1366 | |
| 1367 | while (input[0]==0 && inputLen>0) |
| 1368 | { |
| 1369 | input++; |
| 1370 | inputLen--; |
| 1371 | } |
| 1372 | |
| 1373 | reg.CleanNew(RoundupSize(bytesToWords(inputLen))); |
| 1374 | |
| 1375 | for (unsigned i=0; i<inputLen; i++) |
| 1376 | reg[i/WORD_SIZE] |= input[inputLen-1-i] << (i%WORD_SIZE)*8; |
| 1377 | |
| 1378 | if (sign == NEGATIVE) |
| 1379 | { |
| 1380 | for (unsigned i=inputLen; i<reg.size*WORD_SIZE; i++) |
| 1381 | reg[i/WORD_SIZE] |= 0xff << (i%WORD_SIZE)*8; |
| 1382 | TwosComplement(reg, reg.size); |
| 1383 | } |
| 1384 | } |
| 1385 | |
| 1386 | unsigned int Integer::MinEncodedSize(Signedness signedness) const |
| 1387 | { |
no test coverage detected