本文整理汇总了C++中P0函数的典型用法代码示例。如果您正苦于以下问题:C++ P0函数的具体用法?C++ P0怎么用?C++ P0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P0函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_assume(__unbuffered_cnt==3);
fence();
// EXPECT:exists
__CPROVER_assert(!(y==2 && __unbuffered_p1_r1==2 && __unbuffered_p2_r1==1 && __unbuffered_p2_r3==0), "Program was expected to be safe for PPC, model checker should have said NO.\nThis likely is a bug in the tool chain.");
return 0;
}
开发者ID:debleena89,项目名称:Mytest,代码行数:10,代码来源:safe116.c
示例2: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_assume(__unbuffered_cnt==3);
fence();
// EXPECT:exists
__CPROVER_assert(!(x==2 && y==2 && __unbuffered_p2_r3==0), "Program proven to be relaxed for PPC, model checker says YES.");
return 0;
}
开发者ID:AnnaTrost,项目名称:cbmc,代码行数:10,代码来源:lwdwr000.c
示例3: myType
AREXPORT ArMapObject::ArMapObject(const char *type,
ArPose pose,
const char *description,
const char *iconName,
const char *name,
bool hasFromTo,
ArPose fromPose,
ArPose toPose) :
myType((type != NULL) ? type : ""),
myBaseType(),
myName((name != NULL) ? name : "" ),
myDescription((description != NULL) ? description : "" ),
myPose(pose),
myIconName((iconName != NULL) ? iconName : "" ),
myHasFromTo(hasFromTo),
myFromPose(fromPose),
myToPose(toPose),
myFromToSegments(),
myStringRepresentation()
{
if (myHasFromTo)
{
double angle = myPose.getTh();
double sa = ArMath::sin(angle);
double ca = ArMath::cos(angle);
double fx = fromPose.getX();
double fy = fromPose.getY();
double tx = toPose.getX();
double ty = toPose.getY();
ArPose P0((fx*ca - fy*sa), (fx*sa + fy*ca));
ArPose P1((tx*ca - fy*sa), (tx*sa + fy*ca));
ArPose P2((tx*ca - ty*sa), (tx*sa + ty*ca));
ArPose P3((fx*ca - ty*sa), (fx*sa + ty*ca));
myFromToSegments.push_back(ArLineSegment(P0, P1));
myFromToSegments.push_back(ArLineSegment(P1, P2));
myFromToSegments.push_back(ArLineSegment(P2, P3));
myFromToSegments.push_back(ArLineSegment(P3, P0));
myFromToSegment.newEndPoints(fromPose, toPose);
}
else { // pose
size_t whPos = myType.rfind("WithHeading");
size_t whLen = 11;
if (whPos > 0) {
if (whPos == myType.size() - whLen) {
myBaseType = myType.substr(0, whPos);
}
}
} // end else pose
IFDEBUG(
ArLog::log(ArLog::Normal,
"ArMapObject::ctor() created %s (%s)",
myName.c_str(), myType.c_str());
);
开发者ID:PipFall2015,项目名称:Ottos-Cloud,代码行数:55,代码来源:ArMapObject.cpp
示例4: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_ASYNC_3: P3(0);
__CPROVER_assume(__unbuffered_cnt==4);
fence();
// EXPECT:exists
__CPROVER_assert(!(x==2 && z==2 && __unbuffered_p1_EAX==0 && __unbuffered_p3_EAX==2 && __unbuffered_p3_EBX==0), "Program proven to be relaxed for X86, model checker says YES.");
return 0;
}
开发者ID:DanielNeville,项目名称:cbmc,代码行数:11,代码来源:mix027.c
示例5: Sample_state_filter
PFilter::PFilter(std::size_t x_size, std::size_t s_size) :
Sample_state_filter (x_size, s_size),
Kalman_state_filter(x_size),
SIR_kalman_scheme(x_size, s_size, rnd),
w(wir)
{
PFilter::x_size = x_size;
FM::Vec x0(x_size);
x0.clear();
FM::SymMatrix P0(x_size, x_size);
P0.clear();
init(x0, P0);
}
开发者ID:LCAS,项目名称:bayestracking,代码行数:13,代码来源:pfilter.cpp
示例6: write
void PolynomialEpipolaireCoordinate::write(class ELISE_fp & aFile) const
{
aFile.write(P0());
aFile.write(DirX());
aFile.write(TrFin());
aFile.write(mPolToYEpip);
aFile.write(AmplInv());
aFile.write(DeltaDegre());
aFile.write(bool(mGridCor!=0));
if (mGridCor!=0)
mGridCor->write(aFile);
}
开发者ID:xialang2012,项目名称:micmac-archeos,代码行数:14,代码来源:phgr_epipole.cpp
示例7: P0
Point Rectangle::Sample(float u, float v, Normal *Ns) const {
// u and v are random samples on the surface of the light source
Point P0(-x/2, y/2, height), P1(x/2, y/2, height);
Point P2(-x/2, -y/2, height), P3(x/2, -y/2, height);
Point p = P0 + (P1 - P0) * u + (P2 - P0) * v;
Normal n = Normal(Cross(P2-P0, P1-P0));
*Ns = Normalize(n);
// NORMAL ON THE PLANE
*Ns = Normalize((*ObjectToWorld)(n));
if (ReverseOrientation) *Ns *= -1.f;
return (*ObjectToWorld)(p);
}
开发者ID:marwan-abdellah,项目名称:pbrt-v2,代码行数:16,代码来源:rectangle.cpp
示例8: FromLabToLocFrame_Vector
void srTSpherMirror::SetupInAndOutPlanes(TVector3d* InPlane, TVector3d* OutPlane)
{// Assumes InPlaneNorm and transverse part InPlaneCenPo already defined !!!
TVector3d &InPlaneCenPo = *InPlane, &InPlaneNorm = InPlane[1];
TVector3d &OutPlaneCenPo = *OutPlane, &OutPlaneNorm = OutPlane[1];
TVector3d LocInPlaneNorm = InPlaneNorm;
FromLabToLocFrame_Vector(LocInPlaneNorm);
double xP = -0.5*Dx, yP = -0.5*Dy;
TVector3d P0(xP, yP, SurfaceFunction(xP, yP, 0));
TVector3d P1(-xP, yP, SurfaceFunction(-xP, yP, 0));
TVector3d P2(xP, -yP, SurfaceFunction(xP, -yP, 0));
TVector3d P3(-xP, -yP, SurfaceFunction(-xP, -yP, 0));
TVector3d EdgePoints[] = { P0, P1, P2, P3 };
int LowestInd, UppestInd;
FindLowestAndUppestPoints(LocInPlaneNorm, EdgePoints, 4, LowestInd, UppestInd);
TVector3d PointForInPlane = EdgePoints[LowestInd];
FromLocToLabFrame_Point(PointForInPlane);
InPlaneCenPo.y = PointForInPlane.y;
TVector3d LocInPlaneCenPo = InPlaneCenPo;
FromLabToLocFrame_Point(LocInPlaneCenPo);
TVector3d LocInPlane[] = { LocInPlaneCenPo, LocInPlaneNorm };
TVector3d LocP, LocN;
FindRayIntersectWithSurface(LocInPlane, 0, LocP);
SurfaceNormalAtPoint(LocP.x, LocP.y, 0, LocN);
TVector3d LocOutPlaneNorm = LocInPlaneNorm;
ReflectVect(LocN, LocOutPlaneNorm);
FindLowestAndUppestPoints(LocOutPlaneNorm, EdgePoints, 4, LowestInd, UppestInd);
OutPlaneCenPo = (EdgePoints[UppestInd]*LocOutPlaneNorm)*LocOutPlaneNorm;
*OutPlaneInLocFrame = OutPlaneCenPo; OutPlaneInLocFrame[1] = LocOutPlaneNorm;
FromLocToLabFrame_Point(OutPlaneCenPo);
OutPlaneNorm = LocOutPlaneNorm;
FromLocToLabFrame_Vector(OutPlaneNorm);
TVector3d LabN = LocN;
FromLocToLabFrame_Vector(LabN);
ExRefInLabFrameBeforeProp = TVector3d(1.,0.,0.);
ReflectVect(LabN, ExRefInLabFrameBeforeProp);
EzRefInLabFrameBeforeProp = TVector3d(0.,0.,1.);
ReflectVect(LabN, EzRefInLabFrameBeforeProp);
}
开发者ID:FranceECL,项目名称:SRW,代码行数:46,代码来源:sroptsmr.cpp
示例9: Fopen
void Centerline::buildKdTree()
{
FILE * f = Fopen("myPOINTS.pos","w");
fprintf(f, "View \"\"{\n");
int nbPL = 3; //10 points per line
//int nbNodes = (lines.size()+1) + (nbPL*lines.size());
int nbNodes = (colorp.size()) + (nbPL*lines.size());
ANNpointArray nodes = annAllocPts(nbNodes, 3);
int ind = 0;
std::map<MVertex*, int>::iterator itp = colorp.begin();
while (itp != colorp.end()){
MVertex *v = itp->first;
nodes[ind][0] = v->x();
nodes[ind][1] = v->y();
nodes[ind][2] = v->z();
itp++; ind++;
}
for(unsigned int k = 0; k < lines.size(); ++k){
MVertex *v0 = lines[k]->getVertex(0);
MVertex *v1 = lines[k]->getVertex(1);
SVector3 P0(v0->x(),v0->y(), v0->z());
SVector3 P1(v1->x(),v1->y(), v1->z());
for (int j= 1; j < nbPL+1; j++){
double inc = (double)j/(double)(nbPL+1);
SVector3 Pj = P0+inc*(P1-P0);
nodes[ind][0] = Pj.x();
nodes[ind][1] = Pj.y();
nodes[ind][2] = Pj.z();
ind++;
}
}
kdtree = new ANNkd_tree(nodes, nbNodes, 3);
for(int i = 0; i < nbNodes; ++i){
fprintf(f, "SP(%g,%g,%g){%g};\n",
nodes[i][0], nodes[i][1],nodes[i][2],1.0);
}
fprintf(f,"};\n");
fclose(f);
}
开发者ID:feelpp,项目名称:debian-gmsh,代码行数:43,代码来源:CenterlineField.cpp
示例10: getFreeStaticLikelihood
/**
* Returns the probability of static empty
*/
float getFreeStaticLikelihood()
{
if( (b_entry_event + b_exit_event)<20.0 )
{
return 0.5f;
}
Eigen::Matrix2f P;
Eigen::Vector2f P0;
Eigen::Vector2f u1(0.5, 0.5);
float Lex = exitL();
float Len = entryL();
P(0,0) = (1.0-Len);
P(0,1) = Len;
P(1,0) = Lex;
P(1,1) = (1-Lex);
P0 = u1.transpose() * P;
return (P0(0));
}
开发者ID:windbicycle,项目名称:oru-ros-pkg,代码行数:22,代码来源:EventCounterData.hpp
示例11: ArLineSegment
AREXPORT void ArForbiddenRangeDevice::processMap(void)
{
std::list<ArMapObject *>::const_iterator it;
ArMapObject *obj;
myDataMutex.lock();
ArUtil::deleteSet(mySegments.begin(), mySegments.end());
mySegments.clear();
for (it = myMap->getMapObjects()->begin();
it != myMap->getMapObjects()->end();
it++)
{
obj = (*it);
if (strcmp(obj->getType(), "ForbiddenLine") == 0 &&
obj->hasFromTo())
{
mySegments.push_back(new ArLineSegment(obj->getFromPose(),
obj->getToPose()));
}
if (strcmp(obj->getType(), "ForbiddenArea") == 0 &&
obj->hasFromTo())
{
double angle = obj->getPose().getTh();
double sa = ArMath::sin(angle);
double ca = ArMath::cos(angle);
double fx = obj->getFromPose().getX();
double fy = obj->getFromPose().getY();
double tx = obj->getToPose().getX();
double ty = obj->getToPose().getY();
ArPose P0((fx*ca - fy*sa), (fx*sa + fy*ca));
ArPose P1((tx*ca - fy*sa), (tx*sa + fy*ca));
ArPose P2((tx*ca - ty*sa), (tx*sa + ty*ca));
ArPose P3((fx*ca - ty*sa), (fx*sa + ty*ca));
mySegments.push_back(new ArLineSegment(P0, P1));
mySegments.push_back(new ArLineSegment(P1, P2));
mySegments.push_back(new ArLineSegment(P2, P3));
mySegments.push_back(new ArLineSegment(P3, P0));
}
}
myDataMutex.unlock();
}
开发者ID:eilo,项目名称:Evolucion-Artificial-y-Robotica-Autonoma-en-Robots-Pioneer-P3-DX,代码行数:42,代码来源:ArForbiddenRangeDevice.cpp
示例12: main
int main(int argc, char* argv[]) {
srand(time(0));
point_pf::initialize();
Matrix<X_DIM> x0, xGoal;
x0[0] = -3.5; x0[1] = 2;
xGoal[0] = -3.5; xGoal[1] = -2;
SymmetricMatrix<X_DIM> Sigma0 = .01*identity<X_DIM>();
Matrix<U_DIM> u = (xGoal - x0) / (DT*(T-1));
std::vector<Matrix<X_DIM> > P0(M);
for(int m=0; m < M; ++m) {
P0[m] = sampleGaussian(x0, Sigma0);
}
std::vector<std::vector<Matrix<X_DIM>> > P_t(T);
std::vector<Matrix<Q_DIM> > dyn_noise;
std::vector<Matrix<R_DIM> > obs_noise;
float sampling_noise;
P_t[0] = P0;
for(int t=0; t < T-1; ++t) {
dyn_noise = sampleGaussianN(zeros<Q_DIM,1>(), Q, M);
obs_noise = sampleGaussianN(zeros<R_DIM,1>(), R, M);
sampling_noise = (1/float(M))*(rand() / float(RAND_MAX));
P_t[t+1] = point_pf::beliefDynamics(P_t[t], u, dyn_noise, obs_noise, sampling_noise);
//P_t[t+1] = point_pf::casadiBeliefDynamics(P_t[t], u, dyn_noise, obs_noise, sampling_noise);
}
for(int t=0; t < T; ++t) {
std::cout << "\nt: " << t << "\n";
for(int m=0; m < M; ++m) {
std::cout << ~P_t[t][m];
}
}
point_pf::pythonDisplayParticles(P_t);
return 0;
}
开发者ID:animesh-garg,项目名称:bsp,代码行数:41,代码来源:test-point-pf.cpp
示例13: P0
PolynomialEpipolaireCoordinate *
PolynomialEpipolaireCoordinate::PolMapingChScale
(REAL aChSacle) const
{
PolynomialEpipolaireCoordinate * aRes =
new PolynomialEpipolaireCoordinate
(
P0() * aChSacle,
DirX(),
mPolToYEpip.MapingChScale(aChSacle),
AmplInv() * aChSacle,
DeltaDegre(),
TrFin() * aChSacle
);
if (mGridCor)
aRes->mGridCor = mGridCor->NewChScale(aChSacle,true);
return aRes;
}
开发者ID:xialang2012,项目名称:micmac-archeos,代码行数:21,代码来源:phgr_epipole.cpp
示例14: ray
float Rectangle::Pdf(const Point &p, const Vector &wi) const
{
// Intersect sample ray with area light geometry
DifferentialGeometry dgLight;
Ray ray(p, wi, 1e-3f);
ray.depth = -1; // temporary hack to ignore alpha mask
float thit, rayEpsilon;
if (!Intersect(ray, &thit, &rayEpsilon, &dgLight)) return 0.;
float pdf;
Point pObject = (*WorldToObject)(p);
// TODO: Check with the normal (n.p)
if (!(pObject.x < x/2 && pObject.x > -x/2
&& pObject.y < y/2 && pObject.y > -y/2))
return 0;
// N & wi
Point P0(-x/2, y/2, height);
Point P1(x/2, y/2, height);
Point P2(-x/2, -y/2, height);
Point P0_W = (*WorldToObject)(P0);
Point P1_W = (*WorldToObject)(P1);
Point P2_W = (*WorldToObject)(P2);
Normal n = Normal(Cross(P2_W-P0_W, P1_W-P0_W));
Normal Ns = Normalize(n);
Normal Nwi(wi.x, wi.y, wi.z);
if (Dot(Ns, Nwi) < 0.0010)
pdf = 1.0;
if (isinf(pdf)) pdf = 0.f;
return pdf;
}
开发者ID:marwan-abdellah,项目名称:pbrt-v2,代码行数:38,代码来源:rectangle.cpp
示例15: evaluateFields
void ConstitutiveModelDriver<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
bool print = false;
if (typeid(ScalarT) == typeid(RealType)) print = true;
std::cout.precision(15);
std::cout << "ConstitutiveModelDriver<EvalT, Traits>::evaluateFields" << std::endl;
Intrepid2::Tensor<ScalarT> F(num_dims_), P(num_dims_), sig(num_dims_);
Intrepid2::Tensor<ScalarT> F0(num_dims_), P0(num_dims_);
for (int cell = 0; cell < workset.numCells; ++cell) {
for (int pt = 0; pt < num_pts_; ++pt) {
F0.fill(prescribed_def_grad_,cell,pt,0,0);
F.fill(def_grad_,cell,pt,0,0);
sig.fill(stress_,cell,pt,0,0);
P = Intrepid2::piola(F,sig);
if (print) {
std::cout << "F: \n" << F << std::endl;
std::cout << "P: \n" << P << std::endl;
std::cout << "sig: \n" << sig << std::endl;
}
for (int node = 0; node < num_nodes_; ++node) {
for (int dim1 = 0; dim1 < num_dims_; ++dim1) {
for (int dim2 = 0; dim2 < num_dims_; ++dim2) {
residual_(cell,node,dim1,dim2) =
(F(dim1,dim2) - F0(dim1,dim2));
//* (P(dim1,dim2) - P0(dim1,dim2));
}
}
}
}
}
}
开发者ID:SailingFM,项目名称:Albany,代码行数:36,代码来源:ConstitutiveModelDriver_Def.hpp
示例16: whetstone_main
//.........这里部分代码省略.........
#ifdef PRINTOUT
IF (JJ==II)POUT(N7,J,K,X,X,Y,Y);
#endif
/*
C
C Module 8: Procedure calls
C
*/
X = 1.0;
Y = 1.0;
Z = 1.0;
for (I = 1; I <= N8; I++)
P3(X,Y,&Z);
#ifdef PRINTOUT
IF (JJ==II)POUT(N8,J,K,X,Y,Z,Z);
#endif
/*
C
C Module 9: Array references
C
*/
J = 1;
K = 2;
L = 3;
E1[1] = 1.0;
E1[2] = 2.0;
E1[3] = 3.0;
for (I = 1; I <= N9; I++)
P0();
#ifdef PRINTOUT
IF (JJ==II)POUT(N9,J,K,E1[1],E1[2],E1[3],E1[4]);
#endif
/*
C
C Module 10: Integer arithmetic
C
*/
J = 2;
K = 3;
for (I = 1; I <= N10; I++) {
J = J + K;
K = J + K;
J = K - J;
K = K - J - J;
}
#ifdef PRINTOUT
IF (JJ==II)POUT(N10,J,K,X1,X2,X3,X4);
#endif
/*
C
C Module 11: Standard functions
C
*/
X = 0.75;
for (I = 1; I <= N11; I++)
开发者ID:LeoLiangZhang,项目名称:Picocenter-embassies,代码行数:67,代码来源:whetstone.c
示例17: test_EKF_interface_simulated_data
void test_EKF_interface_simulated_data()
{
vcl_string panFile("/Users/jimmy/Data/pan_regression/real_data/RF_raw_output.txt");
vcl_string velocityFile("/Users/jimmy/Data/pan_regression/real_data/RF_raw_velocity.txt");
vcl_string panGdFile("/Users/jimmy/Data/pan_regression/real_data/quarter_2_spherical_map/testing_fn_pan_features.txt");
vnl_matrix<double> panMat;
vnl_matrix<double> velocityMat;
vnl_matrix<double> panGdMat;
VnlPlus::readMat(panFile.c_str(), panMat);
VnlPlus::readMat(velocityFile.c_str(), velocityMat);
VnlPlus::readMat(panGdFile.c_str(), panGdMat);
vcl_vector<double> observed_pan;
vcl_vector<double> observed_velocity;
for (int i = 0; i<panMat.rows(); i++) {
observed_pan.push_back(panMat(i, 1));
observed_velocity.push_back(velocityMat(i, 1));
}
vcl_vector<double> smoothed_pan;
vcl_vector<double> smoothed_velocity;
vnl_vector<double> x0(2, 0);
x0[0] = 12; x0[1] = 0.0;
vnl_matrix<double> P0(2, 2, 0);
P0(0, 0) = 0.1; P0(1, 1) = 0.1;
vnl_matrix<double> R(2, 2, 0);
R(0, 0) = 0.06; R(1, 1) = 0.01;
vnl_matrix<double> Q(2, 2, 0);
Q(0, 0) = 0.00000004; Q(1, 1) = 0.00000001;
cameraPlaningPan_EKF aEKF;
aEKF.init(x0, P0);
aEKF.initNoiseCovariance(Q, R);
for (int i = 0; i<observed_pan.size(); i++) {
vnl_vector<double> zk(2, 0);
zk[0] = observed_pan[i];
zk[1] = observed_velocity[i];
vnl_vector<double> xk;
vnl_matrix<double> pk;
aEKF.update(zk, xk, pk);
smoothed_pan.push_back(xk[0]);
smoothed_velocity.push_back(xk[1]);
}
vnl_vector<double> smoothedPanVec(&smoothed_pan[0], (int)smoothed_pan.size());
vnl_vector<double> smoothedVelocityVec(&smoothed_velocity[0], (int)smoothed_velocity.size());
vcl_string save_file("EKF_observed_pan_velocity_26.mat");
vnl_matlab_filewrite awriter(save_file.c_str());
awriter.write(smoothedPanVec, "sm_pan");
awriter.write(panMat.get_column(1), "pan");
awriter.write(panGdMat.get_column(1), "gdPan");
awriter.write(velocityMat.get_column(1), "velo");
awriter.write(smoothedVelocityVec, "sm_velo");
printf("save to %s\n", save_file.c_str());
}
开发者ID:iefiac,项目名称:vxl_util,代码行数:66,代码来源:UT_EKF.cpp
示例18: P0M
// eq 18
double P0M(double a, double LE)
{
return P0(LE) + a * pow(sin(2 * t12), 2) * cos(2 * t12) * pow(cos(t13), 4) * (1.267 * LE * sin(2 * F21(LE)) - 2 * pow(sin(F21(LE)), 2) / Dmsq21);
}
开发者ID:PeterDenton,项目名称:Nu-Pert,代码行数:5,代码来源:LWX.cpp
示例19: EpipolaireCoordinateNoDist
EpipolaireCoordinate * EpipolaireCoordinateNoDist::MapingChScale(REAL aChSacle) const
{
EpipolaireCoordinateNoDist * aRes = new EpipolaireCoordinateNoDist(P0(),DirX());
aRes->HeriteChScale(const_cast<EpipolaireCoordinateNoDist&>(*this),aChSacle);
return aRes;
}
开发者ID:xialang2012,项目名称:micmac-archeos,代码行数:6,代码来源:phgr_epipole.cpp
示例20: sm3_compress
void sm3_compress(uint32_t digest[8], const unsigned char block[64])
{
int j;
uint32_t W[68], W1[64];
const uint32_t *pblock = (const uint32_t *)block;
uint32_t A = digest[0];
uint32_t B = digest[1];
uint32_t C = digest[2];
uint32_t D = digest[3];
uint32_t E = digest[4];
uint32_t F = digest[5];
uint32_t G = digest[6];
uint32_t H = digest[7];
uint32_t SS1,SS2,TT1,TT2,T[64];
for (j = 0; j < 16; j++) {
W[j] = cpu_to_be32(pblock[j]);
}
for (j = 16; j < 68; j++) {
W[j] = P1( W[j-16] ^ W[j-9] ^ ROTATELEFT(W[j-3],15)) ^ ROTATELEFT(W[j - 13],7 ) ^ W[j-6];;
}
for( j = 0; j < 64; j++) {
W1[j] = W[j] ^ W[j+4];
}
for(j =0; j < 16; j++) {
T[j] = 0x79CC4519;
SS1 = ROTATELEFT((ROTATELEFT(A,12) + E + ROTATELEFT(T[j],j)), 7);
SS2 = SS1 ^ ROTATELEFT(A,12);
TT1 = FF0(A,B,C) + D + SS2 + W1[j];
TT2 = GG0(E,F,G) + H + SS1 + W[j];
D = C;
C = ROTATELEFT(B,9);
B = A;
A = TT1;
H = G;
G = ROTATELEFT(F,19);
F = E;
E = P0(TT2);
}
for(j =16; j < 64; j++) {
T[j] = 0x7A879D8A;
SS1 = ROTATELEFT((ROTATELEFT(A,12) + E + ROTATELEFT(T[j],j)), 7);
SS2 = SS1 ^ ROTATELEFT(A,12);
TT1 = FF1(A,B,C) + D + SS2 + W1[j];
TT2 = GG1(E,F,G) + H + SS1 + W[j];
D = C;
C = ROTATELEFT(B,9);
B = A;
A = TT1;
H = G;
G = ROTATELEFT(F,19);
F = E;
E = P0(TT2);
}
digest[0] ^= A;
digest[1] ^= B;
digest[2] ^= C;
digest[3] ^= D;
digest[4] ^= E;
digest[5] ^= F;
digest[6] ^= G;
digest[7] ^= H;
}
开发者ID:LiTianjue,项目名称:GmSSL,代码行数:69,代码来源:sm3.c
注:本文中的P0函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论