File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed
Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ # fixed.dfa
2+ # Build time configuration of libpng
3+ #
4+ # Author: John Bowler
5+ # Copyright: (c) John Bowler, 2025
6+ # Usage rights:
7+ # To the extent possible under law, the author has waived all copyright and
8+ # related or neighboring rights to this work. This work is published from:
9+ # United States.
10+ #
11+ # Test the standard libpng configuration without floating point (the internal
12+ # fixed point implementations are used instead).
13+ #
14+ option FLOATING_ARITHMETIC off
15+ option FLOATING_POINT off
Original file line number Diff line number Diff line change 1+ # fixed-float.dfa
2+ # Build time configuration of libpng
3+ #
4+ # Author: John Bowler
5+ # Copyright: (c) John Bowler, 2025
6+ # Usage rights:
7+ # To the extent possible under law, the author has waived all copyright and
8+ # related or neighboring rights to this work. This work is published from:
9+ # United States.
10+ #
11+ # Test the standard libpng configuration with the fixed point internal
12+ # implementation in place of the default floating point
13+ #
14+ option FLOATING_ARITHMETIC off
Original file line number Diff line number Diff line change @@ -2931,6 +2931,30 @@ png_gamma_significant(png_fixed_point gamma_val)
29312931 gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED ;
29322932}
29332933
2934+ #ifndef PNG_FLOATING_ARITHMETIC_SUPPORTED
2935+ /* A local convenience routine. */
2936+ static png_fixed_point
2937+ png_product2 (png_fixed_point a , png_fixed_point b )
2938+ {
2939+ /* The required result is a * b; the following preserves accuracy. */
2940+ #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* Should now be unused */
2941+ double r = a * 1E-5 ;
2942+ r *= b ;
2943+ r = floor (r + .5 );
2944+
2945+ if (r <= 2147483647. && r >= -2147483648. )
2946+ return (png_fixed_point )r ;
2947+ #else
2948+ png_fixed_point res ;
2949+
2950+ if (png_muldiv (& res , a , b , 100000 ) != 0 )
2951+ return res ;
2952+ #endif
2953+
2954+ return 0 ; /* overflow */
2955+ }
2956+ #endif /* FLOATING_ARITHMETIC */
2957+
29342958png_fixed_point
29352959png_reciprocal2 (png_fixed_point a , png_fixed_point b )
29362960{
You can’t perform that action at this time.
0 commit comments