summaryrefslogtreecommitdiff
path: root/src/sole.c
AgeCommit message (Collapse)Author
2014-12-29Check for zero-length input (do nothing)Thomas Jespersen
2014-12-21Remove lots of debugging statementsThomas Jespersen
2014-12-10Breaking changeThomas Jespersen
2014-12-09Rename r to r_nextThomas Jespersen
Clarifies that this is the next remainder we're extracting
2014-12-09Fix an obvious mistake and compiler warningsThomas Jespersen
The u64() macro is now for _casting_ as uint64_t, whereas the u64c() macro is for declaring a uint64_t constant (literally appending ULL).
2014-12-08Add header files to configure.ac and typedefs to common.hThomas Jespersen
2014-12-07First round at making decoding work.Thomas Jespersen
TODO: Obvious test fails - fix it
2014-12-07DocumentationThomas Jespersen
2014-12-07Implement stream re-alignment when given input does not alignThomas Jespersen
Implement sole_encode_realign() which takes care of re-aligning the way the input is read. An arbitrary byte buffer might not be 32-byte aligned, which causes the stream to be misaligned. Given a fresh buffer, we must first ensure that we re-align with 32 bytes.
2014-12-07Fix minor error in sole_encode_end()Thomas Jespersen
Identifying whether we received odd or even blocks didn't query the correct size.
2014-12-07Fix output byte orderingThomas Jespersen
2014-12-07Big changes to streaming algorithmThomas Jespersen
Essentially modelled on zlib's API, which requires some setup from the user, but also offers a lot of flexibility. - Add inp and outp pointers to input and output respectively - Require set sizes for data available in input and output
2014-12-06Fix erroneous composition for double EOF with even blocksThomas Jespersen
Now cmd-sole and sole_file agree on 64-bit output.
2014-12-06Adjust cmd-sole to compose the blocks the same way sole_file sees itThomas Jespersen
2014-12-06Minor changes to sole.cThomas Jespersen
2014-12-06Add direct conversion from 128-bit blocks to 64-bit blocksThomas Jespersen
2014-12-04Fix apparent byte manglingThomas Jespersen
Haskell and C implementations now read the input in the same way. So they should produce the same output.
2014-12-04Add byte output to both examples/sole_file and poc/cmd-soleThomas Jespersen
Their byte output should be the same (just allows us to inspect that the data is processed identically)
2014-12-01Add total bytes read counter to sole_streamThomas Jespersen
TODO REALLY IMPORTANT! Check sole_encode_file() reads input in the "correct" order. One way to see this is to finish the poc/cmd-sole tool and have it output a 64-bit block view of a file (and compare outputs)
2014-12-01Remove sole_mul_i3() and organise some testsThomas Jespersen
2014-11-24Move include lines into sole headerThomas Jespersen
2014-11-21Use available macros in sole_pass1_decompose()Thomas Jespersen
Checking for i3 == 0 and setting rem both have macros that do this. Use them.
2014-11-20Add small correction step for quotient found by double divisionThomas Jespersen
2014-11-19Replace iterating addition with multiplicationThomas Jespersen
2014-11-19Add 128-bit block multiplications and basic testing.Thomas Jespersen
I'm pretty confident this works, and it should be pretty useful later on. More testing is required though.
2014-11-19Write TODOsThomas Jespersen
2014-11-18Add multiplication routine to blk256Thomas Jespersen
For multiplying with a 128-bit number. Needs testing. Provide declaration for blk256_div_blk128()
2014-11-11Document sole_mul_b3i()Thomas Jespersen
Get rid of previous implementation and use only the multiplication version (it should in the general case be faster). Document the multiplication procedure.
2014-11-11Document division trick and fix bug in sole_pass2_rev_regroup()Thomas Jespersen
The intermediate dividend in sole_pass2_rev_regroup() was extracted wrong, which caused the correct numbers to appear, but in the wrong places.
2014-11-11Fix numerous errors and work on faster divisionThomas Jespersen
Given a three-digit number x=(x3,x2,x1) that we want to divide by a two-digit number say y=(y2,y1) we can always take out x3 times y when x3 > 0 and add that to the relevant part of the quotient. Using this observation can save lots of time by doing a multiplication and a subtraction instead of x3 subtractions. Furthermore, the blk256_sub() function turned out to be broken and untested, so implement rudimentary tests and fix the errors.
2014-11-09Correct BLK256SIZ, so it actually represents four times u64Thomas Jespersen
Rename strm->outfd to strm->out, and correct a few things in sole_file.c Expand on the sole_encode_file() function and actually begin to process files. As predicted the division performs poorly...
2014-11-08Add test for sole_pass2_rev_regroup()Thomas Jespersen
This test perfectly demonstrates how a better strategy for performing the division is required.
2014-11-07Add test for sole_pass1_decompose()Thomas Jespersen
2014-11-07Get rid of temporaries in sole_pass1_rev_compose()Thomas Jespersen
The results are computed directly in the output parameters x and y
2014-11-07Rewrite of sole_pass1_rev_compose()Thomas Jespersen
Only one instance of computing y
2014-11-07Fix carry subtraction in sole_pass1_rev_compose()Thomas Jespersen
2014-11-07Lots of testingThomas Jespersen
Tests for sole_pass1_rev_compose(), with fixes.
2014-11-07Add final steps in decoding SOLEThomas Jespersen
This adds sole_pass1_rev_decompose() which reverses the decomposition step in pass 1. Also add sole_pass1_rev_compose() which reverses the composition step in pass 1.
2014-11-06First attempt add sole_pass2_rev_regroup.Thomas Jespersen
This step should, for a given double-block, reverse to enumerated computation and produce the quotient and remainder (intermediate results from pass1). The division implemented is long division for which I predict very poor results as the divisior B+3i forces us to use three 64-bit blocks during the division phase instead of two. This most likely leads to poor performance, since the third block in B+3i is always 1 (the smallest possible), and potentially needs to be subtracted 2^64 times from the third block of the dividend.
2014-11-06Fix minor mistakes to make it compile againThomas Jespersen
2014-11-06A few changesThomas Jespersen
Add even-block handling as introduced in branch 'debug'. This is just a copy (no merge) Introduce sole_stream_free() in the API, allowing users to explicitly freeing a sole_stream. This could be useful in error situations where the stream needs to be abandoned before completion.
2014-11-05WhitespaceThomas Jespersen
2014-11-05Reduce addition and copy to directly output addition in ropThomas Jespersen
2014-11-04Remove print statements introduced by debug branchThomas Jespersen
2014-11-04Bring division under controlThomas Jespersen
Implement simple long division to reduce running time. There are still remaining errors, so the [5, 7, (2^128)-1] example still doesn't seem to give the right result (but it is close)
2014-11-03Add lots of debugging statements to find bottle-necksThomas Jespersen
Also detect infinite loops
2014-11-03Implement the odd-n termination procedure.Thomas Jespersen
And swap x and &w in blk256_add() as x may equal the output operator, but we know &w is different than rop.
2014-11-03Expand on the termination in 'sole_encode_end()'Thomas Jespersen
Closing a stream by calling sole_encode_end() takes care of finalising the stream with proper EOF indication. Currently the representation of 128-bit blocks makes handling EOF a little clunky (for example the compose() function cannot be used directly). Also, regroup() didn't properly handle the case where the output destination was the same as the larger input. Signed-off-by: Thomas Jespersen <laumann.thomas@gmail.com>
2014-11-03Add TODO on byte-size in write()'sThomas Jespersen
2014-11-03Fix namingThomas Jespersen