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


C++ FP函数代码示例

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


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

示例1: setVariance

 void setVariance(FP inVariance) {
   if (inVariance < FP(0.0)) {
     assert(0); // negative variance
   }
   variance = inVariance;
   stdDeviation = FP(-1.0);
 }
开发者ID:mdejong,项目名称:GvmCpp,代码行数:7,代码来源:GvmResult.hpp

示例2: print_tree

void	print_tree(t_ast *ast)
{
	while (ast->leftcmd != NULL)
		ast = ast->leftcmd;
	FP("%s | %d | %s\n", ast->left, ast->type, ast->right);
	while (ast != NULL)
	{
		ast = ast->parent;
		if (ast != NULL)
			FP("%p | %d | %s\n", ast->leftcmd, ast->type, ast->right);
	}
}
开发者ID:Succubae,项目名称:42,代码行数:12,代码来源:operation_on_command.c

示例3: GvmResult

 GvmResult(GvmCluster<S,V,K,FP> cluster)
 : space(cluster.clusters.space)
 {
   count = cluster.count;
   mass = cluster.m0;
   variance = cluster.var / mass;
   stdDeviation = FP(-1.0);
   key = cluster.getKey();
   //space = cluster.clusters.space;
   point = space.newCopy(cluster.m1);
   space.scale(point, FP(1.0) / mass);
 }
开发者ID:mdejong,项目名称:GvmCpp,代码行数:12,代码来源:GvmResult.hpp

示例4: des_ecb3_encrypt

void
des_ecb3_encrypt(des_cblock (*input), des_cblock (*output),
    des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3,
    int encrypt)
{
	register u_int32_t l0, l1;
	register unsigned char *in, *out;
	u_int32_t ll[2];

	in = (unsigned char *) input;
	out = (unsigned char *) output;
	c2l(in, l0);
	c2l(in, l1);
	IP(l0, l1);
	ll[0] = l0;
	ll[1] = l1;
	des_encrypt2(ll, ks1, encrypt);
	des_encrypt2(ll, ks2, !encrypt);
	des_encrypt2(ll, ks3, encrypt);
	l0 = ll[0];
	l1 = ll[1];
	FP(l1, l0);
	l2c(l0, out);
	l2c(l1, out);
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:25,代码来源:ecb3_enc.c

示例5: ft_check_setenv_ag

int		ft_check_setenv_ag(char **arg, char **varn, char **varvalue, int *ow)
{
	if (arg[1] && arg[2] && arg[3])
	{
		*varn = ft_strtoupper(ft_strdup(arg[1]));
		*varvalue = ft_strdup(arg[2]);
		*ow = ft_atoi(arg[3]);
	}
	else
	{
		FP("Setenv error.\n");
		FP("Usage : setenv (char*)name (char*)value (int)overwrite\n");
		return (-1);
	}
	return (0);
}
开发者ID:Succubae,项目名称:42,代码行数:16,代码来源:ft_for_builtins.c

示例6: des_decrypt3

void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3)
  {
  register DES_LONG l,r;

  l=data[0];
  r=data[1];
  IP(l,r);
  data[0]=l;
  data[1]=r;

  /*des_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); */
  /*des_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); */
  /*des_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); */

  /* XID on 23-MAR-1999 */
  /* Modified to use Triple DES. Key must be 24 bytes. */
  des_encrypt((DES_LONG *)data,ks3,DES_DECRYPT);
  des_encrypt((DES_LONG *)data,ks2,DES_ENCRYPT);
  des_encrypt((DES_LONG *)data,ks1,DES_DECRYPT);

  l=data[0];
  r=data[1];
  FP(r,l);
  data[0]=l;
  data[1]=r;
}/*end des_decrypt3 */
开发者ID:bochaqos,项目名称:tol,代码行数:26,代码来源:DES_ENC.c

示例7: crypto_des3_decrypt

/**
 * @brief 对数据段进行 Triple DES 算法解密。
 *
 * @author Damien(2011/12/22)
 *
 * @param p_ctx  Triple DES 加密算法语境。
 * @param p_dst  输出明文保存地址。
 * @param p_src  输入密文保存地址。
 *
 * @note 数据段的长度为 8 个字节。
 */
void
crypto_des3_decrypt(const crypto_des3_ctx_t* p_ctx,
                    unsigned char*           p_dst,
                    const unsigned char*     p_src) {
  unsigned long  i;
  unsigned long  l;
  unsigned long  r;
  unsigned long  a;
  unsigned long  b;
  unsigned long*       p_dst_u32 = (      unsigned long* )p_dst;
  const unsigned long* p_src_u32 = (const unsigned long* )p_src;
  const unsigned long* p_exp_key = p_ctx->expkey + CRYPTO_DES3_EXPKEY_WORDS - 2;


  l = le32_to_cpu(p_src_u32[0]);
  r = le32_to_cpu(p_src_u32[1]);

  IP(l, r, a);
  for (i = 0; i < 8; i++) {
    ROUND(l, r, a, b, p_exp_key, -2);
    ROUND(r, l, a, b, p_exp_key, -2);
  }
  for (i = 0; i < 8; i++) {
    ROUND(r, l, a, b, p_exp_key, -2);
    ROUND(l, r, a, b, p_exp_key, -2);
  }
  for (i = 0; i < 8; i++) {
    ROUND(l, r, a, b, p_exp_key, -2);
    ROUND(r, l, a, b, p_exp_key, -2);
  }
  FP(r, l, a);

  p_dst_u32[0] = cpu_to_le32(r);
  p_dst_u32[1] = cpu_to_le32(l);
}
开发者ID:againzhou,项目名称:tangkong,代码行数:46,代码来源:crypto_des3.c

