diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index e45bdba..bf3ca47 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -1610,7 +1610,7 @@ goto Exit; } - offset = cur_len % 64; + offset = cur_len & 63; if ( offset < 32 ) { diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 356b156..2f1ba6a 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -771,7 +771,7 @@ return 1; } - return ( n % 2 ); + return n & 1; } diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index f013425..abf17f2 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -1513,11 +1513,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 4n or 4n+1, */ - /* we reduce it to 4n+1 */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; if ( cff_builder_start_point( builder, x, y ) ) goto Fail; @@ -1560,11 +1558,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 4n or 4n+1, */ - /* we reduce it to 4n+1 */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; if ( cff_builder_start_point( builder, x, y ) ) goto Fail; @@ -1612,11 +1608,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ - /* we reduce it to the largest one which fits */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; args -= nargs; if ( check_points( builder, ( nargs / 4 ) * 3 ) ) diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h index 35c043d..814ae16 100644 --- a/src/gxvalid/gxvcommn.h +++ b/src/gxvalid/gxvcommn.h @@ -316,7 +316,7 @@ FT_BEGIN_HEADER #define GXV_32BIT_ALIGNMENT_VALIDATE( a ) \ FT_BEGIN_STMNT \ { \ - if ( 0 != ( (a) % 4 ) ) \ + if ( (a) & 3 ) \ FT_INVALID_OFFSET ; \ } \ FT_END_STMNT diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c index 46792bb..d82b14c 100644 --- a/src/gxvalid/gxvfeat.c +++ b/src/gxvalid/gxvfeat.c @@ -176,7 +176,7 @@ setting = FT_NEXT_USHORT( p ); /* If we have exclusive setting, the setting should be odd. */ - if ( exclusive && ( setting % 2 ) == 0 ) + if ( exclusive && ( setting & 1 ) == 0 ) FT_INVALID_DATA; gxv_feat_name_index_validate( p, limit, valid );