diff options
author | uema2 <uema2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-19 10:02:57 +0000 |
---|---|---|
committer | uema2 <uema2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-19 10:02:57 +0000 |
commit | c7d2ebd71ee024db66c1630fed24d83fead4ac35 (patch) | |
tree | 9ce72e7e90dd4f9d964cb976e68667637ce39c6a /wince | |
parent | 6d696136d53d8cce2e2b931abdc3dae248894954 (diff) |
* wince/stdlib.c: add bsearch().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'wince')
-rw-r--r-- | wince/stdlib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/wince/stdlib.c b/wince/stdlib.c index a2ac340de4..d371b12f88 100644 --- a/wince/stdlib.c +++ b/wince/stdlib.c @@ -37,3 +37,21 @@ int mblen(const char *mbstr, size_t count) return n; } + +void *bsearch( const void *key, const void *base, + size_t num, size_t width, + int ( __cdecl *compare )(const void *, const void *)) +{ + size_t i; + const void* p = base; + const char* px; + + for( i=0; i<num; i++ ) + { + if( 0==compare( key, p ) ) + return (void*)p; + px = (const char*)p; px+=width; p=(const void*)px; + } + return NULL; +} + |