mirror of https://github.com/freetype/freetype
* src/sfnt/sfwoff2.c (compute_ULong_sum): Clean up.
This commit is contained in:
parent
2c9691e7c1
commit
13da904267
|
@ -289,7 +289,6 @@
|
|||
FT_ULong checksum = 0;
|
||||
FT_ULong aligned_size = size & ~3UL;
|
||||
FT_ULong i;
|
||||
FT_ULong v;
|
||||
|
||||
|
||||
for ( i = 0; i < aligned_size; i += 4 )
|
||||
|
@ -298,14 +297,9 @@
|
|||
( (FT_ULong)buf[i + 2] << 8 ) |
|
||||
( (FT_ULong)buf[i + 3] << 0 );
|
||||
|
||||
/* If size is not aligned to 4, treat as if it is padded with 0s. */
|
||||
if ( size != aligned_size )
|
||||
{
|
||||
v = 0;
|
||||
for ( i = aligned_size ; i < size; ++i )
|
||||
v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) );
|
||||
checksum += v;
|
||||
}
|
||||
/* remaining bytes can be shifted and added one at a time */
|
||||
for ( ; i < size; ++i )
|
||||
checksum += (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) );
|
||||
|
||||
return checksum;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue