224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
** of four bytes.
*/
static unsigned int checksum(const char *zIn, size_t N){
static const int byteOrderTest = 1;
const unsigned char *z = (const unsigned char *)zIn;
const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
unsigned sum = 0;
assert( (3&(sqlite3_uint64)z)==0 ); /* Four-byte alignment */
if( 0==*(char*)&byteOrderTest ){
/* This is a big-endian machine */
while( z<zEnd ){
sum += *(unsigned*)z;
z += 4;
}
}else{
|
|
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
** of four bytes.
*/
static unsigned int checksum(const char *zIn, size_t N){
static const int byteOrderTest = 1;
const unsigned char *z = (const unsigned char *)zIn;
const unsigned char *zEnd = (const unsigned char*)&zIn[N&~3];
unsigned sum = 0;
assert( (z - (const unsigned char*)0)%4==0 ); /* Four-byte alignment */
if( 0==*(char*)&byteOrderTest ){
/* This is a big-endian machine */
while( z<zEnd ){
sum += *(unsigned*)z;
z += 4;
}
}else{
|