]> icculus.org git repositories - icculus/xz.git/blob - m4/ax_c_arithmetic_rshift.m4
Take advantage of arithmetic right shift in range decoder.
[icculus/xz.git] / m4 / ax_c_arithmetic_rshift.m4
1 ##### http://autoconf-archive.cryp.to/ax_c_arithmetic_rshift.html
2 #
3 # SYNOPSIS
4 #
5 #   AX_C_ARITHMETIC_RSHIFT
6 #
7 # DESCRIPTION
8 #
9 #   Checks if the right shift operation is arithmetic.
10 #
11 #   This macro uses compile-time detection and so is cross-compile
12 #   ready.
13 #
14 # LAST MODIFICATION
15 #
16 #   2006-12-12
17 #
18 # COPYLEFT
19 #
20 #   Copyright (c) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
21 #
22 #   Copying and distribution of this file, with or without
23 #   modification, are permitted in any medium without royalty provided
24 #   the copyright notice and this notice are preserved.
25
26 AC_DEFUN([AX_C_ARITHMETIC_RSHIFT], [
27   AC_CACHE_CHECK([whether right shift operation is arithmetic],
28                  [ax_cv_c_arithmetic_rshift],
29                  [AC_COMPILE_IFELSE([[int dummy[((-1 >> 1) < 0) ? 1 : -1];]],
30                                     [ax_cv_c_arithmetic_rshift=yes],
31                                     [ax_cv_c_arithmetic_rshift=no])])
32   if test "x$ax_cv_c_arithmetic_rshift" = xyes; then
33     AC_DEFINE([HAVE_ARITHMETIC_RSHIFT], [1],
34               [Define to 1 if the right shift operation is arithmetic.])
35   fi
36 ])