openfpga/src/utils/pb_type_utils.cpp
/************************************************************************ 
 * With a given mode name, find the mode pointer
 ************************************************************************/
With a given mode name, find the mode pointer
With a given mode name find the mode pointer
t_mode* find_pb_type_mode(t_pb_type* pb_type, const char* mode_name) {
  for (int i = 0; i < pb_type->num_modes; ++i) {
    if (std::string(mode_name) == std::string(pb_type->modes[i].name)) {
       return &(pb_type->modes[i]);
    }
  }
  return nullptr;
}
t_mode * find_pb_type_mode ( t_pb_type * pb_type , const char * mode_name ) { for ( int i = 0 ; i < pb_type -> num_modes ; ++ i ) { if ( std :: string ( mode_name ) == std :: string ( pb_type -> modes [ i ] . name ) ) { return & ( pb_type -> modes [ i ] ) ; } } return nullptr ; }
With a given mode name, find the mode pointer
With a given mode name find the mode pointer
/* Note found, return a nullptr */