示例8: assert

 GvmStdVector<FP,D>()
 {
   assert(D >= 1);
   for (int i = 0; i < D; i++) {
     values[i] = FP(0.0);
   }
 }
开发者ID:mdejong,项目名称:GvmCpp,代码行数:7,代码来源:GvmStdVector.hpp

示例9: write_snapshots_to_file

static void write_snapshots_to_file(void)
{
    Int i;

    Char* elune_out_file =
        VG_(expand_file_name)("--output-filename", clo_outputfilename);

    sres = VG_(open)(clo_outputfilename, VKI_O_CREAT|VKI_O_TRUNC|VKI_O_WRONLY,
                     VKI_S_IRUSR|VKI_S_IWUSR);
    if (sr_isError(sres)) {
        // If the file can't be opened for whatever reason (conflict
        // between multiple cachegrinded processes?), give up now.
        VG_(umsg)("error: can't open output file '%s'\n", elune_out_file );
        VG_(umsg)("       ... so the log will be missing.\n");
        VG_(free)(elune_out_file);
        return;
    } else {
        fd = sr_Res(sres);
        VG_(free)(elune_out_file);
    }
    // Print elune-specific options that were used.
    if (VG_(args_the_exename)) {
        /*FP("%s", VG_(args_the_exename));*/
        for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
            HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
            if (arg)
                FP(" %s", arg);
        }
    }
    /*FP("\n");*/
}
开发者ID:Legend,项目名称:Elune,代码行数:31,代码来源:el_main.c

示例10: return

//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴
//Procedure		GetWindDirVel
//Author		Craig Beeston
//Date			Thu 10 Jun 1999
//
//Description	Returns the wind speed and direction at a given altitude
//
//Inputs		Alt
//
//Returns		Wind Heading and Speed
//
//------------------------------------------------------------------------------
Bool Atmosphere::GetWindDirVel (SLong alt, SWord& hdg, SLong& speed)
{
	if(!Save_Data.flightdifficulty [FD_WINDEFFECTS])
	{
		hdg = 0;
		speed = 0;
		return(TRUE);
	}

	if(alt > 914400)	// 30,000 ft
	{
		hdg	  = SWord(diralt * 182.04);
//DeadCode RJS 16Dec99		speed = (51 * windalt) / 10;
		speed = SLong(5148. * windalt);					//RJS 16Dec99
		return(TRUE);
	}

//DeadCode RJS 16Dec99	SWord Dir0   = SWord(182.04 * dir0);
//DeadCode RJS 16Dec99	SWord DirAlt = SWord(182.04 * diralt);
//DeadCode RJS 16Dec99
//DeadCode RJS 16Dec99	SWord DeltaDir = DirAlt - Dir0;
	FP Dir0   = 182.04 * dir0;							//RJS 16Dec99
	FP DirAlt = 182.04 * diralt;						//RJS 16Dec99

	FP DeltaDir = DirAlt - Dir0;						//RJS 16Dec99
	FP Fract = FP(alt) / 914411.0;
	FP fdir   = Dir0 + Fract * DeltaDir;
	FP fspeed = ((1. - Fract) * wind0 + Fract * windalt) * 5148.;//RJS 16Dec99

	hdg   = SWord(fdir);
	speed = SLong(fspeed);
	
	return(TRUE);
}
开发者ID:xor2003,项目名称:bob-flight-sim,代码行数:46,代码来源:sky.cpp

示例11: doubles

// Generator for toplevel expression
// It also evaluates the generated function
llvm::Function * ProgCodegen::operator()(const ast::Expr      & expr)  const 
{
    std::vector<llvm::Type*> doubles(0,llvm::Type::getDoubleTy(llvm::getGlobalContext()));
    llvm::FunctionType * FT       = llvm::FunctionType::get   (llvm::Type::getDoubleTy(llvm::getGlobalContext()),llvm::ArrayRef<llvm::Type*>(doubles), false);
    llvm::Function     * funcVal  = llvm::Function    ::Create(FT, llvm::Function::ExternalLinkage,"", module);
    if (funcVal == 0) return 0;

    //Creating ExprCodegen to process the function body.
    ExprCodegen expCG(module);
    //Building
    llvm::BasicBlock * BB = llvm::BasicBlock::Create(llvm::getGlobalContext(), "entry", funcVal);
    expCG.pimpl->builder.SetInsertPoint(BB);

    if(llvm::Value * bodyVal = boost::apply_visitor(expCG,expr)) 
    {
        expCG.pimpl->builder.CreateRet(bodyVal);
        llvm::verifyFunction(*funcVal);
        //Evaluation
        std::cout << "ready " << engine << "\n";
        void *FPtr = engine->getPointerToFunction(funcVal);
        double (*FP)() = (double (*)())FPtr;
        std::cout << "Evaluated to " << FP() << "\n";

        return funcVal;
    }

    funcVal->eraseFromParent();
    return 0;
}
开发者ID:KKostya,项目名称:SpiritKaleidoscope,代码行数:31,代码来源:codegenerator.cpp

