Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
Rune*
5
_runebsearch(Rune c, Rune *t, int n, int ne)
6
{
7
	Rune *p;
8
	int m;
9
 
10
	while(n > 1) {
11
		m = n/2;
12
		p = t + m*ne;
13
		if(c >= p[0]) {
14
			t = p;
15
			n = n-m;
16
		} else
17
			n = m;
18
	}
19
	if(n && c >= t[0])
20
		return t;
21
	return 0;
22
}