/* * --> a = (*p) *--> b = *a *--> c = b-- = x * */ uint32_t cfir(int M, uint32_t* h, uint32_t* w, uint32_t** p, uint32_t x) { int i = 0; uint32_t y; *(*p)-- = x; // gan gia tri roi tru dia chi di 1 wrap_(M, w, p); for (y = 0, h += M; i >= 0; i--) { y += (*h--) * (*(*(p))--); // gan gia tri roi tru dia chi di 1 wrap_(M, w, p); } return y; }
/// Get the next command entry std::string CommandHolder::GetNext(){ if(total == 0){ return "NULL"; } if(external_index >= 1){ external_index--; } if(external_index == 0){ return fragment; } return commands[wrap_()]; }
/// Get the previous command entry std::string CommandHolder::GetPrev(){ if(total == 0){ return "NULL"; } external_index++; if(external_index >= max_size){ external_index = max_size - 1; } else if(external_index >= total){ external_index = total; } return commands[wrap_()]; }
String XQuestResultXMLFile::getxQuestBase64EncodedSpectrum_(const PeakSpectrum& spec, String header) { std::vector<String> in_strings; StringList sl; double precursor_mz = 0; double precursor_z = 0; if (spec.getPrecursors().size() > 0) { precursor_mz = Math::roundDecimal(spec.getPrecursors()[0].getMZ(), -9); precursor_z = spec.getPrecursors()[0].getCharge(); } // header lines if (!header.empty()) // common or xlinker spectrum will be reported { sl.push_back(header + "\n"); // e.g. GUA1372-S14-A-LRRK2_DSS_1A3.03873.03873.3.dta,GUA1372-S14-A-LRRK2_DSS_1A3.03863.03863.3.dta sl.push_back(String(precursor_mz) + "\n"); sl.push_back(String(precursor_z) + "\n"); } else // light or heavy spectrum will be reported { sl.push_back(String(precursor_mz) + "\t" + String(precursor_z) + "\n"); } PeakSpectrum::IntegerDataArray charges; if (spec.getIntegerDataArrays().size() > 0) { charges = spec.getIntegerDataArrays()[0]; } // write peaks for (Size i = 0; i != spec.size(); ++i) { String s; s += String(Math::roundDecimal(spec[i].getMZ(), -9)) + "\t"; s += String(spec[i].getIntensity()) + "\t"; if (charges.size() > 0) { s += String(charges[i]); } else { s += "0"; } s += "\n"; sl.push_back(s); } String out; out.concatenate(sl.begin(), sl.end(), ""); in_strings.push_back(out); String out_encoded; Base64().encodeStrings(in_strings, out_encoded, false, false); String out_wrapped; wrap_(out_encoded, 76, out_wrapped); return out_wrapped; }