hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
7613404cb396d958f0ae5fd486c82160361af1b8
1,365
cpp
C++
Codechef/LunchTime/January2k20/q4/main.cpp
jeevanpuchakay/a2oj
f867e9b2ced6619be3ca6b1a1a1838107322782d
[ "MIT" ]
null
null
null
Codechef/LunchTime/January2k20/q4/main.cpp
jeevanpuchakay/a2oj
f867e9b2ced6619be3ca6b1a1a1838107322782d
[ "MIT" ]
null
null
null
Codechef/LunchTime/January2k20/q4/main.cpp
jeevanpuchakay/a2oj
f867e9b2ced6619be3ca6b1a1a1838107322782d
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long int ll; vector<vector<ll> > adjlist; ll max(ll x,ll y){return (x>y)?x:y;} #define min(x,y) (x>y)?y:x #define sfor(a,n,i) for(ll i=a;i<n;i++) #define rfor(n,a,i) for(ll i=n;i>=a;i--) #define mod 1000000007 #define pb push_back #define in insert #define mp make_pair #define inf mod #define bg begin() #define ed end() #define sz size() #define vi vector<ll> #define vc vector<char> #define vinv vector<vector<ll,ll> > #define imap map<ll,ll> #define cmap map<char,ll> #define smap map<string,ll> #define iset set<ll> #define bit(x,i) (x&(1<<i)) ll n,m; vector<vi> dp; ll go(ll i,ll j){ if(j>n) return 1; ll &ans=dp[i][j]; if(ans!=-1) return ans; if(j==n) { if(i==1) { ans=(m-1)%mod; return ans; } else{ ans=m%mod; return ans; //(go(1,j+1)+(((m-1)%mod)*(go(0,j+1)%mod)))%mod; } } if(i==1){ ans= (((m-1)%mod)*(go(0,j+1)%mod))%mod; return ans; } else{ ans=((go(1,j+1)%mod)+((m-1)%mod)*(go(0,j+1)%mod))%mod; return ans; } } int main() { ll t;cin>>t; while(t--){ cin>>n>>m; dp=vector<vi> (2,vi(n+2,-1)); cout<<((m%mod)*(go(0,02)%mod))%mod<<endl; } return 0; }
19.5
62
0.515751
jeevanpuchakay
761bc7887fd6ad28909273d105e929189ccc8c0a
1,435
cpp
C++
shaders/src/sib_color_to_vector.cpp
caron/sitoa
52a0a4b35f51bccb6223a8206d04b40edc80071c
[ "Apache-2.0" ]
34
2018-02-01T16:13:48.000Z
2021-07-16T07:37:47.000Z
shaders/src/sib_color_to_vector.cpp
625002974/sitoa
46b7de8e3cf2e2c4cbc6bc391f11181cbac1a589
[ "Apache-2.0" ]
72
2018-02-16T17:30:41.000Z
2021-11-22T11:41:45.000Z
shaders/src/sib_color_to_vector.cpp
625002974/sitoa
46b7de8e3cf2e2c4cbc6bc391f11181cbac1a589
[ "Apache-2.0" ]
15
2018-02-15T15:36:58.000Z
2021-04-14T03:54:25.000Z
/************************************************************************************************************************************ Copyright 2017 Autodesk, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ************************************************************************************************************************************/ #include <ai.h> AI_SHADER_NODE_EXPORT_METHODS(SIBColorToVectorMethods); enum SIBColorToVectorParams { p_input, p_method, p_scale }; node_parameters { AiParameterRGB ( "input" , 1.0f , 1.0f , 1.0f ); AiParameterInt ( "method", 0 ); // Not implemented AiParameterFlt ( "scale" , 1.0f ); } node_initialize{} node_update{} node_finish{} shader_evaluate { AtRGB input = AiShaderEvalParamRGB(p_input); float scale = AiShaderEvalParamFlt(p_scale); sg->out.VEC().x = input.r * scale; sg->out.VEC().y = input.g * scale; sg->out.VEC().z = input.b * scale; }
33.372093
134
0.594425
caron
761cc3cc60ddd3888168d1660747f22c041e0a61
13,797
cc
C++
src/tests/test_lammpsdumpreaderwriter.cc
BuildJet/csg
c02f06ff316eef38564c8e0160bcaf4a6c7f160d
[ "Apache-2.0" ]
null
null
null
src/tests/test_lammpsdumpreaderwriter.cc
BuildJet/csg
c02f06ff316eef38564c8e0160bcaf4a6c7f160d
[ "Apache-2.0" ]
null
null
null
src/tests/test_lammpsdumpreaderwriter.cc
BuildJet/csg
c02f06ff316eef38564c8e0160bcaf4a6c7f160d
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2009-2021 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE lammpdumpstrajectoryreaderwriter_test // Standard includes #include <cmath> #include <cstdio> #include <fstream> #include <string> // Third party includes #include <boost/test/unit_test.hpp> // VOTCA includes #include <votca/tools/constants.h> #include <votca/tools/elements.h> #include <votca/tools/types.h> // Local VOTCA includes #include "votca/csg/bead.h" #include "votca/csg/orthorhombicbox.h" #include "votca/csg/trajectoryreader.h" #include "votca/csg/trajectorywriter.h" using namespace std; using namespace votca::csg; using namespace votca::tools; BOOST_AUTO_TEST_SUITE(lammpsdumpreaderwriter_test) /** * \brief Test the trajectory reader * * This test is designed to test the trajectory reader this is done by * creating a small lammps dump file. A topology object is created with * some default values. The file is then read in with the * trajectory reader and the values in the top object are then examined * to ensure they no longer represent the default state but the values * from the file. */ BOOST_AUTO_TEST_CASE(test_trajectoryreader) { // Create a .dump file with (2-bonded thiophene monomers) // and read from it. Create a topology object with the same // molecule to enable the ability to read in the trajectory // file string lammpsdumpfilename = std::string(CSG_TEST_DATA_FOLDER) + "/lammpsdumpreaderwriter/test_thiophene.dump"; // Atom Coordinates vector<vector<double>> atom_xyz_file = { {3.57166300, -2.91232800, 0.62799100}, {2.70277100, -1.74647700, 0.72415900}, {1.44813500, -2.02583600, 0.30856000}, {2.94693900, -3.99290500, 0.16108100}, {4.61160400, -2.88232000, 0.91932700}, {1.28482000, -3.69221600, -0.19709400}, {3.37487400, -4.97110400, 0.00494100}, {3.08267998, -0.80674791, 1.09707295}, {0.24459700, -1.15927300, 0.24162000}, {-0.59908296, -0.82091411, -1.24794356}, {-0.36240496, -0.56711816, 1.28476993}, {-0.01775039, -0.64275306, 2.30554425}, {-1.54246635, 0.20136386, 0.91593361}, {-1.76480547, 0.13871054, -0.40089364}, {-2.56388268, 0.61198783, -0.94726998}, {-2.12173485, 0.73285944, 1.65650560}}; // Forces vector<vector<double>> atom_forces_file = { {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}}; Topology top; // Make square box Eigen::Matrix3d box = conv::ang2nm * Eigen::Matrix3d::Identity(); top.setBox(box); auto boxType = top.getBoxType(); BOOST_CHECK_EQUAL(boxType, BoundaryCondition::typeOrthorhombic); OrthorhombicBox ortho_box; ortho_box.setBox(box); top.setStep(1); // atom type - this may or may not be the same as the element name, e.g. // different atom types depending on the forcefield and bond structure. vector<string> atom_types = {"C", "C", "C", "C", "H", "S", "H", "H", "C", "S", "C", "H", "C", "C", "H", "H"}; // Atom Coordinates vector<vector<double>> atom_xyz = {{3.57166300, -1.91232800, 1.62799100}, {2.70277100, -0.74647700, 1.72415900}, {1.44813500, -1.02583600, 1.30856000}, {2.94693900, -2.99290500, 1.16108100}, {4.61160400, -1.88232000, 1.91932700}, {1.28482000, -2.69221600, 0.19709400}, {3.37487400, -3.97110400, 1.00494100}, {3.08267998, 0.80674791, 2.09707295}, {0.24459700, -0.15927300, 1.24162000}, {0.59908296, 0.82091411, -0.24794356}, {0.36240496, 0.56711816, 2.28476993}, {0.01775039, 0.64275306, 3.30554425}, {-0.54246635, 1.20136386, 1.91593361}, {-0.76480547, 1.13871054, 0.40089364}, {-1.56388268, 1.61198783, 0.94726998}, {-1.12173485, 1.73285944, 2.65650560}}; // Atom Velocities vector<vector<double>> atom_vel = { {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}}; // Forces vector<vector<double>> atom_forces = { {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}, {0.2, 0.2, 0.2}}; Elements elements; votca::Index residue_num = 1; double charge = 0.0; for (votca::Index ind = 0; ind < votca::Index(atom_types.size()); ++ind) { string atom_type = atom_types.at(ind); if (!top.BeadTypeExist(atom_type)) { top.RegisterBeadType(atom_type); } Bead *b = top.CreateBead(Bead::spherical, atom_types.at(ind), atom_type, residue_num, elements.getMass(atom_types.at(ind)), charge); Eigen::Vector3d xyz(atom_xyz.at(ind).at(0) * conv::ang2nm, atom_xyz.at(ind).at(1) * conv::ang2nm, atom_xyz.at(ind).at(2) * conv::ang2nm); b->setPos(xyz); Eigen::Vector3d xyz_vel(atom_vel.at(ind).at(0) * conv::ang2nm, atom_vel.at(ind).at(1) * conv::ang2nm, atom_vel.at(ind).at(2) * conv::ang2nm); b->setVel(xyz_vel); Eigen::Vector3d xyz_forces( atom_forces.at(ind).at(0) * conv::kcal2kj / conv::ang2nm, atom_forces.at(ind).at(1) * conv::kcal2kj / conv::ang2nm, atom_forces.at(ind).at(2) * conv::kcal2kj / conv::ang2nm); b->setF(xyz_forces); } TrajectoryReader::RegisterPlugins(); std::unique_ptr<TrajectoryReader> reader = std::unique_ptr<TrajectoryReader>( TrjReaderFactory().Create(lammpsdumpfilename)); reader->Open(lammpsdumpfilename); reader->FirstFrame(top); reader->Close(); for (votca::Index ind = 0; ind < votca::Index(atom_types.size()); ++ind) { Bead *b = top.getBead(ind); BOOST_CHECK_CLOSE(b->Pos().x(), atom_xyz_file.at(ind).at(0) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->Pos().y(), atom_xyz_file.at(ind).at(1) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->Pos().z(), atom_xyz_file.at(ind).at(2) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE( b->F().x(), atom_forces_file.at(ind).at(0) * conv::kcal2kj / conv::ang2nm, 0.01); BOOST_CHECK_CLOSE( b->F().y(), atom_forces_file.at(ind).at(1) * conv::kcal2kj / conv::ang2nm, 0.01); BOOST_CHECK_CLOSE( b->F().z(), atom_forces_file.at(ind).at(2) * conv::kcal2kj / conv::ang2nm, 0.01); } } /** * \brief Testing trajectory writer * * This test first creates a topology object and assigns default values to * it. It then writes the topology info to a lammps dump file. The dump * file is then read into the topology file and the values are compared. */ BOOST_AUTO_TEST_CASE(test_trajectorywriter) { // Create a topology object with a simple system (2-bonded thiophene monomers) // and write it to a lammps dump file Topology top; // Make square box Eigen::Matrix3d box = conv::nm2ang * Eigen::Matrix3d::Identity(); top.setBox(box); auto boxType = top.getBoxType(); BOOST_CHECK_EQUAL(boxType, BoundaryCondition::typeOrthorhombic); OrthorhombicBox ortho_box; ortho_box.setBox(box); top.setStep(1); // atom type - this may or may not be the same as the element name, e.g. // different atom types depending on the forcefield and bond structure. vector<string> atom_types = {"C", "C", "C", "C", "H", "S", "H", "H", "C", "S", "C", "H", "C", "C", "H", "H"}; // Atom Coordinates vector<vector<double>> atom_xyz = {{3.57166300, -2.91232800, 0.62799100}, {2.70277100, -1.74647700, 0.72415900}, {1.44813500, -2.02583600, 0.30856000}, {2.94693900, -3.99290500, 0.16108100}, {4.61160400, -2.88232000, 0.91932700}, {1.28482000, -3.69221600, -0.19709400}, {3.37487400, -4.97110400, 0.00494100}, {3.08267998, -0.80674791, 1.09707295}, {0.24459700, -1.15927300, 0.24162000}, {-0.59908296, -0.82091411, -1.24794356}, {-0.36240496, -0.56711816, 1.28476993}, {-0.01775039, -0.64275306, 2.30554425}, {-1.54246635, 0.20136386, 0.91593361}, {-1.76480547, 0.13871054, -0.40089364}, {-2.56388268, 0.61198783, -0.94726998}, {-2.12173485, 0.73285944, 1.65650560}}; // Atom Velocities vector<vector<double>> atom_vel = { {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}}; // Forces vector<vector<double>> atom_forces = { {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}}; Elements elements; votca::Index residue_num = 1; double charge = 0.0; for (votca::Index ind = 0; ind < votca::Index(atom_types.size()); ++ind) { string atom_type = atom_types.at(ind); if (!top.BeadTypeExist(atom_type)) { top.RegisterBeadType(atom_type); } Bead *b = top.CreateBead(Bead::spherical, atom_types.at(ind), atom_type, residue_num, elements.getMass(atom_types.at(ind)), charge); Eigen::Vector3d xyz(atom_xyz.at(ind).at(0) * conv::ang2nm, atom_xyz.at(ind).at(1) * conv::ang2nm, atom_xyz.at(ind).at(2) * conv::ang2nm); b->setPos(xyz); Eigen::Vector3d xyz_vel(atom_vel.at(ind).at(0) * conv::ang2nm, atom_vel.at(ind).at(1) * conv::ang2nm, atom_vel.at(ind).at(2) * conv::ang2nm); b->setVel(xyz_vel); Eigen::Vector3d xyz_forces( atom_forces.at(ind).at(0) * conv::kcal2kj / conv::ang2nm, atom_forces.at(ind).at(1) * conv::kcal2kj / conv::ang2nm, atom_forces.at(ind).at(2) * conv::kcal2kj / conv::ang2nm); b->setF(xyz_forces); } top.SetHasForce(true); top.SetHasVel(true); string lammpsDumpFileName = "test_thiophene.dump"; // Write the topology object to a file TrajectoryWriter::RegisterPlugins(); std::unique_ptr<TrajectoryWriter> writer = std::unique_ptr<TrajectoryWriter>( TrjWriterFactory().Create(lammpsDumpFileName)); writer->Open(lammpsDumpFileName); writer->Write(&top); writer->Close(); // Read the .dump file and ensure the information is correct TrajectoryReader::RegisterPlugins(); std::unique_ptr<TrajectoryReader> reader = std::unique_ptr<TrajectoryReader>( TrjReaderFactory().Create(lammpsDumpFileName)); reader->Open(lammpsDumpFileName); reader->FirstFrame(top); reader->Close(); for (votca::Index ind = 0; ind < votca::Index(atom_types.size()); ++ind) { Bead *b = top.getBead(ind); BOOST_CHECK_CLOSE(b->Pos().x(), atom_xyz.at(ind).at(0) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->Pos().y(), atom_xyz.at(ind).at(1) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->Pos().z(), atom_xyz.at(ind).at(2) * conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->F().x(), atom_forces.at(ind).at(0) * conv::kcal2kj / conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->F().y(), atom_forces.at(ind).at(1) * conv::kcal2kj / conv::ang2nm, 0.01); BOOST_CHECK_CLOSE(b->F().z(), atom_forces.at(ind).at(2) * conv::kcal2kj / conv::ang2nm, 0.01); } } BOOST_AUTO_TEST_SUITE_END()
41.557229
80
0.553744
BuildJet
76211f9acf908b7c72af662ad7b24013fd460d73
2,619
cpp
C++
src/test/logging/log_record_test.cpp
abingham/ackward
f1a45293de570f4b4429d9eaeb3f6c4da7d245bf
[ "MIT" ]
null
null
null
src/test/logging/log_record_test.cpp
abingham/ackward
f1a45293de570f4b4429d9eaeb3f6c4da7d245bf
[ "MIT" ]
null
null
null
src/test/logging/log_record_test.cpp
abingham/ackward
f1a45293de570f4b4429d9eaeb3f6c4da7d245bf
[ "MIT" ]
null
null
null
#include <Python.h> #include <fstream> #include <boost/python/tuple.hpp> #include <boost/test/unit_test.hpp> #include <ackward/logging/LogRecord.hpp> using namespace ackward::logging; namespace { struct Fixture { Fixture() : rec (L"foo", DEBUG(), L"/some/path/name", 101, L"Message", boost::python::tuple()) {} LogRecord rec; }; } BOOST_AUTO_TEST_SUITE( logging ) BOOST_FIXTURE_TEST_SUITE( logRecord, Fixture ) BOOST_AUTO_TEST_CASE( constructor ) { LogRecord(L"foo", DEBUG(), L"/some/path/name", 101, L"Message", boost::python::tuple(), boost::python::make_tuple( boost::python::object(), boost::python::object(), boost::python::object())); } BOOST_AUTO_TEST_CASE( getMessage ) { BOOST_CHECK(rec.getMessage() == L"Message"); } BOOST_AUTO_TEST_CASE( args ) { boost::python::tuple args = rec.args; } // BOOST_AUTO_TEST_CASE( asctime ) // { // std::wstring at = rec.asctime; // } BOOST_AUTO_TEST_CASE( created ) { float c = rec.created; } // BOOST_AUTO_TEST_CASE( exc_info ) // { // boost::python::tuple ei = rec.exc_info; // } BOOST_AUTO_TEST_CASE( filename ) { std::wstring fn = rec.filename; } // BOOST_AUTO_TEST_CASE( funcName ) // { // std::wstring fn = rec.funcName; // } BOOST_AUTO_TEST_CASE( levelname ) { std::wstring ln = rec.levelname; } BOOST_AUTO_TEST_CASE( levelno ) { int ln = rec.levelno; } BOOST_AUTO_TEST_CASE( lineno ) { int ln = rec.lineno; } BOOST_AUTO_TEST_CASE( module ) { std::wstring m = rec.module; } BOOST_AUTO_TEST_CASE( msecs ) { float ms = rec.msecs; } // BOOST_AUTO_TEST_CASE( message ) // { // std::wstring m = rec.message; // } BOOST_AUTO_TEST_CASE( msg ) { std::wstring m = rec.msg; } BOOST_AUTO_TEST_CASE( name ) { std::wstring n = rec.name; } BOOST_AUTO_TEST_CASE( pathname ) { std::wstring pn = rec.pathname; } BOOST_AUTO_TEST_CASE( process ) { int p = rec.process; } BOOST_AUTO_TEST_CASE( processName ) { std::wstring pn = rec.processName; } BOOST_AUTO_TEST_CASE( relateveCreated ) { float rc = rec.relativeCreated; } #if PYTHON_MAJOR_VERSION == 3 BOOST_AUTO_TEST_CASE( stack_info ) { boost::python::object si = rec.stack_info; } #endif BOOST_AUTO_TEST_CASE( thread ) { unsigned long t = rec.thread; } BOOST_AUTO_TEST_CASE( threadName ) { std::wstring tn = rec.threadName; } BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
16.166667
48
0.623139
abingham
76239975a019ff7a8095b7f41e9b9ffdbc5e73b6
6,277
cpp
C++
src/gammaGenerator.cpp
bhurwitz33/bayesembler
b1d8200d5ffa2ae3476391d9f35f26e5f14f517f
[ "MIT" ]
1
2019-01-10T15:43:12.000Z
2019-01-10T15:43:12.000Z
src/gammaGenerator.cpp
bhurwitz33/bayesembler
b1d8200d5ffa2ae3476391d9f35f26e5f14f517f
[ "MIT" ]
null
null
null
src/gammaGenerator.cpp
bhurwitz33/bayesembler
b1d8200d5ffa2ae3476391d9f35f26e5f14f517f
[ "MIT" ]
null
null
null
/* gammaGenerator.cpp - This file is part of the Bayesembler (v1.1.1) The MIT License (MIT) Copyright (c) 2014 Lasse Maretty and Jonas Andreas Sibbesen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <math.h> #include <gammaGenerator.h> #include <boost/math/constants/constants.hpp> #include <boost/lexical_cast.hpp> #include <boost/math/distributions/gamma.hpp> #include <boost/math/distributions/lognormal.hpp> #include <boost/random/variate_generator.hpp> #include <boost/random/gamma_distribution.hpp> #include <boost/random/lognormal_distribution.hpp> /* Gamma-sampler class */ SymmetricGammaGenerator::SymmetricGammaGenerator(HyperPrior * hyper_prior_in, int slice_iterations_in, double slice_window_size_in, int slice_max_windows_in, boost::random::mt19937* mt_rng_pt_in) { hyper_prior = hyper_prior_in; slice_iterations = slice_iterations_in; slice_window_size = slice_window_size_in; slice_max_windows = slice_max_windows_in; mt_rng_pt = mt_rng_pt_in; } // Init gamma with sample from the hyperprior double SymmetricGammaGenerator::initGamma() { return hyper_prior->init(); } double SymmetricGammaGenerator::generateGamma(ExpressionValueContainer expression) { vector<double> expression_s_plus; for (int i = 0; i < expression.getPlusSize(); i++) { int idx = expression.getPlus(i); double value = expression.getValue(idx); expression_s_plus.push_back(value); } // Init gamma and uniform sampler uniform_01_sampler_t sample_uniform_01(mt_rng_pt); double gamma_current = sample_uniform_01(); if (gamma_current < double_underflow) { gamma_current = double_underflow; } double gamma = gamma_current; for (int i=0; i < slice_iterations; i++) { double y = calculateLogDensity(expression_s_plus, gamma_current) + hyper_prior->calculateLogDensity(gamma_current) + log(1-sample_uniform_01()); // Find slice by "step-out" double left = gamma_current - sample_uniform_01() * slice_window_size; double right = left + slice_window_size; int j = floor(slice_max_windows*sample_uniform_01()); int k = slice_max_windows-1-j; // Truncate at zero if (left < double_underflow) { left = double_underflow; j = 0; } while (j > 0 && y < (calculateLogDensity(expression_s_plus, left) + hyper_prior->calculateLogDensity(left))) { left = left - slice_window_size; j--; if (left < double_underflow) { left = double_underflow; break; } } // Expand window to the right while (k > 0 && y < (calculateLogDensity(expression_s_plus, right) + hyper_prior->calculateLogDensity(right))) { right = right + slice_window_size; k--; } // Sample from the window until in slice gamma = sample_uniform_01()*(right-left) + left; while ( y >= (calculateLogDensity(expression_s_plus, gamma) + hyper_prior->calculateLogDensity(gamma))) { if (gamma < gamma_current) { left = gamma; gamma = sample_uniform_01()*(right-left) + left; } else { right = gamma; gamma = sample_uniform_01()*(right-left) + left; } } gamma_current = gamma; } return gamma; } double SymmetricGammaGenerator::calculateLogDensity(vector<double>& expression, double gamma) { int size = expression.size(); // Init prob with normalisation constant double prob = boost::math::lgamma(size*gamma) - size*boost::math::lgamma(gamma); for (int i=0; i < size; i++) { prob += (gamma-1)*log(expression[i]); } return prob; } FixedGammaGenerator::FixedGammaGenerator(double gamma_in) { gamma = gamma_in; } double FixedGammaGenerator::initGamma() { return gamma; } double FixedGammaGenerator::generateGamma(ExpressionValueContainer expression) { return gamma; } GammaHyperPrior::GammaHyperPrior(double shape_in, double scale_in, mt_rng_pt_t mt_rng_pt_in) { shape = shape_in; scale = scale_in; mt_rng_pt = mt_rng_pt_in; }; double GammaHyperPrior::init() { boost::random::gamma_distribution<> gamma_dist(shape, scale); boost::random::variate_generator<boost::random::mt19937*, boost::random::gamma_distribution<> > sample_gamma(mt_rng_pt, gamma_dist); double gamma = sample_gamma(); return gamma; } double GammaHyperPrior::calculateLogDensity(double gamma) { double prob = (shape-1)*log(gamma) - (gamma/scale); return prob; }; LogNormalHyperPrior::LogNormalHyperPrior(double location_in, double scale_in, mt_rng_pt_t mt_rng_pt_in) { location = location_in; scale = scale_in; mt_rng_pt = mt_rng_pt_in; } double LogNormalHyperPrior::init() { boost::random::lognormal_distribution<> lognormal_dist(location, scale); boost::random::variate_generator<boost::random::mt19937*, boost::random::lognormal_distribution<> > sample_gamma(mt_rng_pt, lognormal_dist); double gamma = sample_gamma(); return gamma; } double LogNormalHyperPrior::calculateLogDensity(double gamma) { double prob = - log(gamma) - pow(log(gamma)-location,2)/(2*pow(scale,2)); return prob; }
27.774336
197
0.703043
bhurwitz33
762404feb02085ab9c4d08f8b714f6676543d87a
430
hpp
C++
src/argument_interpreter.hpp
rikutons/mytreecode
c25f955f946afb5c9e2d6fd14357e01eb4ff19f9
[ "MIT" ]
null
null
null
src/argument_interpreter.hpp
rikutons/mytreecode
c25f955f946afb5c9e2d6fd14357e01eb4ff19f9
[ "MIT" ]
null
null
null
src/argument_interpreter.hpp
rikutons/mytreecode
c25f955f946afb5c9e2d6fd14357e01eb4ff19f9
[ "MIT" ]
null
null
null
#pragma once #include <string> using namespace std; class ArgumentInterpreter { public: int cnt = 1; double dt = 0.01; double t = 1; double eps_square = 0.1 * 0.1; double theta_square = 0.5; // [rad^2] int simulator_mode = -1; string input_filename = ""; string output_filename = "output.csv"; // 以下はinputfileが決まっている場合無効となる int n = 1000; double rsize = 1.0; ArgumentInterpreter(int argc, char *argv[]); };
21.5
46
0.672093
rikutons
7626795e8f24f12494188d05b9a7290f08a15917
334
cpp
C++
src/leetcode/q0001_0100/q0022.cpp
jielyu/leetcode
ce5327f5e5ceaa867ea2ddd58a93bfb02b427810
[ "MIT" ]
9
2020-04-09T12:37:50.000Z
2021-04-01T14:01:14.000Z
src/leetcode/q0001_0100/q0022.cpp
jielyu/leetcode
ce5327f5e5ceaa867ea2ddd58a93bfb02b427810
[ "MIT" ]
3
2020-05-05T02:43:54.000Z
2020-05-20T11:12:16.000Z
src/leetcode/q0001_0100/q0022.cpp
jielyu/leetcode
ce5327f5e5ceaa867ea2ddd58a93bfb02b427810
[ "MIT" ]
5
2020-04-17T02:32:10.000Z
2020-05-20T10:12:26.000Z
/* #LeetCode# Q0022 生成括号 难度:中 给出n对小括号,写一个函数来生成所有形式良好的小括号组合。 例如,给定n = 3,一个解集是: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] */ #include "leetcode.h" namespace q0022 { template<typename T> bool run_testcases() { T slt; return true; } class Solution { public: void func(); }; } // namespace q0022
9.027027
29
0.52994
jielyu
762716444ca4d252701dbcb91ff2688701eda79d
467
hpp
C++
libs/modelmd3/include/sge/model/md3/load_flags.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
2
2016-01-27T13:18:14.000Z
2018-05-11T01:11:32.000Z
libs/modelmd3/include/sge/model/md3/load_flags.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
null
null
null
libs/modelmd3/include/sge/model/md3/load_flags.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
3
2018-05-11T01:11:34.000Z
2021-04-24T19:47:45.000Z
// Copyright Carl Philipp Reh 2006 - 2019. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef SGE_MODEL_MD3_LOAD_FLAGS_HPP_INCLUDED #define SGE_MODEL_MD3_LOAD_FLAGS_HPP_INCLUDED #include <sge/model/md3/load_flags_fwd.hpp> namespace sge::model::md3 { enum class load_flags { switch_yz, fcppt_maximum = switch_yz }; } #endif
20.304348
61
0.738758
cpreh
7627af6217dd98f6d344ed1aacc825ceb81214e7
3,461
cpp
C++
XRADDicomGUI/Sources/DisplayFunctions/DisplayTomogram_CTAcquisition.cpp
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
1
2021-04-02T16:47:00.000Z
2021-04-02T16:47:00.000Z
XRADDicomGUI/Sources/DisplayFunctions/DisplayTomogram_CTAcquisition.cpp
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
null
null
null
XRADDicomGUI/Sources/DisplayFunctions/DisplayTomogram_CTAcquisition.cpp
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
3
2021-08-30T11:26:23.000Z
2021-09-23T09:39:56.000Z
/* Copyright (c) 2021, Moscow Center for Diagnostics & Telemedicine All rights reserved. This file is licensed under BSD-3-Clause license. See LICENSE file for details. */ /*! \file \date 4/23/2018 5:46:49 PM \author kovbas */ #include "pre.h" #include "DisplayTomogram_CTAcquisition.h" XRAD_BEGIN enum display_ct_options_t { display_ct_slices, display_ct_metadata, display_ct_DICOM_file_content, display_ct_current, display_ct_voltage, display_CTDI_vol, display_ct_thickness, display_ct_positions, exit_ct_display }; const vector<wstring> &options_ct_names() { static vector<wstring> options(exit_ct_display + 1); do_once { options[display_ct_slices] = L"Display CT Slices"; options[display_ct_metadata] = L"Display CT Metadata"; options[display_ct_DICOM_file_content] = L"Display DICOM-file content"; options[display_ct_current] = L"Display CT current"; options[display_ct_voltage] = L"Display CT voltage"; options[display_CTDI_vol] = L"Display CTDI vol"; options[display_ct_thickness] = L"Display CT slice thickness"; options[display_ct_positions] = L"Display CT slice position"; options[exit_ct_display] = L"Exit display"; } return options; } void DisplayTomogram_CTAcquisition(const CTAcquisition &ct, const wstring &title) { display_ct_options_t options{ display_ct_slices }; auto title_full{ title + L" [" + ct.series_description() + L"]" }; while (options != exit_ct_display) { try { options = static_cast<display_ct_options_t>(GetButtonDecision(title_full, options_ct_names())); switch (options) { case display_ct_slices: DisplayMathFunction3D(ct.load_ordered_slices(), title_full); break; case display_ct_metadata: ShowText(title_full, ct.summary_info()); break; case display_ct_DICOM_file_content: ShowText(title_full, ct.get_dicom_file_content(GetUnsigned("Enter number of frame.", 0, 0, ct.n_elements() - 1))); break; case display_ct_current: DisplayMathFunction(ct.currents(), 0, 1, title_full + L" Current", L"mA", L"Slice No"); break; case display_ct_voltage: DisplayMathFunction(ct.voltages(), 0, 1, title_full + L" Voltage", L"kV", L"Slice No"); break; case display_CTDI_vol: DisplayMathFunction(ct.CTDIvols(), 0, 1, title_full + L" CTDIVol", L"mGy?", L"Slice No"); break; case display_ct_thickness: DisplayMathFunction(ct.thickness(), 0, 1, title_full + L" Slice Thickness", L"mm", L"Slice No"); break; case display_ct_positions: { auto image_positions_patient{ct.image_positions_patient()}; RealFunctionF64 locations_z(image_positions_patient.size(), 0); static_assert(std::is_same<decltype(image_positions_patient)::value_type::value_type, decltype(locations_z)::value_type>::value, "Type mismatch."); locations_z.CopyData(image_positions_patient, [](double &x, const auto &p) {return x = p[0];}); DisplayMathFunction(locations_z, 0, 1, title_full + L" Slice Position", L"mm", L"Slice No"); } break; } } catch (canceled_operation &) { // нажатие кнопки cancel в любом диалоговом окне, включая прогресс. // (например, отмена ошибочного выбранной команды без необходимости // дожидаться ее завершения) } catch (quit_application &) { // команда принудительного выхода из программы throw; } catch (exception &ex) { // все остальное, включая нехватку памяти ShowString("An error occured", ex.what()); } } } XRAD_END
29.084034
118
0.726091
n-kulberg
7629aa911a2a82f7aee1da1daeb7117fa133138d
5,244
cpp
C++
src/classes/controller/controller.cpp
kevinxtung/MICE
6559c8d242893f0697f64853ab49688198e9692d
[ "MIT" ]
null
null
null
src/classes/controller/controller.cpp
kevinxtung/MICE
6559c8d242893f0697f64853ab49688198e9692d
[ "MIT" ]
6
2018-05-14T23:38:17.000Z
2018-05-18T23:38:06.000Z
src/classes/controller/controller.cpp
kevinxtung/MICE
6559c8d242893f0697f64853ab49688198e9692d
[ "MIT" ]
null
null
null
#include "controller.h" #include "classes/topping/topping.h" #include "classes/container/container.h" #include "classes/scoop/scoop.h" #include "classes/order/order.h" #include <string> #include <iostream> void Controller::cli() { int cmd = -1; while (cmd != 0) { cmd = m_view.select(); execute(cmd); } } void Controller::execute(int cmd) { if (!cmd) { return; } switch (cmd) { case 0: // Exit break; case 1: { // Create item std::string name, description; double rawCost, retailPrice; int type; Gtk::Dialog *dialog = new Gtk::Dialog(); dialog->set_title("Create New Item"); // Title Gtk::HBox b_name; Gtk::Label l_name{"Name: "}; l_name.set_width_chars(15); b_name.pack_start(l_name, Gtk::PACK_SHRINK); Gtk::Entry e_name; e_name.set_max_length(50); b_name.pack_start(e_name, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_name, Gtk::PACK_SHRINK); // Description Gtk::HBox b_description; Gtk::Label l_description{"Description: "}; l_description.set_width_chars(15); b_description.pack_start(l_description, Gtk::PACK_SHRINK); Gtk::Entry e_description; e_description.set_max_length(50); b_description.pack_start(e_description, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_description, Gtk::PACK_SHRINK); // Cost Gtk::HBox b_rawCost; Gtk::Label l_rawCost{"Cost per item: "}; l_rawCost.set_width_chars(15); b_rawCost.pack_start(l_rawCost, Gtk::PACK_SHRINK); Gtk::Entry e_rawCost; e_rawCost.set_max_length(50); b_rawCost.pack_start(e_rawCost, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_rawCost, Gtk::PACK_SHRINK); // Price Gtk::HBox b_retailPrice; Gtk::Label l_retailPrice{"Price per item: "}; l_retailPrice.set_width_chars(15); b_retailPrice.pack_start(l_retailPrice, Gtk::PACK_SHRINK); Gtk::Entry e_retailPrice; e_retailPrice.set_max_length(50); b_retailPrice.pack_start(e_retailPrice, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_retailPrice, Gtk::PACK_SHRINK); // Type Gtk::HBox b_type; Gtk::Label l_type{"Type of item: "}; l_type.set_width_chars(15); b_type.pack_start(l_type, Gtk::PACK_SHRINK); Gtk::ComboBoxText c_type; c_type.set_size_request(160); c_type.append("Container"); c_type.append("Scoop"); c_type.append("Topping"); b_type.pack_start(c_type, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_type, Gtk::PACK_SHRINK); // Finishing up dialog dialog->add_button("Cancel", 0); dialog->add_button("Create", 1); dialog->show_all(); int result = dialog->run(); dialog->close(); while (Gtk::Main::events_pending()) { Gtk::Main::iteration(); } if (result == 1) { name = e_name.get_text(); description = e_description.get_text(); rawCost = std::stod(e_rawCost.get_text()); retailPrice = std::stod(e_retailPrice.get_text()); type = c_type.get_active_row_number(); switch (type) { case 0: { int maxScoops; Gtk::Dialog *dialog = new Gtk::Dialog(); dialog->set_title("Enter Max Scoops"); Gtk::HBox b_maxScoops; Gtk::Label l_maxScoops{"Max Scoops: "}; l_maxScoops.set_width_chars(15); b_maxScoops.pack_start(l_maxScoops, Gtk::PACK_SHRINK); Gtk::Entry e_maxScoops; e_maxScoops.set_max_length(2); b_maxScoops.pack_start(e_maxScoops, Gtk::PACK_SHRINK); dialog->get_vbox()->pack_start(b_maxScoops, Gtk::PACK_SHRINK); dialog->add_button("Set", 1); dialog->show_all(); int result = dialog->run(); dialog->close(); while (Gtk::Main::events_pending()) { Gtk::Main::iteration(); } if (result == 1) { maxScoops = std::stoi(e_maxScoops.get_text()); m_emporium.addContainer(Container(name, description, rawCost, retailPrice, maxScoops)); } break; } case 1: m_emporium.addScoop(Scoop(name, description, rawCost, retailPrice)); break; case 2: m_emporium.addTopping(Topping(name, description, rawCost, retailPrice)); break; default: break; } } break; } case 2: { //emporium.addOrder(Orde); } case 3: { // Save save(); break; } case 4: { // Load load(); break; } case 66: { m_emporium.addContainer(Container("Waffle Cone", "A waffle cone.", 0.75, 1.00, 0, 3)); m_emporium.addContainer(Container("Cup", "A wax coated cup.", 0.15, 0.20, 0, 4)); m_emporium.addScoop(Scoop("Vanilla", "Plain vanilla.", 0.49, 0.80, 0)); m_emporium.addScoop(Scoop("Mint Chocolate Chip", "Deliciously minty.", 0.55, 0.80, 0)); m_emporium.addTopping(Topping("Peanuts", "Chopped nuts!", 0.50, 0.75, 0, "Normal")); m_emporium.addTopping(Topping("Hot Fudge", "Creamy and fattening.", 0.30, 0.75, 0, "Normal")); break; } default: m_view.error("ERROR: INVALID COMMAND."); break; } } Emporium& Controller::getEmporium() { return m_emporium; } Container Controller::container(std::string name, std::string description, double rawCost, double retailPrice, int maxScoops, int quantity) { return Container(name, description, rawCost, retailPrice, quantity, maxScoops); }
28.972376
141
0.657132
kevinxtung
762b6e6124d6e9d27b6a700ae265856ca5c0b334
1,429
cpp
C++
src/Modules/Vision/VisionUtils/DrawSSLClient/DrawSSLClientField/DrawSSLClientField.cpp
MatheusPaixaoG/project-unification
efeec63244a370e4408b3e94fbdbff2be082554a
[ "MIT" ]
2
2022-01-02T15:28:08.000Z
2022-01-05T17:46:15.000Z
src/Modules/Vision/VisionUtils/DrawSSLClient/DrawSSLClientField/DrawSSLClientField.cpp
MatheusPaixaoG/project-unification
efeec63244a370e4408b3e94fbdbff2be082554a
[ "MIT" ]
null
null
null
src/Modules/Vision/VisionUtils/DrawSSLClient/DrawSSLClientField/DrawSSLClientField.cpp
MatheusPaixaoG/project-unification
efeec63244a370e4408b3e94fbdbff2be082554a
[ "MIT" ]
1
2022-01-15T15:28:15.000Z
2022-01-15T15:28:15.000Z
#include "DrawSSLClientField.h" #include <protobufs/protobufs.h> #include "Modules/Vision/VisionUtils/DrawCIninho/DrawCIninho.h" DrawSSLClientField::DrawSSLClientField(const RoboCupSSL::SSL_GeometryFieldSize& field, bool drawCIninho, const QColor& color) : drawCIninho(drawCIninho), color(color) { for (const auto& line : field.field_lines()) { lines += Line{QLineF(line.p1().x(), line.p1().y(), line.p2().x(), line.p2().y()), line.thickness()}; } for (const auto& arc : field.field_arcs()) { arcs += Arc{QPointF(arc.center().x(), arc.center().y()), arc.radius() - arc.thickness() / 2.0, arc.radius() + arc.thickness() / 2.0, arc.a1(), arc.a2()}; } } void DrawSSLClientField::run(GameVisualizerPainter2D* f) { for (const auto& line : lines) { f->drawLine(line.line.p1(), line.line.p2(), color, line.thickness); } for (const auto& arc : arcs) { f->drawArc(arc.origin, arc.innerRadius, arc.outterRadius, arc.theta1, arc.theta2, color); if (arc.origin.isNull() && drawCIninho) { qreal scale = 1.2 * arc.outterRadius * std::sin(PI / 4); DrawCIninho draw(arc.origin, scale); draw.run(f); } } } std::unique_ptr<Painting> DrawSSLClientField::clone() const { return std::make_unique<DrawSSLClientField>(*this); }
33.232558
99
0.595521
MatheusPaixaoG
762f9f6fb8bd4271525b7bfe604e60ae64c94642
7,977
cpp
C++
src/infra/Measurement.cpp
cryptobiu/libscapi
49eee7aee9eb3544a7facb199d0a6e98097b058a
[ "MIT" ]
160
2016-05-11T09:45:56.000Z
2022-03-06T09:32:19.000Z
src/infra/Measurement.cpp
cryptobiu/libscapi
49eee7aee9eb3544a7facb199d0a6e98097b058a
[ "MIT" ]
57
2016-12-26T07:02:12.000Z
2022-03-06T16:34:31.000Z
src/infra/Measurement.cpp
cryptobiu/libscapi
49eee7aee9eb3544a7facb199d0a6e98097b058a
[ "MIT" ]
67
2016-10-10T17:56:22.000Z
2022-03-15T22:56:39.000Z
// // Created by liork on 17/09/17. // /** * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * * Copyright (c) 2016 LIBSCAPI (http://crypto.biu.ac.il/SCAPI) * This file is part of the SCAPI project. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * We request that any publication and/or code referring to and/or based on SCAPI contain an appropriate citation to SCAPI, including a reference to * http://crypto.biu.ac.il/SCAPI. * * Libscapi uses several open source libraries. Please see these projects for any further licensing issues. * For more information , See https://github.com/cryptobiu/libscapi/blob/master/LICENSE.MD * * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * */ #include "../../include/infra/Measurement.hpp" #include "../../include/cryptoInfra/Protocol.hpp" using namespace std; Measurement::Measurement(Protocol &protocol) { init(protocol); } Measurement::Measurement(Protocol &protocol, vector<string> &names) { init(protocol); init(names); } Measurement::Measurement(const string &protocolName, int internalIterationsNumber, int partyId, int partiesNumber) { init(protocolName, internalIterationsNumber, partyId, partiesNumber); } Measurement::Measurement(const string &protocolName, int internalIterationsNumber, int partyId, int partiesNumber, vector<string> &names) { init(protocolName, internalIterationsNumber, partyId, partiesNumber); init(names); } void Measurement::setTaskNames(const vector<string> & names) { init(names); } void Measurement::addTaskNames(vector<string> & names) { names.insert(names.end(), m_names.begin(), m_names.end()); delete m_cpuStartTimes; delete m_cpuEndTimes; init(names); } void Measurement::init(Protocol &protocol) { m_arguments = protocol.getArguments(); CmdParser parser = protocol.getParser(); m_protocolName = parser.getValueByKey(m_arguments, "protocolName"); m_numberOfIterations = stoi(parser.getValueByKey(m_arguments,"internalIterationsNumber")); string partyId = parser.getValueByKey(m_arguments, "partyID"); if(partyId.compare("NotFound") != 0) m_partyId = stoi(partyId); m_numOfParties = atoi(parser.getValueByKey(m_arguments, "numParties").c_str()); } void Measurement::init(const string &protocolName, int internalIterationsNumber, int partyId, int partiesNumber) { m_protocolName = protocolName; m_numberOfIterations = internalIterationsNumber; m_partyId = partyId; m_numOfParties = partiesNumber; } void Measurement::init(const vector <string> &names) { m_cpuStartTimes = new vector<vector<double>>(names.size(), vector<double>(m_numberOfIterations,0)); m_cpuEndTimes = new vector<vector<double>>(names.size(), vector<double>(m_numberOfIterations, 0)); m_memoryUsage = new vector<vector<double>>(names.size(), vector<double>(m_numberOfIterations, 0)); m_names = move(names); } int Measurement::getTaskIdx(const string &name) { auto it = find(m_names.begin(), m_names.end(), name); auto idx = distance(m_names.begin(), it); return idx; } void Measurement::startSubTask(const string &taskName, int currentIterationNum) { auto now = system_clock::now(); auto ms = (double) time_point_cast<nanoseconds>(now).time_since_epoch().count() / 1000000; int taskIdx = getTaskIdx(taskName); (*m_cpuStartTimes)[taskIdx][currentIterationNum] = ms; } void Measurement::endSubTask(const string &taskName, int currentIterationNum) { int taskIdx = getTaskIdx(taskName); auto now = system_clock::now(); auto ms = (double) time_point_cast<nanoseconds>(now).time_since_epoch().count() / 1000000; (*m_cpuEndTimes)[taskIdx][currentIterationNum] = ms - (*m_cpuStartTimes)[taskIdx][currentIterationNum]; struct sysinfo systemInfo; (*m_memoryUsage)[taskIdx][currentIterationNum] = systemInfo.totalram / systemInfo.mem_unit; } void Measurement::writeData(const string &key, const string &value) { if (m_auxiliaryData.find(key) == m_auxiliaryData.end ()) m_auxiliaryData[key] = value; else m_auxiliaryData[key] += " " + value; } void Measurement::analyze() { string filePath = getcwdStr(); string fileName = filePath + "/" + m_protocolName + "*"; for (size_t idx = 1; idx< m_arguments.size(); idx++) fileName += "*" + m_arguments[idx].second; fileName += ".json"; json partyTimes = json::array(); for (size_t taskNameIdx = 0; taskNameIdx < m_names.size(); taskNameIdx++) { //Write for each task name all the iteration json task = json::object(); task["name"] = m_names[taskNameIdx]; for (int iterationIdx = 0; iterationIdx < m_numberOfIterations; iterationIdx++) { ostringstream streamObj; streamObj << fixed << setprecision(3) << (*m_cpuEndTimes)[taskNameIdx][iterationIdx]; task["iteration_" + to_string(iterationIdx)] = streamObj.str(); } partyTimes.insert(partyTimes.begin(), task); } //party is the root of the json objects json party; party["times"] = partyTimes; //read auxiliary data party["auxiliaryData"] = m_auxiliaryData; map <string, string> argumentsToFile; copy(m_arguments.begin(), m_arguments.end(), inserter(argumentsToFile, argumentsToFile.begin())); party["parameters"] = argumentsToFile; //send json object to create file createJsonFile(party, fileName); } void Measurement::analyzeComm(const json & j, const string &fileName) { createJsonFile(j, fileName); } void Measurement::analyzeMemory() { string filePath = getcwdStr(); string fileName = filePath + "/party" + to_string(m_partyId) + "Memory.json"; json partyTimes = json::array(); for (size_t taskNameIdx = 0; taskNameIdx < m_names.size(); taskNameIdx++) { //Write for each task name all the iteration json task = json::object(); task["name"] = m_names[taskNameIdx]; for (int iterationIdx = 0; iterationIdx < m_numberOfIterations; iterationIdx++) { ostringstream streamObj; streamObj << fixed << setprecision(3) << (*m_memoryUsage)[taskNameIdx][iterationIdx]; task["iteration_" + to_string(iterationIdx)] = streamObj.str(); } partyTimes.insert(partyTimes.begin(), task); } //party is the root of the json objects json party; party["times"] = partyTimes; createJsonFile(party, fileName); } void Measurement::createJsonFile(const json &j, const string &fileName) { try { ofstream myfile (fileName, ostream::out); myfile << j; } catch (exception& e) { cout << "Exception thrown : " << e.what() << endl; } } Measurement::~Measurement() { analyze(); analyzeMemory(); delete m_cpuStartTimes; delete m_cpuEndTimes; delete m_memoryUsage; }
34.834061
157
0.689357
cryptobiu
7632d1ab4a4c2eb45bb31e7f52c08e7fdf8ba5ec
3,226
hpp
C++
src/OpenGL/Framebuffer.hpp
Mischa-Alff/world
93772b438df7477104298cc253737713d510a595
[ "MIT" ]
null
null
null
src/OpenGL/Framebuffer.hpp
Mischa-Alff/world
93772b438df7477104298cc253737713d510a595
[ "MIT" ]
null
null
null
src/OpenGL/Framebuffer.hpp
Mischa-Alff/world
93772b438df7477104298cc253737713d510a595
[ "MIT" ]
3
2016-07-10T08:39:10.000Z
2019-08-28T01:35:06.000Z
#pragma once #include <vector> #include <GL/glew.h> #include <GL/gl.h> namespace Graphics { namespace OpenGL { class Texture; /*! \brief A wrapper around the OpenGL framebuffer API */ class Framebuffer { private: /*! \brief The internal OpenGL framebuffer object */ GLuint m_framebuffer; public: /*! \brief Creates the internal frambuffer object */ void create(); /*! \brief Binds a 1D texture to an attachment on the framebuffer * \param[in] attachment the point to attach to * \param[in] tex the texture to attach * \param[in] level the LOD level to use */ void bindTexture1D(GLenum attachment, Texture &tex, GLint level); /*! \brief Binds a 2D texture to an attachment on the framebuffer * \param[in] attachment the point to attach to * \param[in] tex the texture to attach * \param[in] level the LOD level to use */ void bindTexture2D(GLenum attachment, Texture &tex, GLint level); /*! \brief Binds a 3D texture to an attachment on the framebuffer * \param[in] attachment the point to attach to * \param[in] tex the texture to attach * \param[in] level the LOD level to use * \param[in] layer the layer of the 3D texture to use */ void bindTexture3D( GLenum attachment, Texture &tex, GLint level, GLint layer ); /*! \brief Binds fragment shader outputs to the framebuffer's bound color * buffers. * \param[in] buffers A vector of buffers to bind. Their position in the * vector corresponds to the 2nd argument in * [ShaderProgram::bindFragDataLocation]. * \sa ShaderProgram::bindFragDataLocation */ void drawBuffers(std::vector<GLenum> buffers); /*! \brief Destroys the internal frambuffer object */ void destroy(); /*! \brief Returns the internal framebuffer object. * \returns the internal framebuffer object */ operator GLuint(); /*! \brief Returns whether the internal frambuffer object is valid or not. * \returns whether the internal frambuffer object is valid or not. */ explicit operator bool() const; /*! \brief Returns whether the internal frambuffer object is valid or not. * \returns whether the internal frambuffer object is valid or not. */ bool isValid() const; /*! \brief binds the given framebuffer (or none if nullptr) to GL_FRAMEBUFFER \param[in] framebuffer the framebuffer to bind */ static void bind(Framebuffer *framebuffer); /*! \brief binds the given framebuffer (or none if nullptr) to the given bind point \param[in] bind_point the bind point to bind to \param[in] framebuffer the framebuffer to bind */ static void bind(GLenum bind_point, Framebuffer *framebuffer); /*! \brief Binds the framebuffer to the given bind point * (default is GL_FRAMEBUFFER) * \param[in] bind_point the bind point to bind to */ void bind(GLenum bind_point = GL_FRAMEBUFFER); /*! \brief Constructs the framebuffer object. */ Framebuffer(); /*! \brief Destroys the framebuffer object. */ ~Framebuffer(); }; } }
28.548673
77
0.656851
Mischa-Alff
7633680275b64df4765f0614af5165d18c6bd3a0
3,560
cc
C++
test/unit/picolibrary/spi/gpio_output_pin_device_selector/main.cc
jaylamb/picolibrary
528d04fac031c80c64df86574737be3bfca1b867
[ "Apache-2.0" ]
3
2021-02-12T04:05:42.000Z
2022-02-15T19:23:52.000Z
test/unit/picolibrary/spi/gpio_output_pin_device_selector/main.cc
jaylamb/picolibrary
528d04fac031c80c64df86574737be3bfca1b867
[ "Apache-2.0" ]
633
2019-08-31T20:58:26.000Z
2022-03-31T22:23:36.000Z
test/unit/picolibrary/spi/gpio_output_pin_device_selector/main.cc
jaylamb/picolibrary
528d04fac031c80c64df86574737be3bfca1b867
[ "Apache-2.0" ]
1
2021-02-17T20:40:49.000Z
2021-02-17T20:40:49.000Z
/** * picolibrary * * Copyright 2020-2021, Andrew Countryman <apcountryman@gmail.com> and the picolibrary * contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /** * \file * \brief picolibrary::SPI::GPIO_Output_Pin_Device_Selector unit test program. */ #include "gmock/gmock.h" #include "gtest/gtest.h" #include "picolibrary/error.h" #include "picolibrary/result.h" #include "picolibrary/spi.h" #include "picolibrary/testing/unit/error.h" #include "picolibrary/testing/unit/gpio.h" #include "picolibrary/testing/unit/random.h" #include "picolibrary/void.h" namespace { using ::picolibrary::Error_Code; using ::picolibrary::Result; using ::picolibrary::Void; using ::picolibrary::Testing::Unit::Mock_Error; using ::picolibrary::Testing::Unit::random; using ::testing::Return; using Device_Selector = ::picolibrary::SPI::GPIO_Output_Pin_Device_Selector<::picolibrary::Testing::Unit::GPIO::Mock_Output_Pin>; } // namespace /** * \brief Verify picolibrary::SPI::GPIO_Output_Pin_Device_Selector::select() properly * handles a selection error. */ TEST( select, selectionError ) { auto device_selector = Device_Selector{}; auto const error = random<Mock_Error>(); EXPECT_CALL( device_selector, transition_to_high() ).WillOnce( Return( error ) ); auto const result = device_selector.select(); EXPECT_TRUE( result.is_error() ); EXPECT_EQ( result.error(), error ); } /** * \brief Verify picolibrary::SPI::GPIO_Output_Pin_Device_Selector::select() works * properly. */ TEST( select, worksProperly ) { auto device_selector = Device_Selector{}; EXPECT_CALL( device_selector, transition_to_high() ).WillOnce( Return( Result<Void, Error_Code>{} ) ); EXPECT_FALSE( device_selector.select().is_error() ); } /** * \brief Verify picolibrary::SPI::GPIO_Output_Pin_Device_Selector::dedeselect() properly * handles a deselection error. */ TEST( deselect, deselectionError ) { auto device_selector = Device_Selector{}; auto const error = random<Mock_Error>(); EXPECT_CALL( device_selector, transition_to_low() ).WillOnce( Return( error ) ); auto const result = device_selector.deselect(); EXPECT_TRUE( result.is_error() ); EXPECT_EQ( result.error(), error ); } /** * \brief Verify picolibrary::SPI::GPIO_Output_Pin_Device_Selector::deselect() works * properly. */ TEST( deselect, worksProperly ) { auto device_selector = Device_Selector{}; EXPECT_CALL( device_selector, transition_to_low() ).WillOnce( Return( Result<Void, Error_Code>{} ) ); EXPECT_FALSE( device_selector.deselect().is_error() ); } /** * \brief Execute the picolibrary::SPI::GPIO_Output_Pin_Device_Selector unit tests. * * \param[in] argc The number of arguments to pass to testing::InitGoogleMock(). * \param[in] argv The array of arguments to pass to testing::InitGoogleMock(). * * \return See Google Test's RUN_ALL_TESTS(). */ int main( int argc, char * argv[] ) { ::testing::InitGoogleMock( &argc, argv ); return RUN_ALL_TESTS(); }
28.943089
109
0.719101
jaylamb
763cf77fc4311d80add0a6bbab05f572c314e410
600
cc
C++
fountain/base/NodeBase.cc
fountainment/fountain-engine-improved
5ca46d089cf26bb200374c46a69d4dc927d94f0d
[ "MIT" ]
null
null
null
fountain/base/NodeBase.cc
fountainment/fountain-engine-improved
5ca46d089cf26bb200374c46a69d4dc927d94f0d
[ "MIT" ]
null
null
null
fountain/base/NodeBase.cc
fountainment/fountain-engine-improved
5ca46d089cf26bb200374c46a69d4dc927d94f0d
[ "MIT" ]
null
null
null
#include "base/NodeBase.h" using fei::NodeBase; void NodeBase::init() { } void NodeBase::destroy() { } void NodeBase::beforeUpdate() { } void NodeBase::update() { } void NodeBase::afterUpdate() { } void NodeBase::feiInit() { if (_isLoaded) return; init(); _isLoaded = true; } void NodeBase::feiDestroy() { if (!_isLoaded) return; destroy(); _isLoaded = false; } void NodeBase::feiReinit() { feiDestroy(); feiInit(); } void NodeBase::feiUpdate() { if (!isActive()) { return; } beforeUpdate(); feiBasicUpdate(); update(); afterUpdate(); } void NodeBase::feiBasicUpdate() { }
10.169492
31
0.655
fountainment
763f1e13446725f865d345f189d95cf8f57f10fc
1,173
cpp
C++
libs/library/src/library.cpp
briancairl/snek
ebdd90ba2790bfcbf843c0eb52a13c7f212f8e8f
[ "MIT" ]
null
null
null
libs/library/src/library.cpp
briancairl/snek
ebdd90ba2790bfcbf843c0eb52a13c7f212f8e8f
[ "MIT" ]
null
null
null
libs/library/src/library.cpp
briancairl/snek
ebdd90ba2790bfcbf843c0eb52a13c7f212f8e8f
[ "MIT" ]
null
null
null
/** * @copyright 2022-present Brian Cairl * * @file library.cpp */ // LibDL #include <dlfcn.h> // Snek #include <snek/assert.hpp> #include <snek/library.hpp> namespace snek { Library::Library(Library&& other) : native_handle_{other.native_handle_} { other.native_handle_ = nullptr; } Library::Library(const char* path) : native_handle_{nullptr} { if (native_handle_ = dlopen(path, RTLD_LAZY | RTLD_LOCAL); native_handle_ != nullptr) { return; } else if (const char* errstr = dlerror(); errstr != nullptr) { native_handle_ = nullptr; throw std::runtime_error{errstr}; } SNEK_ASSERT_NON_NULL(dlopen(path, RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD)); } void* Library::get_opaque_symbol(const char* symbol_name) const { SNEK_ASSERT_TRUE(Library::is_loaded()); return dlsym(native_handle_, symbol_name); } void Library::unload() { if (!is_loaded()) { return; } else if (const int retval = dlclose(native_handle_); retval == 0) { native_handle_ = nullptr; } } Library& Library::operator=(Library&& other) { native_handle_ = other.native_handle_; other.native_handle_ = nullptr; return *this; } } // namespace snek
19.881356
108
0.693947
briancairl
7640e1b2223bf4821609e32166d7f02f73080d21
9,173
cc
C++
arcane/src/arcane/std/ProfPerformanceService.cc
JeromeDuboisPro/framework
d88925495e3787fdaf640c29728dcac385160188
[ "Apache-2.0" ]
null
null
null
arcane/src/arcane/std/ProfPerformanceService.cc
JeromeDuboisPro/framework
d88925495e3787fdaf640c29728dcac385160188
[ "Apache-2.0" ]
null
null
null
arcane/src/arcane/std/ProfPerformanceService.cc
JeromeDuboisPro/framework
d88925495e3787fdaf640c29728dcac385160188
[ "Apache-2.0" ]
null
null
null
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*- //----------------------------------------------------------------------------- // Copyright 2000-2021 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) // See the top-level COPYRIGHT file for details. // SPDX-License-Identifier: Apache-2.0 //----------------------------------------------------------------------------- /*---------------------------------------------------------------------------*/ /* ProfPerformanceService.cc (C) 2000-2021 */ /* */ /* Informations de performances utilisant les signaux de profiling. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #include "arcane/utils/ArcanePrecomp.h" #include "arcane/utils/ValueConvert.h" #include "arcane/utils/NotImplementedException.h" #include "arcane/utils/PlatformUtils.h" #include "arcane/utils/FatalErrorException.h" #include "arcane/utils/TraceInfo.h" #include "arcane/FactoryService.h" #include "arcane/AbstractService.h" #include "arcane/utils/IProfilingService.h" #include "arcane/std/ProfilingInfo.h" // NOTE: Ce fichier nécessitant la libunwind, il n'est compilé que sur // les OS de style UNIX. #define UNW_LOCAL_ONLY #include <libunwind.h> #include <stdio.h> #include <cxxabi.h> #include <sys/time.h> #include <signal.h> /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ namespace Arcane { /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /*! * \brief Service de profiling utilisant 'setitimer'. */ class ProfPerformanceService : public AbstractService , public IProfilingService { public: ProfPerformanceService(const ServiceBuildInfo& sbi); virtual ~ProfPerformanceService(); public: virtual void initialize(); virtual void startProfiling(); virtual void switchEvent(); virtual void stopProfiling(); virtual void printInfos(bool dump_file); virtual void getInfos(Int64Array&); virtual void dumpJSON(JSONWriter& writer); virtual void reset(); virtual ITimerMng* timerMng() { return 0; } public: private: int m_period; private: }; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ ARCANE_REGISTER_APPLICATION_FACTORY(ProfPerformanceService, IProfilingService, ProfProfilingService); /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ ProfPerformanceService:: ProfPerformanceService(const ServiceBuildInfo& sbi) : AbstractService(sbi) , m_period(100) { } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ ProfPerformanceService:: ~ProfPerformanceService() { } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ static void _setTimer(Integer usecond) { struct itimerval time_val; struct itimerval otime_val; time_val.it_value.tv_sec = 0; time_val.it_value.tv_usec = usecond; time_val.it_interval.tv_sec = 0; time_val.it_interval.tv_usec = 0; int r = setitimer(ITIMER_PROF,&time_val,&otime_val); if (r!=0) cout << "** ERROR in setitimer r=" << r << '\n'; } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ namespace { int nb_total = 0; ProfInfos* global_infos = nullptr; bool global_is_active = false; //! Temps du timer en micro-seconde int global_timer_period = 10000; } extern "C" void arcane_prof_handler() { static bool is_in_handler = false; // Sous Linux avec gcc, les exceptions utilisent la libunwind contenue // dans gcc et cela peut provoquer des deadlocks avec notre utilisation // si cet handler est appelé lors du dépilement d'une exception. // Pour éviter ce problème, on ne fait rien tant qu'une exception est // active. if (Exception::hasPendingException()){ cout << "** WARNING: ProfHandler in pending exception\n"; return; } if (is_in_handler){ cout << "** In handler\n"; return; } is_in_handler = true; ++nb_total; int overflow_event[MAX_COUNTER]; int nb_overflow_event = 1; overflow_event[0] = 0; unw_word_t func_ip = 0; unw_word_t offset = 0; { unw_cursor_t cursor; unw_context_t uc; unw_getcontext(&uc); unw_init_local(&cursor, &uc); int current_func = 0; String message; // Le 3 indique le nombre de fonctions avant la bonne // (il y a cette fonction, puis le _arcaneProfilingSigFunc // et le signal lui meme. while (unw_step(&cursor) > 0 && current_func<3) { //while (current_func<3) { //unw_step(&cursor); unw_get_reg(&cursor, UNW_REG_IP, &func_ip); #if 0 char func_name_buf[10000]; unw_get_proc_name(&cursor,func_name_buf,10000,&offset); cout << "** I=" << current_func << " FUNC NAME=" << func_name_buf << " ip=" << (void*)func_ip << '\n'; #endif ++current_func; } } global_infos->addEvent((void*)(func_ip+offset),overflow_event,nb_overflow_event); is_in_handler = false; } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ extern "C" void _arcaneProfilingSigFunc(int signum) { //cout << "**SIGPROF=" << global_is_active << "\n"; if (signum!=SIGPROF) return; if (global_is_active){ arcane_prof_handler(); // Il est préférable de positionner le timer une fois // la fonction de profiling appelée car si le timer est petit, // il peut se déclencher dans la boucle _setTimer(global_timer_period); } } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: initialize() { if (!global_infos) global_infos = new ProfInfos(traceMng()); global_infos->setFunctionDepth(4); global_infos->setNbEventBeforeGettingStack(100); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: startProfiling() { global_is_active = true; global_infos->startProfiling(); ::sigset(SIGPROF,_arcaneProfilingSigFunc); _setTimer(global_timer_period); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: switchEvent() { } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: stopProfiling() { if (!global_infos) return; global_is_active = false; _setTimer(global_timer_period); ::sigset(SIGPROF,SIG_IGN); //info() << "PROFILING: stop profiling nb_total=" << nb_total; global_infos->stopProfiling(); //global_infos->printInfos(); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: printInfos(bool dump_file) { if (global_infos) global_infos->printInfos(dump_file); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: dumpJSON(JSONWriter& writer) { if (global_infos) global_infos->dumpJSON(writer); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: getInfos(Int64Array&) { throw NotImplementedException(A_FUNCINFO); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ProfPerformanceService:: reset() { if (global_infos) global_infos->reset(); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ } // End namespace Arcane /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
30.07541
83
0.444784
JeromeDuboisPro
7645af02312abcebdd8f3c3d3a087226498ed96e
881
cpp
C++
palimdromicGame.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
palimdromicGame.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
palimdromicGame.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
#include <iostream> #include <map> #include <iterator> using namespace std; int main(){ int t; scanf("%d",&t); while(t--) { string a,b; cin>>a; cin>>b; map<char,int> a1,b1; for(int i=0;i<a.length();i++) { a1[a[i]]++; b1[b[i]]++; } int flag=0; for(map<char,int> :: iterator it=a1.begin();it!=a1.end();it++) { if(b1[it->first]==0) { flag=1; break; } } if(flag==0) { printf("B\n"); continue; } flag=0; for(map<char,int> :: iterator it=a1.begin();it!=a1.end();it++) { if(it->second>1 && b1[it->first]==0) { flag=1; break; } } if(flag==1) { printf("A\n"); continue; } flag=0; for(map<char,int> :: iterator it=b1.begin();it!=b1.end();it++) { if(a1[it->first]==0) { flag=1; break; } } if(flag==0) { printf("A\n"); } else { printf("B\n"); } } }
12.955882
64
0.475596
sagar-sam
76464428f0d4aa053f6d9bf93c3edfec11c33bd2
1,916
cpp
C++
aws-cpp-sdk-backup/source/model/ListReportJobsRequest.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-10T08:06:54.000Z
2022-02-10T08:06:54.000Z
aws-cpp-sdk-backup/source/model/ListReportJobsRequest.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-backup/source/model/ListReportJobsRequest.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-12-30T04:25:33.000Z
2021-12-30T04:25:33.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/backup/model/ListReportJobsRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/http/URI.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <utility> using namespace Aws::Backup::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws::Http; ListReportJobsRequest::ListReportJobsRequest() : m_byReportPlanNameHasBeenSet(false), m_byCreationBeforeHasBeenSet(false), m_byCreationAfterHasBeenSet(false), m_byStatusHasBeenSet(false), m_maxResults(0), m_maxResultsHasBeenSet(false), m_nextTokenHasBeenSet(false) { } Aws::String ListReportJobsRequest::SerializePayload() const { return {}; } void ListReportJobsRequest::AddQueryStringParameters(URI& uri) const { Aws::StringStream ss; if(m_byReportPlanNameHasBeenSet) { ss << m_byReportPlanName; uri.AddQueryStringParameter("ReportPlanName", ss.str()); ss.str(""); } if(m_byCreationBeforeHasBeenSet) { ss << m_byCreationBefore.ToGmtString(DateFormat::ISO_8601); uri.AddQueryStringParameter("CreationBefore", ss.str()); ss.str(""); } if(m_byCreationAfterHasBeenSet) { ss << m_byCreationAfter.ToGmtString(DateFormat::ISO_8601); uri.AddQueryStringParameter("CreationAfter", ss.str()); ss.str(""); } if(m_byStatusHasBeenSet) { ss << m_byStatus; uri.AddQueryStringParameter("Status", ss.str()); ss.str(""); } if(m_maxResultsHasBeenSet) { ss << m_maxResults; uri.AddQueryStringParameter("MaxResults", ss.str()); ss.str(""); } if(m_nextTokenHasBeenSet) { ss << m_nextToken; uri.AddQueryStringParameter("NextToken", ss.str()); ss.str(""); } }
23.084337
69
0.679019
perfectrecall
76479256096b7fad549a443ecbeb55cfc4550f3d
6,442
cpp
C++
src/Mx3.cpp
infinitelyCannon/Mx3
9d2ae82344821c428272511f23a937c9025d92a3
[ "MIT" ]
null
null
null
src/Mx3.cpp
infinitelyCannon/Mx3
9d2ae82344821c428272511f23a937c9025d92a3
[ "MIT" ]
null
null
null
src/Mx3.cpp
infinitelyCannon/Mx3
9d2ae82344821c428272511f23a937c9025d92a3
[ "MIT" ]
null
null
null
#include "Mx3.hpp" #include "fmod_errors.h" #include "Song.hpp" #include <cstdlib> #define ERRCHECK(x) ErrorCheck(x, __FILE__, __LINE__) #define HEAD_CHANNEL "Mx3_Main" #define SOLO_CHANNEL "Mx3_Solo" ErrorCallback Mx3::mErrorCallback = nullptr; /* * TODO: Find a way to have the library be imported without the user having to use/include FMOD headers * (Might help with glue implementations) */ Mx3::Mx3() : mSystem(nullptr) { // TODO: Add call to CoInitialize for Windows ERRCHECK(FMOD::System_Create(&mSystem, FMOD_VERSION)); ERRCHECK(mSystem->init(32, FMOD_INIT_NORMAL, 0)); mTracks[HEAD_CHANNEL] = nullptr; mTracks[SOLO_CHANNEL] = nullptr; ERRCHECK(mSystem->createChannelGroup(HEAD_CHANNEL, &mTracks[HEAD_CHANNEL])); ERRCHECK(mSystem->createChannelGroup(SOLO_CHANNEL, &mTracks[SOLO_CHANNEL])); ERRCHECK(mTracks[HEAD_CHANNEL]->addGroup(mTracks[SOLO_CHANNEL])); } Mx3::Mx3(int maxchannels, FMOD_INITFLAGS flags, void* driverdata): mSystem(nullptr) { ERRCHECK(FMOD::System_Create(&mSystem, FMOD_VERSION)); ERRCHECK(mSystem->init(maxchannels, flags, driverdata)); mTracks[HEAD_CHANNEL] = nullptr; mTracks[SOLO_CHANNEL] = nullptr; ERRCHECK(mSystem->createChannelGroup(HEAD_CHANNEL, &mTracks[HEAD_CHANNEL])); ERRCHECK(mSystem->createChannelGroup(SOLO_CHANNEL, &mTracks[SOLO_CHANNEL])); ERRCHECK(mTracks[HEAD_CHANNEL]->addGroup(mTracks[SOLO_CHANNEL])); } void Mx3::AddToQueue(std::string file) { if (file.empty()) return; mQueue.push_back(file); } void Mx3::AddToQueue(std::vector<std::string> &files) { mQueue.insert(mQueue.end(), files.begin(), files.end()); } void Mx3::ClearQueue() { Stop(); mQueue.clear(); //for (auto sound : mSounds) // ERRCHECK(sound.second->release()); //mSounds.clear(); } void Mx3::Debug() { bDebug = true; } void Mx3::ErrorCheck(FMOD_RESULT result, const char *file, int line) { if(result != FMOD_OK) { if(mErrorCallback) mErrorCallback(FMOD_ErrorString(result), file, line); } } unsigned int Mx3::GetLength() { if(mChannels.empty()) return 0; return mChannels.begin()->second->GetLength(); } bool Mx3::GetPaused() { bool paused = false; ERRCHECK(mTracks[HEAD_CHANNEL]->getPaused(&paused)); return paused; } unsigned int Mx3::GetPosition() { if (bDebug) bDebug = false; if(mChannels.empty()) return 0; return mChannels.begin()->second->GetPosition(); } float Mx3::GetVolume() { float volume = 0; ERRCHECK(mTracks[HEAD_CHANNEL]->getVolume(&volume)); return volume; } bool Mx3::IsPlaying() { bool result = false; ERRCHECK(mTracks[HEAD_CHANNEL]->isPlaying(&result)); return result; } bool Mx3::IsSoundLoaded(const std::string file) { /*auto songRef = mSounds.find(file); if(songRef == mSounds.end()) return false; if(songRef->second) { FMOD_OPENSTATE state; ERRCHECK(songRef->second->getOpenState(&state, 0, 0, 0)); return state != FMOD_OPENSTATE_ERROR; }*/ return false; } //void Mx3::LoadSound(const std::string name) //{ // if (IsSoundLoaded(name)) // return; // // auto soundRef = mSounds.find(name); // if (soundRef != mSounds.end()) // return; // // mSounds[name] = nullptr; // FMOD_MODE mode = FMOD_NONBLOCKING | FMOD_CREATESTREAM | FMOD_2D | FMOD_LOOP_NORMAL; // ERRCHECK(mSystem->createSound(name.c_str(), mode, 0, &mSounds[name])); //} void Mx3::Next() { if (mQueue.empty()) return; else if (mQueue.size() == 1) Play(NowPlayingIdx); Play((NowPlayingIdx + 1) % mQueue.size()); } void Mx3::Play(int index) { if (index >= mQueue.size() || index < 0) return; if (!mChannels.empty()) Stop(); //LoadSound(mQueue[index]); NowPlayingIdx = index; mChannels.emplace(NextChannelID++, new Song(mSystem, mQueue[index], mTracks[SOLO_CHANNEL])); } //void Mx3::PlaySound(std::string file) //{ // auto songRef = mSounds.find(file); // // if(songRef == mSounds.end()) // { // LoadSound(file); // songRef = mSounds.find(file); // if(songRef == mSounds.end()) // return; // } // // mChannels.emplace( // std::make_pair(NextChannelID++, Song(mSystem, file, mTracks[SOLO_CHANNEL])) // ); //} void Mx3::Previous() { // TODO: Have it restart currrent song if at/before certain position if (mQueue.empty() || NowPlayingIdx == 0) return; else if (mQueue.size() == 1) Play(NowPlayingIdx); Play((NowPlayingIdx - 1) % mQueue.size()); } void Mx3::RemoveFromQueue(int index) { if (index < 0 || index >= mQueue.size()) return; else if (mQueue.size() == 1) { ClearQueue(); return; } //NOTE: Might need to switch to having Songs manage the Sound *'s mQueue.erase(mQueue.begin() + index); if (index < NowPlayingIdx) --NowPlayingIdx; else if (index == NowPlayingIdx) Play(NowPlayingIdx); } void Mx3::SetErrorCallback(ErrorCallback func) { mErrorCallback = func; Song::SetErrorCallback(func); } void Mx3::SetPaused(bool paused) { ERRCHECK(mTracks[HEAD_CHANNEL]->setPaused(paused)); } void Mx3::SetRepeatMode(int mode) { if (!IsPlaying()) return; mChannels.begin()->second->SetRepeatMode(mode); } void Mx3::SetVolume(float volume, bool clamp) { if(clamp) { if(volume < 0) volume = 0; else if(volume > 1.0f) volume = 1.0f; } ERRCHECK(mTracks[HEAD_CHANNEL]->setVolume(volume)); } void Mx3::Stop() { for (auto it = mTracks.begin(); it != mTracks.end();) { if (it->first == HEAD_CHANNEL || it->first == SOLO_CHANNEL) ++it; else { ERRCHECK(it->second->stop()); it = mTracks.erase(it); } } mChannels.clear(); NextChannelID = 0; } void Mx3::SwapSongs(int first, int second) { if (first < 0 || first >= mQueue.size() || second < 0 || second >= mQueue.size()) return; if (first == second) return; std::string temp = mQueue[first]; mQueue[first] = mQueue[second]; mQueue[second] = temp; if (NowPlayingIdx == first) NowPlayingIdx = second; else if (NowPlayingIdx == second) NowPlayingIdx = first; } //void Mx3::UnLoadSound(std::string file) //{ // auto soundRef = mSounds.find(file); // // if(soundRef != mSounds.end()) // return; // // ERRCHECK(mSounds[file]->release()); // mSounds.erase(soundRef); //} void Mx3::Update(float deltaTime) { ERRCHECK(mSystem->update()); for (auto it = mChannels.begin(); it != mChannels.end();) { it->second->Update(deltaTime); if (it->second->IsStopped()) it = mChannels.erase(it); else ++it; } } Mx3::~Mx3() { ERRCHECK(mTracks[HEAD_CHANNEL]->stop()); mChannels.clear(); //for(auto sound : mSounds) // ERRCHECK(sound.second->release()); ERRCHECK(mSystem->release()); }
20.068536
102
0.681931
infinitelyCannon
7648659fe4b6c7405b296766b3515d9de6ba108f
9,364
cpp
C++
src/DaggyCore/tests/local/DaggyCoreLocalTests.cpp
milovidov/dataagregator
1150f66fc2ef2bbcf62c0174ef147109185cad98
[ "MIT" ]
135
2019-06-23T20:32:33.000Z
2022-02-06T15:41:41.000Z
src/DaggyCore/tests/local/DaggyCoreLocalTests.cpp
milovidov/dataagregator
1150f66fc2ef2bbcf62c0174ef147109185cad98
[ "MIT" ]
2
2020-10-16T17:31:44.000Z
2022-01-02T22:02:04.000Z
src/DaggyCore/tests/local/DaggyCoreLocalTests.cpp
milovidov/dataagregator
1150f66fc2ef2bbcf62c0174ef147109185cad98
[ "MIT" ]
11
2019-12-26T14:36:44.000Z
2022-02-23T02:14:41.000Z
/* MIT License Copyright (c) 2021 Mikhail Milovidov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Precompiled.h" #include "DaggyCoreLocalTests.h" #include <DaggyCore/Core.hpp> #include <DaggyCore/Errors.hpp> using namespace daggy; namespace { constexpr const char* json_data = R"JSON( { "sources": { "localhost" : { "type": "local", "commands": { "pingpong": { "exec": "pingpong", "extension": "log" }, "pingpong_restart": { "exec": "pingpong -c 1", "extension": "log", "restart": true }, "pingpong_once": { "exec": "pingpong -c 1", "extension": "log" } } } } } )JSON"; constexpr const char* yaml_data = R"YAML( aliases: - &my_commands pingpong: exec: pingpong extension: log pingpong_restart: exec: pingpong -c 1 extension: log restart: true pingpong_once: exec: pingpong -c 1 extension: log sources: localhost: type: local commands: *my_commands )YAML"; thread_local const Sources test_sources{ { "localhost", { "local", "", { { "pingpong", { "log", "pingpong", {}, false } }, { "pingpong_restart", { "log", "pingpong -c 1", {}, true } }, { "pingpong_once", { "log", "pingpong -c 1", {}, false } }, }, false, {} } } }; thread_local const Sources fake_data_sources = { { "localhost", { "local", "", { { "fake_ping", { "log", "ping_fake 127.0.0.1", {}, false } } }, false, {} } } }; thread_local const Sources once_process_data_sources = { { "localhost", { "local", "", { { "pingpong", { "log", "pingpong", {}, false } } }, false, {} } } }; } DaggyCoreLocalTests::DaggyCoreLocalTests(QObject *parent) : QObject(parent) { } void DaggyCoreLocalTests::init() { } void DaggyCoreLocalTests::cleanup() { } void DaggyCoreLocalTests::checkVersion() { daggy::Core core({}); auto version = core.version(); QCOMPARE(QString(version.full), QString(DAGGY_VERSION_FULL)); QCOMPARE(version.major, DAGGY_VERSION_MAJOR); QCOMPARE(version.minor, DAGGY_VERSION_MINOR); QCOMPARE(version.patch, DAGGY_VERSION_PATCH); QCOMPARE(version.build, DAGGY_VERSION_BUILD); QCOMPARE(QString(version.postfix), QString(DAGGY_VERSION_POSTFIX)); QCOMPARE(QString(version.vendor), QString(DAGGY_VENDOR)); QCOMPARE(QString(version.commit), QString(DAGGY_VERSION_COMMIT)); } void DaggyCoreLocalTests::startAndTerminateTest_data() { QTest::addColumn<QString>("type"); QTest::addColumn<QString>("data"); QTest::newRow("json") << "json" << json_data; #ifdef YAML_SUPPORT QTest::newRow("yaml") << "yaml" << yaml_data; #endif } void DaggyCoreLocalTests::startAndTerminateTest() { QFETCH(QString, type); QFETCH(QString, data); Sources sources; QString error; if (type == "json") sources = std::move(*sources::convertors::json(data, error)); else sources = std::move(*sources::convertors::yaml(data, error)); QVERIFY(error.isEmpty()); QCOMPARE(sources, test_sources); Core core(std::move(sources)); const auto& session = core.session(); QCOMPARE(core.prepare(error), errors::success); QVERIFY(core.state() == DaggyNotStarted); QCOMPARE(core.sources(), test_sources); QSignalSpy states_spy(&core, &Core::stateChanged); QSignalSpy streams_spy(&core, &Core::commandStream); QTimer::singleShot(0, &core, [&]() { auto result = core.start(); QCOMPARE(result, errors::success); }); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); auto arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyStarted); QTimer::singleShot(3000, &core, [&]() { core.stop(); }); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyFinishing); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyFinished); streams_spy.wait(); QVERIFY(!streams_spy.isEmpty()); QMap<QString, QList<sources::commands::Stream>> streams; for (auto command_stream : streams_spy) { auto command_id = command_stream[1].toString(); auto stream = command_stream[2].value<sources::commands::Stream>(); QVERIFY(!stream.part.isEmpty()); QCOMPARE(stream.meta.session, session); streams[command_id].push_back(stream); } auto stream_keys = streams.keys(); std::sort(stream_keys.begin(), stream_keys.end()); QList<QString> sources_keys; for (const auto& command : test_sources) { sources_keys += command.commands.keys(); } std::sort(sources_keys.begin(), sources_keys.end()); QCOMPARE(stream_keys, sources_keys); QVERIFY(!streams["pingpong_once"].isEmpty()); QVERIFY(!streams["pingpong_restart"].isEmpty()); QVERIFY(!streams["pingpong"].isEmpty()); } void DaggyCoreLocalTests::stopWithFakeProcess() { Core core(fake_data_sources); QString error; QCOMPARE(core.prepare(error), errors::success); QCOMPARE(core.state(), DaggyNotStarted); QSignalSpy states_spy(&core, &Core::stateChanged); QTimer::singleShot(0, &core, [&]() { auto result = core.start(); QCOMPARE(result, errors::success); }); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); auto arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyStarted); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyFinished); } void DaggyCoreLocalTests::stopOnceProcess() { Core core(once_process_data_sources); QCOMPARE(core.prepare(), errors::success); QCOMPARE(core.state(), DaggyNotStarted); QSignalSpy states_spy(&core, &Core::stateChanged); QSignalSpy streams_spy(&core, &Core::commandStream); QTimer::singleShot(0, &core, [&]() { auto result = core.start(); QCOMPARE(result, errors::success); }); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); auto arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyStarted); QTimer::singleShot(3000, &core, [&]() { core.stop(); }); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); QCOMPARE(states_spy.count(), 1); arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyFinishing); QVERIFY(states_spy.wait()); QVERIFY(!states_spy.isEmpty()); arguments = states_spy.takeFirst(); QCOMPARE(arguments.at(0).value<DaggyStates>(), DaggyFinished); QVERIFY(!streams_spy.isEmpty()); }
27.063584
78
0.562046
milovidov
7650955f6e972620c93af8e702e9f055198b3623
3,619
hpp
C++
pythran/pythonic/numpy/reduce.hpp
artas360/pythran
66dad52d52be71693043e9a7d7578cfb9cb3d1da
[ "BSD-3-Clause" ]
null
null
null
pythran/pythonic/numpy/reduce.hpp
artas360/pythran
66dad52d52be71693043e9a7d7578cfb9cb3d1da
[ "BSD-3-Clause" ]
null
null
null
pythran/pythonic/numpy/reduce.hpp
artas360/pythran
66dad52d52be71693043e9a7d7578cfb9cb3d1da
[ "BSD-3-Clause" ]
null
null
null
#ifndef PYTHONIC_NUMPY_REDUCE_HPP #define PYTHONIC_NUMPY_REDUCE_HPP #include "pythonic/include/numpy/reduce.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/__builtin__/None.hpp" #include "pythonic/__builtin__/ValueError.hpp" #include "pythonic/utils/neutral.hpp" #ifdef USE_BOOST_SIMD #include <boost/simd/include/functions/broadcast.hpp> #include <boost/simd/memory/functions/aligned_store.hpp> #endif #include <algorithm> namespace pythonic { namespace numpy { template <class Op, bool vector_form> template <class E, class F> F _reduce<Op, 1, vector_form>::operator()(E e, F acc) { for (auto const &value : e) Op{}(acc, value); return acc; } #ifdef USE_BOOST_SIMD template <class Op> template <class E, class F> F _reduce<Op, 1, true>::operator()(E e, F acc) { using T = typename E::dtype; using vT = typename boost::simd::native<T, BOOST_SIMD_DEFAULT_EXTENSION>; static const size_t vN = boost::simd::meta::cardinal_of<vT>::value; const long n = e.shape()[0]; const long bound = n / vN * vN; long i = 0; if (bound > 0) { vT vacc = e.load(i); for (i = vN; i < bound; i += vN) Op{}(vacc, e.load(i)); alignas(sizeof(vT)) T stored[vN]; boost::simd::store(vacc, &stored[0]); for (size_t j = 0; j < vN; ++j) Op{}(acc, stored[j]); } for (; i < n; ++i) Op{}(acc, e.fast(i)); return acc; } #endif template <class Op, size_t N, bool vector_form> template <class E, class F> F _reduce<Op, N, vector_form>::operator()(E e, F acc) { for (auto const &value : e) acc = _reduce<Op, N - 1, vector_form>{}(value, acc); return acc; } template <class Op, class E> reduce_result_type<E> reduce(E const &expr, types::none_type) { bool constexpr is_vectorizable = E::is_vectorizable and not std::is_same<typename E::dtype, bool>::value; reduce_result_type<E> p = utils::neutral<Op, typename E::dtype>::value; return _reduce<Op, types::numpy_expr_to_ndarray<E>::N, is_vectorizable>{}( expr, p); } template <class Op, class E> auto reduce(E const &array, long axis) -> typename std::enable_if<E::value == 1, decltype(reduce<Op>(array))>::type { if (axis != 0) throw types::ValueError("axis out of bounds"); return reduce<Op>(array); } template <class Op, class E> typename std::enable_if<E::value != 1, reduced_type<E>>::type reduce(E const &array, long axis) { if (axis < 0 || size_t(axis) >= E::value) throw types::ValueError("axis out of bounds"); auto shape = array.shape(); if (axis == 0) { types::array<long, E::value - 1> shp; std::copy(shape.begin() + 1, shape.end(), shp.begin()); return _reduce<Op, 1, false /* not on scalars*/>{}( array, reduced_type<E>{shp, utils::neutral<Op, typename E::dtype>::value}); } else { types::array<long, E::value - 1> shp; auto next = std::copy(shape.begin(), shape.begin() + axis, shp.begin()); std::copy(shape.begin() + axis + 1, shape.end(), next); reduced_type<E> sumy{shp, __builtin__::None}; std::transform(array.begin(), array.end(), sumy.begin(), [axis](typename E::iterator::value_type other) { return reduce<Op>(other, axis - 1); }); return sumy; } } } } #endif
30.669492
80
0.576126
artas360
76567786b4d2f0fea4342b88600955522033f9dc
1,429
cpp
C++
hardware/aw/bluetooth/bluedroid-usb/service/common/bluetooth/scan_result.cpp
ghsecuritylab/Android-7.0
e65af741a5cd5ac6e49e8735b00b456d00f6c0d0
[ "MIT" ]
10
2020-04-17T04:02:36.000Z
2021-11-23T11:38:42.000Z
hardware/aw/bluetooth/bluedroid-usb/service/common/bluetooth/scan_result.cpp
ghsecuritylab/Android-7.0
e65af741a5cd5ac6e49e8735b00b456d00f6c0d0
[ "MIT" ]
3
2020-02-19T16:53:25.000Z
2021-04-29T07:28:40.000Z
hardware/aw/bluetooth/bluedroid-usb/service/common/bluetooth/scan_result.cpp
ghsecuritylab/Android-7.0
e65af741a5cd5ac6e49e8735b00b456d00f6c0d0
[ "MIT" ]
5
2019-12-25T04:05:02.000Z
2022-01-14T16:57:55.000Z
// // Copyright (C) 2015 Google, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "service/common/bluetooth/scan_result.h" #include <base/logging.h> #include "service/common/bluetooth/util/address_helper.h" namespace bluetooth { ScanResult::ScanResult(const std::string& device_address, const std::vector<uint8_t> scan_record, int rssi) : device_address_(device_address), scan_record_(scan_record), rssi_(rssi) { CHECK(util::IsAddressValid(device_address)) << "Invalid BD_ADDR given: " << device_address; } bool ScanResult::operator==(const ScanResult& rhs) const { if (device_address_ != rhs.device_address_) return false; if (scan_record_ != rhs.scan_record_) return false; if (rssi_ != rhs.rssi_) return false; return true; } } // namespace bluetooth
28.58
76
0.677397
ghsecuritylab
7661f2225dfd8d98740c95c27acefdb09add4b76
1,863
hpp
C++
Schweizer-Messer/sm_kinematics/include/sm/kinematics/EulerAnglesYawPitchRoll.hpp
PushyamiKaveti/kalibr
d8bdfc59ee666ef854012becc93571f96fe5d80c
[ "BSD-4-Clause" ]
2,690
2015-01-07T03:50:23.000Z
2022-03-31T20:27:01.000Z
Schweizer-Messer/sm_kinematics/include/sm/kinematics/EulerAnglesYawPitchRoll.hpp
PushyamiKaveti/kalibr
d8bdfc59ee666ef854012becc93571f96fe5d80c
[ "BSD-4-Clause" ]
481
2015-01-27T10:21:00.000Z
2022-03-31T14:02:41.000Z
Schweizer-Messer/sm_kinematics/include/sm/kinematics/EulerAnglesYawPitchRoll.hpp
PushyamiKaveti/kalibr
d8bdfc59ee666ef854012becc93571f96fe5d80c
[ "BSD-4-Clause" ]
1,091
2015-01-26T21:21:13.000Z
2022-03-30T01:55:33.000Z
#ifndef _EULERANGLESYAWPITCHROLL_H_ #define _EULERANGLESYAWPITCHROLL_H_ #include "RotationalKinematics.hpp" namespace sm { namespace kinematics { /** * @class EulerAnglesYawPitchRoll * This is the standard Rotation sequence for aerospace vehicles. * * Passing this the parameters [yaw, pitch, roll] of a vehicle frame, F_v, * with respect to an inertial frame, F_i, returns the rotation matrix, * C_iv, the rotation that takes vectors from F_v, to F_i. * * Similarly passing the rotation matrix C_iv to this class will cause * return the vector [heading, pitch, roll] where these represent the usual * meaning with respect to aerospace vehicles. * * This assumes that the vehicle frame has: * x-axis pointing to the front. * y-axis pointing to the left. * z-axis pointing up. * * heading: positive is vehicle nose left (counter clockwise). * pitch: positive is vehicle nose down. * roll: positive is left wing up. * */ class EulerAnglesYawPitchRoll : public RotationalKinematics { public: virtual ~EulerAnglesYawPitchRoll(); // Three functions that must be implemented. virtual Eigen::Matrix3d parametersToRotationMatrix(const Eigen::Vector3d & parameters, Eigen::Matrix3d * S = NULL) const; virtual Eigen::Vector3d rotationMatrixToParameters(const Eigen::Matrix3d & rotationMatrix) const; virtual Eigen::Matrix3d parametersToSMatrix(const Eigen::Vector3d & parameters) const; virtual Eigen::Vector3d angularVelocityAndJacobian(const Eigen::Vector3d & p, const Eigen::Vector3d & pdot, Eigen::Matrix<double,3,6> * Jacobian) const; private: // A helper function Eigen::Matrix3d buildSMatrix(double sz, double cz, double sy, double cy) const; }; }} // namespace sm::kinematics #endif /* _EULERANGLESYAWPITCHROLL_H_ */
38.8125
158
0.718733
PushyamiKaveti
76685fdee2e27c3f2ca9a7a0f9635d827b1d8348
820
cpp
C++
src/ui/aim65proxy.cpp
LiamMayfair/EMU65
0d9540fd25ed84d501068becc71a11281fd6b01b
[ "MIT" ]
4
2021-01-31T05:23:48.000Z
2021-11-04T11:35:20.000Z
src/ui/aim65proxy.cpp
LiamMayfair/EMU65
0d9540fd25ed84d501068becc71a11281fd6b01b
[ "MIT" ]
null
null
null
src/ui/aim65proxy.cpp
LiamMayfair/EMU65
0d9540fd25ed84d501068becc71a11281fd6b01b
[ "MIT" ]
3
2018-10-11T01:15:36.000Z
2020-12-18T05:36:14.000Z
#include "../../include/ui/aim65proxy.h" Aim65Proxy::Aim65Proxy(Aim65 *aim65, QObject *parent) : QObject(parent), UiProxy() { this->m_aim65 = std::shared_ptr<Aim65>(Aim65::GetInstance()); this->m_aim65->Initialise(); this->RegisterProxy(); } Aim65Proxy::~Aim65Proxy() { } void Aim65Proxy::RegisterProxy() { UiProxyCollection::GetInstance()->InsertAim65Proxy(std::shared_ptr<Aim65Proxy>(this)); } void Aim65Proxy::Start() { //Cpu::GetInstance()->Reset(); Cpu::GetInstance()->Run(); } void Aim65Proxy::SetResetButton(bool newState) { if (newState == true) { Cpu::GetInstance()->Reset(); Start(); } else { Cpu::GetInstance()->Halt(); } this->m_aim65->SetPowerSwitch(newState); } bool Aim65Proxy::GetResetButton() const { return true; }
18.636364
90
0.636585
LiamMayfair
7668b543d43cc7764dd0490a8f34c67450528365
1,728
cpp
C++
algospot/amusementpark/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
13
2015-06-07T09:26:26.000Z
2019-05-01T13:23:38.000Z
algospot/amusementpark/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
null
null
null
algospot/amusementpark/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
4
2016-03-05T06:21:05.000Z
2017-02-17T15:34:18.000Z
// https://algospot.com/judge/problem/read/AMUSEMENTPARK #include <iostream> #include <map> #include <cmath> #include <vector> using namespace std; int row, col; int in[22][22] = {0, }; map<int, pair<int, int>> m; vector<int> out; bool cc(int r, int b, int d) { for (int i = b + 1; i < d; i++) { if (in[r][i] != 0) return false; } return true; } bool rr(int C, int a, int c) { for (int i = a + 1; i < c; i++) { if (in[i][C] != 0) return false; } return true; } int gcd(int a, int b) { return (a % b == 0) ? b : gcd(b, a % b); } bool ok(int me, int to) { auto a = m[me].first; auto b = m[me].second; auto c = m[to].first; auto d = m[to].second; if (a == c) { return cc(a, min(b, d), max(b, d)); } if (b == d) { return rr(b, min(a, c), max(a, c)); } int dr = (c-a); int dc = (d-b); if (abs(dr) == 1 || abs(dc) == 1) return true; else { int g = gcd((int)abs(dr), (int)abs(dc)); dr = dr / g; dc = dc / g; int rr = a + dr; int cc = b + dc; while (rr != c) { if (in[rr][cc] != 0) return false; rr += dr; cc += dc; } return true; } } int main() { int to; cin >> row >> col >> to; for (int r = 1; r <= row; r++) { for (int c = 1; c <= col; c++) { cin >> in[r][c]; if (in[r][c] != 0) { m[in[r][c]] = make_pair(r, c); } } } int me(1); int maxi = in[row][col]; while (to <= maxi) { if (ok(me, to)) out.push_back(me); me++; to++; } cout << out.size() << endl; for (int x : out) cout << x << endl; return 0; }
21.073171
56
0.426505
seirion
76699ec84d06adcf4e4cf2a202e1ff8009f50b31
2,114
hxx
C++
main/toolkit/workben/layout/recover.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/toolkit/workben/layout/recover.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/toolkit/workben/layout/recover.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #ifndef _SVX_RECOVER_HXX #define _SVX_RECOVER_HXX #include <layout/layout.hxx> #include <vcl/button.hxx> #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <layout/core/box.hxx> #include <layout/layout-pre.hxx> class SvxRecoverDialog : public SfxModalDialog { private: FixedImage aHeaderImage; FixedText aHeaderText; FixedLine aHeaderLine; FixedText aRecoverText; FixedText aTextAdvanced; CheckBox aCheckBoxDoc; FixedImage aImageDoc; FixedText aTextDoc; CheckBox aCheckBoxSheet; FixedImage aImageSheet; FixedText aTextSheet; CheckBox aCheckBoxDraw; FixedImage aImageDraw; FixedText aTextDraw; CheckBox aCheckBoxPresent; FixedImage aImagePresent; FixedText aTextPresent; AdvancedButton aButtonAdvanced; FixedText aProgressText; ProgressBar aProgressBar; CheckBox aCheckBoxLogFile; OKButton aOKBtn; CancelButton aCancelBtn; HelpButton aHelpBtn; public: #if TEST_LAYOUT SvxRecoverDialog( Window* pParent ); #else /* !TEST_LAYOUT */ SvxRecoverDialog( Window* pParent, const SfxItemSet& rCoreSet ); #endif /* !TEST_LAYOUT */ ~SvxRecoverDialog(); }; #include <layout/layout-post.hxx> #endif
27.815789
65
0.711447
Grosskopf
766af497af3c56d266e5d66c9ef41de8f7615f7e
10,973
hpp
C++
src/ros2_examples_headers/include/ros2_examples_headers/signal_handler/signal_handler.hpp
IntelligentSystemsLabUTV/ros2_examples
b34d9238d680dd6b06177586f81bfed0bae31eb2
[ "MIT" ]
null
null
null
src/ros2_examples_headers/include/ros2_examples_headers/signal_handler/signal_handler.hpp
IntelligentSystemsLabUTV/ros2_examples
b34d9238d680dd6b06177586f81bfed0bae31eb2
[ "MIT" ]
null
null
null
src/ros2_examples_headers/include/ros2_examples_headers/signal_handler/signal_handler.hpp
IntelligentSystemsLabUTV/ros2_examples
b34d9238d680dd6b06177586f81bfed0bae31eb2
[ "MIT" ]
null
null
null
/** * ROS 2-compliant signal handler. * * Roberto Masocco <robmasocco@gmail.com> * * January 17, 2022 */ #ifndef SIGNAL_HANDLER_HPP #define SIGNAL_HANDLER_HPP #include <thread> #include <mutex> #include <atomic> #include <semaphore.h> #include <stdexcept> #include <vector> #include <algorithm> #include <unistd.h> #include <rclcpp/rclcpp.hpp> namespace ROS2SignalHandler { /** * Global singleton signal handler object. */ class SignalHandler final { public: /** * @brief Returns the global singleton instance. * * @return Global signal handler object. */ static SignalHandler & get_global_signal_handler() { static SignalHandler instance; return instance; } /** * @brief Initializes the signal handler data. * * @param context rclcpp::Context to operate on. * @param logger_name Name to be visualized in rclcpp log prints. * @param deferred_handler Signal handler to be called alongside main thread. * @param system_handler System signal handler to be called while tracing. * * @throws InvalidArgument */ void init( std::shared_ptr<rclcpp::Context> context, std::string && logger_name = std::string("signal_handler"), std::function<void(int, std::string &)> && deferred_handler = nullptr, std::function<void(int, siginfo_t *, void *)> && system_handler = nullptr ) { // Check if provided context is valid if (!context) { throw std::invalid_argument("SignalHandler::init: context cannot be null"); } // Acquire installation lock std::scoped_lock<std::mutex> init_lock(install_lock_); // Check if signal handler is currently valid if (valid_) { throw std::runtime_error("SignalHandler::init: called on valid object"); } // Initialize semaphores if (sem_init(&sig_prod_, 0, 0) || sem_init(&sig_cons_, 0, 1)) { std::perror("sem_init"); throw std::runtime_error("SignalHandler::init: failed to initialize sempahores"); } // Initialize pointers context_ = context; deferred_handler_ = deferred_handler; system_handler_ = system_handler; // Initialize rclcpp logger name logger_name_ = logger_name; // Initialize local signal value sig_ = 0; // Initialize validity flag (this also acts as a barrier, validating data above) valid_.store(true, std::memory_order_release); // Initialize handler thread handler_thread_ = std::thread( [this]() -> void { this->handler_thread_routine(); }); } /** * @brief Installs the signal handler for a given signal. * * @param int Signal code. * * @throws RuntimeError */ void install(int sig) { // Prepare sigaction struct sigaction new_act; if (sigfillset(&(new_act.sa_mask))) { std::perror("sigfillset"); throw std::runtime_error("SignalHandler::install: failed to set blocked signals mask"); } new_act.sa_flags = SA_SIGINFO; new_act.sa_sigaction = &this->common_handler; // Acquire installation lock std::scoped_lock<std::mutex> install_lock(install_lock_); // Install handler if (sigaction(sig, &new_act, NULL)) { std::perror("sigaction"); throw std::runtime_error( "SignalHandler::install: failed to install handler for signal (" + std::to_string(sig) + ")" ); } // Add signal to installed list installed_.push_back(sig); RCLCPP_INFO( rclcpp::get_logger(logger_name_), "Installed handler for signal (%d)", sig ); } /** * @brief Uninstalls the signal handler for a given signal. * * @param int Signal code. * * @throws RuntimeError */ void uninstall(int sig) { uninstall_(sig); } /** * @brief Sets the "ignore" flag for a given signal. * * @param int Signal code. * * @throws RuntimeError */ void ignore(int sig) { // Prepare sigaction struct sigaction new_act; if (sigemptyset(&(new_act.sa_mask))) { std::perror("sigfillset"); throw std::runtime_error("SignalHandler::ignore: failed to set blocked signals mask"); } new_act.sa_flags = 0; new_act.sa_handler = SIG_IGN; // Acquire installation lock std::scoped_lock<std::mutex> ignore_lock(install_lock_); // Install ignore handler if (sigaction(sig, &new_act, NULL)) { std::perror("sigaction"); throw std::runtime_error( "SignalHandler::ignore: failed to install handler for signal (" + std::to_string(sig) + ")" ); } // Add signal to installed list installed_.push_back(sig); RCLCPP_INFO( rclcpp::get_logger(logger_name_), "Ignoring signal (%d)", sig ); } /** * @brief Reinitializes this signal handler. * * @throws RuntimeError */ void fini() { // Acquire installation lock std::scoped_lock<std::mutex> fini_lock(install_lock_); // Check if signal handler is currently valid if (!valid_) { throw std::runtime_error("SignalHandler::fini: called on invalid object"); } // Remove all installed handlers std::vector<int> installed_local = installed_; for (auto sig : installed_local) { uninstall_(sig, true); } // Reset validity flag valid_ = false; // Terminate and join handler thread sem_wait_(&sig_cons_); sig_ = -1; sem_post_(&sig_prod_); handler_thread_.join(); // Erase pointers context_.reset(); deferred_handler_ = nullptr; system_handler_ = nullptr; // Erase logger name logger_name_ = std::string(""); // Destroy semaphores if (sem_destroy(&sig_prod_) || sem_destroy(&sig_cons_)) { std::perror("sem_destroy"); throw std::runtime_error("SignalHandler::fini: failed to destroy semaphores"); } // Erase local signal value sig_ = 0; } /* Singleton: no copy constructor. */ SignalHandler(SignalHandler &&) = delete; /* Singleton: no move assignment operator. */ void operator=(SignalHandler &&) = delete; private: /* Singleton: private constructor. */ SignalHandler() {} /* Internal rclcpp logger name. */ std::string logger_name_; /* Pointer to context to operate on. */ std::shared_ptr<rclcpp::Context> context_ = nullptr; /* Deferred signal handler. */ std::function<void(int, std::string &)> deferred_handler_ = nullptr; /* System signal handler. */ inline static std::function<void(int, siginfo_t *, void *)> system_handler_ = nullptr; /* Internal handler status flag. */ inline static std::atomic_bool valid_ = false; /* Signal handler object installation mutex. */ inline static std::mutex install_lock_; /* Delivered signal, also used to notify termination. */ inline static int sig_ = 0; /* Delivered signal PRODUCED semaphore. */ inline static sem_t sig_prod_; /* Delivered signal CONSUMED semaphore. */ inline static sem_t sig_cons_; /* List of traced signals. */ std::vector<int> installed_{}; /* Signal handler thread. */ std::thread handler_thread_; /** * @brief Wraps the call to sem_post. * * @throws RuntimeError */ static void sem_post_(sem_t * sem) { if (sem_post(sem)) { std::perror("sem_post"); throw std::runtime_error("SignalHandler::sem_post_: failed to post semaphore"); } } /** * @brief Wraps the call to sem_wait. * * @throws RuntimeError */ static void sem_wait_(sem_t * sem) { if (sem_wait(sem)) { std::perror("sem_wait"); throw std::runtime_error("SignalHandler::sem_wait_: failed to wait sempahore"); } } /** * @brief Uninstalls the signal handler for a given signal. * * @param int Signal code. * @param has_lock Marks lock acquisition. * * @throws RuntimeError */ void uninstall_(int sig, bool has_lock = false) { // Prepare sigaction struct sigaction new_act; if (sigemptyset(&(new_act.sa_mask))) { std::perror("sigfillset"); throw std::runtime_error("SignalHandler::uninstall_: failed to set blocked signals mask"); } new_act.sa_flags = 0; new_act.sa_handler = SIG_DFL; // Acquire installation lock if (!has_lock) { install_lock_.lock(); } // Check if signal handler has been installed before if (std::find(installed_.begin(), installed_.end(), sig) == installed_.end()) { throw std::runtime_error("SignalHandler::uninstall_: signal handler wasn't installed"); } // Install default handler if (sigaction(sig, &new_act, NULL)) { std::perror("sigaction"); throw std::runtime_error( "SignalHandler::uninstall_: failed to install handler for signal (" + std::to_string(sig) + ")" ); } // Remove signal from installed list installed_.erase(std::remove(installed_.begin(), installed_.end(), sig), installed_.end()); RCLCPP_INFO( rclcpp::get_logger(logger_name_), "Uninstalled handler for signal (%d)", sig ); // Release installation lock if (!has_lock) { install_lock_.unlock(); } } /** * @brief Signal handler thread routine. */ void handler_thread_routine() { int local_sig; RCLCPP_INFO(rclcpp::get_logger(logger_name_), "Signal handler started"); while (true) { // Wait for external wakeup call sem_wait_(&sig_prod_); local_sig = sig_; sem_post_(&sig_cons_); // Check if termination is due if (local_sig == -1) { RCLCPP_INFO(rclcpp::get_logger(logger_name_), "Signal handler terminated"); return; } RCLCPP_INFO(rclcpp::get_logger(logger_name_), "Got signal (%d)", local_sig); // Call custom handler, if present if (deferred_handler_) { deferred_handler_(local_sig, logger_name_); } // Shut down context if requested if (context_->is_valid() && context_->get_init_options().shutdown_on_sigint) { RCLCPP_WARN(rclcpp::get_logger(logger_name_), "Shutting down context"); context_->shutdown("signal (" + std::to_string(sig_) + ")"); } } } /** * @brief Common signal handler installed for all signals. * * @param sig Traced signal. * @param info Additional trace information. * @param ucontext Additional context information provided by the kernel. */ static void common_handler(int sig, siginfo_t * info, void * ucontext) { // Acquire signal handler lock std::scoped_lock<std::mutex> common_handler_lock(install_lock_); // Call system handler, if present, bypassing the rest of the system if (system_handler_) { system_handler_(sig, info, ucontext); } // Check if signal handler is currently valid if (!valid_) { return; } // Notify handler thread sem_wait_(&sig_cons_); sig_ = sig; sem_post_(&sig_prod_); } }; // class SignalHandler } // namespace ROS2SignalHandler #endif
25.578089
96
0.646678
IntelligentSystemsLabUTV
7671264799bb22fb7423ad236f3efe3c750e049c
1,010
cc
C++
src/MyPrimaryGeneratorAction.cc
wangshishe/RutherfordScattering
ccc4353501ad7ca4fcc78bf5e4805a358bdaa3ce
[ "MIT" ]
null
null
null
src/MyPrimaryGeneratorAction.cc
wangshishe/RutherfordScattering
ccc4353501ad7ca4fcc78bf5e4805a358bdaa3ce
[ "MIT" ]
null
null
null
src/MyPrimaryGeneratorAction.cc
wangshishe/RutherfordScattering
ccc4353501ad7ca4fcc78bf5e4805a358bdaa3ce
[ "MIT" ]
1
2022-03-15T04:52:09.000Z
2022-03-15T04:52:09.000Z
#include "MyPrimaryGeneratorAction.hh" MyPrimaryGeneratorAction::MyPrimaryGeneratorAction() { G4int nParticle = 1; fParticleGun = new G4ParticleGun(nParticle); auto *particleTable = G4ParticleTable::GetParticleTable(); G4String particleName = "alpha"; G4ParticleDefinition *particle = particleTable->FindParticle(particleName); G4ThreeVector momentumDirection(-1., 0., 0.); G4double energy = 5. * MeV; fParticleGun->SetParticleDefinition(particle); fParticleGun->SetParticleMomentumDirection(momentumDirection); fParticleGun->SetParticleEnergy(energy); } MyPrimaryGeneratorAction::~MyPrimaryGeneratorAction() { delete fParticleGun; } void MyPrimaryGeneratorAction::GeneratePrimaries(G4Event *anEvent) { G4double gunPositionX = 1 * m - 1 * mm; G4double gunPositionYZ = 1 * mm * (G4UniformRand() - 0.5); fParticleGun->SetParticlePosition(G4ThreeVector(gunPositionX, gunPositionYZ, gunPositionYZ)); fParticleGun->GeneratePrimaryVertex(anEvent); }
31.5625
97
0.758416
wangshishe
7673ca365447584d996d5c88b643c3447a95671f
2,885
cpp
C++
controller/strformats.cpp
bartek56/quetzalcoatl
dc60dbed6e1e9de7b3318d26a6ef65a47a59120c
[ "MIT" ]
5
2015-06-10T07:47:19.000Z
2021-04-03T21:26:49.000Z
controller/strformats.cpp
bartek56/quetzalcoatl
dc60dbed6e1e9de7b3318d26a6ef65a47a59120c
[ "MIT" ]
1
2020-07-22T13:57:56.000Z
2020-08-07T00:03:44.000Z
controller/strformats.cpp
duganchen/quetzalcoatl2
6e7f1ef8f4b2eaf698cc86f4308039afc8df7b44
[ "MIT" ]
1
2022-01-11T16:02:41.000Z
2022-01-11T16:02:41.000Z
#include "strformats.h" #include <QStringBuilder> #include <QStringList> QString timeStr(unsigned duration) { // Can't remember where I got this time format from. It might have been Foobar2000. unsigned seconds = duration % 60; unsigned minutes = duration % 3600 / 60; unsigned hours = duration / 3600; // For the string formatting: // Re: https://stackoverflow.com/a/2618444/240515 if (!hours && !minutes) { return QStringLiteral("0:%1").arg(seconds, 2, 10, QLatin1Char('0')); } if (!hours) { return QStringLiteral("%1:%2").arg(QString::number(minutes), leftPad(seconds)); } return QStringLiteral("%1:%2:%3").arg(QString::number(hours), leftPad(minutes), leftPad(seconds)); } QString leftPad(unsigned i) { // Left-zero-pad to two digits. return QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')); } QString songLabel(const mpd_song *song) { if (!song) { return QString(); } const char *title = mpd_song_get_tag(song, MPD_TAG_TITLE, 0); if (!title) { // You're supposed to have a title. This is just a fallback to let you know to fix the tags. title = mpd_song_get_uri(song); } return title; } QString songEntityLabel(mpd_entity *entity) { if (!entity) { return QString(); } if (mpd_entity_get_type(entity) != MPD_ENTITY_TYPE_SONG) { return QString(); } auto song = mpd_entity_get_song(entity); return songLabel(song); } QString dirEntryLabel(mpd_entity *entity) { if (!entity) { return QString(); } if (mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_DIRECTORY) { return mpd_directory_get_path(mpd_entity_get_directory(entity)); } return songEntityLabel(entity); } QString songToolTip(const mpd_song *song) { if (!song) { return QString(); } QStringList metadata; QVector<mpd_tag_type> tagTypes{MPD_TAG_TITLE, MPD_TAG_TRACK, MPD_TAG_ALBUM, MPD_TAG_DISC, MPD_TAG_ARTIST, MPD_TAG_ALBUM_ARTIST, MPD_TAG_COMPOSER, MPD_TAG_GENRE}; QString tagValue; QString tagName; for (auto tagType : tagTypes) { tagValue = mpd_song_get_tag(song, tagType, 0); if (tagValue.isEmpty()) { continue; } QString tagName = mpd_tag_name(tagType); metadata.append(tagName % ": " % tagValue); } return metadata.join("\n"); } QString songDuration(const mpd_song *song) { unsigned duration = mpd_song_get_duration(song); if (!duration) { // I have not personally encountered this. return "0:00"; } return timeStr(duration); }
24.65812
102
0.591334
bartek56
767546e1c60ef9bcddd19d949b21fbcab8a6e620
920
cpp
C++
vnoj/thmst.cpp
tiozo/Training
02cc8c4fcf68e07c16520fd05fcbfa524c171b6b
[ "MIT" ]
1
2021-08-28T04:16:34.000Z
2021-08-28T04:16:34.000Z
vnoj/thmst.cpp
tiozo/Training
02cc8c4fcf68e07c16520fd05fcbfa524c171b6b
[ "MIT" ]
null
null
null
vnoj/thmst.cpp
tiozo/Training
02cc8c4fcf68e07c16520fd05fcbfa524c171b6b
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; long long giaithua(int n) { int giai_thua = 1; for (int i = 1; i <= n; i++) giai_thua *= i; return giai_thua; } int main() { int N; cin >> N; long long res = 0,largest = 0; for (int i=1;i<N;++i) { long long x,y,z; cin >> x >> y >> z; res += z; largest = max(largest,z); } if (N>2) { long long a,b; a = N-1,b=N-2; a = giaithua(a)/(giaithua(2)*giaithua(a-2)); b = giaithua(b)/(giaithua(2)*giaithua(b-2)); res+=(largest+1)*(a-b)+largest*b; --N; while (N-2>2 || N-1>2) { a = N-1,b=N-2; a = giaithua(a)/(giaithua(2)*giaithua(a-2)); b = giaithua(b)/(giaithua(2)*giaithua(b-2)); res+=(largest+1)*(a-b)+largest*b; --N; } cout << res; } else cout << res; return 0; }
23.589744
56
0.444565
tiozo
76858b68fc441244110a83d05e89f5ff39d24686
3,991
cpp
C++
RipleyK.cpp
lsaravia/SpatialAnalysis
899148a65407dc8807475a923b4a231984441301
[ "Unlicense", "MIT" ]
null
null
null
RipleyK.cpp
lsaravia/SpatialAnalysis
899148a65407dc8807475a923b4a231984441301
[ "Unlicense", "MIT" ]
null
null
null
RipleyK.cpp
lsaravia/SpatialAnalysis
899148a65407dc8807475a923b4a231984441301
[ "Unlicense", "MIT" ]
null
null
null
#include "RipleyK.h" void RipleyK(char * outfile, simplmat <float>& ftr, int numAnn, float widAnn, int treeDensity, int xDist, int yDist ) { simplmat <float> ripknl(100); simplmat <float> pairs(100); simplmat <float> kripley(100); simplmat <float> lripley(100); simplmat <float> ce95(100); simplmat <float> l_d(100); simplmat <float> pdf(100); simplmat <float> frank(100); simplmat <float> kfrank(100); simplmat <float> lfrank(100); // cout << "Ripley's K for run #" << run << "Tree density of " << treeDensity << endl; float searchDist = numAnn * widAnn; const int xCoor = 0; const int yCoor = 1; ripknl.fill(0.0); frank.fill(0.0); kfrank.fill(0.0); l_d.fill(0.0); ce95.fill(0.0); pdf.fill(0.0); float dist=0; int distpt=0; int foc,tar; for(foc=0; foc<treeDensity; foc++) { int fx = ftr(foc,xCoor); int fy = ftr(foc,yCoor); int focb1=0,focb2=0; // Determine distance from point FOC to nearest 2 boundaries // focBound(focb1,focb2,fx,fy,xDist,yDist); for(tar=0; tar<treeDensity; tar++) { if(tar!=foc) { int tx=ftr(tar,xCoor); int ty=ftr(tar,yCoor); int xDiff = abs(tx-fx); int yDiff = abs(ty-fy); if( xDiff <= searchDist && yDiff <= searchDist ) { dist = sqrt(xDiff*xDiff + yDiff*yDiff ); distpt = int(dist/widAnn) + 1; if(distpt <= numAnn) { double wij=0; if( dist<=focb1) // No adjustement wij=1; else { double arccos1=0,arccos2=0; double x1=0,x2=0; if( (dist*dist) <= (focb1*focb1+focb2*focb2) ) // 1-border adjustement { x1 = focb1/dist; arccos1 = Pi/2 - atan(x1/sqrt(1-x1*x1)); wij = 1 / (1 - arccos1/Pi); } else { x1 = focb1/dist; x2 = focb2/dist; arccos1 = Pi/2 - atan(x1/sqrt(1-x1*x1)); arccos2 = Pi/2 - atan(x2/sqrt(1-x2*x2)); wij = 1 / (1 - (arccos1+arccos2+Pi/2)/(2*Pi)); } } if( wij < 1 ) cerr << "Error"; if( wij > 4 ) wij = 4; ripknl(distpt) += wij; double c1 = (4/3/Pi)*(dist/xDist + dist/yDist); double c2 = ((11/3/Pi) - 1 )*(dist*dist/(yDist*xDist)); double fc1c2 = 1 - c1-c2; if( fc1c2 < 0 ) { cerr << "Bogus fc1c2 of " << fc1c2 << endl; exit(1); } frank(distpt) += fc1c2; } } } } // next tar } // next foc double area = xDist*yDist; double areaDens = area/(treeDensity*(treeDensity-1)); int ppp=0; for(distpt=0;distpt<numAnn; distpt++) { for(ppp=0; ppp<distpt; ppp++) { kripley(distpt) += ripknl(ppp); kfrank(distpt) += frank(ppp); } kripley(distpt) = areaDens * kripley(distpt); kfrank(distpt) = areaDens * kfrank(distpt); } int ddd; for(ddd=0; ddd<numAnn; ddd++) { lripley(ddd) = sqrt(kripley(ddd)/Pi); lfrank(ddd) = sqrt(kfrank(ddd)/Pi); double d = ddd*widAnn; double c1 = (4/(3*Pi))*(d/xDist + d/yDist); double c2 = (4- 35/(3*Pi))*(d*d/area); double corr = 1-c1-c2; ce95(ddd) = 1.95*sqrt(areaDens/(2*Pi*corr)); l_d(ddd) = lripley(ddd) - d; if( ddd>0 ) pdf(ddd) = lripley(ddd) - lripley(ddd-1) - widAnn; } cout << " Tree density was" << treeDensity << endl; for(ddd=0; ddd<numAnn; ddd++) { // cout << head << ddd*widAnn << l_d(ddd) << endl; cout << ddd*widAnn << "\t" << lripley(ddd) << "\t" << l_d(ddd) << "\t" << ce95(ddd); if( fabs(l_d(ddd)) >= ce95(ddd)) cout << "\t*"; else cout << "\t"; cout << "\t" << pdf(ddd) << endl; } } void focBound(int & focb1, int & focb2, int fx, int fy, int xDist, int yDist) { // Nearest boundary distance focb1 = min(min(fx,xDist-fx), min(fy, yDist-fy)); // Second closest boundary if( focb1 == fx || focb1 == xDist-fx) focb2 = min(fy, yDist-fy); else focb2 = min(fx, xDist-fx); }
24.94375
118
0.532448
lsaravia
768a3b303b0142b532a7689994c0a4a824c3464c
3,823
cpp
C++
test/Rational/main.cpp
Enseed/GenericMath
d54ae97ddaaeb25842371f16f9889a05dac6754d
[ "Apache-2.0" ]
null
null
null
test/Rational/main.cpp
Enseed/GenericMath
d54ae97ddaaeb25842371f16f9889a05dac6754d
[ "Apache-2.0" ]
null
null
null
test/Rational/main.cpp
Enseed/GenericMath
d54ae97ddaaeb25842371f16f9889a05dac6754d
[ "Apache-2.0" ]
null
null
null
/******************************************************************************* Copyright 2008 Enseed inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Author: Gaspard Petit *******************************************************************************/ #include <Generic/Math/Rational.h> #include <iostream> using namespace std; ostream& operator << (ostream& os, const Rational &r) { os << r.numerator() << '/' << r.denominator(); return os; } int main(int argc, const char *argv[]) { /*************************************************************************** * Today, we test the Rational object. * * The Rational object represends a number as A/B. A is the numerator * while B is the denominator. This is convenient, because you can * keep exact representation of numbers that cannot be correctly * represented as floats or doubles (for example, 1/3). * **************************************************************************/ /*************************************************************************** * INITIALISATION * * A Rational object can be initialized in two ways: */ Rational rat1(1, 2); // 1/2 Rational rat2 = Rational::fromFloat(0.75); /* * Great, now we have two rationals, let's see what they are: */ cout << "rat1 = " << rat1 << endl; cout << "rat2 = " << rat2 << endl; /* * You can also express them as floats if you prefer... */ cout << "rat1 = " << rat1.toFloat() << endl; cout << "rat2 = " << rat2.toFloat() << endl; /* * ... or as doubles */ cout << "rat1 = " << rat1.toDouble() << endl; cout << "rat2 = " << rat2.toDouble() << endl; /* * You have to be careful with the Rational::fromFloat function - some * numbers, though very simple in base 10, cannot be expressed correctly * in base 2. For example: */ Rational rat3 = Rational::fromFloat(1.9); cout << "this is nasty: 1.9 = " << rat3 << " = " << rat3.toDouble() << endl; /* * You can also do all kinds of operations with rationals: */ cout << rat1 << " + " << rat2 << " = " << rat1 + rat2 << endl; cout << rat1 << " - " << rat2 << " = " << rat1 - rat2 << endl; cout << rat1 << " * " << rat2 << " = " << rat1 * rat2 << endl; cout << rat1 << " / " << rat2 << " = " << rat1 / rat2 << endl; cout << rat1 << " + " << "3" << " = " << rat1 + 3 << endl; cout << rat1 << " - " << "3" << " = " << rat1 - 3 << endl; cout << rat1 << " * " << "3" << " = " << rat1 * 3 << endl; cout << rat1 << " / " << "3" << " = " << rat1 / 3 << endl; cout << "3" << " + " << rat1 << " = " << 3 + rat1 << endl; cout << "3" << " - " << rat1 << " = " << 3 - rat1 << endl; cout << "3" << " * " << rat1 << " = " << 3 * rat1 << endl; cout << "3" << " / " << rat1 << " = " << 3 / rat1 << endl; cout << "~" << rat1 << " = " << ~rat1 << endl; return 0; }
35.073394
80
0.542506
Enseed
768b1e397ac35290164c077a55ca2a16397fb23a
4,551
cpp
C++
src/hybrid_window.cpp
edublancas/dplyr
3ace34bf8eaec8295d5a7f09ab19947ced3438cd
[ "MIT" ]
1
2020-10-19T20:04:09.000Z
2020-10-19T20:04:09.000Z
src/hybrid_window.cpp
edublancas/dplyr
3ace34bf8eaec8295d5a7f09ab19947ced3438cd
[ "MIT" ]
null
null
null
src/hybrid_window.cpp
edublancas/dplyr
3ace34bf8eaec8295d5a7f09ab19947ced3438cd
[ "MIT" ]
1
2020-10-20T17:53:42.000Z
2020-10-20T17:53:42.000Z
#include "pch.h" #include <dplyr/main.h> #include <dplyr/HybridHandlerMap.h> #include <dplyr/Result/ILazySubsets.h> #include <dplyr/Result/Rank.h> using namespace Rcpp; using namespace dplyr; namespace dplyr { template <bool ascending> Result* row_number_asc(const RObject& data) { switch (TYPEOF(data)) { case INTSXP: return new RowNumber<INTSXP, ascending>(data); case REALSXP: return new RowNumber<REALSXP, ascending>(data); case STRSXP: return new RowNumber<STRSXP, ascending>(data); default: return 0; } } Result* row_number(const RObject& data, const bool ascending) { if (ascending) { return row_number_asc<true>(data); } else { return row_number_asc<false>(data); } } Result* row_number_prototype(SEXP call, const ILazySubsets& subsets, int nargs) { if (nargs > 1 || subsets.size() == 0) return 0; if (nargs == 0) return new RowNumber_0(); RObject data(CADR(call)); bool ascending = true; if (TYPEOF(data) == LANGSXP && CAR(data) == Rf_install("desc")) { data = CADR(data); ascending = false; } if (TYPEOF(data) == SYMSXP) { SymbolString name = SymbolString(Symbol(data)); if (subsets.has_non_summary_variable(name)) data = subsets.get_variable(name); else return 0; } if (subsets.nrows() != Rf_length(data)) return 0; return row_number(data, ascending); } template <bool ascending> Result* ntile_asc(const RObject& data, const int number_tiles) { switch (TYPEOF(data)) { case INTSXP: return new Ntile<INTSXP, ascending>(data, number_tiles); case REALSXP: return new Ntile<REALSXP, ascending>(data, number_tiles); case STRSXP: return new Ntile<STRSXP, ascending>(data, number_tiles); default: return 0; } } Result* ntile(const RObject& data, const int number_tiles, const bool ascending) { if (ascending) { return ntile_asc<true>(data, number_tiles); } else { return ntile_asc<false>(data, number_tiles); } } Result* ntile_prototype(SEXP call, const ILazySubsets& subsets, int nargs) { if (nargs != 2) return 0; // handle 2nd arg SEXP ntiles = maybe_rhs(CADDR(call)); if (TYPEOF(ntiles) != INTSXP && TYPEOF(ntiles) != REALSXP) return 0; int number_tiles = as<int>(ntiles); if (number_tiles == NA_INTEGER) return 0; RObject data(maybe_rhs(CADR(call))); bool ascending = true; if (TYPEOF(data) == LANGSXP && CAR(data) == Rf_install("desc")) { data = CADR(data); ascending = false; } if (TYPEOF(data) == SYMSXP) { SymbolString name = SymbolString(Symbol(data)); if (subsets.has_non_summary_variable(name)) data = subsets.get_variable(name); else return 0; } if (subsets.nrows() != Rf_length(data)) return 0; return ntile(data, number_tiles, ascending); } template <typename Increment, bool ascending> Result* rank_asc(const RObject& data) { switch (TYPEOF(data)) { case INTSXP: return new Rank_Impl<INTSXP, Increment, ascending>(data); case REALSXP: return new Rank_Impl<REALSXP, Increment, ascending>(data); case STRSXP: return new Rank_Impl<STRSXP, Increment, ascending>(data); default: return 0; } } template <typename Increment> Result* rank(const RObject& data, bool ascending) { if (ascending) { return rank_asc<Increment, true>(data); } else { return rank_asc<Increment, false>(data); } } template <typename Increment> Result* rank_impl_prototype(SEXP call, const ILazySubsets& subsets, int nargs) { if (nargs != 1) return 0; RObject data(maybe_rhs(CADR(call))); bool ascending = true; if (TYPEOF(data) == LANGSXP && CAR(data) == Rf_install("desc")) { data = maybe_rhs(CADR(data)); ascending = false; } if (TYPEOF(data) == SYMSXP) { SymbolString name = SymbolString(Symbol(data)); if (subsets.has_non_summary_variable(name)) data = subsets.get_variable(name); else return 0; } if (subsets.nrows() != Rf_length(data)) return 0; return rank<Increment>(data, ascending); } } void install_window_handlers(HybridHandlerMap& handlers) { handlers[ Rf_install("row_number") ] = row_number_prototype; handlers[ Rf_install("ntile") ] = ntile_prototype; handlers[ Rf_install("min_rank") ] = rank_impl_prototype<dplyr::internal::min_rank_increment>; handlers[ Rf_install("percent_rank") ] = rank_impl_prototype<dplyr::internal::percent_rank_increment>; handlers[ Rf_install("dense_rank") ] = rank_impl_prototype<dplyr::internal::dense_rank_increment>; handlers[ Rf_install("cume_dist") ] = rank_impl_prototype<dplyr::internal::cume_dist_increment>; }
27.251497
104
0.69633
edublancas
768e478fa735981b2461749a5a1f9c3fcf7c727f
8,437
cpp
C++
src/app.cpp
PENGUINLIONG/AutoExposure
d31771437f7cc423a111d8970fa6ecf9aaf2f722
[ "Apache-2.0", "MIT" ]
null
null
null
src/app.cpp
PENGUINLIONG/AutoExposure
d31771437f7cc423a111d8970fa6ecf9aaf2f722
[ "Apache-2.0", "MIT" ]
null
null
null
src/app.cpp
PENGUINLIONG/AutoExposure
d31771437f7cc423a111d8970fa6ecf9aaf2f722
[ "Apache-2.0", "MIT" ]
null
null
null
#include "gft/log.hpp" #include "gft/args.hpp" #include "gft/vk.hpp" #include "gft/glslang.hpp" using namespace liong; using namespace vk; static const char* APP_NAME = "AutoExposure"; static const char* APP_DESC = "Implementation of various AutoExposure algorithms."; struct AppConfig { bool verbose = false; } CFG; scoped::Context CTXT {}; void initialize(int argc, const char** argv) { args::init_arg_parse(APP_NAME, APP_DESC); args::reg_arg<args::SwitchParser>("-v", "--verbose", CFG.verbose, "Produce extra amount of logs for debugging."); args::parse_args(argc, argv); extern void log_cb(log::LogLevel lv, const std::string& msg); log::set_log_callback(log_cb); log::LogLevel level = CFG.verbose ? log::LogLevel::L_LOG_LEVEL_DEBUG : log::LogLevel::L_LOG_LEVEL_INFO; log::set_log_filter_level(level); CTXT = scoped::Context(create_ctxt(ContextConfig { "CTXT", 0 }), false); } void finalize() { CTXT = {}; } void fill(const scoped::Image& img, const std::vector<vmath::float4>& data) { static const char* comp_src = R"( #version 460 layout(local_size_x_id=0, local_size_y_id=1, local_size_z_id=2) in; layout(binding=0, rgba16f) writeonly uniform image2D out_img; layout(binding=1) readonly buffer Data { vec4 data[]; }; void main() { uvec3 global_id = gl_GlobalInvocationID; ivec2 out_img_size = imageSize(out_img); if (global_id.x > out_img_size.x || global_id.y > out_img_size.y) return; vec4 c = data[global_id.y * out_img_size.x + global_id.x]; imageStore(out_img, ivec2(global_id.xy), c); } )"; static glslang::ComputeSpirvArtifact art = glslang::compile_comp(comp_src, "main"); static scoped::Task task = CTXT.build_comp_task("fill") .comp(art.comp_spv) .rsc(L_RESOURCE_TYPE_STORAGE_IMAGE) .rsc(L_RESOURCE_TYPE_STORAGE_BUFFER) .workgrp_size(8, 8, 1) .build(); auto data_buf = CTXT.build_buf() .streaming_with(data) .storage() .build(); task.build_comp_invoke() .rsc(img.view()) .rsc(data_buf.view()) .workgrp_count(util::div_up(img.cfg().width, 8), util::div_up(img.cfg().height, 8), 1) .build() .submit() .wait(); } float avg_cpu( const std::vector<vmath::float4>& data, uint32_t width, uint32_t height ) { float sum = 0.0f; for (uint32_t w = 0; w < width; ++w) { for (uint32_t h = 0; h < height; ++h) { vmath::float4 c = data[h * width + w]; sum += 0.2126f * c.x + 0.7152 * c.y + 0.0722 * c.z; } } return sum / (width * height); } float avg_gpu( const std::vector<vmath::float4>& data, uint32_t width, uint32_t height ) { static const char* comp_src = R"( #version 460 layout(local_size_x=8, local_size_y=8, local_size_z=1) in; layout(binding=0) uniform Params { uvec2 size; } u; layout(binding=1, r32f) writeonly uniform image3D out_img; layout(binding=2) uniform sampler2D img; mediump float luminance(mediump vec3 c) { return 0.2126 * c.x + 0.7152 * c.y + 0.0722 * c.z; } shared float[64] stage_sum; void main() { uvec3 global_id = gl_GlobalInvocationID; uvec3 workgrp_id = gl_WorkGroupID; uvec3 local_id = gl_LocalInvocationID; uint local_idx = gl_LocalInvocationIndex; uint W = u.size.x; uint H = u.size.y; vec2 size_coe = 1.0f / vec2(W, H); mediump vec3 sum = vec3(0.0f, 0.0f, 0.0f); for (uint w = (global_id.z * 16 + global_id.x) * 4; w < W; w += 128) { for (uint h = global_id.y * 4; h < H; h += 64) { mediump vec3 c0 = texture(img, vec2(w + 1.0, h + 1.0) * size_coe).rgb; mediump vec3 c1 = texture(img, vec2(w + 3.0, h + 1.0) * size_coe).rgb; mediump vec3 c2 = texture(img, vec2(w + 1.0, h + 3.0) * size_coe).rgb; mediump vec3 c3 = texture(img, vec2(w + 3.0, h + 3.0) * size_coe).rgb; sum += 4.0f * c0; sum += 4.0f * c1; sum += 4.0f * c2; sum += 4.0f * c3; } } stage_sum[local_idx] = luminance(sum.rgb); memoryBarrierShared(); barrier(); if (local_idx > 8) { return; } stage_sum[local_idx] += stage_sum[local_idx + 8] + stage_sum[local_idx + 16] + stage_sum[local_idx + 24] + stage_sum[local_idx + 32] + stage_sum[local_idx + 40] + stage_sum[local_idx + 48] + stage_sum[local_idx + 56]; memoryBarrierShared(); barrier(); if (local_idx > 0) { return; } float out_sum = stage_sum[0] + stage_sum[1] + stage_sum[2] + stage_sum[3] + stage_sum[4] + stage_sum[5] + stage_sum[6] + stage_sum[7]; out_sum = out_sum * 8.0 / float(W * H); imageStore(out_img, ivec3(workgrp_id.xyz), out_sum.xxxx); } )"; static glslang::ComputeSpirvArtifact art = glslang::compile_comp(comp_src, "main"); static scoped::Task task = CTXT.build_comp_task("avg") .comp(art.comp_spv) .rsc(L_RESOURCE_TYPE_UNIFORM_BUFFER) .rsc(L_RESOURCE_TYPE_STORAGE_IMAGE) .rsc(L_RESOURCE_TYPE_SAMPLED_IMAGE) .build(); scoped::GcScope gc(); vmath::uint2 size(width, height); scoped::Buffer params_buf = CTXT.build_buf() .streaming_with(size) .uniform() .build(); scoped::Image img = CTXT.build_img() .width(width) .height(height) .fmt(fmt::L_FORMAT_R16G16B16A16_SFLOAT) .storage() .sampled() .build(); fill(img, data); scoped::Image out_img = CTXT.build_img() .width(2) .height(2) .depth(2) .fmt(fmt::L_FORMAT_R32_SFLOAT) .storage() .build(); std::vector<float> out_avg(8); scoped::Buffer out_buf = CTXT.build_buf() .size_like(out_avg) .storage() .read_back() .build(); auto invoke = task.build_comp_invoke() .rsc(params_buf.view()) .rsc(out_img.view()) .rsc(img.view()) .workgrp_count(2, 2, 2) .is_timed() .build(); invoke.submit().wait(); CTXT.build_trans_invoke() .src(out_img.view()) .dst(out_buf.view()) .build() .submit() .wait(); log::info("[", width, "x", height, "] ", invoke.get_time_us(), "us"); out_buf.map_read().read(out_avg); return 0.125f * ( out_avg[0] + out_avg[1] + out_avg[2] + out_avg[3] + out_avg[4] + out_avg[5] + out_avg[6] + out_avg[7]); } void fuzz_avg() { auto run = [=](uint32_t WIDTH, uint32_t HEIGHT) { std::vector<vmath::float4> data; data.resize(WIDTH * HEIGHT); for (uint32_t w = 0; w < WIDTH; ++w) { for (uint32_t h = 0; h < HEIGHT; ++h) { data[h * WIDTH + w] = vmath::float4 { float(std::rand() % 1024) / 1024.0f, float(std::rand() % 1024) / 1024.0f, float(std::rand() % 1024) / 1024.0f, float(std::rand() % 1024) / 1024.0f, }; } } float cpu_res = avg_cpu(data, WIDTH, HEIGHT); float gpu_res = avg_gpu(data, WIDTH, HEIGHT); if (std::fabs(cpu_res - gpu_res) > 1e-3) { log::error("expect=", cpu_res, "; actual=", gpu_res); panic(); } }; //run(1, 1); //run(2, 1); //run(1, 2); //run(2, 2); //run(4, 4); run(8, 8); run(64, 8); run(8, 64); run(64, 64); run(128, 64); run(512, 64); run(64, 512); run(512, 512); run(1024, 768); run(1920, 1080); log::info("fuzzed avg"); } void guarded_main() { log::info("hello, world!"); fuzz_avg(); } // ----------------------------------------------------------------------------- // Usually you don't need to change things below. int main(int argc, const char** argv) { initialize(argc, argv); try { guarded_main(); } catch (const std::exception& e) { liong::log::error("application threw an exception"); liong::log::error(e.what()); liong::log::error("application cannot continue"); } catch (...) { liong::log::error("application threw an illiterate exception"); } finalize(); return 0; } void log_cb(log::LogLevel lv, const std::string& msg) { using log::LogLevel; switch (lv) { case LogLevel::L_LOG_LEVEL_DEBUG: printf("[\x1b[90mDEBUG\x1B[0m] %s\n", msg.c_str()); break; case LogLevel::L_LOG_LEVEL_INFO: printf("[\x1B[32mINFO\x1B[0m] %s\n", msg.c_str()); break; case LogLevel::L_LOG_LEVEL_WARNING: printf("[\x1B[33mWARN\x1B[0m] %s\n", msg.c_str()); break; case LogLevel::L_LOG_LEVEL_ERROR: printf("[\x1B[31mERROR\x1B[0m] %s\n", msg.c_str()); break; } }
25.489426
90
0.598554
PENGUINLIONG
76921e962bdee29b36f03def72b39659026214f3
1,841
cpp
C++
Codes/M/MAIN74.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
Codes/M/MAIN74.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
Codes/M/MAIN74.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
#include<iostream> #include<vector> #include<stdio.h> using namespace std; typedef long long ll; #define matrix vector<vector<ll> > ll n,MOD=1000000007; int k=2; vector<ll> c; vector<ll> b; matrix mul(matrix A, matrix B){ matrix C(k+2, vector<ll>(k+2)); for(int i = 1;i<=k+1;i++){ for(int j = 1;j<=k+1;j++){ for(int x = 1;x<=k+1;x++) C[i][j] = (C[i][j] + A[i][x]*B[x][j]) % MOD; } } return C; } matrix pow(matrix A, ll p){ if(p == 1) return A; if(p & 1) return mul(A, pow(A,p-1)); matrix X = pow(A,p/2); return mul(X,X); } ll fib(ll n){ if(n==0) return 0; if(n==1 || n==2) return 1; vector<ll> F1(k+2); F1[1]=0; F1[2]=1; F1[3]=1; matrix T(k+2, vector<ll>(k+2)); for(int i = 1;i<=3;i++){ for(int j = 1;j<=3;j++){ if(i == 1 && j == 1){ T[i][j] = 1; continue; } if(i == k + 1 && j > 1){ T[i][j] = c[k- j + 1]; continue; } if(j == i+1){ T[i][j] = 1; continue; } T[i][j] = 0; } } T = pow(T,n); ll res = 0; for(int i = 1;i<=k;i++){ res = (res + T[1][i] * F1[i]) % MOD; } return res % MOD; } int main(){ int t; scanf("%d",&t); while(t--){ b.push_back(0); b.push_back(1); c.push_back(1); c.push_back(1); scanf("%lld",&n); ll tot=0; if(n==0) tot=0; else if(n==1) tot=2; else if(n>=2) { tot = ((fib(n+1)%MOD)+(fib(n+2)%MOD))%MOD; if(tot < 0) tot += MOD; } printf("%lld\n",tot); c.clear(); b.clear(); } return 0; }
18.59596
60
0.379685
Tanuj9043
7693859c18fea97bc702f87f58ebc274cff29972
10,711
cpp
C++
TRAP/src/Graphics/Renderer2D.cpp
GamesTrap/TRAP
007de9ce70273cb8ae11066cc8488d9db78b1038
[ "MIT", "Zlib", "Apache-2.0", "BSD-3-Clause" ]
3
2018-06-23T18:18:19.000Z
2019-05-27T21:10:07.000Z
TRAP/src/Graphics/Renderer2D.cpp
GamesTrap/TRAP
007de9ce70273cb8ae11066cc8488d9db78b1038
[ "MIT", "Zlib", "Apache-2.0", "BSD-3-Clause" ]
88
2018-08-02T01:08:04.000Z
2019-07-24T19:13:26.000Z
TRAP/src/Graphics/Renderer2D.cpp
GamesTrap/TRAP
007de9ce70273cb8ae11066cc8488d9db78b1038
[ "MIT", "Zlib", "Apache-2.0", "BSD-3-Clause" ]
2
2018-08-02T01:10:40.000Z
2020-08-14T14:05:58.000Z
#include "TRAPPCH.h" #include "Renderer2D.h" #include "Buffers/VertexArray.h" #include "Shaders/Shader.h" #include "Buffers/UniformBuffer.h" #include "RenderCommand.h" #include "Application.h" #include "Embed.h" #include "Cameras/Camera.h" #include "Textures/TextureManager.h" namespace TRAP::Graphics { struct QuadVertex { Math::Vec3 Position; Math::Vec4 Color; Math::Vec2 TexCoord; float TexIndex; }; struct Renderer2DData { static constexpr uint32_t MaxQuads = 20000; static constexpr uint32_t MaxVertices = MaxQuads * 4; static constexpr uint32_t MaxIndices = MaxQuads * 6; static constexpr uint32_t MaxTextureSlots = 32; //TODO: RenderCaps (OpenGL already has GetMaxTextureUnits()) Scope<VertexArray> QuadVertexArray; Scope<VertexBuffer> QuadVertexBuffer; Scope<Shader> TextureShader; Scope<Texture2D> WhiteTexture; Scope<std::array<QuadVertex, MaxVertices>> QuadVertices = MakeScope<std::array<QuadVertex, MaxVertices>>(); uint32_t QuadIndexCount = 0; QuadVertex* QuadVertexBufferBase = nullptr; QuadVertex* QuadVertexBufferPtr = nullptr; std::array<Texture2D*, MaxTextureSlots> TextureSlots{}; uint32_t TextureSlotIndex = 1; //0 = White texture std::array<Math::Vec4, 4> QuadVertexPositions{}; Renderer2D::Statistics Stats; Scope<UniformBuffer> CameraUniformBuffer; struct UniformCamera { Math::Mat4 ProjectionMatrix{ 1.0f }; Math::Mat4 ViewMatrix{ 1.0f }; } UniformCamera; }; } //-------------------------------------------------------------------------------------------------------------------// TRAP::Graphics::Renderer2DData TRAP::Graphics::Renderer2D::s_data{}; //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::Init() { TP_PROFILE_FUNCTION(); TP_DEBUG(Log::Renderer2DPrefix, "Initializing"); s_data.QuadVertexArray = VertexArray::Create(); s_data.QuadVertexBuffer = VertexBuffer::Create(Renderer2DData::MaxVertices * sizeof(QuadVertex)); s_data.QuadVertexBuffer->SetLayout ({ { ShaderDataType::Float3, "Position" }, { ShaderDataType::Float4, "Color" }, { ShaderDataType::Float2, "TexCoord" }, { ShaderDataType::Float, "TexIndex" } }); s_data.QuadVertexArray->SetVertexBuffer(s_data.QuadVertexBuffer); s_data.QuadVertexBufferBase = (*s_data.QuadVertices).data(); Scope<std::array<uint32_t, Renderer2DData::MaxIndices>> quadIndices = MakeScope<std::array<uint32_t, Renderer2DData::MaxIndices>>(); for(uint32_t offset = 0, i = 0; i < Renderer2DData::MaxIndices; i += 6) { (*quadIndices)[i + 0] = offset + 0; (*quadIndices)[i + 1] = offset + 1; (*quadIndices)[i + 2] = offset + 2; (*quadIndices)[i + 3] = offset + 2; (*quadIndices)[i + 4] = offset + 3; (*quadIndices)[i + 5] = offset + 0; offset += 4; } Scope<IndexBuffer> quadIndexBuffer = IndexBuffer::Create((*quadIndices).data(), Renderer2DData::MaxIndices); s_data.QuadVertexArray->SetIndexBuffer(quadIndexBuffer); quadIndices.reset(); s_data.CameraUniformBuffer = UniformBuffer::Create("CameraBuffer", &s_data.UniformCamera, sizeof(Renderer2DData::UniformCamera), BufferUsage::Stream); s_data.TextureShader = Shader::CreateFromSource("Renderer2D", Embed::Renderer2DVS, Embed::Renderer2DFS); const Scope<Image> whiteImage = Image::LoadFromMemory(1, 1, Image::ColorFormat::RGBA, std::vector<uint8_t>{255, 255, 255, 255}); s_data.WhiteTexture = Texture2D::CreateFromImage("Renderer2DWhite", whiteImage); std::array<int32_t, Renderer2DData::MaxTextureSlots> samplers{}; for (uint32_t i = 0; i < Renderer2DData::MaxTextureSlots; i++) samplers[i] = i; //Set first texture slot to 0 s_data.TextureSlots[0] = s_data.WhiteTexture.get(); s_data.QuadVertexPositions[0] = { -0.5f, -0.5f, 0.0f, 1.0f }; s_data.QuadVertexPositions[1] = { 0.5f, -0.5f, 0.0f, 1.0f }; s_data.QuadVertexPositions[2] = { 0.5f, 0.5f, 0.0f, 1.0f }; s_data.QuadVertexPositions[3] = { -0.5f, 0.5f, 0.0f, 1.0f }; TextureManager::Get2D("Fallback2D")->Bind(0); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::Shutdown() { TP_PROFILE_FUNCTION(); TP_DEBUG(Log::Renderer2DPrefix, "Shutting down"); s_data.CameraUniformBuffer.reset(); s_data.TextureShader.reset(); s_data.WhiteTexture.reset(); s_data.QuadVertexArray->Unbind(); s_data.QuadVertexArray.reset(); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::BeginScene(const Camera& camera, const Math::Mat4& transform) { TP_PROFILE_FUNCTION(); s_data.UniformCamera.ProjectionMatrix = camera.GetProjectionMatrix(); s_data.UniformCamera.ViewMatrix = Math::Inverse(transform); //Bind Shader s_data.TextureShader->Bind(); StartBatch(); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::BeginScene(const OrthographicCamera& camera) { TP_PROFILE_FUNCTION(); s_data.UniformCamera.ProjectionMatrix = camera.GetProjectionMatrix(); s_data.UniformCamera.ViewMatrix = camera.GetViewMatrix(); //Bind Shader s_data.TextureShader->Bind(); StartBatch(); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::EndScene() { TP_PROFILE_FUNCTION(); Flush(); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::Flush() { if (s_data.QuadIndexCount == 0) return; //Nothing to render //Update Camera s_data.CameraUniformBuffer->UpdateData(&s_data.UniformCamera); s_data.CameraUniformBuffer->Bind(0); //Bind Vertex Array s_data.QuadVertexArray->Bind(); const uint32_t dataSize = static_cast<uint32_t>(reinterpret_cast<uint8_t*>(s_data.QuadVertexBufferPtr) - reinterpret_cast<uint8_t*>(s_data.QuadVertexBufferBase)); s_data.QuadVertexArray->GetVertexBuffer()->SetData(s_data.QuadVertexBufferBase, dataSize); //Bind textures for (uint32_t i = 0; i < s_data.TextureSlotIndex; i++) s_data.TextureSlots[i]->Bind(i); RenderCommand::DrawIndexed(s_data.QuadVertexArray, s_data.QuadIndexCount); s_data.Stats.DrawCalls++; } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::StartBatch() { s_data.QuadIndexCount = 0; s_data.QuadVertexBufferPtr = s_data.QuadVertexBufferBase; s_data.TextureSlotIndex = 1; } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::NextBatch() { Flush(); StartBatch(); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::DrawQuad(const Transform& transform, const Math::Vec4& color) { DrawQuad(transform, color, s_data.WhiteTexture); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::DrawQuad(const Transform& transform, const Scope<Texture2D>& texture) { DrawQuad(transform, Math::Vec4(1.0f), texture); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::DrawQuad(const Transform& transform, const Math::Vec4& color, const Scope<Texture2D>& texture) { TP_PROFILE_FUNCTION(); Math::Mat4 transformation; if (transform.Rotation.x != 0.0f || transform.Rotation.y != 0.0f || transform.Rotation.z != 0.0f) transformation = Math::Translate(transform.Position) * Mat4Cast(Math::Quaternion(Radians(transform.Rotation))) * Math::Scale(transform.Scale); else transformation = Math::Translate(transform.Position) * Math::Scale(transform.Scale); DrawQuad(transformation, color, texture); } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::DrawQuad(const Math::Mat4& transform, const Math::Vec4& color, const Scope<Texture2D>& texture) { constexpr uint64_t quadVertexCount = 4; constexpr std::array<Math::Vec2, 4> textureCoords = { {{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}} }; if (s_data.QuadIndexCount >= Renderer2DData::MaxIndices) NextBatch(); const float textureIndex = GetTextureIndex(texture); for (uint64_t i = 0; i < quadVertexCount; i++) { s_data.QuadVertexBufferPtr->Position = Math::Vec3(transform * s_data.QuadVertexPositions[i]); s_data.QuadVertexBufferPtr->Color = color; s_data.QuadVertexBufferPtr->TexCoord = textureCoords[i]; s_data.QuadVertexBufferPtr->TexIndex = textureIndex; s_data.QuadVertexBufferPtr++; } s_data.QuadIndexCount += 6; s_data.Stats.QuadCount++; } //-------------------------------------------------------------------------------------------------------------------// float TRAP::Graphics::Renderer2D::GetTextureIndex(const Scope<Texture2D>& texture) { float textureIndex = 0.0f; if (!texture) return textureIndex; for (uint32_t i = 1; i < s_data.TextureSlotIndex; i++) { if (s_data.TextureSlots[i] == texture.get()) { textureIndex = static_cast<float>(i); break; } } if (textureIndex == 0.0f) { if (s_data.TextureSlotIndex >= Renderer2DData::MaxTextureSlots) NextBatch(); textureIndex = static_cast<float>(s_data.TextureSlotIndex); s_data.TextureSlots[s_data.TextureSlotIndex] = texture.get(); s_data.TextureSlotIndex++; } return textureIndex; } //-------------------------------------------------------------------------------------------------------------------// uint32_t TRAP::Graphics::Renderer2D::Statistics::GetTotalVertexCount() const { return QuadCount * 4; } //-------------------------------------------------------------------------------------------------------------------// uint32_t TRAP::Graphics::Renderer2D::Statistics::GetTotalIndexCount() const { return QuadCount * 6; } //-------------------------------------------------------------------------------------------------------------------// TRAP::Graphics::Renderer2D::Statistics TRAP::Graphics::Renderer2D::GetStats() { return s_data.Stats; } //-------------------------------------------------------------------------------------------------------------------// void TRAP::Graphics::Renderer2D::ResetStats() { std::memset(&s_data.Stats, 0, sizeof(Statistics)); }
32.359517
151
0.586033
GamesTrap
769386d37046607a690418cdc0e2ccc6e39c0e61
737
cpp
C++
src/Pandacoin/Address.cpp
justthedoctor/wallet-core
c0d9e9144f89919fcde67c192b8c5e1c2e5e4c6b
[ "MIT" ]
null
null
null
src/Pandacoin/Address.cpp
justthedoctor/wallet-core
c0d9e9144f89919fcde67c192b8c5e1c2e5e4c6b
[ "MIT" ]
null
null
null
src/Pandacoin/Address.cpp
justthedoctor/wallet-core
c0d9e9144f89919fcde67c192b8c5e1c2e5e4c6b
[ "MIT" ]
null
null
null
// Copyright © 2017-2019 Trust. // // This file is part of Trust. The full Trust copyright notice, including // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. #pragma once namespace TW::Pandacoin { class Address { /// Determines whether a string makes a valid address. static bool isValid(const std::string& string); /// Initializes an address from a string representation. Address(const std::string& string); /// Initializes an address from a public key. Address(const PublicKey& publicKey); /// Returns a string representation of the address. std::string string() const; }; } // namespace TW::Pandacoin
29.48
77
0.717775
justthedoctor
7694fa2912f5e6f716d9e3206bb15b4aea90a8e1
4,781
cpp
C++
s2e/guest/windbg-gdb/main.cpp
wyz7155/SymDrive
055f3ab1601d6350b397eddc9f3982271d9186d2
[ "MIT" ]
null
null
null
s2e/guest/windbg-gdb/main.cpp
wyz7155/SymDrive
055f3ab1601d6350b397eddc9f3982271d9186d2
[ "MIT" ]
null
null
null
s2e/guest/windbg-gdb/main.cpp
wyz7155/SymDrive
055f3ab1601d6350b397eddc9f3982271d9186d2
[ "MIT" ]
null
null
null
#define INITGUID #include <string> #include <map> #include <stdio.h> #include <windows.h> #include <psapi.h> #include <stdint.h> #include "BFDInterface.h" #include "Symbols.h" using namespace std; static Symbols *s_symbols = NULL; extern "C" HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { *Version = 0x00010000; *Flags = 0; bfd_init(); return S_OK; } //called when the target is connected or disconnected extern "C" VOID CALLBACK DebugExtensionNotify(ULONG Notify, ULONG64 Argument) { } //cannot assume that a debug session is active at this point extern "C" VOID CALLBACK DebugExtensionUninitialize(VOID) { if (s_symbols) { delete s_symbols; } } //Loads information about all images extern "C" HRESULT CALLBACK gload(PDEBUG_CLIENT Client, PCSTR args) { IDebugControl *control; IDebugSymbols3 *symbols; HRESULT hr; if (!s_symbols) { s_symbols = new Symbols(Client); } hr = Client->QueryInterface(IID_IDebugControl, (LPVOID*)&control); if(FAILED(hr)) { goto err1; } //control->Output(DEBUG_OUTPUT_NORMAL, "test\n"); hr = Client->QueryInterface(IID_IDebugSymbols3, (LPVOID*)&symbols); if(FAILED(hr)) { control->Output(DEBUG_OUTPUT_NORMAL, "Failed to obtain IDebugSymbols3 interface. Use a more recent debugger."); goto err2; } s_symbols->LoadSymbols(Client, symbols); symbols->Release(); control->Release(); return S_OK; err2: control->Release(); err1: return DEBUG_EXTENSION_CONTINUE_SEARCH; } extern "C" HRESULT CALLBACK gdump(PDEBUG_CLIENT Client, PCSTR args) { s_symbols->Dump(); return S_OK; } /** * Queries the specified address for the corresponding symbol * and add the symbol to the symbol library. * Syntax: gsym address */ extern "C" HRESULT CALLBACK gsym(PDEBUG_CLIENT Client, PCSTR args) { HRESULT Ret; IDebugControl *Control; IDebugSymbols3 *Symbols; std::string File, Function, Symbol="<unksym>"; uint64_t Line; StartSize sz; Ret = Client->QueryInterface(IID_IDebugControl, (LPVOID*)&Control); if(FAILED(Ret)) { goto err1; } Ret = Client->QueryInterface(IID_IDebugSymbols3, (LPVOID*)&Symbols); if(FAILED(Ret)) { DBGPRINT("Failed to obtain IDebugSymbols3 interface. Use a more recent debugger."); goto err2; } UINT64 Address; sscanf(args, "%llx", &Address); if (s_symbols->GetSymbolForAddress(Address, sz, Symbol)) { DEBUG_MODULE_AND_ID ModuleId; HRESULT Ret = Symbols->AddSyntheticSymbol(sz.Start, (ULONG)sz.Size, Symbol.c_str(), DEBUG_ADDSYNTHSYM_DEFAULT, &ModuleId); if (FAILED(Ret)) { DBGPRINT("Failed to add symbol (%p)\n", Ret); } } DBGPRINT("%p Size=%#x %s ", sz.Start, sz.Size, Symbol.c_str()); if (s_symbols->GetInfo(Address, File, Line, Function)) { DBGPRINT("%s:%d (%s)", File.c_str(), Line, Function.c_str()); } DBGPRINT("\n"); Symbols->Release(); Control->Release(); return S_OK; err2: Control->Release(); err1: return DEBUG_EXTENSION_CONTINUE_SEARCH; } /** * Displays the backtrace starting from current program counter */ extern "C" HRESULT CALLBACK gbt(PDEBUG_CLIENT Client, PCSTR args) { IDebugRegisters *Registers; IDebugControl *Control; IDebugDataSpaces *Data; HRESULT Ret; if (!s_symbols) { s_symbols = new Symbols(Client); } Ret = Client->QueryInterface(IID_IDebugControl, (LPVOID*)&Control); if(FAILED(Ret)) { goto err1; } Ret = Client->QueryInterface(IID_IDebugRegisters, (LPVOID*)&Registers); if (FAILED(Ret)) { goto err2; } Ret = Client->QueryInterface(IID_IDebugDataSpaces, (LPVOID*)&Data); if (FAILED(Ret)) { goto err3; } ULONG64 StackPointer; Registers->GetStackOffset(&StackPointer); DBGPRINT("Printing stack from offset %p\n", StackPointer) for(uint64_t s = StackPointer; s < StackPointer + 0x1000; s+=8) { std::string File, Function, Symbol="<unksym>"; uint64_t Line; StartSize sz; uint64_t Address; ULONG ReadBytes; Data->ReadVirtual(s, &Address, sizeof(Address), &ReadBytes); s_symbols->GetSymbolForAddress(Address, sz, Symbol); DBGPRINT("[%p]=%p %s ", s, Address, Symbol.c_str()); if (s_symbols->GetInfo(Address, File, Line, Function)) { DBGPRINT("%s:%d (%s)", File.c_str(), Line, Function.c_str()); } DBGPRINT("\n"); } Data->Release(); Control->Release(); Registers->Release(); return S_OK; err3: Registers->Release(); err2: Control->Release(); err1: return DEBUG_EXTENSION_CONTINUE_SEARCH; }
23.78607
130
0.648609
wyz7155
76973be34f9a869b9c4c40b9edf80ae6f34ea42a
2,150
cc
C++
chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <memory> #include "ash/public/cpp/shell_window_ids.h" #include "ash/shelf/app_list_button.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/wm/window_util.h" #include "base/run_loop.h" #include "chrome/test/base/in_process_browser_test.h" #include "ui/app_list/presenter/app_list.h" #include "ui/aura/window.h" #include "ui/events/test/event_generator.h" using AppListTest = InProcessBrowserTest; // An integration test to toggle the app list by pressing the shelf button. IN_PROC_BROWSER_TEST_F(AppListTest, PressAppListButtonToShowAndDismiss) { ash::Shelf* shelf = ash::Shelf::ForWindow(ash::wm::GetActiveWindow()); ash::ShelfWidget* shelf_widget = shelf->shelf_widget(); ash::AppListButton* app_list_button = shelf_widget->GetAppListButton(); aura::Window* root_window = ash::wm::GetActiveWindow()->GetRootWindow(); aura::Window* app_list_container = root_window->GetChildById(ash::kShellWindowId_AppListContainer); ui::test::EventGenerator generator(shelf_widget->GetNativeWindow()); // Click the app list button to show the app list. ash::Shell* shell = ash::Shell::Get(); EXPECT_FALSE(shell->app_list()->GetTargetVisibility()); EXPECT_EQ(0u, app_list_container->children().size()); EXPECT_FALSE(app_list_button->is_showing_app_list()); generator.set_current_location( app_list_button->GetBoundsInScreen().CenterPoint()); generator.ClickLeftButton(); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(shell->app_list()->GetTargetVisibility()); EXPECT_EQ(1u, app_list_container->children().size()); EXPECT_TRUE(app_list_button->is_showing_app_list()); // Click the button again to dismiss the app list; the window animates closed. generator.ClickLeftButton(); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(shell->app_list()->GetTargetVisibility()); EXPECT_EQ(1u, app_list_container->children().size()); EXPECT_FALSE(app_list_button->is_showing_app_list()); }
41.346154
80
0.761395
metux
7698a3aec2f0962c3babeda904b51bfd9d595a83
2,104
cpp
C++
laborator-1/l1_252/main.cpp
mcmarius/poo
ba380d170d30feb1cb3d52026bf8761ae0d6324a
[ "Unlicense" ]
15
2020-10-30T21:50:50.000Z
2022-03-25T14:20:53.000Z
altele/2020-2021/l1_252/main.cpp
Moarcas/poo-1
bf520c749067a9280cf5e1077e54be9dd3d68dba
[ "Unlicense" ]
null
null
null
altele/2020-2021/l1_252/main.cpp
Moarcas/poo-1
bf520c749067a9280cf5e1077e54be9dd3d68dba
[ "Unlicense" ]
4
2020-10-31T21:42:44.000Z
2022-03-25T14:20:44.000Z
#include <iostream> class trotineta { std::string culoare; int nr_roti; public: trotineta(const std::string &culoare = "verde", int nrRoti = 2) : culoare(culoare), nr_roti(nrRoti) { std::cout << "constr trotineta\n"; } ~trotineta() { std::cout << "destr trotineta\n"; } }; class bicicleta { std::string culoare; int nr_roti_ajutatoare; public: bicicleta(const std::string &culoare = "galben", int nrRoti = 2) : culoare(culoare), nr_roti_ajutatoare(nrRoti) { std::cout << "constr bicla\n"; } ~bicicleta() { std::cout << "destr bicla\n"; } }; class motor { int cai_putere; public: void run() { std::cout << "motor goes brr\n"; } motor(int caiPutere) : cai_putere(caiPutere) { std::cout << "constr motor " << cai_putere << "\n"; } motor(const motor& copie) : cai_putere(copie.cai_putere - 10) { std::cout << "cc motor\n"; } ~motor() { std::cout << "destr motor " << cai_putere << "\n"; } }; class vehicul_electric { motor m; int capacitate_baterie; bool se_incarca; static int nr; public: vehicul_electric(motor m = motor(50)) : m(m) { ++nr; std::cout << "constr v electric\n"; } virtual ~vehicul_electric() = 0; static int getNr() { return nr; } }; int vehicul_electric::nr; vehicul_electric::~vehicul_electric() { --nr; std::cout << "destr v electric\n"; } class trotineta_electrica : trotineta, public vehicul_electric { public: trotineta_electrica() { std::cout << "constr trotineta electrica\n"; } virtual ~trotineta_electrica() { { std::cout << "destr trotineta electrica\n"; } } }; class bicicleta_electrica : bicicleta, public vehicul_electric { public: bicicleta_electrica() {} }; int main() { trotineta_electrica t; vehicul_electric& v = t; std::cout << t.getNr() << "\n"; bicicleta_electrica b; std::cout << v.getNr() << "\n"; // t.~trotineta_electrica(); { trotineta tr; } return 0; }
20.038095
117
0.58365
mcmarius
769cfd5786dfef928b954da7b1457f6647ac165c
1,601
cpp
C++
test/unit/test_file_reader.cpp
karelvaculik/dgrminer
37d1cf6c2829f5afd931f2728c27a893128d1152
[ "Apache-2.0" ]
2
2018-05-16T16:35:07.000Z
2021-03-16T12:08:06.000Z
test/unit/test_file_reader.cpp
karelvaculik/dgrminer
37d1cf6c2829f5afd931f2728c27a893128d1152
[ "Apache-2.0" ]
null
null
null
test/unit/test_file_reader.cpp
karelvaculik/dgrminer
37d1cf6c2829f5afd931f2728c27a893128d1152
[ "Apache-2.0" ]
null
null
null
// // Created by karbal on 25.2.18. // #include "AdjacencyList.h" #include "FileReader.h" #include "PartialUnion.h" #include "HelperPrintFunctions.h" #include <gtest/gtest.h> #include <gmock/gmock.h> #include <vector> using ::testing::_; using ::testing::Invoke; using namespace dgrminer; TEST(FileReader, read_intro_example) { FileReader fr; PartialUnion pu; bool search_for_anomalies = false; int window_size = 10; std::string input_file = "data/intro_example"; pu = fr.read_dynamic_graph_from_file(input_file, window_size, search_for_anomalies); ASSERT_EQ(pu.getNumberOfNodes(), 23); ASSERT_EQ(pu.getNumberOfSnapshots(), 5); std::vector<std::array<int, 8>> edges_ground_truth = { {1, 1, 2, 6, 1, 0, 0, 1}, {2, 1, 2, 11, 1, 1, 1, 1}, {2, 2, 3, 6, 1, 0, 0, 2}, {2, 2, 4, 6, 1, 0, 0, 3}, {3, 2, 3, 11, 1, 1, 1, 2}, {3, 2, 4, 11, 1, 1, 1, 3}, {3, 3, 1, 6, 1, 0, 0, 4}, {3, 4, 1, 6, 1, 0, 0, 5}, {3, 1, 5, 6, 1, 0, 0, 6}, {4, 3, 1, 11, 1, 1, 1, 4}, {4, 4, 1, 11, 1, 1, 1, 5}, {4, 1, 5, 11, 1, 1, 1, 6}, {4, 5, 3, 6, 1, 0, 0, 7}, {4, 5, 4, 6, 1, 0, 0, 8}, {5, 5, 3, 11, 1, 1, 1, 7}, {5, 5, 4, 11, 1, 1, 1, 8}, {5, 3, 1, 6, 1, 0, 0, 9}, {5, 4, 1, 6, 1, 0, 0, 10} }; // println(pu.getEdges()); // println(pu.getEncodingLabel(6)); // println(pu.getEncodingLabel(11)); ASSERT_EQ(pu.getEdges(), edges_ground_truth); }
26.683333
88
0.489069
karelvaculik
769d00b2042c81e983dc22226c5ef689a92d1809
2,432
hpp
C++
dep/win/include/boost/histogram/detail/common_type.hpp
Netis/packet-agent
70da3479051a07e3c235abe7516990f9fd21a18a
[ "BSD-3-Clause" ]
995
2018-06-22T10:39:18.000Z
2022-03-25T01:22:14.000Z
dep/win/include/boost/histogram/detail/common_type.hpp
Netis/packet-agent
70da3479051a07e3c235abe7516990f9fd21a18a
[ "BSD-3-Clause" ]
32
2018-06-23T14:19:37.000Z
2022-03-29T10:20:37.000Z
dep/win/include/boost/histogram/detail/common_type.hpp
Netis/packet-agent
70da3479051a07e3c235abe7516990f9fd21a18a
[ "BSD-3-Clause" ]
172
2018-06-22T11:12:00.000Z
2022-03-29T07:44:33.000Z
// Copyright 2015-2018 Hans Dembinski // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP #define BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP #include <boost/histogram/detail/meta.hpp> #include <boost/histogram/fwd.hpp> #include <boost/mp11/list.hpp> #include <boost/mp11/utility.hpp> #include <tuple> #include <type_traits> namespace boost { namespace histogram { namespace detail { // clang-format off template <class T, class U> using common_axes = mp11::mp_cond< is_tuple<T>, T, is_tuple<U>, U, is_sequence_of_axis<T>, T, is_sequence_of_axis<U>, U, std::true_type, T >; template <class T, class U> using common_container = mp11::mp_cond< is_array_like<T>, T, is_array_like<U>, U, is_vector_like<T>, T, is_vector_like<U>, U, std::true_type, T >; // clang-format on template <class T> using type_score = mp11::mp_size_t<((!std::is_pod<T>::value) * 1000 + std::is_floating_point<T>::value * 50 + sizeof(T))>; template <class T, class U> struct common_storage_impl; template <class T, class U> struct common_storage_impl<storage_adaptor<T>, storage_adaptor<U>> { using type = mp11::mp_if_c<(type_score<typename storage_adaptor<T>::value_type>::value >= type_score<typename storage_adaptor<U>::value_type>::value), storage_adaptor<T>, storage_adaptor<U>>; }; template <class T, class A> struct common_storage_impl<storage_adaptor<T>, unlimited_storage<A>> { using type = mp11::mp_if_c<(type_score<typename storage_adaptor<T>::value_type>::value >= type_score<typename unlimited_storage<A>::value_type>::value), storage_adaptor<T>, unlimited_storage<A>>; }; template <class C, class A> struct common_storage_impl<unlimited_storage<A>, storage_adaptor<C>> : common_storage_impl<storage_adaptor<C>, unlimited_storage<A>> {}; template <class A1, class A2> struct common_storage_impl<unlimited_storage<A1>, unlimited_storage<A2>> { using type = unlimited_storage<A1>; }; template <class A, class B> using common_storage = typename common_storage_impl<A, B>::type; } // namespace detail } // namespace histogram } // namespace boost #endif
30.78481
89
0.686266
Netis
37200938914b2178b42413c7dd8b6844e8db3400
3,839
cpp
C++
src/kdev_discord.cpp
FiniteReality/kdev_discord
3cac16a7272c5396e20ea16a687266e10db2e16d
[ "MIT" ]
5
2018-05-28T10:30:38.000Z
2020-08-08T20:14:32.000Z
src/kdev_discord.cpp
FiniteReality/kdev_discord
3cac16a7272c5396e20ea16a687266e10db2e16d
[ "MIT" ]
1
2020-06-22T16:59:50.000Z
2021-08-30T19:03:02.000Z
src/kdev_discord.cpp
FiniteReality/kdev_discord
3cac16a7272c5396e20ea16a687266e10db2e16d
[ "MIT" ]
1
2020-06-17T20:33:41.000Z
2020-06-17T20:33:41.000Z
#include "kdev_discord.h" #include <debug.h> #include <QRegularExpression> #include <KPluginFactory> #include <interfaces/icore.h> #include <interfaces/idocumentcontroller.h> #include <interfaces/isession.h> #include <interfaces/iprojectcontroller.h> #include <interfaces/iproject.h> #include <KTextEditor/Document> #include <discord_rpc.h> #define APPID "429055143087177730" static bool discordReady; static bool running; static void SetDefaultState(); K_PLUGIN_FACTORY_WITH_JSON(kdev_discordFactory, "kdev_discord.json", registerPlugin<kdev_discord>(); ) kdev_discord::kdev_discord(QObject *parent, const QVariantList& args) : KDevelop::IPlugin(QStringLiteral("kdev_discord"), parent) { Q_UNUSED(args); discordReady = false; auto* documentController = core()->documentController(); QObject::connect( documentController, SIGNAL(documentActivated(KDevelop::IDocument*)), this, SLOT(onDocumentActivated(KDevelop::IDocument*))); load(); } void kdev_discord::load() { running = true; DiscordEventHandlers handlers; memset(&handlers, 0, sizeof(handlers)); handlers.ready = [](const DiscordUser*){ discordReady = true; SetDefaultState(); }; callbackThread = std::thread([]() { while (running) { const std::chrono::duration<int64_t, std::milli> sleepTime{500LL}; Discord_RunCallbacks(); std::this_thread::sleep_for(sleepTime); } }); Discord_Initialize(APPID, &handlers, 1, nullptr); } void kdev_discord::unload() { discordReady = false; Discord_Shutdown(); running = false; callbackThread.join(); } void kdev_discord::onDocumentActivated(KDevelop::IDocument* document) { if (document->isTextDocument()) setCurrentFile(document); } void kdev_discord::setCurrentFile(KDevelop::IDocument* document) { if (discordReady) { KTextEditor::Document* textDoc = document->textDocument(); auto fileName = textDoc->documentName(); auto fileType = textDoc->mimeType(); auto session = core()->activeSession(); auto projectCtrl = core()->projectController(); auto project = projectCtrl == nullptr ? nullptr : projectCtrl->findProjectForUrl(document->url()); if (session != nullptr && projectCtrl != nullptr && project != nullptr) { auto projects = session->containedProjects(); auto sessionProjs = QString::number(projects.size()); auto sessionName = session->name(); auto sessionDesc = session->description(); auto projectName = project->name(); QString state = "Editing some code"; QString details = fileName; if (!sessionName.isEmpty()) state = "In session " + sessionName + " (" + sessionProjs + " projects)"; if (!projectName.isEmpty()) details = fileName + " in " + projectName; DiscordRichPresence presence; memset(&presence, 0, sizeof(presence)); presence.state = state.toUtf8().constData(); presence.details = details.toUtf8().constData(); presence.largeImageKey = "kdev_logo"; presence.largeImageText = sessionDesc.toUtf8().constData(); presence.startTimestamp = time(nullptr); Discord_UpdatePresence(&presence); } } } static void SetDefaultState() { DiscordRichPresence presence; memset(&presence, 0, sizeof(presence)); presence.state = "Idle"; presence.largeImageKey = "kdev_logo"; presence.startTimestamp = time(nullptr); Discord_UpdatePresence(&presence); } // needed for QObject class created from K_PLUGIN_FACTORY_WITH_JSON #include "kdev_discord.moc"
26.659722
102
0.648085
FiniteReality
37238744afa24c58aac13b73c6bb38b498473476
105
hpp
C++
src/physics/polygon.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
1
2020-09-23T11:17:35.000Z
2020-09-23T11:17:35.000Z
src/physics/polygon.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
null
null
null
src/physics/polygon.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
null
null
null
#pragma once #include <vector> #include <SFML/Graphics.hpp> using Polygon = std::vector<sf::Vector2f>;
15
42
0.72381
astrellon
372610427df2b87f2ea78e5ee4bc6f79f3054019
3,581
hpp
C++
include/rrboost/serial_port.hpp
afoolsbag/rrCnCxx
1e673bd4edac43d8406a0c726138cba194d17f48
[ "Unlicense" ]
2
2019-03-20T01:14:10.000Z
2021-12-08T15:39:32.000Z
include/rrboost/serial_port.hpp
afoolsbag/rrCnCxx
1e673bd4edac43d8406a0c726138cba194d17f48
[ "Unlicense" ]
null
null
null
include/rrboost/serial_port.hpp
afoolsbag/rrCnCxx
1e673bd4edac43d8406a0c726138cba194d17f48
[ "Unlicense" ]
null
null
null
/// \copyright Unlicense #pragma once #ifndef SERIAL_PORT_HPP_ #define SERIAL_PORT_HPP_ #include <stdexcept> #include <string> #include <vector> #include <boost/asio.hpp> #include <boost/utility.hpp> namespace rrboost { /// \brief 超时异常。 class timeout_exception: public std::runtime_error { public: timeout_exception(const std::string &msg): runtime_error {msg} {} }; /// \brief 串行端口。 /// \details 使用 Boost.Asio 库,仿照 `std::fstream` 接口,提供串口库。 /// \sa [serial-port](https://github.com/fedetft/serial-port) /// \sa [std::basic_fstream](https://zh.cppreference.com/w/cpp/io/basic_fstream) class serial_port: private boost::noncopyable { public: using parity = boost::asio::serial_port::parity; using character_size = boost::asio::serial_port::character_size; using flow_control = boost::asio::serial_port::flow_control; using stop_bits = boost::asio::serial_port::stop_bits; /// \brief 构造函数。 explicit serial_port() noexcept; /// \brief 构造函数,同时打开设备。 /// \param device_name 设备名,例如 `/dev/ttyUSB0` 或 `COM4`; /// \param baud_rate 波特率,例如 `9600` 或 `115200`; /// \param parity 奇偶检验,默认为空; /// \param character_size 串行字符大小,默认为 8 bits; /// \param flow_control 流量控制,默认为空; /// \param stop_bits 停止位,默认为 `1`; /// \throws boost::system::system_error 打开串口失败时抛出此类异常。 explicit serial_port(const std::string &device_name, unsigned baud_rate, parity parity = serial_port::parity {parity::none}, character_size character_size = serial_port::character_size {8}, flow_control flow_control = serial_port::flow_control {flow_control::none}, stop_bits stop_bits = serial_port::stop_bits {stop_bits::one}); /// \brief 打开设备。 /// \param device_name 设备名,例如 `/dev/ttyUSB0` 或 `COM4`; /// \param baud_rate 波特率,例如 `9600` 或 `115200`。 /// \param parity 奇偶检验,默认为空; /// \param character_size 串行字符大小,默认为 8 bits; /// \param flow_control 流量控制,默认为空; /// \param stop_bits 停止位,默认为 `1`; /// \throws boost::system::system_error 打开串口失败时抛出此类异常。 void open(const std::string &device_name, unsigned baud_rate, parity parity = serial_port::parity {parity::none}, character_size character_size = serial_port::character_size {8}, flow_control flow_control = serial_port::flow_control {flow_control::none}, stop_bits stop_bits = serial_port::stop_bits {stop_bits::one}); /// \brief 检查当前串口设备是否已打开。 bool is_open() const; /// \brief 关闭当前串口设备。 void close(); /// \brief 设置超时时间。 /// \details 将其设置为 `boost::posix_time::seconds{0}` 以禁用超时。 void set_timeout(const boost::posix_time::time_duration &timeout); /// \brief 向串口中写入二进制数据。 void write(const std::byte *data, std::size_t size); /// \brief 向串口中写入二进制数据。 void write(const std::vector<std::byte> &data); /// \brief 向串口中写入字符串。 void write(const std::string &string); /// \brief 阻塞地,从串口中读取二进制数据。 void read(std::byte *buffer, std::size_t size); /// \brief 阻塞地,从串口中读取二进制数据。 std::vector<std::byte> read(std::size_t size); /// \brief 阻塞地,从串口中读取字符串。 std::string read_string(std::size_t size); /// \brief 阻塞地,从串口中读取字符串,直到分隔符。 std::string read_string_until(const std::string &delimiter = "\n"); private: /// \brief ASIO 上下文。 boost::asio::io_service io_; /// \brief ASIO 串行端口。 boost::asio::serial_port sp_; }; } #include "serial_port.inl" #endif
32.853211
100
0.639486
afoolsbag
3727fe483c2a80e9e79facc6d87eaed8bfa83eb7
665
cpp
C++
Dialogs/brightnessdialog.cpp
kalpanki/ocvGUI
9fc1f2278b414c316f091e1de5a4b1c4e3695ee9
[ "BSD-2-Clause" ]
2
2019-08-21T13:37:51.000Z
2019-10-18T01:39:53.000Z
Dialogs/brightnessdialog.cpp
kalpanki/ocvGUI
9fc1f2278b414c316f091e1de5a4b1c4e3695ee9
[ "BSD-2-Clause" ]
null
null
null
Dialogs/brightnessdialog.cpp
kalpanki/ocvGUI
9fc1f2278b414c316f091e1de5a4b1c4e3695ee9
[ "BSD-2-Clause" ]
null
null
null
#include "brightnessdialog.h" #include "ui_brightnessdialog.h" BrightnessDialog::BrightnessDialog(QWidget *parent) : QDialog(parent), ui(new Ui::BrightnessDialog) { ui->setupUi(this); } BrightnessDialog::~BrightnessDialog() { delete ui; } void BrightnessDialog::on_alphaDoubleSpinBox_valueChanged(double arg1) { double alpha = ui->alphaDoubleSpinBox->value(); int beta = ui->betaSpinBox->value(); sendBrightnessSignal(alpha, beta); } void BrightnessDialog::on_betaSpinBox_valueChanged(int arg1) { double alpha = ui->alphaDoubleSpinBox->value(); int beta = ui->betaSpinBox->value(); sendBrightnessSignal(alpha, beta); }
21.451613
70
0.726316
kalpanki
3730a40a6b71018014acf7061f965369160c608d
709
hpp
C++
tests/test_spin_lock.hpp
djmott/xtl
cadb963a3d1ad292033f08f4754c545066be75f7
[ "BSL-1.0" ]
6
2016-06-30T11:23:33.000Z
2019-10-22T13:09:49.000Z
tests/test_spin_lock.hpp
djmott/xtl
cadb963a3d1ad292033f08f4754c545066be75f7
[ "BSL-1.0" ]
null
null
null
tests/test_spin_lock.hpp
djmott/xtl
cadb963a3d1ad292033f08f4754c545066be75f7
[ "BSL-1.0" ]
4
2016-07-24T10:38:43.000Z
2021-04-02T11:18:09.000Z
/** @file xtd::concurrent::spin_lock system and unit tests @copyright David Mott (c) 2016. Distributed under the Boost Software License Version 1.0. See LICENSE.md or http://boost.org/LICENSE_1_0.txt for details. */ #include <xtd/concurrent/spin_lock.hpp> TEST(test_spin_lock, initialization){ xtd::concurrent::spin_lock oLock; } TEST(test_spin_lock, lock){ xtd::concurrent::spin_lock oLock; oLock.lock(); } TEST(test_spin_lock, unlock){ xtd::concurrent::spin_lock oLock; oLock.lock(); oLock.unlock(); } TEST(test_spin_lock, try_lock){ xtd::concurrent::spin_lock oLock; EXPECT_TRUE(oLock.try_lock()); EXPECT_FALSE(oLock.try_lock()); oLock.unlock(); EXPECT_TRUE(oLock.try_lock()); }
23.633333
153
0.736248
djmott
37342f185245e32ef5f598371dd655ee5b1666f5
69
cpp
C++
configuration/bazel/max_align_t.cpp
yesudeep/fruit
6f3760672a0d2c772306e737d894a2ae2d8c5f58
[ "Apache-2.0" ]
1,666
2015-01-04T08:52:43.000Z
2022-03-28T11:06:19.000Z
configuration/bazel/max_align_t.cpp
yesudeep/fruit
6f3760672a0d2c772306e737d894a2ae2d8c5f58
[ "Apache-2.0" ]
135
2015-02-19T11:35:07.000Z
2022-03-29T05:00:42.000Z
configuration/bazel/max_align_t.cpp
yesudeep/fruit
6f3760672a0d2c772306e737d894a2ae2d8c5f58
[ "Apache-2.0" ]
253
2015-01-14T08:15:10.000Z
2022-03-24T07:49:53.000Z
#include <cstddef> using X = max_align_t; int main() { return 0; }
11.5
22
0.652174
yesudeep
3739a84e1f47b2c087950d0297aabe106eec4f17
114
hpp
C++
include/memory/hadesmem/detail/warning_disable_suffix.hpp
phlip9/hadesmem
59e13a92c05918b8c842141fd5cac1ed390cd79e
[ "MIT" ]
19
2017-10-19T23:13:11.000Z
2022-03-29T11:37:26.000Z
include/memory/hadesmem/detail/warning_disable_suffix.hpp
Bia10/hadesmem
b91bce37611d0e939a55d9490c49780f9f0f3bff
[ "MIT" ]
null
null
null
include/memory/hadesmem/detail/warning_disable_suffix.hpp
Bia10/hadesmem
b91bce37611d0e939a55d9490c49780f9f0f3bff
[ "MIT" ]
10
2018-04-04T07:55:16.000Z
2021-11-23T20:22:43.000Z
// Copyright (C) 2010-2015 Joshua Boyce // See the file COPYING for copying permission. #pragma warning(pop)
22.8
48
0.719298
phlip9
373e8cc2d89af8d558b30c174ea3962fc1265ab2
2,135
cpp
C++
core/src/GLFWInput.cpp
matthew-oconnell/glitter
d9eb6cea96063f080121e9c6e59098e2d690c427
[ "Apache-2.0" ]
null
null
null
core/src/GLFWInput.cpp
matthew-oconnell/glitter
d9eb6cea96063f080121e9c6e59098e2d690c427
[ "Apache-2.0" ]
null
null
null
core/src/GLFWInput.cpp
matthew-oconnell/glitter
d9eb6cea96063f080121e9c6e59098e2d690c427
[ "Apache-2.0" ]
null
null
null
#include "GLFWInput.h" #include "Game.h" using namespace Glitter; GLFWInput::GLFWInput(GLFWwindow *window) : window(window){ glfwSetKeyCallback(window, key_callback); glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetCursorPosCallback(window, cursor_position_callback); for (bool &keyboard_key : keyboard_keys) keyboard_key = false; for (bool &mouse_button : mouse_buttons) mouse_button = false; } void GLFWInput::key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) { auto input = static_cast<Engine*>(glfwGetWindowUserPointer(window))->getInput(); if(action == GLFW_PRESS) input->keyboard_keys[key] = true; else if(action == GLFW_RELEASE) input->keyboard_keys[key] = false; } void GLFWInput::mouse_button_callback(GLFWwindow *window, int button, int action, int mods) { auto input = static_cast<Engine*>(glfwGetWindowUserPointer(window))->getInput(); if(action == GLFW_PRESS) input->mouse_buttons[button] = true; else if(action == GLFW_RELEASE) input->mouse_buttons[button] = false; } void GLFWInput::cursor_position_callback(GLFWwindow *window, double x, double y) { auto input = static_cast<Engine*>(glfwGetWindowUserPointer(window))->getInput(); input->mouse_x = (float)x; input->mouse_y = (float)y; } unsigned int GLFWInput::mapToGLFWKeycode(Player::Input::KEYS k) const { if(k == Player::Input::KEYS::W) return GLFW_KEY_W; if(k == Player::Input::KEYS::A) return GLFW_KEY_A; if(k == Player::Input::KEYS::S) return GLFW_KEY_S; if(k == Player::Input::KEYS::D) return GLFW_KEY_D; if(k == Player::Input::KEYS::SPACE) return GLFW_KEY_SPACE; return MAX_KEYBOARD_KEYS+1; } bool GLFWInput::pressed(Player::Input::KEYS k) const { unsigned int keycode = mapToGLFWKeycode(k); if(keycode > MAX_KEYBOARD_KEYS) return false; return keyboard_keys[keycode]; } bool GLFWInput::isMouseButtonPressed(unsigned int button_code) const { if(button_code > MAX_MOUSE_BUTTONS) return false; return mouse_buttons[button_code]; } Math::Vec2d GLFWInput::getCursorLocation() const { return {mouse_x, mouse_y}; }
34.435484
95
0.733958
matthew-oconnell
3743275a0c913f6817ce8effacc9cd07d6bbb7a6
251
hpp
C++
parser/nodes/stmt.hpp
cursorweb/Asula-Lang
173a814f92b977064a889febc69798a93c906ebe
[ "MIT" ]
2
2022-03-09T20:13:26.000Z
2022-03-10T14:18:19.000Z
parser/nodes/stmt.hpp
cursorweb/Asula-Lang
173a814f92b977064a889febc69798a93c906ebe
[ "MIT" ]
null
null
null
parser/nodes/stmt.hpp
cursorweb/Asula-Lang
173a814f92b977064a889febc69798a93c906ebe
[ "MIT" ]
null
null
null
#ifndef STMT_HPP #define STMT_HPP // visitor list class StmtVisitor; // stmt list class Stmt { public: virtual void accept(StmtVisitor visitor); }; // nodes // visitor list class StmtVisitor { public: // virtual C visit(); }; #endif
9.296296
45
0.673307
cursorweb
3746811b08e49103a4b553bc31698e84a064bff1
183
cpp
C++
applications/builder/source/builder_modes.cpp
skarab/coffee-master
6c3ff71b7f15735e41c9859b6db981b94414c783
[ "MIT" ]
null
null
null
applications/builder/source/builder_modes.cpp
skarab/coffee-master
6c3ff71b7f15735e41c9859b6db981b94414c783
[ "MIT" ]
null
null
null
applications/builder/source/builder_modes.cpp
skarab/coffee-master
6c3ff71b7f15735e41c9859b6db981b94414c783
[ "MIT" ]
null
null
null
#include "builder_modes.h" #undef _BUILDER_MODES_H_ #include "kernel/meta/macros/meta_macros_enum_cpp.h" #include "builder_modes.h" #include "kernel/meta/macros/meta_macros_enum_h.h"
30.5
52
0.819672
skarab
3746eac5953c4951ff7b0e5fe2fdb5372fabc386
3,318
hxx
C++
src/openlcb/EventService.hxx
balazsracz/openmrn
338f5dcbafeff6d171b2787b291d1904f2c45965
[ "BSD-2-Clause" ]
34
2015-05-23T03:57:56.000Z
2022-03-27T03:48:48.000Z
src/openlcb/EventService.hxx
balazsracz/openmrn
338f5dcbafeff6d171b2787b291d1904f2c45965
[ "BSD-2-Clause" ]
214
2015-07-05T05:06:55.000Z
2022-02-06T14:53:14.000Z
src/openlcb/EventService.hxx
balazsracz/openmrn
338f5dcbafeff6d171b2787b291d1904f2c45965
[ "BSD-2-Clause" ]
38
2015-08-28T05:32:07.000Z
2021-07-06T16:47:23.000Z
/** \copyright * Copyright (c) 2013, Balazs Racz * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \file EventService.hxx * * A service that takes incoming event messages, owns the event registry, and * dispatches the incoming event messages to the registered handlers. This * service can be registered to multiple NMRAnet::If interfaces at the same * time. * * @author Balazs Racz * @date 22 May 2014 */ #ifndef _OPENLCB_EVENTSERVICE_HXX_ #define _OPENLCB_EVENTSERVICE_HXX_ // This is a workaround for missing shared_ptr.h causing compilation errors. We // do not use shared_ptr. #ifndef __CR2_C___4_6_2_BITS_SHARED_PTR_H__ #define __CR2_C___4_6_2_BITS_SHARED_PTR_H__ #endif #define DEBUG_EVENT_PERFORMANCE #include <memory> #include "utils/macros.h" #include "executor/Service.hxx" #include "openlcb/Defs.hxx" #include "openlcb/If.hxx" namespace openlcb { class Node; class EventIteratorFlow; /// Global Event Service. Registers itself with a specific interface to receive /// all incoming messages related to the OpenLCB Event Protocol, maintains the /// registry of event handlers, and routes the incoming messages to the event /// handlers based on the registration arguments. class EventService : public Service { public: /** Creates a global event service with no interfaces registered. */ EventService(ExecutorBase *e); /** Creates a global event service that runs on an interface's thread and * registers the interface. */ EventService(If *iface); ~EventService(); /** Registers this global event handler with an interface. This operation * will be undone in the destructor. */ void register_interface(If *iface); class Impl; Impl *impl() { return impl_.get(); } /** Returns true if there are outstanding events that are not yet * handled. */ bool event_processing_pending(); static EventService *instance; private: std::unique_ptr<Impl> impl_; }; }; /* namespace openlcb */ #endif // _OPENLCB_EVENTSERVICE_HXX_
33.18
79
0.748342
balazsracz
37475954f61c70fbc81285c66c8f93fdc0de4f55
1,261
cpp
C++
src/Panel2D.cpp
cfrpg/SourcePanelMethod
0d16482b345c0457e48935a53a06c63a9205bd22
[ "MIT" ]
null
null
null
src/Panel2D.cpp
cfrpg/SourcePanelMethod
0d16482b345c0457e48935a53a06c63a9205bd22
[ "MIT" ]
null
null
null
src/Panel2D.cpp
cfrpg/SourcePanelMethod
0d16482b345c0457e48935a53a06c63a9205bd22
[ "MIT" ]
null
null
null
#include "Panel2D.h" #include "MathHelper.h" #include <cmath> #include <cstdio> Panel2D::Panel2D(void) { } Panel2D::Panel2D(Vector2 _v1,Vector2 _v2) { v1=_v1; v2=_v2; midpoint=v1+v2; midpoint/=2; normal=-Vector2((v2-v1).y,-(v2-v1).x); angle=atan2(v2.y-v1.y,v2.x-v1.x); if(angle<0) angle+=2*PI; direction=(v2-v1); direction.Normalize(); normal.Normalize(); lengthSqure=(v2-v1).GetLengthSqure(); } Vector2 Panel2D::GetNormal() { return normal; } Vector2 Panel2D::GetMidpoint() { return midpoint; } void Panel2D::Reset(Vector2 _v1,Vector2 _v2) { v1=_v1; v2=_v2; midpoint=v1+v2; midpoint/=2; normal.x=-(v2-v1).y; normal.y=(v2-v1).x; angle=atan2(v2.y-v1.y,v2.x-v1.x); if(angle<0) angle+=2*PI; direction=(v2-v1); direction.Normalize(); } void Panel2D::Reverse() { normal=-normal; v1+=v2; v2=v1-v2; v1-=v2; } double Panel2D::GetAngle() { return angle; } Vector2 Panel2D::GetDirection() { return direction; } double Panel2D::GetX1() { return v1.x; } double Panel2D::GetY1() { return v1.y; } double Panel2D::GetX2() { return v2.x; } double Panel2D::GetY2() { return v2.y; } double Panel2D::GetLengthSqure() { return lengthSqure; } double Panel2D::GetLength() { return sqrt(lengthSqure); } Panel2D::~Panel2D(void) { }
12.485149
44
0.666931
cfrpg
37489c6dca94e1c7cd65ebf002e34f3feb15663f
1,365
cpp
C++
src/ScreenshotView.cpp
humdingerb/HaikuThemeManager
b38a77fc147cf4a8dc083b52ce4941b0a44cf160
[ "MIT" ]
4
2016-02-26T08:13:04.000Z
2019-11-17T22:15:04.000Z
src/ScreenshotView.cpp
humdingerb/HaikuThemeManager
b38a77fc147cf4a8dc083b52ce4941b0a44cf160
[ "MIT" ]
26
2017-01-05T04:18:51.000Z
2021-10-08T04:22:14.000Z
src/ScreenshotView.cpp
humdingerb/HaikuThemeManager
b38a77fc147cf4a8dc083b52ce4941b0a44cf160
[ "MIT" ]
4
2017-12-06T19:29:54.000Z
2020-10-26T07:27:34.000Z
/* * Copyright 2000-2008, François Revol, <revol@free.fr>. All rights reserved. * Distributed under the terms of the MIT License. */ #include "ScreenshotView.h" #include <View.h> #include <Bitmap.h> #include <stdio.h> #include <Debug.h> // PRIVATE: in libzeta for now. extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); ScreenshotView::ScreenshotView(BRect bounds, const char *name, uint32 resizeMask, uint32 flags) : BView(bounds, name, resizeMask, flags) { fBitmap = NULL; } ScreenshotView::~ScreenshotView() { if (fBitmap) delete fBitmap; } void ScreenshotView::AttachedToWindow() { UpdateScreenshot(); } void ScreenshotView::UpdateScreenshot() { if (Window() == NULL) return; ClearViewBitmap(); if (fBitmap) { #ifdef __HAIKU__ SetViewBitmap(fBitmap, fBitmap->Bounds(), Bounds(), B_FOLLOW_ALL, B_FILTER_BITMAP_BILINEAR); #else SetViewBitmap(fBitmap, fBitmap->Bounds(), Bounds()); #endif } Invalidate(); } void ScreenshotView::SetScreenshot(BBitmap *bitmap) { if (fBitmap) delete fBitmap; fBitmap = bitmap; #ifdef B_ZETA_VERSION if (bitmap) { BBitmap *scaled = new BBitmap(Bounds(), B_RGB32); status_t err = ENOSYS; err = ScaleBitmap(*bitmap, *scaled); if( err == B_OK ) { fBitmap = scaled; delete bitmap; } else delete scaled; } #endif UpdateScreenshot(); }
16.058824
77
0.698168
humdingerb
37498a6e0c3032f7f83715fff555ff0f0d506299
3,763
hpp
C++
include/rectojump/global/config_settings.hpp
Malekblubb/rectojump
66c04e9a081bd1b830205bb0c515a42eeb4befb6
[ "MIT" ]
null
null
null
include/rectojump/global/config_settings.hpp
Malekblubb/rectojump
66c04e9a081bd1b830205bb0c515a42eeb4befb6
[ "MIT" ]
null
null
null
include/rectojump/global/config_settings.hpp
Malekblubb/rectojump
66c04e9a081bd1b830205bb0c515a42eeb4befb6
[ "MIT" ]
null
null
null
// // Copyright (c) 2013-2021 Christoph Malek // See LICENSE for more information. // #ifndef RJ_GLOBAL_CONFIG_SETTINGS_HPP #define RJ_GLOBAL_CONFIG_SETTINGS_HPP #include "config.hpp" #include <rectojump/shared/utils.hpp> #include <mlk/signals_slots/slot.h> #include <mlk/tools/utils.h> namespace rj { namespace settings { inline void init() { config::get(); } inline mlk::slot<>& on_changed() { return config::get().on_setting_changed; } // setters inline void set_window_size(const vec2u& size) { config::get().set_entry("window_width", size.x); config::get().set_entry("window_height", size.y); config::get().on_setting_changed(); } inline void set_fullscreen(bool b) { config::get().set_entry("fullscreen", b); config::get().on_setting_changed(); } inline void set_sound_volume(int vol) { config::get().set_entry("sound_volume", vol); } inline void set_color_light(const std::string& hex) { config::get().set_entry("color_light", hex); } inline void set_color_dark(const std::string& hex) { config::get().set_entry("color_dark", hex); } inline void set_color_default_dark(const std::string& hex) { config::get().set_entry("color_default_dark", hex); } inline void set_color_default_light(const std::string& hex) { config::get().set_entry("color_default_light", hex); } inline void set_editor_scroll_step(float step) { config::get().set_entry("editor_scroll_step", step); } inline void set_editor_settings_expanded(bool b) { config::get().set_entry("editor_settings_expanded", b); } inline void set_main_menu_effects(bool b) { config::get().set_entry("main_menu_effects", b); } // getters template <typename Vec_Type = vec2u, typename Val_Type = decltype(Vec_Type::x)> inline Vec_Type get_window_size() { return {config::get().get_entry<Val_Type>("window_width"), config::get().get_entry<Val_Type>("window_height")}; } inline bool get_fullscreen() { return config::get().get_entry<bool>("fullscreen"); } inline int get_sound_volume() { return config::get().get_entry<int>("sound_volume"); } inline sf::Color get_color_light() { return to_rgb(config::get().get_entry<std::string>("color_light")); } inline sf::Color get_color_dark() { return to_rgb(config::get().get_entry<std::string>("color_dark")); } inline sf::Color get_color_default_dark() { return to_rgb( config::get().get_entry<std::string>("color_default_dark")); } inline sf::Color get_color_default_light() { return to_rgb( config::get().get_entry<std::string>("color_default_light")); } inline float get_editor_scroll_step() { return config::get().get_entry<float>("editor_scroll_step"); } inline bool get_editor_settings_expanded() { return mlk::parse_bool(config::get().get_entry<std::string>( "editor_settings_expanded")); } inline bool get_main_menu_effects() { return mlk::parse_bool( config::get().get_entry<std::string>("main_menu_effects")); } // fixed settings inline std::string data_path() { return "data/"; } inline std::string level_path() { return "levels/"; } inline std::string rj_font() { return "Fipps-Regular.otf"; } inline std::string text_font() { return "Ubuntu-R.ttf"; } inline constexpr mlk::uint text_size() { return 15; } inline sf::Color text_color() { return to_rgb("#373737"); } inline std::string version() { return "0.0.0"; } inline constexpr float game_warmup_time() { return 1500.f; } inline constexpr float player_start_x() { return 100.f; } inline constexpr float player_start_y() { return 500.f; } }// namespace settings }// namespace rj #endif// RJ_GLOBAL_CONFIG_SETTINGS_HPP
24.594771
70
0.689078
Malekblubb
374a39a527b2079a64a6d2408212e423a278ea19
1,813
cpp
C++
src/dex/inst.cpp
wangziqi2013/Android-Dalvik-Analysis
c22e48cffd0af84febe9796afa9598b7c4e976c7
[ "Apache-2.0" ]
4
2016-10-03T06:38:00.000Z
2019-06-15T02:57:27.000Z
src/dex/inst.cpp
wangziqi2013/Android-Dalvik-Analysis
c22e48cffd0af84febe9796afa9598b7c4e976c7
[ "Apache-2.0" ]
null
null
null
src/dex/inst.cpp
wangziqi2013/Android-Dalvik-Analysis
c22e48cffd0af84febe9796afa9598b7c4e976c7
[ "Apache-2.0" ]
1
2019-06-15T02:57:45.000Z
2019-06-15T02:57:45.000Z
#include "inst.h" namespace wangziqi2013 { namespace android_dalvik_analysis { namespace dex { /* * BuildInst() - Fills the opcode and the address of the instruction * * The return value is the new data pointer. Offset could be computed using * the starting address of the code segment */ uint8_t *BuildInst(uint32_t addr, uint8_t *data_p, InstInfo *info_p) { info_p->op = *data_p; info_p->addr = addr; // We use this to receive arguments ArgumentPack arg_pack; InstFormat format = bytecode_type_list[info_p->op]; data_p = op_jump_table[format](&arg_pack, data_p); // For 0x00 we need to do some special processing because // it may be a data bearing instruction, and if it is the case // we need to jump over the data either // // Also note that since data_p already contains the first two bytes // of the opcode we do not need to advance data_p to jump over them // here, so there is a "-2" term for every switch if(info_p->op == 0x00) { dbg_printf("opcode = 0x00 - Either nop or data bearing instruction\n"); switch(arg_pack.xx) { case 0x01: { uint16_t size = EncodingUtility::Get16Bit(data_p); data_p += (size * 4 + 8 - 2); break; } case 0x02: { uint16_t size = EncodingUtility::Get16Bit(data_p); data_p += (size * 8 + 4 - 2); break; } case 0x03: { uint16_t width = EncodingUtility::Get16Bit(data_p); uint32_t size = EncodingUtility::Get32Bit(data_p + 2); // If the data payload is of odd size then we must round it up // to an even number data_p += ((((width * size + 1) >> 1) << 1) + 8 - 2); break; } default: { break; } // default } // switch } // if return data_p; } } } }
27.469697
75
0.620518
wangziqi2013
375874543e19c087fa3046111ddf0f636b1debad
322
cpp
C++
05. Matrix/02 Sum/ColWiseSum.cpp
samdev-py/100DaysOfCode
b0d96e42aeb657902153434c6a7ec8aec265f461
[ "MIT" ]
6
2021-10-30T10:18:11.000Z
2021-12-27T17:25:30.000Z
05. Matrix/02 Sum/ColWiseSum.cpp
samdev-py/Data-Structures-and-algorithms
b0d96e42aeb657902153434c6a7ec8aec265f461
[ "MIT" ]
null
null
null
05. Matrix/02 Sum/ColWiseSum.cpp
samdev-py/Data-Structures-and-algorithms
b0d96e42aeb657902153434c6a7ec8aec265f461
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; void printColSum(int arr[][3], int row, int col) { cout << "The Column Sum: " << endl; for (col = 0; col < 3; col++) { int sum = 0; for (row = 0; row < 3; row++) { sum += arr[row][col]; } cout << sum << endl; } }
20.125
48
0.447205
samdev-py
375b79c9a86d3106c753b0f4d41ae7d6014772a9
329
cc
C++
ctci/5.2_binary_to_string.cc
sservulo/programming-challenges
65a872c96ab5cda347c0ee6b6742a07d55ba9d33
[ "Apache-2.0" ]
null
null
null
ctci/5.2_binary_to_string.cc
sservulo/programming-challenges
65a872c96ab5cda347c0ee6b6742a07d55ba9d33
[ "Apache-2.0" ]
null
null
null
ctci/5.2_binary_to_string.cc
sservulo/programming-challenges
65a872c96ab5cda347c0ee6b6742a07d55ba9d33
[ "Apache-2.0" ]
null
null
null
#include<iostream> using namespace std; string doubleToString(double num){ string s = ""; while(num > 0){ if(s.size() >= 32){return "ERROR";} num *= 2; s += num >= 1 ? "1" : "0"; num -= num >= 1 ? 1 : 0; } return s; } int main(){ double num = 0.5; cout << doubleToString(num) << endl; return 0; }
16.45
39
0.528875
sservulo
375bc1d302d0377dc2250e4b16d042c88e17ee26
1,991
cpp
C++
viandanti/src/ofApp.cpp
npisanti/np-sketches
256203d73c8bedecc106157841e048731a7ab50a
[ "MIT" ]
1
2019-05-08T17:01:46.000Z
2019-05-08T17:01:46.000Z
viandanti/src/ofApp.cpp
npisanti/np-sketches
256203d73c8bedecc106157841e048731a7ab50a
[ "MIT" ]
null
null
null
viandanti/src/ofApp.cpp
npisanti/np-sketches
256203d73c8bedecc106157841e048731a7ab50a
[ "MIT" ]
null
null
null
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ gui.setup("panel", "settings.xml", ofGetWidth()-220, 20 ); gui.add( travelers.parameters ); gui.add( color.set("color", ofColor(255, 80, 80), ofColor(0), ofColor(255)) ); ofBackground(0); ofSetWindowTitle( "mouse controlled traveler" ); } //-------------------------------------------------------------- void ofApp::update(){ travelers.update(); } //-------------------------------------------------------------- void ofApp::draw(){ ofSetColor( color ); travelers.draw(); gui.draw(); } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ travelers.move( x, y ); } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ travelers.enter(); travelers.move( x, y ); } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ travelers.move( x, y ); travelers.exit(); } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ }
24.280488
82
0.347062
npisanti
3760ae21c8ed2abe24e7ae81da66709e9d1d1e0e
2,373
cpp
C++
005-equalization/equalization.cpp
the-other-mariana/image-processing-algorithms
f88d6d9f6e2257bec0b1fe707ec22c4124bdd384
[ "MIT" ]
9
2021-01-28T22:21:16.000Z
2022-03-03T20:16:45.000Z
005-equalization/equalization.cpp
the-other-mariana/image-processing-algorithms
f88d6d9f6e2257bec0b1fe707ec22c4124bdd384
[ "MIT" ]
null
null
null
005-equalization/equalization.cpp
the-other-mariana/image-processing-algorithms
f88d6d9f6e2257bec0b1fe707ec22c4124bdd384
[ "MIT" ]
1
2021-07-18T08:57:20.000Z
2021-07-18T08:57:20.000Z
#include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include <iostream> #include <cmath> using namespace std; using namespace cv; int main() { int arr[256] = { 0 }; float arr2[256] = { 0 }; float arr3[256] = { 0 }; Mat image = imread("trees.jpg", CV_LOAD_IMAGE_GRAYSCALE); for (int i = 0; i < image.rows; i++) { for (int j = 0; j < image.cols; j++) { int index = (int)(image.at<uchar>(i, j)); arr[index]++; } } int max = 0; for (int i = 0; i < 255; i++) { if (arr[i] > max) { max = arr[i]; } } int height = image.rows; int width = image.cols; Mat myMat1(height, width, CV_8U, Scalar(0)); Mat histog(750, 750, CV_8U, Scalar(0)); int inc = 750 / 256; // original image histogram for (int i = 0; i < 255; i++) { rectangle(histog, Point(inc * i, histog.rows), Point((inc*(i + 1) - 1), histog.rows - ((arr[i] * histog.rows) / (max))), Scalar(255, 255, 255, 0), CV_FILLED); } //-- PMF float total = image.cols*image.rows; for (int i = 0; i < 255; i++) { arr2[i] = float(arr[i]) / total; } arr3[0] = arr2[0]; //-- CDF for (int i = 1; i < 255; i++) { arr3[i] = arr2[i] + arr3[i - 1]; } for (int i = 0; i < image.rows; i++) { for (int j = 0; j < image.cols; j++) { myMat1.at<uchar>(i, j) = floor((256 - 1)*arr3[image.at<uchar>(i, j)]); } } // histogram equalized image int h2[256] = { 0 }; for (int i = 0; i < myMat1.rows; i++) { for (int j = 0; j < myMat1.cols; j++) { int index = (int)(myMat1.at<uchar>(i, j)); h2[index]++; } } int maxH2 = 0; for (int i = 0; i < 255; i++) { if (h2[i] > maxH2) { maxH2 = h2[i]; } } Mat histog2(750, 750, CV_8U, Scalar(0)); inc = 750 / 256; // histogram equalized image for (int i = 0; i < 255; i++) { rectangle(histog2, Point(inc * i, histog2.rows), Point((inc*(i + 1) - 1), histog2.rows - ((h2[i] * histog2.rows) / (maxH2))), Scalar(255, 255, 255, 0), CV_FILLED); } namedWindow("Original Image", WINDOW_AUTOSIZE); imshow("Original Image", image); namedWindow("Histogram Original Image", WINDOW_AUTOSIZE); imshow("Histogram Original Image", histog); namedWindow("Histogram Equalized Image", WINDOW_AUTOSIZE); imshow("Histogram Equalized Image", histog2); namedWindow("Equalized Image", WINDOW_AUTOSIZE); imshow("Equalized Image", myMat1); waitKey(0); }
20.282051
165
0.585335
the-other-mariana
376581b25525deacf94b5e57d952d4caff20b7ae
486
cpp
C++
ackermann_ekf/src/ackermann_ekf_node.cpp
OssianEriksson/autonomous-twizy
d78e352c37dd4b2dcdd588b89e2bedb665e7175e
[ "Apache-2.0" ]
8
2021-03-18T21:49:43.000Z
2022-03-14T20:23:16.000Z
ackermann_ekf/src/ackermann_ekf_node.cpp
OssianEriksson/autonomous-twizy
d78e352c37dd4b2dcdd588b89e2bedb665e7175e
[ "Apache-2.0" ]
1
2021-04-04T20:25:34.000Z
2021-04-04T20:31:07.000Z
ackermann_ekf/src/ackermann_ekf_node.cpp
OssianEriksson/autonomous-twizy
d78e352c37dd4b2dcdd588b89e2bedb665e7175e
[ "Apache-2.0" ]
null
null
null
/** * @file ackermann_ekf_node.cpp * * @brief ROS node for sensor fusion using EKF based on Ackermann steering model * * @author Ossian Eriksson \<ossiane@student.chalmers.se\> */ #include "ackermann_ekf/sensor_array.h" #include <ros/ros.h> int main(int argc, char **argv) { ros::init(argc, argv, "ackermann_ekf"); ros::NodeHandle nh; ros::NodeHandle nh_private("~"); ackermann_ekf::SensorArray sensor_array(nh, nh_private); ros::spin(); return 0; }
20.25
80
0.679012
OssianEriksson
3766f65844cad48fcc4334bef5b61517063f7886
78
cpp
C++
test_package/example.cpp
sintef-ocean/conan-netcdf-c
7807ca2b743cfcd2b087bc9da950b05cf35ee5a3
[ "MIT" ]
null
null
null
test_package/example.cpp
sintef-ocean/conan-netcdf-c
7807ca2b743cfcd2b087bc9da950b05cf35ee5a3
[ "MIT" ]
1
2020-06-24T15:02:32.000Z
2020-06-24T15:02:32.000Z
test_package/example.cpp
sintef-ocean/conan-netcdf-c
7807ca2b743cfcd2b087bc9da950b05cf35ee5a3
[ "MIT" ]
null
null
null
#include <iostream> #include "netcdf.h" int main() { nc_inq_libvers(); }
11.142857
21
0.641026
sintef-ocean
376708cc4f0b1b35f45dc74e960d152b5223a1b6
854
cpp
C++
10703.cpp
felikjunvianto/kfile-uvaoj-submissions
5bd8b3b413ca8523abe412b0a0545f766f70ce63
[ "MIT" ]
null
null
null
10703.cpp
felikjunvianto/kfile-uvaoj-submissions
5bd8b3b413ca8523abe412b0a0545f766f70ce63
[ "MIT" ]
null
null
null
10703.cpp
felikjunvianto/kfile-uvaoj-submissions
5bd8b3b413ca8523abe412b0a0545f766f70ce63
[ "MIT" ]
null
null
null
#include <cstdio> #include <iostream> #include <algorithm> #include <string> using namespace std; int total,bawah,samping,n,x,y,z,kasus; int x1,x2,y1,y2; int peta[550][550]; int main() { kasus=0; do { scanf("%d %d %d",&samping,&bawah,&n); if(samping == 0) break; scanf("\n"); kasus++; total=samping*bawah; for(z=0;z<n;z++) { scanf("%d %d %d %d",&x1,&y1,&x2,&y2); for(y=min(y1,y2);y<=max(y1,y2);y++) for(x=min(x1,x2);x<=max(x1,x2);x++) if(peta[x][y] != kasus) { peta[x][y] = kasus; total--; } } switch(total) { case 0: printf("There is no empty spots.\n"); break; case 1: printf("There is one empty spot.\n"); break; default:printf("There are %d empty spots.\n",total); break; } } while(samping != 0); return 0; }
17.791667
64
0.522248
felikjunvianto
3767e93c4b093e02df6d37a0caebb926404eb729
681
cpp
C++
solutions-PAT/A1005.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
1
2022-02-26T10:33:24.000Z
2022-02-26T10:33:24.000Z
solutions-PAT/A1005.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
null
null
null
solutions-PAT/A1005.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
1
2021-12-01T14:54:33.000Z
2021-12-01T14:54:33.000Z
#include <iostream> #include <cstring> #define MAXN 105 using namespace std; int main() { char number[MAXN], trans[10][7] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; scanf("%s", number); int len = strlen(number), sum = 0; for (int i = 0; i < len; i++) sum += number[i] - '0'; // due to the sum < 1000, there is no need to calculate the digit of var. sum if (0 <= sum && sum <= 9) printf("%s", trans[sum]); if (10 <= sum && sum <= 99) printf("%s %s", trans[sum/10], trans[sum%10]); if (100 <= sum && sum <= 999) printf("%s %s %s", trans[sum/100], trans[sum/10%10], trans[sum%10]); return 0; }
35.842105
119
0.54185
Ki-Seki
3769ec2ab96b5d2e4a3719d381e405a675d07bc5
1,313
hpp
C++
boost/network/protocol/http/message/header/value.hpp
antoinelefloch/cpp-netlib
5eb9b5550a10d06f064ee9883c7d942d3426f31b
[ "BSL-1.0" ]
3
2015-02-10T22:08:08.000Z
2021-11-13T20:59:25.000Z
include/boost/network/protocol/http/message/header/value.hpp
waTeim/boost
eb3850fae8c037d632244cf15cf6905197d64d39
[ "BSL-1.0" ]
1
2018-08-10T04:47:12.000Z
2018-08-10T13:54:57.000Z
include/boost/network/protocol/http/message/header/value.hpp
waTeim/boost
eb3850fae8c037d632244cf15cf6905197d64d39
[ "BSL-1.0" ]
5
2017-12-28T12:42:25.000Z
2021-07-01T07:41:53.000Z
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 // Copyright 2010 Dean Michael Berris. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <utility> namespace boost { namespace network { namespace http { struct request_header_narrow; struct request_header_wide; struct response_header_narrow; struct response_header_wide; template <class T1, class T2> T1 & value(std::pair<T1,T2> const & p) { return p.second; } inline request_header_narrow::string_type const & value(request_header_narrow const & h) { return h.value; } inline request_header_wide::string_type const & value(request_header_wide const & h) { return h.value; } inline response_header_narrow::string_type const & value(response_header_narrow const & h) { return h.value; } inline response_header_wide::string_type const & value(response_header_wide const & h) { return h.value; } } /* http */ } /* network */ } /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 */
25.745098
74
0.708302
antoinelefloch
376a6dad0a17b41abfe64db72cd74e5167b63e16
11,676
cc
C++
src/pong.cc
tomredant/winpong
f5ef70852be4e1161dc5e8eeb8bc309571c20763
[ "MIT", "Unlicense" ]
null
null
null
src/pong.cc
tomredant/winpong
f5ef70852be4e1161dc5e8eeb8bc309571c20763
[ "MIT", "Unlicense" ]
null
null
null
src/pong.cc
tomredant/winpong
f5ef70852be4e1161dc5e8eeb8bc309571c20763
[ "MIT", "Unlicense" ]
null
null
null
// Copyright [2015] <Chafic Najjar> #include "src/pong.h" #include <iostream> #include "src/ball.h" #include "src/paddle.h" #include "src/utilities.h" #include <QFile> #include <QDir> // Screen resolution. const int Pong::SCREEN_WIDTH = 640; const int Pong::SCREEN_HEIGHT = 480; Pong::Pong(int argc, char *argv[]) { // Intialize SDL. SDL_Init(SDL_INIT_EVERYTHING); // Don't show cursor. SDL_ShowCursor(0); // Create window and renderer. window = SDL_CreateWindow("Winpong", SDL_WINDOWPOS_UNDEFINED, // Centered window. SDL_WINDOWPOS_UNDEFINED, // Centered window. SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); // Instantiate game objects. ball = new Ball(SCREEN_WIDTH/2-ball->LENGTH/2, SCREEN_HEIGHT/2-ball->LENGTH/2); left_paddle = new Paddle(40, SCREEN_HEIGHT/2-Paddle::HEIGHT/2); right_paddle = new Paddle(SCREEN_WIDTH-(40+Paddle::WIDTH), SCREEN_HEIGHT/2-Paddle::HEIGHT/2); // Sounds. // Initialize SDL_mixer. Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024); // Load paddle sound. QFile paddleHitFile(":/resources/sounds/paddle_hit.wav"); QString paddleHitFilePath = QDir::temp().absolutePath() + "/" + paddleHitFile.fileName().split("/").last(); paddleHitFile.copy(paddleHitFilePath); paddle_sound = Mix_LoadWAV(paddleHitFilePath.toUtf8().constData()); // Load wall sound. QFile wallHitFile(":/resources/sounds/wall_hit.wav"); QString wallHitFilePath = QDir::temp().absolutePath() + "/" + wallHitFile.fileName().split("/").last(); wallHitFile.copy(wallHitFilePath); wall_sound = Mix_LoadWAV(wallHitFilePath.toUtf8().constData()); // Load score_update sound. QFile scoreUpdateFile(":/resources/sounds/score_update.wav"); QString scoreUpdateFilePath = QDir::temp().absolutePath() + "/" + scoreUpdateFile.fileName().split("/").last(); scoreUpdateFile.copy(scoreUpdateFilePath); score_sound = Mix_LoadWAV(scoreUpdateFilePath.toUtf8().constData()); // Controllers. if (argc == 2) { if ( strcmp(argv[1], "keyboard") == 0 ) { controller = keyboard; } else if ( strcmp(argv[1], "joystick") == 0 ) { controller = joystick; } else { controller = mouse; } } else { controller = mouse; // Default controller. } if (controller == joystick) { printf("%i joysticks were found.\n\n", SDL_NumJoysticks() ); printf("The names of the joysticks are:\n"); // Give control to the first joystick. gamepad = SDL_JoystickOpen(0); for (int i = 0; i < SDL_NumJoysticks(); i++) { std::cout << "\t" << SDL_JoystickName(gamepad) << std::endl; } // Initialize joystick controller. SDL_JoystickEventState(SDL_ENABLE); gamepad_direction = 0; } // Fonts. TTF_Init(); // Initialize font. font_color = {255, 255, 255, 255}; font_name = ":/resources/fonts/NES-Chimera/NES-Chimera.ttf"; font_image_launch = renderText("Press SPACE to start", font_name, font_color, 16, renderer); // Scores. left_score = 0; right_score = 0; // Indicates when rendering new score is necessary. left_score_changed = true; // Indicates when rendering new score is necessary. right_score_changed = true; // Game status. exit = false; // Initialize potentially non-used pointers to nullptr. font_image_winner = nullptr; font_image_restart = nullptr; } Pong::~Pong() { // Destroy textures. SDL_DestroyTexture(font_image_left_score); SDL_DestroyTexture(font_image_right_score); if(font_image_winner != nullptr) SDL_DestroyTexture(font_image_winner); if(font_image_restart != nullptr) SDL_DestroyTexture(font_image_restart); SDL_DestroyTexture(font_image_launch); // Free sound effects. Mix_FreeChunk(paddle_sound); Mix_FreeChunk(wall_sound); Mix_FreeChunk(score_sound); // Quit SDL_mixer. Mix_CloseAudio(); // Close joystick. if (controller == joystick) { SDL_JoystickClose(gamepad); } // Destroy renderer and window. SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); // Shuts down SDL. SDL_Quit(); } void Pong::execute() { while (!exit) { input(); update(); render(); SDL_Delay(10); } } void Pong::input() { // Handle events. SDL_Event event; while (SDL_PollEvent(&event)) { // Track mouse movement. if (event.type == SDL_MOUSEMOTION) { SDL_GetMouseState(&mouse_x, &mouse_y); } // Clicking 'x' or pressing F4. if (event.type == SDL_QUIT) { exit = true; } // Joystick direction controller moved. if (event.type == SDL_JOYAXISMOTION) { // 32767. // Up or down. if (event.jaxis.axis == 1) { gamepad_direction = event.jaxis.value/5461; } } // Joystick action button pressed. if (event.type == SDL_JOYBUTTONDOWN) { if (ball->status == ball->READY) { ball->status = ball->LAUNCH; } } // Pressing a key. if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { // Pressing ESC exits from the game. case SDLK_ESCAPE: exit = true; break; // Pressing space will launch the ball if it isn't // already launched. case SDLK_SPACE: if (ball->status == ball->READY) { ball->status = ball->LAUNCH; } break; // Pressing F11 to toggle fullscreen. case SDLK_F11: int flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, 0); } else { SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); } break; } } } } // Update game values. void Pong::update() { // Paddle movement. if (controller == mouse) { // Right paddle follows the player's mouse on the y-axis. right_paddle->set_y(mouse_y); } else if (controller == joystick) { // Right paddle follows the player's gamepad. right_paddle->add_to_y(gamepad_direction); } // AI paddle movement. left_paddle->AI(ball); // Launch ball. if (ball->status == ball->READY) { return; } else if (ball->status == ball->LAUNCH) { ball->launch_ball(left_paddle); ball->predicted_y = left_paddle->predict(ball); } // Update ball speed. ball->update_speed(); // Collision. if (ball->collides_with(left_paddle)) { ball->bounces_off(left_paddle); Mix_PlayChannel(-1, paddle_sound, 0); // Play collision sound. } else if (ball->collides_with(right_paddle)) { ball->bounces_off(right_paddle); // Predict ball position on the y-axis. ball->predicted_y = left_paddle->predict(ball); Mix_PlayChannel(-1, paddle_sound, 0); } // Upper and bottom walls collision. if (ball->wall_collision()) { ball->dy *= -1; // Reverse ball direction on y-axis. Mix_PlayChannel(-1, wall_sound, 0); // Play collision sound. } // Update ball coordinates. ball->x += ball->dx; ball->y += ball->dy; // Ball goes out. if (ball->x > SCREEN_WIDTH || ball->x < 0) { // Change score. if (ball->x > SCREEN_WIDTH) { left_score++; left_score_changed = true; } else { right_score++; right_score_changed = true; } Mix_PlayChannel(-1, score_sound, 0); ball->reset(); } } // Render objects on screen. void Pong::render() { // Clear screen (background color). SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); // Dark grey. SDL_RenderClear(renderer); // Paddle color. SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); // Render filled paddle. SDL_Rect paddle1 = { left_paddle->get_x(), left_paddle->get_y(), Paddle::WIDTH, Paddle::HEIGHT }; SDL_RenderFillRect(renderer, &paddle1); // Render filled paddle. SDL_Rect paddle2 = { right_paddle->get_x(), right_paddle->get_y(), Paddle::WIDTH, Paddle::HEIGHT }; SDL_RenderFillRect(renderer, &paddle2); // Render ball. SDL_Rect pong_ball = { ball->x, ball->y, ball->LENGTH, ball->LENGTH }; SDL_RenderFillRect(renderer, &pong_ball); // Render scores. if (left_score_changed) { font_image_left_score = renderText(std::to_string(left_score), font_name, font_color, 24, renderer); left_score_changed = false; if (left_score == 5) { font_image_winner = renderText("Player 1 won!", font_name, font_color, 24, renderer); font_image_restart = renderText("Press SPACE to restart", font_name, font_color, 14, renderer); } } renderTexture(font_image_left_score, renderer, SCREEN_WIDTH * 4 / 10, SCREEN_HEIGHT / 12); int score_font_size = 24; if (right_score_changed) { font_image_right_score = renderText(std::to_string(right_score), font_name, font_color, score_font_size, renderer); right_score_changed = false; if (right_score == 5) { font_image_winner = renderText("Player 2 won!", font_name, font_color, 24, renderer); font_image_restart = renderText("Press SPACE to restart", font_name, font_color, 14, renderer); } } renderTexture(font_image_right_score, renderer, SCREEN_WIDTH * 6 / 10 - score_font_size/2, SCREEN_HEIGHT/ 12); // Render text indicating the winner. if (left_score == 5) { // Align with score. renderTexture(font_image_winner, renderer, SCREEN_WIDTH * 1 / 10 + 3, SCREEN_HEIGHT / 4); renderTexture(font_image_restart, renderer, SCREEN_WIDTH * 1 / 10 + 3, SCREEN_HEIGHT / 3); if (ball->status == ball->LAUNCHED) { left_score = 0; right_score = 0; left_score_changed = true; right_score_changed = true; } } else if (right_score == 5) { // Align with score. renderTexture(font_image_winner, renderer, SCREEN_WIDTH * 6 / 10 - score_font_size/2, SCREEN_HEIGHT / 4); renderTexture(font_image_restart, renderer, SCREEN_WIDTH * 6 / 10 - score_font_size/2, SCREEN_HEIGHT / 3); if (ball->status == ball->LAUNCHED) { left_score = 0; right_score = 0; left_score_changed = true; right_score_changed = true; } } else if (ball->status == ball->READY) { // Draw "Press SPACE to start". renderTexture(font_image_launch, renderer, SCREEN_WIDTH / 2 - 160, SCREEN_HEIGHT - 30); } // Swap buffers. SDL_RenderPresent(renderer); }
30.970822
115
0.583248
tomredant
376e05ab6f756be8b5f358b871a73f9280c63f69
241
cpp
C++
Game/Client/WXClient/Network/PacketHandler/CGBankAcquireListHandler.cpp
hackerlank/SourceCode
b702c9e0a9ca5d86933f3c827abb02a18ffc9a59
[ "MIT" ]
4
2021-07-31T13:56:01.000Z
2021-11-13T02:55:10.000Z
Game/Client/WXClient/Network/PacketHandler/CGBankAcquireListHandler.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
null
null
null
Game/Client/WXClient/Network/PacketHandler/CGBankAcquireListHandler.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
7
2021-08-31T14:34:23.000Z
2022-01-19T08:25:58.000Z
#include"stdafx.h" #include "CGBankAcquireList.h" uint CGBankAcquireListHandler::Execute( CGBankAcquireList* pPacket, Player* pPlayer ) { __ENTER_FUNCTION return PACKET_EXE_CONTINUE ; __LEAVE_FUNCTION return PACKET_EXE_ERROR ; }
15.0625
85
0.788382
hackerlank
3770e938bd3b5625a683d08d300b429be254d11e
3,166
cpp
C++
modules/task_2/korobeinikov_a_batcher_radix_sort/main.cpp
allnes/pp_2022_spring
159191f9c2f218f8b8487f92853cc928a7652462
[ "BSD-3-Clause" ]
null
null
null
modules/task_2/korobeinikov_a_batcher_radix_sort/main.cpp
allnes/pp_2022_spring
159191f9c2f218f8b8487f92853cc928a7652462
[ "BSD-3-Clause" ]
null
null
null
modules/task_2/korobeinikov_a_batcher_radix_sort/main.cpp
allnes/pp_2022_spring
159191f9c2f218f8b8487f92853cc928a7652462
[ "BSD-3-Clause" ]
2
2022-03-31T17:48:22.000Z
2022-03-31T18:06:07.000Z
// Copyright 2022 Korobeinikov Alexandr #include <gtest/gtest.h> #include<omp.h> #include<iostream> #include "./ParallelRadixSort.h" TEST(RadixSort, SimpleCase_1) { std::vector<double> vec = { 1.123, 1.111, -1.1, -2.313, 34.23 }; std::vector<double> vec1(vec); RadixSort(0, vec.size() - 1, &vec); std::sort(vec1.begin(), vec1.end()); ASSERT_EQ(vec, vec1); } TEST(RadixSort, SimpleCase_2) { std::vector<double> vec = getRandomVector(10, -100, 100); std::vector<double> vec1(vec); RadixSort(0, vec.size() - 1, &vec); std::sort(vec1.begin(), vec1.end()); ASSERT_EQ(vec, vec1); } TEST(RadixSort, NegativeAndPositiveCase_1) { std::vector<double> vec = getRandomVector(1000, -100, 100); std::vector<double> vec1(vec); RadixSort(0, vec.size() - 1, &vec); std::sort(vec1.begin(), vec1.end()); ASSERT_EQ(vec, vec1); } TEST(RadixSort, NegativeAndPositiveCase_2) { std::vector<double> vec = getRandomVector(100000, -100, 100); std::vector<double> vec1(vec); RadixSort(0, vec.size() - 1, &vec); std::sort(vec1.begin(), vec1.end()); ASSERT_EQ(vec, vec1); } TEST(ParallelRadixSort, SimpleCase) { std::vector<double> vec = { 1.123, 1.111, -1.1, -2.313, 34.23 }; std::vector<double> vec1(vec); RadixSortParallel(&vec); std::sort(vec1.begin(), vec1.end()); ASSERT_EQ(vec, vec1); } TEST(ParallelRadixSort, NegativeAndPositiveCase_1) { std::vector<double> vec = getRandomVector(10000, -100, 100); std::vector<double> vec1(vec); std::vector<double> vec2(vec); double t1, t2; t1 = omp_get_wtime(); RadixSort(0, vec1.size() - 1, &vec1); t2 = omp_get_wtime(); std::cout << "Time_Seq: " << t2 - t1 << "\n"; t1 = omp_get_wtime(); RadixSortParallel(&vec2); t2 = omp_get_wtime(); std::cout << "Time_Parallel: " << t2 - t1 << "\n"; std::sort(vec.begin(), vec.end()); ASSERT_EQ(vec, vec2); } TEST(ParallelRadixSort, NegativeAndPositiveCase_2) { std::vector<double> vec = getRandomVector(100000, -100, 100); std::vector<double> vec1(vec); std::vector<double> vec2(vec); double t1, t2; t1 = omp_get_wtime(); RadixSort(0, vec1.size() - 1, &vec1); t2 = omp_get_wtime(); std::cout << "Time_Seq: " << t2 - t1 << "\n"; t1 = omp_get_wtime(); RadixSortParallel(&vec2); t2 = omp_get_wtime(); std::cout << "Time_Parallel: " << t2 - t1 << "\n"; std::sort(vec.begin(), vec.end()); ASSERT_EQ(vec, vec2); } TEST(ParallelRadixSort, NegativeAndPositiveCase_3) { std::vector<double> vec = getRandomVector(1000000, -100, 100); std::vector<double> vec1(vec); std::vector<double> vec2(vec); double t1, t2; t1 = omp_get_wtime(); RadixSort(0, vec1.size() - 1, &vec1); t2 = omp_get_wtime(); std::cout << "Time_Seq: " << t2 - t1 << "\n"; t1 = omp_get_wtime(); RadixSortParallel(&vec2); t2 = omp_get_wtime(); std::cout << "Time_Parallel: " << t2 - t1 << "\n"; std::sort(vec.begin(), vec.end()); ASSERT_EQ(vec, vec2); } int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
26.605042
68
0.610234
allnes
3778022c92ed20985cce66298dbb5d285c8c6842
19,247
cc
C++
tests/neuron_support_code_threshold/neuron_support_code_threshold_CODE/synapseUpdate.cc
9inpachi/genn-opencl
33231225a72611c7b629ef1d13f325f35d4ae2f7
[ "MIT" ]
1
2020-06-28T19:48:48.000Z
2020-06-28T19:48:48.000Z
tests/neuron_support_code_threshold/neuron_support_code_threshold_CODE/synapseUpdate.cc
9inpachi/genn-opencl
33231225a72611c7b629ef1d13f325f35d4ae2f7
[ "MIT" ]
1
2020-02-10T15:26:29.000Z
2020-02-10T15:26:29.000Z
tests/neuron_support_code_threshold/neuron_support_code_threshold_CODE/synapseUpdate.cc
9inpachi/genn-opencl
33231225a72611c7b629ef1d13f325f35d4ae2f7
[ "MIT" ]
1
2020-02-10T10:47:12.000Z
2020-02-10T10:47:12.000Z
#include "definitionsInternal.h" #include "supportCode.h" extern "C" const char* updateSynapsesProgramSrc = R"(typedef float scalar; void atomic_add_f_global(volatile __global float *source, const float operand) { union { unsigned int intVal; float floatVal; } newVal; union { unsigned int intVal; float floatVal; } prevVal; do { prevVal.floatVal = *source; newVal.floatVal = prevVal.floatVal + operand; } while (atomic_cmpxchg((volatile __global unsigned int *)source, prevVal.intVal, newVal.intVal) != prevVal.intVal); } __kernel void updatePresynapticKernel(__global unsigned int* d_glbSpkCntpre, __global unsigned int* d_glbSpkpre, __global float* d_inSynsyn0, __global float* d_inSynsyn1, __global float* d_inSynsyn2, __global float* d_inSynsyn3, __global float* d_inSynsyn4, __global float* d_inSynsyn5, __global float* d_inSynsyn6, __global float* d_inSynsyn7, __global float* d_inSynsyn8, __global float* d_inSynsyn9, __global scalar* d_wsyn0, __global scalar* d_wsyn1, __global scalar* d_wsyn2, __global scalar* d_wsyn3, __global scalar* d_wsyn4, __global scalar* d_wsyn5, __global scalar* d_wsyn6, __global scalar* d_wsyn7, __global scalar* d_wsyn8, __global scalar* d_wsyn9, __global scalar* d_xpre, volatile unsigned int spkQuePtrpre, float t) { const size_t localId = get_local_id(0); const unsigned int id = get_global_id(0); __local unsigned int shSpk[32]; // syn0 if(id < 32) { const unsigned int preReadDelaySlot = spkQuePtrpre; const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (id < 10) { unsigned int synAddress = (shSpk[j] * 10) + id; d_wsyn0[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (id < 10) { d_inSynsyn0[id] += linSyn; } } // syn1 if(id >= 32 && id < 64) { const unsigned int lid = id - 32; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 9) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn1[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn1[lid] += linSyn; } } // syn2 if(id >= 64 && id < 96) { const unsigned int lid = id - 64; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 8) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn2[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn2[lid] += linSyn; } } // syn3 if(id >= 96 && id < 128) { const unsigned int lid = id - 96; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 7) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn3[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn3[lid] += linSyn; } } // syn4 if(id >= 128 && id < 160) { const unsigned int lid = id - 128; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 6) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn4[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn4[lid] += linSyn; } } // syn5 if(id >= 160 && id < 192) { const unsigned int lid = id - 160; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 5) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn5[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn5[lid] += linSyn; } } // syn6 if(id >= 192 && id < 224) { const unsigned int lid = id - 192; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 4) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn6[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn6[lid] += linSyn; } } // syn7 if(id >= 224 && id < 256) { const unsigned int lid = id - 224; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 3) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn7[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn7[lid] += linSyn; } } // syn8 if(id >= 256 && id < 288) { const unsigned int lid = id - 256; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 2) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn8[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn8[lid] += linSyn; } } // syn9 if(id >= 288 && id < 320) { const unsigned int lid = id - 288; const unsigned int preReadDelaySlot = ((spkQuePtrpre + 1) % 10); const unsigned int preReadDelayOffset = preReadDelaySlot * 10; // only do this for existing neurons float linSyn = 0; { const size_t localIdi = get_local_id(0); const unsigned int numSpikes = d_glbSpkCntpre[preReadDelaySlot]; const unsigned int numSpikeBlocks = (numSpikes + 32 - 1) / 32; for (unsigned int r = 0; r < numSpikeBlocks; r++) { const unsigned int numSpikesInBlock = (r == numSpikeBlocks - 1) ? ((numSpikes - 1) % 32) + 1 : 32; barrier(CLK_LOCAL_MEM_FENCE); if (localIdi < numSpikesInBlock) { const unsigned int spk = d_glbSpkpre[preReadDelayOffset + (r * 32) + localIdi]; shSpk[localIdi] = spk; } barrier(CLK_LOCAL_MEM_FENCE); // loop through all incoming spikes for (unsigned int j = 0; j < numSpikesInBlock; j++) { // only work on existing neurons if (lid < 10) { unsigned int synAddress = (shSpk[j] * 10) + lid; d_wsyn9[synAddress]= d_xpre[preReadDelayOffset + shSpk[j]];} } } } // only do this for existing neurons if (lid < 10) { d_inSynsyn9[lid] += linSyn; } } } )"; // Initialize the synapse update kernel(s) void updateSynapsesProgramKernels() { updatePresynapticKernel = cl::Kernel(updateSynapsesProgram, "updatePresynapticKernel"); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(0, d_glbSpkCntpre)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(1, d_glbSpkpre)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(2, d_inSynsyn0)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(3, d_inSynsyn1)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(4, d_inSynsyn2)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(5, d_inSynsyn3)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(6, d_inSynsyn4)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(7, d_inSynsyn5)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(8, d_inSynsyn6)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(9, d_inSynsyn7)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(10, d_inSynsyn8)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(11, d_inSynsyn9)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(12, d_wsyn0)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(13, d_wsyn1)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(14, d_wsyn2)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(15, d_wsyn3)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(16, d_wsyn4)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(17, d_wsyn5)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(18, d_wsyn6)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(19, d_wsyn7)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(20, d_wsyn8)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(21, d_wsyn9)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(22, d_xpre)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(23, spkQuePtrpre)); } void updateSynapses(float t) { { CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(23, spkQuePtrpre)); CHECK_OPENCL_ERRORS(updatePresynapticKernel.setArg(24, t)); const cl::NDRange globalWorkSize(320, 1); const cl::NDRange localWorkSize(32, 1); CHECK_OPENCL_ERRORS(commandQueue.enqueueNDRangeKernel(updatePresynapticKernel, cl::NullRange, globalWorkSize, localWorkSize)); CHECK_OPENCL_ERRORS(commandQueue.finish()); } }
46.602906
734
0.561802
9inpachi
37817cf292cc5388ef2dd4c7f77a7e99a49c5e1c
4,437
cpp
C++
src/3rdparty/kjs/src/kjs/identifier.cpp
afarcat/QtHtmlView
fff12b6f5c08c2c6db15dd73e4f0b55421827b39
[ "Apache-2.0" ]
null
null
null
src/3rdparty/kjs/src/kjs/identifier.cpp
afarcat/QtHtmlView
fff12b6f5c08c2c6db15dd73e4f0b55421827b39
[ "Apache-2.0" ]
null
null
null
src/3rdparty/kjs/src/kjs/identifier.cpp
afarcat/QtHtmlView
fff12b6f5c08c2c6db15dd73e4f0b55421827b39
[ "Apache-2.0" ]
null
null
null
/* * This file is part of the KDE libraries * Copyright (C) 2003 Apple Computer, Inc * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #include "identifier.h" #include <wtf/FastMalloc.h> #include <wtf/HashSet.h> #include <string.h> // for strlen #include <new> // for placement new namespace KJS { typedef HashSet<UString::Rep *> IdentifierTable; static IdentifierTable *table; static inline IdentifierTable &identifierTable() { if (!table) { table = new IdentifierTable; } return *table; } bool Identifier::equal(const UString::Rep *r, const char *s) { int length = r->len; const UChar *d = r->data(); for (int i = 0; i != length; ++i) if (d[i].uc != (unsigned char)s[i]) { return false; } return s[length] == 0; } bool Identifier::equal(const UString::Rep *r, const UChar *s, int length) { if (r->len != length) { return false; } const UChar *d = r->data(); for (int i = 0; i != length; ++i) if (d[i].uc != s[i].uc) { return false; } return true; } struct CStringTranslator { static unsigned hash(const char *c) { return UString::Rep::computeHash(c); } static bool equal(UString::Rep *r, const char *s) { return Identifier::equal(r, s); } static void translate(UString::Rep *&location, const char *c, unsigned hash) { size_t length = strlen(c); UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * length)); for (size_t i = 0; i != length; i++) { d[i] = c[i]; } UString::Rep *r = UString::Rep::create(d, static_cast<int>(length)).releaseRef(); r->isIdentifier = 1; r->rc = 0; r->_hash = hash; location = r; } }; PassRefPtr<UString::Rep> Identifier::add(const char *c) { if (!c) { UString::Rep::null.hash(); return &UString::Rep::null; } if (!c[0]) { UString::Rep::empty.hash(); return &UString::Rep::empty; } return *identifierTable().add<const char *, CStringTranslator>(c).first; } struct UCharBuffer { const UChar *s; unsigned int length; }; struct UCharBufferTranslator { static unsigned hash(const UCharBuffer &buf) { return UString::Rep::computeHash(buf.s, buf.length); } static bool equal(UString::Rep *str, const UCharBuffer &buf) { return Identifier::equal(str, buf.s, buf.length); } static void translate(UString::Rep *&location, const UCharBuffer &buf, unsigned hash) { UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * buf.length)); for (unsigned i = 0; i != buf.length; i++) { d[i] = buf.s[i]; } UString::Rep *r = UString::Rep::create(d, buf.length).releaseRef(); r->isIdentifier = 1; r->rc = 0; r->_hash = hash; location = r; } }; PassRefPtr<UString::Rep> Identifier::add(const UChar *s, int length) { if (!length) { UString::Rep::empty.hash(); return &UString::Rep::empty; } UCharBuffer buf = {s, static_cast<unsigned int>(length)}; return *identifierTable().add<UCharBuffer, UCharBufferTranslator>(buf).first; } PassRefPtr<UString::Rep> Identifier::addSlowCase(UString::Rep *r) { assert(!r->isIdentifier); if (r->len == 0) { UString::Rep::empty.hash(); return &UString::Rep::empty; } UString::Rep *result = *identifierTable().add(r).first; if (result == r) { r->isIdentifier = true; } return result; } void Identifier::remove(UString::Rep *r) { identifierTable().remove(r); } } // namespace KJS
25.354286
90
0.606265
afarcat
3786b8f456e1b5fc95c201b9653f7ca95bb3105b
153
cpp
C++
src/ble/blPermission.cpp
fidoriel/track38
d3773a7ae704e460da25c5ec68e444dab82bfdc1
[ "MIT" ]
null
null
null
src/ble/blPermission.cpp
fidoriel/track38
d3773a7ae704e460da25c5ec68e444dab82bfdc1
[ "MIT" ]
null
null
null
src/ble/blPermission.cpp
fidoriel/track38
d3773a7ae704e460da25c5ec68e444dab82bfdc1
[ "MIT" ]
null
null
null
#if defined( WIN32 ) || defined( __linux__ ) #include "blPermission.h" bool bleIsAutorized() { return true; } void askForPermission() { } #endif
10.2
44
0.673203
fidoriel
3787f23976b04e86007092b401d60d613db9ba2f
641
cc
C++
controllers/download_route.cc
Rynnya/hanaru
2bfa40d9040b9b4e3b952099886dc293921a5a25
[ "MIT" ]
1
2021-12-13T10:37:30.000Z
2021-12-13T10:37:30.000Z
controllers/download_route.cc
Rynnya/hanaru
2bfa40d9040b9b4e3b952099886dc293921a5a25
[ "MIT" ]
null
null
null
controllers/download_route.cc
Rynnya/hanaru
2bfa40d9040b9b4e3b952099886dc293921a5a25
[ "MIT" ]
null
null
null
#include "download_route.hh" #include "../impl/downloader.hh" #include "../impl/utils.hh" Task<HttpResponsePtr> download_route::get(HttpRequestPtr req, int64_t id) { const auto [code, filename, content] = co_await hanaru::downloader::get().download_map(id); if (code != k200OK) { SEND_ERROR(code, content); } HttpResponsePtr response = HttpResponse::newFileResponse( reinterpret_cast<const unsigned char*>(content.data()), content.size(), filename ); response->setContentTypeCodeAndCustomString(drogon::CT_CUSTOM, "application/x-osu-beatmap-archive"); co_return response; }
26.708333
104
0.691108
Rynnya
3788372b6c8beae2f46454b97a4d243b5e547177
1,861
hpp
C++
parser/operators.hpp
CobaltXII/cxcc
2e8f34e851b3cbe6699e443fd3950d630ff170b7
[ "MIT" ]
3
2019-05-27T04:50:51.000Z
2019-06-18T16:27:58.000Z
parser/operators.hpp
CobaltXII/cxcc
2e8f34e851b3cbe6699e443fd3950d630ff170b7
[ "MIT" ]
null
null
null
parser/operators.hpp
CobaltXII/cxcc
2e8f34e851b3cbe6699e443fd3950d630ff170b7
[ "MIT" ]
null
null
null
#pragma once #include <string> // All binary operators. enum binary_operator_t { bi_addition, bi_subtraction, bi_multiplication, bi_division, bi_modulo, bi_assignment, bi_addition_assignment, bi_subtraction_assignment, bi_multiplication_assignment, bi_division_assignment, bi_modulo_assignment, bi_logical_and, bi_logical_or, bi_relational_equal, bi_relational_non_equal, bi_relational_greater_than, bi_relational_lesser_than, bi_relational_greater_than_or_equal_to, bi_relational_lesser_than_or_equal_to, bi_binary_and, bi_binary_or, bi_binary_xor, bi_binary_and_assignment, bi_binary_or_assignment, bi_binary_xor_assignment, bi_binary_left_shift, bi_binary_right_shift, bi_binary_left_shift_assignment, bi_binary_right_shift_assignment, bi_error }; // All binary operators as strings. std::string binary_operator_str[] = { "addition", "subtraction", "multiplication", "division", "modulo", "assignment", "addition assignment", "subtraction assignment", "multiplication assignment", "division assignment", "modulo assignment", "logical and", "logical or", "relational equal", "relational non-equal", "relational greater-than", "relational lesser-than", "relational greater-than or equal-to", "relational lesser-than or equal-to", "binary AND", "binary OR", "binary XOR", "binary AND assignment", "binary OR assignment", "binary XOR assignment" "binary left-shift", "binary right-shift", "binary left-shift assignment", "binary right-shift assignment" }; // All unary operators. enum unary_operator_t { un_value_of, un_arithmetic_positive, un_arithmetic_negative, un_address_of, un_logical_not, un_binary_not }; // All unary operators as strings. std::string unary_operator_str[] = { "value-of", "arithmetic positive", "arithmetic negative", "address-of", "logical NOT", "binary NOT" };
20.910112
40
0.779688
CobaltXII
3788db31a645be37bbeccd43acd7cda07ad23d4b
133,850
inl
C++
modules/aho/inl/ru/ali/StateMap.inl
JosDenysGitHub/iknow
e6a142253513ad4365d7998e36c569d4174e8248
[ "MIT" ]
49
2020-02-05T15:54:24.000Z
2022-03-03T20:10:39.000Z
modules/aho/inl/ru/ali/StateMap.inl
makorin0315/iknow
3043030d2ac83b8719471bacaabd204ebdf94be6
[ "MIT" ]
84
2020-02-06T13:09:16.000Z
2022-03-22T19:36:00.000Z
modules/aho/inl/ru/ali/StateMap.inl
makorin0315/iknow
3043030d2ac83b8719471bacaabd204ebdf94be6
[ "MIT" ]
20
2020-02-04T21:38:57.000Z
2022-02-23T20:30:13.000Z
12, 25798,16068,20404,140,3539,229,14745,10097,9525,12784,5217,8986,4804,5728,4881,5529,23602,7236,8008,26756,4270,8116,1454,7804,4690,3358,233,1012,8253,11199,612,17620,10209,10614,3940,25274,17691,56,598,91,475,283,16,317,458,52,409,78,38,594,5,1,74,262,65,26,390,524,672,157,48,219,198,2096,471,433,964,545,313,3059,26640,250,2041,8736,8481,307,60,2,520,1991,751,1859,1296,503,1249,564,486,865,1572,1269,321,101,161,12922,6020,1770,2316,1912,1682,8589,6925,12661,2319,16721,19366,20709,23623,6383,1279,11446,1677,2163,14499,3,978,3148,4,1749,16211,7767,732,16247,26093,22103,4588,12481,18139,8699,5229,15688,12259,15755,4743,13867,15817,293,17354,8043,7762,7385,275,16733,16004,9,4351,17788,176,30,12650,911,2258,715,3224,4926,12587,6540,6,6052,18198,4526,10361,3561,2180,3488,63,144,206,10385,7,8,5480,10089,6179,5563,8309,15235,9067,18083,24,5632,1167,243,550,942,7809,695,7455,5989,1170,2215,23687,1893,5502,1112,668,10,11,721,1231,2834,3109,14212,12330,8803,5450,2382,13625,5003,5905,3628,4078,5044,5618,23560,5742,7759,3501,7195,1489,2962,3468,1318,223,778,2367,11279,591,15480,9132,7158,18054,3176,16649,17906,1994,179,240,213,287,552,1594,310,188,192,842,870,20,268,13,113,216,195,787,1380,2763,1559, 119,5458,210,4294,1068,12646,1638,134,5740,1832,125,14,3231,9550,3933,13675,3879,205,44,23,15,6685,173,3578,15399,5084,4780,4193,5069,107,375,3662,1552,2720,13727,891,1664,71,815,17,3455,4848,587,82,131,21630,7012,5677,3242,936,1889,3266,8841,1904,13492,9761,11752,11112,1737,25494,10367,2286,10654,18,6932,42,2092,5408,1335,17743,3076,18592,6394,1134,1752,8109,25068,3295,14737,15705,10785,33,500,682,20172,12877,24444,6904,26731,6125,15974,858,19,20315,21,69,3521,1300,15420,5994,10834,17081,22,4098,9816,10485,1938,1255,5327,14315,3299,549,5654,9719,25845,1063,1216,445,11441,4192,3072,4952,1011,3326,25,2144,3603,17487,590,1262,4331,10495,9773,365,22626,98,23565,3837,27,428,3826,5946,6231,1562,290,11054,425,45,26218,2412,24194,16952,18319,3134,739,15089,4032,15357,5782,5391,7973,11892,9844,20281,21967,2895,6969,28,2922,5171,10009,3440,1305,5159,8641,3048,3555,16444,10182,825,1875,13482,14456,29,12735,1624,1191,1079,9516,2779,1404,31,2949,253,11251,16272,36,11684,5196,368,18534,11263,12730,3438,34,16188,22903,11905,1887,13187,12108,4547,32,17327,26488,25402,3035,16494,11557,35,19157,7646,37,6769,9670,4488,5623,20310,634,19603,17010,88,3337,832,5704,8518,2967,687,11590,1353,20706,1211,26408,9966,39,2740,626,6034,9792,7166,11805,18768,21395,1514,724,17238, 40,23956,431,2450,14474,20191,3654,4205,9101,17022,2832,7144,3593,41,5157,112,3381,8640,3258,43,4920,106,25183,3269,531,6721,46,47,3946,4461,23368,25676,259,49,1460,6584,5453,2504,5771,149,7049,14036,19953,9265,24163,8059,14078,4223,11324,22408,1162,3074,256,2446,50,4924,22817,51,786,202,1978,2802,718,2128,1185,4913,2192,528,2648,656,510,280,835,122,1036,1208,939,7959,226,684,85,25669,6439,1155,2611,53,5024,9215,3786,399,26588,21003,17400,14734,54,3023,2002,8452,14537,9990,15387,3320,55,449,2109,2560,533,576,7106,2492,360,1427,1389,5513,4358,417,57,380,137,25230,3154,383,479,128,7215,9657,2182,154,1074,5861,3378,14059,828,2005,11746,6076,5882,8605,989,4834,670,5647,10711,567,2995,17867,14067,10591,58,12214,14935,17793,59,8541,14703,14717,19656,20973,16548,1147,357,728,61,795,4303,5968,877,10251,1815,747,21495,2631,1172,13520,8105,18376,1414,8498,16397,2750,6944,9812,9335,1225,10114,62,2543,768,25905,25061,5734,64,7791,15429,3707,22122,18822,1597,4346,1538,4049,2406,404,116,354,1395,661,647,541,653,396,66,346,5974,1845,9351,2361,12194,20741,9852,2617,19334,573,18135,17186,18941,5427,184,67,1504,110,9535,1228,394,152,9841,680,10759,186,25315,8637,2232,7117,10610,164,68,374,2337,136,714,70,7145,5242,4485,2326,16225, 3962,9486,6727,3705,10399,3977,15225,1844,2647,7425,1640,4651,9326,4605,19764,26327,12087,14600,15116,13778,2973,770,1351,9385,16195,969,18783,17392,72,13222,2787,6994,2148,11904,18749,20336,12533,21514,73,324,14186,4471,9157,3574,351,3079,20211,885,8323,441,8399,75,3007,9423,2821,9969,6647,16621,7400,104,76,623,605,23002,6237,17368,5432,77,22199,5851,4199,14665,6317,8449,8069,9805,7005,16184,1328,9685,20022,11653,2732,11087,13864,300,7830,4402,1016,245,25413,973,9083,79,3491,6287,1479,2463,2781,4616,7623,22555,16903,25850,914,182,13767,1138,25370,80,1570,918,562,16170,13313,4682,6074,166,24726,20613,81,7545,14952,11618,22567,26264,16393,5144,24616,171,2031,9304,8219,5508,2671,4136,83,6437,20862,18644,5279,4536,25357,11683,3290,84,3693,1240,20640,1337,2217,8786,2061,24281,2030,26228,7585,10103,12322,3638,86,3923,21748,13992,1857,11433,1714,3857,6342,372,8229,10071,87,23891,3958,3700,6320,9924,12407,15251,7021,11101,1646,1149,4432,3421,1579,2584,22017,5446,89,21720,11954,12175,4130,17432,24647,3313,7379,5963,18126,90,559,4171,18508,16110,5083,15679,1199,4072,5876,92,9462,9447,17668,95,7943,1049,4542,146,4932,2277,845,8813,538,1883,1778,2605,7083,5040,18893,1099,13147,3822,18330,2931,1283,2126,8243,21124,13074,928,5864,24623,17952,1332,6089,93,3102,12062,501,8901,18205,22871,1720,2696, 8235,9089,20769,94,988,6504,18382,26648,6546,6934,8897,7245,961,18109,25497,2155,2709,96,1412,1750,630,6640,4687,23290,24502,7771,97,14958,24732,16303,26245,8286,9631,7073,10271,407,99,2343,3645,571,18416,1848,17294,2442,12327,14921,100,2947,738,12987,16551,18480,20495,10359,7266,14437,11855,3452,2028,641,8294,848,900,5780,5833,168,102,388,16223,18016,10069,1392,9506,19174,11166,238,2751,103,3954,444,1061,4507,16975,170,23461,8137,105,10896,4435,21295,25258,12716,8505,22763,4695,12841,26563,108,14709,4929,25516,109,8760,15171,13474,5016,7924,8806,111,1178,2700,15910,18972,7506,8523,10504,23332,5760,7104,9716,8535,13754,1334,14698,11310,2893,13616,114,1790,7030,1949,2514,6151,5240,791,4508,6278,115,4705,8272,9607,4978,271,19184,26223,14775,19543,922,5776,15515,342,4540,26561,117,11386,2911,10123,3015,299,1521,118,2010,1317,16154,10193,4172,20962,18568,24582,569,1097,2140,6115,16884,120,8569,16459,16414,121,8969,6708,13828,2197,10336,123,7075,3139,3807,8874,16717,3384,20586,124,9819,19917,26040,22606,19114,11832,21909,17553,26523,3027,17954,18238,10498,12939,127,10622,6393,1304,4146,165,12061,9451,2310,11084,15550,1327,126,1819,2853,22228,2634,1207,191,1299,9323,3710,11587,7135,4124,15643,12908,14149,4534,129,1136,14153,22385,19198,5996,2048,2226,11500,2581,24512,2178,208,3779,26570,6254,14726,130,7130,23591, 2518,1622,2243,3181,2390,12546,5491,6456,14953,5052,4901,4879,132,16704,6496,4859,3200,902,133,13608,26044,6789,135,14622,23424,9212,8191,6507,10454,1986,13923,6350,2934,138,8233,420,439,1609,3161,13984,5570,19460,1652,15833,9332,20337,13583,24621,24595,239,708,1174,2267,25935,11245,5200,7481,10937,17730,7680,6941,2603,3508,139,25350,17915,18152,19230,21206,18734,20078,23851,363,6268,437,4875,3517,2694,16345,1616,873,266,5556,4291,616,2077,278,1667,1081,2115,4382,14711,8557,16027,142,25172,7305,8181,13152,4082,21557,143,21561,145,10330,17190,2074,147,5357,793,24460,7915,148,13295,4600,10898,6956,150,151,12586,15086,3531,25975,8980,17178,153,2149,4723,618,2410,15982,4233,156,4606,1556,3951,1433,16269,22592,5922,8471,2103,158,18537,11348,16692,9426,772,24550,3252,159,3277,16052,3124,518,6826,9373,17521,14389,2954,1131,160,1409,2297,3559,10045,19030,6689,651,3987,6006,2253,4125,5893,3025,1006,162,11141,875,7133,16395,10266,16678,26538,20600,25816,4702,14789,7002,25542,2076,18932,23858,15163,10127,3998,17594,163,15739,8458,167,169,22949,7591,3352,172,237,6270,19283,14425,10958,7038,24211,23753,19391,19982,16639,19639,8878,18762,8478,2673,607,1673,1960,10575,9453,1252,766,1696,4670,1973,452,1241,174,1179,1125,1797,3696,10082,9227,7880,4242,20813,5493,26498,8036,7449,3997,13819,9248,298,175,13988,21176,1813, 12659,4099,402,3010,177,23632,21100,454,916,650,178,3515,1183,7333,5651,415,8332,1635,180,5319,3323,7352,181,10179,1691,2385,183,3170,11768,15664,13895,185,13170,16724,23769,16293,1316,12520,296,2831,676,15785,17843,14526,20422,17434,187,3966,5955,21893,1467,10797,338,8396,4415,4619,22356,305,22107,189,801,2083,621,10909,838,7883,190,25161,4938,248,4385,20969,20064,10684,4861,17728,8114,193,2423,7125,3417,21055,2453,12622,24239,14466,1866,582,333,11634,17100,1399,4212,194,24885,21132,7597,196,7907,1214,5820,13321,1238,1356,11488,3245,11726,6078,23341,10102,10960,197,15749,6110,14761,13643,4601,199,1115,9357,8716,10987,12010,14418,19910,1557,3463,1693,8346,1086,21150,12635,200,10620,10943,3967,16569,24485,17672,19105,23617,19506,25265,13581,22038,14700,19478,12653,4569,16668,26163,26050,9285,2986,340,2352,1302,6511,8305,1004,328,1783,3550,2737,303,1205,203,1140,1072,3694,4075,9019,11802,8430,5675,24661,2207,14539,8047,6534,3141,12955,9466,255,204,12761,13515,207,9122,11047,625,209,4472,6947,6556,4582,1820,23597,774,20810,1800,3805,18240,8247,13941,16427,211,6601,5384,1488,18511,212,10870,2100,4464,9732,4185,5438,15694,1611,22923,214,1009,10662,3613,215,3494,20202,968,497,7174,1918,20010,730,4244,344,23816,3817,2993,26400,1658,3143,797,2425,5334,557,2037,889,11600,217,1047,8193,16250,12198,3256,16838, 8951,19862,6509,218,26221,3513,5986,792,258,11771,26203,24689,6372,220,2727,4787,4673,15984,8861,16782,8146,12496,16481,11011,13821,9741,13496,3284,10865,7593,4147,14592,11239,221,5269,26194,17924,23745,22324,222,3101,16022,15807,16876,6157,10149,18257,224,16962,7309,5261,19470,22979,225,25397,23034,26509,6876,9611,15455,25760,24141,12420,227,9943,2951,22727,228,3910,8066,22439,23401,19956,21828,230,23938,12941,3730,7061,231,7848,5138,5388,21746,2768,3292,2589,10328,7209,883,2659,495,3247,1265,2135,9044,16659,10732,13566,8836,2524,6459,18019,17992,5205,16461,12624,23217,12433,11248,16878,17203,5141,15578,6396,9523,9431,20200,13246,26013,232,12425,13059,8527,23934,14848,20470,18352,17267,2693,12569,19205,4844,19752,7419,21250,11677,10312,234,16845,9412,13194,22733,25386,235,236,21025,241,15486,6025,7488,18684,2370,6638,1291,3793,1590,5942,3915,469,7492,722,462,4235,17580,6897,1274,13397,9628,11164,12460,12758,11229,16966,15754,19196,17961,8225,14559,5736,18384,18651,10191,2592,4711,13073,22586,21954,6644,3765,2842,1123,2064,9622,14663,3989,3640,910,7480,2914,1555,769,506,864,242,1053,4722,8497,9337,5018,3776,12592,3547,26557,22350,244,5872,8074,3121,1416,2662,13257,498,632,13414,1226,10052,20507,10030,25654,246,25543,247,13108,20860,26336,16515,17751,15936,3382,3563,249,11238,8260,7020,5724,3936,10540,4946,24548,3276,14872,11887,16776,11929,25773, 7575,16702,25158,14327,13236,12898,2516,697,2568,2230,4529,4777,1027,1160,1402,3678,3202,467,1217,251,1093,959,2956,5671,10967,9298,11134,6072,9511,3497,14267,8911,3722,16874,11221,334,252,12065,13359,254,9510,15766,12591,14110,257,19888,2027,10679,20665,7676,4637,24735,20203,22279,19125,3020,23113,11776,4447,22474,10747,260,7347,14422,6558,7533,7087,26262,17821,9653,261,8893,12129,25278,17997,335,8054,6056,272,12216,464,3905,25249,855,7035,13792,3234,3543,263,13333,2394,330,5637,1471,7701,17703,5999,2173,1643,14014,3990,19499,22208,22719,23771,4237,264,2761,1360,3955,7566,14086,998,2089,6742,4565,1795,4325,9387,6945,12906,931,2431,6064,6699,2238,9231,7461,18886,24713,9008,1071,5158,6235,265,1811,9171,8726,21955,3458,1281,10148,25565,7695,7360,8651,1003,20622,18959,267,6839,9025,10969,5372,579,24806,3723,808,10782,11620,3461,12764,1703,1219,349,952,269,5931,5277,5155,2920,13835,15130,270,11504,1932,2905,11711,2280,5592,2936,1254,12722,7838,3671,3878,15430,16732,17819,9615,26243,273,16239,12976,23904,8162,15042,16938,26365,274,1145,6998,6620,10116,7871,2071,5769,2421,8779,4127,11401,2438,4163,13274,4635,276,3057,5167,4316,3949,6251,17828,4580,13804,5795,6280,13454,20419,10931,277,5305,15011,10325,13490,13580,4213,15398,14042,297,279,15533,25239,2295,1152,2448,18600,281,282,15871,11143,7834,20950,19462,446,3683,7242, 6521,325,4767,8667,1566,7412,284,2403,2480,812,3054,690,422,10950,2622,8832,5379,13456,21939,17007,5008,15725,6339,10332,12718,4000,11505,6220,285,15021,1807,4363,1041,7059,288,8991,666,699,7977,21660,8288,289,1502,3411,13425,11224,3130,749,907,11327,14949,6327,6463,1881,6984,1202,516,8337,10601,291,12856,3601,1407,1367,4595,23386,26649,1575,6482,18658,11555,859,24272,9156,292,9932,8251,359,25693,736,2485,2906,5713,6366,9926,6923,6122,21532,4405,7230,21097,1628,585,2550,3798,26596,1641,1910,1045,7607,6790,3038,3570,840,7052,8515,294,295,12419,17357,4020,1788,2807,7439,18631,13600,6739,3851,301,370,4801,2167,8339,6865,6906,13361,5721,3728,4311,3001,12988,726,10369,302,19766,22632,15591,16989,17043,16837,3034,304,677,10215,6060,23951,306,8153,4829,4094,11086,5537,13592,3180,20553,8076,23184,7715,16100,6948,8503,13118,2688,5887,1267,15417,3735,2854,308,1508,9272,3259,26117,609,2293,2711,1744,309,4491,17680,8852,26449,7992,311,12490,6900,2979,11931,12162,945,7549,8998,19497,455,4720,1787,6961,2883,25283,15080,25421,312,7044,2196,3413,25396,1951,4366,3884,4327,24378,11298,15736,5420,5102,314,3485,4748,4288,948,6803,897,7799,1825,4501,14894,5813,1841,4760,20395,10567,7634,1142,4067,13666,19164,23166,5289,2472,24358,18569,15355,860,21259,24253,17556,17589,13501,8284,17765,12526,6187,315,2011,3063,9193, 10753,2085,781,2997,4852,5072,482,2142,536,2730,2263,4794,9000,13775,17442,8052,7887,24541,6729,17175,316,17411,26184,9047,20196,15537,13801,13466,2828,20880,19071,6974,5430,4412,11959,803,318,2427,16191,1468,13079,7151,11230,12775,3128,9310,16818,15241,15062,22268,13889,7233,19571,319,16769,2849,1512,5934,13541,14597,320,3420,12617,15988,26685,7112,10686,15322,10751,16155,1920,15997,14331,322,12098,5685,18962,2553,18463,1345,5757,976,13354,6189,4974,4638,4263,16896,9896,1708,7845,2725,323,19523,8381,6852,11363,14169,17275,6704,18326,12881,23649,954,3193,1195,7441,326,13912,9700,378,4631,3335,23746,1901,11868,7577,327,6186,11734,1988,10913,26646,10723,4143,329,25216,18591,2868,3205,6134,1630,3433,6470,17599,12863,3718,9578,15587,331,22060,332,22588,6498,3820,4817,490,706,18067,3309,11632,1365,1001,8454,4598,1176,903,2959,1088,9702,23987,1536,1020,5207,2222,336,13010,18081,3835,14814,4424,25967,19437,12014,16313,13765,15548,16134,23484,18955,10476,18810,12608,18228,21364,14101,16710,9343,19261,24804,21717,5875,3150,701,3514,971,6977,11829,2990,1608,2102,5737,2409,925,826,339,2023,544,1661,2864,7128,11187,13127,6017,17938,6682,19587,14309,341,15373,18949,5662,12578,11027,19621,13375,20727,8943,1705,17380,12114,3846,19795,2417,2958,20689,26598,702,664,1175,343,20047,3419,6297,345,18640,1370,22120,22864,16205,5088,25400,347,6159,12919,6193, 24391,26259,6450,5181,24118,920,9021,348,5442,10595,6605,19259,9575,18994,350,11991,8218,23021,18359,15013,11051,4280,22425,7370,352,16698,19145,2723,4057,11788,2433,1108,353,1970,23669,7496,9957,9006,3742,355,1197,806,1712,14796,24539,25793,1169,24148,356,20365,3374,20796,20583,13891,14031,3087,361,18467,362,6937,13725,489,364,13635,21503,15852,20733,19374,18027,4276,2331,3188,12782,799,13253,4102,21771,25133,11911,1129,2419,2805,742,19185,5792,19136,366,5752,3611,6785,8678,17763,15711,8297,3004,5805,17210,3893,25468,9577,10042,367,369,9308,10101,19733,7312,1896,11300,4621,1760,371,24002,6279,5286,373,6635,11133,3725,20243,6298,9030,386,1387,12888,6266,6902,3262,1362,3028,22609,376,2625,13771,16441,12253,7519,13750,8002,21375,377,20850,379,10546,1114,25202,5414,18764,6148,3282,5825,12858,21944,3117,381,9929,7938,23406,8602,15619,19590,11551,9668,382,2548,3153,15238,25479,25342,14672,17862,23781,23946,2555,15545,25808,16030,10049,7748,5311,12484,8807,5763,1631,21262,21409,384,2579,2067,6207,15868,15204,14605,5340,7403,385,15562,15981,665,984,387,22860,22473,389,11335,2261,2713,8929,9441,4572,2639,5331,3635,391,1723,2528,10463,19984,2925,1058,2563,4397,2348,2754,1064,5079,9737,7601,1446,1964,513,1547,18659,25206,26074,392,3926,9867,5717,3533,8107,18073,13953,3597,17145,6466,9356,19256,393,22578,17731,2358,26001,21671,2661,19699, 17234,3329,6814,5627,2978,11749,20387,18609,917,14519,3507,395,25188,25582,9243,10461,397,4376,2836,4758,5253,5162,7201,22450,15758,11409,14906,14588,1034,398,7633,26691,17248,13412,4113,784,400,759,2748,6706,4061,2595,888,10779,8079,14147,21422,457,1496,403,1776,456,22341,22889,17967,10605,16035,15912,13688,1544,405,21280,5607,4394,15441,4756,7040,1450,4495,12639,4368,13877,14494,4627,20617,406,408,2535,3704,6039,9315,775,3959,19988,6274,16351,15267,20384,8171,11983,410,9708,23975,7457,12871,413,411,6301,18217,5281,2389,414,20635,8470,9509,25592,23742,416,16236,5423,18639,3300,5749,17188,4558,8099,980,4510,25027,3495,418,12138,6816,1288,16887,3280,3840,14961,3110,7642,8064,4286,7088,419,14258,6986,13568,16424,711,13089,421,8103,7146,423,1421,424,22024,25895,426,1258,3598,3228,1499,18471,10580,5873,21810,22315,25461,14235,18791,4387,5790,19169,11212,4870,17455,427,7528,1441,7265,1953,4265,22535,18268,2256,956,2303,15821,508,16144,2784,12106,13155,5544,8120,3386,7689,8796,10322,10832,4421,6710,2500,15396,4949,13060,429,11345,1781,430,7616,18150,1775,432,1109,3701,9056,13404,14080,8564,1525,10490,756,11060,602,434,2668,17384,22546,4840,4255,8030,1090,14729,3375,435,993,438,20825,18329,9208,13684,12548,9999,19221,25139,14427,2830,10451,20515,7295,24135,22875,2899,3790,20920,26362,440,9149,18227,25632,2466,25018,10000,4301, 10805,3016,14184,12346,4990,11595,25812,2374,442,3036,5444,11613,1606,761,2587,10393,5696,14574,7913,4792,5132,7218,1465,11160,443,1324,1278,755,26430,13342,3096,2614,1862,4029,14454,3355,4122,17137,7110,7975,1373,447,24429,1510,7136,13041,7091,6040,14839,10197,23527,23911,16926,11404,18804,448,10908,10373,19994,9395,9744,3367,14579,15703,18738,16571,25590,19140,26214,13066,19750,9810,20882,25787,16600,4059,16564,25419,20059,15872,3098,450,2810,2281,8720,9981,1981,560,2890,6244,4037,639,2300,484,2171,1907,1675,10439,12391,15339,12819,7161,25326,4282,24986,10470,451,17879,24660,6642,16335,19204,23680,19365,26296,12956,2667,17755,14393,4314,23152,24989,3670,453,1128,13346,6813,22184,8061,7850,492,8202,1829,10828,2117,5725,21061,3066,14380,3364,2013,852,459,22944,4979,17771,2716,24858,16089,1164,4481,10309,460,23361,13472,7500,13226,23193,6239,16282,26754,11268,12427,22230,24696,461,13401,23729,12325,463,16553,11627,9916,3727,15308,11002,3446,7303,7435,10695,3474,4197,3762,2558,465,16176,2875,2775,12200,14477,5810,4578,991,1494,11183,7604,12168,1025,5701,7796,9042,12409,6781,1989,14656,23363,6646,2809,7485,754,2134,9281,4500,6892,2418,3523,1915,466,2055,16951,9188,10682,468,703,7249,8152,22336,2435,19616,14962,1569,3390,470,14334,2246,11257,5419,5682,3472,15194,1449,8650,14279,1321,4679,5827,5866,1763,14280,6081,1120,11641,22614,2274,12256,1338, 472,13747,5346,7706,4226,1956,643,7416,4676,13996,2887,6573,8450,473,474,11997,13003,15525,12341,763,10370,1188,5958,1518,17466,2131,18694,12422,476,1619,24096,3158,477,1310,25778,5621,637,11067,619,15239,7156,2053,9185,17546,8630,5351,1260,555,2339,15847,22329,24375,25846,20937,25261,8555,5585,3537,944,3467,2091,17525,9120,2251,1350,1485,4955,2511,1453,827,478,1442,507,2786,2682,6532,6583,11933,6847,8334,8849,14461,16009,15257,21760,13470,3964,7028,11411,6513,1817,5410,3791,3350,480,5307,16309,11657,18064,1746,21006,5626,7004,3511,481,6430,1755,947,4836,6310,16615,1975,12348,483,1546,13478,8474,11361,4095,19697,11254,523,485,12749,23055,1343,678,1761,4230,18811,4430,3527,25290,18391,7933,9126,4024,4733,11014,487,6377,23197,488,7405,19312,9790,10694,491,3853,11783,10326,7393,2999,13852,5175,6691,26524,493,6779,2399,1584,6359,11341,7547,1655,24234,11857,659,17479,4770,5103,9941,3512,494,7847,19597,21604,12670,4411,21209,16046,496,629,10609,499,13663,21617,25821,23893,2633,10542,26107,18898,16109,17185,502,504,2000,20130,3046,26226,18975,5847,4012,15660,14385,22307,22231,16536,15735,20185,24197,22641,9504,16893,783,4221,4022,1106,3753,1929,17212,6403,4509,909,1736,5903,2652,2825,1124,581,2513,505,2970,8944,5321,17378,8686,6672,15100,5475,17174,6264,23229,9633,15255,13925,20822,509,5092,21819,15069,1095,511,905,514, 13416,21484,23727,16321,19504,24162,16809,8882,12838,515,517,3168,14030,11163,16212,7531,2455,24579,519,8424,9860,10315,521,7297,6895,5641,2158,712,9059,7956,21651,583,1463,10056,8460,1689,10914,1400,8739,12118,24754,1773,4516,25624,522,5643,3996,8680,10281,20218,9151,23415,7369,2490,7902,3864,2872,3504,12158,525,13440,21624,11664,5122,5690,24472,6679,526,13690,693,1385,2593,19921,2627,529,5215,24381,6211,530,8802,10011,16114,532,26210,26258,11681,22200,22644,10636,5485,534,10063,15368,25474,8742,11155,535,8317,10784,5456,18366,12287,646,537,17216,7868,539,4731,24427,7460,16798,540,13479,2675,7225,11458,542,3344,4717,10339,23359,15221,23941,14523,543,12443,13272,1618,2292,4177,13026,26732,15044,13508,4811,18034,16611,11136,25987,13266,5210,20522,546,13721,3040,1474,5506,8169,13069,16596,14762,547,551,2953,5161,23719,10067,553,3855,13338,14371,7064,2165,3552,26693,3137,15361,13391,21764,12538,556,11057,2574,1008,611,3509,3006,12373,19413,1605,7985,6652,16955,735,6632,8374,558,4954,5369,2629,11077,11270,561,26623,22431,4014,4083,7994,9252,3706,12271,8320,25226,5127,18635,24801,16000,4649,22834,5547,4330,563,3745,2372,15776,5576,2933,5586,14239,17502,23344,5495,7587,12746,1221,1531,1984,11373,7377,1933,733,16785,25752,1444,25940,20268,26650,16317,565,7263,6921,15302,3980,22735,24580,24666,868,566,1542,5956,14828,930,2575,20052,23836,18881, 5265,568,8101,10176,19010,2341,26238,570,17087,572,5803,9791,2157,2017,3294,574,2346,2601,24120,21254,19904,7820,12895,8176,19404,26032,12394,7711,575,10032,4160,11408,21755,5120,2859,2536,9515,6365,1084,2137,1257,5766,1375,4370,7069,14192,21010,23354,11156,17675,26349,16115,19213,19178,2478,10301,11484,4552,1104,6165,577,2151,5054,18069,12628,1864,19926,3689,12817,14375,578,5484,1151,2430,25716,12558,2262,11448,1230,12076,7516,2170,580,3484,5982,25758,26132,705,1232,5239,1754,3614,19028,5917,584,13812,1290,4951,12179,8913,20474,1962,586,20348,1418,14221,3479,25305,12780,588,7979,2314,7769,14808,1325,1870,3353,9249,20262,6959,1947,3206,11686,2354,7032,4936,11785,8004,11235,2160,5897,8757,18071,3409,12667,15320,13126,23206,24746,1371,10008,23077,10584,22825,21889,2190,14257,589,17111,26679,592,14313,19073,12381,22951,995,2537,19798,6311,1741,19600,11743,595,985,10341,8507,5655,1766,1031,3782,8126,2816,2443,13216,10223,24998,8000,11981,13315,24599,2307,4392,1872,23881,21178,5568,862,3297,596,4027,7618,13399,7287,10894,5059,7164,24830,597,5605,7659,4663,12675,1942,22422,4513,21126,1851,15637,4910,822,599,2240,3604,3271,1436,2106,1246,4893,1700,600,6659,12641,10395,3766,16421,10555,601,13591,5404,23609,4931,7027,3111,10879,5317,709,5224,603,23763,1398,1804,1358,604,19705,3405,1159,2557,1234,3874,11852,19345,704,19420,7946,12480,4252, 13833,7611,13044,606,1733,4400,7947,2204,6875,5394,17499,8915,608,12313,5645,10551,8496,20602,11097,25852,11826,1999,16742,3107,3091,22683,2840,7570,610,5199,19381,26575,613,18856,20832,13367,23048,615,25969,617,963,8448,1204,21011,8051,20388,15957,620,18401,3903,7388,1443,6980,2069,22317,622,3592,1963,10410,11022,882,5640,2252,5912,8057,9168,1604,8180,15041,1035,624,5108,12411,3747,3939,19687,8187,2894,9777,3241,14611,3304,6863,7539,23843,21332,19003,627,8560,6752,15557,6480,5554,7652,8028,1945,21397,9166,628,7406,22996,5266,12995,13707,26555,17407,17328,9722,631,20878,19526,633,11001,16743,3434,3913,5839,14463,2507,3348,6516,14723,13930,17067,11287,17217,7189,6712,13409,635,2677,8866,11172,7693,20188,12861,7794,5543,20837,4899,636,1406,6868,14348,19400,13827,17315,638,22749,5098,640,1052,9029,9911,26583,4232,642,22090,7356,9892,25546,644,3372,7557,22998,7247,24862,6750,5759,1528,5398,2393,19274,17964,3631,1685,2826,4611,3092,2796,1439,645,1756,790,4373,4365,6055,16949,12082,10900,21305,11209,14063,4108,2440,926,3585,2777,8096,23634,2039,7397,14859,6575,12283,1458,8292,15827,648,6385,19083,5325,2265,15003,8936,18022,25766,20828,649,13116,652,10024,18418,11946,6767,654,4624,5313,8921,657,8648,1802,12092,8709,5852,11535,22480,2531,2138,4783,26114,7919,15719,11078,15325,18716,26722,22030,13160,658,16179,13014,8663,662,23611,12104, 16516,4887,19972,663,11369,18737,9053,20560,4729,22748,667,3100,6392,2309,25848,15851,3127,683,3642,19969,4278,5581,1730,5302,19783,20104,669,7650,11944,671,9476,11228,24441,15771,1420,16249,10961,1237,10786,16759,23857,7522,22718,673,5599,26198,10994,2703,8418,24793,25694,9175,11871,6344,744,1422,5949,7755,16262,18641,12539,11993,2401,3908,3754,21466,15477,2387,1383,3581,3894,3896,1739,2942,674,2188,2900,6581,6290,9618,19821,8529,11838,25059,13530,16792,9740,7275,12324,1295,675,15939,12451,14660,681,18451,12944,6002,20948,20994,3993,4962,2544,14741,685,3477,1029,14980,3499,17650,16252,22992,12446,880,18273,686,14163,10799,3802,5338,9637,20885,1056,688,8257,18024,1039,9137,7949,4190,11430,14177,1022,11940,17375,14224,13716,21774,8298,10790,4151,24988,689,896,24349,11853,9735,9691,12902,691,692,14144,24536,18349,16941,22653,21238,18996,22016,18759,25170,15565,4785,5402,1000,3957,2739,12605,14830,4492,1272,2234,7433,3890,1759,1359,694,3711,1067,4047,4613,9704,16160,16455,7789,19858,8186,18704,3973,15498,26361,696,9565,25322,16628,22250,698,12664,19206,6323,10250,9113,25353,12559,24590,9674,1874,19082,2586,2685,11333,2746,9650,11709,9871,15791,700,8240,24134,3442,8770,4857,1019,17288,1024,2162,707,15179,24950,21353,24633,958,10145,8594,15050,710,2491,831,3069,924,17628,19296,2597,2913,3437,713,20621,16021,15101,8870,11688,16019,8213,12143,24448,3720, 716,717,16869,24611,14047,719,11762,22165,15567,14616,10352,18004,12607,5248,9046,15547,720,6670,723,24706,11389,25970,725,7513,727,16038,26716,13423,17346,17630,731,10933,23139,6762,1850,734,4355,2033,14678,14673,12618,5406,9082,13141,15793,13174,17029,21069,18706,17542,17177,24498,19900,20284,24089,13033,15470,22721,17707,16076,16486,14551,25738,11713,4142,1287,4942,2379,12699,16260,5153,2360,2908,9287,3825,2036,1543,737,2871,951,2334,4374,10706,22014,17779,10979,20603,6469,13680,18154,1043,1102,2218,9050,6701,740,1916,934,14024,3861,10810,11492,3340,19399,10522,743,13309,10541,21735,5646,16014,3399,745,8963,4039,26700,4727,17658,6128,7841,15125,7016,5101,7626,746,5797,4589,24845,23226,6475,2679,9107,23950,18263,26106,2185,1516,6815,14362,13897,1372,7861,4307,5735,748,13714,19832,25807,750,3133,5371,2566,9764,10884,7917,6544,9255,11554,8141,25439,13886,3274,752,8017,820,9234,25227,753,5441,1452,13773,26384,757,8199,18426,15914,7808,9977,762,21494,1983,7109,894,25904,22420,19333,12750,8612,9786,23394,6419,9661,13214,12517,764,12022,8282,9391,21239,11486,19789,16065,3919,17208,765,3342,22956,5786,767,18102,21683,3113,4871,3868,4063,3554,11588,8719,23962,26580,9549,17308,6931,1331,15824,5945,771,12835,20759,17476,23910,773,13705,15428,25492,21541,8071,21725,26103,26482,17277,20027,15949,21210,21116,8215,19362,776,10445,9241,1792,5006,2599,23593,9180,2635, 810,1935,6745,4214,1431,2483,818,3346,1314,4864,12288,7490,11866,7017,6951,15958,8674,21217,17990,20843,10841,8067,16374,23663,8610,9608,21468,11421,12057,10774,3632,16415,8817,3811,779,6824,6155,780,19561,25959,13427,8876,782,23826,23448,4504,6127,7589,6070,6759,11636,23930,11319,10002,19581,14485,20548,26751,23072,15026,23100,14188,19469,19527,13046,10701,10808,23109,26584,8528,5057,933,6258,2860,12621,16368,5472,895,3237,7560,4101,1430,1633,785,3778,972,5116,5336,12537,18306,19577,11907,23122,7865,16349,6101,11469,3862,5362,4614,25642,2498,16311,2983,10791,5293,4138,3013,2644,788,6696,17347,1425,11812,9421,19443,1707,25365,6808,789,794,5140,7779,1501,19891,6894,2863,23759,1394,16618,3483,796,8198,2025,8767,17854,7254,1937,11617,1600,798,19222,7670,7580,10850,1663,7150,800,13715,13240,18864,13117,24941,5573,22059,802,9108,11550,4724,3623,22918,1577,804,14973,2937,8788,13769,10066,805,26749,8790,807,5464,23388,13662,25485,17103,25364,13614,4820,809,21387,811,18819,5202,5991,6973,3841,11436,7277,6472,1118,2050,26412,9675,17243,7898,5151,813,3084,21184,7269,2008,850,15825,4922,13097,7289,14583,814,20120,8950,23043,17072,17183,3043,2272,5001,5649,21836,816,15097,7940,7723,6873,11560,18386,1680,3952,11675,1785,22234,10165,21670,14722,6446,817,19139,13146,15551,7301,4837,19892,9648,869,819,19302,15745,19618,21297,12698,821,5935,12866,18673,3899, 9592,8089,14164,9324,13756,4867,19743,823,14674,3070,15811,2707,12278,824,21037,15867,879,15154,22046,829,1223,830,9623,16929,1535,1054,2289,3146,19210,2186,3173,5908,13881,25193,13039,2773,13513,13498,5540,14564,18441,6099,9890,4217,833,2376,18775,2812,1698,5500,16468,25878,7839,22977,3132,834,14353,9937,12378,1710,12815,4740,1181,17564,13549,836,12893,18362,9376,6885,20222,15030,837,10228,10072,8113,4183,14368,22771,841,2070,2125,15203,20591,2224,843,9225,7184,19736,2915,17641,6412,2477,13088,12697,24900,8023,17527,5533,844,5548,3481,2436,4708,24123,7335,2202,2094,1529,1329,3032,13347,1809,6012,846,6553,3832,1533,4685,6443,3426,3321,3318,9582,14209,17490,6890,12766,847,13168,15409,3624,3741,19576,849,21349,851,853,7962,4455,7541,21505,5477,9482,10819,20035,8781,4560,10941,12688,3428,12181,854,9111,21319,26515,4622,17146,16329,2488,9458,2757,5808,4715,10132,2236,1839,7630,4209,13004,856,2609,3391,15384,2146,2789,2199,23899,26091,7750,13307,3330,12740,8909,9797,3213,14441,23902,857,16579,19849,25728,16187,7904,16767,1349,1794,25978,1085,8888,23264,863,17871,13845,5121,2345,8494,9147,12173,1588,18280,24192,11175,4985,2686,8850,1497,866,2123,3082,10459,11824,4452,8793,3769,5538,10234,3264,3089,22205,26721,867,10469,22824,17136,2653,982,1997,6597,1968,871,7330,3847,20717,11546,19626,1834,3328,21152,872,14360,4200,7169,7372,4888,10401, 11543,10346,874,21762,21492,25051,5061,8341,5587,7093,5468,8750,4548,876,10708,14201,5925,7925,878,14359,19104,881,13949,15406,10635,17135,884,2047,12177,2879,886,1586,11454,8312,11378,24102,15502,4618,15270,887,8571,4742,890,4321,2058,1307,2220,24048,14113,25943,892,16848,25523,7494,7486,6296,893,10837,8659,898,2201,23679,899,901,5027,21253,23762,18023,11710,12611,16472,18545,5918,20854,18670,21186,904,16523,19260,10084,17911,908,11048,20497,19864,10136,912,6171,3737,1483,20667,6124,1601,913,14882,915,3780,5510,4196,14205,21935,12495,2195,3201,22467,6262,10901,919,9869,13533,5998,17601,13968,4900,4989,15532,19931,1482,25690,3819,22572,921,22963,5387,16729,18578,12736,17456,2333,13086,14760,11575,25612,14208,24918,19108,923,2706,8136,10911,7783,927,10710,4730,21465,5129,16810,25554,6818,3261,929,8154,25683,7551,16902,26674,7343,20846,8749,10530,19582,2330,932,22599,11080,19380,935,10946,11568,7857,937,8884,3969,10582,25780,19671,938,14990,4961,6714,5590,8408,7192,940,17919,18317,9604,21952,1285,8094,12047,941,9518,22639,4016,14598,21192,1062,15795,3005,18143,11928,943,18159,12207,22037,4274,949,22374,14118,2684,950,25303,5899,13485,22503,14816,19701,953,2512,24371,1777,1876,7423,11980,17640,955,3758,6500,22407,3781,15092,4866,7389,7727,3756,10820,13575,960,5694,6775,1286,4420,14077,15431,22937,962,24262,15710,24688,6140,10354,13280,10741,20597,2209, 5983,17615,6693,15375,18394,965,5978,10660,4956,21567,966,10737,967,23183,3209,4921,1369,5798,4810,23535,25505,970,19607,26213,23925,18618,7120,14443,12810,4877,11515,10578,6562,18453,26204,974,23726,1348,2861,977,6236,4110,18992,2591,12441,14018,2567,1679,8540,5034,17532,6324,979,10755,12748,24361,2112,1583,10789,2255,3666,983,2578,8145,24113,21246,2018,1312,1726,10882,23917,10623,22152,8830,8087,13594,986,2228,6859,6336,1835,22737,15033,14019,4816,14977,987,12255,10245,24348,990,9331,12620,20780,15590,14173,3746,11751,19215,25118,992,6524,9769,21019,11701,13159,1440,25408,994,11159,10088,24263,24107,11246,26689,7696,21578,19396,7780,16279,18750,8799,1930,4497,4505,19054,10174,2576,1243,3971,6247,6502,1581,1867,996,3733,3311,8270,10276,17332,15743,14533,6357,26661,8941,15349,11646,7349,20446,17398,1282,997,14287,999,16624,23442,4555,3872,5602,23994,22852,7742,12531,1193,9284,2946,5857,3306,1706,2540,1002,2380,5593,15678,22969,24440,1005,22179,15461,13296,11347,22293,12350,15201,6761,1007,9139,1010,11432,12772,1748,22744,21438,10388,22988,22521,10012,9537,11509,16500,14363,4308,21193,8977,3814,1013,18245,9014,1014,24981,24003,14160,18892,13842,1015,11370,10502,5457,1021,6669,4752,3416,11609,6718,20530,16503,7055,11375,25271,1023,17586,11053,12321,15531,24057,11851,9794,5700,4571,1026,6062,16556,1028,21531,14480,19870,7227,12965,4375,1158,1892,15765,1133,1030,9935,18500, 7399,25186,13604,18173,6954,8237,2885,2856,7786,1032,14963,2988,13241,5849,6856,10431,23249,9849,1293,1376,13050,17558,8903,7094,1256,1033,3771,5719,8932,2759,11741,1077,1037,11923,21369,1976,5666,11397,2917,9795,25506,1038,18960,19745,20545,15971,9293,16296,19032,11118,1040,4439,5246,11521,1576,4719,1042,8484,2616,6936,7170,5154,2924,15360,26208,1695,20402,15667,25833,25645,23533,25661,10771,6105,1107,8142,2801,6720,13831,4982,1522,3403,7077,4819,1487,2122,1044,3672,1154,4203,6494,14908,19247,22331,8960,22882,8165,22784,7739,4091,13065,25295,10192,1046,18325,26463,3981,1048,5364,15473,10676,21672,2392,20393,23695,20917,9595,7964,2284,3625,5708,10452,2509,6773,4087,10020,16093,3324,1050,23355,9954,2799,14269,16411,1051,2247,19528,8489,16513,3764,22251,23052,25297,24104,25336,11522,4045,1273,9070,3644,10240,15114,5670,1592,4293,10683,4885,1869,1900,1055,4577,1517,4916,4499,17321,17268,26529,10608,26587,7181,22449,4898,11368,17833,2829,1057,1812,15317,14401,4031,4710,14051,15908,9914,15465,4390,24531,16456,11951,1059,7187,14137,1060,25151,12396,9204,5635,2176,3018,24094,13418,6560,2153,1065,1066,8273,24949,9334,4689,16855,23974,14659,20552,14298,1069,9602,5300,8372,22068,17562,17265,19796,1070,19960,1083,8542,6038,4152,17214,5775,7982,12354,5109,10155,14384,1073,5940,6981,1824,5271,17230,23469,25628,1075,1927,4338,13022,19806,10335,10566,1076,23931,24247,15071,23262,24850, 4823,9940,1078,2288,8844,4052,4065,10430,4843,20915,7999,12471,9253,8264,12579,17094,1082,8188,12528,3408,8183,15297,25454,18649,1087,6442,20840,16231,8892,22272,25017,5188,1657,1089,23573,3126,11282,1899,7430,17270,8883,4467,14893,5859,20426,1091,11913,15259,9436,13327,24791,1092,24772,19358,26329,22392,23774,1094,2487,6349,12150,23894,12759,11465,19765,13724,20737,23981,20221,16332,23796,22198,15405,6613,11419,24940,11635,6293,1593,8434,4815,16161,20124,7543,1127,5292,13045,6044,2456,2523,1194,5051,1096,7517,7129,17060,24783,19529,17951,12468,14587,9062,1098,3227,2680,13884,5378,22845,12821,10664,13677,6224,10237,13364,5523,1378,11628,22433,2975,3849,18213,5565,4666,3524,19739,1100,20167,2971,11736,1101,14013,26242,7443,16599,20339,1419,26083,26187,2884,1105,23588,12166,22551,21853,9295,1110,10599,4971,10648,17306,3564,2365,6628,11006,8854,1434,5448,1671,4830,5193,9002,14798,24652,18916,22051,11799,8984,25299,1111,18328,14413,25360,25140,22119,5350,23230,9282,8319,23140,1113,14343,6163,8636,25870,20468,25269,21766,1687,3221,8139,19023,2637,11772,14097,1116,22584,1117,22879,22312,7422,1486,6413,9404,1119,9931,19120,13629,4401,10604,1121,5185,12469,9150,7019,2212,6675,3627,20865,20529,5804,2351,4254,8065,4940,3289,2833,1122,3768,1769,6181,6063,8926,20179,16099,13810,21825,15282,21232,2549,9136,4251,17592,6777,7086,11958,4336,8279,18680,1126,6195,6787,2021,4808,14107,1967,13928, 26342,12971,1130,2570,17619,2552,19583,14625,19700,1132,9884,15796,9112,12127,1135,13960,15331,7299,20809,1137,12584,22368,17143,5812,25553,19280,18559,7951,5653,4643,26471,1139,15633,22670,24853,1141,2598,22505,9035,9825,21798,19837,13048,17170,19791,19632,1143,4493,14259,7529,13904,4201,17533,2205,21083,24267,3548,2452,13394,4869,24474,5256,3945,10552,18089,2736,4987,2981,1146,7473,1926,3610,5296,26666,14199,21303,22416,13462,12913,11531,26201,24571,26022,21912,18918,25663,26188,22275,6688,12549,16261,8673,2150,9349,5014,19830,18742,9110,1148,7466,18523,6651,3471,2793,2335,6292,2948,10902,9446,14956,18821,18825,21874,1150,25346,1156,6477,25339,9919,13317,10505,6205,5424,24086,11811,7521,2364,6883,3748,19208,15059,4669,2630,4018,5213,5483,3607,2820,1157,3873,1565,6879,6067,12737,18677,14643,12931,14738,23096,1161,23497,3022,7342,5106,5489,3974,21182,10201,25579,1163,17019,21158,1165,8355,12096,1168,12112,10256,4086,7931,23016,9767,1173,17413,21376,16645,9379,22900,1177,18774,1180,2604,25445,10932,10080,26406,1182,5268,7829,21932,14916,22482,1184,7368,19064,8556,4557,20208,17132,1837,7911,7885,8583,1186,8155,24150,5125,15829,15280,12372,1187,23120,1757,1189,4349,1190,18605,16894,4006,1716,13450,4960,15685,21593,5299,1886,6191,11694,7622,2052,2245,1192,4701,1634,6436,4567,20629,13972,26023,10687,23373,6800,22821,1233,1196,2471,8440,4908,18434,16677,2342,21659,2620,8562,1198,26147, 26752,20559,18844,11313,13838,8033,26144,21549,20346,18726,25928,17717,20085,24877,16363,26096,6518,16751,2034,15904,23309,24179,18437,8129,2665,1477,5133,12435,13673,3572,1276,1805,12055,6909,1648,2571,1200,1669,1235,2520,9562,12030,10381,5074,5259,19077,4444,21923,12550,5077,15423,19981,1245,1201,18299,25243,22143,15610,7078,12298,8532,23874,1203,7332,1206,17251,7709,8250,6872,5245,3546,3307,1364,24790,14817,20676,21310,7138,6569,9679,1877,12413,7467,7046,2838,17390,1492,17698,17654,9635,3983,1209,1717,7497,3397,4645,2797,3465,16107,1210,7068,2004,18888,19946,17917,11444,12768,13740,4855,1212,15713,23212,1213,4378,4042,5166,12234,19217,12926,14135,6920,3377,2291,11253,10646,7926,1215,8269,2658,5344,15512,1218,19887,9804,20058,8135,4525,5536,5117,4988,1959,19172,13363,19486,14702,6645,4234,8463,4475,15085,20637,1220,14928,9880,10140,21085,13140,21374,6329,1222,5232,16814,19102,19002,9698,4847,12363,3190,1224,17762,1227,20547,23375,2919,14858,4721,1229,1854,9759,12979,3535,6330,7223,20225,5303,1236,14793,10138,3549,7897,20224,24153,1654,7054,3885,2087,9474,11956,21623,1239,1895,9564,11371,5854,9671,4700,6912,1242,13790,10618,21071,9270,8405,5738,5660,3797,1523,16521,1244,4650,6617,10878,10811,8696,20666,7988,11271,19661,5552,16584,22662,20313,1247,25091,9477,1897,20214,5801,1662,2415,1637,1248,15392,10118,5855,7935,1250,22542,14416,25073,14084,25630,4437,3447,14572,9469, 5114,4725,21942,21916,24851,1251,16153,23677,6536,24658,24425,17425,1253,21244,18672,13467,5255,13786,1259,22343,26698,22358,6878,7235,1309,24784,5097,9048,7429,12756,17283,6758,12925,1261,22320,16789,15782,17013,24341,8622,24031,16130,19531,2909,1734,9642,4799,12904,13921,4826,3809,6363,10443,10194,1341,4267,1263,4380,4479,8329,15371,21796,24309,14925,13806,11233,18334,8657,24718,20150,1758,1264,14408,4462,14996,8975,13344,24169,7482,13278,16254,8389,16174,22442,3123,11312,8939,1266,9159,1268,3600,18383,7613,12274,3215,3449,7361,2312,2844,20444,1270,25572,13899,6227,5382,18968,9548,1271,8318,1541,9646,4266,7774,9743,3187,23481,26645,6094,21933,23195,18562,21975,20521,11074,2378,3538,1275,15088,7556,18249,5324,8046,1277,10486,9752,22367,9268,7523,17105,15991,8510,2311,1289,22770,4576,12600,14753,1292,15491,8423,16883,25804,24305,9339,1294,18637,19883,1297,22464,7647,10512,5263,4918,5466,1298,25977,21668,8261,1301,25744,1614,16840,11589,3410,9557,21212,10269,13345,5076,9378,2795,12042,5110,21258,1303,2336,16133,10283,22958,20922,2527,7993,16803,3223,1306,7327,5143,12232,9656,2026,8050,22093,21984,10728,7578,13230,8693,7510,3789,17309,6828,12972,4041,9162,7066,1315,7300,16489,26512,15503,12249,3619,18842,2744,1319,23223,9116,4077,2753,1320,3208,23486,11569,11384,25025,6547,2120,8671,7736,22400,19245,5668,1322,9389,15152,8746,1922,7261,2044,7008,5190,5683,20677,24750,20526,19415, 15696,19509,1323,10246,15247,15380,17902,14242,24366,3773,15837,16520,4046,7311,1326,9690,3665,21454,17716,16049,21059,5695,2235,20806,10110,10838,2283,21399,9219,9460,17570,11094,7621,12545,1330,10985,4118,4367,2060,11943,6493,7683,3279,23215,3569,14066,1333,4258,8593,12853,12499,3415,15447,23146,1336,23883,16715,6130,7967,2079,2608,9508,13896,5359,6725,8435,2323,1602,18675,1339,18785,1340,22891,20053,1342,3830,14373,14234,23182,20746,23872,25111,21418,23773,23775,20048,26696,15684,26320,19138,7229,14141,12738,7679,2359,6141,4115,21709,14484,6608,1686,4313,13730,5535,3152,2411,1347,4379,1344,7271,5594,13185,16726,21937,5443,21918,11037,13343,10152,24291,24492,1346,8759,3343,20660,10321,8676,4550,1352,8500,7313,19048,6098,16959,5698,13395,24243,15040,8360,3995,20760,21273,1354,1355,15448,14247,1357,1466,5520,13392,2020,10639,24442,1823,18912,6316,5518,23732,1361,2088,5895,3172,10475,25602,1363,5838,20618,19325,3667,13084,7321,1366,3568,22757,11715,24912,9530,2299,4135,1368,6091,19738,22794,10479,14929,1507,1374,15433,4773,17084,13670,19959,1377,1379,19919,3691,2851,4903,12302,1381,8349,4821,23707,5062,1382,14323,1384,16509,6771,10856,12800,8741,6197,26454,5659,23530,14966,1388,4652,2519,21519,14897,17004,16801,1390,18845,1550,14570,5065,9191,11703,3254,1731,4180,1410,22693,5067,16580,7177,23554,25382,1650,5267,18037,15111,21065,13270,2373,19818,1391,20112,3192,9986,1393,9198,13883, 19860,21786,16445,3621,4388,9586,1396,6578,15379,22010,25903,16857,1397,1401,11260,10161,3982,23111,7665,3369,22502,20691,12458,1403,5575,13357,1660,5961,10573,1405,3090,3423,7273,1692,1729,2767,9939,13611,11608,2233,14168,19861,17405,23945,5842,1408,22440,1411,4162,19895,21682,10305,13213,5831,4337,7222,12534,3490,6869,5474,9121,24246,5093,1413,22795,15882,11517,12248,2386,5015,3288,23085,1415,6728,1423,15662,13120,24156,1424,1426,4173,7307,4735,24279,9365,14682,1428,3286,14545,7704,1429,12827,6370,24233,5751,1432,4396,18664,12702,1435,3030,15666,14486,18001,1437,11213,10742,11846,16532,11949,14813,7471,20726,1438,20460,25876,1445,1447,1855,4832,26423,9620,4633,6837,13698,2747,23147,13607,13796,1448,12901,18583,13844,6526,17985,23524,12219,9753,14613,1455,19051,25036,1456,2985,12329,1459,21067,15954,17162,2944,7483,15362,11691,17123,9683,21564,4318,1461,1940,13552,11381,1462,7713,5977,1464,17221,10065,16443,4066,7127,15948,7685,23313,8553,14203,8946,1469,17488,5328,1613,10650,24948,20954,8967,15854,8559,15883,1470,17850,11210,12997,6331,1472,3930,4586,4247,11031,26377,3673,13206,2248,25501,2457,15621,2056,6354,19487,6010,6167,23116,1473,18703,3175,16510,6683,3928,1475,11877,1880,4189,3251,1476,8082,22058,25653,18012,1478,12013,20056,17512,10561,22835,5417,2356,1480,21366,1924,7395,3316,7142,8733,1481,6474,17365,3831,11069,1484,2752,4457,11195,9347,20518,10667,7568,14369,1490, 20157,9625,13692,16075,20859,17394,1491,21512,23323,26664,13179,1615,18279,15608,1493,16118,8175,12691,23282,17760,16061,10574,15801,1722,1495,7747,9682,8276,12668,12603,23501,13301,1498,15700,1506,23814,13799,1500,25293,3108,13528,24509,25561,17387,4714,1503,11114,4583,4440,6983,7844,4259,6431,12576,5896,1952,2302,1524,6914,2322,5499,6600,24420,19189,14421,9491,13858,4713,23770,2655,19819,1505,6108,4449,4803,10926,15291,21339,11174,1509,12943,22360,19414,1511,22848,25281,21657,5221,1513,17507,25923,10291,10653,24297,14649,1515,3744,12375,13975,11718,13447,20226,19056,23646,15875,3875,5049,14355,11494,16914,4658,20437,18729,4297,25593,2814,1519,23539,7827,1520,12757,1526,8607,14194,9322,6234,13212,1532,1534,10527,13264,18882,12950,12141,7596,10843,5663,15364,1828,1537,2169,5546,25212,11626,11875,22252,25588,7344,7207,2213,18752,1539,1540,19201,11194,1545,6989,8730,3716,10374,17647,21971,4009,1548,15607,3871,1549,24037,4851,10508,1551,24298,25486,7677,1553,19065,9004,8262,24671,16159,2827,1554,22831,6606,10125,1560,16077,1625,1561,18296,6819,8491,15674,1971,1626,11476,1563,19624,3595,5490,3795,1564,17838,15593,20487,13142,5315,14686,24757,24052,11898,21787,10423,5366,3583,4426,24028,19162,9817,15009,1821,20789,17092,1567,4187,12235,20823,6408,7752,5209,7339,2325,24443,14520,1571,2502,16408,6829,1573,8655,1574,12845,26442,7731,12595,1578,18572,9467,18399,1580,5699,6636,1582,3169,23117,13782, 14879,14193,1939,1585,8918,13433,9644,5939,22225,1587,14907,21324,23838,1719,12774,11115,21009,1589,9090,25470,4907,22684,19625,10202,25595,12416,1591,8197,6848,13299,26150,1595,2546,7328,19431,1596,14823,4320,4626,17191,15646,12430,6611,6047,15015,17638,14850,17236,14945,1598,7563,25533,13082,12461,15074,26571,7546,24538,14969,6719,1599,5519,12634,8486,21392,20428,6844,1607,14771,24306,22337,2469,18316,9836,1610,25329,6087,3594,5844,21256,1612,21927,9481,1617,20106,14883,1620,11296,21383,8598,2327,18419,13008,24817,20447,4225,21820,1621,13940,2819,1799,20233,4776,12077,23260,20142,19360,22674,22036,14697,3334,2250,13133,6051,12377,24369,10812,3976,6580,14773,9155,2416,2735,1623,6092,2114,6776,9251,23029,24990,25667,15977,17258,4973,8829,21278,16347,2862,6537,3341,8371,1627,2080,21724,4443,20905,1629,3917,1632,24450,25912,14090,10131,20812,1636,14922,23620,12039,17733,20332,21616,12910,23776,7286,10558,23086,24577,1639,9987,9452,12710,12386,20250,9291,11177,1642,9163,5030,7599,5966,1644,3302,20957,9368,8819,8586,2461,1645,25771,22966,17957,3867,1647,3445,2468,1649,3726,11594,12328,23514,10047,1651,1653,7532,11481,1656,9665,9200,6243,10825,13966,2305,8266,9041,1659,5891,15671,18806,7699,9345,2965,18231,15475,10220,7080,4538,6622,3093,1665,16511,5836,7628,26505,4153,20984,2928,21504,1666,5403,7966,10743,1668,4838,14767,14695,1670,3383,11574,8579,17096,8124,21989,1728,1672,24775,13965, 19177,20884,24229,12951,1674,5928,1676,3357,24815,4428,8246,20972,8816,21121,11818,7554,5481,14880,20815,23498,9991,1678,7338,1681,15422,18311,25455,21914,1683,13703,19326,6325,14033,15038,16334,23414,19244,1684,1688,25467,8445,6261,1690,1694,25964,16666,6086,3145,21741,23263,14976,22009,1697,6733,14432,7732,2646,2664,1699,19224,1701,1704,22313,3759,2621,9883,5112,15249,22676,23628,1709,3429,7212,2329,1711,8311,11109,15813,13795,10273,8962,3396,6242,10571,14412,5574,15093,23855,5703,1909,24210,1713,13871,1718,21177,1721,3804,6748,1724,1725,19009,22675,4019,1732,26268,1735,22621,14347,23423,23068,25268,19759,5748,18602,9727,7930,1738,14345,17026,23284,21264,12574,14785,15346,1740,6432,11667,21547,9677,5920,8403,13475,6589,10625,2459,10920,3588,10768,4609,1742,12369,3164,9039,12514,6029,23805,1743,3217,14582,3460,26326,7015,1747,17287,15436,21674,19776,16350,18574,23923,1751,8459,1753,19542,20698,9874,18118,11827,5516,18682,25880,1764,18008,11144,13534,15960,1765,3432,7768,4222,2903,13830,15706,5799,17568,1767,24920,9567,1768,22936,10172,9696,21415,21826,26617,23450,2656,1771,1774,9119,10429,24622,18890,6117,10619,1780,1782,11081,12519,19190,20319,4328,3073,21758,21852,15462,1784,6028,10976,1786,17863,20752,2271,8896,9492,1903,8670,6545,1879,17062,3529,5582,13861,15716,13969,3171,5886,16119,8652,1791,1793,15298,9494,19668,13598,22575,4418,22642,3065,21372,15898,8538,1796,13136,15180,6731, 4064,25712,24740,11191,15803,13287,5874,6126,4594,22515,1798,4174,14923,15370,1801,22576,2522,20745,2643,1803,15693,3713,26612,24827,21360,1806,9705,21947,15874,6882,4335,4182,1808,21075,13047,10087,23128,23088,21001,14845,8164,12565,5146,26626,23133,18219,15933,1810,4220,17849,5784,20566,16813,26196,1814,12154,7525,7258,1816,16741,2794,8907,20356,1818,9760,3250,23563,1822,21165,11189,5440,4239,1826,20007,4969,17803,5396,13573,26152,1827,3444,4299,3675,1954,14006,1830,10633,14561,20441,23101,1831,24914,5100,17285,1833,10871,3775,25234,12088,23202,1838,3641,24530,5395,3395,2145,10411,1840,11910,12542,14653,9097,12567,1842,16626,1843,7250,8441,15761,1846,1847,12577,6031,17690,23269,4512,1849,24081,1852,4132,3115,7535,3608,20955,5078,7407,1853,12335,1856,8677,9077,17606,20110,15670,1858,25392,15426,14366,5063,12488,1860,12762,18031,6618,22418,2062,2939,17351,6314,23291,26108,4240,1861,9904,12305,24017,9499,13982,1868,23232,14967,12755,14783,8038,9229,4470,1871,5091,15343,6993,9720,1873,25143,1878,7211,10693,7916,11383,17859,7721,7058,4155,12828,14174,19779,13902,17955,14647,12390,1882,21592,25567,26356,14350,2698,1884,12156,14765,4591,15902,14506,4175,9893,3459,1885,21943,14405,1890,13647,10477,16435,1894,22577,25608,9245,19496,14602,1898,23741,1902,11180,1905,2877,8792,4999,24840,5919,12778,13564,6802,13517,22591,1908,10824,9864,2702,7072,6971,17317,24295,16242,6763,11774,1911,2046,11836, 3119,10802,6461,1913,6626,24677,16811,16791,24171,5179,1914,21618,3999,1917,11367,11801,25015,23446,25086,24377,24613,21730,11544,9610,5937,6259,4149,14720,20264,8908,5614,4419,13791,6778,2865,3669,1919,6880,5993,4408,6182,16522,21997,12937,14211,10166,17835,1921,10717,12376,9321,13596,13164,10645,7045,17430,11663,7981,18638,21275,5189,1923,4434,22739,20036,6119,24020,2766,8890,1925,11761,23927,14733,1928,2848,1931,21553,12994,25218,12153,21708,20239,4668,17748,11775,7772,23315,2306,3050,1934,19758,13682,8070,12870,5231,22077,21036,18543,22064,1936,7318,8335,16816,21425,1941,2719,6723,4984,16372,18877,20753,19264,15842,14758,2866,13350,4158,7656,1943,18178,23408,22698,25107,1944,16642,1946,3045,5559,11480,8027,1948,8824,4262,3195,16142,19547,6011,11779,1950,10467,1955,16097,9846,18123,25441,18899,24721,1957,7364,8385,2454,15599,6666,17798,1961,10545,18406,25458,1965,19856,6427,19933,23286,1966,4112,1969,22545,22015,1972,19850,19631,20758,7284,1974,10073,24593,14338,2073,16652,19127,4593,20039,19081,15582,14324,16417,12442,20003,23427,24157,1977,15918,23418,23845,3661,10766,2470,10331,9312,10757,8840,3680,2434,16278,9545,2835,3653,1980,6887,2982,5970,7101,18151,20556,5017,18108,18351,1982,13524,10813,19045,11637,26211,14428,16591,14297,14308,18361,14841,21140,14049,16817,1985,6811,3947,1987,11192,13396,6027,25947,3414,5274,18984,8439,11154,1990,9552,1992,4976,9960,16123,7477,7323,11696,5754,4140, 14991,2991,21270,12368,2897,15170,6610,23648,6390,4305,8544,12334,8123,4532,2941,1993,5765,3086,12384,6198,17537,19652,22308,2081,13285,1995,11197,2541,2397,6422,9558,4697,8684,7855,11863,13001,22026,14052,13092,10457,16638,1996,12405,13379,6168,2016,1998,23722,21689,19343,2003,20686,2022,2006,4746,9103,9380,10532,12024,14377,18060,8095,8296,3510,6107,5904,20461,15920,8705,3932,4941,11475,6382,5275,3845,2007,6471,2024,7067,17706,12500,24454,16243,9779,21716,12393,19794,25055,2009,8466,15552,18087,23165,17052,2012,8075,23521,7816,2014,2065,20245,2904,2015,25150,8869,20572,11537,18390,22364,10300,9375,3142,7714,4863,23141,19923,7504,2019,6260,9783,6843,4454,3925,2113,6249,3012,9254,10718,14337,20776,23082,18718,17519,19828,2029,2268,20662,16830,17770,2032,25888,2035,23992,10756,2191,5756,19623,2038,6263,10035,2040,9815,22193,11962,14183,5421,17780,14648,14699,16112,10085,5043,24393,15857,4469,7744,4660,15570,6282,11274,16382,2043,22118,26738,18423,12614,26602,2045,2381,18536,4765,14867,17528,22658,11316,7198,24825,2049,6071,25528,2051,22346,2054,24893,7672,18720,2057,16333,19014,10416,24822,23928,25484,19447,24288,14127,20081,16213,12306,3801,9246,7785,20910,21534,11974,2743,8539,18005,10788,4657,6665,3106,8331,2059,9490,15393,19909,23422,15435,26130,16948,26615,12996,2063,26633,2066,19484,24065,20176,8732,2068,19810,15928,2072,8502,2075,14624,2078,18779,5687,26669,10814,4476,7006,9879,3157, 2651,21351,5560,16836,19410,13016,14965,14521,18702,8308,14058,7784,10229,10731,2082,20847,24410,16037,8729,5534,17962,12980,2338,3196,2084,2701,3406,2086,18243,18940,17371,23317,2090,23030,23207,12779,6371,2093,14011,21540,4119,23047,22202,12754,12560,25252,13481,2095,11630,18544,8877,2097,8343,23327,6795,15894,2098,2101,15217,21090,21053,24452,6448,16674,15788,7365,22048,2104,15945,7745,3698,15653,10539,20589,9342,8643,8112,5779,21472,2105,14930,2107,9479,10499,6919,2108,11861,23652,24673,4786,13710,3249,12706,9075,11579,24770,11936,4429,2977,16629,10338,3265,4096,2111,9500,3389,7132,9734,23985,19569,8226,23644,21633,17583,2497,6686,2116,8695,26461,15056,2118,3985,13542,5673,9472,12711,15609,10160,17644,2119,12085,17036,19753,2121,19658,23854,22921,9580,12178,9534,19782,9758,22731,2124,22519,26292,17612,7427,23978,6307,2129,15262,10861,2130,5429,25064,2132,8886,16745,9855,7121,15127,2133,17520,23333,10770,2889,6277,2136,6046,26675,6407,11046,21478,2139,5310,4707,22141,26381,7894,9616,2141,9222,7272,2143,25750,10164,14462,15907,7986,7637,6687,2902,24387,22278,2147,12874,13221,6483,10981,2152,4089,13622,2154,7561,6404,10702,11992,2156,15509,12479,18928,3596,22781,22190,14329,9770,3587,4184,2159,13034,2161,8039,2164,9715,13087,2166,2476,7315,15838,19961,11967,2168,20161,17948,2172,4772,18854,10419,8592,17164,23299,2174,18518,16831,2177,6425,2179,13712,19615,9269,22640,24373,22370,22557,4947, 3166,4322,13926,17108,21731,2183,12601,2184,3238,18841,11842,21129,2187,2189,3218,12544,18323,24483,11072,2193,4958,19585,7983,6529,15600,23464,8972,18626,11139,12276,7895,17795,22031,23339,11106,21221,2194,11362,10178,21600,4897,26168,2198,15395,20097,14134,14307,4446,10109,9881,3651,11380,21476,2200,21894,23174,6454,2206,22457,8572,7668,17934,24236,2208,25464,2210,21457,3184,7098,2211,2298,19685,2214,2526,6486,6850,9271,24379,11654,2216,22383,15150,21452,23511,4751,6506,14842,17947,22793,2223,19916,8098,14770,26252,9706,18830,9876,2225,7948,7514,2227,17075,21703,9747,5710,8953,11294,2229,10203,5130,6150,2475,12806,7103,12260,2231,11017,20933,23699,20695,13920,14273,2237,14581,13035,11237,15286,14902,2241,13989,17949,2242,9382,19148,4107,2249,6588,2254,13593,24743,25032,21711,22565,10028,19715,18105,24284,15035,19829,13733,13012,2878,9319,3886,18733,21302,9099,2583,6609,9317,4909,3031,3898,2257,7710,3404,10060,11161,18040,15449,16763,25522,16631,14088,19573,3104,23798,2259,7853,11147,2269,3210,10548,15067,6285,6756,16228,16302,20646,19802,13977,14394,2260,2683,10320,5233,22785,7682,6008,16985,7942,14664,21685,2264,9717,11318,3078,7214,24085,2270,23577,8442,19811,2275,7199,13980,17159,9963,10054,4157,8847,5236,24487,7410,4798,3891,20093,6673,7100,5000,2276,5941,2858,8390,8407,12695,12281,17139,17370,21187,15053,26241,6964,7381,5526,2533,4116,2278,10697,25717,3785,5150,3668,2279,8865,10986, 5047,15853,6744,17666,2282,9873,22715,14476,6552,2285,8428,7592,8239,6577,13870,13695,23668,14676,21864,7256,10613,26095,20236,16073,2287,5835,22147,10772,2294,5504,11025,21520,18647,24301,21436,19323,19874,26031,18540,26048,19090,11619,10275,3296,9540,5542,9905,2642,4945,16755,7010,4459,5323,2296,7292,3618,11090,9366,15772,20044,23797,20728,13876,19644,7777,2301,23703,9011,11036,9069,6988,11435,3151,3291,26607,21587,2308,12429,2313,11610,12032,19248,7754,18760,14829,18042,2880,11553,2315,24000,2495,2317,2318,14857,13095,5036,21636,3751,21166,21109,4872,2320,2321,5244,25707,19867,22922,6940,2328,25526,2340,25907,2824,2681,6938,5567,2344,12957,20334,10412,26343,2349,5147,6654,6571,2690,6564,5819,2350,13546,16354,21824,12541,2353,5806,22227,2355,11391,15541,2357,13763,7375,2362,6318,15890,2363,2366,17930,7995,14899,12310,12966,10821,13243,19234,2368,13100,10872,13104,12981,24610,2369,16862,20145,17424,3834,22646,3760,6490,15628,2371,4035,12270,12880,4590,2375,21042,23476,8488,12054,12161,21421,12879,3451,2377,18910,20101,24412,7906,14116,12142,19896,3519,13062,7681,17106,9870,8823,7627,16916,12145,2573,3191,2384,7595,4211,10972,8245,17358,23713,22570,20409,15615,20369,22438,19006,20287,14943,25047,17811,2388,26547,23943,22685,16081,2391,12203,11938,17602,6447,12045,9909,14599,17752,22499,22167,19676,2395,11698,6594,18873,10611,2398,6703,25043,2400,19357,26127,2402,22897,6801,12928,10823,19566,23873,4796, 21910,18487,8549,6832,2404,21742,12102,14402,16197,5173,11427,2407,5011,18852,14459,7325,14027,2929,8091,6120,19306,11185,21497,11995,3920,21714,8490,2408,12644,10169,12992,5597,16980,25557,2413,3843,18654,10292,3859,13734,5287,22667,7186,2414,5137,5415,22970,4755,18689,2420,26491,8702,5169,16356,3473,26235,2422,13166,23296,2424,3407,4874,5512,2843,15412,24136,15683,2426,7206,7889,21313,24160,3393,22460,11351,23000,2428,25568,8041,11532,17361,16319,4169,26472,17422,14988,8754,2432,16384,10906,24896,14156,24403,19974,25550,16208,2437,14666,12395,18372,7105,17988,9731,5746,10593,5988,16328,7154,21046,17726,24090,26045,2439,15764,15457,24311,17891,5247,20159,12294,3577,9900,9485,4460,3332,10139,2441,7268,7526,6113,7997,18283,3911,5788,6434,4002,2444,4518,2447,11821,15573,26433,24813,14230,2451,14483,23735,18225,3333,22539,25049,20944,2458,18368,16866,16101,16766,11039,6555,13809,2460,2462,17501,10397,6256,8160,12472,2791,5038,23571,10876,7203,7123,24808,18874,22470,2464,2465,24737,20756,16930,6851,12721,5900,20829,12932,8634,6255,23595,7155,7099,4886,3370,7354,2467,10006,9983,19300,20939,16826,2473,3657,4081,2474,2479,15804,21308,13439,5707,19897,10560,17289,6674,26360,23438,3239,7765,4889,2481,17232,2846,5610,5437,11493,15151,20623,9699,3095,11558,23392,2482,18552,6943,23701,7614,13644,2484,20946,15729,18740,9547,5488,8914,4011,25131,2489,11817,14311,21430,16921,17896,19771,6202,7172,8711,8714, 6068,15681,6917,2493,9831,8923,18130,11611,20510,6409,12794,21620,16478,2496,3883,19720,2499,19899,23247,3677,2501,3617,26085,8268,3430,2503,8856,25563,4774,2771,10851,2505,4111,6465,5365,2506,18029,5630,14325,11000,16582,2508,15784,13461,14123,2510,24926,3436,2515,2898,23998,11122,9320,16241,12240,4754,16387,12233,2517,14146,9297,4219,2521,10720,26380,13937,2525,10528,9821,4450,2529,10793,19803,10226,19935,11243,20777,2530,15160,4287,15893,7722,23804,4839,2532,11559,25076,3003,19901,12834,23009,9952,2534,5609,3179,5288,4167,23503,9651,17408,5413,17340,13232,14430,15115,7666,5578,23986,16696,5901,7640,4168,14035,6979,11716,12314,2539,25797,7882,21679,2542,18408,8784,2545,19777,5816,24892,17591,5021,17736,2547,6169,21423,7870,6361,17064,19725,6411,2551,23693,9711,20353,11372,13162,2554,12494,21368,9218,19866,9300,3388,6309,10514,6153,9788,22417,10306,18415,25405,2556,15542,11564,7663,21829,5933,17661,19143,2559,12428,18086,4655,12125,9288,8658,12307,16137,2562,13746,9438,14434,14585,9660,8703,23320,11071,5577,5889,3163,14792,3401,9965,15020,26560,20585,12575,24139,21507,19514,21377,10641,2564,18714,13248,25529,26333,23241,12683,24788,18397,23124,24683,2565,11498,19085,16079,25855,10818,2569,10715,22750,2572,10892,15184,5082,12826,6192,3053,25666,2577,21491,23549,18101,22316,6976,13468,2580,12745,10208,22159,23937,10997,2582,10845,6587,18588,14982,2585,3660,15858,16995,4766,4478,2588,6379,2590,26171, 16711,3659,5399,14106,2596,6942,13129,16936,16190,2600,12070,7673,4056,20107,15432,14864,11423,13970,4545,22636,24556,23543,7775,22537,21021,2606,4944,7625,2607,26310,5094,18093,2841,25952,13161,23552,11340,5096,21354,2610,17872,8241,14914,4824,10257,2612,26552,8682,11178,5588,4858,16498,6417,13306,2613,6015,8189,10531,20864,19395,10844,2618,4165,5845,12208,23502,9649,2619,24060,8537,19716,12444,7351,8221,18766,12940,3749,6643,3688,12830,4642,10917,13652,20624,25042,5711,8576,7475,8838,6401,6491,5971,4361,15112,19015,2623,5628,11049,16274,10473,3647,21518,6399,15133,16216,2626,24354,13783,3842,2628,9493,13103,2636,22178,22559,14026,2638,25260,6616,17031,10523,9306,15244,2640,15167,4967,20285,7671,2641,18634,11942,23569,2645,16121,2649,11507,13234,13137,24112,2650,10255,24497,25208,8348,4154,14525,5183,2961,2654,9522,11670,26071,2657,13957,14522,21551,18207,18266,3732,3327,20650,2660,11339,7798,4417,5693,17025,2666,26178,13999,7163,4997,22788,10559,2669,19132,23060,3362,2670,26578,2672,18449,6539,18979,4726,11222,8307,20352,12355,4584,17892,7901,2674,23861,3454,5962,14128,2676,2692,10891,22455,14398,2678,11337,14021,14145,13761,24435,3402,7555,2687,18103,11926,14569,19949,6147,9088,14517,9301,26209,15980,24506,10935,22911,24047,3902,16033,2689,18489,2691,13303,25166,21987,8249,26328,2695,21153,24491,2697,22985,21936,2770,2699,10804,5297,3796,26392,22191,20266,13260,22496,18275,6834,2704,20770,2705, 20111,11474,17366,2708,14344,25112,5822,7658,15256,10557,4943,18758,17683,2710,15506,2712,18229,25844,23890,21215,9405,4121,14340,22994,26135,12807,11302,3681,12317,9415,21649,12230,6967,3566,9495,12626,11769,2881,8996,2714,8827,5767,12417,22298,11392,13210,21591,12309,3230,2715,19444,24626,7251,2717,18370,24421,10004,7450,11976,7511,19369,12796,15165,18953,2869,12728,21921,8761,6229,26745,2721,2722,21995,2724,25674,19932,26148,2726,15073,13962,18455,24720,24596,17958,10285,4070,4790,18477,5612,6603,8013,15654,12339,2728,2729,14001,2731,4053,9936,15479,21609,21537,11462,5434,12831,12352,22967,13802,11416,2733,6467,21654,14197,4207,8811,3219,8691,7866,11018,22686,25764,17877,13434,2734,15538,20103,23006,23581,19938,23671,5235,2738,5029,25078,11948,3197,10550,14548,24480,18579,20358,6452,3615,25432,19026,11602,7096,2741,3740,2742,7645,16999,2745,24816,20265,6143,16549,16906,5295,15625,16229,19103,16909,3315,10671,16305,10199,5422,12246,16057,2749,21130,7340,13759,10038,17038,6137,2755,9143,16220,5385,2756,19541,11405,2758,5902,23211,10750,8230,18313,12849,5631,2760,6724,3183,8625,16912,22504,12854,19236,12630,14180,3233,2762,23289,2764,20856,10744,12241,4340,9329,7582,2769,19255,23653,16467,2772,8859,12825,17886,3652,9748,3308,9142,5368,13298,2774,6215,13815,8125,10151,17719,3944,15464,16062,14023,2776,10603,18097,2892,23821,2782,19080,2783,7584,5436,12170,7367,2785,21276,25456,9634,2788,11869,12914,23507, 6348,15964,5214,15445,8433,7337,24846,16202,21597,20903,12066,11091,22220,2790,10207,16695,25936,2792,16488,2798,9078,13197,10268,23080,8379,6566,2800,10173,17515,12111,8899,12038,12239,10739,12727,17323,2804,17715,10656,15540,14627,9571,6614,23682,13068,5778,5944,3212,14395,4114,8536,16637,16772,13463,25657,19769,20787,21572,19099,15691,17972,5128,17024,21868,21605,2806,13825,24186,17440,15051,24114,14246,2811,7011,5927,10730,20115,2813,5794,9757,5170,12477,13024,4084,4640,9275,23219,11963,11290,12094,21555,4473,26711,2817,13660,2822,12357,7056,4043,7802,23824,12360,5511,20082,22485,21872,2839,14179,21964,21058,14065,26610,2845,11377,14378,5238,7819,6226,2847,13302,2852,20802,21873,13340,19298,18617,16901,2855,20490,8853,12501,24510,6347,19111,17864,3520,11354,24760,2857,20713,24117,24202,26559,2867,20242,14691,5830,24285,20459,13055,2873,5177,18913,5400,6135,2876,20154,5498,10456,2882,5234,12311,25029,15592,14436,6164,4585,2886,14975,12041,5634,13132,6543,6118,5028,8012,11644,10023,7788,4324,2888,8411,3643,11472,10282,18389,24693,23443,20906,24064,6842,4120,23766,24376,21765,2891,9209,18244,2896,7453,12210,23081,7688,17791,7281,11301,7893,18891,7404,25745,3530,10749,6333,2901,7712,26131,17155,10196,23738,2910,17249,18106,23996,6950,2912,2916,3443,14503,15095,2918,22435,2923,8514,5056,11540,14719,9210,10086,4604,24044,2926,21300,11884,22247,3051,13623,4441,5603,20251,26741,2927,23892,21838,22703,2930,17794, 8006,22747,7606,25638,26445,24649,12665,21315,24561,13599,4055,11413,11146,26341,13850,2932,11292,18145,10124,4846,6658,4315,14603,5192,17141,19313,22371,24824,22553,4436,18033,17269,9434,2935,18049,11695,2938,4407,2940,4653,13000,9364,2943,24872,14291,22760,12109,4477,9393,4054,25806,2945,12696,17926,24198,2950,14020,22625,2952,25540,17429,4097,19690,2955,11655,17665,4994,23452,4105,13131,2957,4935,22654,11169,21571,10857,24489,20234,14671,4896,9663,2960,17235,11206,2963,7537,6352,3557,22975,2964,16602,19387,13525,20876,11471,24385,8138,5745,17350,21713,25711,21112,15574,23622,2966,10129,11758,7448,14900,22387,16805,12206,18114,20373,25334,19287,2968,3424,4371,24881,16437,14207,2969,21963,8835,2972,19842,2974,15025,21648,14346,10669,11781,9776,7740,11064,14824,25210,21729,2980,9784,2984,23235,8362,8078,4996,15665,16135,5251,18780,9280,2987,23880,2989,23944,19836,7228,2992,2994,11116,7276,23721,14934,8906,6505,6678,4156,5892,3114,21707,10692,3813,3204,18862,2998,10587,16067,4608,3000,8588,25040,15410,5936,4023,3014,3017,5615,4306,6809,5187,23517,15650,21390,14469,7026,21419,10081,4487,7900,6043,9976,9851,8858,8438,18725,13013,3019,6042,15108,10154,13446,3021,10974,8713,15901,16727,3024,12566,16987,24943,6735,3029,3656,25095,13020,8575,6059,12366,3033,21358,25915,7793,7213,9768,3037,23454,5981,17453,18364,3039,9894,3041,9901,17001,20190,3042,23803,24282,25215,18683,9707,3979,12512,7183,18188,19419, 10537,4917,8551,17687,10162,4015,5469,3044,10458,3186,9673,10135,24277,16910,15501,25240,11512,17102,3049,3052,25368,8365,8143,3055,3058,16085,21064,17511,20633,11660,26037,22811,22837,21613,22261,16683,3060,20477,18061,7877,25423,20900,3061,23515,18558,5407,25784,3062,12146,15175,4661,13655,6736,3064,13383,18541,6272,25101,3067,9996,18621,19276,18458,21884,6484,23896,15613,6487,6550,16969,3068,24158,14482,4704,20123,12295,3071,18939,11188,15408,8367,3075,13323,25196,10765,21817,3077,17609,20277,21168,23321,10420,25703,15145,16971,9418,3080,3198,24315,22700,13172,24268,3081,16687,12003,18906,12467,9049,23520,8961,15058,19689,17360,3083,3085,17205,17844,7302,20323,18255,22086,7921,12934,19338,11795,23372,20725,5644,3088,11973,3094,10241,16029,19505,6962,6596,17518,24424,24707,24967,14556,12961,15414,8364,3097,17080,10387,17805,22373,10222,4531,11152,19831,12525,4629,6362,3904,11467,4463,15144,15023,21298,21346,17674,11837,9543,16834,6792,23031,14535,3099,23495,14993,16940,3103,18582,9054,9091,19295,21445,9809,3105,13565,14645,17909,9283,9195,24261,17750,20054,15319,26309,3112,9546,8609,3116,10015,14524,13557,24355,18254,3118,5095,5688,6751,15536,15636,23350,21486,7896,3120,6139,8601,21896,24554,18303,12403,3901,17492,7955,26452,7472,3122,9560,19962,12133,4854,6096,4229,12724,4662,13054,14004,23541,23519,24879,19263,3125,24728,9985,3634,16086,8639,22633,15352,8845,10627,19474,12847,3978,6515,3129,12450,4423,12954,10934, 21983,26340,26639,3131,5761,3135,5227,3590,8981,8524,12868,10534,5342,6996,5370,10846,9746,25016,24805,22256,14240,3140,21357,3144,18358,11530,3935,11099,21237,14837,3149,5549,19843,5249,22395,26659,10815,12028,3155,15507,3156,4484,3963,13324,18147,19721,18409,11042,6798,19826,8302,3159,19761,10487,3162,18880,10640,21877,13385,3174,8278,15962,10143,17032,3177,16331,13919,3178,23529,3185,15411,7176,18907,16546,18000,3194,3199,16399,11119,6501,3203,7795,18414,4524,3975,15866,13284,22948,21224,3207,17296,19637,23756,8783,26582,12374,15556,9903,17169,3777,18771,19303,3211,4410,23121,21663,3214,19091,24977,17927,18876,17324,18278,3216,22229,25710,17098,25785,4753,3220,3222,15792,14511,23311,11998,3225,23118,14680,3431,9484,5149,3229,4092,3739,8665,7692,9289,17134,18210,24993,20092,22560,23277,3235,11859,3649,23654,16102,12680,5579,11443,8694,16405,7735,9106,18385,3236,8633,21558,15783,3240,9187,15630,18777,3243,13958,26724,3244,16325,14397,3248,6841,10903,15505,3253,9350,19322,3257,8848,13389,3263,3761,12583,15492,17543,14978,3267,3714,25789,3268,6531,15737,4017,3270,9695,3275,3278,10319,12851,22892,3281,3532,22868,20664,3287,14102,3293,14458,25200,26541,25811,6246,18884,10059,9012,7168,21382,6097,4253,7290,3298,25746,5322,5470,3757,22116,4026,18615,11482,11651,24971,9993,5482,16925,12739,23523,14017,17695,3301,6661,23764,10962,5353,6387,3686,11577,4738,13693,13029,14836,17732,3303,25349,24842,18119,15446, 5505,6764,9394,22282,22589,12037,6199,9066,17305,11909,6398,5345,3305,7782,4983,9141,10780,22083,17769,18721,13495,7409,21408,3310,12915,13489,18505,7470,10796,9344,11360,15698,21012,5479,13165,26468,3312,9128,12187,4342,8880,23138,3314,22253,23020,18970,13610,3317,17436,19877,7220,3319,7629,4004,20149,16451,22271,11041,24147,4269,5099,3322,15994,4161,12171,9712,9906,13898,7987,26624,3325,12301,25178,20207,3800,3331,13840,13706,3476,25473,15483,3336,17901,10299,11702,18308,6213,15484,3338,9693,18688,3339,6415,6772,7813,8361,3345,3347,3371,24321,10249,12682,25148,3349,24855,4129,26414,6889,9814,7363,10061,14451,3351,24249,4647,8480,17781,15794,15246,13437,3536,16641,10631,6916,12964,5716,23898,10761,9032,3354,13229,11807,12172,20453,3356,20643,6216,5283,3359,23154,9092,4356,6161,3360,17577,3361,26398,10993,13851,24475,13145,26426,3365,15730,22134,23895,3366,17860,5739,3376,26665,13200,3379,5374,16054,17389,23173,17122,3380,19427,25986,14584,3385,17410,21072,24380,18096,19770,4216,7079,3387,7818,10795,6510,3392,26202,20342,20423,23228,3394,7903,18902,14955,20953,18933,17498,3398,23045,19908,3400,5791,13325,9521,20197,16560,26540,24131,3418,11344,6908,20252,17397,23095,3425,25854,25311,13477,3427,22155,20475,22573,24111,10607,3435,16402,9199,16157,24618,11756,6653,10590,22854,12582,6093,3526,3889,9848,4607,13911,13638,21381,25691,3439,17044,3441,14772,22259,3774,24418,18498,3448,15365,17768,10556,3450,8467, 16535,22206,3453,3456,15774,16166,8227,23672,13538,17461,22932,26110,8791,3457,19695,22791,3482,24413,20363,3712,3462,9399,3464,21622,21268,19942,10025,3466,23275,25937,21744,11330,25861,3469,25802,17903,5257,19613,16635,7420,8547,18485,17395,23866,20928,3470,21431,8217,3475,16911,7970,3478,19158,7469,18291,5309,20503,12963,15717,14396,7505,4763,22217,14010,4644,6204,3487,12959,4533,10016,14822,5832,22688,26394,4522,5222,8208,8184,3937,3492,9262,10447,3493,23261,22827,25996,26232,3496,11820,25920,3498,19239,17483,3869,25241,14786,23810,3502,25973,6990,15626,13063,4260,11622,7717,3503,10727,18509,17745,5376,16898,6630,10317,4891,15172,16203,3505,7822,24958,3506,4612,7910,3516,10378,15930,23482,8432,17635,6535,16105,8976,3518,12846,22323,4706,8624,8690,5198,6650,25168,3522,8157,21028,12336,3525,5237,9789,6253,23384,15078,6183,6958,6414,3528,16647,3534,7669,12398,10278,5461,10347,19549,17737,19653,7862,19812,12182,24216,15222,13190,26727,3540,10093,15488,16757,20296,3541,6667,14497,12752,3544,14862,3887,6533,11750,12337,3545,7257,4106,8940,11708,23453,6928,3551,17477,23400,11326,3558,8464,21560,12454,20183,19762,7426,14312,4656,20561,18117,16967,5606,9882,23553,8968,6747,7518,3560,10417,5885,7346,13916,17061,17523,18903,21814,24256,23028,8687,3562,12612,8785,14985,4104,10156,22131,11862,4966,7502,4354,12223,4672,12590,15712,23906,25875,3565,26319,19706,3567,11876,13766,20536,21420,14732,3573,26113,18530, 24352,24519,19007,20581,19967,17663,8178,12615,21904,24835,5964,10307,4007,3881,3575,13719,17852,11167,16526,14594,16258,24543,3576,17981,13277,16974,17684,7507,14869,4694,14415,13259,12478,14693,7090,3829,23091,12523,5090,6356,3580,13955,5337,8905,9922,4090,24500,24018,13995,7259,15135,25288,3582,11262,12155,18958,10107,3584,9828,17887,26476,16998,7350,21948,3589,21870,17353,12948,13555,6698,12829,23288,3599,19359,18728,15995,15963,26271,26024,24947,7322,22601,19110,11311,9411,16355,3605,12050,13402,17417,12043,5680,14249,23402,25487,11215,3606,25085,4409,13390,6734,3616,10594,23426,20663,17028,3620,5930,3626,21509,10991,3629,6806,14852,22796,6049,18294,7971,17529,21574,9152,17120,19853,5354,14231,12448,22111,20546,14536,19718,19893,3630,11730,18404,13352,8620,26000,16324,6037,8469,6633,7617,3877,7954,24437,18338,16895,14276,8415,26100,11605,3633,9309,17973,21862,25211,15728,24800,24345,11814,20680,18208,11107,3636,16858,5817,12486,25020,16990,5723,7171,3637,9336,23325,6433,14612,3639,20620,4093,8825,5558,13135,9211,17046,6716,3646,22544,3648,14361,8621,3650,24322,24785,20102,13169,3655,3750,4736,18191,20329,8957,3658,3663,9022,12580,22170,25429,14999,4992,25174,24901,21462,17782,3664,22445,12687,15351,10260,11165,20848,11990,10858,8426,5105,11406,6416,9875,15935,9052,21205,15326,16381,3687,3674,13841,5661,22300,21145,17597,3676,7728,3679,20318,26291,14435,3682,18138,10303,24230,17286,12875,5879,10183,3684,6174,6018, 7654,21455,3685,15989,9224,3690,15169,23969,3692,25145,19580,8391,4486,26156,3695,23316,3948,4554,18925,16492,12773,22971,16066,18307,10036,18722,25971,12426,16807,21832,10404,18693,3697,20768,6495,24149,14109,23613,11153,24905,19459,22759,25576,10975,9017,19970,8798,13544,7651,21513,11816,16365,22725,3703,26175,26683,25536,16566,11724,10721,10121,20378,26068,8763,10553,6676,23630,12891,5164,10688,3708,11104,9829,9130,13110,13157,21589,12504,22772,24333,14806,3709,4630,3715,25519,17808,14050,9202,13636,9647,19253,16290,6911,8085,19376,12709,11971,6014,4279,6615,3717,10216,23251,16011,22972,15611,17166,14071,4466,3719,22753,14073,21160,16370,3721,12666,8026,20322,19270,3724,3729,12973,16644,3731,12120,17179,21543,17975,18507,26121,12005,19952,3734,6223,16248,15921,22867,26676,7859,3736,7274,6915,3738,8574,10586,3743,26695,18897,16824,3752,6836,14129,17742,3755,19481,11723,25601,3892,17588,11040,12837,7102,3763,12349,9274,23319,3767,19181,8206,3770,9203,19088,21435,15299,6095,17757,10105,23965,13330,5416,11120,12222,13071,8222,3772,4814,12126,6088,13102,13777,18666,26357,23268,4249,3783,21803,5910,13421,24318,17073,19356,3784,19418,4596,3787,5664,9541,12713,16780,18590,15110,4953,3792,3794,15535,21603,3799,16111,12268,4699,24587,10547,4648,25046,10612,21197,13144,10263,9801,24570,13360,5881,7374,3803,11256,6200,11739,12974,20499,3806,16691,3810,7876,14493,8487,12275,9728,13657,18350,3818,3823,21122,16418,10713,3824,21563, 4458,18630,15926,6870,10243,3827,26189,8821,4144,12990,3828,12052,19203,23462,16768,9713,11583,11457,3833,7205,7355,6884,3836,25167,3838,18076,15174,25023,5393,6975,11299,3918,13947,12793,3844,3848,12053,15539,3850,21776,23964,6300,3852,11026,25117,15566,8086,11879,10867,26469,19535,6391,11572,23610,15052,6888,10448,4556,11217,3854,11707,20175,19648,19999,26390,3856,22292,5113,21699,8040,3858,21879,3863,16554,21400,15232,3865,20292,26517,25344,3866,24026,10355,24503,13665,8354,3870,14181,21138,19292,25453,9140,20217,21283,3876,22926,3882,18560,17469,11527,14706,20721,4036,26070,5521,6755,7408,3888,9934,3895,13238,7662,3897,12968,25585,8550,21516,19494,3900,26256,17709,3906,8321,14399,9781,18120,20525,17303,3907,10037,8771,21693,22696,23365,3909,7773,3922,8326,12247,3916,14820,7194,16026,4906,19708,18092,3924,18090,4261,19142,7089,16200,17415,13848,17869,3927,4329,7063,3929,9363,4654,18133,3931,5973,9465,7620,12967,3934,19787,3938,7380,4334,21656,10923,21016,3941,17540,16764,3942,3943,15603,21411,16487,5860,3950,14885,13445,9158,22666,9858,16378,23658,19339,3953,16605,18850,6788,9189,10096,4048,5747,23125,3956,5952,21489,8437,17817,5658,16918,15623,21958,16199,7434,5953,26514,14941,6953,8351,3961,13424,5330,10187,12610,14236,24276,12211,3965,15956,26434,21183,3970,11721,11865,8974,16586,3972,11258,21985,18272,23579,25204,3984,6656,10007,4005,19646,21611,9724,26046,5913,23586,26138,8618,3986,23012,9614, 14431,3988,18713,4284,15769,14971,3991,16015,10643,14039,24040,9573,24972,17940,26098,21163,9672,11170,25626,3992,23806,5476,12415,19168,3994,14568,4001,12404,4008,25725,4010,6080,5184,4013,20930,23335,24945,22554,19147,20098,20520,13956,4246,22183,9718,26455,16432,4134,9964,20408,12007,5884,6849,4021,12953,5926,17076,15564,22156,8748,7503,13745,25070,22657,21475,22500,24710,16518,22820,4828,4025,18264,4779,21191,4797,13910,4028,4150,24761,11937,4030,9771,9233,13579,20118,4033,8195,10735,17495,20866,14983,8277,4038,8983,16749,4998,21077,18521,25747,21482,4044,5405,4050,20985,14410,4051,26374,10111,4058,5195,4060,12048,4062,14142,10350,4068,9865,4071,15553,8290,19216,6421,20893,14912,22240,16007,8267,6241,24962,17349,7317,7255,4074,13125,7082,14115,9087,14681,8457,21647,15413,17259,14202,15334,26526,15105,20424,16181,16673,10324,19251,4076,17818,26087,7048,13787,23053,9026,5823,4079,11822,21265,14781,11556,4080,25584,21739,14433,6222,15889,9640,15007,14131,7479,11453,14289,11171,7446,6972,4085,10253,5841,15831,12563,23876,10092,24917,4088,14942,4712,5180,6173,13436,13057,25129,20382,4100,23708,11680,25892,20321,4103,12506,19610,26611,4109,4117,11720,4123,18551,5715,16881,9664,18293,17018,4126,16794,4128,24237,19341,4131,12792,11418,10261,13585,15143,10982,14634,4684,8795,26270,26614,7131,4204,4133,21608,23172,12438,15870,9165,11902,4137,9763,18809,17802,4148,17150,18129,4159,8073,4170,26062,9221,19021,20258,26254, 18183,6184,14778,11648,16919,9950,4561,8927,17847,16573,6177,11023,4178,10488,8392,13452,25864,19979,21198,14997,19385,21665,18182,22393,4179,4845,4181,19564,5087,5013,4191,15468,15519,14638,12734,24507,7383,11834,6004,4520,4194,23751,11028,16932,5022,15840,4195,10700,11918,11126,4809,12345,4198,20009,9073,17345,16059,14143,4202,4208,6112,16991,23040,24248,4210,19768,14092,25680,12564,24226,8363,4215,8398,5617,13312,4218,7837,7729,7508,12204,4227,7718,11615,5272,4228,14467,8287,20100,23584,24537,4231,7282,16175,19268,23730,4238,17561,20325,26234,9190,4243,12572,24260,24068,16541,4245,24786,18292,9487,4248,6568,21362,20971,8462,24601,9645,4264,13672,16968,10426,9689,5035,23508,12018,15206,16620,11804,21373,10294,4268,25859,11672,4271,14631,4343,26249,8166,10289,14549,8386,4272,22129,22491,20080,4275,13888,22382,21694,26545,22635,24199,26740,26569,22311,8619,19480,22581,24552,16343,5487,8644,9962,21815,15177,5111,16034,22629,13862,6400,11098,4277,16045,6265,17297,18905,22707,4281,21099,13262,11767,26008,4283,18433,4285,25367,9129,20020,24182,21336,4289,15434,21162,4290,9303,6797,13150,10638,16297,4292,17367,10940,15656,21859,4295,12399,4300,22281,14387,22580,4302,21070,11283,10379,16433,16316,14069,5890,21311,16907,20272,21222,11182,21403,9036,6455,4304,7638,4568,22157,4309,9213,23069,25769,25317,10493,4310,20341,21701,4317,18239,6303,14957,22779,15103,14628,22634,15335,4319,6681,16050,7937,11523,25910,15082,11731,12297, 6726,7191,9461,14122,13983,4326,26627,12128,25267,13709,23919,25575,14740,9681,24767,10248,13292,10415,23347,14677,16215,20210,4333,7615,25359,7790,15147,6424,17107,4339,5572,5282,11766,7373,4341,13615,14727,4344,12521,5032,20504,25955,4347,18575,5914,11276,10525,7609,9912,10433,9183,4352,18490,22655,16017,8993,19838,9654,4359,15230,12672,18662,4384,8868,4364,5136,4737,15748,7720,4369,26350,16728,20693,18204,4372,9808,23641,7559,5525,4377,4381,8205,20349,18388,12116,18345,21139,19521,18711,8773,26306,20716,22448,8735,25877,4383,15202,8582,26460,10304,4389,20199,16977,14884,19471,22690,4391,19153,12365,9949,13736,4395,19809,23583,14655,4398,19880,24641,8158,4964,23915,26634,4399,9313,4403,6527,24458,18236,19018,13305,5276,4549,4406,21634,24183,9079,15814,10515,4413,7968,5360,7572,23274,25418,4414,23537,24455,23935,4416,16464,4422,8022,24490,5595,5243,20317,4427,9529,5843,8616,24768,12188,18045,25024,4468,19680,22849,4431,7308,20890,8352,11035,4433,11604,25636,14100,11841,21490,18599,25619,9639,4438,9384,6783,26346,19555,19173,16158,10836,4442,20413,12936,4445,13718,4575,8493,8081,7180,19046,4448,25369,10190,4451,25307,10966,4453,22345,19353,5497,13711,17184,4456,24749,4465,14044,21317,9167,4474,20661,11623,14091,7632,23921,11008,15005,23227,12385,23667,24496,4480,12319,18565,7296,12912,4482,16412,18428,16234,4489,21881,17199,20330,10481,10112,16588,24811,25403,5583,13180,6032,14262,12648,20481,23733,4490,22741, 16342,20881,17388,5522,6381,18909,9889,16664,26316,4494,8681,4496,13263,5954,10435,23875,19037,24122,4498,14635,13239,15119,6144,18584,6893,4506,17614,8627,25236,4995,4511,5107,10402,21866,9600,15746,8688,18195,12637,4514,8958,4515,13875,13109,4517,4764,19928,24938,4521,7571,17653,8513,10418,18450,21988,4551,4523,24471,19667,6634,17539,14994,12185,16655,19043,5019,21378,9554,21781,4527,22981,19377,6854,7686,18235,19534,4528,14768,10074,10344,5201,8274,18802,4530,16716,23662,4535,17090,19825,22242,15208,11033,26744,12532,20514,11242,4905,4537,6176,23984,20014,15243,7952,17875,15374,4539,14868,20611,4541,7279,10437,4543,4563,18141,13017,4544,17282,22309,4553,6557,18652,20454,8083,17607,13932,26016,18501,4559,16281,12878,24332,9806,4562,20639,14959,22751,15544,16410,15019,4564,9599,8632,20450,4566,11045,25126,4570,22085,4573,12071,5203,20929,20765,13762,4579,25596,18357,20471,12814,8935,7929,4587,13917,4592,5131,9992,24025,25285,19912,19530,6567,18863,16514,17783,5938,11111,23256,16129,7565,8889,6111,12078,4597,16407,19657,20904,12140,4599,17806,6023,19407,16449,13536,13561,4602,4603,19290,15624,4610,17965,16891,4615,12570,17508,6066,19707,4617,26396,11451,25287,26269,15534,11066,13849,17435,13356,6593,8701,5298,12933,6476,13228,12300,18805,20739,4620,23615,22040,15444,23110,9886,20186,15940,23192,10659,13283,25238,23330,8708,8465,5774,13726,9247,19476,13353,23621,4623,4625,11502,4628,19723,13189,22762,8003,4632,4636, 15001,10029,16590,10762,25205,14319,26519,6784,19495,9598,4639,10699,18226,22550,4646,9123,4659,20531,17463,23376,11425,13908,16425,23304,13381,20132,4664,21219,17976,11460,20045,19101,24331,14062,4665,4667,15896,26335,26318,7991,4671,15800,23474,26760,12364,9397,4674,8015,10704,14919,6294,4677,26065,9406,18353,7179,18218,14555,16538,9174,5048,23737,18961,6458,6445,4681,16194,6858,11355,13732,12197,8756,23062,12084,7232,16593,14610,4683,9885,4739,22405,4686,22692,13621,4688,22520,22602,17057,4691,20747,9257,17342,7390,8375,19117,23674,21523,4692,4693,19219,16480,19361,4696,5412,20658,25446,4698,11953,7175,4703,15938,15721,15440,21050,4716,22035,21806,18796,4718,17318,12511,4734,12947,5871,8275,26007,17110,4741,15602,16725,25580,9862,4744,19095,13483,12001,5869,21856,19249,6084,11882,6334,15337,12703,21830,25613,21328,4745,17652,22959,15884,12513,16852,16493,19918,4750,13209,21008,19128,12389,11733,16543,8533,8517,5689,16562,6657,11652,18474,25763,18814,25924,4759,10051,25511,8383,22563,4761,7824,20219,9071,15596,4762,11265,21080,6009,15797,4768,24562,25649,4769,4778,10970,24022,9354,4781,10983,4782,9105,11076,4784,24144,17281,18610,26312,9290,18797,6861,4788,4789,16790,4791,19176,4793,17898,6624,5058,4795,7909,16420,14429,5356,24739,14450,4800,15285,21991,14054,13994,11442,22780,4802,4805,18446,18013,8723,20605,8595,18815,10953,17450,20762,10563,14254,17720,21201,15835,24654,4806,22402,20797,13006,8521,18430,13251,12290, 12553,13372,18355,16662,17034,8965,12609,4807,15188,6145,4812,12725,23512,22961,4822,21389,4825,8077,19279,8291,19599,18322,4827,21296,4831,7738,16288,20723,15742,5528,4833,4835,26076,12844,21196,14278,6389,12720,18285,13784,4841,7000,8628,18482,4842,13560,17256,13633,18495,10279,4849,17921,10977,23841,6405,7140,21105,8300,15941,14190,4850,7411,15881,4853,19123,14704,10391,4856,11903,6812,4860,22216,13950,19069,22340,4862,10449,8697,18075,19171,15474,10436,4865,8281,7923,21356,4873,12280,21522,20580,4876,19121,25083,12929,6338,12619,19517,4878,11388,15288,5135,24061,9667,12459,4880,21066,18514,25374,20146,4882,13649,17457,14487,20032,18287,9606,13380,4890,6520,11833,10130,4894,19669,5426,4902,18432,7454,26004,19845,18181,5551,25082,6489,4904,15647,8954,24894,4911,24105,8394,21342,23071,16982,9946,19318,11989,22704,4912,10407,14667,8774,16843,17128,11896,4914,17912,4915,18707,25627,13281,7182,4919,18180,14216,23103,4923,4925,7890,12189,8212,9898,8412,4927,19425,15191,17053,10206,22558,4928,16886,5471,16259,9223,26535,4934,20417,24742,16233,15028,15740,4937,14940,13078,14890,10217,15500,18469,9074,13233,10658,25320,20043,14749,9081,19714,13948,6599,7424,5304,9420,4939,8864,13683,24669,21704,16860,22927,23176,24484,15390,9497,15861,14473,22498,4948,13943,14788,10690,10297,6732,15437,7655,15906,20040,24084,4950,20610,17071,5787,10484,20657,8476,4957,14140,11735,15999,17574,24073,4959,15314,5987,23509,17905,4963,7023,20921, 5858,6963,4965,14661,16431,7562,22665,11764,4972,18104,4975,26417,4980,7811,20512,17055,14947,9532,20700,4981,6810,23528,4986,22101,20462,24343,7260,9179,25220,12040,6671,5473,11320,21363,4991,17158,4993,15763,12657,7024,15300,20999,20568,5004,13052,12237,17889,5005,20246,14777,18168,11576,5007,5807,8511,5009,6283,9826,20896,25198,8948,12983,5012,19434,9750,5020,10776,17402,17301,5025,19524,5033,7574,5037,24955,11921,6845,5041,19449,6380,6754,8600,16267,5042,17206,14552,23606,14651,19401,5045,13951,13797,13906,10947,5050,14002,17983,22334,11376,8328,5957,5053,5349,5055,9813,21088,14586,14844,10518,8406,25702,5732,13569,5060,23714,5064,11083,24961,5066,10674,17656,5068,7224,14591,23294,15219,6663,8706,8231,5070,9196,10826,7148,7319,7070,20578,17049,9361,23600,24697,25918,5071,14892,7996,5073,12744,14286,5390,17504,23548,8919,18700,18607,8661,23073,6793,25065,9444,18528,12100,14707,5118,5080,18628,6103,14541,20571,5081,19913,18310,18581,16775,19220,5086,23371,13516,19252,20898,13171,11070,26102,17956,8860,8410,5616,17963,7905,12432,26692,22238,16246,20260,26600,24071,5089,5115,8635,10364,25689,10589,5119,11034,23240,5123,23126,25668,5124,18947,8427,5126,11334,14439,5134,18111,11656,5252,11307,25961,25685,6210,18248,7221,21710,5139,5433,13519,26030,5142,14227,24154,22243,20936,5145,14182,16984,5226,5148,7119,26261,10848,21869,21750,5152,14152,5160,5165,7291,10628,22210,5733,5168,17662,19417,12026,23506,5172, 17298,17865,15877,14043,21641,9751,22620,6978,5174,17888,5176,10998,24170,20734,5178,18698,24985,20919,17881,5182,5230,21157,18158,22587,24564,12975,25286,5191,18051,22412,8111,16406,25827,5517,15452,6823,25452,11396,16463,22479,12674,24578,5194,15911,20555,6322,14057,12110,5197,5206,14576,26181,19746,24351,8546,5208,5211,25598,14515,5212,16201,16870,23490,15198,21029,5218,13176,12802,20151,8617,20779,5223,7716,6760,10003,5250,5254,26635,26719,14905,14029,5258,10807,8809,24462,5260,11124,21763,5262,15899,15563,11218,5264,22842,20852,5278,5280,13697,11580,26216,15992,19035,15733,21227,20170,26386,5284,14629,10365,20377,5285,14158,20275,5290,5561,5306,8626,5291,16477,11549,5294,18161,21559,24605,14288,17240,17016,5312,25312,15178,10406,14642,11162,19754,19943,6662,21662,14104,5314,9292,6418,12597,5431,13030,17797,22909,17045,17211,5316,16524,5318,12930,5320,21926,5929,8336,10204,6992,5329,20037,5332,16978,23887,6929,19642,5333,12557,9942,21391,5335,15425,16056,5341,9013,7579,5343,10427,5347,9833,5352,21643,22513,5355,14904,25466,5358,6045,9240,5361,10106,5363,12573,11606,9318,5367,11278,17643,19293,9974,23132,14838,21013,20089,12152,24823,15458,5465,5373,13708,6250,7726,19053,25004,16106,26391,16344,5375,7544,19421,5380,16863,18879,5383,5386,12585,14716,14589,25113,5389,14275,26020,16744,5397,26495,16519,5401,19195,26101,17416,16403,5409,6201,9435,5411,22541,5418,19170,21619,17942,8122,15407,5435,25972,22469,25481,12400, 20399,12692,5439,11395,20094,8912,22611,18546,9785,5445,20333,5916,5447,16748,18533,11250,6388,21876,22810,10521,12656,6016,25682,14590,21223,20087,13491,17510,10288,5449,25508,5451,18046,14166,13289,14826,18566,8614,5452,21722,8782,12633,24909,16268,16476,8810,13527,18936,11638,25460,17194,9629,6737,5459,23004,8131,5462,12019,13873,18944,13641,11356,23148,10680,9236,9765,17292,13576,9371,8722,15580,9979,5478,25749,11563,14252,26060,5486,7314,17254,22366,6538,26595,6525,6429,5492,10239,18803,5494,19347,10675,23582,5496,17858,16833,25610,22668,11693,17224,25310,5501,17299,8698,11063,5503,16255,7741,22935,20294,5507,23475,9173,22980,20195,11304,14326,22880,15658,7113,8769,5596,11545,6106,12227,18923,22857,5509,19441,17584,5514,10928,18412,9033,14932,9109,17555,5524,24558,5527,8477,18398,21137,7114,14074,12147,14529,18989,5530,16992,5531,20537,17759,6637,13469,16754,7445,5541,11738,23145,5545,19433,19698,5550,21785,13205,23901,5553,9572,17598,5555,25874,12243,5557,22265,10990,12383,5562,9383,19659,10392,5566,8700,21554,24074,13737,16306,16169,5569,23651,12689,5571,14148,19430,5580,16667,19885,5584,11478,5589,15751,17611,5591,15927,23997,9641,5598,15787,22526,10158,24011,20729,24223,23428,16575,6770,19902,9714,12561,5601,19482,10120,16092,20992,10200,10787,16379,5608,15176,23783,7612,15347,6549,5611,22145,24423,22649,19424,17017,5613,12089,23108,22019,6765,12034,13459,14887,19092,5619,16713,25992,5620,19223,23518,20063,22163,24615, 19328,25954,5625,18611,5633,13529,19851,5636,22188,15463,24592,20766,25228,6368,16853,9569,5638,9584,17426,15182,13914,8801,5639,23267,5642,23302,22517,5648,5650,25175,19324,17767,16557,8945,15096,5652,21404,6154,8578,18585,10672,9917,5656,6820,13332,5657,5667,9624,22213,5669,24725,20109,10265,25872,15673,20380,12439,11870,26663,15863,21875,16630,16568,7932,11100,6867,19520,5672,18820,22562,5674,8353,5676,17153,19647,17544,22177,14303,14639,7891,5678,6304,5679,5785,14125,15140,14388,5684,8604,22884,18708,16731,24356,5686,17509,13058,5691,19834,5692,17439,22722,12017,5697,19188,7815,8378,7294,9837,20517,5702,12463,20923,10185,5705,22803,9652,5706,17974,24407,5709,11987,21573,24560,22091,16084,9457,25272,14219,19034,12252,20113,21956,11092,13545,7415,18112,5712,15925,22736,19694,5714,18577,26177,5718,11534,26534,20004,8766,5722,19882,7452,25067,21880,24168,11650,15283,26027,5726,26530,10141,18435,6831,5727,11117,22806,11518,6131,5729,13586,21899,26353,23869,5730,14420,5731,19368,22478,19627,20074,5741,10383,19289,9953,5743,22185,13224,16139,15148,8265,21027,24495,5744,20429,10414,23338,14854,5753,17414,20980,18669,17104,5758,8080,17800,8501,20164,15342,15777,6109,18381,16797,7463,11925,5992,16359,7725,5762,22335,16795,20410,5764,6426,7432,23411,16080,17291,25721,18520,5768,23276,8447,18176,15109,12978,6142,25395,5770,15604,13115,5773,17676,10146,6209,22816,16937,19020,5777,20800,18160,7552,5781,6306,22454,11490,14769,18633, 24908,25448,22832,11916,16362,19788,8772,13182,8133,21807,5783,21962,23480,23293,15332,14755,7958,8368,5793,16339,14452,13025,16358,25555,9028,5800,13743,23848,5802,23472,19472,19072,5809,19786,11151,11336,9207,5811,8134,24797,10026,5814,13464,12917,5815,10572,14636,16047,17438,17846,7524,5818,12074,5821,18302,24748,21282,23715,5829,18646,26172,15560,16617,21076,10798,11273,7826,21695,10450,14465,23709,26289,5834,18525,13540,18948,13978,21101,5848,13138,20368,5850,20740,20360,20306,16454,5853,13269,12371,6717,23990,20066,5862,7674,25013,19537,19672,17334,13451,18571,5863,26082,25559,23877,5865,20772,5867,17945,5870,9730,21035,24573,22437,20638,23178,20573,22314,5878,24934,17338,23494,19709,17446,14518,21978,10999,10236,8316,20712,9338,15970,25147,19801,26225,5880,13072,12999,5888,25574,12452,13630,5894,23093,5898,18289,23627,17514,18690,14504,8646,19058,5906,20240,18038,15344,12705,22008,5907,12229,13570,24414,5909,5915,18165,17312,17271,21033,16299,5923,11358,7874,9114,7464,19011,5932,20679,23221,5947,26431,13202,5948,12507,5950,26161,21812,22002,17855,5959,20631,21248,11705,15844,24765,5960,15402,15472,13859,8190,17747,9613,13933,24951,5965,22931,5967,14927,6913,10270,5969,18681,17478,5972,25983,11573,5975,10295,16291,19756,5979,5980,20013,5984,17928,5985,7778,5990,11021,26166,5997,10017,15967,9945,6003,11466,6005,14490,10707,25457,8357,10945,11399,6007,18741,11624,7843,8704,14351,6013,20899,6019,6375,6021,18496,21292,20979,9316, 24875,6022,23017,6026,9823,12304,22506,9907,13112,14264,6170,6033,17363,6035,25615,6036,26404,6061,6041,17341,9697,17095,6050,20616,11809,12456,12492,11226,23808,15972,6053,16389,26005,24698,6054,16128,14138,23504,23499,9947,12123,6057,24166,6058,8456,13319,11582,6065,9908,13371,21562,26464,23790,9278,11059,22910,6069,24132,10907,6073,10726,12985,24952,24873,6075,19309,6271,25900,20912,6077,21401,16087,20439,18506,12836,16023,17984,11016,9302,8289,20433,8021,19628,21687,26707,24668,6079,19635,17373,6082,20830,6083,26056,6085,10817,6196,18172,6090,20381,8422,18099,15313,6100,15915,15595,20235,13186,20653,18197,15976,16264,15278,6102,24568,14321,25503,14931,26064,6104,26153,21769,26207,19890,6121,26544,15773,24566,25648,6625,26180,15990,25022,6123,6136,19730,6219,6138,8545,6146,7833,18026,9561,19868,13411,26009,21526,7644,20835,21525,9617,9978,6149,17774,8421,22384,17198,25757,12308,6152,19805,6158,14644,6822,6162,8388,19337,6166,23025,9328,18043,6172,26025,6982,18531,18157,7474,6175,6178,9877,23179,11717,7698,24547,14238,17677,7515,22065,15931,8382,6180,7118,17820,8573,16890,16700,24966,6185,23750,24075,22100,12081,25868,17960,13656,8995,15732,20193,6899,16386,6188,12743,6190,24067,6194,8443,21976,20088,11503,15273,13500,14266,6203,10233,8084,6206,12320,14187,23837,6208,23130,6217,7240,6218,12192,18818,6225,14083,16604,12535,6228,26688,12455,6230,6232,18800,11110,6233,7553,15659,6238,11843,6245,22066,15886,17377,6248, 18866,6252,15324,23792,12921,20466,18668,10466,25099,25830,12694,13349,14339,6267,16671,7581,20943,15229,7667,22682,12165,6269,18348,19957,22681,6276,21602,16820,25882,15943,13755,18636,11848,10949,7358,18697,8280,17172,22777,23023,6286,13019,20237,7437,20016,9095,22486,8752,6288,12790,6289,11284,11093,22815,24059,22843,26762,22372,17933,6291,7643,9772,25381,22511,6295,23007,9261,24711,11986,14479,13811,22264,8654,6299,10115,18835,6305,20375,14172,17587,23431,6313,23958,18643,24159,25518,15820,14000,25132,17649,10517,10259,7357,20655,7734,14251,24091,21974,26355,6315,16219,16471,20230,25692,9100,11659,17836,22399,19964,11700,18597,23473,12809,12770,6321,14626,10897,14849,23926,18462,18503,14151,9923,6326,6328,25325,10043,11787,24759,6332,21413,26029,24036,6840,6335,19649,6337,22726,11728,19686,17088,6340,6591,6341,10153,9505,25294,6343,26034,25301,17866,8150,6345,23466,6346,14560,6351,7285,15846,6741,23496,16682,18452,17579,6353,9840,9206,6355,23531,12771,6358,21089,6479,18709,23697,11132,6360,13288,8485,9921,26137,6364,16013,26673,11125,17157,18795,6367,6369,16583,18484,15064,16388,26304,14917,7042,20457,24465,11566,12079,6373,6374,22325,24334,21998,6378,6384,18793,25477,12073,8304,10247,26086,24906,21020,18993,6386,24042,18827,17412,6881,6397,11578,20025,23387,6406,15403,6420,21980,6423,13590,15087,15529,6428,6435,12117,6438,22321,23488,6440,26465,25509,17595,6441,13444,18149,6444,12678,9910,6449,15057,16064,21208,23185,20206,10077, 22569,6453,15118,13713,25571,26405,17482,9182,7316,20425,23791,20492,7691,6457,14407,9799,22146,6462,18973,14843,7499,17679,6464,6468,10078,26504,8526,17037,6905,6473,26446,9124,6485,11009,6492,8174,6497,18400,22833,8358,24368,21502,25160,24814,25646,22413,25394,22468,20090,18870,7684,20254,15598,23436,6499,21225,18901,10847,11208,7928,21977,8543,22863,25298,11464,6503,11491,23265,9277,24516,6512,19375,19315,18175,15157,24916,6514,20567,21844,20026,24251,19775,6517,7431,7444,17213,20449,14819,20071,12860,21175,6523,6530,21846,25035,26511,19879,17900,18808,6548,10965,6554,15799,13817,6559,9417,19533,6563,26307,15394,9402,18865,19272,21214,6572,6576,17142,15060,14481,16377,6582,24995,10159,8653,11528,19875,6585,19944,15891,6586,22041,24738,24330,15741,6590,11889,6592,19311,6598,9403,20784,6602,22862,17827,26402,23024,6604,16719,23626,10973,6619,6623,11671,23625,6627,26094,8585,6629,22203,7034,18066,26077,6631,17065,7639,12299,24880,10859,25356,9975,15132,6639,12543,6641,16973,21794,17485,17325,6648,19285,6649,13571,22289,26486,25547,22823,13854,22476,6655,11939,25849,21823,18402,6660,17697,25705,6668,24463,10058,9018,26619,14621,6677,22007,26015,6680,19269,24818,6690,17627,20372,24289,18926,9566,23459,9729,21601,13265,21790,15031,6692,21095,6697,16082,8826,6702,12613,25832,18006,17149,13487,14302,6713,23829,15514,19329,16113,23349,9878,20636,6730,24400,6740,6987,20451,26702,7918,11757,25443,6743,24910,10570,22800,16808,6746,19886, 24019,25223,11815,6749,12701,6753,21286,6766,6768,15281,6774,15076,22742,6939,17710,8778,24294,9498,6780,16773,10536,9780,6782,12850,12760,6786,10763,8768,6791,6799,10725,19151,15158,8223,6804,24324,9519,13293,21203,11020,6805,26753,6821,22215,19702,6827,23585,17229,17660,21890,19453,17646,6830,24099,6838,16473,6846,13780,9859,16383,19134,6853,18088,24278,12362,17603,25120,24304,14220,14938,10746,17741,11286,23058,25999,6855,11915,6857,23815,7007,16708,6860,12916,18479,16301,6862,6871,18598,7814,15849,12669,19833,26480,9260,15237,7359,13738,17152,6874,15079,9800,20400,18144,15083,11305,16060,6877,15367,6886,19094,22886,24143,8402,9531,6901,12000,13609,26281,24323,26652,12742,6907,25041,10205,6910,7927,26133,8429,21878,6922,19536,21148,13077,16646,15493,6966,10764,8552,6924,8236,9749,25141,6926,18465,21325,12986,6927,10079,19869,12359,6933,19522,24753,19987,22912,22079,12604,20783,20982,10719,15781,22113,12015,11732,8149,18365,6935,18427,10729,6946,20940,7753,11030,18712,16479,6949,14105,8327,14718,15524,6952,10905,23142,6960,18930,8035,19978,15897,6965,9958,20549,24058,6970,8475,16917,6985,14567,19518,13637,16665,22302,12406,18838,9422,12292,21334,6991,20539,20229,16529,16168,7001,16619,7003,15649,7009,11289,22421,19393,14684,24145,7013,9501,17585,7014,24258,7018,25289,7022,14056,11219,20730,13679,18425,7029,13376,15471,23832,7031,19729,14721,7033,8563,14243,15648,7253,14284,11266,20714,11754,17604,7036,20069,7037,26290,14874, 9038,7041,20455,20732,7047,17079,17310,7050,24190,17979,16740,7053,11332,20775,7293,14215,20534,20761,14876,17840,10503,7060,18422,18166,13113,14544,7062,21953,19130,13134,7076,23616,7081,24925,20304,17671,9007,12285,7092,14157,18922,8934,9360,7095,24729,7107,9988,23065,24969,13893,9145,10596,26397,17678,7108,20870,14713,14248,20990,12606,11978,14623,8359,8093,9172,7111,20420,7115,26116,21277,7124,26429,9489,7134,7137,21402,26263,15294,23280,7139,19297,22532,13814,21417,14245,13038,9778,7141,12086,7143,19456,14064,9450,7147,14910,8380,22363,7149,9824,7953,19930,20975,7157,26513,20173,11844,7159,25033,14563,7162,19929,18613,25815,7743,7165,7178,19914,13578,19144,7188,18527,15944,13967,25549,10274,7190,25901,25045,18919,22094,7196,18787,23723,20301,15450,19364,7197,19226,26230,7202,7590,20652,10849,14296,13431,15880,11782,7204,16701,9627,7219,12551,11571,7210,19067,10157,21576,16256,7216,26500,7217,23493,7226,11950,7664,9455,7234,23421,23920,26120,20968,7237,21800,15137,20484,22846,7238,26302,10874,19389,8468,7241,12599,7252,17566,7262,21437,19197,20344,18132,21143,15585,7283,15581,14891,7264,10472,7267,12679,7270,18667,7641,19609,16865,18595,14866,15072,9118,18411,12083,20467,13847,12855,14764,7353,21791,7278,11003,26501,17629,7280,25011,8058,21664,7288,12865,11584,12060,7298,25527,15555,10831,23150,14330,23592,23711,17445,7304,10860,18988,14449,25213,13064,24176,7306,25933,7310,7320,18220,9456,7326,16750,10425,26474,7447,7331, 18526,8019,20290,18542,10483,9872,22536,7334,21658,7341,24432,15699,26548,14270,15318,10214,24663,25586,11323,7345,20799,15642,10345,26730,22660,24479,24975,17290,20674,7348,26236,22463,7362,20305,7758,12445,7366,19398,8765,8207,25341,7792,13554,7371,11429,20076,7376,22351,8731,7378,9135,22182,14650,20084,7382,11468,9723,7384,22974,11808,21094,7386,8314,8210,10956,12262,20165,16024,16001,12707,21583,20996,7387,24889,24744,7394,26272,20261,14271,7396,14379,21429,10703,7398,8938,7402,15271,14003,9725,7413,11538,8024,16944,20125,7414,25044,18656,20298,7417,7418,13271,10936,7438,20684,7440,21474,10893,7442,7451,13572,16609,10048,7456,21180,25885,7458,14300,9024,18344,7462,11849,20077,7465,16095,24802,13563,24499,20291,19040,21388,7468,9367,7487,24919,7489,25965,13130,15161,18995,14391,22631,7491,20238,24667,8444,20465,10543,7493,7498,16448,23389,24883,16927,10163,26581,7501,8049,21728,21032,7512,8201,26657,20927,26370,25379,25309,7520,18222,21146,9010,10019,21350,10773,23702,19305,11792,11778,7527,17740,8666,21479,15181,12293,7530,16550,8755,7534,8534,7536,7538,15934,17882,12453,18271,18347,15924,21407,10544,19665,18978,12571,14547,20945,10916,21284,14130,7542,11285,19446,7548,14670,7550,19348,24602,7564,8414,18424,16781,20935,19567,11220,7649,15227,11714,7567,19755,7569,18512,9857,14206,7573,21034,7576,26212,7586,16209,24364,22391,11103,11639,23966,22023,11394,7733,10800,21834,12004,17822,19724,17027,22310,7588,7594,23039,19691,10400, 7603,12067,22669,15528,25985,8580,7605,16658,14349,20669,14870,16873,16958,7608,22928,13618,24936,12049,13193,19455,7610,23433,15888,7631,25984,14457,9429,7635,15520,11548,17114,7648,19187,21966,7657,10034,23968,7660,23186,17201,11900,16266,17749,7675,16892,13901,11895,7678,9433,20000,11439,10801,7690,12006,19180,20902,20735,7694,25898,10040,14045,7702,16439,7922,7705,7707,15275,16400,26681,24524,18974,7708,17536,14133,8007,7719,20889,7724,13151,11920,20357,13872,25058,7737,8102,23157,7746,25650,24140,9256,15017,22814,23510,13658,19906,20350,21700,13696,19966,8645,21596,17381,7749,15715,7757,21645,12135,10651,7760,16841,25245,12685,19466,12529,10376,15065,11365,16760,21086,17447,21598,12266,20960,7763,7764,21642,24628,10108,12075,8568,7766,11798,25664,22881,15289,7860,7770,17015,7781,25262,13523,7797,7800,19451,16230,7801,13640,7803,9370,13297,10716,16561,14468,9063,16039,7805,11203,25108,11473,26052,15378,7810,13021,23252,18813,23233,7873,7812,7817,18116,18221,14774,7821,15341,12789,23051,7825,13311,7828,18773,8872,8416,12886,23169,22710,7831,7832,21322,23161,18223,11004,26338,17633,14607,13093,15809,20575,7835,20061,9590,15214,15708,7836,15652,24046,11438,21226,25790,7840,25185,21756,11759,23374,7842,22885,7846,20858,21323,18555,8567,7849,11353,26286,18985,18346,26019,9756,7854,21432,24996,12269,17021,8020,24838,7990,26726,12137,7856,10033,14012,7858,13863,13963,16298,17168,16889,23160,23856,17667,7867,26183,25184,12510,18946,25699,12261, 10912,9581,7869,20256,12316,24259,12113,7872,17994,15510,19824,7875,16452,20072,24504,23952,21783,7878,7884,10264,7886,13420,17545,21149,22260,7888,8787,17936,24957,16470,7892,24857,7899,21871,25096,18080,13843,13669,23907,7912,21171,24576,14025,7920,14688,7934,8745,16861,9279,24787,26047,24741,22894,15996,7939,7941,9037,25754,18167,13634,25138,7944,12272,24574,10863,11668,15196,8776,14527,7950,19330,15823,7957,23079,7960,24313,17809,17382,13879,15054,13106,7961,15859,24001,8581,7963,11640,7969,11894,22619,21931,7976,7978,23564,9475,10632,19747,10630,7980,7984,16044,22792,10242,20615,18140,14124,24115,25437,24776,11452,11919,7989,23429,9061,20977,19192,21340,25560,18625,23983,19079,22359,15228,25623,16465,8001,22679,8891,8005,22326,8009,19594,20987,25603,14833,10356,11968,19350,14491,18445,8014,8016,19209,25792,8252,12213,8531,8018,8025,19611,25380,25998,9687,8031,26608,8916,17196,8037,23013,26556,12671,18041,8042,17030,25008,14637,8044,12839,15722,8045,8053,26647,15701,8743,8055,24054,14618,18201,18556,17711,22042,8062,17824,8369,16276,8727,16996,12502,15315,24686,23056,18259,17989,8063,22295,8068,9201,19780,13250,8088,22566,16042,23889,10147,18692,8090,8259,16357,10980,10520,20303,8092,11593,24116,8106,19588,8108,9972,8110,8446,17040,15832,10740,8115,12482,8117,25087,24014,21289,24006,8118,21056,8121,15635,24837,17182,14093,11414,8127,9238,15077,15124,20280,19630,8130,16338,12069,23032,10657,8132,18444,19963,8140,15404,9178,8144, 21529,12121,8147,24208,13386,8151,13428,15207,21428,8156,25417,19703,21629,13336,14690,9666,9973,9915,25039,11085,15612,22643,8159,10971,10167,15306,8167,25449,22136,13986,13429,25190,14471,8172,8173,20842,22073,19167,15226,8177,24829,18282,20376,8179,10647,9086,26668,10963,8182,8185,9294,26550,20819,8192,11780,15513,19442,13813,13834,25116,8194,14121,8196,16787,20625,18548,8203,14714,16391,15978,19797,21074,8209,8211,15416,15922,17160,21816,8214,9160,22729,8216,22695,23859,8220,13326,25939,9726,16547,20516,15049,12191,8232,17304,23248,20232,21078,10468,21285,16587,8234,22273,10298,20697,8238,16648,21835,11275,24280,25123,22745,8244,8254,15264,15121,17245,8255,23812,10927,10886,25772,12027,8256,16244,13219,20942,10778,13558,8258,20491,25782,25893,18177,24265,8263,9220,11819,8271,10380,9576,8283,15641,20440,24386,19719,13107,24640,8293,21973,9544,8295,8299,25219,26280,8306,10709,23134,11407,18494,18098,10235,13282,8313,19435,8315,8322,12228,25673,14831,17192,9513,8324,12315,19477,19286,8325,8330,10918,8342,10177,25354,9468,23820,14272,8333,23214,16779,17571,21247,14241,8338,9959,11058,24447,10422,18855,8340,24010,22746,16499,21950,23255,10090,8344,19950,8347,22822,10507,8350,15029,21299,8356,17608,24469,14111,11712,11585,8370,8376,10441,18789,9055,15274,22266,11514,19409,10405,23744,24915,8393,16490,12466,17322,13973,8395,11597,22595,19319,23390,8400,8413,8846,17870,14875,21808,8417,24346,26308,23410,8425,14689,22034,12805,12333,24300,8900, 13685,9125,16778,9161,18767,26718,8431,24250,15839,25768,18931,21304,14641,12708,8436,20023,12969,18373,19273,26516,8455,8461,13099,18653,11988,8479,10904,16485,20403,16616,25930,25891,25179,8483,22590,24555,15816,18532,19422,11315,14261,9230,23353,11975,17066,24831,26579,15916,8492,16815,11121,17931,23638,13934,24991,20891,12036,8956,8495,21213,11038,23306,22004,8499,14200,12900,11065,18253,8504,22756,20941,22907,18981,9439,13504,8508,9409,25621,22160,8509,19131,20030,10044,20122,22934,8512,21521,26656,8881,11420,9597,24337,9588,8516,26012,23878,10180,8519,10231,18747,24890,24528,16706,8751,21697,8520,8522,17787,8548,10519,15495,8554,13331,17657,8558,17242,16162,13184,8561,24434,22840,15353,18078,19731,20792,8565,20018,22028,8570,23044,17966,18125,8584,24833,8587,13175,12876,22089,8590,14794,10188,11880,17085,10839,11562,8599,24255,9839,12338,22284,17526,12843,14112,17861,12524,22224,19448,8603,26403,11797,15687,8608,9154,10062,17471,15518,25304,22032,8611,17154,15617,8629,24780,23681,8638,13449,11293,8642,14293,22888,19075,19638,8647,14805,24549,22661,16654,8649,14810,12631,8660,16592,8662,8664,15723,23287,14646,18744,14694,8672,18743,8675,16806,21188,25072,10670,21517,14120,18304,8683,11403,8685,25681,13341,8689,9235,24501,8692,12848,24608,8710,11343,14960,25647,18868,24365,19489,9471,15037,8712,13124,20493,8717,8721,23989,19593,17260,21595,21107,9887,24521,8724,24088,18456,9721,8728,19502,20162,21919,22677,25736,8737,24603,10868,15575,19778, 18757,8738,23801,11965,22896,26750,8747,22369,8753,8758,17686,13818,14306,17078,12190,8762,11157,18234,22740,20489,8775,24172,17449,8777,19150,8780,13506,26395,8789,8794,22651,13203,8797,18343,22873,16148,17280,14825,22659,17116,14290,25169,22650,9263,25282,20869,8800,17756,17465,23576,21348,15419,13654,8805,16008,22964,11831,15094,12693,14754,17531,8808,19042,8925,26478,24312,17714,20690,16823,8812,18603,9407,20594,14509,8814,25302,8818,22510,8820,13857,20295,8822,16661,20480,8828,14005,18100,23885,14692,19748,8831,21818,13279,22960,17880,9980,18731,8837,8842,9169,8843,22549,22132,20543,10509,8851,12115,8855,14103,17696,10724,16946,15583,8862,14136,23863,13584,8873,16690,8875,26345,14320,8885,13245,8990,8887,24290,18510,13938,24927,24636,20180,8894,24445,14501,26010,13700,22098,8902,24177,9686,8904,8920,11586,20231,15680,26502,14072,11966,9076,17775,12949,22933,20178,8924,11306,20654,18765,20096,23532,20228,20177,13826,14802,8928,26428,14253,23932,9933,25587,19997,23545,24038,11317,10781,25195,9553,11483,8931,25719,11840,18337,8971,13432,8942,23659,15672,8952,8955,16608,21969,14878,8959,25247,12091,24634,15388,8964,22025,21444,17778,9264,23787,18251,25244,26739,13628,21048,24523,12282,10992,9556,20253,8970,20908,26678,16210,8973,24005,26382,8978,22914,17761,8985,18378,12811,19154,8987,26079,23189,8988,17884,15689,8989,10262,20144,8992,8994,23800,19257,8997,26035,15634,24240,20774,18770,10284,8999,22732,12367,23587,18661,15099,22943,23094,18848, 21891,9001,24408,14392,9003,11917,9327,13337,16653,9005,16341,10767,22197,9009,10964,9016,19278,13358,15738,9020,11308,23244,19049,12046,17785,9027,11259,9031,22533,9034,9040,20300,10887,9043,9045,22689,23929,20557,19135,23457,20051,18146,12021,23383,13664,13589,16152,9051,23777,23008,23283,9058,20099,17215,18517,24271,12556,12483,12465,14812,20137,12033,9060,21733,19894,15438,24964,15304,12732,11127,9064,20803,20326,15887,9065,9838,9068,17311,9072,23129,24664,9080,9340,9084,13686,17472,25435,10218,9093,18030,9096,16429,22257,24606,10171,9117,13653,16164,9503,10585,9127,18148,9131,12562,18736,22180,9133,19554,9134,16327,13800,26330,25853,9144,16931,18300,13935,9146,15757,25733,14162,15808,18550,19629,9956,20853,17548,22033,10881,12016,22776,23972,20456,9153,12437,23757,12643,19872,26629,9164,25255,21566,13090,16151,9488,23430,12723,25994,16323,9170,23010,21897,9176,26603,10075,9400,9181,9820,15885,9184,9186,25894,24903,21965,15156,23698,9192,9194,21698,23439,20138,22189,10128,17470,24863,23743,9197,21233,9216,20414,19760,12552,9217,23396,16576,9226,15975,17713,22954,15469,9228,21394,23913,10213,14228,16730,9232,19483,9237,11255,9803,15120,19920,10055,22462,19713,9242,9244,26063,25389,15193,23999,13438,9250,24553,14265,18573,9594,24232,18934,10938,9258,25722,10677,14175,16336,9266,9267,14532,22787,18998,18719,26072,11440,9273,11850,26054,12134,9286,16625,21511,13694,11075,23201,25838,23158,11793,22169,9296,23382,10942,10855,9299,20143,25979,23818, 9305,9307,9843,20361,13043,17500,20805,9314,16720,21043,12286,18044,10311,21084,12387,24227,9330,16875,11830,22005,10919,15036,9333,18794,9341,24638,26708,21902,16835,13991,23163,18859,9348,12883,16578,9352,17681,23860,9359,13291,14508,24152,9362,10022,9369,13304,9374,24241,25156,19598,9377,9381,9694,13413,26146,9386,15309,13128,12380,9390,24939,9408,26134,26565,9413,15333,20619,11223,15724,9416,24828,13742,22084,9419,9802,17220,9425,20964,17130,9427,13631,15802,9430,13646,14496,20993,25050,20401,22859,13031,9432,25399,9437,26348,22691,9440,17339,23352,9443,25942,22953,25490,19238,21582,24394,15453,14782,11190,12824,21257,25841,13167,22082,21493,9445,20140,9448,9454,10134,19873,16058,22490,22617,9459,9463,25857,14846,9464,23973,23678,9470,10018,9480,9483,25824,22214,23725,11927,9496,16851,15218,9502,15386,16371,10930,24769,9507,19100,21886,25837,9512,15850,16672,21073,9514,25406,16165,15290,22415,18028,9517,26017,16032,12623,12962,14492,9520,15618,16226,22524,9524,9536,19316,12068,11437,9538,24898,23204,9542,13659,14095,9555,20476,21544,22647,9559,24244,18943,17995,9563,19039,11760,16423,17899,9568,9589,19515,17222,10822,14696,15640,12536,9570,25077,15523,9574,14861,9579,14159,9583,10885,9585,26160,26542,17003,20656,26043,11193,9591,9593,11565,22258,9596,15024,9603,21734,9605,24534,9609,24886,22223,17077,25094,10254,25734,25541,9612,9998,16072,17725,15862,9619,9621,11400,14725,25201,9632,19029,21982,18699,17223,22472,9636,12801,9643,20473, 11499,9655,15517,9658,10510,16737,9662,18755,12509,9676,19116,26677,22204,11329,18194,22144,9835,24674,24396,14022,13645,9807,21901,9678,24426,22613,11130,11261,9684,14578,20570,21821,10598,25012,17313,25847,10629,14871,21416,16531,12897,9688,22411,10809,24572,9692,20750,23643,17272,25171,24357,9701,14800,9709,9710,19291,14951,9736,20012,19346,10538,19678,22338,26437,18623,24398,26324,9738,9739,18095,12474,22766,9754,13366,10577,17857,23933,15250,19741,9762,20874,12476,23307,14055,23590,9928,9766,17406,22950,9775,26248,26447,21306,21644,16385,22648,10691,16265,11131,14310,18339,25075,23660,13789,23412,19299,9782,17618,24238,22406,9793,22893,20463,15002,12193,23758,18829,15494,16366,9984,20577,13443,17910,11945,21911,13198,9796,14171,24296,17582,9811,9818,12412,25313,20075,17063,19355,9822,26441,19937,17645,26703,9830,24317,25951,9832,13936,9834,26506,12245,9845,16289,11082,21510,9847,13377,16314,20271,9850,22301,23258,19097,11095,16828,9853,23639,11790,20687,9994,26139,24826,9863,17148,20596,9868,20588,10230,9891,9895,20430,22540,13885,11908,9899,21414,21147,9902,9913,23868,24705,18952,9918,9930,26321,12251,14009,9948,15571,15107,9955,22752,12164,18619,24411,16688,11524,16507,11934,11496,19160,9967,18745,21515,9971,22908,16322,13548,9982,9989,23970,9997,19516,23460,10001,20608,18192,10005,10013,17549,15676,12401,16804,12823,18059,23298,10021,12938,20877,16304,20998,10027,12655,10031,17524,10039,24080,23208,26315,12132,22929,10041,14818,12598,21690,20108,10050, 11123,15443,13612,10734,26003,10053,19403,18010,21646,20029,13244,10064,10070,22344,23580,15632,16756,11631,10083,26373,17777,16340,10091,10098,10888,10113,13855,22096,10117,26628,25071,11338,15947,24069,10119,23599,22579,12593,14126,11972,25081,13320,26142,12715,10122,11450,17826,26450,17115,10133,11044,16753,26735,11150,10137,21236,16207,16422,10142,26366,22244,18048,10150,23243,20807,10175,17126,22303,25165,10181,12344,11729,10184,10186,19457,26440,25820,12516,10195,13556,19384,13387,24681,10211,10221,22828,10224,17336,19578,20913,23716,23849,13511,22724,12890,26206,26288,18799,18250,17151,17101,10225,14333,10227,17140,18127,25521,25002,10232,19406,11541,18169,10238,10287,24931,23295,10258,13329,23015,10267,23435,18710,25748,24612,18189,26273,17409,12555,10922,10277,10280,21341,10286,16127,10293,18115,25675,24327,20418,10308,25513,22916,10313,22055,12690,21696,10318,10384,12852,25525,10323,11874,16882,25177,15961,17144,14877,21044,16680,26143,14662,10329,26266,23949,16607,23272,10333,10853,22076,10334,24039,18336,24976,15012,10337,10342,19539,25377,14577,25125,25214,10351,26714,25658,14901,11158,11765,11479,26367,21718,24514,19784,10357,10360,15321,13856,26167,15952,10362,13310,10368,23479,22000,11722,20270,21712,19282,10377,16821,10389,21960,18270,10394,10396,24884,16530,11526,23136,26323,11010,20794,21586,10398,22761,23706,12202,14094,10666,24946,11607,23689,24632,18265,18705,19086,10409,10408,21736,10413,14424,10424,20736,23839,21669,20868,11542,10758,10432,12296,14409,10434,14566,14008,10438,24866,13681, 20963,19855,17320,22887,18286,22858,11690,15878,10440,24734,11456,25644,10444,21483,12700,17876,10446,24283,14791,23608,10501,20997,22618,21569,10453,25331,24756,10460,23908,10462,17593,21727,18374,15605,18163,14803,15779,12264,16594,10464,16986,10471,10480,10474,26313,10478,13374,11979,25756,10588,10489,11449,26599,18314,10491,22290,17252,18965,15786,10511,22249,16295,16960,20184,12952,10516,22713,10526,18869,25121,11645,10529,10533,15330,10535,26383,24589,10549,17428,17119,19254,26613,19266,10554,23534,10564,16867,10565,19340,25709,23067,22507,10568,21242,10569,13488,10576,20050,24645,17255,22246,20289,19115,25949,21051,10579,10581,21546,10592,22855,23788,22339,10597,18011,19773,15865,25233,10600,14283,20983,10602,21789,21638,17893,10615,10617,15554,10624,21287,22939,10626,10637,19511,20892,10642,20554,12927,15018,15692,20755,10649,18393,10655,20651,16132,11129,17444,10661,10663,18648,22768,12594,10668,18297,19688,19958,21385,10673,24992,13620,10685,26193,12059,24799,19062,10689,17006,24511,22664,21903,16120,16182,10705,18375,20155,17832,20021,10712,12596,15185,22582,10722,21861,21279,10733,20641,10736,10745,22612,13199,10754,10760,21038,23740,23398,26089,21938,19194,11740,10769,14881,10777,22622,25706,10792,11957,10794,19660,13522,13276,13617,20169,23710,14274,25412,19089,10803,16712,13619,14244,23982,11828,23468,12064,10806,21441,11241,10816,22901,13824,16643,10827,19823,25886,10829,11890,10830,11295,20095,10833,15937,22483,16447,10840,15790,10869,19262,17624,10873,24963,10877,17727,21688,13671,26419,10880, 10895,23419,21992,10910,16657,10921,10951,24493,11321,23440,19559,21442,23704,22211,10954,13602,10957,22006,20911,10959,16458,15084,20786,14543,10968,10978,15081,19465,10996,24043,21779,21393,19820,19109,13559,26222,15061,22379,25762,11005,20443,13183,11007,16294,11012,22254,16186,24609,11019,20564,22380,11390,19371,19548,11599,11024,11029,23180,11032,13384,16237,17228,22883,11050,11055,20391,11061,14513,22919,11062,26311,17700,11068,11073,20205,22404,16923,13407,21331,13378,16850,20434,24657,11647,18904,14937,25053,11089,18929,11149,15690,25001,19907,23596,13076,15261,11102,22115,11105,14780,23802,11108,24372,23216,22458,19304,11128,26616,11135,11142,19258,11148,11847,16163,11173,19608,12799,13702,19349,11176,23666,11179,19314,11184,19308,25154,11625,13903,11186,16440,16495,22477,26459,11309,11198,18594,21459,20703,11200,12224,15381,23237,20925,11201,17263,11204,11205,19491,17454,23485,11214,21359,19977,22495,11216,25416,11234,11240,13085,11249,22394,24764,25080,19372,20781,21344,11280,18966,12008,12884,25136,23106,21979,11281,23538,21570,11288,13846,11291,20838,21855,26253,11297,18134,24692,21309,18937,24477,11303,11325,25144,20533,15027,15329,11328,19490,13163,24676,25831,17935,11331,14528,20273,23038,11342,12180,22117,19903,17970,17493,16172,11349,11350,13974,11352,17823,23409,13606,26274,11366,19558,26314,20279,11374,11382,26170,13979,16534,11387,19996,26233,11393,17048,23036,11398,11402,26527,12833,11410,16976,20894,11412,16214,22218,13964,11415,11422,16284,21913,16178,23536,11426,22305,19915,13820,11431, 15389,23297,25030,11434,13036,15511,14669,11447,11455,16404,11796,15186,11459,23336,11461,26528,21865,21318,11463,14913,11470,23420,18840,11487,15499,26697,22232,11489,14939,11495,11513,26507,11501,22362,20791,14440,11506,12798,11510,19556,16942,22296,11519,11529,23397,24774,18553,13486,26066,11533,26154,11536,14070,11794,11539,22021,20675,11547,23151,18367,15195,11552,13808,11561,24803,20139,11567,13597,24187,19641,15210,25500,21446,25197,11581,11592,23046,12632,11598,11886,12788,14986,12356,12212,11614,11616,15047,14099,11621,13091,25927,11629,21245,11633,13122,24847,11642,11649,22459,13370,11658,17560,18860,14447,21172,19840,11661,20647,15128,16307,22850,17734,17816,11662,20682,11665,19992,16360,25447,11669,11673,24781,25730,17786,11676,16227,20134,20501,26371,11678,21002,11679,19267,11682,11685,26709,22432,19612,11687,23665,24130,16988,11704,24679,15336,24913,20354,11706,13208,19617,11725,14620,11737,15311,12326,11748,11755,23739,15900,11763,19013,11770,19061,26041,16222,21154,13139,26487,11773,20845,11777,24072,11786,21705,26532,21307,11791,18724,11800,26573,25338,16136,23188,11803,18256,26601,21809,12911,22673,23936,15979,21612,25130,18233,17708,19940,11810,20136,12151,12351,13929,20198,23177,11823,11825,12090,11839,16185,18650,17937,23144,11845,17399,11854,22877,23789,16217,11856,17041,16117,17845,24607,22110,18185,17125,11858,11860,23993,14305,14277,11864,16964,11867,18312,11881,25203,23301,13613,25499,11883,11885,20091,25104,15586,11891,15549,13551,11897,11899,25640,25826,23033,11906,18094,11912,17051, 13639,26375,17969,11941,13739,22410,20824,22361,17042,13961,21678,11955,25114,22053,22287,22528,11960,11961,25491,23980,11964,16558,26388,11969,17173,19726,20309,22001,18547,23175,14557,18021,11977,20722,12946,14924,21352,25639,11985,14196,15917,19237,13231,14237,21508,20257,11994,14736,12244,11996,19727,12011,16474,18053,23862,12012,17815,22765,12023,15718,22597,16762,13032,12025,15279,19122,12031,16957,12056,17812,12058,25531,14658,12080,25921,12099,20932,12101,24013,24983,20738,14453,23903,19070,24188,15686,12103,12312,22294,14292,18407,19508,24968,13273,17632,15750,12105,12388,12119,12122,22778,19734,24929,13220,24415,20083,18341,22638,21156,12131,26632,15577,25981,12136,24719,14404,22514,12139,12144,13944,13037,23963,16430,24200,12159,14756,12169,17423,25618,12176,16286,13945,15032,14743,12183,17117,12195,17273,24431,25911,12196,23253,19202,12205,14233,16670,24207,12209,15589,19218,19439,21850,21266,12217,21627,19568,22270,12218,22397,12220,21447,24702,12231,21946,12236,22530,13837,16965,12238,19038,17796,15454,24027,12250,12254,21039,17688,19681,23760,20307,12257,13518,17227,13255,25890,12263,15778,12279,25856,23598,12284,25980,23749,25869,26567,26246,21934,15543,14604,12289,23346,16083,12291,20398,12303,12318,22453,16048,12332,18269,18761,12340,12342,13752,21014,25607,25248,23619,20121,12440,20160,20820,12343,20934,12347,23358,18924,15668,23458,12353,23181,25620,12358,20364,23736,18457,12392,12397,26300,13114,12410,15254,12414,18193,12418,15295,17437,12421,17241,15855,23785,14335,12423,13153,12424,16063, 26369,12935,23767,12431,22866,25968,18290,19475,15142,16466,12436,23303,23135,24675,12449,12462,17944,12464,22652,23123,18964,12489,22283,13532,12491,23784,12498,26436,19149,21606,12503,26299,14739,12515,17180,14968,12518,12522,20673,21738,14096,19570,12527,16504,18883,14970,24535,20127,25422,12540,21261,22207,26317,13408,12547,22671,14108,13388,12554,23340,12588,17474,15767,15756,12589,13946,17754,12625,26155,12627,18977,12629,13860,12642,16709,25834,14821,15860,23551,12645,24960,15467,20685,14989,26049,14352,20383,25237,12649,18849,25718,24865,16051,12654,25958,12658,21471,12660,20117,15213,21951,18781,12662,18950,12663,15391,24874,12673,20343,21231,12681,12684,22991,12686,21433,20452,12704,15497,17784,12712,18440,26231,18171,12717,26451,12726,22965,24293,12729,14383,12731,25617,12741,17250,24670,12751,13832,23351,21338,20412,12753,14223,26337,12763,12767,16799,17165,12769,12776,19411,26508,15923,25476,12960,12783,22274,12791,22743,20366,15559,12795,13744,19939,12797,13526,18522,15312,19241,20005,12803,26275,26122,26443,12812,23960,18156,24956,14470,20068,20976,22769,12822,19552,12832,26713,18261,12840,12859,25934,23568,25637,20694,17799,12864,14374,20432,12867,15296,13393,13256,24051,12869,19191,24700,17723,12872,18524,20671,17538,12873,15530,12887,23690,24844,14750,12889,18113,17000,25566,12892,19898,14807,12896,12899,20340,26036,17314,23471,14944,18589,16540,17460,14342,26379,12903,24984,17167,12905,20826,14229,12907,19423,22087,16928,12924,21161,12958,12970,13503,13758,24849,13398,12977,25119,23357,12984, 13204,12989,21026,19159,13002,25372,14446,19589,26042,13005,25672,16542,23684,18085,13007,20851,13011,14189,21111,13018,15104,13023,13507,20879,25919,14226,26503,18473,15424,13028,17099,15164,25337,14357,21527,16232,13040,19651,13049,25438,19683,22876,17284,16707,19041,17497,15987,26574,13061,19852,13067,17047,23995,24012,13075,22925,13081,13083,16738,22102,13098,26129,13101,18927,15006,21737,14811,13105,23578,25775,21839,13111,22430,13121,13143,19063,21434,26653,21500,13148,14316,13156,20042,17181,18851,13547,25182,16143,24464,13181,13188,23225,18057,18956,13191,14132,15048,13192,16505,14217,13195,13201,22802,24935,17996,23478,16218,13215,24214,24476,23683,13217,21487,13223,25235,21144,13227,13823,26522,21269,16238,13235,24066,24367,24614,13237,18215,13781,20114,13249,14911,13252,25425,25187,13275,13300,21990,16055,15187,13314,16533,22365,13318,22484,24887,19965,20627,13328,17830,21141,18492,25263,13334,20324,21552,14886,17419,13351,18335,13355,13362,18443,19379,13365,23326,21007,13373,13382,18833,26159,17127,16125,16496,23444,22488,13405,14358,24213,13410,21241,23205,18834,13417,13419,18301,13816,13422,21480,13430,24639,26112,13441,24979,14444,22071,19000,13442,23830,18915,13453,20416,15327,13457,22081,13458,15348,13465,13471,15522,18614,22133,25105,25103,18938,13476,16676,16880,21453,23636,22276,13480,21686,20593,13484,17335,24569,24219,25122,19878,22717,13494,23092,16104,13499,24796,15806,13505,22447,25038,25776,20389,18836,13509,23245,13510,25908,25581,15561,22723,25031,13512,24076,13514,23381,13731,18999, 13531,15134,13535,23831,13537,14705,17939,13539,13918,13543,15966,25805,13550,23203,13562,17883,21424,13577,20249,20283,13582,23159,15629,19468,15211,17420,13587,13601,16537,21970,19666,13605,14784,20659,13624,15070,19001,13648,16908,20562,14294,13667,13668,21581,24204,26658,13674,13687,15008,17091,13699,13701,14322,21840,13717,16012,15366,15951,13720,17914,13723,14554,25409,17625,13728,21189,13741,21294,21702,14117,23425,13748,14595,18831,20540,17319,17567,13749,13751,22699,23115,13760,16367,17279,16610,13772,14041,24056,21347,13774,17535,14679,15569,13776,21883,13793,26637,13798,22072,17753,17372,18460,16739,13803,25539,13805,20500,26186,13807,22245,24588,14987,25328,22172,26368,26554,15805,26301,13822,19321,26687,13839,25538,19781,16287,13853,13866,24665,19948,21052,16147,21778,25314,23162,17161,22525,14558,17923,17776,13869,16528,26267,18612,13874,13880,24533,24079,19634,13882,24083,26425,22801,13887,20345,13890,23076,16774,13894,13905,20821,18050,20895,13907,15864,22267,21777,21330,13909,13922,26479,15909,22799,13924,25962,13927,13939,26558,13942,14155,13954,16983,17758,20367,15248,13959,18170,13976,24439,21092,21759,13985,23257,26247,22022,14889,13993,13997,14751,23456,13998,22607,20128,15968,16633,14015,15234,18671,14028,22913,14032,16074,26298,23087,26551,14038,15651,21200,24745,14046,22902,14079,21653,14081,19512,14085,22106,19817,23153,18987,14087,21155,23542,20187,15162,24731,14098,21079,14114,18867,22716,14119,16905,19485,16245,14139,22986,14154,21335,14161,24810,24854,14909,14165,14176,16326,23942, 21386,14178,22709,18305,21675,24839,14198,26747,14204,15929,23712,21677,14210,20288,14214,22109,19575,19388,25783,15272,26418,24747,14222,18921,14260,21925,14263,18871,25679,14414,14268,24565,19232,14281,20965,14285,26636,25652,20328,18262,14299,20872,20757,23768,22624,23807,23037,26723,22333,14318,22527,14304,22112,14314,14354,22574,19620,19207,18091,18470,26605,14364,14376,21757,17261,14381,15459,14382,24292,22452,19124,14390,16369,18190,25153,22219,14406,20355,14417,26415,20574,19664,17874,19859,25225,25253,19301,14419,25881,14855,21005,25796,14423,16484,25991,14445,20916,14464,26285,17801,25363,15645,22501,14472,24129,17637,14475,14609,15141,20711,20947,14478,18187,16563,21584,14488,24165,14500,14502,17219,23686,15572,25407,14505,15879,15136,24545,21119,14507,14510,19565,19005,14512,23557,14514,17359,17685,14546,21588,19645,19438,14856,14553,14562,15669,25759,23210,14565,21120,25431,24897,14571,14580,22194,14596,18504,25982,14601,19767,17300,22277,18052,20024,14606,19275,19492,14614,14617,23477,14619,25319,22494,20634,24270,24974,26705,14632,26364,14652,20031,25739,25296,19050,14654,24009,26105,19663,21312,19975,14657,22466,23629,14668,16285,14683,24078,24228,17331,23847,14685,16961,24586,21015,14701,19200,18007,23840,14708,20974,20978,16183,14712,25388,16380,14724,16088,25863,16606,18122,23084,14735,18107,14742,18513,15919,19871,24773,14759,14763,22623,14766,17943,26088,14779,17404,20938,16141,14787,20436,26761,22067,14799,21316,26672,14804,24128,24383,14809,20702,14815,25840,21723,14853,22381,15209,18267, 15106,16003,19793,21093,14860,15415,14863,15292,17971,17441,24843,14865,19991,14898,24063,21528,18277,16681,24205,14920,18476,20411,22154,14933,20609,16146,19816,16348,21848,14946,14950,24308,19679,14954,22518,15753,15216,14974,18288,18018,14979,22874,18554,21999,14981,18342,14992,15293,15253,24527,17431,25192,15190,20055,14995,25866,16577,22984,15000,15004,22139,15010,24869,22672,15496,17950,15014,19112,21096,24405,22940,15016,15046,22583,22092,24933,22414,15965,16796,15310,15098,21365,24110,26358,25478,16491,21045,22168,24902,23254,18421,25545,15102,26416,24189,22241,15932,18756,18211,15122,21530,15123,15277,15129,18732,20370,15146,16525,24559,15153,20156,15166,24904,15168,24598,18252,18499,22805,15189,18403,15192,17841,15199,19925,23914,15215,25496,16788,22080,15220,19113,20909,15760,19473,15245,16043,21040,15252,24625,15263,25348,15265,19562,25221,17701,15268,25163,25916,15276,20801,19774,15287,18230,15301,15316,24034,24384,23334,18354,25217,16736,23971,15323,18986,17554,16315,15338,19546,21272,20907,15340,15350,16913,15359,22973,24275,24070,24937,23042,24715,15372,16539,21229,15376,15385,25347,24924,15418,15427,24350,26585,21993,23661,22443,15439,25471,15752,22708,19763,15442,24266,15451,21049,15456,26536,25698,15460,26704,24126,20001,26165,15466,22319,15478,15616,19428,15481,23793,20320,15482,26591,24328,21449,21929,17329,15526,25462,22348,23089,15527,25054,19584,15568,17097,15579,23546,21499,17209,24864,20448,15614,21288,21740,16697,15622,25079,21849,26055,21371,25135,15627,24819,15638,15644,17113,18911, 22493,16934,21845,15675,22174,16956,21666,15682,24338,16096,22446,16686,15695,23019,15697,15704,22702,22955,23765,15707,20699,20528,15709,16603,22104,15726,23098,21023,23558,26420,16935,15731,16939,20888,20105,22531,23614,15734,25063,15744,15768,17231,15789,24206,22070,15810,15812,22044,24092,15819,25292,24994,20509,24594,15983,20483,25714,25665,16434,15826,23318,19622,16924,15828,15830,22782,23864,18896,21060,22173,18475,15834,25333,15843,19742,26456,20630,22221,15869,16825,15873,23083,21451,17834,23348,20002,22138,17481,25562,15905,15913,24185,16598,15946,21580,15950,24867,15959,19212,19692,15969,16544,16149,15985,26630,15986,19941,23884,15993,24733,24659,19331,16005,16010,23343,16827,23404,16747,16877,22509,16018,19976,16025,19717,20427,24651,16031,21754,16138,16036,22062,19711,20816,26670,16040,16069,26620,25426,16070,25810,21691,20861,16078,25373,16091,21607,16094,17814,16098,18162,25953,24944,19317,16103,23700,16116,20827,19673,25124,25755,16122,24257,25385,19553,16124,24155,24215,22355,16145,21170,19710,26179,16150,25751,20049,16167,18997,16171,18298,16173,26537,16177,24220,20855,19229,19650,16180,16189,19525,23954,16192,19846,17225,16196,19684,16221,25257,22013,22012,16235,21380,17083,16240,25611,16376,16251,16253,16900,24404,25273,16257,17551,16270,22377,23143,16273,19728,20015,16275,16277,25570,20818,19696,18155,16283,26484,18792,25990,16300,25093,23059,26470,16555,18203,17316,16310,19354,22140,16312,16318,22730,23656,16346,18340,25410,16352,24286,16364,18754,18772,22332,26169,21981,16373,16950,16614, 16375,16394,19519,17156,22997,16413,23846,26126,24397,16416,24852,20247,20274,16419,20544,22045,16438,16453,19310,17257,17379,16460,23449,22598,16469,16482,19674,16483,25323,23064,21847,19971,23922,22306,16506,18828,19107,16771,16856,16512,20785,24911,16517,16527,22798,18439,16545,24861,24456,16552,22226,19060,16565,20991,24178,16567,25176,16570,24326,24252,16572,24133,22390,17978,16574,19271,25003,16589,16601,16800,20472,16622,18586,16627,25932,20604,20871,23819,21545,24695,16632,25330,25284,19047,16634,26399,16636,22630,18620,16660,18908,18980,19973,20959,16669,19068,23670,18461,16675,16684,21103,21133,20836,24033,22895,21673,16685,19889,16689,26593,17516,26124,16693,16746,20967,18687,22861,16752,24942,22905,16822,20216,19344,16842,23455,16849,18003,16854,24402,17369,16859,22347,24888,25902,26297,16871,25056,21680,26720,20194,16879,22057,24409,25913,16888,23137,16897,24856,16920,16922,24173,19458,21833,16945,22097,22150,20535,17932,16981,16997,23231,18324,17023,17033,18847,25106,17039,18717,18242,17050,17054,26277,24619,17056,19182,17069,17505,17058,21320,22754,21768,17093,17118,26453,23556,25009,17121,23196,17124,20431,18216,17129,20724,22114,25708,19592,17131,20981,21118,17138,23463,20670,23437,17187,23285,17195,24433,21887,24723,17200,17202,26157,17636,19025,18405,17218,17792,17233,17239,22233,25960,17264,23853,21706,26033,20692,23041,17307,17631,17333,21481,18723,18369,17383,19243,24953,17572,17385,24224,18665,20362,18596,21811,17393,25995,17403,17443,26407,17448,25966,19545,25551,17451,17575,17458,20849, 17473,22376,17475,23234,17480,24685,24834,17496,24482,17506,21667,22149,17522,17534,21174,23385,25767,18686,17547,25609,25925,25361,25835,26422,20795,17557,17565,17837,20116,22389,23360,18606,17569,24231,22239,17578,18186,26192,17813,21959,20590,26257,22285,24401,17590,21676,17600,26191,19815,17613,17621,23833,23378,17622,21888,17626,25084,21895,17634,17669,24716,17670,24127,20041,17673,19294,17982,26457,17689,17699,20841,26644,19342,18333,23331,17724,17766,22978,17773,18839,18616,24181,17807,17831,25384,21751,25843,22534,24567,18128,24907,17839,19704,17851,25515,21047,25391,22930,21082,19735,21473,17868,18488,17873,23399,23637,17878,24771,17890,22783,24273,25633,17894,22869,22164,17895,17904,26322,26140,17907,17916,24704,25472,17922,17941,22142,21548,17946,23886,17959,25444,23270,25686,17986,17987,23470,17991,18561,17998,20550,17999,22844,23259,18872,24930,23075,18002,22125,21114,18014,18035,24708,22151,18039,24109,18055,24777,18065,22176,24488,22088,20931,18068,22222,18072,26655,23731,23191,22568,18826,18082,23748,24762,18084,18110,24087,18121,19454,20628,18124,26067,22388,18131,20565,18136,21752,19129,18137,18153,19076,23657,25819,18184,21470,18196,18971,21907,25362,18202,20248,18214,18885,18237,22775,22237,18241,18983,18247,24959,18274,21136,23924,18276,18295,19228,21949,19087,18309,18320,20719,23199,18327,23314,21841,25005,23104,18331,21405,26119,18360,18413,22441,18431,25948,19281,22175,25480,18436,20542,18502,23570,25006,18438,18442,19193,22786,20506,18448,25651,24821,18459,20371,21539,18464,21917,22456, 21464,19033,22938,18478,19227,18486,23014,20255,21773,19017,25997,24620,18678,18515,18563,18519,22078,26439,22353,18538,18539,23112,25390,21102,18557,18951,21928,18593,25957,18601,19436,24724,25795,18622,18629,26462,24417,21858,18632,18655,20374,18660,25818,20649,18663,24335,18676,23308,22829,18695,22714,18727,19606,25791,18739,22853,20731,24868,18751,25814,24093,21684,25127,18769,18776,24137,18778,21692,18782,23645,25641,18784,21235,18786,22758,21780,18807,23393,22789,21863,23171,18812,18824,24978,18832,21426,19749,22162,18837,25688,18858,25155,24694,18889,25867,18900,25520,24035,18935,23574,25180,18957,22774,18976,24922,24221,18990,21957,19004,23380,19016,26736,23279,21463,25740,19019,19693,20464,19024,19059,23547,21361,23417,23018,19066,20642,20887,25976,19074,19084,21135,23778,19093,21181,26237,22942,20435,19098,21822,22011,19106,22705,19118,26493,19133,26282,19161,22856,23366,26520,19165,20839,19183,25897,19186,26533,24339,19211,19225,25713,23694,25532,26026,26481,20751,25308,19231,19240,21892,24340,19242,26278,20672,19246,22236,19250,22571,19277,21908,22195,19335,19363,21770,25883,19367,26287,23779,19370,24388,24630,19382,25741,19386,22516,19402,19998,24125,19408,22330,26359,19416,25963,19445,24629,19808,19452,22512,19464,25906,26332,20873,24650,19467,20696,19479,25149,26057,19500,19619,19503,22697,19532,24438,19538,22947,21326,19550,19572,25836,19605,26347,25822,22819,24997,19848,19636,24699,23780,19640,20351,19677,21594,19732,21456,22680,24395,24876,19744,25873,19822,19827,25931,20788,19844,25352,19857, 25010,19905,19922,19924,19934,24763,21427,19945,21535,19954,23827,21041,19983,19995,25825,20017,22318,24050,20034,22790,25343,20057,25684,20062,20182,22957,20079,24024,22187,20808,20119,20147,25659,20158,26686,20168,20612,24932,20189,23867,20209,20875,22987,25090,20220,22878,24470,20227,20241,26748,25440,20244,25697,23164,25724,24635,20278,24363,20286,20302,22322,20312,24581,26376,20327,26021,23483,20335,20347,21477,26018,20407,20415,24299,20438,25100,26111,20458,20558,20478,25700,20479,23416,20482,24374,24656,25146,20498,20502,21081,24467,24436,25097,20523,21842,26475,26084,20532,20579,25355,20584,23575,25393,20592,24245,21805,23063,20598,21792,25115,20744,22899,20601,20632,24406,20644,23026,26240,20645,22809,24077,26435,23871,20678,25860,21216,25735,20681,24347,24468,24174,20707,20715,21113,20811,23236,24307,25635,20814,22050,23324,22898,25162,25839,20844,24591,24752,23200,20883,20886,23266,20914,23909,24526,25926,20952,21412,22941,24544,20956,20958,24646,20988,22074,21000,22444,21017,22428,23432,23209,21343,21996,26279,21068,23281,21799,21098,25914,21117,23948,21123,25828,21127,26699,21134,21164,24390,23642,21179,26053,24779,21185,25482,21194,23755,22906,21207,23097,21355,21220,21230,23078,21251,24100,22148,21367,25577,25945,26294,26283,21439,24643,21443,26543,26448,21498,23865,21501,21533,25597,21536,25884,24242,21550,21565,21994,23718,21575,21615,23550,21621,25366,25726,21625,22712,21637,26128,24062,21655,21681,25842,21986,21747,25556,21749,21772,24451,26158,21784,25321,21795,22304,24362,21797,26182,22128, 24320,21804,21831,25662,21906,25048,25656,21854,26715,23685,21857,22436,26073,21882,21941,24841,24353,21968,25254,23447,24680,22029,22043,25469,22063,25548,22099,22127,22352,23405,26549,22286,22105,26174,22124,22158,25606,23959,22171,22201,26485,25451,22209,23795,22605,22299,22327,24584,22349,22427,22826,22354,25504,22396,24203,23337,22426,22600,22451,26411,22465,23434,24030,22481,22538,24370,26737,22594,22983,25729,22608,23912,22610,22687,25489,22841,25434,22872,24478,24870,22989,23003,26492,23005,25786,24303,23027,23054,23413,26363,23057,26331,24416,23066,25332,23107,26667,24419,23149,23187,26467,23218,25157,23292,24344,26197,23305,23329,24546,23391,24832,23395,26059,23823,23407,23492,25715,26458,25909,25950,23516,23691,23561,23967,23601,24923,23607,23631,25600,24021,26229,23673,25062,23752,24138,23786,23897,26185,25535,24457,23900,24302,23918,24684,23940,25743,23953,26496,23976,24004,25128,26568,24041,25889,24124,24191,25052,25428,24274,24336,24314,24517,24359,24466,25922,24712,24486,24508,25324,24518,26078,26477,24520,25181,24653,24722,25007,26173,26090,24736,24798,25823,25224,24836,25209,25021,25256,26710,25159,25194,25720,25404,26149,25442,26002,26717,26061,25459,26546,25498,25510,26586,25732,25530,25695,26351,26594,25753,26490,26011,26014,26239,26080,26742,26489,26260,26421,26625,SmallState()
1,394.270833
1,536
0.819768
JosDenysGitHub
379182b11ef8f7c81420419a07c0170c3faf9ef5
898
cc
C++
poj/1/1064.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
1
2015-04-17T09:54:23.000Z
2015-04-17T09:54:23.000Z
poj/1/1064.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
null
null
null
poj/1/1064.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
null
null
null
#include <cstdio> #include <vector> using namespace std; bool ok(const vector<long long>& cables, int K, long long len) { if (len == 0) { return true; } for (vector<long long>::const_iterator it(cables.begin()); it != cables.end() && K > 0; ++it) { K -= *it / len; } return K <= 0; } int main() { int N, K; scanf("%d %d", &N, &K); vector<long long> cables(N); long long right = 0LL; for (int i = 0; i < N; i++) { double d; scanf("%lf", &d); cables[i] = 100LL*d; right = max(right, cables[i]); } long long left = 0; while (left < right) { if (left+1 == right) { if (ok(cables, K, right)) { left = right; } break; } const long long mid = (left + right) / 2LL; if (ok(cables, K, mid)) { left = mid; } else { right = mid; } } printf("%lld.%02lld\n", left/100, left%100); return 0; }
19.955556
97
0.513363
eagletmt
37926c6e01702a320a788f39146488ba5b6a0b58
469
hpp
C++
include/gkom/ShaderProgram.hpp
akowalew/mill-opengl
91ef11e6cdbfe691e0073d9883e42c0a29d29b45
[ "MIT" ]
null
null
null
include/gkom/ShaderProgram.hpp
akowalew/mill-opengl
91ef11e6cdbfe691e0073d9883e42c0a29d29b45
[ "MIT" ]
null
null
null
include/gkom/ShaderProgram.hpp
akowalew/mill-opengl
91ef11e6cdbfe691e0073d9883e42c0a29d29b45
[ "MIT" ]
null
null
null
#pragma once #include <string_view> namespace gkom { //! Forward declarations class Shader; class Uniform; class ShaderProgram { public: explicit ShaderProgram(unsigned int handle) noexcept; void attach(Shader shader); void detach(Shader shader); void link(); bool isLinked() const noexcept; void use(); void unuse(); Uniform getUniform(std::string_view name); operator unsigned int() const noexcept; private: unsigned int handle_; }; } // gkom
12.675676
54
0.729211
akowalew
379670eada688a7b758b8d8b7d100f4207921eee
625
ipp
C++
src/di/tools/hash.ipp
lukaszlaszko/di
def12a9356ba1336931ecab9acd5abf8b497ff96
[ "Apache-2.0" ]
10
2019-03-02T16:11:55.000Z
2022-03-24T10:04:20.000Z
src/di/tools/hash.ipp
lukaszlaszko/di
def12a9356ba1336931ecab9acd5abf8b497ff96
[ "Apache-2.0" ]
8
2018-05-12T07:50:39.000Z
2019-01-06T08:11:54.000Z
src/di/tools/hash.ipp
lukaszlaszko/di
def12a9356ba1336931ecab9acd5abf8b497ff96
[ "Apache-2.0" ]
null
null
null
#pragma once #include <functional> #include <utility> namespace di { namespace tools { template <typename T1, typename T2> inline size_t pair_hash::operator ()(const std::pair<T1, T2>& p) const { auto h1 = std::hash<T1>{}(p.first); auto h2 = std::hash<T2>{}(p.second); return h1 ^ h2; } } } namespace std { template <typename first_type, typename second_type> inline size_t hash<std::pair<first_type, second_type>>::operator()(const std::pair<first_type, second_type>& p) const { auto h1 = std::hash<first_type>{}(p.first); auto h2 = std::hash<second_type>{}(p.second); return h1 ^ h2; }; }
19.53125
117
0.6656
lukaszlaszko
3798d47bc559569c8b038800e6948c0ebfadaa10
519
cc
C++
DataFormats/Math/test/WriteMath.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-24T19:10:26.000Z
2019-02-19T11:45:32.000Z
DataFormats/Math/test/WriteMath.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-23T13:40:24.000Z
2019-12-05T21:16:03.000Z
DataFormats/Math/test/WriteMath.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
5
2018-08-21T16:37:52.000Z
2020-01-09T13:33:17.000Z
#include "DataFormats/Math/test/WriteMath.h" #include "DataFormats/Math/interface/Vector3D.h" #include "FWCore/Framework/interface/Event.h" #include <vector> using namespace edm; using namespace std; typedef math::XYZVector Vector; WriteMath::WriteMath( const ParameterSet& ) { produces<vector<Vector> >(); } void WriteMath::produce( Event & evt, const EventSetup & ) { std::unique_ptr<vector<Vector> > v( new vector<Vector> ); v->push_back( Vector( 1, 2, 3 ) ); evt.put( std::move(v) ); }
28.833333
62
0.689788
nistefan
379d8b03fa2c230fd916caf2eb632af7d02b0201
1,542
cc
C++
tests/CompileTests/ElsaTestCases/d0016.cc
maurizioabba/rose
7597292cf14da292bdb9a4ef573001b6c5b9b6c0
[ "BSD-3-Clause" ]
488
2015-01-09T08:54:48.000Z
2022-03-30T07:15:46.000Z
tests/CompileTests/ElsaTestCases/d0016.cc
sujankh/rose-matlab
7435d4fa1941826c784ba97296c0ec55fa7d7c7e
[ "BSD-3-Clause" ]
174
2015-01-28T18:41:32.000Z
2022-03-31T16:51:05.000Z
tests/CompileTests/ElsaTestCases/d0016.cc
sujankh/rose-matlab
7435d4fa1941826c784ba97296c0ec55fa7d7c7e
[ "BSD-3-Clause" ]
146
2015-04-27T02:48:34.000Z
2022-03-04T07:32:53.000Z
// this test was isolated from nsAtomTable.i; a change was made in // nsAtomTable.i to remove the failure here, but the fix was NOT that // which I present here; the fix was to just comment out the line // corresponding to the line at the bottom here where the ctor is // actually called; this was done because attempting to fix it the way // I have here somehow allowed another failure, where as the way I // fixed it removed all failures struct nsACString; struct nsAString; template <class CharT> struct nsStringTraits { typedef nsAString abstract_string_type; }; template <> struct nsStringTraits<char> { typedef nsACString abstract_string_type; }; template <class CharT> struct nsReadingIterator { // if you replace this line typedef typename nsStringTraits <CharT>::abstract_string_type abstract_string_type; // with this line // typedef nsACString abstract_string_type; // then the test passes; this seems to be due to the way implicit // copy ctors are added to classes; the line marked below is calling // a copy ctor that seems to be missing const abstract_string_type & string () const {} }; struct nsACString { typedef nsACString abstract_string_type; typedef nsReadingIterator<char> const_iterator; }; struct nsDependentCSubstring:nsACString { const abstract_string_type & mString; nsDependentCSubstring (const const_iterator & aStart, const const_iterator & aEnd) // it seems that the copy ctor missing here for this initializer // call : mString (aStart.string ()) {} };
37.609756
85
0.756809
maurizioabba
379d999398968fe22b83e1234e3e731b4bd13ff4
3,755
cc
C++
src/runtime/directx/directx_buffer.cc
wenxcs/tvm
bcbf4f9b1ddc4326364a3aa2fc82aaf4df8d53e8
[ "Apache-2.0" ]
null
null
null
src/runtime/directx/directx_buffer.cc
wenxcs/tvm
bcbf4f9b1ddc4326364a3aa2fc82aaf4df8d53e8
[ "Apache-2.0" ]
null
null
null
src/runtime/directx/directx_buffer.cc
wenxcs/tvm
bcbf4f9b1ddc4326364a3aa2fc82aaf4df8d53e8
[ "Apache-2.0" ]
null
null
null
#include "directx_header.h" using namespace tvm::runtime::dx; DirectBuffer::DirectBuffer(DirectXDevice* _dev, UINT64 size, DLDataType type) : _dxdev(_dev) { _res = _dev->device_allocate(size); D3D12_RESOURCE_DESC desc = _res->GetDesc(); this->size = desc.Width; this->type = type; } DirectBuffer::DirectBuffer(DirectXDevice* _dev, ComPtr<ID3D12Resource> res, DLDataType type) : _dxdev(_dev), _res(res) { D3D12_RESOURCE_DESC desc = _res->GetDesc(); this->size = desc.Width; this->type = type; } DirectHostBuffer::DirectHostBuffer(DirectXDevice* _dev, UINT64 size, DLDataType type, hostbuffer_state state) : _cur_state(state), ptr(nullptr) { if (state == hostbuffer_state::upload) _host_res = _dev->upload_allocate(size); else if (state == hostbuffer_state::readback) _host_res = _dev->readback_allocate(size); else throw std::invalid_argument(_msg_("Buffer state is not supported")); D3D12_RESOURCE_DESC desc = _host_res->GetDesc(); this->size = desc.Width; range = {0, static_cast<SIZE_T>(size)}; _dxdev = _dev; this->type = type; } void* DirectHostBuffer::open_data_ptr() { if (ptr != nullptr) return ptr; ThrowIfFailed(_host_res->Map(0, &range, reinterpret_cast<void**>(&ptr))); return ptr; } void DirectHostBuffer::close_data_ptr() { ptr = nullptr; if (_cur_state == hostbuffer_state::readback) // Use begin = end to tell no data is changed; { D3D12_RANGE range = {0, 0}; _host_res->Unmap(0, &range); } else _host_res->Unmap(0, &range); } // todo(wenxh): use resource barrier to support call this transition in async way; void DirectHostBuffer::change_state(hostbuffer_state hs) { if (hs == _cur_state) return; D3D12_RESOURCE_DESC desc = _host_res->GetDesc(); if (hs == hostbuffer_state::upload) { // readback to upload, need to memcpy auto tgt = _dxdev->upload_allocate(size); // cpu memcpy { // open ptr void* t_ptr = nullptr; ThrowIfFailed(tgt->Map(0, &range, reinterpret_cast<void**>(&t_ptr))); open_data_ptr(); memcpy(t_ptr, ptr, size); // close ptr close_data_ptr(); tgt->Unmap(0, &range); } _host_res = tgt; } else if (hs == hostbuffer_state::readback) { close_data_ptr(); auto tgt = _dxdev->readback_allocate(size); _dxdev->copy(tgt, _host_res); _host_res = tgt; } else { throw std::invalid_argument(_msg_("Target buffer state is not supported.")); } _cur_state = hs; } DirectReadBackBuffer::DirectReadBackBuffer(DirectXDevice* _dev, UINT64 size, DLDataType type) : DirectBuffer(_dev, size, type) { _host_res = _dev->readback_allocate(size); range = {0, static_cast<SIZE_T>(size)}; this->ptr = nullptr; } void* DirectReadBackBuffer::open_data_ptr() { if (ptr != nullptr) return ptr; ThrowIfFailed(_host_res->Map(0, &range, reinterpret_cast<void**>(&ptr))); return ptr; } void DirectReadBackBuffer::to_host(bool async) { _dxdev->copy(_host_res, _res, async); } void DirectReadBackBuffer::close_data_ptr() { ptr = nullptr; // Use begin = end to tell no data is changed; D3D12_RANGE range = {0, 0}; _host_res->Unmap(0, &range); } DirectUploadBuffer::DirectUploadBuffer(DirectXDevice* _dev, UINT64 size, DLDataType type) : DirectBuffer(_dev, size, type) { _host_res = _dev->upload_allocate(size); range = {0, static_cast<SIZE_T>(size)}; this->ptr = nullptr; } void* DirectUploadBuffer::open_data_ptr() { if (ptr != nullptr) return ptr; ThrowIfFailed(_host_res->Map(0, &range, reinterpret_cast<void**>(&ptr))); return ptr; } void DirectUploadBuffer::close_data_ptr() { ptr = nullptr; _host_res->Unmap(0, &range); } void DirectUploadBuffer::to_device(bool async) { _dxdev->copy(_res, _host_res, async); }
30.282258
109
0.691877
wenxcs
37a3d6f0cbcad80ec1e8c1e039da86adbffbc7fc
4,162
cpp
C++
IVT/src/Visualizer/OpenInventorVisualizer.cpp
Tobi2001/asr_ivt
146abe4324a14d7b8acccec7b1bfbdb74590fb5f
[ "BSD-3-Clause" ]
null
null
null
IVT/src/Visualizer/OpenInventorVisualizer.cpp
Tobi2001/asr_ivt
146abe4324a14d7b8acccec7b1bfbdb74590fb5f
[ "BSD-3-Clause" ]
null
null
null
IVT/src/Visualizer/OpenInventorVisualizer.cpp
Tobi2001/asr_ivt
146abe4324a14d7b8acccec7b1bfbdb74590fb5f
[ "BSD-3-Clause" ]
1
2019-11-24T17:09:19.000Z
2019-11-24T17:09:19.000Z
// **************************************************************************** // This file is part of the Integrating Vision Toolkit (IVT). // // The IVT is maintained by the Karlsruhe Institute of Technology (KIT) // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de). // // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT). // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the KIT nor the names of its contributors may be // used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // **************************************************************************** // **************************************************************************** // Filename: OpenInventorVisualizer.cpp // Author: Pedram Azad // Date: 2005 // **************************************************************************** // **************************************************************************** // Includes // **************************************************************************** #include "OpenInventorVisualizer.h" #include "Math/Math3d.h" #include <Inventor/Qt/SoQt.h> #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> #include <Inventor/SoInput.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/nodes/SoPointSet.h> #include <Inventor/nodes/SoCoordinate3.h> // **************************************************************************** // Constructor / Destructor // **************************************************************************** COpenInventorVisualizer::COpenInventorVisualizer(int argc, char **args) { // init SoQt library (initializes QT and Coin) m_pMainWidget = SoQt::init(argc, args, args[0]); m_pRoot = new SoSeparator(); m_pPointSet = new SoPointSet(); m_pCoordinate3 = new SoCoordinate3(); m_pRoot->addChild(m_pCoordinate3); m_pRoot->addChild(m_pPointSet); m_nCounter = 0; } COpenInventorVisualizer::~COpenInventorVisualizer() { } // **************************************************************************** // Methods // **************************************************************************** void COpenInventorVisualizer::Clear() { // TODO: empty m_pCoordinate3 m_nCounter = 0; } void COpenInventorVisualizer::AddPoint(const Vec3d &point) { m_pCoordinate3->point.set1Value(m_nCounter++, (float) point.x, (float) point.y, (float) point.z); } void COpenInventorVisualizer::Render() { // create root node m_pRoot->ref(); // create viewer SoQtExaminerViewer *pViewer = new SoQtExaminerViewer(m_pMainWidget); pViewer->setSceneGraph(m_pRoot); pViewer->show(); // pop up the main window and start main loop SoQt::show(m_pMainWidget); SoQt::mainLoop(); // free memory m_pRoot->unref(); //delete pViewer; }
35.57265
99
0.58962
Tobi2001
37a7abc6249e0a1407032027ca507df0703f4c24
1,698
cpp
C++
admin/pchealth/sr/tools/flbuild/flbuild.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
admin/pchealth/sr/tools/flbuild/flbuild.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
admin/pchealth/sr/tools/flbuild/flbuild.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1998-1999 Microsoft Corporation Module Name: flbuild.cpp Abstract: this file uses filelist.lib to build a dat file from xml file Author: Kanwaljit Marok (kmarok) 01-May-2000 Revision History: --*/ #include "flstructs.h" #include "flbuilder.h" #ifdef _ASSERT #undef _ASSERT #endif #include <dbgtrace.h> #ifdef THIS_FILE #undef THIS_FILE #endif static char __szTraceSourceFile[] = __FILE__; #define THIS_FILE __szTraceSourceFile #define TRACE_FILEID 0 #define FILEID 0 int _cdecl main(int argc, char* argv[]) { INT returnCde = 0; CFLDatBuilder datbuild; InitAsyncTrace(); if( argc != 3 ) { fprintf(stderr, "usage: %s <in.xml> <out.dat>\n", argv[0]); returnCde = 1; } else { LPTSTR pFileList, pDatFile; #ifdef UNICODE TCHAR tFileList[MAX_PATH]; TCHAR tDatFile[MAX_PATH]; MultiByteToWideChar( CP_ACP, 0, argv[1], -1, tFileList, sizeof(tFileList)/sizeof(TCHAR) ); MultiByteToWideChar( CP_ACP, 0, argv[2], -1, tDatFile, sizeof(tDatFile)/sizeof(TCHAR) ); pFileList = tFileList; pDatFile = tDatFile; #else pFileList = argv[1]; pDatFile = argv[2]; #endif if( !datbuild.BuildTree(pFileList, pDatFile) ) { fprintf(stderr, "Error building dat\n"); returnCde = 1; } } return returnCde; }
16.647059
68
0.520612
npocmaka
37a80ab55c5fa7ba4985d1ab17263121be860830
1,377
cpp
C++
tests/SignalConverterTests.cpp
sbash64/phase-vocoder
ac9c11cd4d38c6827bfde815e559d3f1114e1cf4
[ "MIT" ]
null
null
null
tests/SignalConverterTests.cpp
sbash64/phase-vocoder
ac9c11cd4d38c6827bfde815e559d3f1114e1cf4
[ "MIT" ]
null
null
null
tests/SignalConverterTests.cpp
sbash64/phase-vocoder
ac9c11cd4d38c6827bfde815e559d3f1114e1cf4
[ "MIT" ]
null
null
null
#include "assert-utility.hpp" #include <sbash64/phase-vocoder/SignalConverter.hpp> #include <gtest/gtest.h> namespace sbash64::phase_vocoder { namespace { class SignalConverterTests : public ::testing::Test { protected: void assertExpanded(const std::vector<double> &x, index_type P, const std::vector<double> &y) { std::vector<double> expanded(x.size() * gsl::narrow_cast<size_t>(P), 1); converter.expand(x, expanded); assertEqual(y, expanded); } void assertDecimated(const std::vector<double> &x, index_type Q, const std::vector<double> &y) { std::vector<double> decimated(x.size() / gsl::narrow_cast<size_t>(Q)); converter.decimate(x, decimated); assertEqual(y, decimated); } private: SignalConverterImpl<double> converter; }; // clang-format off TEST_F(SignalConverterTests, extractsEveryQthElement) { assertDecimated( { 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0 }, 3, { 1, 2, 3, 4, 5 } ); } TEST_F(SignalConverterTests, insertsPMinusOneZeros) { assertExpanded( { 1, 2, 3, 4, 5 }, 3, { 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0 } ); } TEST_F(SignalConverterTests, insertsNoZerosWhenPIsOne) { assertExpanded( { 1, 2, 3, 4, 5 }, 1, { 1, 2, 3, 4, 5 } ); } // clang-format on } }
24.157895
80
0.594771
sbash64
37ad33aeccebf9570081da11802638ed6c0bc2fe
609
cpp
C++
engine/src/core/mesh.cpp
AnisB/Donut
335638df9eca74440ca0d9dc3928ae9b419b7307
[ "MIT" ]
3
2015-09-28T23:21:02.000Z
2017-06-20T16:17:32.000Z
engine/src/core/mesh.cpp
AnisB/Donut
335638df9eca74440ca0d9dc3928ae9b419b7307
[ "MIT" ]
null
null
null
engine/src/core/mesh.cpp
AnisB/Donut
335638df9eca74440ca0d9dc3928ae9b419b7307
[ "MIT" ]
2
2015-11-25T07:34:35.000Z
2017-01-03T00:14:38.000Z
// Library includes #include "core/Mesh.h" #include "resource/resource_manager.h" // External includes #include <string.h> namespace donut { TMesh::TMesh(MATERIAL_GUID material_guid, GEOMETRY_GUID _geometry) : TDrawable() , m_material(material_guid) , m_geometry(_geometry) { } TMesh::~TMesh() { } void TMesh::Evaluate(TCollector& _request, const bento::Matrix4& _tm) { // Build our new render request TRenderRequest newRequest; newRequest.geometry = m_geometry; newRequest.material = m_material; newRequest.transform = _tm; // Appent it _request.Append(newRequest); } }
19.03125
70
0.720854
AnisB
37ae65938574133f0b9790b155f54b47609aee78
1,004
cpp
C++
geometry/point.11.cpp
ivan100sic/competelib-snippets
e40170a63b37d92c91e2dfef08b2794e67ccb0b2
[ "Unlicense" ]
3
2022-01-17T01:56:05.000Z
2022-02-23T07:30:02.000Z
geometry/point.11.cpp
ivan100sic/competelib-snippets
e40170a63b37d92c91e2dfef08b2794e67ccb0b2
[ "Unlicense" ]
null
null
null
geometry/point.11.cpp
ivan100sic/competelib-snippets
e40170a63b37d92c91e2dfef08b2794e67ccb0b2
[ "Unlicense" ]
null
null
null
// Planar point using ll = long long; /*snippet-begin*/ template<class P, class T = ll> T det(const P& a, const P& b, const P& c) { return (a-b).template vp<T>(a-c); } template<class T> T sgn(T x) { return x < 0 ? -1 : !!x; } template<class T> struct point { T x, y; point operator- (const point& b) const { return {x-b.x, y-b.y}; } point& operator-= (const point& b) { x -= b.x; y -= b.y; return *this; } bool operator< (const point& b) const { return tie(x, y) < tie(b.x, b.y); } bool operator== (const point& b) const { return tie(x, y) == tie(b.x, b.y); } bool operator<= (const point& b) const { return tie(x, y) <= tie(b.x, b.y); } template<class R = ll> R sp(const point& b) const { return (R)x*b.x + (R)y*b.y; } template<class R = ll> R vp(const point& b) const { return (R)x*b.y - (R)y*b.x; } }; using pti = point<int>; using ptll = point<ll>; /*snippet-end*/ int main() { pti a = {1, 2}, b = {2, 5}; return a.sp(b) != 12 || a.vp(b) != 1; }
27.888889
85
0.553785
ivan100sic
37af6ac6bde83050e4d712bba906df5672394208
1,849
cpp
C++
Project2/GccApplication3/GccApplication3/tests/test002_create_rr_task.cpp
paulmoon/csc460
a432cfccef97fca5820cb0fc006112bb773cda0f
[ "MIT" ]
null
null
null
Project2/GccApplication3/GccApplication3/tests/test002_create_rr_task.cpp
paulmoon/csc460
a432cfccef97fca5820cb0fc006112bb773cda0f
[ "MIT" ]
null
null
null
Project2/GccApplication3/GccApplication3/tests/test002_create_rr_task.cpp
paulmoon/csc460
a432cfccef97fca5820cb0fc006112bb773cda0f
[ "MIT" ]
null
null
null
#ifdef USE_TEST_002 /* Test workflow: 1) r_main() system task prints to trace 0 twice. Adds two RR tasks rr(1) and rr2(2). 2) RR Queue: rr(1), rr2(2). rr(1) runs, printing out (1) and going back to the queue. 3) RR Queue: rr2(2), rr(1). rr2(2) runs. Adds 2, 2 to the trace, and creates rr(3). rr2(2) yields, going back to the queue. 4) RR Queue: rr(1), rr(3), rr2(2). rr(1) runs, adding 1 to the trace. 5) RR Queue: rr(3), rr2(2), rr(1). rr(3) runs, adding 3 to the trace. 6) RR Queue: rr2(2), rr(1), rr(3). rr2(2) runs. Adds 2, 2 to the trace, and creates rr(4). Terminates. 7) RR Queue: rr(1), rr(3), rr(4). From now on, [1, 3, 4] will be printed to the trace until it's full. Desired trace: T002;0;0;1;2;2;1;3;2;2;1;3;4;1;3;4;1;3;4...;1;3;4; */ #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include "os.h" #include "uart/uart.h" #include "trace/trace.h" void dump_trace(){ print_trace(); } /** RR task which adds its argument to the trace. Various RR tasks will add to the trace as they run. i.e 1;3;4;1;3;4; */ void rr(){ int16_t v = Task_GetArg(); for(;;){ add_to_trace(v); _delay_ms(5); if( is_trace_full() ){ Task_Create_System(dump_trace,0); Task_Terminate(); } } } /** A RR task which creates a couple of RR tasks */ void rr2(){ add_to_trace(2); Task_Create_RR(rr,3); add_to_trace(2); Task_Next(); add_to_trace(2); Task_Create_RR(rr,4); add_to_trace(2); Task_Terminate(); } extern int r_main(){ uart_init(); set_trace_test(2); add_to_trace(0); Task_Create_RR(rr,1); Task_Create_RR(rr2,2); add_to_trace(0); Task_Terminate(); return 0; } #endif
24.012987
124
0.575987
paulmoon
37b0e336737df256bc44e98d0a264c23822a78a2
485
cpp
C++
mj344/IOManager/Outputs/Host.cpp
Shakarang/mbed-mj344_a1
d8217db644c08f3417fe5f4f3b51f59df9439408
[ "MIT" ]
null
null
null
mj344/IOManager/Outputs/Host.cpp
Shakarang/mbed-mj344_a1
d8217db644c08f3417fe5f4f3b51f59df9439408
[ "MIT" ]
null
null
null
mj344/IOManager/Outputs/Host.cpp
Shakarang/mbed-mj344_a1
d8217db644c08f3417fe5f4f3b51f59df9439408
[ "MIT" ]
null
null
null
/** * @Author: Maxime Junger <mj344> * @Date: 2017-02-03T21:46:16+00:00 * @Email: mj344@kent.ac.uk * @Last modified by: mj344 * @Last modified time: 2017-02-08T18:26:07+00:00 */ #include <time.h> #include "Host.hh" Host::Host() { this->host = new Serial(USBTX, USBRX); } Host::~Host() { if (this->host != NULL) { delete this->host; } } void Host::print(const std::string &str) { if (this->host != NULL) { this->host->printf("\r%i : %s\n", time (NULL), str.c_str()); } }
19.4
62
0.602062
Shakarang
37b5a3a5158024aace1be6ee2386633d7ea6992f
4,308
cpp
C++
WOAP Host/Source/woap_gain_fader_view.cpp
ZonRobin/WOAP
f1bfb8dbe84e57826834ad3ca81f548b20b1afc6
[ "MIT" ]
null
null
null
WOAP Host/Source/woap_gain_fader_view.cpp
ZonRobin/WOAP
f1bfb8dbe84e57826834ad3ca81f548b20b1afc6
[ "MIT" ]
null
null
null
WOAP Host/Source/woap_gain_fader_view.cpp
ZonRobin/WOAP
f1bfb8dbe84e57826834ad3ca81f548b20b1afc6
[ "MIT" ]
null
null
null
#include "woap_gain_fader_view.h" #include "woap_gain_fader.h" #include "woap_track.h" #include "woap_track_level_indicator_view.h" #include "woap_parameter_float.h" #include "woap_vertical_db_scale.h" #include "woap_track_send_node.h" using namespace WOAP; using namespace WOAP::GUI; GainFaderView::GainFaderView(Track* tr) : track(nullptr) { levelIndicator = new TrackLevelIndicatorView(); levelIndicator->setSkewFactor(1.5f); levelIndicator->setRange(-80.0f, 17.0f); addAndMakeVisible(levelIndicator); fader = new GainFader(); fader->setThumbOpacity(0.75f); fader->setSkewFactor(3.0f); fader->setRange(-145, 10); fader->addListener(this); addAndMakeVisible(fader); dbScale = new VerticalDbScale(); dbScale->setSkewFactor(3.0f); dbScale->setRange(-145.0f, 10.0f); addAndMakeVisible(dbScale); setTrack(tr); } GainFaderView::~GainFaderView() { setTrack(nullptr); } void GainFaderView::resized() { const Rectangle<int> bounds = getLocalBounds(); const int width = getWidth(); const int halfWidth = (int)(width * 0.5f); dbScale->setMargin(jmin(getHeight() / 8, 30)); dbScale->setBounds(bounds.withLeft(halfWidth + 5)); levelIndicator->setBounds(bounds.withWidth(halfWidth)); fader->setBounds(bounds.withWidth(halfWidth).withSizeKeepingCentre(halfWidth - 7, getHeight())); } void GainFaderView::setTrack(Track* tr) { if (track != nullptr) track->getGainParameter()->removeListener(this); track = tr; levelIndicator->setTrack(tr); if (tr != nullptr) { ParameterFloat* gainParameter = track->getGainParameter(); gainParameter->addListener(this); fader->setRange(gainParameter->getMinValue(), gainParameter->getMaxValue(), 0.01f); fader->setValue(gainParameter->get(), NotificationType::dontSendNotification); } } void GainFaderView::sliderValueChanged(Slider*) { *track->getGainParameter() = (float)fader->getValue(); } void GainFaderView::sliderDragStarted(Slider*) { dragging = true; } void GainFaderView::sliderDragEnded(Slider*) { dragging = false; fader->setValue(track->getGainParameter()->get(), NotificationType::dontSendNotification); } void GainFaderView::parameterChanged(Parameter*) { if (!dragging) fader->setValue((double)track->getGainParameter()->get(), NotificationType::dontSendNotification); } TrackSendNodeGainFaderView::TrackSendNodeGainFaderView(TrackSendNode* trackSend) : trackSendNode(nullptr) { fader = new GainFader(); fader->setSkewFactor(3.0f); fader->setRange(-145, 10); fader->addListener(this); fader->setColour(Slider::trackColourId, Colour(70, 70, 70)); addAndMakeVisible(fader); dbScale = new VerticalDbScale(); dbScale->setSkewFactor(3.0f); dbScale->setRange(-145.0f, 10.0f); addAndMakeVisible(dbScale); setTrackSendNode(trackSend); } TrackSendNodeGainFaderView::~TrackSendNodeGainFaderView() { setTrackSendNode(nullptr); } void TrackSendNodeGainFaderView::resized() { const Rectangle<int> bounds = getLocalBounds(); const int width = getWidth(); const int halfWidth = (int)(width * 0.5f); dbScale->setMargin(getHeight() / 8); dbScale->setBounds(bounds.withLeft(halfWidth + 5)); fader->setBounds(bounds.withWidth(halfWidth).withSizeKeepingCentre(halfWidth - 7, getHeight())); } void TrackSendNodeGainFaderView::setTrackSendNode(TrackSendNode* trackSend) { if (trackSendNode != nullptr) trackSendNode->getGainParameter()->removeListener(this); trackSendNode = trackSend; if (trackSend != nullptr) { ParameterFloat* gainParameter = trackSendNode->getGainParameter(); gainParameter->addListener(this); fader->setRange(gainParameter->getMinValue(), gainParameter->getMaxValue(), 0.01f); fader->setValue(gainParameter->get(), NotificationType::dontSendNotification); } } void TrackSendNodeGainFaderView::sliderValueChanged(Slider*) { *trackSendNode->getGainParameter() = (float)fader->getValue(); } void TrackSendNodeGainFaderView::sliderDragStarted(Slider*) { dragging = true; } void TrackSendNodeGainFaderView::sliderDragEnded(Slider*) { dragging = false; fader->setValue(trackSendNode->getGainParameter()->get(), NotificationType::dontSendNotification); } void TrackSendNodeGainFaderView::parameterChanged(Parameter*) { if (!dragging) fader->setValue((double)trackSendNode->getGainParameter()->get(), NotificationType::dontSendNotification); }
24.338983
108
0.7565
ZonRobin
37b5c10a09437c61ff19ce3a1f4adec3ec21a77f
1,352
hpp
C++
Random/NewHV/Inc/Handle/HandleBase.hpp
SuperV1234/Experiments
572c94d1afb367c241645b479019f6cb3883f98f
[ "AFL-3.0" ]
12
2015-10-10T16:27:28.000Z
2019-11-28T17:48:32.000Z
Random/NewHV/Inc/Handle/HandleBase.hpp
vittorioromeo/Experiments
572c94d1afb367c241645b479019f6cb3883f98f
[ "AFL-3.0" ]
3
2016-11-20T21:17:19.000Z
2018-05-25T16:52:32.000Z
Random/NewHV/Inc/Handle/HandleBase.hpp
vittorioromeo/Experiments
572c94d1afb367c241645b479019f6cb3883f98f
[ "AFL-3.0" ]
2
2016-11-20T21:02:49.000Z
2020-01-09T18:11:29.000Z
// Copyright (c) 2013-2015 Vittorio Romeo // License: Academic Free License ("AFL") v. 3.0 // AFL License page: http://opensource.org/licenses/AFL-3.0 #ifndef SSVU_NEWHV_HANDLEBASE #define SSVU_NEWHV_HANDLEBASE namespace ssvu { namespace Internal { template <typename T> class HVHandleBase { protected: /// @brief Internal pointer to the HandleVector. T* hVec; /// @brief Index of the mark to check. HIdx markIdx; /// @brief Counter of the handle. Will be compared to the mark's /// counter. HCtr ctr; public: inline HVHandleBase(T& mHVec, HIdx mMarkIdx, HCtr mCtr) noexcept : hVec{&mHVec}, markIdx{mMarkIdx}, ctr{mCtr} { } /// @brief Returns whether the handle is valid or not. /// @details The handle is considered valid only when it points to /// the item it originally pointed to. /// If the item is set to dead but the HandleVector was not yet /// refreshed, the handle is considered valid. bool isAlive() const noexcept; /// @brief Sets the pointed item's status as dead. void setDead() noexcept; }; } } #endif
28.765957
78
0.553254
SuperV1234
37b9fd0a59f9806b2227df06ef6c6415ba53b56f
1,212
cpp
C++
examples/images/ImageOpenCVModel.cpp
teyenliu/nodeeditor
a1bf22f924f4911b8dd3f84ff88678f91cdd2c7e
[ "BSD-3-Clause" ]
null
null
null
examples/images/ImageOpenCVModel.cpp
teyenliu/nodeeditor
a1bf22f924f4911b8dd3f84ff88678f91cdd2c7e
[ "BSD-3-Clause" ]
null
null
null
examples/images/ImageOpenCVModel.cpp
teyenliu/nodeeditor
a1bf22f924f4911b8dd3f84ff88678f91cdd2c7e
[ "BSD-3-Clause" ]
null
null
null
#include "ImageOpenCVModel.hpp" #include <QtCore/QEvent> #include <QtCore/QDir> #include <QDebug> #include <QtWidgets/QFileDialog> #include <nodes/DataModelRegistry> #include "PixmapData.hpp" ImageOpenCVModel:: ImageOpenCVModel() { } bool ImageOpenCVModel:: eventFilter(QObject *object, QEvent *event) { if (object == _panel) { int w = _panel->width(); int h = _panel->height(); if (event->type() == QEvent::Resize) { auto d = std::dynamic_pointer_cast<PixmapData>(_nodeData); if (d) { _label->setPixmap(d->pixmap().scaled(w, h, Qt::KeepAspectRatio)); } } } return false; } std::shared_ptr<NodeData> ImageOpenCVModel:: outData(PortIndex) { return _nodeData; } void ImageOpenCVModel:: setInData(std::shared_ptr<NodeData> nodeData, PortIndex) { _nodeData = nodeData; if (_nodeData) { auto d = std::dynamic_pointer_cast<PixmapData>(_nodeData); // Danny Implementation if(!d->pixmap().isNull()) { int w = _panel->width(); int h = _panel->height(); _label->setPixmap(d->pixmap().scaled(w, h, Qt::KeepAspectRatio)); } } else { _label->setPixmap(QPixmap()); } Q_EMIT dataUpdated(0); }
17.070423
75
0.643564
teyenliu
37bf813d9aa9a21833b19ba4e9f78654eb01aa91
31,278
cpp
C++
Math3D.cpp
joeriedel/Tread3.0A2
337c4aa74d554e21b50d6bd4406ce0f67aa39144
[ "MIT" ]
1
2020-07-19T10:19:18.000Z
2020-07-19T10:19:18.000Z
Math3D.cpp
joeriedel/Tread3.0A2
337c4aa74d554e21b50d6bd4406ce0f67aa39144
[ "MIT" ]
null
null
null
Math3D.cpp
joeriedel/Tread3.0A2
337c4aa74d554e21b50d6bd4406ce0f67aa39144
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // Math3D.cpp /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008, Joe Riedel // All rights reserved. // Original Author: Andrew Meggs // // Redistribution and use in source and binary forms, // with or without modification, are permitted provided // that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation and/or // other materials provided with the distribution. // // Neither the name of the <ORGANIZATION> nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY // OF SUCH DAMAGE. /////////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #ifndef __math3d_h__ #include "math3d.h" #endif // Include inline functions in out-of-line form if mat3d.h // didn't include them already as inlines. #ifndef __math3d_inlines_i__ #define inline #include "math3d_inlines.i" #undef inline #endif static const float zero4x4[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; static const float ident4x4[] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; const mat3x3 mat3x3::zero = *(mat3x3 *)zero4x4; const mat3x3 mat3x3::identity = *(mat3x3 *)ident4x4; const mat4x3 mat4x3::zero = *(mat4x3 *)zero4x4; const mat4x3 mat4x3::identity = *(mat4x3 *)ident4x4; const mat4x4 mat4x4::zero = *(mat4x4 *)zero4x4; const mat4x4 mat4x4::identity = *(mat4x4 *)ident4x4; const quat quat::zero(0,0,0,0); const quat quat::identity(0,0,0,1); const vec2 vec2::zero(0,0); const vec3 vec3::zero(0,0,0); const vec3 vec3::bogus_max(999999.0f, 999999.0f, 999999.0f); const vec3 vec3::bogus_min(-999999.0f, -999999.0f, -999999.0f); float plane3::tolerance = 1.0 / 65536.0; OS_FNEXP void quaternion_to_matrix( mat3x3 *out, const quat *in ) { float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; // calculate coefficients x2 = in->x + in->x; y2 = in->y + in->y; z2 = in->z + in->z; xx = in->x * x2; xy = in->x * y2; xz = in->x * z2; yy = in->y * y2; yz = in->y * z2; zz = in->z * z2; wx = in->w * x2; wy = in->w * y2; wz = in->w * z2; out->m[0][0] = 1.0f - (yy + zz); out->m[0][1] = xy - wz; out->m[0][2] = xz + wy; out->m[1][0] = xy + wz; out->m[1][1] = 1.0f - (xx + zz); out->m[1][2] = yz - wx; out->m[2][0] = xz - wy; out->m[2][1] = yz + wx; out->m[2][2] = 1.0f - (xx + yy); } // This code is reversed from what I can find in the literature! // I feel really strongly that mat2quat( quat2mat( q ) ) should equal q // and that quat2mat( mat2quat( m ) ) should equal m, but the set // of functions that I copied from Game Developer instead gives me // their respective inverses. It's possible I screwed something up // in the process of copying things over (and the original mat2quat // is reproduced below if someone wishes to attempt to find my typo), // and it's possible I completely misunderstand the intention of // the original functions. Either way, for now I'm making the code // do what I want it to do by having mat2quat return the inverse of // what my attempt at transcribing the original code does. OS_FNEXP void matrix_to_quaternion( quat *out, const mat3x3 *in ) { float tr, s, q[4]; int i, j, k; static const int nxt[3] = {1, 2, 0}; tr = in->m[0][0] + in->m[1][1] + in->m[2][2]; // check the diagonal if (tr > 0.0) { s = sqrtf(tr + 1.0f); out->w = s / 2.0f; s = 0.5f / s; out->x = -(in->m[1][2] - in->m[2][1]) * s; // added minus sign (see above) out->y = -(in->m[2][0] - in->m[0][2]) * s; // added minus sign (see above) out->z = -(in->m[0][1] - in->m[1][0]) * s; // added minus sign (see above) } else { // diagonal is negative i = 0; if (in->m[1][1] > in->m[0][0]) i = 1; if (in->m[2][2] > in->m[i][i]) i = 2; j = nxt[i]; k = nxt[j]; s = sqrtf( (in->m[i][i] - (in->m[j][j] + in->m[k][k])) + 1.0f ); q[i] = s * 0.5f; if (s != 0.0f) s = 0.5f / s; q[3] = (in->m[j][k] - in->m[k][j]) * s; q[j] = (in->m[i][j] + in->m[j][i]) * s; q[k] = (in->m[i][k] + in->m[k][i]) * s; out->x = -q[0]; // added minus sign (see above) out->y = -q[1]; // added minus sign (see above) out->z = -q[2]; // added minus sign (see above) out->w = q[3]; } } /* original code (see above) void matrix_to_quaternion( quat *out, const mat3x3 *in ) { float tr, s, q[4]; int i, j, k; static const int nxt[3] = {1, 2, 0}; tr = in->m[0][0] + in->m[1][1] + in->m[2][2]; // check the diagonal if (tr > 0.0) { s = sqrtf(tr + 1.0f); out->w = s / 2.0f; s = 0.5f / s; out->x = (in->m[1][2] - in->m[2][1]) * s; out->y = (in->m[2][0] - in->m[0][2]) * s; out->z = (in->m[0][1] - in->m[1][0]) * s; } else { // diagonal is negative i = 0; if (in->m[1][1] > in->m[0][0]) i = 1; if (in->m[2][2] > in->m[i][i]) i = 2; j = nxt[i]; k = nxt[j]; s = sqrtf( (in->m[i][i] - (in->m[j][j] + in->m[k][k])) + 1.0f ); q[i] = s * 0.5f; if (s != 0.0f) s = 0.5f / s; q[3] = (in->m[j][k] - in->m[k][j]) * s; q[j] = (in->m[i][j] + in->m[j][i]) * s; q[k] = (in->m[i][k] + in->m[k][i]) * s; out->x = q[0]; out->y = q[1]; out->z = q[2]; out->w = q[3]; } } */ OS_FNEXP vec3 euler_from_matrix( const mat3x3 &m ) { float theta; float cp; float sp; vec3 v; sp = m[2][0]; if( sp > 1.0f ) sp = 1.0f; if( sp < -1.0f ) sp = -1.0f; theta = (float)-asin( sp ); cp = (float)cos( theta ); if( cp > (8192.0f*1.19209289550781250000e-07) ) { v[0] = theta;// * 180.0f / PI; v[1] = (float)atan2( m[1][0], m[0][0] );// * 180.0f / PI; v[2] = (float)atan2( m[2][1], m[2][2] );// * 180.0f / PI; } else { v[0] = theta;// * 180.0f / PI; v[1] = (float)-atan2( m[0][1], m[1][1] );// * 180.0f / PI; v[2] = 0.0f; } return v; } OS_FNEXP void slerp_quaternion( quat *out, const quat *from, const quat *to, float t ) { float to1[4]; double omega, cosom, sinom, scale0, scale1; // calc cosine cosom = (from->x * to->x) + (from->y * to->y) + (from->z * to->z) + (from->w * to->w); // adjust signs (if necessary) if (cosom < 0.0f) { cosom = -cosom; to1[0] = -to->x; to1[1] = -to->y; to1[2] = -to->z; to1[3] = -to->w; } else { to1[0] = to->x; to1[1] = to->y; to1[2] = to->z; to1[3] = to->w; } // calculate coefficients // This particular definition of "close" was chosen // to match the keyframe tolerance of the skelanim // library. if ( (1.0 - cosom) > 0.0006f ) { // standard case (slerp) omega = acosf((float)cosom); sinom = sinf((float)omega); scale0 = sinf((float)((1.0f - t) * omega)) / sinom; scale1 = sinf((float)(t * omega)) / sinom; } else { // "from" and "to" quaternions are very close // ... so we can do a linear interpolation scale0 = 1.0f - t; scale1 = t; } // calculate final values out->x = (float)(scale0 * from->x + scale1 * to1[0]); out->y = (float)(scale0 * from->y + scale1 * to1[1]); out->z = (float)(scale0 * from->z + scale1 * to1[2]); out->w = (float)(scale0 * from->w + scale1 * to1[3]); } OS_FNEXP void quaternion_mul( quat *out, const quat *q1, const quat *q2 ) { float A, B, C, D, E, F, G, H; A = (q1->w + q1->x) * (q2->w + q2->x); B = (q1->z - q1->y) * (q2->y - q2->z); C = (q1->w - q1->x) * (q2->y + q2->z); D = (q1->y + q1->z) * (q2->w - q2->x); E = (q1->x + q1->z) * (q2->x + q2->y); F = (q1->x - q1->z) * (q2->x - q2->y); G = (q1->w + q1->y) * (q2->w - q2->z); H = (q1->w - q1->y) * (q2->w + q2->z); out->w = B + (-E - F + G + H) * 0.5f; out->x = A - (E + F + G + H) * 0.5f; out->y = C + (E - F + G - H) * 0.5f; out->z = D + (E - F - G + H) * 0.5f; } #define MAX_INVERTIBLE 8 OS_FNEXP void matrix_invert( float *m, int size, int column_stride, int row_stride ) { if (!column_stride) column_stride = 1; if (!row_stride) row_stride = size * column_stride; MATH3D_ASSERT( size > 1 && size <= MAX_INVERTIBLE ); int indxc[MAX_INVERTIBLE]; int indxr[MAX_INVERTIBLE]; int ipiv[MAX_INVERTIBLE]; int i, icol, irow, j, k; float big, pivinv, temp; memset( ipiv, 0, sizeof(ipiv) ); for (i = 0; i < size; ++i) { big = 0.0f; for (j = 0; j < size; ++j) { if (ipiv[j] != 1) { for (k = 0; k < size; ++k) { if (!ipiv[k]) { float fa = (float)fabs( m[ j * row_stride + k * column_stride ] ); if (fa > big) { big = fa; irow = j; icol = k; } } else if (ipiv[k] > 1) { // error, singular matrix return; } } } } ipiv[icol] += 1; if (irow != icol) { for (j = 0; j < size; ++j) { temp = m[icol * row_stride + j * column_stride]; m[icol * row_stride + j * column_stride] = m[irow * row_stride + j * column_stride]; m[irow * row_stride + j * column_stride] = temp; } } indxr[i] = irow; indxc[i] = icol; pivinv = m[icol * row_stride + icol * column_stride]; if (pivinv == 0.0f) { // error, singular matrix return; } pivinv = 1.0f / pivinv; m[icol * row_stride + icol * column_stride] = 1.0f; for (j = 0; j < size; ++j) { m[icol * row_stride + j * column_stride] *= pivinv; } for (j = 0; j < size; ++j) { if (j != icol) { temp = m[j * row_stride + icol * column_stride]; m[j * row_stride + icol * column_stride] = 0.0f; for (k = 0; k < size; ++k) { m[j * row_stride + k * column_stride] -= m[icol * row_stride + k * column_stride] * temp; } } } } for (i = size-1; i >= 0; --i) { if (indxr[i] != indxc[i]) { for (j = 0; j < size; ++j) { temp = m[j * row_stride + indxr[i] * column_stride]; m[j * row_stride + indxr[i] * column_stride] = m[j * row_stride + indxc[i] * column_stride]; m[j * row_stride + indxc[i] * column_stride] = temp; } } } } OS_FNEXP void matrix_invert( mat4x4 *out, const mat4x4 *in ) { if (out != in) *out = *in; matrix_invert( &(*out)[0][0], 4, 4, 1 ); } OS_FNEXP void matrix_invert( mat4x3 *out, const mat4x3 *in ) { mat4x4 temp = *in; matrix_invert( &temp[0][0], 4, 4, 1 ); *out = temp; } OS_FNEXP void matrix_invert( mat3x3 *out, const mat3x3 *in ) { if (out != in) *out = *in; matrix_invert( &(*out)[0][0], 3, 4, 1 ); } OS_FNEXP void matrix_mul( mat4x4 *out, const mat4x4 *left, const mat4x4 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]) + (left->m[3][0] * right->m[0][3]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]) + (left->m[3][1] * right->m[0][3]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]) + (left->m[3][2] * right->m[0][3]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]) + (left->m[3][3] * right->m[0][3]); out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]) + (left->m[3][0] * right->m[1][3]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]) + (left->m[3][1] * right->m[1][3]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]) + (left->m[3][2] * right->m[1][3]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]) + (left->m[3][3] * right->m[1][3]); out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]) + (left->m[3][0] * right->m[2][3]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]) + (left->m[3][1] * right->m[2][3]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]) + (left->m[3][2] * right->m[2][3]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]) + (left->m[3][3] * right->m[2][3]); out->m[3][0] = (left->m[0][0] * right->m[3][0]) + (left->m[1][0] * right->m[3][1]) + (left->m[2][0] * right->m[3][2]) + (left->m[3][0] * right->m[3][3]); out->m[3][1] = (left->m[0][1] * right->m[3][0]) + (left->m[1][1] * right->m[3][1]) + (left->m[2][1] * right->m[3][2]) + (left->m[3][1] * right->m[3][3]); out->m[3][2] = (left->m[0][2] * right->m[3][0]) + (left->m[1][2] * right->m[3][1]) + (left->m[2][2] * right->m[3][2]) + (left->m[3][2] * right->m[3][3]); out->m[3][3] = (left->m[0][3] * right->m[3][0]) + (left->m[1][3] * right->m[3][1]) + (left->m[2][3] * right->m[3][2]) + (left->m[3][3] * right->m[3][3]); } OS_FNEXP void matrix_mul( mat4x4 *out, const mat4x4 *left, const mat4x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]) + (left->m[3][0] * right->m[0][3]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]) + (left->m[3][1] * right->m[0][3]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]) + (left->m[3][2] * right->m[0][3]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]) + (left->m[3][3] * right->m[0][3]); out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]) + (left->m[3][0] * right->m[1][3]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]) + (left->m[3][1] * right->m[1][3]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]) + (left->m[3][2] * right->m[1][3]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]) + (left->m[3][3] * right->m[1][3]); out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]) + (left->m[3][0] * right->m[2][3]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]) + (left->m[3][1] * right->m[2][3]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]) + (left->m[3][2] * right->m[2][3]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]) + (left->m[3][3] * right->m[2][3]); out->m[3][0] = left->m[3][0]; out->m[3][1] = left->m[3][1]; out->m[3][2] = left->m[3][2]; out->m[3][3] = left->m[3][3]; } OS_FNEXP void matrix_mul( mat4x4 *out, const mat4x4 *left, const mat3x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]); out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]); out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]); out->m[3][0] = left->m[3][0]; out->m[3][1] = left->m[3][1]; out->m[3][2] = left->m[3][2]; out->m[3][3] = left->m[3][3]; } OS_FNEXP void matrix_mul( mat4x4 *out, const mat4x3 *left, const mat4x4 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]) + right->m[0][3]; out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]) + right->m[1][3]; out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]) + right->m[2][3]; out->m[3][0] = (left->m[0][0] * right->m[3][0]) + (left->m[1][0] * right->m[3][1]) + (left->m[2][0] * right->m[3][2]); out->m[3][1] = (left->m[0][1] * right->m[3][0]) + (left->m[1][1] * right->m[3][1]) + (left->m[2][1] * right->m[3][2]); out->m[3][2] = (left->m[0][2] * right->m[3][0]) + (left->m[1][2] * right->m[3][1]) + (left->m[2][2] * right->m[3][2]); out->m[3][3] = (left->m[0][3] * right->m[3][0]) + (left->m[1][3] * right->m[3][1]) + (left->m[2][3] * right->m[3][2]) + right->m[3][3]; } OS_FNEXP void matrix_mul( mat4x3 *out, const mat4x3 *left, const mat4x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]) + right->m[0][3]; out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]) + right->m[1][3]; out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]) + right->m[2][3]; } OS_FNEXP void matrix_mul( mat4x3 *out, const mat4x3 *left, const mat3x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = (left->m[0][3] * right->m[0][0]) + (left->m[1][3] * right->m[0][1]) + (left->m[2][3] * right->m[0][2]); out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = (left->m[0][3] * right->m[1][0]) + (left->m[1][3] * right->m[1][1]) + (left->m[2][3] * right->m[1][2]); out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = (left->m[0][3] * right->m[2][0]) + (left->m[1][3] * right->m[2][1]) + (left->m[2][3] * right->m[2][2]); } OS_FNEXP void matrix_mul( mat4x4 *out, const mat3x3 *left, const mat4x4 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = right->m[0][3]; out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = right->m[1][3]; out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = right->m[2][3]; out->m[3][0] = (left->m[0][0] * right->m[3][0]) + (left->m[1][0] * right->m[3][1]) + (left->m[2][0] * right->m[3][2]); out->m[3][1] = (left->m[0][1] * right->m[3][0]) + (left->m[1][1] * right->m[3][1]) + (left->m[2][1] * right->m[3][2]); out->m[3][2] = (left->m[0][2] * right->m[3][0]) + (left->m[1][2] * right->m[3][1]) + (left->m[2][2] * right->m[3][2]); out->m[3][3] = right->m[3][3]; } OS_FNEXP void matrix_mul( mat4x3 *out, const mat3x3 *left, const mat4x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[0][3] = right->m[0][3]; out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[1][3] = right->m[1][3]; out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); out->m[2][3] = right->m[2][3]; } OS_FNEXP void matrix_mul( mat3x3 *out, const mat3x3 *left, const mat3x3 *right ) { MATH3D_ASSERT( (char *)left >= (char *)out + sizeof(*out) || (char *)out >= (char *)left + sizeof(*left) ); MATH3D_ASSERT( (char *)right >= (char *)out + sizeof(*out) || (char *)out >= (char *)right + sizeof(*right) ); out->m[0][0] = (left->m[0][0] * right->m[0][0]) + (left->m[1][0] * right->m[0][1]) + (left->m[2][0] * right->m[0][2]); out->m[0][1] = (left->m[0][1] * right->m[0][0]) + (left->m[1][1] * right->m[0][1]) + (left->m[2][1] * right->m[0][2]); out->m[0][2] = (left->m[0][2] * right->m[0][0]) + (left->m[1][2] * right->m[0][1]) + (left->m[2][2] * right->m[0][2]); out->m[1][0] = (left->m[0][0] * right->m[1][0]) + (left->m[1][0] * right->m[1][1]) + (left->m[2][0] * right->m[1][2]); out->m[1][1] = (left->m[0][1] * right->m[1][0]) + (left->m[1][1] * right->m[1][1]) + (left->m[2][1] * right->m[1][2]); out->m[1][2] = (left->m[0][2] * right->m[1][0]) + (left->m[1][2] * right->m[1][1]) + (left->m[2][2] * right->m[1][2]); out->m[2][0] = (left->m[0][0] * right->m[2][0]) + (left->m[1][0] * right->m[2][1]) + (left->m[2][0] * right->m[2][2]); out->m[2][1] = (left->m[0][1] * right->m[2][0]) + (left->m[1][1] * right->m[2][1]) + (left->m[2][1] * right->m[2][2]); out->m[2][2] = (left->m[0][2] * right->m[2][0]) + (left->m[1][2] * right->m[2][1]) + (left->m[2][2] * right->m[2][2]); } void fprint_matrix( FILE *f, const mat3x3 &m ) { for (int i = 0; i < 3; ++i) { fprintf( f, "\n " ); for (int j = 0; j < 3; ++j) { fprintf( f, "%10.5f", m[j][i] ); } } fprintf( f, "\n" ); } void fprint_matrix( FILE *f, const mat4x3 &m ) { for (int i = 0; i < 4; ++i) { fprintf( f, "\n " ); for (int j = 0; j < 3; ++j) { fprintf( f, "%10.5f", m[j][i] ); } } fprintf( f, "\n" ); } void fprint_matrix( FILE *f, const mat4x4 &m ) { for (int i = 0; i < 4; ++i) { fprintf( f, "\n " ); for (int j = 0; j < 4; ++j) { fprintf( f, "%10.5f", m[j][i] ); } } fprintf( f, "\n" ); } OS_FNEXP void factor_matrix( vec3 *out_scale, quat *out_orient, vec3 *out_offset, const mat4x3 &in ) { int i; vec3 scale; mat4x3 m = in; for (i = 0; i < 3; ++i) { double s = sqrt( in[0][i] * in[0][i] + in[1][i] * in[1][i] + in[2][i] * in[2][i] ); scale[i] = (float)s; m[0][i] = (float)(in[0][i] / s); m[1][i] = (float)(in[1][i] / s); m[2][i] = (float)(in[2][i] / s); } if (out_scale) *out_scale = scale; if (out_orient) { *out_orient = m; mat3x3 test_m(*out_orient); } if (out_offset) { for (i = 0; i < 3; ++i) { (*out_offset)[i] = m[i][3]; } } } OS_FNEXP void make_orthonormal( float *m, int size, int column_stride, int row_stride ); OS_FNEXP void make_orthonormal( float *m, int size, int column_stride, int row_stride ) { int i, j, k; for (i = 0; i < size; ++i) { // make othogonal to earlier columns for (j = 0; j < i; ++j) { // compute the dot product of columns j and i. note that column j is normalized float proj = 0.0f; for (k = 0; k < size; ++k) { proj += m[(i*column_stride) + (k*row_stride)] * m[(j*column_stride) + (k*row_stride)]; } // subtract out the projection of column j onto column i for (k = 0; k < size; ++k) { m[(i*column_stride) + (k*row_stride)] -= proj * m[(j*column_stride) + (k*row_stride)]; } } // normalize column i float len = 0.0f; for (j = 0; j < size; ++j) { len += m[(i*column_stride) + (j*row_stride)] * m[(i*column_stride) + (j*row_stride)]; } float n = 1.0f / sqrtf(len); for (j = 0; j < size; ++j) { m[(i*column_stride) + (j*row_stride)] *= n; } } }
39.442623
154
0.494437
joeriedel
37c4c7d50037d93b4c8db049ebcbbacfcf8e48b6
31,930
cpp
C++
blades/xbmc/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
4
2016-04-26T03:43:54.000Z
2016-11-17T08:09:04.000Z
blades/xbmc/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
17
2015-01-05T21:06:22.000Z
2015-12-07T20:45:44.000Z
blades/xbmc/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
3
2016-04-26T03:43:55.000Z
2020-11-06T11:02:08.000Z
/* * Copyright (C) 2010-2014 Team KODI * http://kodi.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with KODI; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "ActiveAEDSP.h" #include <utility> extern "C" { #include "libavutil/channel_layout.h" } #include "ActiveAEDSPProcess.h" #include "addons/AddonInstaller.h" #include "addons/GUIDialogAddonSettings.h" #include "Application.h" #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" #include "cores/AudioEngine/Interfaces/AEResample.h" #include "cores/AudioEngine/Utils/AEUtil.h" #include "cores/IPlayer.h" #include "dialogs/GUIDialogKaiToast.h" #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "guiinfo/GUIInfoLabels.h" #include "guilib/GUIWindowManager.h" #include "GUIUserMessages.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" #include "settings/AdvancedSettings.h" #include "settings/dialogs/GUIDialogAudioDSPManager.h" #include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "utils/JobManager.h" #include "utils/StringUtils.h" using namespace ADDON; using namespace ActiveAE; using namespace KODI::MESSAGING; using KODI::MESSAGING::HELPERS::DialogResponse; #define MIN_DSP_ARRAY_SIZE 4096 /*! @name Master audio dsp control class */ //@{ CActiveAEDSP::CActiveAEDSP() : CThread("ActiveAEDSP") , m_isActive(false) , m_noAddonWarningDisplayed(false) , m_usedProcessesCnt(0) , m_activeProcessId(-1) , m_isValidAudioDSPSettings(false) { Cleanup(); } CActiveAEDSP::~CActiveAEDSP() { /* Deactivate all present dsp addons */ Deactivate(); CLog::Log(LOGDEBUG, "ActiveAE DSP - destroyed"); } CActiveAEDSP &CActiveAEDSP::GetInstance() { static CActiveAEDSP activeAEDSPManagerInstance; return activeAEDSPManagerInstance; } //@} /*! @name message handling methods */ //@{ void CActiveAEDSP::OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg) { switch(pMsg->dwMessage) { case TMSG_SETAUDIODSPSTATE: if(pMsg->param1 == ACTIVE_AE_DSP_STATE_ON) { if(pMsg->param2 == ACTIVE_AE_DSP_ASYNC_ACTIVATE) { Activate(true); } else { Activate(); } } else if(pMsg->param1 == ACTIVE_AE_DSP_STATE_OFF) { Deactivate(); } break; default: CLog::Log(LOGERROR, "CActiveAEDSP received a invalid message! Nothing is processed."); break; } } int CActiveAEDSP::GetMessageMask() { return TMSG_MASK_AUDIO_DSP; } //@} /*! @name initialization and configuration methods */ //@{ class CActiveAEDSPStartJob : public CJob { public: CActiveAEDSPStartJob() {} ~CActiveAEDSPStartJob(void) {} bool DoWork(void) { CActiveAEDSP::GetInstance().Activate(false); return true; } }; void CActiveAEDSP::Activate(bool bAsync /* = false */) { if (bAsync) { CActiveAEDSPStartJob *job = new CActiveAEDSPStartJob(); CJobManager::GetInstance().AddJob(job, NULL); return; } CSingleLock lock(m_critSection); /* first stop and remove any audio dsp add-on's */ Deactivate(); CLog::Log(LOGNOTICE, "ActiveAE DSP - starting"); /* don't start if Settings->System->Audio->Audio DSP isn't checked */ if (!CSettings::GetInstance().GetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED)) return; Cleanup(); /* create and open database */ m_databaseDSP.Open(); Create(); SetPriority(-1); } class CActiveAEDSPModeUpdateJob : public CJob { public: CActiveAEDSPModeUpdateJob() {} ~CActiveAEDSPModeUpdateJob(void) {} bool DoWork(void) { CActiveAEDSP::GetInstance().TriggerModeUpdate(false); return true; } }; void CActiveAEDSP::TriggerModeUpdate(bool bAsync /* = true */) { if (bAsync) { CActiveAEDSPModeUpdateJob *job = new CActiveAEDSPModeUpdateJob(); CJobManager::GetInstance().AddJob(job, NULL); return; } CLog::Log(LOGINFO, "ActiveAE DSP - %s - Update mode selections", __FUNCTION__); if (!m_databaseDSP.IsOpen()) { CLog::Log(LOGERROR, "ActiveAE DSP - failed to open the database"); return; } for (unsigned int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i) { m_modes[i].clear(); m_databaseDSP.GetModes(m_modes[i], i); } /* * if any dsp processing is active restart playback */ if (m_usedProcessesCnt > 0) { CLog::Log(LOGNOTICE, "ActiveAE DSP - restarting playback after disabled dsp system"); CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_RESTART); } } void CActiveAEDSP::Deactivate(void) { CSingleLock lock(m_critSection); /* check whether the audio dsp is loaded */ if (!m_isActive) return; CLog::Log(LOGNOTICE, "ActiveAE DSP - stopping"); /* stop thread */ StopThread(false); /* unload all data */ Cleanup(); /* close database */ if (m_databaseDSP.IsOpen()) m_databaseDSP.Close(); /* destroy all addons */ for (AE_DSP_ADDONMAP_ITR itr = m_addonMap.begin(); itr != m_addonMap.end(); ++itr) itr->second->Destroy(); m_addonMap.clear(); } void CActiveAEDSP::Cleanup(void) { CActiveAEDSPProcessPtr tmp; for (unsigned int i = 0; i < AE_DSP_STREAM_MAX_STREAMS; ++i) m_usedProcesses[i] = tmp; m_isActive = false; m_usedProcessesCnt = 0; m_isValidAudioDSPSettings = false; m_noAddonWarningDisplayed = false; m_outdatedAddons.clear(); for (unsigned int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i) m_modes[i].clear(); } bool CActiveAEDSP::InstallAddonAllowed(const std::string &strAddonId) const { return !m_isActive || !IsInUse(strAddonId) || m_usedProcessesCnt == 0; } void CActiveAEDSP::MarkAsOutdated(const std::string& strAddonId) { if (IsActivated() && CSettings::GetInstance().GetInt(CSettings::SETTING_GENERAL_ADDONUPDATES) == AUTO_UPDATES_ON) { CSingleLock lock(m_critSection); m_outdatedAddons.push_back(strAddonId); } } bool CActiveAEDSP::HasOutdatedAddons(std::vector<std::string> &outdatedAddons) { CSingleLock lock(m_critSection); if (!m_outdatedAddons.empty()) { outdatedAddons = m_outdatedAddons; return true; } return false; } void CActiveAEDSP::ResetDatabase(void) { CLog::Log(LOGNOTICE, "ActiveAE DSP - clearing the audio DSP database"); if (IsProcessing()) { CLog::Log(LOGNOTICE, "ActiveAE DSP - stopping playback"); CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_STOP); } /* stop the thread */ Deactivate(); if (m_databaseDSP.Open()) { m_databaseDSP.DeleteModes(); m_databaseDSP.DeleteActiveDSPSettings(); m_databaseDSP.DeleteAddons(); m_databaseDSP.Close(); } CLog::Log(LOGNOTICE, "ActiveAE DSP - database cleared"); if (CSettings::GetInstance().GetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED)) { CLog::Log(LOGNOTICE, "ActiveAE DSP - restarting the audio DSP handler"); m_databaseDSP.Open(); Cleanup(); Activate(); } } //@} /*! @name Settings and action callback methods (OnAction currently unused */ //@{ void CActiveAEDSP::OnSettingAction(const CSetting *setting) { if (setting == NULL) return; const std::string &settingId = setting->GetId(); if (settingId == CSettings::SETTING_AUDIOOUTPUT_DSPSETTINGS) { if (IsActivated()) { CGUIDialogAudioDSPManager *dialog = (CGUIDialogAudioDSPManager *)g_windowManager.GetWindow(WINDOW_DIALOG_AUDIO_DSP_MANAGER); if (dialog) dialog->Open(); } } else if (settingId == CSettings::SETTING_AUDIOOUTPUT_DSPRESETDB) { if (HELPERS::ShowYesNoDialogLines(CVariant{19098}, CVariant{36440}, CVariant{750}) == DialogResponse::YES) { CDateTime::ResetTimezoneBias(); ResetDatabase(); } } } //@} /*! @name addon installation callback methods */ //@{ bool CActiveAEDSP::RequestRestart(AddonPtr addon, bool bDataChanged) { return StopAudioDSPAddon(addon, true); } bool CActiveAEDSP::RequestRemoval(AddonPtr addon) { return StopAudioDSPAddon(addon, false); } bool CActiveAEDSP::IsInUse(const std::string &strAddonId) const { CSingleLock lock(m_critSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) if (citr->second->Enabled() && citr->second->ID() == strAddonId) return true; return false; } bool CActiveAEDSP::IsKnownAudioDSPAddon(const AddonPtr &addon) const { // database IDs start at 1 return GetAudioDSPAddonId(addon) > 0; } int CActiveAEDSP::GetAudioDSPAddonId(const AddonPtr &addon) const { CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ID() == addon->ID()) return citr->first; } return -1; } //@} /*! @name GUIInfoManager calls */ //@{ bool CActiveAEDSP::TranslateBoolInfo(DWORD dwInfo) const { bool bReturn(false); CSingleLock lock(m_critSection); if (!IsProcessing() || !m_usedProcesses[m_activeProcessId]) return bReturn; switch (dwInfo) { case ADSP_IS_ACTIVE: bReturn = true; break; case ADSP_HAS_INPUT_RESAMPLE: bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_INPUT_RESAMPLE); break; case ADSP_HAS_PRE_PROCESS: bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_PRE_PROCESS); break; case ADSP_HAS_MASTER_PROCESS: bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_MASTER_PROCESS); break; case ADSP_HAS_POST_PROCESS: bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_POST_PROCESS); break; case ADSP_HAS_OUTPUT_RESAMPLE: bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE); break; case ADSP_MASTER_ACTIVE: bReturn = m_usedProcesses[m_activeProcessId]->GetActiveMasterMode() != NULL; break; default: break; }; return bReturn; } bool CActiveAEDSP::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const { bool bReturn(true); CSingleLock lock(m_critSection); if (!IsProcessing() || !m_usedProcesses[m_activeProcessId]) return false; CActiveAEDSPModePtr activeMaster = m_usedProcesses[m_activeProcessId]->GetActiveMasterMode(); if (activeMaster == NULL) return false; switch (dwInfo) { case ADSP_ACTIVE_STREAM_TYPE: strValue = g_localizeStrings.Get(GetStreamTypeName(m_usedProcesses[m_activeProcessId]->GetUsedStreamType())); break; case ADSP_DETECTED_STREAM_TYPE: strValue = g_localizeStrings.Get(GetStreamTypeName(m_usedProcesses[m_activeProcessId]->GetDetectedStreamType())); break; case ADSP_MASTER_NAME: { AE_DSP_ADDON addon; int modeId = activeMaster->ModeID(); if (modeId == AE_DSP_MASTER_MODE_ID_PASSOVER || modeId >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES) strValue = g_localizeStrings.Get(activeMaster->ModeName()); else if (CActiveAEDSP::GetInstance().GetAudioDSPAddon(activeMaster->AddonID(), addon)) strValue = addon->GetString(activeMaster->ModeName()); } break; case ADSP_MASTER_INFO: bReturn = m_usedProcesses[m_activeProcessId]->GetMasterModeStreamInfoString(strValue); break; case ADSP_MASTER_OWN_ICON: strValue = activeMaster->IconOwnModePath(); break; case ADSP_MASTER_OVERRIDE_ICON: strValue = activeMaster->IconOverrideModePath(); break; default: strValue.clear(); bReturn = false; break; }; return bReturn; } //@} /*! @name Current processing streams control function methods */ //@{ CAEChannelInfo CActiveAEDSP::GetInternalChannelLayout(AEStdChLayout stdLayout) { uint64_t channelLayoutOut; switch (stdLayout) { default: case AE_CH_LAYOUT_2_0: channelLayoutOut = AV_CH_LAYOUT_STEREO; break; case AE_CH_LAYOUT_2_1: channelLayoutOut = AV_CH_LAYOUT_2POINT1; break; case AE_CH_LAYOUT_3_0: channelLayoutOut = AV_CH_LAYOUT_SURROUND; break; case AE_CH_LAYOUT_3_1: channelLayoutOut = AV_CH_LAYOUT_3POINT1; break; case AE_CH_LAYOUT_4_0: channelLayoutOut = AV_CH_LAYOUT_2_2; break; case AE_CH_LAYOUT_4_1: channelLayoutOut = AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY; break; case AE_CH_LAYOUT_5_0: channelLayoutOut = AV_CH_LAYOUT_5POINT0; break; case AE_CH_LAYOUT_5_1: channelLayoutOut = AV_CH_LAYOUT_5POINT1; break; case AE_CH_LAYOUT_7_0: channelLayoutOut = AV_CH_LAYOUT_7POINT0; break; case AE_CH_LAYOUT_7_1: channelLayoutOut = AV_CH_LAYOUT_7POINT1; break; } return CAEUtil::GetAEChannelLayout(channelLayoutOut); } bool CActiveAEDSP::CreateDSPs(unsigned int &streamId, CActiveAEDSPProcessPtr &process, const AEAudioFormat &inputFormat, const AEAudioFormat &outputFormat, bool upmix, AEQuality quality, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type, int profile, bool wasActive) { if (!IsActivated() || m_usedProcessesCnt >= AE_DSP_STREAM_MAX_STREAMS) return false; CSingleLock lock(m_critSection); AE_DSP_STREAMTYPE requestedStreamType = LoadCurrentAudioSettings(); CActiveAEDSPProcessPtr usedProc; if (wasActive && streamId != (unsigned int)-1 && streamId < AE_DSP_STREAM_MAX_STREAMS) { if (m_usedProcesses[streamId] != NULL) { usedProc = m_usedProcesses[streamId]; } } else { for (unsigned int i = 0; i < AE_DSP_STREAM_MAX_STREAMS; ++i) { /* find a free position */ if (m_usedProcesses[i] == NULL) { usedProc = CActiveAEDSPProcessPtr(new CActiveAEDSPProcess(i)); streamId = i; break; } } } if (usedProc == NULL) { CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't find active processing class", __FUNCTION__); return false; } if (!usedProc->Create(inputFormat, outputFormat, upmix, quality, requestedStreamType, matrix_encoding, audio_service_type, profile)) { CLog::Log(LOGERROR, "ActiveAE DSP - %s - Creation of processing class failed", __FUNCTION__); return false; } if (!wasActive) { process = usedProc; m_activeProcessId = streamId; m_usedProcesses[streamId] = usedProc; m_usedProcessesCnt++; } return true; } void CActiveAEDSP::DestroyDSPs(unsigned int streamId) { CSingleLock lock(m_critSection); if (streamId != (unsigned int)-1 && m_usedProcesses[streamId] != NULL) { m_usedProcesses[streamId]->Destroy(); m_usedProcesses[streamId] = CActiveAEDSPProcessPtr(); --m_usedProcessesCnt; } if (m_usedProcessesCnt == 0) { m_activeProcessId = -1; } } CActiveAEDSPProcessPtr CActiveAEDSP::GetDSPProcess(unsigned int streamId) { CSingleLock lock(m_critSection); if (streamId != (unsigned int)-1 && m_usedProcesses[streamId]) return m_usedProcesses[streamId]; return CActiveAEDSPProcessPtr(); } unsigned int CActiveAEDSP::GetProcessingStreamsAmount(void) { CSingleLock lock(m_critSection); return m_usedProcessesCnt; } unsigned int CActiveAEDSP::GetActiveStreamId(void) { CSingleLock lock(m_critSection); return m_activeProcessId; } const AE_DSP_MODELIST &CActiveAEDSP::GetAvailableModes(AE_DSP_MODE_TYPE modeType) { static AE_DSP_MODELIST emptyArray; if (modeType < 0 || modeType >= AE_DSP_MODE_TYPE_MAX) return emptyArray; CSingleLock lock(m_critSection); return m_modes[modeType]; } /*! @name addon update process methods */ //@{ bool CActiveAEDSP::StopAudioDSPAddon(AddonPtr addon, bool bRestart) { CSingleLock lock(m_critSection); int iId = GetAudioDSPAddonId(addon); AE_DSP_ADDON mappedAddon; if (GetReadyAudioDSPAddon(iId, mappedAddon)) { if (bRestart) mappedAddon->ReCreate(); else mappedAddon->Destroy(); return true; } return false; } bool CActiveAEDSP::UpdateAndInitialiseAudioDSPAddons(bool bInitialiseAllAudioDSPAddons /* = false */) { bool bReturn(true); VECADDONS map; VECADDONS disableAddons; { CSingleLock lock(m_critUpdateSection); map = m_addons; } if (map.size() == 0) return false; for (unsigned iAddonPtr = 0; iAddonPtr < map.size(); ++iAddonPtr) { const AddonPtr dspAddon = map.at(iAddonPtr); bool bEnabled = dspAddon->Enabled() && !CAddonMgr::GetInstance().IsAddonDisabled(dspAddon->ID()); if (!bEnabled && IsKnownAudioDSPAddon(dspAddon)) { CSingleLock lock(m_critUpdateSection); /* stop the dsp addon and remove it from the db */ StopAudioDSPAddon(dspAddon, false); VECADDONS::iterator addonPtr = std::find(m_addons.begin(), m_addons.end(), dspAddon); if (addonPtr != m_addons.end()) m_addons.erase(addonPtr); } else if (bEnabled && (bInitialiseAllAudioDSPAddons || !IsKnownAudioDSPAddon(dspAddon) || !IsReadyAudioDSPAddon(dspAddon))) { bool bDisabled(false); /* register the add-on in the audio dsp db, and create the CActiveAEDSPAddon instance */ int iAddonId = RegisterAudioDSPAddon(dspAddon); if (iAddonId < 0) { /* failed to register or create the add-on, disable it */ CLog::Log(LOGWARNING, "ActiveAE DSP - %s - failed to register add-on %s, disabling it", __FUNCTION__, dspAddon->Name().c_str()); disableAddons.push_back(dspAddon); bDisabled = true; } else { ADDON_STATUS status(ADDON_STATUS_UNKNOWN); AE_DSP_ADDON addon; { CSingleLock lock(m_critUpdateSection); if (!GetAudioDSPAddon(iAddonId, addon)) { CLog::Log(LOGWARNING, "ActiveAE DSP - %s - failed to find add-on %s, disabling it", __FUNCTION__, dspAddon->Name().c_str()); disableAddons.push_back(dspAddon); bDisabled = true; } } /* re-check the enabled status. newly installed dsps get disabled when they're added to the db */ if (!bDisabled && addon->Enabled() && (status = addon->Create(iAddonId)) != ADDON_STATUS_OK) { CLog::Log(LOGWARNING, "ActiveAE DSP - %s - failed to create add-on %s, status = %d", __FUNCTION__, dspAddon->Name().c_str(), status); if (!addon.get() || !addon->DllLoaded() || status == ADDON_STATUS_PERMANENT_FAILURE) { /* failed to load the dll of this add-on, disable it */ CLog::Log(LOGWARNING, "ActiveAE DSP - %s - failed to load the dll for add-on %s, disabling it", __FUNCTION__, dspAddon->Name().c_str()); disableAddons.push_back(dspAddon); bDisabled = true; } } } if (bDisabled && IsActivated()) CGUIDialogOK::ShowAndGetInput(24070, 24071, 16029, 0); } } /* disable add-ons that failed to initialise */ if (disableAddons.size() > 0) { CSingleLock lock(m_critUpdateSection); for (VECADDONS::iterator itr = disableAddons.begin(); itr != disableAddons.end(); ++itr) { /* disable in the add-on db */ CAddonMgr::GetInstance().DisableAddon((*itr)->ID()); /* remove from the audio dsp add-on list */ VECADDONS::iterator addonPtr = std::find(m_addons.begin(), m_addons.end(), *itr); if (addonPtr != m_addons.end()) m_addons.erase(addonPtr); } } return bReturn; } bool CActiveAEDSP::UpdateAddons(void) { VECADDONS addons; AE_DSP_ADDON dspAddon; bool bReturn(CAddonMgr::GetInstance().GetAddons(ADDON_ADSPDLL, addons, true)); size_t usableAddons; if (bReturn) { CSingleLock lock(m_critUpdateSection); m_addons = addons; } usableAddons = m_addons.size(); /* handle "new" addons which aren't yet in the db - these have to be added first */ for (VECADDONS::const_iterator itr = addons.begin(); itr != addons.end(); ++itr) { dspAddon = std::dynamic_pointer_cast<CActiveAEDSPAddon>(*itr); bool newRegistration = false; if (RegisterAudioDSPAddon(dspAddon, &newRegistration) < 0 || newRegistration) { CAddonMgr::GetInstance().DisableAddon(dspAddon->ID()); --usableAddons; } } if ((!bReturn || usableAddons == 0) && !m_noAddonWarningDisplayed && !CAddonMgr::GetInstance().HasAddons(ADDON_ADSPDLL, false) && IsActivated()) { // No audio DSP add-ons could be found // You need a add-on installed for the process of audio DSP signal. System becomes disabled. m_noAddonWarningDisplayed = true; CGUIDialogOK::ShowAndGetInput(CVariant{19273}, CVariant{19274}); CSettings::GetInstance().SetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED, false); CGUIMessage msg(GUI_MSG_UPDATE, WINDOW_SETTINGS_SYSTEM, 0); g_windowManager.SendThreadMessage(msg, WINDOW_SETTINGS_SYSTEM); CApplicationMessenger::GetInstance().SendMsg(TMSG_SETAUDIODSPSTATE, ACTIVE_AE_DSP_STATE_OFF); } return bReturn; } void CActiveAEDSP::Notify(const Observable &obs, const ObservableMessage msg) { if (msg == ObservableMessageAddons) UpdateAddons(); } void CActiveAEDSP::Process(void) { bool bCheckedEnabledAddonsOnStartup(false); CAddonMgr::GetInstance().RegisterAddonMgrCallback(ADDON_ADSPDLL, this); CAddonMgr::GetInstance().RegisterObserver(this); m_isActive = true; UpdateAddons(); while (!g_application.m_bStop && !m_bStop) { UpdateAndInitialiseAudioDSPAddons(); if (!bCheckedEnabledAddonsOnStartup) { bCheckedEnabledAddonsOnStartup = true; if (HasEnabledAudioDSPAddons()) TriggerModeUpdate(false); else if (!m_noAddonWarningDisplayed) ShowDialogNoAddonsEnabled(); } Sleep(1000); } m_isActive = false; } void CActiveAEDSP::ShowDialogNoAddonsEnabled(void) { if (!IsActivated()) return; CGUIDialogOK::ShowAndGetInput(15048, 15049, 0, 0); std::vector<std::string> params; params.push_back("addons://disabled/kodi.adsp"); params.push_back("return"); g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params); } int CActiveAEDSP::RegisterAudioDSPAddon(AddonPtr addon, bool* newRegistration/*=NULL*/) { int iAddonId(-1); if (newRegistration) *newRegistration = false; if (!addon->Enabled()) return -1; CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - registering add-on '%s'", __FUNCTION__, addon->Name().c_str()); if (!m_databaseDSP.IsOpen()) { CLog::Log(LOGERROR, "ActiveAE DSP - %s - failed to get the database", __FUNCTION__); return -1; } /* check whether we already know this dsp addon */ iAddonId = m_databaseDSP.GetAudioDSPAddonId(addon->ID()); /* try to register the new dsp addon in the db */ if (iAddonId < 0) { if ((iAddonId = m_databaseDSP.Persist(addon)) < 0) { CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't add dsp addon '%s' to the database", __FUNCTION__, addon->Name().c_str()); return -1; } else if (newRegistration) *newRegistration = true; } AE_DSP_ADDON dspAddon; /* load and initialise the dsp addon libraries */ { CSingleLock lock(m_critSection); AE_DSP_ADDONMAP_CITR existingAddon = m_addonMap.find(iAddonId); if (existingAddon != m_addonMap.end()) { /* return existing addon */ dspAddon = existingAddon->second; } else { /* create a new addon instance */ dspAddon = std::dynamic_pointer_cast<CActiveAEDSPAddon> (addon); m_addonMap.insert(std::make_pair(iAddonId, dspAddon)); } } if (iAddonId < 0) CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't register dsp add-on '%s'", __FUNCTION__, addon->Name().c_str()); return iAddonId; } //@} /*! @name Played source settings methods * @note for save of settings see CSaveFileStateJob */ //@{ AE_DSP_STREAMTYPE CActiveAEDSP::LoadCurrentAudioSettings(void) { CSingleLock lock(m_critSection); AE_DSP_STREAMTYPE type = AE_DSP_ASTREAM_INVALID; if (g_application.m_pPlayer->HasPlayer()) { CFileItem currentFile(g_application.CurrentFileItem()); /* load the persisted audio settings and set them as current */ CAudioSettings loadedAudioSettings = CMediaSettings::GetInstance().GetDefaultAudioSettings(); m_databaseDSP.GetActiveDSPSettings(currentFile, loadedAudioSettings); CMediaSettings::GetInstance().GetCurrentAudioSettings() = loadedAudioSettings; type = (AE_DSP_STREAMTYPE) loadedAudioSettings.m_MasterStreamTypeSel; /* settings can be saved on next audio stream change */ m_isValidAudioDSPSettings = true; } return type; } //@} /*! @name Backend methods */ //@{ bool CActiveAEDSP::IsProcessing(void) const { return m_isActive && m_usedProcessesCnt > 0; } bool CActiveAEDSP::IsActivated(void) const { return m_isActive; } int CActiveAEDSP::EnabledAudioDSPAddonAmount(void) const { int iReturn(0); CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->Enabled()) ++iReturn; } return iReturn; } bool CActiveAEDSP::HasEnabledAudioDSPAddons(void) const { return EnabledAudioDSPAddonAmount() > 0; } int CActiveAEDSP::GetEnabledAudioDSPAddons(AE_DSP_ADDONMAP &addons) const { int iReturn(0); CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->Enabled()) { addons.insert(std::make_pair(citr->second->GetID(), citr->second)); ++iReturn; } } return iReturn; } int CActiveAEDSP::ReadyAudioDSPAddonAmount(void) const { int iReturn(0); CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ReadyToUse()) ++iReturn; } return iReturn; } bool CActiveAEDSP::HasReadyAudioDSPAddons(void) const { return ReadyAudioDSPAddonAmount() > 0; } bool CActiveAEDSP::IsReadyAudioDSPAddon(int iAddonId) const { AE_DSP_ADDON addon; return GetReadyAudioDSPAddon(iAddonId, addon); } bool CActiveAEDSP::IsReadyAudioDSPAddon(const AddonPtr &addon) { CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ID() == addon->ID()) return citr->second->ReadyToUse(); } return false; } int CActiveAEDSP::GetReadyAddons(AE_DSP_ADDONMAP &addons) const { int iReturn(0); CSingleLock lock(m_critSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ReadyToUse()) { addons.insert(std::make_pair(citr->second->GetID(), citr->second)); ++iReturn; } } return iReturn; } bool CActiveAEDSP::GetReadyAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const { if (GetAudioDSPAddon(iAddonId, addon)) return addon->ReadyToUse(); return false; } bool CActiveAEDSP::GetAudioDSPAddonName(int iAddonId, std::string &strName) const { bool bReturn(false); AE_DSP_ADDON addon; if ((bReturn = GetReadyAudioDSPAddon(iAddonId, addon)) == true) strName = addon->GetAudioDSPName(); return bReturn; } bool CActiveAEDSP::GetAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const { bool bReturn(false); if (iAddonId <= AE_DSP_INVALID_ADDON_ID) return bReturn; CSingleLock lock(m_critUpdateSection); AE_DSP_ADDONMAP_CITR citr = m_addonMap.find(iAddonId); if (citr != m_addonMap.end()) { addon = citr->second; bReturn = true; } return bReturn; } bool CActiveAEDSP::GetAudioDSPAddon(const std::string &strId, AddonPtr &addon) const { CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ID() == strId) { addon = citr->second; return true; } } return false; } //@} /*! @name Menu hook methods */ //@{ bool CActiveAEDSP::HaveMenuHooks(AE_DSP_MENUHOOK_CAT cat, int iDSPAddonID) { for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr) { if (citr->second->ReadyToUse()) { if (citr->second->HaveMenuHooks(cat)) { if (iDSPAddonID > 0 && citr->second->GetID() == iDSPAddonID) return true; else if (iDSPAddonID < 0) return true; } else if (cat == AE_DSP_MENUHOOK_SETTING) { AddonPtr addon; if (CAddonMgr::GetInstance().GetAddon(citr->second->ID(), addon) && addon->HasSettings()) return true; } } } return false; } bool CActiveAEDSP::GetMenuHooks(int iDSPAddonID, AE_DSP_MENUHOOK_CAT cat, AE_DSP_MENUHOOKS &hooks) { bool bReturn(false); if (iDSPAddonID < 0) return bReturn; AE_DSP_ADDON addon; if (GetReadyAudioDSPAddon(iDSPAddonID, addon) && addon->HaveMenuHooks(cat)) { AE_DSP_MENUHOOKS *addonhooks = addon->GetMenuHooks(); for (unsigned int i = 0; i < addonhooks->size(); ++i) { if (cat == AE_DSP_MENUHOOK_ALL || addonhooks->at(i).category == cat) { hooks.push_back(addonhooks->at(i)); bReturn = true; } } } return bReturn; } //@} /*! @name General helper functions */ //@{ enum AEChannel CActiveAEDSP::GetKODIChannel(AE_DSP_CHANNEL channel) { switch (channel) { case AE_DSP_CH_FL: return AE_CH_FL; case AE_DSP_CH_FR: return AE_CH_FR; case AE_DSP_CH_FC: return AE_CH_FC; case AE_DSP_CH_LFE: return AE_CH_LFE; case AE_DSP_CH_BL: return AE_CH_BL; case AE_DSP_CH_BR: return AE_CH_BR; case AE_DSP_CH_FLOC: return AE_CH_FLOC; case AE_DSP_CH_FROC: return AE_CH_FROC; case AE_DSP_CH_BC: return AE_CH_BC; case AE_DSP_CH_SL: return AE_CH_SL; case AE_DSP_CH_SR: return AE_CH_SR; case AE_DSP_CH_TC: return AE_CH_TC; case AE_DSP_CH_TFL: return AE_CH_TFL; case AE_DSP_CH_TFC: return AE_CH_TFC; case AE_DSP_CH_TFR: return AE_CH_TFR; case AE_DSP_CH_TBL: return AE_CH_TBL; case AE_DSP_CH_TBC: return AE_CH_TBC; case AE_DSP_CH_TBR: return AE_CH_TBR; default: return AE_CH_NULL; } } AE_DSP_CHANNEL CActiveAEDSP::GetDSPChannel(enum AEChannel channel) { switch (channel) { case AE_CH_FL: return AE_DSP_CH_FL; case AE_CH_FR: return AE_DSP_CH_FR; case AE_CH_FC: return AE_DSP_CH_FC; case AE_CH_LFE: return AE_DSP_CH_LFE; case AE_CH_BL: return AE_DSP_CH_BL; case AE_CH_BR: return AE_DSP_CH_BR; case AE_CH_FLOC: return AE_DSP_CH_FLOC; case AE_CH_FROC: return AE_DSP_CH_FROC; case AE_CH_BC: return AE_DSP_CH_BC; case AE_CH_SL: return AE_DSP_CH_SL; case AE_CH_SR: return AE_DSP_CH_SR; case AE_CH_TC: return AE_DSP_CH_TC; case AE_CH_TFL: return AE_DSP_CH_TFL; case AE_CH_TFC: return AE_DSP_CH_TFC; case AE_CH_TFR: return AE_DSP_CH_TFR; case AE_CH_TBL: return AE_DSP_CH_TBL; case AE_CH_TBC: return AE_DSP_CH_TBC; case AE_CH_TBR: return AE_DSP_CH_TBR; default: return AE_DSP_CH_INVALID; } } /*! * Contains string name id's related to the AE_DSP_ASTREAM_ values */ const int CActiveAEDSP::m_StreamTypeNameTable[] = { 15004, //!< "Basic" 249, //!< "Music" 157, //!< "Video" 15016, //!< "Games" 15005, //!< "Application" 15006, //!< "Phone" 15007, //!< "Message" 14061 //!< "Auto" }; int CActiveAEDSP::GetStreamTypeName(unsigned int streamType) { if (streamType > AE_DSP_ASTREAM_AUTO) return -1; return m_StreamTypeNameTable[streamType]; } //@}
26.519934
167
0.6943
krattai
37c55a5c7f72ea7d9f4b1f86eda223c7a32430d1
7,538
cc
C++
blades/mediatomb/src/filesystem.cc
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
4
2016-04-26T03:43:54.000Z
2016-11-17T08:09:04.000Z
blades/mediatomb/src/filesystem.cc
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
17
2015-01-05T21:06:22.000Z
2015-12-07T20:45:44.000Z
blades/mediatomb/src/filesystem.cc
krattai/AEBL
a7b12c97479e1236d5370166b15ca9f29d7d4265
[ "BSD-2-Clause" ]
3
2016-04-26T03:43:55.000Z
2020-11-06T11:02:08.000Z
/*MT* MediaTomb - http://www.mediatomb.cc/ filesystem.cc - this file is part of MediaTomb. Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>, Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc> Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>, Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>, Leonhard Wimmer <leo@mediatomb.cc> MediaTomb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. MediaTomb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License version 2 along with MediaTomb; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. $Id$ */ /// \file filesystem.cc #ifdef HAVE_CONFIG_H #include "autoconfig.h" #endif #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include "common.h" #include "config_manager.h" #include "content_manager.h" #include "filesystem.h" #include "mxml/mxml.h" #include "tools.h" using namespace zmm; using namespace mxml; int FsObjectComparator(void *arg1, void *arg2) { FsObject *o1 = (FsObject *)arg1; FsObject *o2 = (FsObject *)arg2; if (o1->isDirectory) { if (o2->isDirectory) return strcmp(o1->filename.c_str(), o2->filename.c_str()); else return -1; } else { if (o2->isDirectory) return 1; else return strcmp(o1->filename.c_str(), o2->filename.c_str()); } } Filesystem::Filesystem() : Object() { includeRules = Ref<Array<RExp> >(new Array<RExp>()); Ref<ConfigManager> cm = ConfigManager::getInstance(); /* Ref<Element> rules = cm->getElement(_("filter")); if (rules == nil) return; for (int i = 0; i < rules->childCount(); i++) { Ref<Element> rule = rules->getChild(i); String pat = rule->getAttribute(_("pattern")); /// \todo make patterns from simple wildcards instead of /// taking the pattern attribute directly as regexp Ref<RExp> pattern(new RExp()); try { pattern->compile(pat); includeRules->append(pattern); } catch (Exception e) { e.printStackTrace(); } } */ } Ref<Array<FsObject> > Filesystem::readDirectory(String path, int mask, int childMask) { if (path.charAt(0) != '/') { throw _Exception(_("Filesystem: relative paths not allowed: ") + path); } if (! fileAllowed(path)) throw _Exception(_("Filesystem: file blocked: ") + path); struct stat statbuf; int ret; Ref<Array<FsObject> > files(new Array<FsObject>()); DIR *dir; struct dirent *dent; dir = opendir(path.c_str()); if (! dir) { throw _Exception(_("could not list directory ") + path + " : " + strerror(errno)); } while ((dent = readdir(dir)) != NULL) { char *name = dent->d_name; if (name[0] == '.') { if (name[1] == 0) { continue; } else if (name[1] == '.' && name[2] == 0) { continue; } else if (!(mask & FS_MASK_HIDDEN)) continue; } String childPath; if (path == FS_ROOT_DIRECTORY) childPath = path + name; else childPath = path + "/" + name; if (fileAllowed(childPath)) { bool isDirectory = false; bool hasContent = false; ret = stat(childPath.c_str(), &statbuf); if (ret != 0) continue; if (S_ISREG(statbuf.st_mode)) { if (! (mask & FS_MASK_FILES)) continue; } else if (S_ISDIR(statbuf.st_mode)) { if (! (mask & FS_MASK_DIRECTORIES)) continue; isDirectory = true; if (childMask) { try { hasContent = have(childPath, childMask); } catch (Exception e) { //continue; } } } else continue; // special file Ref<FsObject> obj(new FsObject()); obj->filename = name; obj->isDirectory = isDirectory; obj->hasContent = hasContent; files->append(obj); } } closedir(dir); quicksort((COMPARABLE *)files->getObjectArray(), files->size(), FsObjectComparator); return files; } bool Filesystem::have(String path, int mask) { /* if (path.charAt(0) != '/') { throw _Exception(_("Filesystem relative paths not allowed: ") + path); } */ if (! fileAllowed(path)) return false; struct stat statbuf; int ret; Ref<Array<FsObject> > files(new Array<FsObject>()); DIR *dir; struct dirent *dent; dir = opendir(path.c_str()); if (! dir) { throw _Exception(_("could not list directory ")+ path + " : " + strerror(errno)); } bool result = false; while ((dent = readdir(dir)) != NULL) { char *name = dent->d_name; if (name[0] == '.') { if (name[1] == 0) { continue; } else if (name[1] == '.' && name[2] == 0) { continue; } else if (!(mask & FS_MASK_HIDDEN)) continue; } String childPath; if (path == FS_ROOT_DIRECTORY) childPath = path + name; else childPath = path + "/" + name; if (fileAllowed(childPath)) { ret = stat(childPath.c_str(), &statbuf); if (ret != 0) continue; if (S_ISREG(statbuf.st_mode) && mask & FS_MASK_FILES) { result = true; break; } else if (S_ISDIR(statbuf.st_mode) && mask & FS_MASK_DIRECTORIES) { result = true; break; } else continue; // special file } } closedir(dir); return result; } bool Filesystem::haveFiles(String dir) { return have(dir, FS_MASK_FILES); } bool Filesystem::haveDirectories(String dir) { return have(dir, FS_MASK_DIRECTORIES); } bool Filesystem::fileAllowed(String path) { if (path == ConfigManager::getInstance()->getConfigFilename()) return false; return true; /* for (int i = 0; i < include_rules->size(); i++) { Ref<RExp> rule = include_rules->get(i); if (rule->matches(path)) return true; } return false; */ }
26.083045
78
0.499071
krattai
37c6f073046f522293840ddcc5e4216519ae3012
4,715
cpp
C++
test/source/game_state_unit_tests.cpp
ahelwer/pason2012
9e7d76589c3a9c81adc9b37e8770239b346801c0
[ "MIT" ]
1
2020-09-15T05:48:22.000Z
2020-09-15T05:48:22.000Z
test/source/game_state_unit_tests.cpp
ahelwer/pason2012
9e7d76589c3a9c81adc9b37e8770239b346801c0
[ "MIT" ]
4
2019-07-03T17:06:25.000Z
2019-07-03T17:06:45.000Z
test/source/game_state_unit_tests.cpp
ahelwer/pason2012
9e7d76589c3a9c81adc9b37e8770239b346801c0
[ "MIT" ]
null
null
null
#include <test/game_state_unit_tests.hpp> #include <model/tetromino.hpp> #include <util/constants.hpp> #include <util/vector.hpp> #include <iostream> CPPUNIT_TEST_SUITE_REGISTRATION(GameStateUnitTests); void GameStateUnitTests::setUp() { m_pState = new GameState(); } void GameStateUnitTests::tearDown() { if (m_pState != NULL) { delete m_pState; m_pState = NULL; } } void GameStateUnitTests::TestInit() { CPPUNIT_ASSERT(m_pState->GetPieceInPlay() == NULL); std::vector<int> const& last = m_pState->LastClearedRows(); int lastSize = last.size(); CPPUNIT_ASSERT_EQUAL(0, lastSize); CPPUNIT_ASSERT_EQUAL(-1, m_pState->GetCurrentPieceNumber()); CPPUNIT_ASSERT(!m_pState->WasRowClearEvent()); CPPUNIT_ASSERT(!m_pState->PieceHasChanged()); } void GameStateUnitTests::TestAssignment() { GameState a; Tetromino t ('O', 0, 5, COLS-2); a.SetPieceInPlay(&t); std::vector<Tetromino> queue; queue.push_back(t); a.SetQueueInPlay(queue); std::vector<int> cleared; cleared.push_back(0); a.SetLastClearedRows(cleared); a.SetCurrentPieceNumber(4); GameState b = a; CPPUNIT_ASSERT(b == a); } void GameStateUnitTests::TestApplyMove() { Tetromino t ('I', 0, 2, ROWS-1); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftUp(); t.ShiftUp(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftDown(); t.ShiftDown(); t.ShiftRight(); t.ShiftRight(); t.ShiftUp(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftUp(); t.ShiftUp(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftDown(); t.ShiftDown(); t.ShiftDown(); t.ShiftRight(); t.ShiftRight(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftUp(); t.ShiftUp(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftDown(); t.ShiftDown(); t.ShiftRight(); t.ShiftRight(); t.RotateRight(); t.ShiftUp(); t.ShiftUp(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(0, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); t.ShiftRight(); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT_EQUAL(2, m_pState->ApplyMove(t)); CPPUNIT_ASSERT(m_pState->LastPiecePlayed() == t); std::vector<int> const& cleared = m_pState->LastClearedRows(); CPPUNIT_ASSERT_EQUAL(ROWS-3, cleared.at(0)); CPPUNIT_ASSERT_EQUAL(ROWS-1, cleared.at(1)); } void GameStateUnitTests::TestFeedFromQueue() { Tetromino t1 ('I', 0, 5, 1); Tetromino t2 ('S', 0, 5, 1); std::vector<Tetromino> queue; queue.push_back(t1); queue.push_back(t2); CPPUNIT_ASSERT_EQUAL(0, m_pState->QueuedPieceCount()); m_pState->SetQueueInPlay(queue); CPPUNIT_ASSERT_EQUAL(2, m_pState->QueuedPieceCount()); CPPUNIT_ASSERT(m_pState->GetPieceInPlay() == NULL); CPPUNIT_ASSERT(!m_pState->FeedFromQueue(-1)); CPPUNIT_ASSERT(!m_pState->FeedFromQueue(2)); CPPUNIT_ASSERT(m_pState->FeedFromQueue(0)); CPPUNIT_ASSERT(m_pState->GetPieceInPlay() != NULL); CPPUNIT_ASSERT(*(m_pState->GetPieceInPlay()) == t1); CPPUNIT_ASSERT_EQUAL(2, m_pState->QueuedPieceCount()); CPPUNIT_ASSERT(m_pState->FeedFromQueue(1)); CPPUNIT_ASSERT(m_pState->GetPieceInPlay() != NULL); CPPUNIT_ASSERT(*(m_pState->GetPieceInPlay()) == t2); CPPUNIT_ASSERT_EQUAL(2, m_pState->QueuedPieceCount()); } void GameStateUnitTests::TestEventMethods() { // Tests piece number methods m_pState->SetCurrentPieceNumber(3); CPPUNIT_ASSERT(m_pState->PieceHasChanged()); CPPUNIT_ASSERT(!m_pState->PieceHasChanged()); m_pState->SetCurrentPieceNumber(3); CPPUNIT_ASSERT(!m_pState->PieceHasChanged()); Tetromino t ('T', 0, 5, 1); m_pState->SetPieceInPlay(&t); CPPUNIT_ASSERT(m_pState->GetPieceInPlay() != NULL); m_pState->SetCurrentPieceNumber(-1); CPPUNIT_ASSERT(m_pState->GetPieceInPlay() == NULL); // Tests row clearing events CPPUNIT_ASSERT(!m_pState->WasRowClearEvent()); m_pState->SetRowClearEvent(); CPPUNIT_ASSERT(m_pState->WasRowClearEvent()); CPPUNIT_ASSERT(!m_pState->WasRowClearEvent()); }
32.517241
66
0.68526
ahelwer
37c78d02abb275b9a1ce9a4790d8e4b2f8db64df
1,999
hh
C++
Framework/AbsModuleMemento.hh
brownd1978/FastSim
05f590d72d8e7f71856fd833114a38b84fc7fd48
[ "Apache-2.0" ]
null
null
null
Framework/AbsModuleMemento.hh
brownd1978/FastSim
05f590d72d8e7f71856fd833114a38b84fc7fd48
[ "Apache-2.0" ]
null
null
null
Framework/AbsModuleMemento.hh
brownd1978/FastSim
05f590d72d8e7f71856fd833114a38b84fc7fd48
[ "Apache-2.0" ]
null
null
null
//-------------------------------------------------------------------------- // File and Version Information: // $Id: AbsModuleMemento.hh 509 2010-01-14 15:18:55Z stroili $ // // Description: // Class AbsModuleMemento. Abstract base class for Memento classes // Do not use this for Template class (foo<T>). use TemplateTemplate.hh // instead. // // Environment: // Software developed for the BaBar Detector at the SLAC B-Factory. // // Author List: // Akbar Mokhtarani originator // <Author2> <originator/contributor etc.> // // Copyright Information: // Copyright (C) 1998 LBNL // //------------------------------------------------------------------------ #ifndef ABSMODULEMEMENTO_HH #define ABSMODULEMEMENTO_HH //------------- // C Headers -- //------------- extern "C" { } //--------------- // C++ Headers -- //--------------- //---------------------- // Base Class Headers -- //---------------------- //------------------------------- // Collaborating Class Headers -- //------------------------------- #include "Framework/AppExecutable.hh" //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ #include <iosfwd> // --------------------- // -- Class Interface -- // --------------------- class AbsModuleMemento { public: // Constructors AbsModuleMemento(AppExecutable* theExec); // Destructor virtual ~AbsModuleMemento( ); // Operators virtual void Dump(std::ostream&)const = 0; virtual void Dump_tcl(std::ostream&)const = 0; const char* name() const { return _theExec->name();} AppExecutable::ExecType exectype() const { return _theExec->execType();} bool isEnabled() const {return _theExec->isEnabled();} AppExecutable* exec() const {return _theExec;} private: // Not implemented. AbsModuleMemento( const AbsModuleMemento& ); AbsModuleMemento& operator=( const AbsModuleMemento& ); AppExecutable* _theExec; }; #endif // ABSMODULEMEMENTO_HH
23.517647
77
0.533267
brownd1978
37c795ef3fe406c28eb7b431d4a48c24d37ab13d
8,415
cc
C++
components/history_clusters/core/clusterer_unittest.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
components/history_clusters/core/clusterer_unittest.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
86
2015-10-21T13:02:42.000Z
2022-03-14T07:50:50.000Z
components/history_clusters/core/clusterer_unittest.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/history_clusters/core/clusterer.h" #include "base/test/task_environment.h" #include "components/history_clusters/core/clustering_test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace history_clusters { namespace { using ::testing::ElementsAre; class ClustererTest : public ::testing::Test { public: void SetUp() override { clusterer_ = std::make_unique<Clusterer>(); } void TearDown() override { clusterer_.reset(); } std::vector<history::Cluster> CreateInitialClustersFromVisits( const std::vector<history::ClusterVisit>& visits) { return clusterer_->CreateInitialClustersFromVisits(visits); } private: std::unique_ptr<Clusterer> clusterer_; base::test::TaskEnvironment task_environment_; }; TEST_F(ClustererTest, ClusterOneVisit) { std::vector<history::ClusterVisit> visits; // Fill in the visits vector with 1 visit. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://google.com/")); visits.push_back(testing::CreateClusterVisit(visit)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0)))); } TEST_F(ClustererTest, ClusterTwoVisitsTiedByReferringVisit) { std::vector<history::ClusterVisit> visits; // Visit2's referrer is visit 1 and are close together. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://google.com/")); visits.push_back(testing::CreateClusterVisit(visit)); history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit(2, GURL("https://google.com/next")); visit2.referring_visit_of_redirect_chain_start = 1; visits.push_back(testing::CreateClusterVisit(visit2)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0)))); } TEST_F(ClustererTest, ClusterTwoVisitsTiedByOpenerVisit) { std::vector<history::ClusterVisit> visits; // Visit2's referrer is visit 1 and are close together. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://google.com/")); visits.push_back(testing::CreateClusterVisit(visit)); history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit(2, GURL("https://google.com/next")); visit2.opener_visit_of_redirect_chain_start = 1; visits.push_back(testing::CreateClusterVisit(visit2)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0)))); } TEST_F(ClustererTest, ClusterTwoVisitsTiedByURL) { std::vector<history::ClusterVisit> visits; // Visit2 has the same URL as Visit1. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://google.com/")); visits.push_back(testing::CreateClusterVisit(visit)); history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit(2, GURL("https://google.com/")); visits.push_back(testing::CreateClusterVisit(visit2)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0)))); } TEST_F(ClustererTest, ClusterTwoVisitsTiedByNormalizedURL) { std::vector<history::ClusterVisit> visits; // Visit2 has the same URL as Visit1. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit( 1, GURL("https://example.com/normalized?q=whatever")); visits.push_back(testing::CreateClusterVisit( visit, GURL("https://example.com/normalized"))); history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit( 2, GURL("https://example.com/normalized")); visits.push_back(testing::CreateClusterVisit(visit2)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0)))); } TEST_F(ClustererTest, MultipleClusters) { std::vector<history::ClusterVisit> visits; // Visit2's referrer is visit 1 and visit 4 is a back navigation from visit 2. // Visit 3 is a different journey altogether. Visit 10 is referring to a // missing visit and should be considered as in its own cluster. // Also, make sure these aren't sorted so we test that we are sorting the // visits by visit ID. history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://github.com/")); visits.push_back(testing::CreateClusterVisit(visit)); history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit(2, GURL("https://google.com/")); visit2.referring_visit_of_redirect_chain_start = 1; // Set the visit duration to be 2x the default so it has the same duration // after |visit| and |visit4| are deduped. visit2.visit_row.visit_duration = base::Seconds(20); visits.push_back(testing::CreateClusterVisit(visit2)); history::AnnotatedVisit visit4 = testing::CreateDefaultAnnotatedVisit(4, GURL("https://github.com/")); visits.push_back(testing::CreateClusterVisit(visit4)); history::AnnotatedVisit visit5 = testing::CreateDefaultAnnotatedVisit( 10, GURL("https://nonexistentreferrer.com/")); visit5.referring_visit_of_redirect_chain_start = 6; visits.push_back(testing::CreateClusterVisit(visit5)); history::AnnotatedVisit visit3 = testing::CreateDefaultAnnotatedVisit(3, GURL("https://whatever.com/")); visits.push_back(testing::CreateClusterVisit(visit3)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0), testing::VisitResult(4, 1.0)), ElementsAre(testing::VisitResult(3, 1.0)), ElementsAre(testing::VisitResult(10, 1.0)))); } TEST_F(ClustererTest, SplitClusterOnNavigationTime) { std::vector<history::ClusterVisit> visits; history::AnnotatedVisit visit = testing::CreateDefaultAnnotatedVisit(1, GURL("https://google.com/")); visit.visit_row.visit_time = base::Time::Now(); visits.push_back(testing::CreateClusterVisit(visit)); // Visit2 has a different URL but is linked by referring id to visit. history::AnnotatedVisit visit2 = testing::CreateDefaultAnnotatedVisit(2, GURL("https://bar.com/")); visit2.referring_visit_of_redirect_chain_start = 1; visit2.visit_row.visit_time = base::Time::Now() + base::Minutes(5); visits.push_back(testing::CreateClusterVisit(visit2)); // Visit3 has a different URL but is linked by referring id to visit but the // cutoff has passed so it should be in a different cluster. history::AnnotatedVisit visit3 = testing::CreateDefaultAnnotatedVisit(3, GURL("https://foo.com/")); visit3.referring_visit_of_redirect_chain_start = 1; visit3.visit_row.visit_time = base::Time::Now() + base::Hours(2); visits.push_back(testing::CreateClusterVisit(visit3)); std::vector<history::Cluster> result_clusters = CreateInitialClustersFromVisits(visits); EXPECT_THAT(testing::ToVisitResults(result_clusters), ElementsAre(ElementsAre(testing::VisitResult(1, 1.0), testing::VisitResult(2, 1.0)), ElementsAre(testing::VisitResult(3, 1.0)))); } } // namespace } // namespace history_clusters
41.658416
80
0.717172
zealoussnow
37c9772c6ca09ef7c9f20fb3a952c0c76bb4f79e
928
cpp
C++
src/classes/socket/ClientTCPSocket.cpp
thibautcornolti/plazza
253b0dd9f76179aa2ef7e98050fcb7c2bc6c4b25
[ "MIT" ]
null
null
null
src/classes/socket/ClientTCPSocket.cpp
thibautcornolti/plazza
253b0dd9f76179aa2ef7e98050fcb7c2bc6c4b25
[ "MIT" ]
null
null
null
src/classes/socket/ClientTCPSocket.cpp
thibautcornolti/plazza
253b0dd9f76179aa2ef7e98050fcb7c2bc6c4b25
[ "MIT" ]
null
null
null
/* ** EPITECH PROJECT, 2018 ** cpp_plazza ** File description: ** ClientTCPSocket */ #include "ClientTCPSocket.hpp" ClientTCPSocket::ClientTCPSocket() : TCPSocket() { } ClientTCPSocket::ClientTCPSocket(const std::string &host, int port) : TCPSocket() { ClientTCPSocket::connect(host, port); } ClientTCPSocket::ClientTCPSocket(int fd) : TCPSocket(fd) { } ClientTCPSocket::~ClientTCPSocket() { close(); } bool ClientTCPSocket::connect(const std::string &host, int port) { struct sockaddr_in addr; struct addrinfo req; struct addrinfo *ret = 0; memset(&req, 0, sizeof(req)); req.ai_family = AF_INET; req.ai_socktype = SOCK_STREAM; if (getaddrinfo(host.c_str(), 0, &req, &ret) != 0 || ret == 0) return false; addr = *(struct sockaddr_in *)ret->ai_addr; addr.sin_port = htons(port); addr.sin_family = AF_INET; if (::connect(_socket, (const sockaddr *)&addr, sizeof(addr)) != 0) return false; return true; }
19.744681
68
0.700431
thibautcornolti
37ca07a23fb9693304bb70cde961086de5536e1d
1,505
cpp
C++
source/plugin/squarexorx4/squarexor.cpp
lostjared/acidcamGL
dbd06c24bfc4a0b1afc137e906f1a9a9cb98a14b
[ "BSD-2-Clause" ]
12
2020-06-29T03:58:26.000Z
2022-01-15T17:03:16.000Z
source/plugin/squarexorx4/squarexor.cpp
lostjared/acidcamGL
dbd06c24bfc4a0b1afc137e906f1a9a9cb98a14b
[ "BSD-2-Clause" ]
1
2020-11-05T01:51:58.000Z
2020-12-14T18:20:54.000Z
source/plugin/squarexorx4/squarexor.cpp
lostjared/acidcamGL
dbd06c24bfc4a0b1afc137e906f1a9a9cb98a14b
[ "BSD-2-Clause" ]
3
2020-02-27T18:27:45.000Z
2021-08-18T01:24:52.000Z
#include"ac.h" #include<cstdlib> #include<ctime> extern "C" void filter(cv::Mat &frame) { static double alpha = 1.0; for(int z = 0; z < frame.rows-4; z += 3) { for(int i = 0; i < frame.cols-4; i += 3) { if(i+1 < frame.cols && z+1 < frame.rows) { cv::Vec3b source = frame.at<cv::Vec3b>(z, i); cv::Vec3b *colors[] = { &frame.at<cv::Vec3b>(z, i), &frame.at<cv::Vec3b>(z, i+1), &frame.at<cv::Vec3b>(z+1, i), &frame.at<cv::Vec3b>(z+1, i+1) }; cv::Vec3b total; for(int q = 0; q < 4; ++q) { for(int j = 0; j < 3; ++j) total[j] += (*colors[q])[j]; } for(int q = 0; q < 4; ++q) { for(int j = 0; j < 3; ++j) { (*colors[q])[j] ^= static_cast<unsigned char>(alpha*total[j]); // (*colors[q])[j] = static_cast<unsigned char>((0.5 * source[j]) + (0.5 * (*colors[q])[j])); } } } static int dir = 1; if(dir == 1) { alpha += 0.05; if(alpha > 25) dir = 0; } else { alpha -= 0.05; if(alpha <= 1.0) dir = 1; } } } }
32.021277
116
0.322259
lostjared