示例12: des_decipher

void des_decipher(word32 *output, word32 L, word32 R, DESContext *sched) {
    word32 swap, s0246, s1357;

    IP(L, R);

    L = rotl(L, 1);
    R = rotl(R, 1);

    L ^= f(R, sched->k0246[15], sched->k1357[15]);
    R ^= f(L, sched->k0246[14], sched->k1357[14]);
    L ^= f(R, sched->k0246[13], sched->k1357[13]);
    R ^= f(L, sched->k0246[12], sched->k1357[12]);
    L ^= f(R, sched->k0246[11], sched->k1357[11]);
    R ^= f(L, sched->k0246[10], sched->k1357[10]);
    L ^= f(R, sched->k0246[ 9], sched->k1357[ 9]);
    R ^= f(L, sched->k0246[ 8], sched->k1357[ 8]);
    L ^= f(R, sched->k0246[ 7], sched->k1357[ 7]);
    R ^= f(L, sched->k0246[ 6], sched->k1357[ 6]);
    L ^= f(R, sched->k0246[ 5], sched->k1357[ 5]);
    R ^= f(L, sched->k0246[ 4], sched->k1357[ 4]);
    L ^= f(R, sched->k0246[ 3], sched->k1357[ 3]);
    R ^= f(L, sched->k0246[ 2], sched->k1357[ 2]);
    L ^= f(R, sched->k0246[ 1], sched->k1357[ 1]);
    R ^= f(L, sched->k0246[ 0], sched->k1357[ 0]);

    L = rotl(L, 31);
    R = rotl(R, 31);

    swap = L; L = R; R = swap;

    FP(L, R);

    output[0] = L;
    output[1] = R;
}
开发者ID:rdebath,项目名称:sgt,代码行数:35,代码来源:sshdes.c

示例13: SWord

//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴
//Procedure		GetWindDirVel
//Author		Robert Slater
//Date			Thu 16 Dec 1999
//
//Description	Returns the wind speed and direction at a given altitude
//
//Inputs		Alt
//
//Returns		Wind Heading and Speed
//
//------------------------------------------------------------------------------
void Atmosphere::GetWindDirVel (SLong alt, SWord& hdg, FP& speed)
{
	if(!Save_Data.flightdifficulty [FD_WINDEFFECTS])
	{
		hdg = 0;
		speed = 0;
	}
	else
	{
		if(alt > 914400)	// 30,000 ft
		{
			hdg	  = SWord(diralt * 182.04);
			speed = 5148. * windalt;	//from knotts... to vel*1000
		}
		else
		{
			FP Dir0   = 182.04 * dir0;
			FP DirAlt = 182.04 * diralt;
			FP DeltaDir = DirAlt - Dir0;
			FP Fract = FP(alt) / 914411.0;
			FP fdir   = Dir0 + Fract * DeltaDir;
			
			speed = ((1. - Fract) * wind0 + Fract * windalt) * 5148.;
			hdg   = SWord(fdir);
		}
	}
}
开发者ID:xor2003,项目名称:bob-flight-sim,代码行数:39,代码来源:sky.cpp

示例14: diz80_worddata

int diz80_worddata()
{
	if(t[1]==-1) {
		return diz80_bytedata();
	}

	FP(fx, "\tdefw 0%04xh", t[0]+256*t[1]);
	return 2;
}
开发者ID:rasky,项目名称:pacman,代码行数:9,代码来源:dz80.c

示例15: fsync_paranoid

static int fsync_paranoid(const char *name) {
    char rp[1+PATH_MAX], *file = (char *) malloc(sizeof(char)*(strlen(name)+1));
    strcpy(file, name);
    FP(stderr, "fsync to root '%s'\n", file);
    if (NULL == realpath(file, rp))              BAIL("realpath failed");
    FP(stderr, "     realpath '%s'\n", rp);
    do {
        int fd;
            FP(stderr, "    fsync-ing '%s'\n", rp);
            if (-1 == (fd = open(rp, O_RDONLY)))       BAIL("open failed");
            if (-1 == fsync(fd))                       BAIL("fsync failed");
            if (-1 == close(fd))                       BAIL("close failed");
            trim_rightmost_path_component(rp);
        } while (*rp);
    FP(stderr, "         done\n");
    free(file);
    return 0;
}
开发者ID:HewlettPackard,项目名称:Atlas,代码行数:18,代码来源:fsync.hpp


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