Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2008-08-19 14:45:53


I just added an optimization to some code for systems with octet-
sized bytes. I have such a system; so I tested that code. I added a
further optimization for little-endian systems. Unfortunately, my
computer is big-endian, so I have no way to test the second change.
So if you have access to a computer with octet-sized bytes (CHAR_BIT
== 8) and larger integers in little-endian format, can you help?

The code is on our Subversion server, in the sandbox section, just
checked in as revision 48224. Check-out or export the <http://
svn.boost.org/svn/boost/sandbox/md5> directory. The headers are in
the "boost" subdirectory, of course. There is one mandatory source
file at "libs/coding/src/md5.cpp". There are three test files at
"libs/coding/test/md5*test.cpp". Compile all those together with our
Unit Test and Serialization libraries. (On my system, I made a
project file with a three sub-targets: Boost.Test unit-test,
Boost.S11N, and md5.cpp; which the target with the test files
compiled linked to.)

The "md5.cpp" has the optimized code. The optimized code doesn't
activate unless CHAR_BIT is 8 and the file's
BOOST_CONTROL_OPTIMIZE_OCTET_BYTES macro is set (or overridden) to
1. The little-endian extra optimization is activated with the
BOOST_LITTLE_ENDIAN macro and is mandatory (if valid). I added three
now-commented-out #error lines to test which case was activated,
which confirmed I'm using a not-little endian system. You can un-
comment those to check for yourself. Let me know if the little
endian code works, or tell me how to fix it (if not). If you want,
you can comment-out the little endian code to test the endian-
agnostic code, and then redefine or override
BOOST_CONTROL_OPTIMIZE_OCTET_BYTES to be 0 to test the octet-agnostic
code (which explodes the packed array into a bool array before
combining).

Thanks in advance....

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk