本文整理汇总了C++中R4函数的典型用法代码示例。如果您正苦于以下问题:C++ R4函数的具体用法?C++ R4怎么用?C++ R4使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R4函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Transform
static void Transform(Sha* sha)
{
word32 W[80], i;
/* Copy context->state[] to working vars */
word32 a = sha->digest[0];
word32 b = sha->digest[1];
word32 c = sha->digest[2];
word32 d = sha->digest[3];
word32 e = sha->digest[4];
for (i = 0; i < 16; i++)
W[i] = sha->buffer[i];
for (i = 16; i < 80; i++)
W[i] = rotlFixed(W[i-3]^W[i-8]^W[i-14]^W[i-16],1);
/* 4 rounds of 20 operations each. */
for (i = 0; i < 20; ) {
R0(a,b,c,d,e,i); i++;
R0(e,a,b,c,d,i); i++;
R0(d,e,a,b,c,i); i++;
R0(c,d,e,a,b,i); i++;
R0(b,c,d,e,a,i); i++;
}
for (i = 20; i < 40; ) {
R2(a,b,c,d,e,i); i++;
R2(e,a,b,c,d,i); i++;
R2(d,e,a,b,c,i); i++;
R2(c,d,e,a,b,i); i++;
R2(b,c,d,e,a,i); i++;
}
for (i = 40; i < 60; ) {
R3(a,b,c,d,e,i); i++;
R3(e,a,b,c,d,i); i++;
R3(d,e,a,b,c,i); i++;
R3(c,d,e,a,b,i); i++;
R3(b,c,d,e,a,i); i++;
}
for (i = 60; i < 80; ) {
R4(a,b,c,d,e,i); i++;
R4(e,a,b,c,d,i); i++;
R4(d,e,a,b,c,i); i++;
R4(c,d,e,a,b,i); i++;
R4(b,c,d,e,a,i); i++;
}
/* Add the working vars back into digest state[] */
sha->digest[0] += a;
sha->digest[1] += b;
sha->digest[2] += c;
sha->digest[3] += d;
sha->digest[4] += e;
}
示例2: transform
static void transform(uint32_t state[5], uint8_t buffer[64]){
uint32_t block[80];
unsigned int i, a, b, c, d, e;
a = state[0];
b = state[1];
c = state[2];
d = state[3];
e = state[4];
#ifdef CONFIG_SMALL
for(i=0; i<80; i++){
int t;
if(i<16) t= be2me_32(((uint32_t*)buffer)[i]);
else t= rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1);
block[i]= t;
t+= e+rol(a,5);
if(i<40){
if(i<20) t+= ((b&(c^d))^d) +0x5A827999;
else t+= ( b^c ^d) +0x6ED9EBA1;
}else{
if(i<60) t+= (((b|c)&d)|(b&c))+0x8F1BBCDC;
else t+= ( b^c ^d) +0xCA62C1D6;
}
e= d;
d= c;
c= rol(b,30);
b= a;
a= t;
}
#else
for(i=0; i<15; i+=5){
R0(a,b,c,d,e,0+i); R0(e,a,b,c,d,1+i); R0(d,e,a,b,c,2+i); R0(c,d,e,a,b,3+i); R0(b,c,d,e,a,4+i);
}
R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
for(i=20; i<40; i+=5){
R2(a,b,c,d,e,0+i); R2(e,a,b,c,d,1+i); R2(d,e,a,b,c,2+i); R2(c,d,e,a,b,3+i); R2(b,c,d,e,a,4+i);
}
for(; i<60; i+=5){
R3(a,b,c,d,e,0+i); R3(e,a,b,c,d,1+i); R3(d,e,a,b,c,2+i); R3(c,d,e,a,b,3+i); R3(b,c,d,e,a,4+i);
}
for(; i<80; i+=5){
R4(a,b,c,d,e,0+i); R4(e,a,b,c,d,1+i); R4(d,e,a,b,c,2+i); R4(c,d,e,a,b,3+i); R4(b,c,d,e,a,4+i);
}
#endif
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
}
示例3: k8_mc2_mce
static bool k8_mc2_mce(u16 ec, u8 xec)
{
bool ret = true;
if (xec == 0x1)
pr_cont(" in the write data buffers.\n");
else if (xec == 0x3)
pr_cont(" in the victim data buffers.\n");
else if (xec == 0x2 && MEM_ERROR(ec))
pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec));
else if (xec == 0x0) {
if (TLB_ERROR(ec))
pr_cont(": %s error in a Page Descriptor Cache or "
"Guest TLB.\n", TT_MSG(ec));
else if (BUS_ERROR(ec))
pr_cont(": %s/ECC error in data read from NB: %s.\n",
R4_MSG(ec), PP_MSG(ec));
else if (MEM_ERROR(ec)) {
u8 r4 = R4(ec);
if (r4 >= 0x7)
pr_cont(": %s error during data copyback.\n",
R4_MSG(ec));
else if (r4 <= 0x1)
pr_cont(": %s parity/ECC error during data "
"access from L2.\n", R4_MSG(ec));
else
ret = false;
} else
ret = false;
} else
ret = false;
return ret;
}
示例4: R4
void Homography::estimate(int *noi, int *nof, double threshold)
{
if(_n < 20) {
_hom.setIdentity();
return;
}
RX::mat3 H3, H4;
Ransac R4(_ux2, _ux1, _nused);
R4.normalize();
R4.mainLoop(4, 0.01, H4);
R4.fitHomography(H4);
R4.denormalize(H4);
_hom = H4;
if(noi) *noi = R4.noi();
if(nof) *nof = R4.nof();
_inliers = R4.inliers();
for(int i = 0; i < 3; ++i) {
for(int j = 0; j < 3; ++j) {
_hom.set(i, j, _hom.at(i, j)/_hom.at(2, 2));
}
}
}
示例5: sha1_core
static void sha1_core(struct sha1_ctx * ctx)
{
__m128i a, b, c, d, e;
__m128i k0, k1, k2, k3;
__m128i v1, w;
SVAL buf[16];
a = SET1(AA);
b = SET1(BB);
c = SET1(CC);
d = SET1(DD);
e = SET1(EE);
k0 = SET1(K0);
R20(SHA1R0, 0);
k1 = SET1(K1);
R20(SHA1R1, 20);
k2 = SET1(K2);
R20(SHA1R2, 40);
k3 = SET1(K3);
R16(SHA1R3, 60);
if (!ssresult_check(ctx->sres, a)) return;
R4(SHA1R3, 76);
FINAL(0, a, AA);
FINAL(1, b, BB);
FINAL(2, c, CC);
FINAL(3, d, DD);
FINAL(4, e, EE);
check_result(ctx);
}
示例6: k8_mc1_mce
static bool k8_mc1_mce(u16 ec, u8 xec)
{
u8 ll = LL(ec);
bool ret = true;
if (!MEM_ERROR(ec))
return false;
if (ll == 0x2)
pr_cont("during a linefill from L2.\n");
else if (ll == 0x1) {
switch (R4(ec)) {
case R4_IRD:
pr_cont("Parity error during data load.\n");
break;
case R4_EVICT:
pr_cont("Copyback Parity/Victim error.\n");
break;
case R4_SNOOP:
pr_cont("Tag Snoop error.\n");
break;
default:
ret = false;
break;
}
} else
ret = false;
return ret;
}
示例7: decode_mc3_mce
static void decode_mc3_mce(struct mce *m)
{
u16 ec = EC(m->status);
u8 xec = XEC(m->status, xec_mask);
if (boot_cpu_data.x86 >= 0x14) {
pr_emerg("You shouldn't be seeing MC3 MCE on this cpu family,"
" please report on LKML.\n");
return;
}
pr_emerg(HW_ERR "MC3 Error");
if (xec == 0x0) {
u8 r4 = R4(ec);
if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR))
goto wrong_mc3_mce;
pr_cont(" during %s.\n", R4_MSG(ec));
} else
goto wrong_mc3_mce;
return;
wrong_mc3_mce:
pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n");
}
示例8: f10h_mc0_mce
static bool f10h_mc0_mce(u16 ec, u8 xec)
{
if (R4(ec) == R4_GEN && LL(ec) == LL_L1) {
pr_cont("during data scrub.\n");
return true;
}
return f12h_mc0_mce(ec, xec);
}
示例9: a
void
EulerAngleUpdaterCheck::initialize()
{
const auto grain_num = _grain_tracker.getTotalFeatureCount();
_angles.resize(grain_num);
_angles_old.resize(grain_num);
_diff.assign(3 * grain_num, 0.0);
for (unsigned int i = 0; i < grain_num; ++i)
{
_angles[i] = _euler.getEulerAngles(i);
_angles_old[i] = _euler.getEulerAnglesOld(i);
RealGradient torque = _grain_torque.getTorqueValues()[i];
RealVectorValue a(1, 1, 1);
RotationTensor R(_angles[i]); // Final rotation tensor
RealVectorValue a_rot = R * a; // final rotated vector
RotationTensor R0(_angles_old[i]); // RotationTensor as per old euler angles
RealVectorValue torque_rot = R0 * torque; // Rotated torque
RealVectorValue a_rot0 = R0 * a; // Rotated unit vector as per old euler angles
/**
* Change in euler angles are obtained from the torque & angular velocities about the material
* axes.
* Change in phi1, Phi and phi2 are caused by rotation about z axis, x' axis & z'' axis,
* respectively.
* Components of the angular velocities across z, x' and z'' axes are obtained from the torque
* values.
* This yields change in euler angles due to grain rotation.
*/
RealVectorValue torque_rot1;
RealVectorValue angle_rot;
torque_rot1(0) =
torque_rot(2); // Tourque about z changed to torque responsible for chaneg in angle phi1
angle_rot(0) = _mr / _grain_volumes[i] * torque_rot1(0) * _dt; // change in phi1
// Tourque about x' changed to torque responsible for chaneg in angle Phi
torque_rot1(1) =
(torque_rot(0) * std::cos(angle_rot(0)) + torque_rot(1) * std::sin(angle_rot(0)));
angle_rot(1) = _mr / _grain_volumes[i] * torque_rot1(1) * _dt; // change in Phi
// Tourque about z'' changed to torque responsible for chaneg in angle phi2
torque_rot1(2) = (torque_rot(0) * std::sin(angle_rot(0)) * std::sin(angle_rot(1)) -
torque_rot(1) * std::cos(angle_rot(0)) * std::sin(angle_rot(1)) +
torque_rot(2) * std::cos(angle_rot(1)));
angle_rot(2) = _mr / _grain_volumes[i] * torque_rot1(2) * _dt; // change in phi2
angle_rot *= (180.0 / libMesh::pi);
RotationTensor R4(angle_rot); // RotationTensor due to grain rotation
RealVectorValue a_rot1 = R4 * a_rot0; // Final rotated vector obtained in two step rotation
// Difference between the final positions of the rotated vector obtained in two different ways,
// should be 0.0
_diff[3 * i + 0] = a_rot(0) - a_rot1(0);
_diff[3 * i + 1] = a_rot(1) - a_rot1(1);
_diff[3 * i + 2] = a_rot(2) - a_rot1(2);
}
}
示例10: main
int main(int argc, char** argv) {
Giornale G1(12.50, "Titolo1", false);
Giornale G2(1.50, "Titolo2", true);
Giornale G3(2.00, "Titolo3", false);
Rivista R4(22.70, "Titolo4", false, "Editore4", "Periodo4");
Rivista R5(11.50, "Titolo5", true, "Editore5", "Periodo5");
Rivista R6(6.00, "Titolo6", false, "Editore6", "Periodo6");
Quotidiano Q7(6.35, "Titolo7", false, "Direttore7", true);
Quotidiano Q8(9.99, "Titolo8", true, "Direttore8", false);
Quotidiano Q9(5, "Titolo9", false, "Direttore9", true);
cout<<"Polimorfismo:\n";
Giornale * vett[9];
vett[0] = &G1;
vett[1] = &G2;
vett[2] = &G3;
vett[3] = &R4;
vett[4] = &R5;
vett[5] = &R6;
vett[6] = &Q7;
vett[7] = &Q8;
vett[8] = &Q9;
for(int i=0; i<9; i++) {
cout << *vett[i] << "\n\n";
}
cout<<"\n\nPila:\n";
Pila P;
for(int i=0; i<9; i++) {
P.push(vett[i]);
}
cout<<P;
ofstream file;
file.open("./test.txt", ios::out);
if(!file) {
cout<<"Errore apertura file.";
} else {
file << P;
}
file.close();
Rivista R10(1.00, "Titolo10", false, "Editore10", "Periodo10");
Quotidiano Q11(1.35, "Titolo11", false, "Direttore11", true);
P.push(&R10);
cout<<"\n\nEccezione:\n";
try {
P.push(&Q11);
} catch(SpaceOverflow e) {
cout<<e.errorLog();
}
return 0;
}
示例11: f14h_mc0_mce
static bool f14h_mc0_mce(u16 ec, u8 xec)
{
u8 r4 = R4(ec);
bool ret = true;
if (MEM_ERROR(ec)) {
if (TT(ec) != TT_DATA || LL(ec) != LL_L1)
return false;
switch (r4) {
case R4_DRD:
case R4_DWR:
pr_cont("Data/Tag parity error due to %s.\n",
(r4 == R4_DRD ? "load/hw prf" : "store"));
break;
case R4_EVICT:
pr_cont("Copyback parity error on a tag miss.\n");
break;
case R4_SNOOP:
pr_cont("Tag parity error during snoop.\n");
break;
default:
ret = false;
}
} else if (BUS_ERROR(ec)) {
if ((II(ec) != II_MEM && II(ec) != II_IO) || LL(ec) != LL_LG)
return false;
pr_cont("System read data error on a ");
switch (r4) {
case R4_RD:
pr_cont("TLB reload.\n");
break;
case R4_DWR:
pr_cont("store.\n");
break;
case R4_DRD:
pr_cont("load.\n");
break;
default:
ret = false;
}
} else {
ret = false;
}
return ret;
}
示例12: decode_stqraw
/* decode skytraq raw channel mesurement -------------------------------------*/
static int decode_stqraw(raw_t *raw)
{
int i,j,iod,prn,sat,n=0,nsat;
unsigned char *p=raw->buff+4,ind;
trace(4,"decode_stqraw: len=%d\n",raw->len);
iod=U1(p+1);
if (iod!=raw->iod) {
trace(2,"stq raw iod error: iod=%d %d\n",iod,raw->iod);
return -1;
}
nsat=U1(p+2);
if (raw->len<8+23*nsat) {
trace(2,"stq raw length error: len=%d nsat=%d\n",raw->len,nsat);
return -1;
}
for (i=0,p+=3;i<nsat&&i<MAXOBS;i++,p+=23) {
ind =U1(p+22);
prn =U1(p);
raw->obs.data[n].SNR[0]=(unsigned char)(U1(p+1)*4.0+0.5);
raw->obs.data[n].P[0] =(ind&0x1)?R8(p+ 2):0.0;
raw->obs.data[n].L[0] =(ind&0x4)?R8(p+10):0.0;
raw->obs.data[n].D[0] =(ind&0x2)?R4(p+18):0.0f;
raw->obs.data[n].LLI[0]=(ind&0x8)?1:0; /* slip */
raw->obs.data[n].code[0]=CODE_L1C;
/* receiver dependent options */
if (strstr(raw->opt,"-invcp")) {
raw->obs.data[n].L[0]=-raw->obs.data[n].L[0];
}
if (prn>MAXPRNGPS) prn+=MINPRNSBS-38;
if (!(sat=satno(MINPRNSBS<=prn?SYS_SBS:SYS_GPS,prn))) {
trace(2,"stq raw satellite number error: prn=%d\n",prn);
continue;
}
raw->obs.data[n].time=raw->time;
raw->obs.data[n].sat =sat;
for (j=1;j<NFREQ;j++) {
raw->obs.data[n].L[j]=raw->obs.data[n].P[j]=0.0;
raw->obs.data[n].D[j]=0.0;
raw->obs.data[n].SNR[j]=raw->obs.data[n].LLI[j]=0;
raw->obs.data[n].code[j]=CODE_NONE;
}
n++;
}
raw->obs.n=n;
return n>0?1:0;
}
示例13: decode_x4aiono
/* decode NVS x4aiono --------------------------------------------------------*/
static int decode_x4aiono(raw_t *raw)
{
unsigned char *p=raw->buff+2;
trace(4,"decode_x4aiono: len=%d\n", raw->len);
raw->nav.ion_gps[0] = R4(p );
raw->nav.ion_gps[1] = R4(p+ 4);
raw->nav.ion_gps[2] = R4(p+ 8);
raw->nav.ion_gps[3] = R4(p+12);
raw->nav.ion_gps[4] = R4(p+16);
raw->nav.ion_gps[5] = R4(p+20);
raw->nav.ion_gps[6] = R4(p+24);
raw->nav.ion_gps[7] = R4(p+28);
return 9;
}
示例14: decode_bnx_01_03
/* decode binex mesaage 0x01-03: decoded sbas ephmemeris ---------------------*/
static int decode_bnx_01_03(raw_t *raw, unsigned char *buff, int len)
{
seph_t seph={0};
unsigned char *p=buff;
double tow,tod,tof;
int prn,week,iodn;
trace(4,"binex 0x01-03: len=%d\n",len);
if (len>=98) {
prn =U1(p); p+=1;
week =U2(p); p+=2;
tow =U4(p); p+=4;
seph.af0 =R8(p); p+=8;
tod =R4(p); p+=4;
tof =U4(p); p+=4;
seph.pos[0]=R8(p)*1E3; p+=8;
seph.vel[0]=R8(p)*1E3; p+=8;
seph.acc[0]=R8(p)*1E3; p+=8;
seph.pos[1]=R8(p)*1E3; p+=8;
seph.vel[1]=R8(p)*1E3; p+=8;
seph.acc[1]=R8(p)*1E3; p+=8;
seph.pos[2]=R8(p)*1E3; p+=8;
seph.vel[2]=R8(p)*1E3; p+=8;
seph.acc[2]=R8(p)*1E3; p+=8;
seph.svh =U1(p); p+=1;
seph.sva =U1(p); p+=1;
iodn =U1(p);
}
else {
trace(2,"binex 0x01-03 length error: len=%d\n",len);
return -1;
}
if (!(seph.sat=satno(SYS_SBS,prn))) {
trace(2,"binex 0x01-03 satellite error: prn=%d\n",prn);
return -1;
}
seph.t0=gpst2time(week,tow);
seph.tof=adjweek(seph.t0,tof);
if (!strstr(raw->opt,"-EPHALL")) {
if (fabs(timediff(seph.t0,raw->nav.seph[prn-MINPRNSBS].t0))<1.0&&
seph.sva==raw->nav.seph[prn-MINPRNSBS].sva) return 0; /* unchanged */
}
raw->nav.seph[prn-MINPRNSBS]=seph;
raw->ephsat=seph.sat;
return 2;
}
示例15: f14h_mc1_mce
static bool f14h_mc1_mce(u16 ec, u8 xec)
{
u8 r4 = R4(ec);
bool ret = true;
if (MEM_ERROR(ec)) {
if (TT(ec) != 0 || LL(ec) != 1)
ret = false;
if (r4 == R4_IRD)
pr_cont("Data/tag array parity error for a tag hit.\n");
else if (r4 == R4_SNOOP)
pr_cont("Tag error during snoop/victimization.\n");
else
ret = false;
}
return ret;
}