| 355 | } |
| 356 | |
| 357 | int TinyDictWordList::find( const char * prefix ) |
| 358 | { |
| 359 | if ( !count ) |
| 360 | return -1; |
| 361 | int a = 0; |
| 362 | int b = count; |
| 363 | for ( ;a < b-1; ) { |
| 364 | int c = (a + b) / 2; |
| 365 | int res = list[c]->compare( prefix ); |
| 366 | if ( !res ) |
| 367 | return c; |
| 368 | if ( res < 0 ) { |
| 369 | a = c + 1; |
| 370 | } else { |
| 371 | b = c; |
| 372 | } |
| 373 | } |
| 374 | if ( a==0 || list[a]->compare( prefix )<0 ) |
| 375 | return a; |
| 376 | return a - 1; |
| 377 | } |
| 378 | |
| 379 | bool TinyDictWord::match( const char * str, bool exact ) const |
| 380 | { |