Comment Re:Compactness and Readability (Score 1) 298
Yeah, I forgot to include
// Reference: http://www.ifp.illinois.edu/~sarwate/pubs/Sarwate88Computing.pdf
Yeah, I forgot to include
// Reference: http://www.ifp.illinois.edu/~sarwate/pubs/Sarwate88Computing.pdf
> What the hell is this?
The 8th entry is set to zero so that the test can verify the table was initialized properly.
> 4))
> Why is there a block comment at the beginning that does nothing.
For alignment of CRC32_REVERSE, CRC32_VERIFY, CRC32_Table since
> and what the hell does that trailing comment mean?
The comments lists entries [0] and [1]. The first 8 entries are these :
i.e. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
Whenever you generate a table it is always helpful to list _expected_ values so someone can _verify_ them with _actual_ values.
Let's let at the clusterfuck of Boost's CRC code
1109 lines of over-engineered C++ crap for a simple CRC32 function!?!?
Now compare that to these simple 27 lines of C/C++ code.
#include <stdint.h>
const uint32_t CRC32_REVERSE = 0xEDB88320;// reverse = shift right
const uint32_t CRC32_VERIFY = 0xCBF43926;// "123456789" -> 0xCBF43926
/* */ uint32_t CRC32_Table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };// i.e. 0x00000000, 0x77073096,
void crc32_init()
{
for( short byte = 0; byte < 256; byte++ )
{
uint32_t crc = (uint32_t) byte;
for( char bit = 0; bit < 8; bit++ )
if( crc & 1 ) crc = (crc >> 1) ^ CRC32_REVERSE;// reverse/reflected Form
else/* = 0*/ crc = (crc >> 1);
CRC32_Table[ byte ] = crc;
}
if( CRC32_Table[8] != (CRC32_REVERSE >> 4))
printf("ERROR: CRC32 Table not initialized properly!\n");
}
uint32_t crc32_buffer( const char *pData, uint32_t nLength )
{
uint32_t crc = (uint32_t) -1 ;// Optimization: crc = CRC32_INIT;
while( nLength-- > 0 )
crc = CRC32_Table[ (crc ^ *pData++) & 0xFF ] ^ (crc >> 8);
return ~crc;// Optimization: crc ^= CRC32_DONE
}
Typical bloated code solves some theoretical "general purpose" solution. Good code does one thing well:
It communicates clearly what it is trying to do.
_When_ was the last time you actually needed a different CRC function from the standard 32-bit one?
Same.
Clerk: "Phone Number?"
Me: "Cash Customer"
Clerk. "OK." They skip entering any more info in.
> You're just being a dick and making the security guard's job more difficult.
Somebody call the wahmbulance simply because somebody is sticking up for their rights.
Fry's and Costco nazi's can go fuck themselves. They don't _have_ to like it, but it is the LAW.
> Optimizing memory is a dying skill,
It is now called Data Orientated Design.
Google+ Group
* https://plus.google.com/+Datao...
Data-Oriented Design and C++
* https://www.youtube.com/watch?...
Typical C++ Bullshit
* http://macton.smugmug.com/gall...
Pitfalls of Object Oriented Programming
* http://research.scee.net/files...
* http://www.slideshare.net/royc...
Ad hominem fallacy. The reasons _why_ I hate PHP are irrelevant.
PHP is a shit design language. Education is the only way to get people to see its problems.
> They either don't notice it,
Typical head in the sand. Ignoring a problem doesn't make it go away.
> work around it,
Sometimes you can, however one can't work around fundamental inconsistency embedded in the design.
> or work in the language with such a level of abstraction that they are not a problem.
Exactly; They use a better designed language.
Or maybe he respected her.
Nah, let's remain myopic.
You won't be laughing by 2024.
When X-Files originally aired it was fresh. 9 seasons later they just waffled back and forth with absolutely no closure.
Fans got tired of Christ Carter not having any balls to commit one way or another.
And men are underrepresented in giving birth.
Translation: No one give a shit about a non-issue
"When the going gets tough, the tough get empirical." -- Jon Carroll