changeset 6343:372613d5970b

(search_buffer): Avoid boolean/integer mixing that confuses some compilers.
author Karl Heuer <kwzh@gnu.org>
date Mon, 14 Mar 1994 21:44:12 +0000
parents c9e33093c488
children 4ef6b636dc99
files src/search.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Mon Mar 14 21:36:58 1994 +0000
+++ b/src/search.c	Mon Mar 14 21:44:12 1994 +0000
@@ -822,7 +822,10 @@
 	 of pattern would align in a possible match.  */
       while (n != 0)
 	{
-	  if ((lim - pos - (direction > 0)) * direction < 0)
+	  /* It's been reported that some (broken) compiler thinks that
+	     Boolean expressions in an arithmetic context are unsigned.
+	     Using an explicit ?1:0 prevents this.  */
+	  if ((lim - pos - ((direction > 0) ? 1 : 0)) * direction < 0)
 	    return (n * (0 - direction));
 	  /* First we do the part we can by pointers (maybe nothing) */
 	  QUIT;