当前位置: 首页>>代码示例>>C++>>正文


C++ C函数代码示例

本文整理汇总了C++中C函数的典型用法代码示例。如果您正苦于以下问题:C++ C函数的具体用法?C++ C怎么用?C++ C使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了C函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

#define BYTE_DISP 1
#define WORD_DISP 2
#define UNDEF_BYTE_DISP 0
#define UNDEF_WORD_DISP 3

#define BRANCH  1
#define SCB_F   2
#define SCB_TST 3
#define END 4

#define BYTE_F 127
#define BYTE_B -126
#define WORD_F 32767
#define WORD_B 32768

const relax_typeS md_relax_table[C (END, 0)];

static struct hash_control *opcode_hash_control;	/* Opcode mnemonics */

/*
  This function is called once, at assembler startup time.  This should
  set up all the tables, etc that the MD part of the assembler needs
  */

void
md_begin ()
{
  h8500_opcode_info *opcode;
  char prev_buffer[100];
  int idx = 0;
  register relax_typeS *table;
开发者ID:chuzhufei,项目名称:ViewAcdemicLinuxCode,代码行数:31,代码来源:tc-h8500.c

示例2: C

#define IMM16 atomrimm, &imm16off
static struct rbitfield imm32off = { 8, 32 };
#define IMM32 atomrimm, &imm32off
static struct bitfield flagoff = { 0, 5 };
#define FLAG atomimm, &flagoff
static struct bitfield waitoff = { 0, 2 };
#define WAIT atomimm, &waitoff
static struct bitfield waitsoff = { 2, 4, .shr = 1 };
#define WAITS atomimm, &waitsoff
static struct bitfield eventoff = { 8, 5 };
#define EVENT atomimm, &eventoff
static struct bitfield evaloff = { 16, 1 };
#define EVAL atomimm, &evaloff

static struct insn tabevent[] = {
	{ 0x0000, 0xff00, C("FB_PAUSED") },
	{ 0x0100, 0xff00, C("CRTC0_VBLANK") },
	{ 0x0200, 0xff00, C("CRTC0_HBLANK") },
	{ 0x0300, 0xff00, C("CRTC1_VBLANK") },
	{ 0x0400, 0xff00, C("CRTC1_HBLANK") },
	{ 0, 0, EVENT },
};

static struct insn tabfl[] = {
	{ 0x00, 0x1f, C("GPIO_2_OUT"), .fmask = F_NV17F },
	{ 0x01, 0x1f, C("GPIO_2_OE"), .fmask = F_NV17F },
	{ 0x02, 0x1f, C("GPIO_3_OUT"), .fmask = F_NV17F },
	{ 0x03, 0x1f, C("GPIO_3_OE"), .fmask = F_NV17F },
	{ 0x04, 0x1f, C("PRAMDAC0_UNK880_28"), .fmask = F_NV17F },
	{ 0x05, 0x1f, C("PRAMDAC1_UNK880_28"), .fmask = F_NV17F },
	{ 0x06, 0x1f, C("PRAMDAC0_UNK880_29"), .fmask = F_NV17F },
开发者ID:TomWij,项目名称:envytools,代码行数:31,代码来源:hwsq.c

示例3: lucas

long long int lucas(long long int a,long long int b){
	if(b==0) return 1;
	return (lucas(a/mod,b/mod)*C(a%mod,b%mod))%mod;
}
开发者ID:hiwang123,项目名称:algo_prob,代码行数:4,代码来源:1594_2.cpp

示例4: main

int main(int, char**)
{
    {
        typedef std::tuple<long> T0;
        typedef std::tuple<long long> T1;
        T0 t0(2);
        T1 t1 = t0;
        assert(std::get<0>(t1) == 2);
    }
#if TEST_STD_VER > 11
    {
        typedef std::tuple<int> T0;
        typedef std::tuple<A> T1;
        constexpr T0 t0(2);
        constexpr T1 t1 = t0;
        static_assert(std::get<0>(t1) == 2, "");
    }
    {
        typedef std::tuple<int> T0;
        typedef std::tuple<C> T1;
        constexpr T0 t0(2);
        constexpr T1 t1{t0};
        static_assert(std::get<0>(t1) == C(2), "");
    }
#endif
    {
        typedef std::tuple<long, char> T0;
        typedef std::tuple<long long, int> T1;
        T0 t0(2, 'a');
        T1 t1 = t0;
        assert(std::get<0>(t1) == 2);
        assert(std::get<1>(t1) == int('a'));
    }
    {
        typedef std::tuple<long, char, D> T0;
        typedef std::tuple<long long, int, B> T1;
        T0 t0(2, 'a', D(3));
        T1 t1 = t0;
        assert(std::get<0>(t1) == 2);
        assert(std::get<1>(t1) == int('a'));
        assert(std::get<2>(t1).id_ == 3);
    }
    {
        D d(3);
        typedef std::tuple<long, char, D&> T0;
        typedef std::tuple<long long, int, B&> T1;
        T0 t0(2, 'a', d);
        T1 t1 = t0;
        d.id_ = 2;
        assert(std::get<0>(t1) == 2);
        assert(std::get<1>(t1) == int('a'));
        assert(std::get<2>(t1).id_ == 2);
    }
    {
        typedef std::tuple<long, char, int> T0;
        typedef std::tuple<long long, int, B> T1;
        T0 t0(2, 'a', 3);
        T1 t1(t0);
        assert(std::get<0>(t1) == 2);
        assert(std::get<1>(t1) == int('a'));
        assert(std::get<2>(t1).id_ == 3);
    }
    {
        const std::tuple<int> t1(42);
        std::tuple<Explicit> t2(t1);
        assert(std::get<0>(t2).value == 42);
    }
    {
        const std::tuple<int> t1(42);
        std::tuple<Implicit> t2 = t1;
        assert(std::get<0>(t2).value == 42);
    }

  return 0;
}
开发者ID:ingowald,项目名称:llvm-project,代码行数:75,代码来源:convert_copy.pass.cpp

示例5: nestedprod

double nestedprod(size_t N, size_t iterations = 1){
    
    typedef boost::numeric::ublas::matrix<value_type, boost::numeric::ublas::row_major> matrix_type;
    boost::numeric::ublas::matrix<value_type, boost::numeric::ublas::row_major> A(N, N), B(N, N), C(N, N), D(N, N), E(N, N), F(N, N);
    
    minit(N, B);
    minit(N, C);
    minit(N, D);
    minit(N, E);
    minit(N, F);
    
    std::vector<double> times;
    for(size_t i = 0; i < iterations; ++i){
        
        auto start = std::chrono::steady_clock::now();
        noalias(A) = prod( B, matrix_type( prod( C, matrix_type( prod( D, matrix_type( prod( E, F) ) ) ) ) ) );
        auto end = std::chrono::steady_clock::now();
        
        auto diff = end - start;
        times.push_back(std::chrono::duration<double, std::milli> (diff).count()); //save time in ms for each iteration
    }

    double tmin = *(std::min_element(times.begin(), times.end()));
    double tavg = average_time(times);
    
    // check to see if nothing happened during run to invalidate the times
    if(variance(tavg, times) > max_variance){
        std::cerr << "boost kernel 'nestedprod': Time deviation too large! \n";
    }
    
    return tavg;
}
开发者ID:BoostGSoC14,项目名称:boost.ublas,代码行数:32,代码来源:NestedProd.cpp

示例6: N

/* Subroutine */ int slaebz_(integer *ijob, integer *nitmax, integer *n, 
	integer *mmax, integer *minp, integer *nbmin, real *abstol, real *
	reltol, real *pivmin, real *d, real *e, real *e2, integer *nval, real 
	*ab, real *c, integer *mout, integer *nab, real *work, integer *iwork,
	 integer *info)
{
/*  -- LAPACK auxiliary routine (version 2.0) --   
       Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,   
       Courant Institute, Argonne National Lab, and Rice University   
       September 30, 1994   


    Purpose   
    =======   

    SLAEBZ contains the iteration loops which compute and use the   
    function N(w), which is the count of eigenvalues of a symmetric   
    tridiagonal matrix T less than or equal to its argument  w.  It   
    performs a choice of two types of loops:   

    IJOB=1, followed by   
    IJOB=2: It takes as input a list of intervals and returns a list of   
            sufficiently small intervals whose union contains the same   
            eigenvalues as the union of the original intervals.   
            The input intervals are (AB(j,1),AB(j,2)], j=1,...,MINP.   
            The output interval (AB(j,1),AB(j,2)] will contain   
            eigenvalues NAB(j,1)+1,...,NAB(j,2), where 1 <= j <= MOUT.   

    IJOB=3: It performs a binary search in each input interval   
            (AB(j,1),AB(j,2)] for a point  w(j)  such that   
            N(w(j))=NVAL(j), and uses  C(j)  as the starting point of   
            the search.  If such a w(j) is found, then on output   
            AB(j,1)=AB(j,2)=w.  If no such w(j) is found, then on output 
  
            (AB(j,1),AB(j,2)] will be a small interval containing the   
            point where N(w) jumps through NVAL(j), unless that point   
            lies outside the initial interval.   

    Note that the intervals are in all cases half-open intervals,   
    i.e., of the form  (a,b] , which includes  b  but not  a .   

    To avoid underflow, the matrix should be scaled so that its largest   
    element is no greater than  overflow**(1/2) * underflow**(1/4)   
    in absolute value.  To assure the most accurate computation   
    of small eigenvalues, the matrix should be scaled to be   
    not much smaller than that, either.   

    See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal   
    VISMatrix", Report CS41, Computer Science Dept., Stanford   
    University, July 21, 1966   

    Note: the arguments are, in general, *not* checked for unreasonable   
    values.   

    Arguments   
    =========   

    IJOB    (input) INTEGER   
            Specifies what is to be done:   
            = 1:  Compute NAB for the initial intervals.   
            = 2:  Perform bisection iteration to find eigenvalues of T.   
            = 3:  Perform bisection iteration to invert N(w), i.e.,   
                  to find a point which has a specified number of   
                  eigenvalues of T to its left.   
            Other values will cause SLAEBZ to return with INFO=-1.   

    NITMAX  (input) INTEGER   
            The maximum number of "levels" of bisection to be   
            performed, i.e., an interval of width W will not be made   
            smaller than 2^(-NITMAX) * W.  If not all intervals   
            have converged after NITMAX iterations, then INFO is set   
            to the number of non-converged intervals.   

    N       (input) INTEGER   
            The dimension n of the tridiagonal matrix T.  It must be at   
            least 1.   

    MMAX    (input) INTEGER   
            The maximum number of intervals.  If more than MMAX intervals 
  
            are generated, then SLAEBZ will quit with INFO=MMAX+1.   

    MINP    (input) INTEGER   
            The initial number of intervals.  It may not be greater than 
  
            MMAX.   

    NBMIN   (input) INTEGER   
            The smallest number of intervals that should be processed   
            using a vector loop.  If zero, then only the scalar loop   
            will be used.   

    ABSTOL  (input) REAL   
            The minimum (absolute) width of an interval.  When an   
            interval is narrower than ABSTOL, or than RELTOL times the   
            larger (in magnitude) endpoint, then it is considered to be   
            sufficiently small, i.e., converged.  This must be at least   
            zero.   

    RELTOL  (input) REAL   
//.........这里部分代码省略.........
开发者ID:deepakantony,项目名称:vispack,代码行数:101,代码来源:slaebz.c

示例7: SA

};

A* ap;

struct C { };
C* cp;

SA (noexcept (dynamic_cast<B*>(ap)));
SA (!noexcept (dynamic_cast<B&>(*ap)));
SA (!noexcept (typeid (*ap)));
SA (noexcept (typeid (*cp)));

SA (!noexcept (true ? 1 : throw 1));
SA (!noexcept (true || true ? 1 : throw 1));

SA (noexcept (C()));

struct D
{
  D() throw();
};

SA (noexcept (D()));

struct E
{
  E() throw();
  ~E();
};

SA (noexcept (E()));
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:31,代码来源:noexcept01.C

示例8: main

int main(int argc, char **argv)
{
	if (argc != 8)
	{
	    std::cerr << "Not valid number of args" << std::endl;
	    std::cerr<<("Usage: #Rows #Columns #kernel_rows #Kernel_columns Input_Matrix Kernel Output_Matrix \n");
	    return 1;
	}
	
	int rows=strtol(argv[1],NULL,10);
	int columns=strtol(argv[2],NULL,10);
	int krows=strtol(argv[3],NULL,10);
	int kcolumns=strtol(argv[4],NULL,10);
	char *inputm=argv[5];
	char *kernel=argv[6];
	char *outputm=argv[7];
	if( krows%2==0 || kcolumns%2==0)
	{
		std::cerr<<"Number of kernel rows and columns must be odd"<<std::endl;
		return 1;
	}

	//INPUT MATRIX
	std::ifstream matrixfile(inputm,std::ios::in);
	if(!matrixfile)
	{
		std::cerr<<"Impossible to read input matrix"<<std::endl;
		return 1;
	}
	
	std::vector<int> inputmatrix(rows*columns);

	for(int i = 0; i < rows; ++i){
			for(int j = 0; j < columns; ++j){
				matrixfile>>inputmatrix[i*columns+j];
			}
	}
	matrixfile.close();
	
	//KERNEL
	std::ifstream kernelfile(kernel,std::ios::in);
	if(!kernelfile)
	{
		std::cerr<<"Impossible to read kernel"<<std::endl;
		return 1;
	}
	

	std::vector<int> kernelmatrix(krows*kcolumns);
	for(int i = 0; i < krows; ++i){
			for(int j = 0; j < kcolumns; ++j){
				kernelfile>>kernelmatrix[i*kcolumns+j];
			}
	}
	kernelfile.close();
	std::ofstream outputfile(outputm,std::ios::out);
	Convolution C(inputmatrix,kernelmatrix, rows, columns, krows, kcolumns);
	C.Compute();
	C.Print_to_File(outputfile);
	outputfile.close();
	return 0;
}
开发者ID:rdb987,项目名称:2DConvolution,代码行数:62,代码来源:main_st.cpp

示例9: computeState

void AnisotropicHyperelasticDamageModel<EvalT, Traits>::
computeState(typename Traits::EvalData workset,
    std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT>>> dep_fields,
    std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT>>> eval_fields)
{
  bool print = false;
  //if (typeid(ScalarT) == typeid(RealType)) print = true;
  //cout.precision(15);

  // retrive appropriate field name strings
  std::string F_string = (*field_name_map_)["F"];
  std::string J_string = (*field_name_map_)["J"];
  std::string cauchy_string = (*field_name_map_)["Cauchy_Stress"];
  std::string matrix_energy_string = (*field_name_map_)["Matrix_Energy"];
  std::string f1_energy_string = (*field_name_map_)["F1_Energy"];
  std::string f2_energy_string = (*field_name_map_)["F2_Energy"];
  std::string matrix_damage_string = (*field_name_map_)["Matrix_Damage"];
  std::string f1_damage_string = (*field_name_map_)["F1_Damage"];
  std::string f2_damage_string = (*field_name_map_)["F2_Damage"];

  // extract dependent MDFields
  PHX::MDField<ScalarT> def_grad = *dep_fields[F_string];
  PHX::MDField<ScalarT> J = *dep_fields[J_string];
  PHX::MDField<ScalarT> poissons_ratio = *dep_fields["Poissons Ratio"];
  PHX::MDField<ScalarT> elastic_modulus = *dep_fields["Elastic Modulus"];

  // extract evaluated MDFields
  PHX::MDField<ScalarT> stress = *eval_fields[cauchy_string];
  PHX::MDField<ScalarT> energy_m = *eval_fields[matrix_energy_string];
  PHX::MDField<ScalarT> energy_f1 = *eval_fields[f1_energy_string];
  PHX::MDField<ScalarT> energy_f2 = *eval_fields[f2_energy_string];
  PHX::MDField<ScalarT> damage_m = *eval_fields[matrix_damage_string];
  PHX::MDField<ScalarT> damage_f1 = *eval_fields[f1_damage_string];
  PHX::MDField<ScalarT> damage_f2 = *eval_fields[f2_damage_string];

  // previous state
  Albany::MDArray energy_m_old =
      (*workset.stateArrayPtr)[matrix_energy_string + "_old"];
  Albany::MDArray energy_f1_old =
      (*workset.stateArrayPtr)[f1_energy_string + "_old"];
  Albany::MDArray energy_f2_old =
      (*workset.stateArrayPtr)[f2_energy_string + "_old"];

  ScalarT kappa, mu, Jm53, Jm23, p, I4_f1, I4_f2;
  ScalarT alpha_f1, alpha_f2, alpha_m;

  // Define some tensors for use
  Intrepid::Tensor<ScalarT> I(Intrepid::eye<ScalarT>(num_dims_));
  Intrepid::Tensor<ScalarT> F(num_dims_), s(num_dims_), b(num_dims_), C(
      num_dims_);
  Intrepid::Tensor<ScalarT> sigma_m(num_dims_), sigma_f1(num_dims_), sigma_f2(
      num_dims_);
  Intrepid::Tensor<ScalarT> M1dyadM1(num_dims_), M2dyadM2(num_dims_);
  Intrepid::Tensor<ScalarT> S0_f1(num_dims_), S0_f2(num_dims_);

  Intrepid::Vector<ScalarT> M1(num_dims_), M2(num_dims_);

  for (int cell = 0; cell < workset.numCells; ++cell) {
    for (int pt = 0; pt < num_pts_; ++pt) {
      // local parameters
      kappa = elastic_modulus(cell, pt)
          / (3. * (1. - 2. * poissons_ratio(cell, pt)));
      mu = elastic_modulus(cell, pt) / (2. * (1. + poissons_ratio(cell, pt)));
      Jm53 = std::pow(J(cell, pt), -5. / 3.);
      Jm23 = std::pow(J(cell, pt), -2. / 3.);
      F.fill(def_grad,cell, pt,0,0);

      // compute deviatoric stress
      b = F * Intrepid::transpose(F);
      s = mu * Jm53 * Intrepid::dev(b);
      // compute pressure
      p = 0.5 * kappa * (J(cell, pt) - 1. / (J(cell, pt)));

      sigma_m = s + p * I;

      // compute energy for M
      energy_m(cell, pt) = 0.5 * kappa
          * (0.5 * (J(cell, pt) * J(cell, pt) - 1.0) - std::log(J(cell, pt)))
          + 0.5 * mu * (Jm23 * Intrepid::trace(b) - 3.0);

      // damage term in M
      alpha_m = energy_m_old(cell, pt);
      if (energy_m(cell, pt) > alpha_m) alpha_m = energy_m(cell, pt);

      damage_m(cell, pt) = max_damage_m_
          * (1 - std::exp(-alpha_m / saturation_m_));

      //-----------compute stress in Fibers

      // Right Cauchy-Green Tensor C = F^{T} * F
      C = Intrepid::transpose(F) * F;

      // Fiber orientation vectors
      //
      // fiber 1
      for (int i = 0; i < num_dims_; ++i) {
        M1(i) = direction_f1_[i];
      }
      M1 = M1 / norm(M1);

//.........这里部分代码省略.........
开发者ID:TheDylanViper,项目名称:Albany,代码行数:101,代码来源:AnisotropicHyperelasticDamageModel_Def.hpp

示例10: w_of_z

cmplx w_of_z(cmplx z)
{
    faddeeva_nofterms = 0;

    // Steven G. Johnson, October 2012.

    if (creal(z) == 0.0) {
        // Purely imaginary input, purely real output.
        // However, use creal(z) to give correct sign of 0 in cimag(w).
        return C(erfcx(cimag(z)), creal(z));
    }
    if (cimag(z) == 0) {
        // Purely real input, complex output.
        return C(exp(-sqr(creal(z))),  im_w_of_x(creal(z)));
    }

    const double relerr = DBL_EPSILON;
    const double a = 0.518321480430085929872; // pi / sqrt(-log(eps*0.5))
    const double c = 0.329973702884629072537; // (2/pi) * a;
    const double a2 = 0.268657157075235951582; // a^2

    const double x = fabs(creal(z));
    const double y = cimag(z);
    const double ya = fabs(y);

    cmplx ret = 0.; // return value

    double sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0, sum5 = 0;
    int n;

    if (ya > 7 || (x > 6  // continued fraction is faster
                   /* As pointed out by M. Zaghloul, the continued
                      fraction seems to give a large relative error in
                      Re w(z) for |x| ~ 6 and small |y|, so use
                      algorithm 816 in this region: */
                   && (ya > 0.1 || (x > 8 && ya > 1e-10) || x > 28))) {

        faddeeva_algorithm = 100;

        /* Poppe & Wijers suggest using a number of terms
           nu = 3 + 1442 / (26*rho + 77)
           where rho = sqrt((x/x0)^2 + (y/y0)^2) where x0=6.3, y0=4.4.
           (They only use this expansion for rho >= 1, but rho a little less
           than 1 seems okay too.)
           Instead, I did my own fit to a slightly different function
           that avoids the hypotenuse calculation, using NLopt to minimize
           the sum of the squares of the errors in nu with the constraint
           that the estimated nu be >= minimum nu to attain machine precision.
           I also separate the regions where nu == 2 and nu == 1. */
        const double ispi = 0.56418958354775628694807945156; // 1 / sqrt(pi)
        double xs = y < 0 ? -creal(z) : creal(z); // compute for -z if y < 0
        if (x + ya > 4000) { // nu <= 2
            if (x + ya > 1e7) { // nu == 1, w(z) = i/sqrt(pi) / z
                // scale to avoid overflow
                if (x > ya) {
                    faddeeva_algorithm += 1;
                    double yax = ya / xs;
                    faddeeva_algorithm = 100;
                    double denom = ispi / (xs + yax*ya);
                    ret = C(denom*yax, denom);
                }
                else if (isinf(ya)) {
                    faddeeva_algorithm += 2;
                    return ((isnan(x) || y < 0)
                            ? C(NaN,NaN) : C(0,0));
                }
                else {
                    faddeeva_algorithm += 3;
                    double xya = xs / ya;
                    double denom = ispi / (xya*xs + ya);
                    ret = C(denom, denom*xya);
                }
            }
            else { // nu == 2, w(z) = i/sqrt(pi) * z / (z*z - 0.5)
                faddeeva_algorithm += 4;
                double dr = xs*xs - ya*ya - 0.5, di = 2*xs*ya;
                double denom = ispi / (dr*dr + di*di);
                ret = C(denom * (xs*di-ya*dr), denom * (xs*dr+ya*di));
            }
        }
        else { // compute nu(z) estimate and do general continued fraction
            faddeeva_algorithm += 5;
            const double c0=3.9, c1=11.398, c2=0.08254, c3=0.1421, c4=0.2023; // fit
            double nu = floor(c0 + c1 / (c2*x + c3*ya + c4));
            double wr = xs, wi = ya;
            for (nu = 0.5 * (nu - 1); nu > 0.4; nu -= 0.5) {
                // w <- z - nu/w:
                double denom = nu / (wr*wr + wi*wi);
                wr = xs - wr * denom;
                wi = ya + wi * denom;
            }
            {   // w(z) = i/sqrt(pi) / w:
                double denom = ispi / (wr*wr + wi*wi);
                ret = C(denom*wi, denom*wr);
            }
        }
        if (y < 0) {
            faddeeva_algorithm += 10;
            // use w(z) = 2.0*exp(-z*z) - w(-z),
            // but be careful of overflow in exp(-z*z)
//.........这里部分代码省略.........
开发者ID:SASfit,项目名称:SASfit,代码行数:101,代码来源:w_of_z.c

示例11: C

int	pnlist[NPN] = { -1 };


int	*pnp = pnlist;
int	npn = 1;
int	npnflg = 1;
int	dpn = -1;
int	totout = 1;
int	ulfont = ULFONT;
int	tabch = TAB;
int	ldrch = LEADER;


#define	C(a,b)	{a, 0, b, 0, 0, NULL}
Contab contab[NM] = {
    C(PAIR('d', 's'), caseds),
    C(PAIR('a', 's'), caseas),
    C(PAIR('s', 'p'), casesp),
    C(PAIR('f', 't'), caseft),
    C(PAIR('p', 's'), caseps),
    C(PAIR('v', 's'), casevs),
    C(PAIR('n', 'r'), casenr),
    C(PAIR('i', 'f'), caseif),
    C(PAIR('i', 'e'), caseie),
    C(PAIR('e', 'l'), caseel),
    C(PAIR('p', 'o'), casepo),
    C(PAIR('t', 'l'), casetl),
    C(PAIR('t', 'm'), casetm),
    C(PAIR('f', 'm'), casefm),
    C(PAIR('b', 'p'), casebp),
    C(PAIR('c', 'h'), casech),
开发者ID:n-t-roff,项目名称:DWB3.3,代码行数:31,代码来源:ni.c

示例12: C

    [SND_PCM_FORMAT_U20_3BE]            = VLC_CODEC_U24B, // ^
    [SND_PCM_FORMAT_S18_3LE]            = VLC_CODEC_S24L, // ^
    [SND_PCM_FORMAT_S18_3BE]            = VLC_CODEC_S24B, // ^
    [SND_PCM_FORMAT_U18_3LE]            = VLC_CODEC_U24L, // ^
    [SND_PCM_FORMAT_U18_3BE]            = VLC_CODEC_U24B, // ^
};

#ifdef WORDS_BIGENDIAN
# define C(f) f##BE, f##LE
#else
# define C(f) f##LE, f##BE
#endif

/* Formats in order of decreasing preference */
static const uint8_t choices[] = {
    C(SND_PCM_FORMAT_FLOAT_),
    C(SND_PCM_FORMAT_S32_),
    C(SND_PCM_FORMAT_U32_),
    C(SND_PCM_FORMAT_S16_),
    C(SND_PCM_FORMAT_U16_),
    C(SND_PCM_FORMAT_FLOAT64_),
    C(SND_PCM_FORMAT_S24_3),
    C(SND_PCM_FORMAT_U24_3),
    SND_PCM_FORMAT_MPEG,
    SND_PCM_FORMAT_GSM,
    SND_PCM_FORMAT_MU_LAW,
    SND_PCM_FORMAT_A_LAW,
    SND_PCM_FORMAT_S8,
    SND_PCM_FORMAT_U8,
};
开发者ID:Aki-Liang,项目名称:vlc-2.1.0.oldlib-2010,代码行数:30,代码来源:alsa.c

示例13: main

int main() {
  {

    static_assert(
        ranges::detail::BidirectionalCursor<
        ranges::detail::reverse_cursor<bidirectional_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::detail::BidirectionalCursor<
        ranges::detail::reverse_cursor<random_access_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::detail::RandomAccessCursor<
        ranges::detail::reverse_cursor<random_access_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::BidirectionalIterator<
            ranges::reverse_iterator<bidirectional_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::RandomAccessIterator<
            ranges::reverse_iterator<random_access_iterator<const char *>>>{},
        "");
  }
  { // test
    test<bidirectional_iterator<const char *>>();
    test<random_access_iterator<char *>>();
    test<char *>();
    test<const char *>();
  }
  { // test 2
    const char s[] = "123";
    test2(bidirectional_iterator<const char *>(s));
    test2(random_access_iterator<const char *>(s));
  }
  { // test3
    Derived d;
    test3<bidirectional_iterator<Base *>>(
        bidirectional_iterator<Derived *>(&d));
    test3<random_access_iterator<const Base *>>(
        random_access_iterator<Derived *>(&d));
  }
  { // test4
    const char *s = "1234567890";
    random_access_iterator<const char *> b(s);
    random_access_iterator<const char *> e(s + 10);
    while (b != e)
      test4(b++);
  }
  { // test5
    const char *s = "1234567890";
    test5(bidirectional_iterator<const char *>(s),
          bidirectional_iterator<const char *>(s), false);
    test5(bidirectional_iterator<const char *>(s),
          bidirectional_iterator<const char *>(s + 1), true);
    test5(random_access_iterator<const char *>(s),
          random_access_iterator<const char *>(s), false);
    test5(random_access_iterator<const char *>(s),
          random_access_iterator<const char *>(s + 1), true);
    test5(s, s, false);
    test5(s, s + 1, true);
  }
  {
    const char *s = "123";
    test6(bidirectional_iterator<const char *>(s + 1),
          bidirectional_iterator<const char *>(s));
    test6(random_access_iterator<const char *>(s + 1),
          random_access_iterator<const char *>(s));
    test6(s + 1, s);
  }
  {
    const char *s = "123";
    test7(bidirectional_iterator<const char *>(s + 1),
          bidirectional_iterator<const char *>(s));
    test7(random_access_iterator<const char *>(s + 1),
          random_access_iterator<const char *>(s));
    test7(s + 1, s);
  }
  {
    const char *s = "1234567890";
    test8(random_access_iterator<const char *>(s + 5), 5,
          random_access_iterator<const char *>(s));
    test8(s + 5, 5, s);
  }
  {
    const char *s = "1234567890";
    test9(random_access_iterator<const char *>(s + 5), 5,
          random_access_iterator<const char *>(s));
    test9(s + 5, 5, s);
  }
  {
    const char *s = "123";
    test10(bidirectional_iterator<const char *>(s + 1),
           bidirectional_iterator<const char *>(s + 2));
    test10(random_access_iterator<const char *>(s + 1),
           random_access_iterator<const char *>(s + 2));
    test10(s + 1, s + 2);
  }
  {
    const char *s = "123";
//.........这里部分代码省略.........
开发者ID:Hincoin,项目名称:range-v3,代码行数:101,代码来源:reverse_iterator.cpp

示例14: md_begin

void
md_begin ()
{
  h8500_opcode_info *opcode;
  char prev_buffer[100];
  int idx = 0;
  register relax_typeS *table;

  opcode_hash_control = hash_new ();
  prev_buffer[0] = 0;

  /* Insert unique names into hash table */
  for (opcode = h8500_table; opcode->name; opcode++)
    {
      if (idx != opcode->idx)
	{
	  hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
	  idx++;
	}
    }

  /* Initialize the relax table.  We use a local variable to avoid
     warnings about modifying a supposedly const data structure.  */
  table = (relax_typeS *) md_relax_table;
  table[C (BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
  table[C (BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
  table[C (BRANCH, BYTE_DISP)].rlx_length = 2;
  table[C (BRANCH, BYTE_DISP)].rlx_more = C (BRANCH, WORD_DISP);

  table[C (BRANCH, WORD_DISP)].rlx_forward = WORD_F;
  table[C (BRANCH, WORD_DISP)].rlx_backward = WORD_B;
  table[C (BRANCH, WORD_DISP)].rlx_length = 3;
  table[C (BRANCH, WORD_DISP)].rlx_more = 0;

  table[C (SCB_F, BYTE_DISP)].rlx_forward = BYTE_F;
  table[C (SCB_F, BYTE_DISP)].rlx_backward = BYTE_B;
  table[C (SCB_F, BYTE_DISP)].rlx_length = 3;
  table[C (SCB_F, BYTE_DISP)].rlx_more = C (SCB_F, WORD_DISP);

  table[C (SCB_F, WORD_DISP)].rlx_forward = WORD_F;
  table[C (SCB_F, WORD_DISP)].rlx_backward = WORD_B;
  table[C (SCB_F, WORD_DISP)].rlx_length = 8;
  table[C (SCB_F, WORD_DISP)].rlx_more = 0;

  table[C (SCB_TST, BYTE_DISP)].rlx_forward = BYTE_F;
  table[C (SCB_TST, BYTE_DISP)].rlx_backward = BYTE_B;
  table[C (SCB_TST, BYTE_DISP)].rlx_length = 3;
  table[C (SCB_TST, BYTE_DISP)].rlx_more = C (SCB_TST, WORD_DISP);

  table[C (SCB_TST, WORD_DISP)].rlx_forward = WORD_F;
  table[C (SCB_TST, WORD_DISP)].rlx_backward = WORD_B;
  table[C (SCB_TST, WORD_DISP)].rlx_length = 10;
  table[C (SCB_TST, WORD_DISP)].rlx_more = 0;

}
开发者ID:chuzhufei,项目名称:ViewAcdemicLinuxCode,代码行数:55,代码来源:tc-h8500.c

示例15: C

	'2',  '3',  '0',  '.',  NO,   NO,   NO,   NO,	// 0x50
	[0xC7] = KEY_HOME,	      [0x9C] = '\n' /*KP_Enter*/,
	[0xB5] = '/' /*KP_Div*/,      [0xC8] = KEY_UP,
	[0xC9] = KEY_PGUP,	      [0xCB] = KEY_LF,
	[0xCD] = KEY_RT,	      [0xCF] = KEY_END,
	[0xD0] = KEY_DN,	      [0xD1] = KEY_PGDN,
	[0xD2] = KEY_INS,	      [0xD3] = KEY_DEL
};

#define C(x) (x - '@')

static uint8_t ctlmap[256] =
{
	NO,      NO,      NO,      NO,      NO,      NO,      NO,      NO,
	NO,      NO,      NO,      NO,      NO,      NO,      NO,      NO,
	C('Q'),  C('W'),  C('E'),  C('R'),  C('T'),  C('Y'),  C('U'),  C('I'),
	C('O'),  C('P'),  NO,      NO,      '\r',    NO,      C('A'),  C('S'),
	C('D'),  C('F'),  C('G'),  C('H'),  C('J'),  C('K'),  C('L'),  NO,
	NO,      NO,      NO,      C('\\'), C('Z'),  C('X'),  C('C'),  C('V'),
	C('B'),  C('N'),  C('M'),  NO,      NO,      C('/'),  NO,      NO,
	[0x97] = KEY_HOME,
	[0xB5] = C('/'),		[0xC8] = KEY_UP,
	[0xC9] = KEY_PGUP,		[0xCB] = KEY_LF,
	[0xCD] = KEY_RT,		[0xCF] = KEY_END,
	[0xD0] = KEY_DN,		[0xD1] = KEY_PGDN,
	[0xD2] = KEY_INS,		[0xD3] = KEY_DEL
};

static uint8_t *charcode[4] = {
	normalmap,
	shiftmap,
开发者ID:erhuluanzi,项目名称:challenge1,代码行数:31,代码来源:console.c


注:本文中的C函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。