- int lo,
- hi,
- cmp,
- result;
- lo = 0;
- hi = maxkey;
-
- /* binary search */
- do
- {
- cmp = (lo + hi) / 2;
-
- result = strcmp (s, table[cmp].name);
-
- if (result < 0)
- hi = cmp;
- else
- lo = cmp;
- }
- while (hi - lo > 1);
- if (!strcmp (s, table[lo].name))
- {
- return table[lo].tokcode;
- }
- else
- return -1; /* not found */
+ Keyword_ent e;
+ e.name_ = s;
+ vsize idx = binary_search (table_, e, tab_less);
+ if (idx != VPOS)
+ return table_[idx].tokcode_;
+ return VPOS;