From: Adam Dickmeiss Date: Tue, 8 Mar 2005 14:41:37 +0000 (+0000) Subject: Fix endless loop in log2_int for negative values for input X-Git-Tag: snippet.version.1~120 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=71ef94163cc848e4ed12965238087d2505c42c05 Fix endless loop in log2_int for negative values for input --- diff --git a/index/rank1.c b/index/rank1.c index 7792647..029f5de 100644 --- a/index/rank1.c +++ b/index/rank1.c @@ -1,4 +1,4 @@ -/* $Id: rank1.c,v 1.23 2005-03-08 14:02:12 adam Exp $ +/* $Id: rank1.c,v 1.24 2005-03-08 14:41:37 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -59,6 +59,8 @@ struct rank_set_info { static int log2_int (zint g) { int n = 0; + if (g < 0) + return 0; while ((g = g>>1)) n++; return n;