本文整理汇总了C++中BF函数的典型用法代码示例。如果您正苦于以下问题:C++ BF函数的具体用法?C++ BF怎么用?C++ BF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: createNode
node *insertNode(node *root, int cont){
if(root==NULL){
return createNode(cont);
}
else
if(cont>root->data) {
root->right=insertNode(root->right,cont);
if(BF(root)==-2){
if(cont>root->right->data)
root=RR(root);
else
root=RL(root);
}
}
else
if(cont<root->data) {
root->left=insertNode(root->left,cont);
if(BF(root)==2){
if(cont < root->left->data)
root=LL(root);
else
root=LR(root);
}
}
/*else{
if(cont==root->data) printf("the node %d already exists in the tree",cont);
return root;
}*/
root->ht=height(root);
return(root);
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:31,代码来源:main.c
示例2: evaluateFields
void DOFInterpolation<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
//Intrepid version:
// for (int i=0; i < val_qp.size() ; i++) val_qp[i] = 0.0;
// Intrepid::FunctionSpaceTools:: evaluate<ScalarT>(val_qp, val_node, BF);
for (int cell=0; cell < workset.numCells; ++cell) {
for (int qp=0; qp < numQPs; ++qp) {
if (2==numRank) {
typename PHAL::Ref<ScalarT>::type vqp = val_qp(cell,qp) = 0;
for (int node=0; node < numNodes; ++node) {
vqp += val_node(cell, node) * BF(cell, node, qp);
}
} else {
for (int level=0; level < numLevels; ++level) {
typename PHAL::Ref<ScalarT>::type vqp = val_qp(cell,qp,level);
vqp = 0;
for (int node=0; node < numNodes; ++node) {
vqp += val_node(cell, node, level) * BF(cell, node, qp);
}
}
}
}
}
}
开发者ID:Sam-MSU,项目名称:Albany,代码行数:26,代码来源:Aeras_DOFInterpolation_Def.hpp
示例3: insertion
/* Insert sessid and socket pair in AVL Tree */
AVLTree_Node* insertion(AVLTree_Node *T,uint16_t x, struct node *head)
{
if(T==NULL)
{
T=(AVLTree_Node*)malloc(sizeof(AVLTree_Node));
T->data=x;
T->head = head;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insertion(T->right,x,head);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insertion(T->left,x,head);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}
T->ht=height(T);
//root=T;
return(T);
}
开发者ID:prabhakarniraula,项目名称:snort-openappid-machinelearning,代码行数:35,代码来源:appIdSessionstore.c
示例4: stmp3xxx_mmc_bc
/* Send the BC command to the device */
static void stmp3xxx_mmc_bc(struct stmp3xxx_mmc_host *host)
{
struct mmc_command *cmd = host->cmd;
struct stmp3xxx_dma_descriptor *dma_desc = &host->dma_desc;
dma_desc->command->cmd = BM_APBH_CHn_CMD_WAIT4ENDCMD | BM_APBH_CHn_CMD_SEMAPHORE | BM_APBH_CHn_CMD_IRQONCMPLT | BF(0, APBH_CHn_CMD_XFER_COUNT) | BF(3, APBH_CHn_CMD_CMDWORDS) | BF(0, APBH_CHn_CMD_COMMAND); /* NO_DMA_XFER */
dma_desc->command->pio_words[0] = BM_SSP_CTRL0_ENABLE |
BM_SSP_CTRL0_IGNORE_CRC;
dma_desc->command->pio_words[1] = BF(cmd->opcode, SSP_CMD0_CMD) |
BM_SSP_CMD0_APPEND_8CYC;
dma_desc->command->pio_words[2] = BF(cmd->arg, SSP_CMD1_CMD_ARG);
init_completion(&host->dma_done);
stmp3xxx_dma_reset_channel(host->dmach);
stmp3xxx_dma_go(host->dmach, dma_desc, 1);
wait_for_completion(&host->dma_done);
cmd->error = stmp3xxx_mmc_cmd_error(host->status);
if (stmp3xxx_dma_running(host->dmach))
dev_dbg(host->dev, "DMA command not finished\n");
if (cmd->error) {
dev_dbg(host->dev, "Command error 0x%x\n", cmd->error);
stmp3xxx_dma_reset_channel(host->dmach);
}
}
开发者ID:despierto,项目名称:imx_233_linux,代码行数:29,代码来源:stmp3xxx_mmc.c
示例5: insert
node * insert(node *T,int x)
{
if(T==NULL)
{
T=(node*)malloc(sizeof(node));
T->data=x;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insert(T->right,x);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insert(T->left,x);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}
T->ht=height(T);
return(T);
}
开发者ID:kc-alva,项目名称:EDD_practica2,代码行数:34,代码来源:main.c
示例6: stmp37xx_circ_advance_active
void stmp37xx_circ_advance_active(struct stmp37xx_circ_dma_chain *chain,
unsigned count)
{
void __iomem *c;
u32 mask_clr, mask;
BUG_ON(chain->free_count < count);
chain->free_count -= count;
chain->free_index += count;
chain->free_index %= chain->total_count;
chain->active_count += count;
switch (chain->bus) {
case STMP3XXX_BUS_APBH:
c = REGS_APBH_BASE + HW_APBH_CHn_SEMA + 0x70 * chain->channel;
mask_clr = BM_APBH_CHn_SEMA_INCREMENT_SEMA;
mask = BF(count, APBH_CHn_SEMA_INCREMENT_SEMA);
break;
case STMP3XXX_BUS_APBX:
c = REGS_APBX_BASE + HW_APBX_CHn_SEMA + 0x70 * chain->channel;
mask_clr = BM_APBX_CHn_SEMA_INCREMENT_SEMA;
mask = BF(count, APBX_CHn_SEMA_INCREMENT_SEMA);
break;
default:
BUG();
return;
}
/* Set counting semaphore (kicks off transfer). Assumes
peripheral has been set up correctly */
stmp3xxx_clearl(mask_clr, c);
stmp3xxx_setl(mask, c);
}
开发者ID:0x0f,项目名称:android-tegra-nv-2.6.39,代码行数:33,代码来源:dma.c
示例7: set_otp_timing
static int set_otp_timing(void)
{
u32 clk_rate = 0;
u32 relax, strobe_read, strobe_prog;
u32 timing = 0;
/* get clock */
clk_rate = mxc_get_clock(MXC_IPG_CLK);
if (clk_rate == -1) {
printf("ERROR: mxc_get_clock failed\n");
return -1;
}
log("clk_rate: %d.", clk_rate);
relax = clk_rate / (1000000000 / DEF_RELAX) - 1;
strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1;
strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1;
timing = BF(relax, OCOTP_TIMING_RELAX);
timing |= BF(strobe_read, OCOTP_TIMING_STROBE_READ);
timing |= BF(strobe_prog, OCOTP_TIMING_STROBE_PROG);
log("timing: 0x%X", timing);
writel(timing, IMX_OTP_BASE + HW_OCOTP_TIMING);
return 0;
}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:28,代码来源:imx_otp.c
示例8: timing_ctrl_rams
int timing_ctrl_rams(int ss)
{
__raw_writel(BF(ss, DIGCTL_ARMCACHE_VALID_SS) |
BF(ss, DIGCTL_ARMCACHE_DRTY_SS) |
BF(ss, DIGCTL_ARMCACHE_CACHE_SS) |
BF(ss, DIGCTL_ARMCACHE_DTAG_SS) |
BF(ss, DIGCTL_ARMCACHE_ITAG_SS),
DIGCTRL_BASE_ADDR + HW_DIGCTL_ARMCACHE);
return 0;
}
开发者ID:Angor00,项目名称:linux-aura-hd-android-2.6.35.3,代码行数:10,代码来源:bus_freq.c
示例9: stmp3xxx_set_sclk_speed
/*
* Change divisors to reflect the rate of 'hz'. Note that we should not
* play with clock rate, because the same source is used to clock both
* SSP ports.
*/
static void
stmp3xxx_set_sclk_speed(struct stmp3xxx_mmc_host *host, unsigned int hz)
{
unsigned long ssp;
u32 div1, div2;
u32 val;
struct stmp3xxxmmc_platform_data *pdata = host->dev->platform_data;
if (get_evk_board_version() == 1) {
/*EVK Ver1 max clock is 12M */
if (hz > 12000000)
hz = 12000000;
}
if (pdata && pdata->setclock) {
/*
if the SSP is buggy and platform provides callback...
well, let it be.
*/
host->clkrt = pdata->setclock(hz);
return;
}
/*
...but the RightIdea(tm) is to set divisors to match
the requested clock.
*/
hz /= 1000;
ssp = clk_get_rate(host->clk);
for (div1 = 2; div1 < 254; div1 += 2) {
div2 = ssp / hz / div1;
if (div2 < 0x100)
break;
}
if (div1 >= 254) {
dev_err(host->dev, "Cannot set clock to %dkHz\n", hz);
return;
}
dev_dbg(host->dev, "Setting clock rate to %ld kHz [%x+%x] "
"(requested %d), source %ldk\n",
ssp / div1 / div2, div1, div2, hz, ssp);
val = __raw_readl(host->ssp_base + HW_SSP_TIMING);
val &= ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE);
val |= BF(div1, SSP_TIMING_CLOCK_DIVIDE) |
BF(div2 - 1, SSP_TIMING_CLOCK_RATE);
__raw_writel(val, host->ssp_base + HW_SSP_TIMING);
host->clkrt = ssp / div1 / div2 * 1000;
}
开发者ID:despierto,项目名称:imx_233_linux,代码行数:58,代码来源:stmp3xxx_mmc.c
示例10: Delete
node * Delete(node *T,int x)
{ node *p;
if(T==NULL)
{
return NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=Delete(T->right,x);
if(BF(T)==2)
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
if(x<T->data)
{
T->left=Delete(T->left,x);
if(BF(T)==-2)//Rebalance during windup
if(BF(T->right)<=0)
T=RR(T);
else
T=RL(T);
}
else
{
//data to be deleted is found
if(T->right !=NULL)
{ //delete its inordersuccesor
p=T->right;
while(p->left != NULL)
p=p->left;
T->data=p->data;
T->right=Delete(T->right,p->data);
if(BF(T)==2)//Rebalance during windup
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
return(T->left);
}
T->ht=height(T);
return(T);
}
开发者ID:kc-alva,项目名称:EDD_practica2,代码行数:52,代码来源:main.c
示例11: if
static struct avl_node *_avl_delete(struct avl_node *n, int key)
{
if(!n) return NULL;
if(key < K(n)) L(n) = _avl_delete(L(n), key);
else if(key > K(n)) R(n) = _avl_delete(R(n), key);
else { // key == K(n)
if(NULL == L(n) || NULL == R(n)) {
struct avl_node *tmp = L(n) ? L(n) : R(n);
if(tmp) {
*n = *tmp; // copy contents of child to n
}
else { // n is leaf
tmp = n;
n = NULL;
}
free(tmp);
}
else { // two children case
struct avl_node *d = _avl_minimum(n);
K(n) = K(d);
R(n) = _avl_delete(d, key);
}
}
// no child case
if(!n) return NULL;
H(n) = MAX(HH(n->left), HH(n->right)) + 1;
int bf = BF(n);
if(bf > 1) {
if(0 > BF(L(n))) { // LR case
L(n) = _leftRotate(L(n));
}
// else LL case
return _rightRotate(n);
}
if(bf < -1) {
if(0 < BF(R(n))) { // RL case
R(n) = _rightRotate(R(n));
}
// else RR case
return _leftRotate(n);
}
return n;
}
开发者ID:dannoy,项目名称:tools,代码行数:50,代码来源:avl.c
示例12: evaluateFields
void CismSurfaceGradFO<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
for (std::size_t cell=0; cell < workset.numCells; ++cell) {
for (std::size_t qp=0; qp < numQPs; ++qp) {
gradS_qp(cell,qp,0) = dsdx_node(cell, 0) * BF(cell, 0, qp);
gradS_qp(cell,qp,1) = dsdy_node(cell, 0) * BF(cell, 0, qp);
for (std::size_t node=1; node < numNodes; ++node) {
gradS_qp(cell,qp,0) += dsdx_node(cell, node) * BF(cell, node, qp);
gradS_qp(cell,qp,1) += dsdy_node(cell, node) * BF(cell, node, qp);
}
}
}
}
开发者ID:Sam-MSU,项目名称:Albany,代码行数:14,代码来源:FELIX_CismSurfaceGradFO_Def.hpp
示例13: testKNNG
bool testKNNG(unsigned int Size, unsigned int k, T min, T max, int num_threads)
{
typedef reviver::dpoint<T, DIM> Point;
std::vector<Point> data;
std::vector<long unsigned int> bf_ans;
data.resize(Size);
for(unsigned int i=0;i < data.size();++i)
{
data[i] = newRandomPoint<Point, T>(min, max);
}
bruteNN<Point> BF(&data[0], data.size());
sfcnn_knng<Point, DIM, T> SFC(&data[0], data.size(), k, num_threads);
for(unsigned int i=0;i < data.size();++i)
{
BF.ksearch(data[i], k+1, bf_ans);
for(unsigned int j=1;j < k+1;++j)
{
if(bf_ans[j] != SFC[i][j-1])
return false;
}
}
return true;
}
开发者ID:Degot,项目名称:Las-Vegas-Reconstruction,代码行数:27,代码来源:test.hpp
示例14: fuse_read_addr
static int fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
{
u32 ctrl_reg;
int ret;
writel(OCOTP_CTRL_ERROR, priv->base + OCOTP_CTRL_CLR);
ctrl_reg = readl(priv->base + OCOTP_CTRL);
ctrl_reg &= ~OCOTP_CTRL_ADDR_MASK;
ctrl_reg &= ~OCOTP_CTRL_WR_UNLOCK_MASK;
ctrl_reg |= BF(addr, OCOTP_CTRL_ADDR);
writel(ctrl_reg, priv->base + OCOTP_CTRL);
writel(OCOTP_READ_CTRL_READ_FUSE, priv->base + OCOTP_READ_CTRL);
ret = imx6_ocotp_wait_busy(priv, 0);
if (ret)
return ret;
if (readl(priv->base + OCOTP_CTRL) & OCOTP_CTRL_ERROR)
*pdata = 0xbadabada;
else
*pdata = readl(priv->base + OCOTP_READ_FUSE_DATA);
return 0;
}
开发者ID:gazoo74,项目名称:barebox,代码行数:25,代码来源:ocotp.c
示例15: NV30EXACheckComposite
Bool
NV30EXACheckComposite(int op, PicturePtr psPict,
PicturePtr pmPict,
PicturePtr pdPict)
{
nv_pict_surface_format_t *fmt;
nv_pict_op_t *opr;
opr = NV30_GetPictOpRec(op);
if (!opr)
NOUVEAU_FALLBACK("unsupported blend op 0x%x\n", op);
fmt = NV30_GetPictSurfaceFormat(pdPict->format);
if (!fmt)
NOUVEAU_FALLBACK("dst picture format 0x%08x not supported\n",
pdPict->format);
if (!NV30EXACheckCompositeTexture(psPict, pdPict, op))
NOUVEAU_FALLBACK("src picture\n");
if (pmPict) {
if (pmPict->componentAlpha &&
PICT_FORMAT_RGB(pmPict->format) &&
opr->src_alpha && opr->src_card_op != BF(ZERO))
NOUVEAU_FALLBACK("mask CA + SA\n");
if (!NV30EXACheckCompositeTexture(pmPict, pdPict, op))
NOUVEAU_FALLBACK("mask picture\n");
}
return TRUE;
}
开发者ID:Vikthor,项目名称:xf86-video-nouveau,代码行数:30,代码来源:nv30_exa.c
示例16: assert
//BEGIN send::host_list
message_udp::send::host_list::host_list(const net::buffer & random,
const std::string & local_ID,
const std::list<net::endpoint> & hosts)
{
assert(random.size() == 4);
assert(hosts.size() <= protocol_udp::host_list_elements);
bit_field BF(16);
unsigned cnt = 0;
for(std::list<net::endpoint>::const_iterator it_cur = hosts.begin(),
it_end = hosts.end(); it_cur != it_end; ++it_cur)
{
if(it_cur->version() == net::IPv4){
BF[cnt] = 0;
}else{
BF[cnt] = 1;
}
++cnt;
}
buf.append(protocol_udp::host_list)
.append(random)
.append(convert::hex_to_bin(local_ID))
.append(BF.get_buf());
//append addresses
for(std::list<net::endpoint>::const_iterator it_cur = hosts.begin(),
it_end = hosts.end(); it_cur != it_end; ++it_cur)
{
buf.append(it_cur->IP_bin())
.append(it_cur->port_bin());
}
}
开发者ID:sbunce,项目名称:p2p,代码行数:31,代码来源:message_udp.cpp
示例17: L
static struct avl_node *_avlInsert(struct avl_node *n, int key)
{
if(!n) return _avlNewNode(key);
if(key < K(n)) {
L(n) = _avlInsert(L(n), key);
}
else {
R(n) = _avlInsert(R(n), key);
}
H(n) = MAX(HH(n->left), HH(n->right)) + 1;
int bf = BF(n);
if(bf > 1) {
if(key > K(L(n))) { // LR case
L(n) = _leftRotate(L(n));
}
// else LL case
return _rightRotate(n);
}
if(bf < -1) {
if(key < K(R(n))) { // RL case
R(n) = _rightRotate(R(n));
}
// else RR case
return _leftRotate(n);
}
return n;
}
开发者ID:dannoy,项目名称:tools,代码行数:32,代码来源:avl.c
示例18: testNN
bool testNN(unsigned int Size, unsigned int k, T min, T max)
{
typedef reviver::dpoint<T, DIM> Point;
std::vector<Point> data;
std::vector<Point> query;
std::vector<long unsigned int> sfcnn_ans;
std::vector<long unsigned int> bf_ans;
data.resize(Size);
query.resize(Size);
for(unsigned int i=0;i < data.size();++i)
{
data[i] = newRandomPoint<Point, T>(min, max);
query[i] = newRandomPoint<Point, T>(min, max);
}
bruteNN<Point> BF(&data[0], data.size());
sfcnn<Point, DIM, T> SFC(&data[0], data.size());
for(unsigned int i=0;i < data.size();++i)
{
BF.ksearch(query[i], k, bf_ans);
SFC.ksearch(query[i], k, sfcnn_ans);
for(unsigned int j=0;j < Point::__DIM;++j)
{
if(bf_ans[j] != sfcnn_ans[j])
return false;
}
}
return true;
}
开发者ID:Degot,项目名称:Las-Vegas-Reconstruction,代码行数:33,代码来源:test.hpp
示例19: remote_ID
bool message_udp::recv::host_list::recv(const net::buffer & recv_buf,
const net::endpoint & endpoint)
{
if(!expect(recv_buf)){
return false;
}
std::string remote_ID(convert::bin_to_hex(std::string(
reinterpret_cast<const char *>(recv_buf.data())+5, 20)));
bit_field BF(recv_buf.data()+25, 2, 16);
std::list<net::endpoint> hosts;
unsigned offset = protocol_udp::host_list_size;
for(unsigned x=0; x<16 && offset != recv_buf.size(); ++x){
if(BF[x] == 0){
//IPv4
boost::optional<net::endpoint> ep = net::bin_to_endpoint(
recv_buf.str(offset, 4), recv_buf.str(offset + 4, 2));
if(ep){
hosts.push_back(*ep);
}
offset += 6;
}else{
//IPv6
boost::optional<net::endpoint> ep = net::bin_to_endpoint(
recv_buf.str(offset, 16), recv_buf.str(offset + 16, 2));
if(ep){
hosts.push_back(*ep);
}
offset += 18;
}
}
func(endpoint, remote_ID, hosts);
return true;
}
开发者ID:sbunce,项目名称:p2p,代码行数:33,代码来源:message_udp.cpp
示例20: evaluateFields
void DOFInterpolation<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
//Intrepid version:
// for (int i=0; i < val_qp.size() ; i++) val_qp[i] = 0.0;
// Intrepid::FunctionSpaceTools:: evaluate<ScalarT>(val_qp, val_node, BF);
for (std::size_t cell=0; cell < workset.numCells; ++cell) {
for (std::size_t qp=0; qp < numQPs; ++qp) {
ScalarT& vqp = val_qp(cell,qp);
vqp = val_node(cell, 0) * BF(cell, 0, qp);
for (std::size_t node=1; node < numNodes; ++node) {
vqp += val_node(cell, node) * BF(cell, node, qp);
}
}
}
}
开发者ID:adam727,项目名称:Albany,代码行数:17,代码来源:PHAL_DOFInterpolation_Def.hpp
注:本文中的BF函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论