Project

General

Profile

« Previous | Next » 

Revision 10154

*{.sh,run}: use new log-() instead of log+() with a negative #

View differences:

binsearch.sh
9 9
	echo_func; kw_params min max; : "${min?}" "${max?}"
10 10
	local min="$min" max="$max" i iter_num=0
11 11
	while true; do
12
		log+ -2 echo_vars iter_num # it will always take log2(max - min) iters
12
		log- 2 echo_vars iter_num # it will always take log2(max - min) iters
13 13
		
14 14
		i=$(( (min + max)/2 ))
15
		log+ -2 echo_vars min max i
15
		log- 2 echo_vars min max i
16 16
		if ! (( i > min )); then break; fi
17 17
		if echo_run "$@"; then min="$i"; else max="$i"; fi
18 18
		

Also available in: Unified diff