Files
OpenCellular/chip
Vadim Bendebury a7d440eaec cr50: compress array of prime deltas
The array storing deltas between sequential prime numbers could be
compressed, as the vast majority of the values in the array does not
require more than 4 buts to store.

The new storage format is as follows:

 - each differential value (difference between two consecutive primes)
   is halved and stored in 4 bits, two halved values are packed per
   byte.

 - I the first one of of the two sequential halved values exceeds 0xf,
   it is stored in the array followed by a zero, stored as is (without
   halving), thus taking two bytes.

 - if the second one of the two sequential halved values exceeds 0xf,
   both values are stored in the array as is, both prepended by zeros,
   thus taking 4 bytes.

The code calculating the sequential primes parses the array according
to this format. Storing the primes in this format allows to shave from
the image size 1848 bytes.

BRANCH=cr50
BUG=b:65253310, b:65287300
TEST=verified that test_rsa test from the tpmtest suite passes.

     verified that the list of prime numbers printed out when
     PRINT_PRIMES is defined and test_rsa is ran is the same before
     and after this patch.

Change-Id: Ifdc2858a48f868ef816ccb4e351d9f60703d16e7
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/664253
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2017-09-27 12:58:00 -07:00
..
2017-09-27 12:58:00 -07:00
2017-09-07 15:01:05 -07:00
2017-09-07 15:01:05 -07:00
2017-09-07 15:01:05 -07:00
2017-09-07 15:01:05 -07:00
2017-09-07 15:01:05 -07:00
2017-09-22 10:18:50 -07:00