* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* Created: August 1996
*
- * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ * Copyright: 1996, 1997 Alejandro Aguilar Sierra
*
* License: GNU GPL version 2 or later
*/
struct compara {
// used by sort
+ inline
int operator()(binary_op_pair const & a,
binary_op_pair const & b) const {
return a.id < b.id;
}
// used by lower_bound
+ inline
int operator()(binary_op_pair const & a, short int id) const {
return a.id < id;
}
int MathedLookupBOP(short id)
{
- static int bopCount = sizeof(binary_op_table) / sizeof(binary_op_pair);
+ static int const bopCount =
+ sizeof(binary_op_table) / sizeof(binary_op_pair);
static bool issorted = false;
if (!issorted) {
binary_op_pair * res = lower_bound(binary_op_table,
binary_op_table + bopCount,
id, compara());
- if (res->id == id)
+ if (res != binary_op_table + bopCount && res->id == id)
return res->isrel;
else
return LMB_NONE;