// DEBUG function: Prints the S parameters of this circuit object. void circuit::print (void) { for (int i = 0; i < getSize (); i++) { for (int j = 0; j < getSize (); j++) { logprint (LOG_STATUS, "%s S%d%d(%+.3e,%+.3e) ", getName (), i, j, (double) real (getS (i, j)), (double) imag (getS (i, j))); } logprint (LOG_STATUS, "\n"); } }
void testArgument() { clang_analyzer_eval(getConstrainedField(getS()) == 42); // expected-warning{{TRUE}} #if __cplusplus // FIXME: Passing the struct by value seems to be confusing C++. // Possibly related to <rdar://problem/12137950>. // expected-warning@-4{{UNKNOWN}} #endif clang_analyzer_eval(getAssignedField(getS()) == 42); // expected-warning{{TRUE}} }
void testImmediateUse() { int x = getS().field; if (x != 42) return; clang_analyzer_eval(x == 42); // expected-warning{{TRUE}} #if __cplusplus clang_analyzer_eval((void *)getS().getThis() == (void *)&x); // expected-warning{{FALSE}} #endif }
double CMesh::getFOSV() { for (int i=mXSize; i>0; i--) { double mT = getT(0,i-1,0); if ( mT > mFOTemp) { double v1 = getS(0,i-1,0,1); double v2 = getS(0,i,0,1); return v1 + (v2-v1) * ((mFOTemp - mT) /(getT(0,i,0) - mT)); } } return 0.; }
void PointTool::setC(double *out,Point2d *v1,Point2d *v2,Point2d *v3,Point2d *v4){ double S123 = getS(v1,v2,v3); double S314 = getS(v3,v1,v4); double S432 = getS(v4,v3,v2); double S241 = getS(v2,v4,v1); double dist23 = sqrt((v2->x-v3->x)*(v2->x-v3->x) + (v2->y-v3->y)*(v2->y-v3->y)); out[0] = (dist23)/S123; out[1] = -(dist23*S314)/(S123*S432); out[2] = -(dist23*S241)/(S123*S432); out[3] = (dist23)/S432; }
Complexity Complexity::operator + (Complexity& t){ Complexity res(*this); double f = t.getF()+getF(); double s = t.getS()+getS(); res.set(f, s); return res; }
int LuaArgs::getp(int idx, const char *key, const char **list, const char *Default) { const char *opt = getS(idx, key, ""); int ret = findopt(opt, list, Default); delete[] opt; return ret; }
void testReferenceAssignment() { const S &s = getS(); if (s.field != 42) return; clang_analyzer_eval(s.field == 42); // expected-warning{{TRUE}} clang_analyzer_eval(s.getThis() == &s); // expected-warning{{TRUE}} }
void testReferenceAddress(int &x) { clang_analyzer_eval(&x != 0); // expected-warning{{TRUE}} clang_analyzer_eval(&ref() != 0); // expected-warning{{TRUE}} struct S { int &x; }; extern S *getS(); clang_analyzer_eval(&getS()->x != 0); // expected-warning{{TRUE}} }
static int py_anal(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAnalOpMask mask) { PyObject *tmpreg = NULL; int size = 0; int seize = -1; int i = 0; if (!op) return -1; if (py_anal_cb) { memset(op, 0, sizeof (RAnalOp)); // anal(addr, buf) - returns size + dictionary (structure) for RAnalOp Py_buffer pybuf = { .buf = (void *) buf, // Warning: const is lost when casting .len = len, .readonly = 1, .ndim = 1, .itemsize = 1, }; PyObject *memview = PyMemoryView_FromBuffer (&pybuf); PyObject *arglist = Py_BuildValue ("(NK)", memview, addr); PyObject *result = PyEval_CallObject (py_anal_cb, arglist); if (result && PyList_Check (result)) { PyObject *len = PyList_GetItem (result, 0); PyObject *dict = PyList_GetItem (result, 1); if (dict && PyDict_Check (dict)) { seize = PyNumber_AsSsize_t (len, NULL); op->type = getI (dict, "type"); op->cycles = getI (dict, "cycles"); op->size = seize; op->addr = getI (dict, "addr"); op->jump = getI (dict, "jump"); op->fail = getI (dict, "fail"); op->stackop = getI (dict, "stackop"); op->stackptr = getI (dict, "stackptr"); op->ptr = getI (dict, "ptr"); op->eob = getB (dict, "eob"); // Loading 'src' and 'dst' values // SRC is is a list of 3 elements PyObject *tmpsrc = getO (dict, "src"); if (tmpsrc && PyList_Check (tmpsrc)) { for (i = 0; i < 3; i++) { PyObject *tmplst = PyList_GetItem (tmpsrc, i); // Read value and underlying regs READ_VAL(tmplst, op->src[i], tmpreg) } } PyObject *tmpdst = getO (dict, "dst"); // Read value and underlying regs READ_VAL(tmpdst, op->dst, tmpreg) // Loading 'var' value if presented r_strbuf_set (&op->esil, getS (dict, "esil")); // TODO: Add opex support here Py_DECREF (dict); } Py_DECREF (result); } else {
void main(){ int a,s,b,n; a = getInt(); s = getS(a); b = getB(a); a = getN(a); n = getN(a); putB(b); putS(s); putN(n); }
bool SymBandSVDiv<T>::checkDecomp( const BaseMatrix<T>& m, std::ostream* fout) const { Matrix<T> mm = m; if (fout) { *fout << "SymBandSVDiv:\n"; *fout << "M = "<<mm<<std::endl; *fout << "U = "<<getU()<<std::endl; *fout << "S = "<<getS()<<std::endl; *fout << "Vt = "<<getVt()<<std::endl; } Matrix<T> usv = getU()*getS()*getVt(); RT nm = Norm(usv-mm); nm /= Norm(getU())*Norm(getS())*Norm(getVt()); RT cond = condition(); if (fout) { *fout << "USVt = "<<usv<<std::endl; *fout << "Norm(M-USVt)/Norm(USVt) = "<<nm; *fout <<" "<<cond<<" * "<<TMV_Epsilon<T>()<<std::endl; } return nm < cond*RT(mm.colsize())*TMV_Epsilon<T>(); }
void testAssignment() { struct S s = getS(); if (s.field != 42) return; clang_analyzer_eval(s.field == 42); // expected-warning{{TRUE}} s.field = 0; clang_analyzer_eval(s.field == 0); // expected-warning{{TRUE}} #if __cplusplus clang_analyzer_eval(s.getThis() == &s); // expected-warning{{TRUE}} #endif }
double getF0(double U) { double S, p[5]={0.}, trqq, qqq, eld; S = getS(U); p[0] = S * two3rd; p[3] =-S * third; trqq = trQQ(p); qqq = QQQ(p); eld = A_ldg * ( 0.5 * (1.0-third*U)*trqq - third*U*qqq + 0.25*U*trqq*trqq ); return eld; }
double CMesh::getDULocal(int eta, int x, int y, int u, int v){ if (v==1) return (getS(eta,x+1,y,u) - getS(eta,x-1,y,u))/(getX(eta,x+1,y,v) - getX(eta,x-1,y,v)); if (v==2) return (getS(eta,x,y+1,u) - getS(eta,x,y-1,u))/(getX(eta,x,y+1,v) - getX(eta,x,y-1,v)); if (v==3) return getU0(eta,x,y)/getTau() + (getS(eta+1,x,y,u) - getS(eta-1,x,y,u))/(getX(eta+1,x,y,v) - getX(eta-1,x,y,v)); return 0.; }
const char *LuaArgs::getS(int idx, const char *key, const char *Default) { if (tbl > 0 && lua_checkstack(L, 1)) { lua_getfield(L, tbl, key); bool success = lua_isstring(L, -1) != 0; if (!success && idx > 0) { lua_pop(L, 1); lua_pushinteger(L, idx); lua_gettable(L, tbl); success = lua_isstring(L, -1) != 0; } Default = success? scopy(-1) : scopy(Default); lua_pop(L, 1); return Default; } else { return getS(idx, Default); } }
int main() { static char message[20] = "Salut"; static char ch2[] = "hello"; static char ch1[] = "hi"; printf("\nEntrez un message\n"); getS(message,25); printf("\nAffichage message : "); putS(message); strCpy(ch2,ch1); printf("\nAffichage message apres copy de hi dans hello: "); putS(ch2); printf("%d",strLen("Plop8")); printf("\nstrCmp1 : %d",strCmp("plop","plop")); printf("\nstrCmp2 : %d",strCmp("ABCD","ABEFG")); printf("\nstrCmp3 : %d",strCmp("plop","plo")); printf("\nstrCat : "); strCat(message," Denis"); putS(message); }
void memcpy_bug() { S *s; double *p = getP(0); if (p) { int intSptr[sizeof(S*)/sizeof(int)]; unsigned i = 0; for (i = 0; i < sizeof(intSptr)/sizeof(*intSptr); ++i) { intSptr[i] = (int) p[i]; } memcpy(&s, intSptr, sizeof(intSptr)); (s)->u.f1 = p; verify_p((s)->u.f1); } else { s = getS(); } verify_p(s->u.f1); }
void ZUITabPanel::render() { float _x = 0.f; float _y = 0.f; float _w = this->w; float _h = this->h; int side = getS("buttonSide")[0]; // READ the size of the first child which will be the buttons if( headChild ) { if( side == 't' || side == 'T' ) { _y = 0.f; _h -= headChild->h * 0.75f; } else if( side == 'l' || side == 'L' ) { _x = headChild->w - 10.f; _w -= _x; } } ZUIPanel::renderBase( _x, _y, _w, _h ); }
std::vector<double> ParamChanger::getDeltaP(const std::vector<float>& p_P, const std::vector<float>& p_Pmin, const std::vector<float>& p_Pmax, int p_iteration) { int size = p_P.size(); // Get S vector std::vector<float> S = getS(size); // Calculate delta-P std::vector<double> deltaP(size, 0.0); std::vector<double> U = s_randomEngine.getRealUniformList(-0.1, 0.1, size); for (unsigned int i = 0; i < size; i++) { double P = (double)p_P[i]; double R = p_Pmax[i] - p_Pmin[i]; double c = U[i] * R; deltaP[i] = (double)S[i] * c; } return deltaP; }
// RUN: %clang_cc1 %s -fno-rtti-data -triple=i386-pc-win32 -o - -emit-llvm | FileCheck %s // vftable shouldn't have RTTI data in it. // CHECK-NOT: @"\01??_R4S@@6B@" // CHECK: @"\01??_7S@@6B@" = linkonce_odr unnamed_addr constant { [1 x i8*] } { [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GS@@UAEPAXI@Z" to i8*)] }, comdat struct type_info; namespace std { using ::type_info; } struct S { virtual ~S(); } s; struct U : S { virtual ~U(); }; extern S *getS(); const std::type_info &ti = typeid(*getS()); const U &u = dynamic_cast<U &>(*getS()); // CHECK: call i8* @__RTDynamicCast(i8* %{{.+}}, i32 0, i8* bitcast ({{.*}} @"\01??_R0?AUS@@@8" to i8*), i8* bitcast ({{.*}} @"\01??_R0?AUU@@@8" to i8*), i32 1)
void test() { S s = getS(); }
void testReferenceArgument() { clang_analyzer_eval(getConstrainedFieldRef(getS()) == 42); // expected-warning{{TRUE}} clang_analyzer_eval(checkThis(getS())); // expected-warning{{TRUE}} }
double getF(char *lo, char* so, int argc, char** argv, double val){ char* str = getS(lo,so,argc,argv,NULL); if (str==NULL) return val; else return atof(str); }
int getI(char *lo, char* so, int argc, char** argv, int val){ char* str = getS(lo,so,argc,argv,NULL); if (str==NULL) return val; else return atoi(str); }
void BucketToBufferGadget::stuff(std::vector<IsmrmrdAcquisitionData>::iterator it, IsmrmrdDataBuffered & dataBuffer, ISMRMRD::Encoding encoding, IsmrmrdAcquisitionBucketStats & stats, bool forref) { // The acquisition header and data ISMRMRD::AcquisitionHeader & acqhdr = *it->head_->getObjectPtr(); hoNDArray< std::complex<float> > & acqdata = *it->data_->getObjectPtr(); // we make one for the trajectory down below if we need it uint16_t NE0 = (uint16_t)dataBuffer.data_.get_size(0); uint16_t NE1 = (uint16_t)dataBuffer.data_.get_size(1); uint16_t NE2 = (uint16_t)dataBuffer.data_.get_size(2); uint16_t NCHA = (uint16_t)dataBuffer.data_.get_size(3); uint16_t NN = (uint16_t)dataBuffer.data_.get_size(4); uint16_t NS = (uint16_t)dataBuffer.data_.get_size(5); uint16_t NLOC = (uint16_t)dataBuffer.data_.get_size(6); size_t slice_loc; if (split_slices_ || NLOC==1) { slice_loc = 0; } else { slice_loc = acqhdr.idx.slice; } //Stuff the data uint16_t npts_to_copy = acqhdr.number_of_samples - acqhdr.discard_pre - acqhdr.discard_post; long long offset; if (encoding.trajectory == ISMRMRD::TrajectoryType::CARTESIAN || encoding.trajectory == ISMRMRD::TrajectoryType::EPI) { if ((acqhdr.number_of_samples == dataBuffer.data_.get_size(0)) && (acqhdr.center_sample == acqhdr.number_of_samples/2)) // acq has been corrected for center , e.g. by asymmetric handling { offset = acqhdr.discard_pre; } else { offset = (long long)dataBuffer.sampling_.sampling_limits_[0].center_ - (long long)acqhdr.center_sample; } } else { //TODO what about EPI with asymmetric readouts? //TODO any other sort of trajectory? offset = 0; } long long roffset = (long long) dataBuffer.data_.get_size(0) - npts_to_copy - offset; //GDEBUG_STREAM("Num_samp: "<< acqhdr.number_of_samples << ", pre: " << acqhdr.discard_pre << ", post" << acqhdr.discard_post << std::endl); //std::cout << "Sampling limits: " // << " min: " << dataBuffer.sampling_.sampling_limits_[0].min_ // << " max: " << dataBuffer.sampling_.sampling_limits_[0].max_ // << " center: " << dataBuffer.sampling_.sampling_limits_[0].center_ // << std::endl; //GDEBUG_STREAM("npts_to_copy = " << npts_to_copy << std::endl); //GDEBUG_STREAM("offset = " << offset << std::endl); //GDEBUG_STREAM("loffset = " << roffset << std::endl); if ((offset < 0) | (roffset < 0) ) { throw std::runtime_error("Acquired reference data does not fit into the reference data buffer.\n"); } std::complex<float> *dataptr; uint16_t NUsed = (uint16_t)getN(acqhdr.idx); if (NUsed >= NN) NUsed = NN - 1; uint16_t SUsed = (uint16_t)getS(acqhdr.idx); if (SUsed >= NS) SUsed = NS - 1; int16_t e1 = (int16_t)acqhdr.idx.kspace_encode_step_1; int16_t e2 = (int16_t)acqhdr.idx.kspace_encode_step_2; bool is_cartesian_sampling = (encoding.trajectory == ISMRMRD::TrajectoryType::CARTESIAN); bool is_epi_sampling = (encoding.trajectory == ISMRMRD::TrajectoryType::EPI); if(is_cartesian_sampling || is_epi_sampling) { if (!forref || (forref && (encoding.parallelImaging.get().calibrationMode.get() == "embedded"))) { // compute the center offset for E1 and E2 int16_t space_matrix_offset_E1 = 0; if (encoding.encodingLimits.kspace_encoding_step_1.is_present()) { space_matrix_offset_E1 = (int16_t)encoding.encodedSpace.matrixSize.y / 2 - (int16_t)encoding.encodingLimits.kspace_encoding_step_1->center; } int16_t space_matrix_offset_E2 = 0; if (encoding.encodingLimits.kspace_encoding_step_2.is_present() && encoding.encodedSpace.matrixSize.z > 1) { space_matrix_offset_E2 = (int16_t)encoding.encodedSpace.matrixSize.z / 2 - (int16_t)encoding.encodingLimits.kspace_encoding_step_2->center; } // compute the used e1 and e2 indices and make sure they are in the valid range e1 = (int16_t)acqhdr.idx.kspace_encode_step_1 + space_matrix_offset_E1; e2 = (int16_t)acqhdr.idx.kspace_encode_step_2 + space_matrix_offset_E2; } // for external or separate mode, it is possible the starting numbers of ref lines are not zero, therefore it is needed to subtract the staring ref line number // because the ref array size is set up by the actual number of lines acquired // only assumption for external or separate ref line mode is that all ref lines are numbered sequentially // the acquisition order of ref line can be arbitrary if (forref && ( (encoding.parallelImaging.get().calibrationMode.get() == "separate") || (encoding.parallelImaging.get().calibrationMode.get() == "external") ) ) { if(*stats.kspace_encode_step_1.begin()>0) { e1 = acqhdr.idx.kspace_encode_step_1 - *stats.kspace_encode_step_1.begin(); } if(*stats.kspace_encode_step_2.begin()>0) { e2 = acqhdr.idx.kspace_encode_step_2 - *stats.kspace_encode_step_2.begin(); } } if (e1 < 0 || e1 >= (int16_t)NE1) { // if the incoming line is outside the encoding limits, something is wrong GADGET_CHECK_THROW(acqhdr.idx.kspace_encode_step_1>=encoding.encodingLimits.kspace_encoding_step_1->minimum && acqhdr.idx.kspace_encode_step_1 <= encoding.encodingLimits.kspace_encoding_step_1->maximum); // if the incoming line is inside encoding limits but outside the encoded matrix, do not include the data GWARN_STREAM("incoming readout " << acqhdr.scan_counter << " is inside the encoding limits, but outside the encoded matrix for kspace_encode_step_1 : " << e1 << " out of " << NE1); return; } if (e2 < 0 || e2 >= (int16_t)NE2) { GADGET_CHECK_THROW(acqhdr.idx.kspace_encode_step_2 >= encoding.encodingLimits.kspace_encoding_step_2->minimum && acqhdr.idx.kspace_encode_step_2 <= encoding.encodingLimits.kspace_encoding_step_2->maximum); GWARN_STREAM("incoming readout " << acqhdr.scan_counter << " is inside the encoding limits, but outside the encoded matrix for kspace_encode_step_2 : " << e2 << " out of " << NE2); return; } } std::complex<float>* pData = &dataBuffer.data_(offset, e1, e2, 0, NUsed, SUsed, slice_loc); for (uint16_t cha = 0; cha < NCHA; cha++) { dataptr = pData + cha*NE0*NE1*NE2; memcpy(dataptr, &acqdata(acqhdr.discard_pre, cha), sizeof(std::complex<float>)*npts_to_copy); } dataBuffer.headers_(e1, e2, NUsed, SUsed, slice_loc) = acqhdr; if (acqhdr.trajectory_dimensions > 0) { hoNDArray< float > & acqtraj = *it->traj_->getObjectPtr(); // TODO do we need to check this? float * trajptr; trajptr = &(*dataBuffer.trajectory_)(0, offset, e1, e2, NUsed, SUsed, slice_loc); memcpy(trajptr, &acqtraj(0, acqhdr.discard_pre), sizeof(float)*npts_to_copy*acqhdr.trajectory_dimensions); } }
float NNClassifier::calcSr(const Mat &img32F, int &maxSPIdx) { float Sr, dummy; getS(img32F, dummy, dummy, Sr, dummy, maxSPIdx); return Sr; }
int ZStr::contains(int i,char *compare) { char *s = getS(i); return strstr(s,compare) ? 1 : 0; }
int ZStr::is(int i,char *compare) { char *s = getS(i); return !strcmp(s,compare); }
bool NNClassifier::getClass(const Mat &img32F, TYPE_DETECTOR_SCANBB &sbb) { getS(img32F, sbb.Sp, sbb.Sn, sbb.Sr, sbb.Sc, sbb.maxSPIdx); return sbb.Sr > thPos ? CLASS_POS : CLASS_NEG; }