1 dnl @synopsis MN_C_CLIP_MODE
3 dnl Determine the clipping mode when converting float to int.
4 dnl @version 1.0 May 17 2003
5 dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
7 dnl Permission to use, copy, modify, distribute, and sell this file for any
8 dnl purpose is hereby granted without fee, provided that the above copyright
9 dnl and this permission notice appear in all copies. No representations are
10 dnl made about the suitability of this software for any purpose. It is
11 dnl provided "as is" without express or implied warranty.
19 dnl Find the clipping mode in the following way:
20 dnl 1) If we are not cross compiling test it.
21 dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
23 AC_DEFUN([MN_C_CLIP_MODE],
24 [AC_CACHE_CHECK(processor clipping capabilities,
27 # Initialize to unknown
28 ac_cv_c_clip_positive=unknown
29 ac_cv_c_clip_negative=unknown
32 if test $ac_cv_c_clip_positive = unknown ; then
35 #define _ISOC9X_SOURCE 1
36 #define _ISOC99_SOURCE 1
37 #define __USE_ISOC99 1
38 #define __USE_ISOC9X 1
44 fval = 1.0 * 0x7FFFFFFF ;
45 for (k = 0 ; k < 100 ; k++)
46 { ival = (lrint (fval)) >> 24 ;
56 ac_cv_c_clip_positive=yes,
57 ac_cv_c_clip_positive=no,
58 ac_cv_c_clip_positive=unknown
63 #define _ISOC9X_SOURCE 1
64 #define _ISOC99_SOURCE 1
65 #define __USE_ISOC99 1
66 #define __USE_ISOC9X 1
72 fval = -8.0 * 0x10000000 ;
73 for (k = 0 ; k < 100 ; k++)
74 { ival = (lrint (fval)) >> 24 ;
84 ac_cv_c_clip_negative=yes,
85 ac_cv_c_clip_negative=no,
86 ac_cv_c_clip_negative=unknown
90 if test $ac_cv_c_clip_positive = yes ; then
91 ac_cv_c_clip_positive=1
93 ac_cv_c_clip_positive=0
96 if test $ac_cv_c_clip_negative = yes ; then
97 ac_cv_c_clip_negative=1
99 ac_cv_c_clip_negative=0
103 case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
105 ac_cv_c_clip_type="none"
108 ac_cv_c_clip_type="positive"
111 ac_cv_c_clip_type="negative"
114 ac_cv_c_clip_type="both"