fixed the potential overflow issue that would never happen in various binary serach functions
This commit is contained in:
		| @ -91,11 +91,11 @@ subdir = tools | |||||||
| ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||||||
| am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ | am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ | ||||||
| 	$(top_srcdir)/m4/ax_cxx_namespace.m4 \ | 	$(top_srcdir)/m4/ax_cxx_namespace.m4 \ | ||||||
| 	$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \ | 	$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ | ||||||
| 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltargz.m4 \ | 	$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ | ||||||
| 	$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ | 	$(top_srcdir)/m4/ltargz.m4 $(top_srcdir)/m4/ltdl.m4 \ | ||||||
| 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ | 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | ||||||
| 	$(top_srcdir)/m4/lt~obsolete.m4 \ | 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | ||||||
| 	$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac | 	$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac | ||||||
| am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||||||
| 	$(ACLOCAL_M4) | 	$(ACLOCAL_M4) | ||||||
| @ -197,6 +197,10 @@ MKDIR_P = @MKDIR_P@ | |||||||
| MPICC = @MPICC@ | MPICC = @MPICC@ | ||||||
| MPI_CFLAGS = @MPI_CFLAGS@ | MPI_CFLAGS = @MPI_CFLAGS@ | ||||||
| MPI_CLDFLAGS = @MPI_CLDFLAGS@ | MPI_CLDFLAGS = @MPI_CLDFLAGS@ | ||||||
|  | MYSQL_CFLAGS = @MYSQL_CFLAGS@ | ||||||
|  | MYSQL_CONFIG = @MYSQL_CONFIG@ | ||||||
|  | MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ | ||||||
|  | MYSQL_VERSION = @MYSQL_VERSION@ | ||||||
| NM = @NM@ | NM = @NM@ | ||||||
| NMEDIT = @NMEDIT@ | NMEDIT = @NMEDIT@ | ||||||
| OBJDUMP = @OBJDUMP@ | OBJDUMP = @OBJDUMP@ | ||||||
|  | |||||||
| @ -147,7 +147,8 @@ function emit_bsearch (name, min, max, arr) { | |||||||
| 	printf ("\t\tint left = 0, right = QSE_COUNTOF(%s_range) - 1, mid; | 	printf ("\t\tint left = 0, right = QSE_COUNTOF(%s_range) - 1, mid; | ||||||
| 		while (left <= right) | 		while (left <= right) | ||||||
| 		{ | 		{ | ||||||
| 			mid = (left + right) / 2; | 			mid = left + (right - left) / 2; | ||||||
|  |  | ||||||
| 			if (c >= %s_range[mid].first && c <= %s_range[mid].last)  | 			if (c >= %s_range[mid].first && c <= %s_range[mid].last)  | ||||||
| 				return %s_range[mid].seg[c - %s_range[mid].first]; | 				return %s_range[mid].seg[c - %s_range[mid].first]; | ||||||
| 			else if (c > %s_range[mid].last)  | 			else if (c > %s_range[mid].last)  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user