コード例 #1
0
ファイル: ot_stats.c プロジェクト: SpiderX/opentracker
static size_t stats_get_highscore_networks( stats_network_node *node, int depth, ot_ip6 node_value, size_t *scores, ot_ip6 *networks, int network_count, int limit ) {
  size_t score = 0;
  int i;

  if( !node ) return 0;

  if( depth < limit ) {
    for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i )
      if( node->children[i] ) {
        __STR(node_value,depth,i);
        score += stats_get_highscore_networks( node->children[i], depth+STATS_NETWORK_NODE_BITWIDTH, node_value, scores, networks, network_count, limit );
      }
    return score;
  }

  if( depth > limit && depth < STATS_NETWORK_NODE_MAXDEPTH ) {
    for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i )
      if( node->children[i] )
        score += stats_get_highscore_networks( node->children[i], depth+STATS_NETWORK_NODE_BITWIDTH, node_value, scores, networks, network_count, limit );
    return score;
  }

  if( depth > limit && depth == STATS_NETWORK_NODE_MAXDEPTH ) {
    for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i )
      score += node->counters[i];
    return score;
  }

  /* if( depth == limit ) */
  for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i ) {
    int j=1;
    size_t node_score;

    if( depth == STATS_NETWORK_NODE_MAXDEPTH )
      node_score = node->counters[i];
    else
      node_score = stats_get_highscore_networks( node->children[i], depth+STATS_NETWORK_NODE_BITWIDTH, node_value, scores, networks, network_count, limit );

    score += node_score;

    if( node_score <= scores[0] ) continue;

    __STR(node_value,depth,i);
    while( j < network_count && node_score > scores[j] ) ++j;
    --j;

    memcpy( scores, scores + 1, j * sizeof( *scores ) );
    memcpy( networks, networks + 1, j * sizeof( *networks ) );
    scores[ j ] = node_score;
    memcpy( networks + j, node_value, sizeof( *networks ) );
  }

  return score;
}
コード例 #2
0
ファイル: cudacompil.cpp プロジェクト: flintforge/baracuda
CudaCompiler::CudaCompiler()
{
   // bin and usr/bin are mandatory
    qputenv("PATH",__STR(PATH)); // path to nvcc, cudafe, cicc /usr/bin/:/usr/local/bin
    // qgetenv("HOME") is not as reliable as QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
    nvcc.setProcessChannelMode(QProcess::MergedChannels);
}
コード例 #3
0
ファイル: registration.c プロジェクト: Oleh-Kravchenko/modemd
	RS_MNC_LOCK,
	RS_CCID_LOCK,
	RS_MSIN_LOCK,
	RS_OPERATOR_SELECT,
	RS_CHECK_REGISTRATION,
	RS_GET_SIGNAL_QUALITY,
	RS_GET_NETWORK_TYPE,
	RS_GET_OPERATOR_NUMBER,
	RS_GET_OPERATOR_NAME,
	RS_RESET
};

static const char *RS_STR[] =
{
#define __STR(x) #x
	__STR(RS_INIT),
	__STR(RS_DISABLE_ECHO),
	__STR(RS_CMEE_NUMBER),
	__STR(RS_GET_FIRMWARE_VER),
	__STR(RS_GET_IMEI),
	__STR(RS_READ_CONFIG),
	__STR(RS_SET_BAND),
	__STR(RS_SET_APN),
	__STR(RS_SET_AUTH),
	__STR(RS_CHECK_PIN),
	__STR(RS_SET_PIN),
	__STR(RS_SET_PUK),
	__STR(RS_GET_IMSI),
	__STR(RS_MCC_LOCK),
	__STR(RS_MNC_LOCK),
	__STR(RS_CCID_LOCK),