本文整理汇总了C++中RR函数的典型用法代码示例。如果您正苦于以下问题:C++ RR函数的具体用法?C++ RR怎么用?C++ RR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: type
/*
Cria e envia uma trama do tipo type (Não funcional para tipo I)
*/
int buildFrame(int flag, char * type) {
info->frameSend[0] = F;
if (type == "set")
info->frameSend[2] = C_SET;
else if (type == "ua")
info->frameSend[2] = C_UA;
else if (type == "disc")
info->frameSend[2] = C_DISC;
else if (!strcmp(type, "rr1"))
info->frameSend[2] = RR(1);
else if (!strcmp(type,"rr0"))
info->frameSend[2] = RR(0);
else if (!strcmp(type,"rej0"))
info->frameSend[2] = REJ(0);
else if (!strcmp(type,"rej1"))
info->frameSend[2] = REJ(0);
else
return 0;
info->frameSend[1] = campo_endereco(info->flag, info->frameSend[2]);
info->frameSend[3] = info->frameSend[1]^info->frameSend[2];
info->frameSend[4] = F;
info->frameSendLength = 5;
//printf("Trama composta %s: 0x%x 0x%x 0x%x 0x%x 0x%x \n", type, info->frameSend[0], info->frameSend[1], info->frameSend[2], info->frameSend[3], info->frameSend[4]);
return 1;
}
示例2: pg_wait
static int pg_wait( int unit, int go, int stop, int tmo, char * msg )
{ int j, r, e, s, p;
PG.status = 0;
j = 0;
while ((((r=RR(1,6))&go)||(stop&&(!(r&stop))))&&(time_before(jiffies,tmo))) {
if (j++ < PG_SPIN) udelay(PG_SPIN_DEL);
else pg_sleep(1);
}
if ((r&(STAT_ERR&stop))||time_after_eq(jiffies, tmo)) {
s = RR(0,7);
e = RR(0,1);
p = RR(0,2);
if (verbose > 1)
printk("%s: %s: stat=0x%x err=0x%x phase=%d%s\n",
PG.name,msg,s,e,p,time_after_eq(jiffies, tmo)?" timeout":"");
if (time_after_eq(jiffies, tmo)) e |= 0x100;
PG.status = (e >> 4) & 0xff;
return -1;
}
示例3: main
int main(void) {
Job in[N];
Job jobs[N];
int cnt = 0;
while (scanf("%s%d%d", in[cnt].name, &in[cnt].arrive_time, &in[cnt].serve_time) == 3) cnt++;
copy(jobs, in, cnt);
printf("FCFS\n");
FCFS(jobs, cnt);
display(jobs, cnt);
copy(jobs, in, cnt);
printf("RR-1\n");
RR(jobs, cnt, 1);
display(jobs, cnt);
copy(jobs, in, cnt);
printf("RR-4\n");
RR(jobs, cnt, 4);
display(jobs, cnt);
copy(jobs, in, cnt);
printf("SJF\n");
SJF(jobs, cnt);
display(jobs, cnt);
copy(jobs, in, cnt);
printf("HRN\n");
HRN(jobs, cnt);
display(jobs, cnt);
return 0;
}
示例4: tmpl
tmpl(uint32_t)::get_absolute_dest_reg(ins_t ins) const
{
switch(ins.call.op) {
case 0 : {
// Format2 instruction : sethi, branch, branch_fp, branch_cp, unimp or garbage...
if (ins.branches.op2 == 4)
// SETHI
return RR(ins.sethi.rd);
else
return 0;
break;
}
case 1 :
// This is a format1 instruction : CALL
return 0;
break;
case 2 :
case 3 :
// This is one of the logical instructions (format3)
return RR(ins.format3.rd);
break;
}
return 0;
}
示例5: dss_restore_context
static void dss_restore_context(void)
{
RR(SYSCONFIG);
RR(CONTROL);
RR(SDI_CONTROL);
RR(PLL_CONTROL);
}
示例6: ClearRenderRows
/**
* Function ReFillRender
* Rebuild Render for instance after the config is read
*/
void GERBER_LAYER_WIDGET::ReFillRender()
{
ClearRenderRows();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[3] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR( _( "Grid" ), GERBER_GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "DCodes" ), DCODES_VISIBLE, WHITE, _( "Show DCodes identification" ) ),
RR( _( "Neg. Obj." ), NEGATIVE_OBJECTS_VISIBLE, DARKGRAY,
_( "Show negative objects in this color" ) ),
};
for( unsigned row=0; row<DIM(renderRows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
renderRows[row].color = myframe->GetVisibleElementColor(
(GERBER_VISIBLE_ID)renderRows[row].id );
}
renderRows[row].state = myframe->IsElementVisible(
(GERBER_VISIBLE_ID)renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
}
示例7: verifyFrameType
/*
retorna o tipo de frame verificando o campo de controlo
*/
char * verifyFrameType(char * frame) {
switch(frame[2]) {
case C_SET:
return "set";
break;
case C_DISC:
return "disc";
break;
case C_UA:
return "ua";
break;
case RR(1):
return "rr1";
break;
case RR(0):
return "rr0";
break;
case REJ(0):
return "rej0";
break;
case REJ(1):
return "rej1";
break;
case C_I0:
return "I0";
break;
case C_I1:
return "I1";
break;
}
}
示例8: orderstats
RR orderstats(const vector<double>& binomCoeff, vector<double>& sigs){
int numLayers = sigs.size();
//First we sort them
double tmp;
bool changed = true;
while(changed){
changed = false;
for(int i=0; i<numLayers-1; i++){
if(sigs[i]<sigs[i+1]){
tmp = sigs[i];
sigs[i] = sigs[i+1];
sigs[i+1] = tmp;
changed = true;
}
}
}
vector<RR> ordersigs;
RR sqr2(2);
sqr2 = sqrt(sqr2);
ordersigs.resize(numLayers);
try{
for(int i=0; i<numLayers; i++){
ordersigs[i] = sigs[i];
ordersigs[i] = RR(0.5) * erfc(ordersigs[i] / sqr2); //We find the cumulative distribution of each
}
}catch(const std::exception& e)
{
std::cout << "\n""Message from thrown exception was:\n " << e.what() << std::endl;
}
for(int i=0; i<numLayers; i++){
RR sum(0.0);
for(int j= i+1; j<=numLayers; j++){
sum += RR(binomCoeff[j]) * pow(ordersigs[i], j) * pow(1.0-ordersigs[i],numLayers-j);
}
ordersigs[i] = sum;
}
int min = 0;
for(int i=1; i<numLayers; i++){
if(ordersigs[i] < ordersigs[min]){
min = i;
}
}
return ordersigs[min];
}
示例9: 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);
}
示例10: main
int main()
{
int ch, size, burstTime[MAX], flag = 1,i;
printf("Enter the number of processes : \n");
scanf("%d",&size);
printf("Enter the burst time for each process P\n");
for (i = 0; i < size; ++i)
scanf("%d", &burstTime[i]);
printf("Enter the choice of implementation of CPU Scheduling Algorithm :\n");
menu();
while(flag)
{
scanf("%d",&ch);
switch(ch)
{
case 1 : FCFS(burstTime, size);
break;
// case 2 : SJF(burstTime, size);
// break;
case 3 : RR(burstTime, size);
break;
default : flag = 0;
continue;
}
}
printf("Thank You for using the program.\n");
}
示例11: insert
avltree insert(avltree root,Elemtype data)
{
if(!root)
{
root=(pnode)malloc(sizeof(node));
root->data=data;
root->left=root->right=0;
root->height=0;
}
else if(data < root->data) //插到左边
{
root->left=insert(root->left,data);
if(HEIGHT(root->left)-HEIGHT(root->right)==2) //失去平衡
{
if(data < root->left->data)
root=LL(root);
else
root=LR(root);
}
}
else if(data >root->data) //插到右边
{
root->right=insert(root->right,data);
if(HEIGHT(root->right)-HEIGHT(root->left)==2) //失去平衡
{
if(data > root->right->data)
root=RR(root);
else
root=RL(root);
}
}
//data在树中已存在时什么事也不做
root->height=MAX(HEIGHT(root->left),HEIGHT(root->right))+1;
return root;
}
示例12: epd_get_dep_prog
Eximpl int /* 0 | depth */
epd_get_dep_prog( EpdJob* ejp, int dftdep )
{
/*
* If |ce| > 32000 --> either normal with depth or prove lost with depth
* If dm > 0 --> normal with depth
* If pv ends in # --> normal or lost with depth
* |ce| >> 0 --> normal or lost with default depth
* else: Try normal and lost, default depth
* FFS: jobtype other than normal?
* We derive a depth, and a "jobprog", or fail.
*/
int ce;
int plies;
int dm;
int pv;
#define RR(dep, prog) { f_jobprog = (prog); return (dep); }
ce = epd_op_numval(ejp, "ce");
dm = epd_op_numval(ejp, "dm");
pv = epd_pv_plies(ejp);
if( ce > 32000 ) {
/* ce = 32767 - plies; plies = 32767 - ce
* plies = 2D-1; plies+1 = 2D; D = (plies+1)/2
*/
plies = 32767 - ce;
if( (plies > 0) && (plies % 2) ) {
RR( (plies+1)/2, JTP__normal )
}
}else if( ce < -32000 ) {
示例13: epat_log_adapter
static void epat_log_adapter( PIA *pi, char * scratch, int verbose )
{ int ver;
char *mode_string[6] =
{"4-bit","5/3","8-bit","EPP-8","EPP-16","EPP-32"};
epat_connect(pi);
WR(0xa,0x38); /* read the version code */
ver = RR(0xb);
epat_disconnect(pi);
#ifdef CONFIG_DEBUG_PRINTK
printk("%s: epat %s, Shuttle EPAT chip %x at 0x%x, ",
pi->device,EPAT_VERSION,ver,pi->port);
#else
;
#endif
#ifdef CONFIG_DEBUG_PRINTK
printk("mode %d (%s), delay %d\n",pi->mode,
mode_string[pi->mode],pi->delay);
#else
;
#endif
}
示例14: RL
static Node RL(Node rootnode){
printf("do a RL in node %d\n" , rootnode -> data);
rootnode -> right = LL(rootnode -> right);
return RR(rootnode);
}
示例15: RR
//right left situation
static TLDNode *RL(TLDNode *node){
TLDNode *temp;
temp=node->right;
//perform rotation
node->right=LL(temp);
return RR(node);
}