From: Daryle Walker (darylew_at_[hidden])
Date: 2001-03-25 09:42:38
on 3/23/01 10:29 AM, Joel Young at jdy_at_[hidden] wrote:
> Thanks for this email. I think that it could very easily become part of
> the documentation for crc. Especially the discussion of the two
> philosophies. Would it be reasonable to include an interface supporting
> "philosophy 1" using the "philosophy 2" code with initial remainder=0,
> XOR val=0, and reflections set to false?
The core bit manipulations are ordered differently between the philosophies,
so you can't use code from one to work the other.
> My problem came from trying to switch from a black-box crc computer,
> where even the polynomial used is only implicitly documented by the
> nest of loops, which implemented philosophy 1.
In the latest version (10), I've added two function templates,
augmented_crc, that operate on a set of bytes using philosophy 1. (I use
two functions because my compiler, Metrowerks CodeWarrior Pro 5.3/Mac,
didn't accept a default argument.) The buffer would hold the data and space
for the CRC directly afterwards. Set that CRC space to zeros and run the
function over the entire buffer to calculate the CRC. Set the CRC space to
the result and running the function over the buffer again should get zero as
the new answer.
I've also added the ability to reset the interim remainder of a CRC computer
object. This lets you reuse a computer for a new calculation after
finishing another calculation before the scope ends. You can't change the
other parameters, though.
The example file tests both additions.
> I am going to be OCONUS for a week so I'll check out the new(est)
> version of CRC when I get back.
What does "OCONUS" stand for?
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk