summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-09 18:39:23 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-11 16:12:33 -0400
commit4b19730c8234de3587bd50256fcb11660fb07388 (patch)
tree01a606ed8b66ea94ec482395b09c16762b9bc91a /configure.in
parent8a36f2125137dc31a0771a8eeac0f2bb8c1343d0 (diff)
downloadtor-4b19730c8234de3587bd50256fcb11660fb07388.tar.gz
tor-4b19730c8234de3587bd50256fcb11660fb07388.zip
Add a data-independent variant of memcmp and a d-i memeq function.
The tor_memcmp code is by Robert Ransom, and the tor_memeq code is by me. Both incorporate some ideas from DJB's stuff.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 1fddacaada..eead014a3d 100644
--- a/configure.in
+++ b/configure.in
@@ -626,6 +626,24 @@ if test "$tor_cv_twos_complement" != no ; then
[Define to 1 iff we represent negative integers with two's complement])
fi
+# What does shifting a negative value do?
+AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
+[AC_RUN_IFELSE([AC_LANG_SOURCE(
+[[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
+ [tor_cv_sign_extend=yes],
+ [tor_cv_sign_extend=no],
+ [tor_cv_sign_extend=cross])])
+
+if test "$tor_cv_sign_extend" = cross ; then
+ # Cross-compiling; let's hope that the target isn't raving mad.
+ AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
+fi
+
+if test "$tor_cv_sign_extend" != no ; then
+ AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
+ [Define to 1 iff right-shifting a negative value performs sign-extension])
+fi
+
# Whether we should use the dmalloc memory allocation debugging library.
AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
AC_ARG_WITH(dmalloc,