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
aa263159498683f586a3f05cfe17a5aafe8cce9e
1,115
cc
C++
leetcode/Designing_data_structures/implement_queue_using_stacks.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
leetcode/Designing_data_structures/implement_queue_using_stacks.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
leetcode/Designing_data_structures/implement_queue_using_stacks.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
#include <algorithm> #include <array> #include <vector> #include "third_party/gflags/include/gflags.h" #include "third_party/glog/include/logging.h" using std::array; class MyQueue { stack<int> in; stack<int> out; void reload() { while (in.size()) { out.push(in.top()); in.pop(); } } public: /** Initialize your data structure here. */ MyQueue() {} /** Push element x to the back of queue. */ void push(int x) { in.push(x); } /** Removes the element from in front of queue and returns that element. */ int pop() { if (out.size()) { int result = out.top(); out.pop(); return result; } reload(); int result = out.top(); out.pop(); return result; } /** Get the front element. */ int peek() { if (out.size()) return out.top(); reload(); return out.top(); } /** Returns whether the queue is empty. */ bool empty() { return in.size() == 0 && out.size() == 0; } }; int main(int argc, char* argv[]) { google::InitGoogleLogging(argv[0]); gflags::ParseCommandLineFlags(&argc, &argv, false); return 0; }
19.910714
77
0.586547
LIZHICHAOUNICORN
aa2a5424af642cbae6677c247f4dbbf364bfced1
12,260
cpp
C++
src/mongo/db/commands/pipeline_command.cpp
morsvolia/mongo
8cbe89efab77d70ac653d20b693cffe15a47acea
[ "Apache-2.0" ]
324
2015-01-01T14:56:10.000Z
2022-03-08T04:52:37.000Z
src/mongo/db/commands/pipeline_command.cpp
morsvolia/mongo
8cbe89efab77d70ac653d20b693cffe15a47acea
[ "Apache-2.0" ]
38
2015-01-31T03:57:16.000Z
2019-04-21T03:30:53.000Z
src/mongo/db/commands/pipeline_command.cpp
morsvolia/mongo
8cbe89efab77d70ac653d20b693cffe15a47acea
[ "Apache-2.0" ]
60
2015-01-14T14:19:41.000Z
2021-02-10T21:54:12.000Z
/** * Copyright (c) 2011 10gen Inc. * Copyright (C) 2013 Tokutek Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "mongo/pch.h" #include <vector> #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/privilege.h" #include "mongo/db/commands.h" #include "mongo/db/command_cursors.h" #include "mongo/db/namespacestring.h" #include "mongo/db/interrupt_status_mongod.h" #include "mongo/db/pipeline/accumulator.h" #include "mongo/db/pipeline/document.h" #include "mongo/db/pipeline/document_source.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/expression.h" #include "mongo/db/pipeline/pipeline_d.h" #include "mongo/db/pipeline/pipeline.h" #include "mongo/db/ops/query.h" namespace mongo { extern const int MaxBytesToReturnToClientAtOnce; class PipelineCursor : public Cursor { public: PipelineCursor(intrusive_ptr<Pipeline> pipeline) : _pipeline(pipeline) {} // "core" cursor protocol virtual bool ok() { return !iterator()->eof(); } virtual bool advance() { return iterator()->advance(); } virtual BSONObj current() { BSONObjBuilder builder; iterator()->getCurrent().toBson(&builder); return builder.obj(); } virtual bool shouldDestroyOnNSDeletion() { return false; } virtual bool getsetdup(const BSONObj &pk) { return false; } // we don't generate dups virtual bool isMultiKey() const { return false; } virtual bool modifiedKeys() const { return false; } virtual string toString() const { return "Aggregate_Cursor"; } // These probably won't be needed once aggregation supports it's own explain. virtual long long nscanned() const { return 0; } virtual void explainDetails( BSONObjBuilder& b ) const { return; } private: const DocumentSource* iterator() const { return _pipeline->output(); } DocumentSource* iterator() { return _pipeline->output(); } intrusive_ptr<Pipeline> _pipeline; }; class PipelineCommand : public Command { public: // virtuals from Command virtual ~PipelineCommand(); virtual bool run(const string &db, BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl); virtual LockType locktype() const; // can't know if you're going to do a write op yet, you just shouldn't do aggregate on a SyncClusterConnection virtual bool requiresSync() const { return true; } virtual bool needsTxn() const { return false; } virtual int txnFlags() const { return noTxnFlags(); } virtual bool canRunInMultiStmtTxn() const { return true; } virtual OpSettings getOpSettings() const { return OpSettings().setBulkFetch(true); } virtual bool slaveOk() const; // aggregate is like a query, we don't need to hold this lock virtual bool requiresShardedOperationScope() const { return false; } virtual void help(stringstream &help) const; virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out); PipelineCommand(); private: /* For the case of explain, we don't want to hold any lock at all, because it generates warnings about recursive locks. However, the getting the explain information for the underlying cursor uses the direct client cursor, and that gets a lock. Therefore, we need to take steps to avoid holding a lock while we use that. On the other hand, we need to have a READ lock for normal explain execution. Therefore, the lock is managed manually, and not through the virtual locktype() above. In order to achieve this, locktype() returns NONE, but the lock that would be managed for reading (for executing the pipeline in the regular way), will be managed manually here. This code came from dbcommands.cpp, where objects are constructed to hold the lock and automatically release it on destruction. The use of this pattern requires extra functions to hold the lock scope and from within which to execute the other steps of the explain. The arguments for these are all the same, and come from run(), but are passed in so that new blocks can be created to hold the automatic locking objects. */ /* Execute the pipeline for the explain. This is common to both the locked and unlocked code path. However, the results are different. For an explain, with no lock, it really outputs the pipeline chain rather than fetching the data. */ bool executeSplitPipeline( BSONObjBuilder& result, string& errmsg, const string& ns, const string& db, intrusive_ptr<Pipeline>& pPipeline, intrusive_ptr<ExpressionContext>& pCtx); }; // self-registering singleton static instance static PipelineCommand pipelineCommand; PipelineCommand::PipelineCommand(): Command(Pipeline::commandName) { } Command::LockType PipelineCommand::locktype() const { // Locks are managed manually, in particular by DocumentSourceCursor. return OPLOCK; } bool PipelineCommand::slaveOk() const { return true; } void PipelineCommand::help(stringstream &help) const { help << "{ pipeline : [ { <data-pipe-op>: {...}}, ... ] }"; } void PipelineCommand::addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) { ActionSet actions; actions.addAction(ActionType::find); out->push_back(Privilege(parseNs(dbname, cmdObj), actions)); } PipelineCommand::~PipelineCommand() { } bool PipelineCommand::executeSplitPipeline( BSONObjBuilder& result, string& errmsg, const string& ns, const string& db, intrusive_ptr<Pipeline>& pPipeline, intrusive_ptr<ExpressionContext>& pCtx) { /* setup as if we're in the router */ pCtx->setInRouter(true); /* Here, we'll split the pipeline in the same way we would for sharding, for testing purposes. Run the shard pipeline first, then feed the results into the remains of the existing pipeline. Start by splitting the pipeline. */ intrusive_ptr<Pipeline> pShardSplit( pPipeline->splitForSharded()); /* Write the split pipeline as we would in order to transmit it to the shard servers. */ BSONObjBuilder shardBuilder; pShardSplit->toBson(&shardBuilder); BSONObj shardBson(shardBuilder.done()); DEV (log() << "\n---- shardBson\n" << shardBson.jsonString(Strict, 1) << "\n----\n").flush(); /* for debugging purposes, show what the pipeline now looks like */ DEV { BSONObjBuilder pipelineBuilder; pPipeline->toBson(&pipelineBuilder); BSONObj pipelineBson(pipelineBuilder.done()); (log() << "\n---- pipelineBson\n" << pipelineBson.jsonString(Strict, 1) << "\n----\n").flush(); } /* on the shard servers, create the local pipeline */ intrusive_ptr<ExpressionContext> pShardCtx( ExpressionContext::create(&InterruptStatusMongod::status)); intrusive_ptr<Pipeline> pShardPipeline( Pipeline::parseCommand(errmsg, shardBson, pShardCtx)); if (!pShardPipeline.get()) { return false; } PipelineD::prepareCursorSource(pShardPipeline, nsToDatabase(ns), pCtx); /* run the shard pipeline */ BSONObjBuilder shardResultBuilder; string shardErrmsg; pShardPipeline->stitch(); pShardPipeline->run(shardResultBuilder); BSONObj shardResult(shardResultBuilder.done()); /* pick out the shard result, and prepare to read it */ intrusive_ptr<DocumentSourceBsonArray> pShardSource; BSONObjIterator shardIter(shardResult); while(shardIter.more()) { BSONElement shardElement(shardIter.next()); const char *pFieldName = shardElement.fieldName(); if ((strcmp(pFieldName, "result") == 0) || (strcmp(pFieldName, "serverPipeline") == 0)) { pPipeline->addInitialSource(DocumentSourceBsonArray::create(&shardElement, pCtx)); pPipeline->stitch(); /* Connect the output of the shard pipeline with the mongos pipeline that will merge the results. */ pPipeline->run(result); return true; } } /* NOTREACHED */ verify(false); return false; } bool PipelineCommand::run(const string &db, BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl) { intrusive_ptr<ExpressionContext> pCtx( ExpressionContext::create(&InterruptStatusMongod::status)); /* try to parse the command; if this fails, then we didn't run */ intrusive_ptr<Pipeline> pPipeline( Pipeline::parseCommand(errmsg, cmdObj, pCtx)); if (!pPipeline.get()) return false; string ns(parseNs(db, cmdObj)); if (pPipeline->getSplitMongodPipeline()) { // This is only used in testing return executeSplitPipeline(result, errmsg, ns, db, pPipeline, pCtx); } #if _DEBUG // This is outside of the if block to keep the object alive until the pipeline is finished. BSONObj parsed; if (!pPipeline->isExplain() && !pCtx->getInShard()) { // Make sure all operations round-trip through Pipeline::toBson() // correctly by reparsing every command on DEBUG builds. This is // important because sharded aggregations rely on this ability. // Skipping when inShard because this has already been through the // transformation (and this unsets pCtx->inShard). BSONObjBuilder bb; pPipeline->toBson(&bb); parsed = bb.obj(); pPipeline = Pipeline::parseCommand(errmsg, parsed, pCtx); verify(pPipeline); } #endif // This does the mongod-specific stuff like creating a cursor PipelineD::prepareCursorSource(pPipeline, nsToDatabase(ns), pCtx); pPipeline->stitch(); if (isCursorCommand(cmdObj)) { CursorId id; { // Set up cursor LOCK_REASON(lockReason, "aggregate: creating aggregation cursor"); Client::ReadContext ctx(ns, lockReason); shared_ptr<Cursor> cursor(new PipelineCursor(pPipeline)); // cc will be owned by cursor manager ClientCursor* cc = new ClientCursor(0, cursor, ns, cmdObj.getOwned()); id = cc->cursorid(); } handleCursorCommand(id, cmdObj, result); } else { pPipeline->run(result); } return true; } } // namespace mongo
39.044586
118
0.619657
morsvolia
aa2a5831bef0ad1fa0f5274226548f00538d501f
5,936
cpp
C++
Cpp14/IO/Epoll_main.cpp
ernestyalumni/HrdwCCppCUDA
17ed937dea06431a4d5ca103f993ea69a6918734
[ "MIT" ]
1
2018-02-09T19:44:51.000Z
2018-02-09T19:44:51.000Z
Cpp14/IO/Epoll_main.cpp
ernestyalumni/HrdwCCppCUDA
17ed937dea06431a4d5ca103f993ea69a6918734
[ "MIT" ]
null
null
null
Cpp14/IO/Epoll_main.cpp
ernestyalumni/HrdwCCppCUDA
17ed937dea06431a4d5ca103f993ea69a6918734
[ "MIT" ]
null
null
null
//------------------------------------------------------------------------------ /// \file Epoll_main.cpp /// \author Ernest Yeung /// \email ernestyalumni@gmail.com /// \brief epoll as RAII main driver file. /// \ref http://man7.org/linux/man-pages/man2/epoll_create.2.html /// \details Using RAII for epoll instance. /// \copyright If you find this code useful, feel free to donate directly and easily at /// this direct PayPal link: /// /// https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ernestsaveschristmas%2bpaypal%40gmail%2ecom&lc=US&item_name=ernestyalumni&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted /// /// which won't go through a 3rd. party such as indiegogo, kickstarter, patreon. /// Otherwise, I receive emails and messages on how all my (free) material on /// physics, math, and engineering have helped students with their studies, and /// I know what it's like to not have money as a student, but love physics (or /// math, sciences, etc.), so I am committed to keeping all my material /// open-source and free, whether or not sufficiently crowdfunded, under the /// open-source MIT license: feel free to copy, edit, paste, make your own /// versions, share, use as you wish. /// Peace out, never give up! -EY //------------------------------------------------------------------------------ /// COMPILATION TIPS: /// g++ -std=c++14 Epoll_main.cpp -o Epoll_main //------------------------------------------------------------------------------ #include "Epoll.h" #include "../Utilities/casts.h" // get_underlying #include <iostream> #include <sys/epoll.h> using IO::ControlOperations; using IO::Epoll; using IO::EpollEvent; using IO::EpollFlags; using IO::EventTypes; using Utilities::get_underlying_value; template <EpollFlags EpollFlag = EpollFlags::default_value> class TestableEpoll : public Epoll<EpollFlag> { public: // Inherit default ctor using Epoll<EpollFlag>::Epoll; using Epoll<EpollFlag>::add_fd; using Epoll<EpollFlag>::fd; }; int main() { // EpollFlags { std::cout << "\n EpollFlags \n"; std::cout << " EpollFlags::default_value : " << static_cast<int>(EpollFlags::default_value) << '\n'; // 0 std::cout << " EpollFlags::close_on_execute : " << static_cast<int>(EpollFlags::close_on_execute) << '\n'; // 524288 } // ControlOperations { std::cout << "\n ControlOperations \n"; std::cout << " ControlOperations::add : " << static_cast<int>(ControlOperations::add) << '\n'; // 1 std::cout << " ControlOperations::modify : " << static_cast<int>(ControlOperations::modify) << '\n'; // 3 std::cout << " ControlOperations::remove : " << static_cast<int>(ControlOperations::remove) << '\n'; // 2 } // EventTypes { std::cout << "\n EventTypes \n"; std::cout << " EventTypes::default_value : " << static_cast<int>(EventTypes::default_value) << '\n'; // 0 std::cout << " EventTypes::read : " << static_cast<int>(EventTypes::read) << '\n'; // 1 std::cout << " EventTypes::write : " << static_cast<int>(EventTypes::write) << '\n'; // 4 std::cout << " EventTypes::stream_or_half_hangup : " << static_cast<int>(EventTypes::stream_or_half_hangup) << '\n'; // 8192 std::cout << " EventTypes::exceptional : " << static_cast<int>(EventTypes::exceptional) << '\n'; // 2 std::cout << " EventTypes::error : " << static_cast<int>(EventTypes::error) << '\n'; // 8 std::cout << " EventTypes::hangup : " << static_cast<int>(EventTypes::hangup) << '\n'; // 16 std::cout << " EventTypes::edge_triggered : " << static_cast<int>(EventTypes::edge_triggered) << '\n'; // -2147483648 std::cout << " EventTypes::one_shot : " << static_cast<int>(EventTypes::one_shot) << '\n'; // 1073741824 std::cout << " EventTypes::wakeup : " << static_cast<int>(EventTypes::wakeup) << '\n'; // 536870912 std::cout << " EventTypes::exclusive : " << static_cast<int>(EventTypes::exclusive) << '\n'; // 268435456 } // EpollEventConstructs { std::cout << "\n EpollEventConstructs \n"; const EpollEvent epoll_event { get_underlying_value<EventTypes>(EventTypes::default_value), 5}; std::cout << " epoll_event : " << epoll_event << '\n'; // const EpollEvent<get_underlying_value<EventTypes>(EventTypes::read)> // WORKS // static_cast<std::underlying_type_t<EventTypes>>(EventTypes::read)> const EpollEvent epoll_event_1 {EventTypes::read, 5}; std::cout << " epoll_event_1 : " << epoll_event_1 << '\n'; const EpollEvent epoll_event_2 { get_underlying_value<EventTypes>(EventTypes::read) || get_underlying_value<EventTypes>(EventTypes::edge_triggered), 5}; std::cout << " epoll_event_2 : " << epoll_event_2 << '\n'; } std::cout << get_underlying_value<EventTypes>(EventTypes::read) << '\n'; std::cout << get_underlying_value<EventTypes>(EventTypes::edge_triggered) << '\n'; std::cout << (get_underlying_value<EventTypes>(EventTypes::read) || get_underlying_value<EventTypes>(EventTypes::edge_triggered)) << '\n'; std::cout << (get_underlying_value<EventTypes>(EventTypes::write) || get_underlying_value<EventTypes>(EventTypes::exclusive)) << '\n'; std::cout << " EPOLLIN : " << EPOLLIN << '\n'; std::cout << " EPOLLOUT : " << EPOLLOUT << '\n'; std::cout << " EPOLLET : " << EPOLLET << '\n'; std::cout << " EPOLLEXCLUSIVE : " << EPOLLEXCLUSIVE << '\n'; std::cout << (EPOLLIN || EPOLLET) << '\n'; std::cout << (EPOLLOUT || EPOLLEXCLUSIVE) << '\n'; // EpollDefaultConstructs { std::cout << " \n EpollDefaultConstructs \n"; const Epoll<> epoll; const TestableEpoll<> test_epoll; std::cout << " test_epoll.fd() : " << test_epoll.fd() << '\n'; } // AddFdAddsFdIntoEpollSet { std::cout << "\n AddFdAddsFdIntoEpollSet \n"; } }
37.56962
214
0.617419
ernestyalumni
aa2c65c36843ad34cde6e738b55267fc856cd3e4
2,232
cpp
C++
compute/perf/perf_host_sort.cpp
atksh/mimalloc-lgb
add692a5ef9a91cad0bc78fa18a051d43a8c930e
[ "MIT" ]
null
null
null
compute/perf/perf_host_sort.cpp
atksh/mimalloc-lgb
add692a5ef9a91cad0bc78fa18a051d43a8c930e
[ "MIT" ]
null
null
null
compute/perf/perf_host_sort.cpp
atksh/mimalloc-lgb
add692a5ef9a91cad0bc78fa18a051d43a8c930e
[ "MIT" ]
null
null
null
//---------------------------------------------------------------------------// // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com> // // 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 // // See http://boostorg.github.com/compute for more information. //---------------------------------------------------------------------------// #include <algorithm> #include <iostream> #include <vector> #include <mimalloc.h> #include <boost/timer/timer.hpp> #include <boost/compute/system.hpp> #include <boost/compute/command_queue.hpp> #include <boost/compute/algorithm/sort.hpp> #include <boost/compute/container/vector.hpp> #include "perf.hpp" int main(int argc, char *argv[]) { perf_parse_args(argc, argv); std::cout << "size: " << PERF_N << std::endl; // setup context and queue for the default device boost::compute::device device = boost::compute::system::default_device(); boost::compute::context context(device); boost::compute::command_queue queue(context, device); std::cout << "device: " << device.name() << std::endl; // create vector of random numbers on the host std::vector<int, mi_stl_allocator<int>> random_vector(PERF_N); std::generate(random_vector.begin(), random_vector.end(), rand); // create input vector for gpu std::vector<int, mi_stl_allocator<int>> gpu_vector = random_vector; // sort vector on gpu boost::timer::cpu_timer t; boost::compute::sort( gpu_vector.begin(), gpu_vector.end(), queue); queue.finish(); std::cout << "time: " << t.elapsed().wall / 1e6 << " ms" << std::endl; // create input vector for host std::vector<int, mi_stl_allocator<int>> host_vector = random_vector; // sort vector on host t.start(); std::sort(host_vector.begin(), host_vector.end()); std::cout << "host time: " << t.elapsed().wall / 1e6 << " ms" << std::endl; // ensure that both sorted vectors are equal if (!std::equal(gpu_vector.begin(), gpu_vector.end(), host_vector.begin())) { std::cerr << "ERROR: sorted vectors not the same" << std::endl; return -1; } return 0; }
33.313433
79
0.616935
atksh
a8f7d1a77b271ec8e555251fbf18029debded219
1,330
hpp
C++
engine/src/events/InputEvents.hpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-01T20:22:41.000Z
2021-11-01T20:22:41.000Z
engine/src/events/InputEvents.hpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-02T12:45:20.000Z
2021-11-02T12:45:20.000Z
engine/src/events/InputEvents.hpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-02T12:28:58.000Z
2021-11-02T12:28:58.000Z
#pragma once #include "events/Event.hpp" namespace Birdy3d::events { class InputScrollEvent : public Event { public: const double xoffset; const double yoffset; InputScrollEvent(double xoffset, double yoffset) : xoffset(xoffset) , yoffset(yoffset) { } }; class InputClickEvent : public Event { public: const int button; const int action; const int mods; InputClickEvent(int button, int action, int mods) : button(button) , action(action) , mods(mods) { } }; class InputKeyEvent : public Event { public: const int key; const int scancode; const int action; const int mods; InputKeyEvent(int key, int scancode, int action, int mods) : key(key) , scancode(scancode) , action(action) , mods(mods) { } bool check_options(std::any options) override { int key_option = std::any_cast<int>(options); return key_option == key && action == 1; // GLFW_PRESS } }; class InputCharEvent : public Event { public: const unsigned int codepoint; InputCharEvent(unsigned int codepoint) : codepoint(codepoint) { } }; }
23.333333
66
0.558647
Birdy2014
a8f91bc2cb2c0d7ad83b7d619f728dee4f4c8b0a
1,796
cpp
C++
src/crypto/arc4.cpp
Iglu47/innoextract
660546ad796bb7619ff0e99a6cd61c4e01e4e241
[ "Zlib" ]
526
2015-01-01T17:52:24.000Z
2022-03-30T10:16:25.000Z
src/crypto/arc4.cpp
Iglu47/innoextract
660546ad796bb7619ff0e99a6cd61c4e01e4e241
[ "Zlib" ]
104
2015-01-01T11:48:51.000Z
2022-03-11T17:25:58.000Z
src/crypto/arc4.cpp
Iglu47/innoextract
660546ad796bb7619ff0e99a6cd61c4e01e4e241
[ "Zlib" ]
83
2015-02-10T15:51:37.000Z
2022-03-08T13:11:12.000Z
/* * Copyright (C) 2018 Daniel Scharrer * * This software is provided 'as-is', without any express or implied * warranty. In no event will the author(s) be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #include "crypto/arc4.hpp" #include <algorithm> #include "util/endian.hpp" namespace crypto { void arc4::init(const char * key, size_t length) { a = b = 0; for(size_t i = 0; i < sizeof(state); i++){ state[i] = boost::uint8_t(i); } size_t j = 0; for(size_t i = 0; i < sizeof(state); i++) { j = (j + state[i] + boost::uint8_t(key[i % length])) % sizeof(state); std::swap(state[i], state[j]); } } void arc4::update() { a = (a + 1) % sizeof(state); b = (b + state[a]) % sizeof(state); std::swap(state[a], state[b]); } void arc4::discard(size_t length) { for(size_t i = 0; i < length; i++) { update(); } } void arc4::crypt(const char * in, char * out, size_t length) { for(size_t i = 0; i < length; i++) { update(); out[i] = char(state[size_t(state[a] + state[b]) % sizeof(state)] ^ boost::uint8_t(in[i])); } } } // namespace crypto
24.944444
92
0.658686
Iglu47
a8fbd745d619170515a02709c40b52df78188eda
2,962
cpp
C++
src_vc141/utils/BadWordFilter.cpp
nneesshh/mytoolkit
336ae9c7077c8687a8cf8a2ce4aec804c28ab90c
[ "Apache-2.0" ]
null
null
null
src_vc141/utils/BadWordFilter.cpp
nneesshh/mytoolkit
336ae9c7077c8687a8cf8a2ce4aec804c28ab90c
[ "Apache-2.0" ]
null
null
null
src_vc141/utils/BadWordFilter.cpp
nneesshh/mytoolkit
336ae9c7077c8687a8cf8a2ce4aec804c28ab90c
[ "Apache-2.0" ]
2
2020-11-04T03:07:09.000Z
2020-11-05T08:14:45.000Z
//------------------------------------------------------------------------------ // BadWordFilter.cpp // (C) 2016 n.lee //------------------------------------------------------------------------------ #include "BadWordFilter.h" #include "CharCode.h" wchar_t * wreplace(wchar_t *buffer, const wchar_t *dirty, const wchar_t ch) { int len = wcslen(dirty); wchar_t *p = buffer; int i; while (nullptr != (p = wcsstr(p, dirty))) { for (i = 0; i < len; ++i) { *p++ = L'*'; } } return buffer; } //------------------------------------------------------------------------------ /** */ CBadWordFilter::CBadWordFilter() { } //------------------------------------------------------------------------------ /** */ CBadWordFilter::~CBadWordFilter() { } //------------------------------------------------------------------------------ /** */ void CBadWordFilter::LoadFromFile(const char *sFile) { char chLine[1024]; // FILE *fp = fopen(sFile, "r"); if (fp) { while (nullptr != fgets(chLine, sizeof(chLine), fp)) { // remove tail '\r' and '\n' int nIndex = strlen(chLine); while (--nIndex > 0) { if ('\r' != chLine[nIndex] && '\n' != chLine[nIndex]) { break; } chLine[nIndex] = '\0'; } // if (nIndex > 0) { AddWord(chLine); } } fclose(fp); } } //------------------------------------------------------------------------------ /** */ void CBadWordFilter::OnFilter(char *sInput) { int nLen = CCharCode::Gb2312ToUnicode(_wbuffer, 1024, sInput, strlen(sInput)); bool bFiltered = false; int i; std::vector<std::wstring > *v; tWcharKeyMap::iterator itBadWord; for (i = 0; i < nLen; ++i) { // if (L'*' == *(_wbuffer + i) || L' ' == *(_wbuffer + i) || L'\t' == *(_wbuffer + i) || L'\0' == *(_wbuffer + i)) continue; // itBadWord = _mapBadKey.find(*(_wbuffer + i)); if (itBadWord == _mapBadKey.end()) continue; // v = &(itBadWord->second); for (auto& it : (*v)) { wreplace(_wbuffer, it.c_str(), L'*'); bFiltered = true; } } // CCharCode::UnicodeToGB2312(sInput, strlen(sInput), _wbuffer, nLen); } //------------------------------------------------------------------------------ /** */ void CBadWordFilter::AddWord(const char *sWord) { wchar_t chBuffer[1024] = { 0 }; int nLen = CCharCode::Gb2312ToUnicode(chBuffer, 1024, sWord, strlen(sWord)); _badWordList.push_back(chBuffer); int i; std::vector<std::wstring> *v; wchar_t *p = chBuffer; for (i = 0; i < nLen; ++i) { if (L'*' == *(p + i) || L' ' == *(p + i) || L'\t' == *(p + i) || L'\0' == *(p + i)) continue; v = &_mapBadKey[*(p + i)]; std::vector<std::wstring>::iterator it = v->begin(), itEnd = v->end(); while (it != itEnd) { if ((*it) == chBuffer) { v->erase(it); break; } ++it; } v->push_back(chBuffer); } } /* -- EOF -- */
21.779412
114
0.422687
nneesshh
a8fce2a00b2b29a6e74ad3a33d412aa1e6183b19
1,159
hh
C++
src/main/c++/novemberizing/io/reactor.hh
iticworld/reactive-lib
9ab761376776e759390fa417d50921ec6e8a898a
[ "Apache-2.0" ]
1
2020-10-10T11:57:15.000Z
2020-10-10T11:57:15.000Z
src/main/c++/novemberizing/io/reactor.hh
iticworld/reactive-lib
9ab761376776e759390fa417d50921ec6e8a898a
[ "Apache-2.0" ]
null
null
null
src/main/c++/novemberizing/io/reactor.hh
iticworld/reactive-lib
9ab761376776e759390fa417d50921ec6e8a898a
[ "Apache-2.0" ]
null
null
null
#ifndef __NOVEMBERIZING_IO__REACTOR__HH__ #define __NOVEMBERIZING_IO__REACTOR__HH__ #include <sys/epoll.h> #include <unistd.h> #include <novemberizing/util/log.hh> #include <novemberizing/ds.hh> #include <novemberizing/ds/cyclable.hh> #include <novemberizing/ds/concurrent.set.hh> #include <novemberizing/io.hh> #include <novemberizing/io/descriptor.hh> namespace novemberizing { namespace io { using namespace util; using namespace ds; class Reactor : public Cyclable { public: static const int DefaultDescriptorSize = 1024; public: static const int DefaultTimeout = 10; private: ConcurrentSet<Descriptor *> __descriptors; private: int __descriptor; private: int __max; private: int __reserved; private: int __timeout; private: struct epoll_event * __events; public: virtual int add(Descriptor * descriptor); public: virtual int del(Descriptor * descriptor); public: virtual int mod(Descriptor * descriptor); public: virtual void onecycle(void); private: virtual void initialize(void); public: Reactor(void); public: virtual ~Reactor(void); }; } } #endif // __NOVEMBERIZING_IO__REACTOR__HH__
26.953488
58
0.750647
iticworld
d1040b84fed60a0e8b316471642290367566cee9
387,371
cpp
C++
old/bna1/res/md5revert_main.cpp
sea-kg/reversehash
77bd44f589cd38dff7bd4b97963134ae27a16a95
[ "MIT" ]
null
null
null
old/bna1/res/md5revert_main.cpp
sea-kg/reversehash
77bd44f589cd38dff7bd4b97963134ae27a16a95
[ "MIT" ]
4
2016-05-30T18:37:26.000Z
2017-02-18T06:59:24.000Z
old/bna1/res/md5revert_main.cpp
sea-kg/bna
f2f228b3cd03be0719a850648c6c67a529453669
[ "MIT" ]
null
null
null
#include <iostream> #include <QString> #include <QVector> #include <QDebug> #include <QCryptographicHash> #include <QCoreApplication> #include "md5revert_helpers.h" #include "0/0/0/000.h" #include "0/0/1/001.h" #include "0/0/2/002.h" #include "0/0/3/003.h" #include "0/0/4/004.h" #include "0/0/5/005.h" #include "0/0/6/006.h" #include "0/0/7/007.h" #include "0/0/8/008.h" #include "0/0/9/009.h" #include "0/1/0/010.h" #include "0/1/1/011.h" #include "0/1/2/012.h" #include "0/1/3/013.h" #include "0/1/4/014.h" #include "0/1/5/015.h" #include "0/1/6/016.h" #include "0/1/7/017.h" #include "0/1/8/018.h" #include "0/1/9/019.h" #include "0/2/0/020.h" #include "0/2/1/021.h" #include "0/2/2/022.h" #include "0/2/3/023.h" #include "0/2/4/024.h" #include "0/2/5/025.h" #include "0/2/6/026.h" #include "0/2/7/027.h" #include "0/2/8/028.h" #include "0/2/9/029.h" #include "0/3/0/030.h" #include "0/3/1/031.h" #include "0/3/2/032.h" #include "0/3/3/033.h" #include "0/3/4/034.h" #include "0/3/5/035.h" #include "0/3/6/036.h" #include "0/3/7/037.h" #include "0/3/8/038.h" #include "0/3/9/039.h" #include "0/4/0/040.h" #include "0/4/1/041.h" #include "0/4/2/042.h" #include "0/4/3/043.h" #include "0/4/4/044.h" #include "0/4/5/045.h" #include "0/4/6/046.h" #include "0/4/7/047.h" #include "0/4/8/048.h" #include "0/4/9/049.h" #include "0/5/0/050.h" #include "0/5/1/051.h" #include "0/5/2/052.h" #include "0/5/3/053.h" #include "0/5/4/054.h" #include "0/5/5/055.h" #include "0/5/6/056.h" #include "0/5/7/057.h" #include "0/5/8/058.h" #include "0/5/9/059.h" #include "0/6/0/060.h" #include "0/6/1/061.h" #include "0/6/2/062.h" #include "0/6/3/063.h" #include "0/6/4/064.h" #include "0/6/5/065.h" #include "0/6/6/066.h" #include "0/6/7/067.h" #include "0/6/8/068.h" #include "0/6/9/069.h" #include "0/7/0/070.h" #include "0/7/1/071.h" #include "0/7/2/072.h" #include "0/7/3/073.h" #include "0/7/4/074.h" #include "0/7/5/075.h" #include "0/7/6/076.h" #include "0/7/7/077.h" #include "0/7/8/078.h" #include "0/7/9/079.h" #include "0/8/0/080.h" #include "0/8/1/081.h" #include "0/8/2/082.h" #include "0/8/3/083.h" #include "0/8/4/084.h" #include "0/8/5/085.h" #include "0/8/6/086.h" #include "0/8/7/087.h" #include "0/8/8/088.h" #include "0/8/9/089.h" #include "0/9/0/090.h" #include "0/9/1/091.h" #include "0/9/2/092.h" #include "0/9/3/093.h" #include "0/9/4/094.h" #include "0/9/5/095.h" #include "0/9/6/096.h" #include "0/9/7/097.h" #include "0/9/8/098.h" #include "0/9/9/099.h" #include "1/0/0/100.h" #include "1/0/1/101.h" #include "1/0/2/102.h" #include "1/0/3/103.h" #include "1/0/4/104.h" #include "1/0/5/105.h" #include "1/0/6/106.h" #include "1/0/7/107.h" #include "1/0/8/108.h" #include "1/0/9/109.h" #include "1/1/0/110.h" #include "1/1/1/111.h" #include "1/1/2/112.h" #include "1/1/3/113.h" #include "1/1/4/114.h" #include "1/1/5/115.h" #include "1/1/6/116.h" #include "1/1/7/117.h" #include "1/1/8/118.h" #include "1/1/9/119.h" #include "1/2/0/120.h" #include "1/2/1/121.h" #include "1/2/2/122.h" #include "1/2/3/123.h" #include "1/2/4/124.h" #include "1/2/5/125.h" #include "1/2/6/126.h" #include "1/2/7/127.h" #include "1/2/8/128.h" #include "1/2/9/129.h" #include "1/3/0/130.h" #include "1/3/1/131.h" #include "1/3/2/132.h" #include "1/3/3/133.h" #include "1/3/4/134.h" #include "1/3/5/135.h" #include "1/3/6/136.h" #include "1/3/7/137.h" #include "1/3/8/138.h" #include "1/3/9/139.h" #include "1/4/0/140.h" #include "1/4/1/141.h" #include "1/4/2/142.h" #include "1/4/3/143.h" #include "1/4/4/144.h" #include "1/4/5/145.h" #include "1/4/6/146.h" #include "1/4/7/147.h" #include "1/4/8/148.h" #include "1/4/9/149.h" #include "1/5/0/150.h" #include "1/5/1/151.h" #include "1/5/2/152.h" #include "1/5/3/153.h" #include "1/5/4/154.h" #include "1/5/5/155.h" #include "1/5/6/156.h" #include "1/5/7/157.h" #include "1/5/8/158.h" #include "1/5/9/159.h" #include "1/6/0/160.h" #include "1/6/1/161.h" #include "1/6/2/162.h" #include "1/6/3/163.h" #include "1/6/4/164.h" #include "1/6/5/165.h" #include "1/6/6/166.h" #include "1/6/7/167.h" #include "1/6/8/168.h" #include "1/6/9/169.h" #include "1/7/0/170.h" #include "1/7/1/171.h" #include "1/7/2/172.h" #include "1/7/3/173.h" #include "1/7/4/174.h" #include "1/7/5/175.h" #include "1/7/6/176.h" #include "1/7/7/177.h" #include "1/7/8/178.h" #include "1/7/9/179.h" #include "1/8/0/180.h" #include "1/8/1/181.h" #include "1/8/2/182.h" #include "1/8/3/183.h" #include "1/8/4/184.h" #include "1/8/5/185.h" #include "1/8/6/186.h" #include "1/8/7/187.h" #include "1/8/8/188.h" #include "1/8/9/189.h" #include "1/9/0/190.h" #include "1/9/1/191.h" #include "1/9/2/192.h" #include "1/9/3/193.h" #include "1/9/4/194.h" #include "1/9/5/195.h" #include "1/9/6/196.h" #include "1/9/7/197.h" #include "1/9/8/198.h" #include "1/9/9/199.h" #include "2/0/0/200.h" #include "2/0/1/201.h" #include "2/0/2/202.h" #include "2/0/3/203.h" #include "2/0/4/204.h" #include "2/0/5/205.h" #include "2/0/6/206.h" #include "2/0/7/207.h" #include "2/0/8/208.h" #include "2/0/9/209.h" #include "2/1/0/210.h" #include "2/1/1/211.h" #include "2/1/2/212.h" #include "2/1/3/213.h" #include "2/1/4/214.h" #include "2/1/5/215.h" #include "2/1/6/216.h" #include "2/1/7/217.h" #include "2/1/8/218.h" #include "2/1/9/219.h" #include "2/2/0/220.h" #include "2/2/1/221.h" #include "2/2/2/222.h" #include "2/2/3/223.h" #include "2/2/4/224.h" #include "2/2/5/225.h" #include "2/2/6/226.h" #include "2/2/7/227.h" #include "2/2/8/228.h" #include "2/2/9/229.h" #include "2/3/0/230.h" #include "2/3/1/231.h" #include "2/3/2/232.h" #include "2/3/3/233.h" #include "2/3/4/234.h" #include "2/3/5/235.h" #include "2/3/6/236.h" #include "2/3/7/237.h" #include "2/3/8/238.h" #include "2/3/9/239.h" #include "2/4/0/240.h" #include "2/4/1/241.h" #include "2/4/2/242.h" #include "2/4/3/243.h" #include "2/4/4/244.h" #include "2/4/5/245.h" #include "2/4/6/246.h" #include "2/4/7/247.h" #include "2/4/8/248.h" #include "2/4/9/249.h" #include "2/5/0/250.h" #include "2/5/1/251.h" #include "2/5/2/252.h" #include "2/5/3/253.h" #include "2/5/4/254.h" #include "2/5/5/255.h" #include "2/5/6/256.h" #include "2/5/7/257.h" #include "2/5/8/258.h" #include "2/5/9/259.h" #include "2/6/0/260.h" #include "2/6/1/261.h" #include "2/6/2/262.h" #include "2/6/3/263.h" #include "2/6/4/264.h" #include "2/6/5/265.h" #include "2/6/6/266.h" #include "2/6/7/267.h" #include "2/6/8/268.h" #include "2/6/9/269.h" #include "2/7/0/270.h" #include "2/7/1/271.h" #include "2/7/2/272.h" #include "2/7/3/273.h" #include "2/7/4/274.h" #include "2/7/5/275.h" #include "2/7/6/276.h" #include "2/7/7/277.h" #include "2/7/8/278.h" #include "2/7/9/279.h" #include "2/8/0/280.h" #include "2/8/1/281.h" #include "2/8/2/282.h" #include "2/8/3/283.h" #include "2/8/4/284.h" #include "2/8/5/285.h" #include "2/8/6/286.h" #include "2/8/7/287.h" #include "2/8/8/288.h" #include "2/8/9/289.h" #include "2/9/0/290.h" #include "2/9/1/291.h" #include "2/9/2/292.h" #include "2/9/3/293.h" #include "2/9/4/294.h" #include "2/9/5/295.h" #include "2/9/6/296.h" #include "2/9/7/297.h" #include "2/9/8/298.h" #include "2/9/9/299.h" #include "3/0/0/300.h" #include "3/0/1/301.h" #include "3/0/2/302.h" #include "3/0/3/303.h" #include "3/0/4/304.h" #include "3/0/5/305.h" #include "3/0/6/306.h" #include "3/0/7/307.h" #include "3/0/8/308.h" #include "3/0/9/309.h" #include "3/1/0/310.h" #include "3/1/1/311.h" #include "3/1/2/312.h" #include "3/1/3/313.h" #include "3/1/4/314.h" #include "3/1/5/315.h" #include "3/1/6/316.h" #include "3/1/7/317.h" #include "3/1/8/318.h" #include "3/1/9/319.h" #include "3/2/0/320.h" #include "3/2/1/321.h" #include "3/2/2/322.h" #include "3/2/3/323.h" #include "3/2/4/324.h" #include "3/2/5/325.h" #include "3/2/6/326.h" #include "3/2/7/327.h" #include "3/2/8/328.h" #include "3/2/9/329.h" #include "3/3/0/330.h" #include "3/3/1/331.h" #include "3/3/2/332.h" #include "3/3/3/333.h" #include "3/3/4/334.h" #include "3/3/5/335.h" #include "3/3/6/336.h" #include "3/3/7/337.h" #include "3/3/8/338.h" #include "3/3/9/339.h" #include "3/4/0/340.h" #include "3/4/1/341.h" #include "3/4/2/342.h" #include "3/4/3/343.h" #include "3/4/4/344.h" #include "3/4/5/345.h" #include "3/4/6/346.h" #include "3/4/7/347.h" #include "3/4/8/348.h" #include "3/4/9/349.h" #include "3/5/0/350.h" #include "3/5/1/351.h" #include "3/5/2/352.h" #include "3/5/3/353.h" #include "3/5/4/354.h" #include "3/5/5/355.h" #include "3/5/6/356.h" #include "3/5/7/357.h" #include "3/5/8/358.h" #include "3/5/9/359.h" #include "3/6/0/360.h" #include "3/6/1/361.h" #include "3/6/2/362.h" #include "3/6/3/363.h" #include "3/6/4/364.h" #include "3/6/5/365.h" #include "3/6/6/366.h" #include "3/6/7/367.h" #include "3/6/8/368.h" #include "3/6/9/369.h" #include "3/7/0/370.h" #include "3/7/1/371.h" #include "3/7/2/372.h" #include "3/7/3/373.h" #include "3/7/4/374.h" #include "3/7/5/375.h" #include "3/7/6/376.h" #include "3/7/7/377.h" #include "3/7/8/378.h" #include "3/7/9/379.h" #include "3/8/0/380.h" #include "3/8/1/381.h" #include "3/8/2/382.h" #include "3/8/3/383.h" #include "3/8/4/384.h" #include "3/8/5/385.h" #include "3/8/6/386.h" #include "3/8/7/387.h" #include "3/8/8/388.h" #include "3/8/9/389.h" #include "3/9/0/390.h" #include "3/9/1/391.h" #include "3/9/2/392.h" #include "3/9/3/393.h" #include "3/9/4/394.h" #include "3/9/5/395.h" #include "3/9/6/396.h" #include "3/9/7/397.h" #include "3/9/8/398.h" #include "3/9/9/399.h" #include "4/0/0/400.h" #include "4/0/1/401.h" #include "4/0/2/402.h" #include "4/0/3/403.h" #include "4/0/4/404.h" #include "4/0/5/405.h" #include "4/0/6/406.h" #include "4/0/7/407.h" #include "4/0/8/408.h" #include "4/0/9/409.h" #include "4/1/0/410.h" #include "4/1/1/411.h" #include "4/1/2/412.h" #include "4/1/3/413.h" #include "4/1/4/414.h" #include "4/1/5/415.h" #include "4/1/6/416.h" #include "4/1/7/417.h" #include "4/1/8/418.h" #include "4/1/9/419.h" #include "4/2/0/420.h" #include "4/2/1/421.h" #include "4/2/2/422.h" #include "4/2/3/423.h" #include "4/2/4/424.h" #include "4/2/5/425.h" #include "4/2/6/426.h" #include "4/2/7/427.h" #include "4/2/8/428.h" #include "4/2/9/429.h" #include "4/3/0/430.h" #include "4/3/1/431.h" #include "4/3/2/432.h" #include "4/3/3/433.h" #include "4/3/4/434.h" #include "4/3/5/435.h" #include "4/3/6/436.h" #include "4/3/7/437.h" #include "4/3/8/438.h" #include "4/3/9/439.h" void print_help(QVector<QString> &vParams) { std::cout << "\n" << " Please usage: " << vParams[0].toStdString() << " [md5]\n" << "\n"; }; int main(int argc, char* argv[]){ QCoreApplication app(argc, argv); QCoreApplication::setApplicationName("reversehash"); QVector<QString> vParams; for(int i = 0; i < argc; i++){ vParams.push_back(QString(argv[i])); } if(vParams.size() < 2 || vParams.size() > 2){ print_help(vParams); return -1; } QString hash = vParams[1]; if(hash.size() != 32){ qDebug().noquote().nospace() << "invalid md5"; print_help(vParams); return -1; }; QVector<bool> hash_bool; convertHEXStringToVBool(hash, hash_bool, 128); bool in0 = hash_bool[0]; bool in1 = hash_bool[1]; bool in2 = hash_bool[2]; bool in3 = hash_bool[3]; bool in4 = hash_bool[4]; bool in5 = hash_bool[5]; bool in6 = hash_bool[6]; bool in7 = hash_bool[7]; bool in8 = hash_bool[8]; bool in9 = hash_bool[9]; bool in10 = hash_bool[10]; bool in11 = hash_bool[11]; bool in12 = hash_bool[12]; bool in13 = hash_bool[13]; bool in14 = hash_bool[14]; bool in15 = hash_bool[15]; bool in16 = hash_bool[16]; bool in17 = hash_bool[17]; bool in18 = hash_bool[18]; bool in19 = hash_bool[19]; bool in20 = hash_bool[20]; bool in21 = hash_bool[21]; bool in22 = hash_bool[22]; bool in23 = hash_bool[23]; bool in24 = hash_bool[24]; bool in25 = hash_bool[25]; bool in26 = hash_bool[26]; bool in27 = hash_bool[27]; bool in28 = hash_bool[28]; bool in29 = hash_bool[29]; bool in30 = hash_bool[30]; bool in31 = hash_bool[31]; bool in32 = hash_bool[32]; bool in33 = hash_bool[33]; bool in34 = hash_bool[34]; bool in35 = hash_bool[35]; bool in36 = hash_bool[36]; bool in37 = hash_bool[37]; bool in38 = hash_bool[38]; bool in39 = hash_bool[39]; bool in40 = hash_bool[40]; bool in41 = hash_bool[41]; bool in42 = hash_bool[42]; bool in43 = hash_bool[43]; bool in44 = hash_bool[44]; bool in45 = hash_bool[45]; bool in46 = hash_bool[46]; bool in47 = hash_bool[47]; bool in48 = hash_bool[48]; bool in49 = hash_bool[49]; bool in50 = hash_bool[50]; bool in51 = hash_bool[51]; bool in52 = hash_bool[52]; bool in53 = hash_bool[53]; bool in54 = hash_bool[54]; bool in55 = hash_bool[55]; bool in56 = hash_bool[56]; bool in57 = hash_bool[57]; bool in58 = hash_bool[58]; bool in59 = hash_bool[59]; bool in60 = hash_bool[60]; bool in61 = hash_bool[61]; bool in62 = hash_bool[62]; bool in63 = hash_bool[63]; bool in64 = hash_bool[64]; bool in65 = hash_bool[65]; bool in66 = hash_bool[66]; bool in67 = hash_bool[67]; bool in68 = hash_bool[68]; bool in69 = hash_bool[69]; bool in70 = hash_bool[70]; bool in71 = hash_bool[71]; bool in72 = hash_bool[72]; bool in73 = hash_bool[73]; bool in74 = hash_bool[74]; bool in75 = hash_bool[75]; bool in76 = hash_bool[76]; bool in77 = hash_bool[77]; bool in78 = hash_bool[78]; bool in79 = hash_bool[79]; bool in80 = hash_bool[80]; bool in81 = hash_bool[81]; bool in82 = hash_bool[82]; bool in83 = hash_bool[83]; bool in84 = hash_bool[84]; bool in85 = hash_bool[85]; bool in86 = hash_bool[86]; bool in87 = hash_bool[87]; bool in88 = hash_bool[88]; bool in89 = hash_bool[89]; bool in90 = hash_bool[90]; bool in91 = hash_bool[91]; bool in92 = hash_bool[92]; bool in93 = hash_bool[93]; bool in94 = hash_bool[94]; bool in95 = hash_bool[95]; bool in96 = hash_bool[96]; bool in97 = hash_bool[97]; bool in98 = hash_bool[98]; bool in99 = hash_bool[99]; bool in100 = hash_bool[100]; bool in101 = hash_bool[101]; bool in102 = hash_bool[102]; bool in103 = hash_bool[103]; bool in104 = hash_bool[104]; bool in105 = hash_bool[105]; bool in106 = hash_bool[106]; bool in107 = hash_bool[107]; bool in108 = hash_bool[108]; bool in109 = hash_bool[109]; bool in110 = hash_bool[110]; bool in111 = hash_bool[111]; bool in112 = hash_bool[112]; bool in113 = hash_bool[113]; bool in114 = hash_bool[114]; bool in115 = hash_bool[115]; bool in116 = hash_bool[116]; bool in117 = hash_bool[117]; bool in118 = hash_bool[118]; bool in119 = hash_bool[119]; bool in120 = hash_bool[120]; bool in121 = hash_bool[121]; bool in122 = hash_bool[122]; bool in123 = hash_bool[123]; bool in124 = hash_bool[124]; bool in125 = hash_bool[125]; bool in126 = hash_bool[126]; bool in127 = hash_bool[127]; QVector<bool> result_bool; for(int i = 0; i < 440; i++){ result_bool.push_back(false); } bool out000; func000(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out000); result_bool[0] = out000; bool out001; func001(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out001); result_bool[1] = out001; bool out002; func002(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out002); result_bool[2] = out002; bool out003; func003(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out003); result_bool[3] = out003; bool out004; func004(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out004); result_bool[4] = out004; bool out005; func005(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out005); result_bool[5] = out005; bool out006; func006(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out006); result_bool[6] = out006; bool out007; func007(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out007); result_bool[7] = out007; bool out008; func008(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out008); result_bool[8] = out008; bool out009; func009(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out009); result_bool[9] = out009; bool out010; func010(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out010); result_bool[10] = out010; bool out011; func011(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out011); result_bool[11] = out011; bool out012; func012(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out012); result_bool[12] = out012; bool out013; func013(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out013); result_bool[13] = out013; bool out014; func014(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out014); result_bool[14] = out014; bool out015; func015(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out015); result_bool[15] = out015; bool out016; func016(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out016); result_bool[16] = out016; bool out017; func017(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out017); result_bool[17] = out017; bool out018; func018(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out018); result_bool[18] = out018; bool out019; func019(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out019); result_bool[19] = out019; bool out020; func020(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out020); result_bool[20] = out020; bool out021; func021(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out021); result_bool[21] = out021; bool out022; func022(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out022); result_bool[22] = out022; bool out023; func023(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out023); result_bool[23] = out023; bool out024; func024(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out024); result_bool[24] = out024; bool out025; func025(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out025); result_bool[25] = out025; bool out026; func026(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out026); result_bool[26] = out026; bool out027; func027(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out027); result_bool[27] = out027; bool out028; func028(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out028); result_bool[28] = out028; bool out029; func029(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out029); result_bool[29] = out029; bool out030; func030(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out030); result_bool[30] = out030; bool out031; func031(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out031); result_bool[31] = out031; bool out032; func032(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out032); result_bool[32] = out032; bool out033; func033(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out033); result_bool[33] = out033; bool out034; func034(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out034); result_bool[34] = out034; bool out035; func035(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out035); result_bool[35] = out035; bool out036; func036(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out036); result_bool[36] = out036; bool out037; func037(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out037); result_bool[37] = out037; bool out038; func038(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out038); result_bool[38] = out038; bool out039; func039(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out039); result_bool[39] = out039; bool out040; func040(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out040); result_bool[40] = out040; bool out041; func041(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out041); result_bool[41] = out041; bool out042; func042(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out042); result_bool[42] = out042; bool out043; func043(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out043); result_bool[43] = out043; bool out044; func044(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out044); result_bool[44] = out044; bool out045; func045(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out045); result_bool[45] = out045; bool out046; func046(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out046); result_bool[46] = out046; bool out047; func047(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out047); result_bool[47] = out047; bool out048; func048(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out048); result_bool[48] = out048; bool out049; func049(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out049); result_bool[49] = out049; bool out050; func050(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out050); result_bool[50] = out050; bool out051; func051(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out051); result_bool[51] = out051; bool out052; func052(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out052); result_bool[52] = out052; bool out053; func053(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out053); result_bool[53] = out053; bool out054; func054(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out054); result_bool[54] = out054; bool out055; func055(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out055); result_bool[55] = out055; bool out056; func056(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out056); result_bool[56] = out056; bool out057; func057(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out057); result_bool[57] = out057; bool out058; func058(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out058); result_bool[58] = out058; bool out059; func059(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out059); result_bool[59] = out059; bool out060; func060(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out060); result_bool[60] = out060; bool out061; func061(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out061); result_bool[61] = out061; bool out062; func062(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out062); result_bool[62] = out062; bool out063; func063(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out063); result_bool[63] = out063; bool out064; func064(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out064); result_bool[64] = out064; bool out065; func065(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out065); result_bool[65] = out065; bool out066; func066(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out066); result_bool[66] = out066; bool out067; func067(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out067); result_bool[67] = out067; bool out068; func068(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out068); result_bool[68] = out068; bool out069; func069(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out069); result_bool[69] = out069; bool out070; func070(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out070); result_bool[70] = out070; bool out071; func071(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out071); result_bool[71] = out071; bool out072; func072(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out072); result_bool[72] = out072; bool out073; func073(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out073); result_bool[73] = out073; bool out074; func074(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out074); result_bool[74] = out074; bool out075; func075(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out075); result_bool[75] = out075; bool out076; func076(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out076); result_bool[76] = out076; bool out077; func077(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out077); result_bool[77] = out077; bool out078; func078(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out078); result_bool[78] = out078; bool out079; func079(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out079); result_bool[79] = out079; bool out080; func080(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out080); result_bool[80] = out080; bool out081; func081(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out081); result_bool[81] = out081; bool out082; func082(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out082); result_bool[82] = out082; bool out083; func083(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out083); result_bool[83] = out083; bool out084; func084(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out084); result_bool[84] = out084; bool out085; func085(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out085); result_bool[85] = out085; bool out086; func086(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out086); result_bool[86] = out086; bool out087; func087(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out087); result_bool[87] = out087; bool out088; func088(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out088); result_bool[88] = out088; bool out089; func089(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out089); result_bool[89] = out089; bool out090; func090(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out090); result_bool[90] = out090; bool out091; func091(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out091); result_bool[91] = out091; bool out092; func092(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out092); result_bool[92] = out092; bool out093; func093(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out093); result_bool[93] = out093; bool out094; func094(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out094); result_bool[94] = out094; bool out095; func095(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out095); result_bool[95] = out095; bool out096; func096(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out096); result_bool[96] = out096; bool out097; func097(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out097); result_bool[97] = out097; bool out098; func098(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out098); result_bool[98] = out098; bool out099; func099(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out099); result_bool[99] = out099; bool out100; func100(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out100); result_bool[100] = out100; bool out101; func101(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out101); result_bool[101] = out101; bool out102; func102(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out102); result_bool[102] = out102; bool out103; func103(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out103); result_bool[103] = out103; bool out104; func104(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out104); result_bool[104] = out104; bool out105; func105(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out105); result_bool[105] = out105; bool out106; func106(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out106); result_bool[106] = out106; bool out107; func107(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out107); result_bool[107] = out107; bool out108; func108(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out108); result_bool[108] = out108; bool out109; func109(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out109); result_bool[109] = out109; bool out110; func110(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out110); result_bool[110] = out110; bool out111; func111(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out111); result_bool[111] = out111; bool out112; func112(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out112); result_bool[112] = out112; bool out113; func113(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out113); result_bool[113] = out113; bool out114; func114(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out114); result_bool[114] = out114; bool out115; func115(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out115); result_bool[115] = out115; bool out116; func116(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out116); result_bool[116] = out116; bool out117; func117(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out117); result_bool[117] = out117; bool out118; func118(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out118); result_bool[118] = out118; bool out119; func119(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out119); result_bool[119] = out119; bool out120; func120(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out120); result_bool[120] = out120; bool out121; func121(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out121); result_bool[121] = out121; bool out122; func122(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out122); result_bool[122] = out122; bool out123; func123(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out123); result_bool[123] = out123; bool out124; func124(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out124); result_bool[124] = out124; bool out125; func125(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out125); result_bool[125] = out125; bool out126; func126(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out126); result_bool[126] = out126; bool out127; func127(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out127); result_bool[127] = out127; bool out128; func128(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out128); result_bool[128] = out128; bool out129; func129(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out129); result_bool[129] = out129; bool out130; func130(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out130); result_bool[130] = out130; bool out131; func131(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out131); result_bool[131] = out131; bool out132; func132(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out132); result_bool[132] = out132; bool out133; func133(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out133); result_bool[133] = out133; bool out134; func134(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out134); result_bool[134] = out134; bool out135; func135(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out135); result_bool[135] = out135; bool out136; func136(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out136); result_bool[136] = out136; bool out137; func137(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out137); result_bool[137] = out137; bool out138; func138(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out138); result_bool[138] = out138; bool out139; func139(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out139); result_bool[139] = out139; bool out140; func140(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out140); result_bool[140] = out140; bool out141; func141(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out141); result_bool[141] = out141; bool out142; func142(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out142); result_bool[142] = out142; bool out143; func143(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out143); result_bool[143] = out143; bool out144; func144(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out144); result_bool[144] = out144; bool out145; func145(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out145); result_bool[145] = out145; bool out146; func146(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out146); result_bool[146] = out146; bool out147; func147(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out147); result_bool[147] = out147; bool out148; func148(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out148); result_bool[148] = out148; bool out149; func149(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out149); result_bool[149] = out149; bool out150; func150(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out150); result_bool[150] = out150; bool out151; func151(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out151); result_bool[151] = out151; bool out152; func152(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out152); result_bool[152] = out152; bool out153; func153(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out153); result_bool[153] = out153; bool out154; func154(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out154); result_bool[154] = out154; bool out155; func155(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out155); result_bool[155] = out155; bool out156; func156(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out156); result_bool[156] = out156; bool out157; func157(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out157); result_bool[157] = out157; bool out158; func158(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out158); result_bool[158] = out158; bool out159; func159(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out159); result_bool[159] = out159; bool out160; func160(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out160); result_bool[160] = out160; bool out161; func161(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out161); result_bool[161] = out161; bool out162; func162(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out162); result_bool[162] = out162; bool out163; func163(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out163); result_bool[163] = out163; bool out164; func164(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out164); result_bool[164] = out164; bool out165; func165(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out165); result_bool[165] = out165; bool out166; func166(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out166); result_bool[166] = out166; bool out167; func167(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out167); result_bool[167] = out167; bool out168; func168(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out168); result_bool[168] = out168; bool out169; func169(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out169); result_bool[169] = out169; bool out170; func170(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out170); result_bool[170] = out170; bool out171; func171(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out171); result_bool[171] = out171; bool out172; func172(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out172); result_bool[172] = out172; bool out173; func173(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out173); result_bool[173] = out173; bool out174; func174(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out174); result_bool[174] = out174; bool out175; func175(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out175); result_bool[175] = out175; bool out176; func176(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out176); result_bool[176] = out176; bool out177; func177(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out177); result_bool[177] = out177; bool out178; func178(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out178); result_bool[178] = out178; bool out179; func179(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out179); result_bool[179] = out179; bool out180; func180(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out180); result_bool[180] = out180; bool out181; func181(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out181); result_bool[181] = out181; bool out182; func182(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out182); result_bool[182] = out182; bool out183; func183(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out183); result_bool[183] = out183; bool out184; func184(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out184); result_bool[184] = out184; bool out185; func185(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out185); result_bool[185] = out185; bool out186; func186(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out186); result_bool[186] = out186; bool out187; func187(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out187); result_bool[187] = out187; bool out188; func188(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out188); result_bool[188] = out188; bool out189; func189(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out189); result_bool[189] = out189; bool out190; func190(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out190); result_bool[190] = out190; bool out191; func191(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out191); result_bool[191] = out191; bool out192; func192(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out192); result_bool[192] = out192; bool out193; func193(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out193); result_bool[193] = out193; bool out194; func194(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out194); result_bool[194] = out194; bool out195; func195(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out195); result_bool[195] = out195; bool out196; func196(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out196); result_bool[196] = out196; bool out197; func197(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out197); result_bool[197] = out197; bool out198; func198(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out198); result_bool[198] = out198; bool out199; func199(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out199); result_bool[199] = out199; bool out200; func200(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out200); result_bool[200] = out200; bool out201; func201(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out201); result_bool[201] = out201; bool out202; func202(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out202); result_bool[202] = out202; bool out203; func203(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out203); result_bool[203] = out203; bool out204; func204(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out204); result_bool[204] = out204; bool out205; func205(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out205); result_bool[205] = out205; bool out206; func206(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out206); result_bool[206] = out206; bool out207; func207(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out207); result_bool[207] = out207; bool out208; func208(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out208); result_bool[208] = out208; bool out209; func209(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out209); result_bool[209] = out209; bool out210; func210(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out210); result_bool[210] = out210; bool out211; func211(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out211); result_bool[211] = out211; bool out212; func212(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out212); result_bool[212] = out212; bool out213; func213(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out213); result_bool[213] = out213; bool out214; func214(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out214); result_bool[214] = out214; bool out215; func215(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out215); result_bool[215] = out215; bool out216; func216(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out216); result_bool[216] = out216; bool out217; func217(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out217); result_bool[217] = out217; bool out218; func218(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out218); result_bool[218] = out218; bool out219; func219(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out219); result_bool[219] = out219; bool out220; func220(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out220); result_bool[220] = out220; bool out221; func221(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out221); result_bool[221] = out221; bool out222; func222(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out222); result_bool[222] = out222; bool out223; func223(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out223); result_bool[223] = out223; bool out224; func224(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out224); result_bool[224] = out224; bool out225; func225(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out225); result_bool[225] = out225; bool out226; func226(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out226); result_bool[226] = out226; bool out227; func227(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out227); result_bool[227] = out227; bool out228; func228(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out228); result_bool[228] = out228; bool out229; func229(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out229); result_bool[229] = out229; bool out230; func230(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out230); result_bool[230] = out230; bool out231; func231(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out231); result_bool[231] = out231; bool out232; func232(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out232); result_bool[232] = out232; bool out233; func233(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out233); result_bool[233] = out233; bool out234; func234(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out234); result_bool[234] = out234; bool out235; func235(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out235); result_bool[235] = out235; bool out236; func236(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out236); result_bool[236] = out236; bool out237; func237(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out237); result_bool[237] = out237; bool out238; func238(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out238); result_bool[238] = out238; bool out239; func239(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out239); result_bool[239] = out239; bool out240; func240(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out240); result_bool[240] = out240; bool out241; func241(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out241); result_bool[241] = out241; bool out242; func242(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out242); result_bool[242] = out242; bool out243; func243(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out243); result_bool[243] = out243; bool out244; func244(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out244); result_bool[244] = out244; bool out245; func245(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out245); result_bool[245] = out245; bool out246; func246(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out246); result_bool[246] = out246; bool out247; func247(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out247); result_bool[247] = out247; bool out248; func248(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out248); result_bool[248] = out248; bool out249; func249(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out249); result_bool[249] = out249; bool out250; func250(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out250); result_bool[250] = out250; bool out251; func251(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out251); result_bool[251] = out251; bool out252; func252(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out252); result_bool[252] = out252; bool out253; func253(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out253); result_bool[253] = out253; bool out254; func254(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out254); result_bool[254] = out254; bool out255; func255(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out255); result_bool[255] = out255; bool out256; func256(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out256); result_bool[256] = out256; bool out257; func257(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out257); result_bool[257] = out257; bool out258; func258(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out258); result_bool[258] = out258; bool out259; func259(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out259); result_bool[259] = out259; bool out260; func260(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out260); result_bool[260] = out260; bool out261; func261(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out261); result_bool[261] = out261; bool out262; func262(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out262); result_bool[262] = out262; bool out263; func263(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out263); result_bool[263] = out263; bool out264; func264(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out264); result_bool[264] = out264; bool out265; func265(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out265); result_bool[265] = out265; bool out266; func266(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out266); result_bool[266] = out266; bool out267; func267(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out267); result_bool[267] = out267; bool out268; func268(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out268); result_bool[268] = out268; bool out269; func269(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out269); result_bool[269] = out269; bool out270; func270(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out270); result_bool[270] = out270; bool out271; func271(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out271); result_bool[271] = out271; bool out272; func272(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out272); result_bool[272] = out272; bool out273; func273(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out273); result_bool[273] = out273; bool out274; func274(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out274); result_bool[274] = out274; bool out275; func275(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out275); result_bool[275] = out275; bool out276; func276(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out276); result_bool[276] = out276; bool out277; func277(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out277); result_bool[277] = out277; bool out278; func278(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out278); result_bool[278] = out278; bool out279; func279(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out279); result_bool[279] = out279; bool out280; func280(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out280); result_bool[280] = out280; bool out281; func281(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out281); result_bool[281] = out281; bool out282; func282(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out282); result_bool[282] = out282; bool out283; func283(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out283); result_bool[283] = out283; bool out284; func284(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out284); result_bool[284] = out284; bool out285; func285(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out285); result_bool[285] = out285; bool out286; func286(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out286); result_bool[286] = out286; bool out287; func287(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out287); result_bool[287] = out287; bool out288; func288(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out288); result_bool[288] = out288; bool out289; func289(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out289); result_bool[289] = out289; bool out290; func290(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out290); result_bool[290] = out290; bool out291; func291(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out291); result_bool[291] = out291; bool out292; func292(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out292); result_bool[292] = out292; bool out293; func293(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out293); result_bool[293] = out293; bool out294; func294(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out294); result_bool[294] = out294; bool out295; func295(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out295); result_bool[295] = out295; bool out296; func296(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out296); result_bool[296] = out296; bool out297; func297(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out297); result_bool[297] = out297; bool out298; func298(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out298); result_bool[298] = out298; bool out299; func299(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out299); result_bool[299] = out299; bool out300; func300(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out300); result_bool[300] = out300; bool out301; func301(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out301); result_bool[301] = out301; bool out302; func302(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out302); result_bool[302] = out302; bool out303; func303(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out303); result_bool[303] = out303; bool out304; func304(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out304); result_bool[304] = out304; bool out305; func305(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out305); result_bool[305] = out305; bool out306; func306(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out306); result_bool[306] = out306; bool out307; func307(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out307); result_bool[307] = out307; bool out308; func308(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out308); result_bool[308] = out308; bool out309; func309(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out309); result_bool[309] = out309; bool out310; func310(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out310); result_bool[310] = out310; bool out311; func311(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out311); result_bool[311] = out311; bool out312; func312(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out312); result_bool[312] = out312; bool out313; func313(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out313); result_bool[313] = out313; bool out314; func314(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out314); result_bool[314] = out314; bool out315; func315(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out315); result_bool[315] = out315; bool out316; func316(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out316); result_bool[316] = out316; bool out317; func317(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out317); result_bool[317] = out317; bool out318; func318(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out318); result_bool[318] = out318; bool out319; func319(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out319); result_bool[319] = out319; bool out320; func320(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out320); result_bool[320] = out320; bool out321; func321(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out321); result_bool[321] = out321; bool out322; func322(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out322); result_bool[322] = out322; bool out323; func323(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out323); result_bool[323] = out323; bool out324; func324(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out324); result_bool[324] = out324; bool out325; func325(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out325); result_bool[325] = out325; bool out326; func326(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out326); result_bool[326] = out326; bool out327; func327(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out327); result_bool[327] = out327; bool out328; func328(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out328); result_bool[328] = out328; bool out329; func329(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out329); result_bool[329] = out329; bool out330; func330(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out330); result_bool[330] = out330; bool out331; func331(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out331); result_bool[331] = out331; bool out332; func332(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out332); result_bool[332] = out332; bool out333; func333(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out333); result_bool[333] = out333; bool out334; func334(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out334); result_bool[334] = out334; bool out335; func335(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out335); result_bool[335] = out335; bool out336; func336(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out336); result_bool[336] = out336; bool out337; func337(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out337); result_bool[337] = out337; bool out338; func338(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out338); result_bool[338] = out338; bool out339; func339(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out339); result_bool[339] = out339; bool out340; func340(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out340); result_bool[340] = out340; bool out341; func341(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out341); result_bool[341] = out341; bool out342; func342(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out342); result_bool[342] = out342; bool out343; func343(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out343); result_bool[343] = out343; bool out344; func344(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out344); result_bool[344] = out344; bool out345; func345(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out345); result_bool[345] = out345; bool out346; func346(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out346); result_bool[346] = out346; bool out347; func347(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out347); result_bool[347] = out347; bool out348; func348(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out348); result_bool[348] = out348; bool out349; func349(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out349); result_bool[349] = out349; bool out350; func350(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out350); result_bool[350] = out350; bool out351; func351(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out351); result_bool[351] = out351; bool out352; func352(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out352); result_bool[352] = out352; bool out353; func353(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out353); result_bool[353] = out353; bool out354; func354(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out354); result_bool[354] = out354; bool out355; func355(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out355); result_bool[355] = out355; bool out356; func356(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out356); result_bool[356] = out356; bool out357; func357(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out357); result_bool[357] = out357; bool out358; func358(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out358); result_bool[358] = out358; bool out359; func359(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out359); result_bool[359] = out359; bool out360; func360(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out360); result_bool[360] = out360; bool out361; func361(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out361); result_bool[361] = out361; bool out362; func362(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out362); result_bool[362] = out362; bool out363; func363(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out363); result_bool[363] = out363; bool out364; func364(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out364); result_bool[364] = out364; bool out365; func365(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out365); result_bool[365] = out365; bool out366; func366(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out366); result_bool[366] = out366; bool out367; func367(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out367); result_bool[367] = out367; bool out368; func368(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out368); result_bool[368] = out368; bool out369; func369(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out369); result_bool[369] = out369; bool out370; func370(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out370); result_bool[370] = out370; bool out371; func371(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out371); result_bool[371] = out371; bool out372; func372(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out372); result_bool[372] = out372; bool out373; func373(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out373); result_bool[373] = out373; bool out374; func374(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out374); result_bool[374] = out374; bool out375; func375(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out375); result_bool[375] = out375; bool out376; func376(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out376); result_bool[376] = out376; bool out377; func377(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out377); result_bool[377] = out377; bool out378; func378(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out378); result_bool[378] = out378; bool out379; func379(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out379); result_bool[379] = out379; bool out380; func380(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out380); result_bool[380] = out380; bool out381; func381(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out381); result_bool[381] = out381; bool out382; func382(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out382); result_bool[382] = out382; bool out383; func383(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out383); result_bool[383] = out383; bool out384; func384(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out384); result_bool[384] = out384; bool out385; func385(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out385); result_bool[385] = out385; bool out386; func386(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out386); result_bool[386] = out386; bool out387; func387(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out387); result_bool[387] = out387; bool out388; func388(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out388); result_bool[388] = out388; bool out389; func389(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out389); result_bool[389] = out389; bool out390; func390(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out390); result_bool[390] = out390; bool out391; func391(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out391); result_bool[391] = out391; bool out392; func392(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out392); result_bool[392] = out392; bool out393; func393(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out393); result_bool[393] = out393; bool out394; func394(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out394); result_bool[394] = out394; bool out395; func395(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out395); result_bool[395] = out395; bool out396; func396(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out396); result_bool[396] = out396; bool out397; func397(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out397); result_bool[397] = out397; bool out398; func398(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out398); result_bool[398] = out398; bool out399; func399(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out399); result_bool[399] = out399; bool out400; func400(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out400); result_bool[400] = out400; bool out401; func401(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out401); result_bool[401] = out401; bool out402; func402(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out402); result_bool[402] = out402; bool out403; func403(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out403); result_bool[403] = out403; bool out404; func404(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out404); result_bool[404] = out404; bool out405; func405(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out405); result_bool[405] = out405; bool out406; func406(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out406); result_bool[406] = out406; bool out407; func407(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out407); result_bool[407] = out407; bool out408; func408(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out408); result_bool[408] = out408; bool out409; func409(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out409); result_bool[409] = out409; bool out410; func410(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out410); result_bool[410] = out410; bool out411; func411(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out411); result_bool[411] = out411; bool out412; func412(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out412); result_bool[412] = out412; bool out413; func413(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out413); result_bool[413] = out413; bool out414; func414(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out414); result_bool[414] = out414; bool out415; func415(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out415); result_bool[415] = out415; bool out416; func416(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out416); result_bool[416] = out416; bool out417; func417(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out417); result_bool[417] = out417; bool out418; func418(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out418); result_bool[418] = out418; bool out419; func419(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out419); result_bool[419] = out419; bool out420; func420(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out420); result_bool[420] = out420; bool out421; func421(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out421); result_bool[421] = out421; bool out422; func422(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out422); result_bool[422] = out422; bool out423; func423(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out423); result_bool[423] = out423; bool out424; func424(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out424); result_bool[424] = out424; bool out425; func425(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out425); result_bool[425] = out425; bool out426; func426(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out426); result_bool[426] = out426; bool out427; func427(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out427); result_bool[427] = out427; bool out428; func428(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out428); result_bool[428] = out428; bool out429; func429(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out429); result_bool[429] = out429; bool out430; func430(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out430); result_bool[430] = out430; bool out431; func431(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out431); result_bool[431] = out431; bool out432; func432(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out432); result_bool[432] = out432; bool out433; func433(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out433); result_bool[433] = out433; bool out434; func434(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out434); result_bool[434] = out434; bool out435; func435(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out435); result_bool[435] = out435; bool out436; func436(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out436); result_bool[436] = out436; bool out437; func437(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out437); result_bool[437] = out437; bool out438; func438(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out438); result_bool[438] = out438; bool out439; func439(in0, in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, in33, in34, in35, in36, in37, in38, in39, in40, in41, in42, in43, in44, in45, in46, in47, in48, in49, in50, in51, in52, in53, in54, in55, in56, in57, in58, in59, in60, in61, in62, in63, in64, in65, in66, in67, in68, in69, in70, in71, in72, in73, in74, in75, in76, in77, in78, in79, in80, in81, in82, in83, in84, in85, in86, in87, in88, in89, in90, in91, in92, in93, in94, in95, in96, in97, in98, in99, in100, in101, in102, in103, in104, in105, in106, in107, in108, in109, in110, in111, in112, in113, in114, in115, in116, in117, in118, in119, in120, in121, in122, in123, in124, in125, in126, in127, out439); result_bool[439] = out439; qDebug().noquote().nospace() << "Original hash: " << hash; QString result = convertVBoolHEXString(result_bool); QByteArray out_array = QByteArray::fromHex(result.toLatin1()); QString hex_from_out = QString(QCryptographicHash::hash(out_array, QCryptographicHash::Md5).toHex()); qDebug().noquote().nospace() << "md5(revertedstring): " << hex_from_out; qDebug().noquote().nospace() << "Reverted (HEX): " << result; qDebug().noquote().nospace() << "Reverted string: " << QString(out_array); return 0; }
198.957884
803
0.675355
sea-kg
d1040bf25eecabce18fece7e0dc55f5589db5ca2
54,803
cpp
C++
test/API/VMTest.cpp
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
null
null
null
test/API/VMTest.cpp
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
null
null
null
test/API/VMTest.cpp
gmh5225/QBDI
d31872adae1099ac74a2e2238f909ad1e63cc3e8
[ "Apache-2.0" ]
null
null
null
/* * This file is part of QBDI. * * Copyright 2017 - 2021 Quarkslab * * 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 <algorithm> #include <catch2/catch.hpp> #include "APITest.h" #include "inttypes.h" #include "QBDI/Memory.hpp" #include "QBDI/Platform.h" #include "Utility/LogSys.h" #include "Utility/String.h" #if defined(QBDI_ARCH_X86) #include "X86/VMTest_X86.h" #elif defined(QBDI_ARCH_X86_64) #include "X86_64/VMTest_X86_64.h" #elif defined(QBDI_ARCH_ARM) #include "ARM/VMTest_ARM.h" #elif defined(QBDI_ARCH_AARCH64) #include "AARCH64/VMTest_AARCH64.h" #else #error "Architecture not supported" #endif #define FAKE_RET_ADDR 0x666 QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFun0() { return 42; } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFun1(int arg0) { return arg0; } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFun4(int arg0, int arg1, int arg2, int arg3) { return arg0 + arg1 + arg2 + arg3; } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFun5(int arg0, int arg1, int arg2, int arg3, int arg4) { return arg0 + arg1 + arg2 + arg3 + arg4; } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFun8(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) { return arg0 + arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7; } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFunCall(int arg0) { // use simple BUT multiplatform functions to test external calls uint8_t *useless = (uint8_t *)QBDI::alignedAlloc(256, 16); if (useless) { *(int *)useless = arg0; QBDI::alignedFree(useless); } return dummyFun1(arg0); } QBDI_DISABLE_ASAN QBDI_NOINLINE int dummyFunBB(int arg0, int arg1, int arg2, int (*f0)(int), int (*f1)(int), int (*f2)(int)) { int r = 0; if (arg0 & 1) { r = f1(f0(arg1)) + arg2; r ^= arg0; } else { r = f0(f1(arg2)) + arg1; r ^= arg0; } r = f2(r + arg0 + arg1 + arg2); if (arg0 & 2) { r += f1(f0(arg2 + r)) + arg1; r ^= arg0; } else { r += f0(f1(arg1 + r)) + arg2; r ^= arg0; } return r; } TEST_CASE_METHOD(APITest, "VMTest-Call0") { QBDI::simulateCall(state, FAKE_RET_ADDR); vm.run((QBDI::rword)dummyFun0, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)42); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-Call1") { QBDI::simulateCall(state, FAKE_RET_ADDR, {42}); vm.run((QBDI::rword)dummyFun1, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)dummyFun1(42)); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-Call4") { QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 5}); vm.run((QBDI::rword)dummyFun4, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)dummyFun4(1, 2, 3, 5)); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-Call5") { QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 5, 8}); vm.run((QBDI::rword)dummyFun5, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)dummyFun5(1, 2, 3, 5, 8)); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-Call8") { QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 5, 8, 13, 21, 34}); vm.run((QBDI::rword)dummyFun8, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)dummyFun8(1, 2, 3, 5, 8, 13, 21, 34)); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-ExternalCall") { dummyFunCall(42); QBDI::simulateCall(state, FAKE_RET_ADDR, {42}); vm.run((QBDI::rword)dummyFunCall, (QBDI::rword)FAKE_RET_ADDR); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)dummyFun1(42)); SUCCEED(); } QBDI::VMAction countInstruction(QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { *((uint32_t *)data) += 1; return QBDI::VMAction::CONTINUE; } QBDI::VMAction evilCbk(QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { const QBDI::InstAnalysis *ana = vm->getInstAnalysis(); CHECK(ana->mnemonic != nullptr); CHECK(ana->disassembly != nullptr); CHECK(ana->operands == nullptr); QBDI::rword *info = (QBDI::rword *)data; QBDI::rword cval = QBDI_GPR_GET(gprState, QBDI::REG_RETURN); // should never be reached (because we stop VM after value is incremented) if (info[1] != 0) { // if we failed this test, just return a fixed value QBDI_GPR_SET(gprState, QBDI::REG_RETURN, 0x21); } // return register is being set with our return value if (cval == (satanicFun(info[0]))) { info[1]++; return QBDI::VMAction::STOP; } return QBDI::VMAction::CONTINUE; } /* This test is used to ensure that addCodeAddrCB is not broken */ TEST_CASE_METHOD(APITest, "VMTest-Breakpoint") { uint32_t counter = 0; QBDI::rword retval = 0; vm.addCodeAddrCB((QBDI::rword)dummyFun0, QBDI::InstPosition::PREINST, countInstruction, &counter); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(counter == 1u); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCallback") { QBDI::rword info[2] = {42, 0}; QBDI::simulateCall(state, FAKE_RET_ADDR, {info[0]}); uint32_t instrId = vm.addCodeCB(QBDI::InstPosition::POSTINST, evilCbk, &info); bool ran = vm.run((QBDI::rword)satanicFun, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)satanicFun(info[0])); REQUIRE(info[1] == (QBDI::rword)1); bool success = vm.deleteInstrumentation(instrId); REQUIRE(success); SUCCEED(); } QBDI::VMAction evilMnemCbk(QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { QBDI::rword *info = (QBDI::rword *)data; if (info[0] >= MNEM_COUNT) return QBDI::VMAction::CONTINUE; // get instruction metadata const QBDI::InstAnalysis *ana = vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION | QBDI::ANALYSIS_OPERANDS); // validate mnemonic CHECKED_IF(QBDI::String::startsWith(MNEM_CMP, ana->mnemonic)) { info[0]++; // CMP count info[1]++; // validate address CHECKED_IF(ana->address >= (QBDI::rword)&satanicFun) CHECKED_IF(ana->address < (((QBDI::rword)&satanicFun) + 0x100)) info[1]++; // validate inst size const struct TestInst &currentInst = TestInsts[info[0] - 1]; #if defined(QBDI_ARCH_X86) || defined(QBDI_ARCH_X86_64) CHECKED_IF(ana->instSize == currentInst.instSize) { #else { #endif info[1]++; } // validate instruction type (kinda...) if (currentInst.isCompare) { // CHECKED_IF doesn't support && operator CHECKED_IF(!ana->isBranch) CHECKED_IF(!ana->isCall) CHECKED_IF(!ana->isReturn) CHECKED_IF(ana->isCompare) info[1]++; } CHECKED_IF(ana->flagsAccess == currentInst.flagsAccess) { info[1]++; } // validate number of analyzed operands CHECKED_IF(ana->numOperands == currentInst.numOperands) { info[1]++; } // validate operands CHECKED_IF(ana->operands != nullptr) { info[1]++; for (uint8_t idx = 0; idx < std::min(ana->numOperands, currentInst.numOperands); idx++) { const QBDI::OperandAnalysis &cmpOp = currentInst.operands[idx]; const QBDI::OperandAnalysis &op = ana->operands[idx]; CHECKED_IF(op.type == cmpOp.type) { info[1]++; } if (op.type == QBDI::OPERAND_IMM) { CHECKED_IF(op.value == cmpOp.value) { info[1]++; } } if (op.regName == nullptr && cmpOp.regName == nullptr) { info[1]++; } else { CHECKED_IF(op.regName != nullptr) CHECKED_IF(cmpOp.regName != nullptr) CHECKED_IF(std::string(op.regName) == std::string(cmpOp.regName)) info[1]++; } CHECKED_IF(op.size == cmpOp.size) { info[1]++; } CHECKED_IF(op.regCtxIdx == cmpOp.regCtxIdx) { info[1]++; } CHECKED_IF(op.regOff == cmpOp.regOff) { info[1]++; } CHECKED_IF(op.regAccess == cmpOp.regAccess) { info[1]++; } } } } return QBDI::VMAction::CONTINUE; } TEST_CASE_METHOD(APITest, "VMTest-MnemCallback") { QBDI::rword info[3] = {0, 0, 42}; QBDI::rword retval = 0; const char *noop = MNEM_CMP; uint32_t instrId = vm.addMnemonicCB(noop, QBDI::InstPosition::PREINST, evilMnemCbk, &info); bool ran = vm.call(&retval, (QBDI::rword)satanicFun, {info[2]}); REQUIRE(ran); CHECK(retval == (QBDI::rword)satanicFun(info[2])); // TODO: try to find a way to support windows #ifdef QBDI_PLATFORM_WINDOWS CHECK(info[1] == (QBDI::rword)0); #else CHECK(info[0] == MNEM_COUNT); CHECK(info[1] == (QBDI::rword)MNEM_VALIDATION); #endif bool success = vm.deleteInstrumentation(instrId); REQUIRE(success); SUCCEED(); } QBDI::VMAction checkTransfer(QBDI::VMInstanceRef vm, const QBDI::VMState *state, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { int *s = (int *)data; if (state->event == QBDI::VMEvent::EXEC_TRANSFER_CALL) { REQUIRE((*s % 2) == 0); REQUIRE(reinterpret_cast<QBDI::rword>(dummyFun1) == state->sequenceStart); *s += 1; } else if (state->event == QBDI::VMEvent::EXEC_TRANSFER_RETURN) { REQUIRE((*s % 2) == 1); REQUIRE(reinterpret_cast<QBDI::rword>(dummyFun1) == state->sequenceStart); *s += 1; } return QBDI::VMAction::CONTINUE; } TEST_CASE_METHOD(APITest, "VMTest-VMEvent_ExecTransfer") { int s = 0; bool instrumented = vm.addInstrumentedModuleFromAddr( reinterpret_cast<QBDI::rword>(dummyFunBB)); REQUIRE(instrumented); vm.removeInstrumentedRange(reinterpret_cast<QBDI::rword>(dummyFun1), reinterpret_cast<QBDI::rword>(dummyFun1) + 1); uint32_t id = vm.addVMEventCB(QBDI::VMEvent::EXEC_TRANSFER_CALL, checkTransfer, (void *)&s); REQUIRE(id != QBDI::INVALID_EVENTID); id = vm.addVMEventCB(QBDI::VMEvent::EXEC_TRANSFER_RETURN, checkTransfer, (void *)&s); REQUIRE(id != QBDI::INVALID_EVENTID); QBDI::rword retval; bool ran = vm.call(&retval, reinterpret_cast<QBDI::rword>(dummyFunBB), {0, 0, 0, reinterpret_cast<QBDI::rword>(dummyFun1), reinterpret_cast<QBDI::rword>(dummyFun1), reinterpret_cast<QBDI::rword>(dummyFun1)}); REQUIRE(ran); REQUIRE(retval == (QBDI::rword)0); REQUIRE(10 == s); vm.deleteAllInstrumentations(); } struct CheckBasicBlockData { bool waitingEnd; QBDI::rword BBStart; QBDI::rword BBEnd; size_t count; }; static QBDI::VMAction checkBasicBlock(QBDI::VMInstanceRef vm, const QBDI::VMState *vmState, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data_) { CheckBasicBlockData *data = static_cast<CheckBasicBlockData *>(data_); CHECK((vmState->event & (QBDI::BASIC_BLOCK_ENTRY | QBDI::BASIC_BLOCK_EXIT)) != 0); CHECK((vmState->event & (QBDI::BASIC_BLOCK_ENTRY | QBDI::BASIC_BLOCK_EXIT)) != (QBDI::BASIC_BLOCK_ENTRY | QBDI::BASIC_BLOCK_EXIT)); if (vmState->event & QBDI::BASIC_BLOCK_ENTRY) { CHECK_FALSE(data->waitingEnd); CHECK(vmState->basicBlockStart == vmState->sequenceStart); *data = {true, vmState->basicBlockStart, vmState->basicBlockEnd, data->count}; } else if (vmState->event & QBDI::BASIC_BLOCK_EXIT) { CHECK(data->waitingEnd); CHECK(data->BBStart == vmState->basicBlockStart); CHECK(data->BBEnd == vmState->basicBlockEnd); CHECK(vmState->basicBlockEnd == vmState->sequenceEnd); data->waitingEnd = false; data->count++; } return QBDI::VMAction::CONTINUE; } TEST_CASE_METHOD(APITest, "VMTest-VMEvent_BasicBlock") { CheckBasicBlockData data{false, 0, 0, 0}; vm.addVMEventCB(QBDI::BASIC_BLOCK_ENTRY | QBDI::BASIC_BLOCK_EXIT, checkBasicBlock, &data); // backup GPRState to have the same state before each run QBDI::GPRState backup = *(vm.getGPRState()); for (QBDI::rword j = 0; j < 4; j++) { for (QBDI::rword i = 0; i < 8; i++) { QBDI_DEBUG("Begin Loop iteration {} {}", j, i); vm.setGPRState(&backup); data.waitingEnd = false; data.count = 0; QBDI::rword retval; bool ran = vm.call(&retval, reinterpret_cast<QBDI::rword>(dummyFunBB), {i ^ j, 5, 13, reinterpret_cast<QBDI::rword>(dummyFun1), reinterpret_cast<QBDI::rword>(dummyFun1), reinterpret_cast<QBDI::rword>(dummyFun1)}); CHECK(ran); CHECK_FALSE(data.waitingEnd); CHECK(data.count != 0); } vm.clearAllCache(); } } TEST_CASE_METHOD(APITest, "VMTest-CacheInvalidation") { uint32_t count1 = 0; uint32_t count2 = 0; bool instrumented = vm.addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); uint32_t instr1 = vm.addCodeCB(QBDI::InstPosition::POSTINST, countInstruction, &count1); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4}); bool ran = vm.run((QBDI::rword)dummyFun4, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)10); REQUIRE((uint32_t)0 != count1); REQUIRE((uint32_t)0 == count2); uint32_t instr2 = vm.addCodeRangeCB( (QBDI::rword)&dummyFun5, ((QBDI::rword)&dummyFun5) + 64, QBDI::InstPosition::POSTINST, countInstruction, &count2); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4, 5}); ran = vm.run((QBDI::rword)dummyFun5, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)15); REQUIRE((uint32_t)0 != count1); REQUIRE((uint32_t)0 != count2); vm.deleteInstrumentation(instr1); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4}); ran = vm.run((QBDI::rword)dummyFun4, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)10); REQUIRE((uint32_t)0 == count1); REQUIRE((uint32_t)0 == count2); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4, 5}); ran = vm.run((QBDI::rword)dummyFun5, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)15); REQUIRE((uint32_t)0 == count1); REQUIRE((uint32_t)0 != count2); instr1 = vm.addCodeCB(QBDI::InstPosition::POSTINST, countInstruction, &count1); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4, 5}); ran = vm.run((QBDI::rword)dummyFun5, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)15); REQUIRE((uint32_t)0 != count1); REQUIRE((uint32_t)0 != count2); vm.deleteInstrumentation(instr2); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4}); ran = vm.run((QBDI::rword)dummyFun4, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)10); REQUIRE((uint32_t)0 != count1); REQUIRE((uint32_t)0 == count2); count1 = 0; count2 = 0; QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4, 5}); ran = vm.run((QBDI::rword)dummyFun5, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)15); REQUIRE((uint32_t)0 != count1); REQUIRE((uint32_t)0 == count2); } struct FunkyInfo { uint32_t instID; uint32_t count; }; QBDI::VMAction funkyCountInstruction(QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) { FunkyInfo *info = (FunkyInfo *)data; const QBDI::InstAnalysis *instAnalysis1 = vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION); vm->deleteInstrumentation(info->instID); const QBDI::InstAnalysis *instAnalysis2 = vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION); info->instID = vm->addCodeRangeCB(QBDI_GPR_GET(gprState, QBDI::REG_PC), QBDI_GPR_GET(gprState, QBDI::REG_PC) + 10, QBDI::InstPosition::POSTINST, funkyCountInstruction, data); const QBDI::InstAnalysis *instAnalysis3 = vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION); // instAnalysis1, instAnalysis2 and instAnalysis3 should be the same pointer // because the cache flush initiated by deleteInstrumentation and // addCodeRangeCB is delayed. if (instAnalysis1 == instAnalysis2 && instAnalysis2 == instAnalysis3) { info->count += 1; } // instAnalysis3 should not have disassembly information, but instAnalysis4 // and instAnalysis5 should. CHECK(instAnalysis3->disassembly == nullptr); CHECK(instAnalysis3->operands == nullptr); const QBDI::InstAnalysis *instAnalysis4 = vm->getInstAnalysis( QBDI::ANALYSIS_INSTRUCTION | QBDI::ANALYSIS_DISASSEMBLY); CHECK(instAnalysis4->disassembly != nullptr); CHECK(instAnalysis4->operands == nullptr); const QBDI::InstAnalysis *instAnalysis5 = vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION); CHECK(instAnalysis5->disassembly != nullptr); CHECK(instAnalysis5->operands == nullptr); return QBDI::VMAction::BREAK_TO_VM; } TEST_CASE_METHOD(APITest, "VMTest-DelayedCacheFlush") { uint32_t count = 0; FunkyInfo info = FunkyInfo{0, 0}; bool instrumented = vm.addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); vm.addCodeCB(QBDI::InstPosition::POSTINST, countInstruction, &count); info.instID = vm.addCodeRangeCB( (QBDI::rword)dummyFun4, ((QBDI::rword)dummyFun4) + 10, QBDI::InstPosition::POSTINST, funkyCountInstruction, &info); QBDI::simulateCall(state, FAKE_RET_ADDR, {1, 2, 3, 4}); bool ran = vm.run((QBDI::rword)dummyFun4, (QBDI::rword)FAKE_RET_ADDR); REQUIRE(ran); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)10); REQUIRE(count == info.count); } struct PriorityDataCall { QBDI::rword addr; QBDI::InstPosition pos; int priority; PriorityDataCall(QBDI::rword addr, QBDI::InstPosition pos, int priority) : addr(addr), pos(pos), priority(priority) {} }; static std::vector<QBDI::InstrRuleDataCBK> priorityInstrCB(QBDI::VMInstanceRef vm, const QBDI::InstAnalysis *inst, void *data_) { std::vector<QBDI::InstrRuleDataCBK> r; r.emplace_back( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, -100); return QBDI::VMAction::CONTINUE; }, data_, -100); r.emplace_back( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::POSTINST, 0); return QBDI::VMAction::CONTINUE; }, data_, 0); r.emplace_back( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::POSTINST, 100); return QBDI::VMAction::CONTINUE; }, data_, 100); r.emplace_back( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, 100); return QBDI::VMAction::CONTINUE; }, data_, 100); r.emplace_back( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, 0); return QBDI::VMAction::CONTINUE; }, data_, 0); r.emplace_back( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::POSTINST, -100); return QBDI::VMAction::CONTINUE; }, data_, -100); return r; } TEST_CASE_METHOD(APITest, "VMTest-Priority") { std::vector<PriorityDataCall> callList; QBDI::rword retval = 0; vm.addCodeCB( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, -10); return QBDI::VMAction::CONTINUE; }, &callList, -10); vm.addCodeCB( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::POSTINST, -67); return QBDI::VMAction::CONTINUE; }, &callList, -67); vm.addCodeCB( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::POSTINST, 56); return QBDI::VMAction::CONTINUE; }, &callList, 56); vm.addInstrRule(priorityInstrCB, QBDI::ANALYSIS_INSTRUCTION, &callList); vm.addCodeCB( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, 27); return QBDI::VMAction::CONTINUE; }, &callList, 27); vm.addCodeCB( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((std::vector<PriorityDataCall> *)data) ->emplace_back( vm->getInstAnalysis(QBDI::ANALYSIS_INSTRUCTION)->address, QBDI::InstPosition::PREINST, -77); return QBDI::VMAction::CONTINUE; }, &callList, -77); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(callList.size() >= 11); for (size_t i = 1; i < callList.size(); i++) { if (callList[i - 1].addr == callList[i].addr) { if (callList[i - 1].pos == callList[i].pos) { REQUIRE(callList[i - 1].priority >= callList[i].priority); } else { REQUIRE(callList[i - 1].pos == QBDI::InstPosition::PREINST); REQUIRE(callList[i].pos == QBDI::InstPosition::POSTINST); } } } SUCCEED(); } struct SkipTestData { uint8_t cbpre1; uint8_t cbpre2; uint8_t cbpre3; uint8_t cbpost; uint8_t cbnumpre; uint8_t cbnumpost; }; TEST_CASE_METHOD(APITest, "VMTest-SKIP_INST") { SkipTestData data = {0}; QBDI::rword addr = genASM(SKIPTESTASM); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre1++; return QBDI::VMAction::CONTINUE; }, &data, 100); vm.addCodeCB( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbnumpre++; return QBDI::VMAction::CONTINUE; }, &data, 0); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre2++; return QBDI::VMAction::SKIP_INST; }, &data, -100); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre3++; return QBDI::VMAction::CONTINUE; }, &data, -200); vm.addCodeAddrCB( addr, QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpost++; return QBDI::VMAction::CONTINUE; }, &data, 0); vm.addCodeCB( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbnumpost++; return QBDI::VMAction::CONTINUE; }, &data, 0); QBDI::rword retval = 0; vm.call(&retval, (QBDI::rword)addr); REQUIRE(data.cbpre1 == 1); REQUIRE(data.cbpre2 == 1); REQUIRE(data.cbpre3 == 0); REQUIRE(data.cbpost == 1); REQUIRE(data.cbnumpre == 3); REQUIRE(data.cbnumpost == 3); } TEST_CASE_METHOD(APITest, "VMTest-SKIP_PATCH") { SkipTestData data = {0}; QBDI::rword addr = genASM(SKIPTESTASM); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre1++; return QBDI::VMAction::CONTINUE; }, &data, 100); vm.addCodeCB( QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbnumpre++; return QBDI::VMAction::CONTINUE; }, &data, 0); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre2++; return QBDI::VMAction::SKIP_PATCH; }, &data, -100); vm.addCodeAddrCB( addr, QBDI::InstPosition::PREINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpre3++; return QBDI::VMAction::CONTINUE; }, &data, -200); vm.addCodeAddrCB( addr, QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbpost++; return QBDI::VMAction::CONTINUE; }, &data, 0); vm.addCodeCB( QBDI::InstPosition::POSTINST, [](QBDI::VMInstanceRef vm, QBDI::GPRState *gprState, QBDI::FPRState *fprState, void *data) -> QBDI::VMAction { ((SkipTestData *)data)->cbnumpost++; return QBDI::VMAction::CONTINUE; }, &data, 0); QBDI::rword retval = 0; vm.call(&retval, (QBDI::rword)addr); REQUIRE(data.cbpre1 == 1); REQUIRE(data.cbpre2 == 1); REQUIRE(data.cbpre3 == 0); REQUIRE(data.cbpost == 0); REQUIRE(data.cbnumpre == 3); REQUIRE(data.cbnumpost == 2); } // Test copy/move constructor/assignment operator struct MoveCallbackStruct { QBDI::VMInstanceRef expectedRef; bool allowedNewBlock; bool reachEventCB; bool reachInstCB; bool reachInstrumentCB; bool reachCB2; }; static QBDI::VMAction allowedNewBlock(QBDI::VMInstanceRef vm, const QBDI::VMState *state, QBDI::GPRState *, QBDI::FPRState *, void *data_) { MoveCallbackStruct *data = static_cast<MoveCallbackStruct *>(data_); CHECK(data->expectedRef == vm); CHECK( (data->allowedNewBlock or ((state->event & QBDI::BASIC_BLOCK_NEW) == 0))); data->reachEventCB = true; return QBDI::VMAction::CONTINUE; } static std::vector<QBDI::InstrRuleDataCBK> instrumentCopyCB(QBDI::VMInstanceRef vm, const QBDI::InstAnalysis *inst, void *data_) { MoveCallbackStruct *data = static_cast<MoveCallbackStruct *>(data_); CHECK(data->expectedRef == vm); CHECK(data->allowedNewBlock); data->reachInstrumentCB = true; return {}; } static QBDI::VMAction verifyVMRef(QBDI::VMInstanceRef vm, QBDI::GPRState *, QBDI::FPRState *, void *data_) { MoveCallbackStruct *data = static_cast<MoveCallbackStruct *>(data_); CHECK(data->expectedRef == vm); data->reachInstCB = true; return QBDI::VMAction::CONTINUE; } static QBDI::VMAction verifyCB2(QBDI::VMInstanceRef vm, QBDI::GPRState *, QBDI::FPRState *, void *data_) { MoveCallbackStruct *data = static_cast<MoveCallbackStruct *>(data_); CHECK(data->expectedRef == vm); data->reachCB2 = true; return QBDI::VMAction::CONTINUE; } TEST_CASE("VMTest-MoveConstructor") { APITest vm1_; std::unique_ptr<QBDI::VM> vm1 = std::make_unique<QBDI::VM>(vm1_.vm); QBDI::VM *vm = vm1.get(); MoveCallbackStruct data{vm, true, false, false, false, false}; bool instrumented = vm->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); vm->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data); vm->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data); vm->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data); QBDI::rword retvalue; QBDI_DEBUG("Execute dummyFun1 with the original VM"); vm->call(&retvalue, (QBDI::rword)dummyFun1, {350}); REQUIRE(retvalue == 350); REQUIRE(data.reachEventCB); REQUIRE(data.reachInstCB); REQUIRE(data.reachInstrumentCB); data.reachEventCB = false; data.reachInstCB = false; data.reachInstrumentCB = false; data.allowedNewBlock = false; REQUIRE(vm == data.expectedRef); // move vm QBDI_DEBUG("Move the VM"); QBDI::VM movedVM(std::move(*vm)); vm = nullptr; vm1.reset(); REQUIRE(vm1.get() == nullptr); REQUIRE(data.expectedRef != &movedVM); data.expectedRef = &movedVM; QBDI_DEBUG("Execute with the moved VM"); movedVM.call(&retvalue, (QBDI::rword)dummyFun1, {780}); REQUIRE(retvalue == 780); REQUIRE(data.reachEventCB); REQUIRE(data.reachInstCB); REQUIRE_FALSE(data.reachInstrumentCB); data.allowedNewBlock = true; movedVM.precacheBasicBlock((QBDI::rword)dummyFun0); REQUIRE(data.reachInstrumentCB); } TEST_CASE("VMTest-CopyConstructor") { APITest vm1; QBDI::VM *vm = &vm1.vm; MoveCallbackStruct data{vm, true, false, false, false, false}; bool instrumented = vm->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); vm->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data); vm->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data); vm->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data); QBDI::rword retvalue; QBDI_DEBUG("Execute dummyFun1 with the original VM"); vm->call(&retvalue, (QBDI::rword)dummyFun1, {350}); REQUIRE(retvalue == 350); REQUIRE(data.reachEventCB); REQUIRE(data.reachInstCB); REQUIRE(data.reachInstrumentCB); data.reachEventCB = false; data.reachInstCB = false; data.reachInstrumentCB = false; data.allowedNewBlock = false; // copy vm QBDI_DEBUG("Copy the VM"); QBDI::VM movedVM(*vm); REQUIRE(data.expectedRef != &movedVM); QBDI_DEBUG("Execute second time with the original VM"); vm->call(&retvalue, (QBDI::rword)dummyFun1, {620}); REQUIRE(retvalue == 620); REQUIRE(data.reachEventCB); REQUIRE(data.reachInstCB); REQUIRE_FALSE(data.reachInstrumentCB); data.reachEventCB = false; data.reachInstCB = false; data.reachInstrumentCB = false; data.allowedNewBlock = true; data.expectedRef = &movedVM; QBDI_DEBUG("Execute with the copied VM"); movedVM.call(&retvalue, (QBDI::rword)dummyFun1, {780}); REQUIRE(retvalue == 780); REQUIRE(data.reachEventCB); REQUIRE(data.reachInstCB); REQUIRE(data.reachInstrumentCB); } TEST_CASE("VMTest-MoveAssignmentOperator") { APITest vm1__; APITest vm2__; std::unique_ptr<QBDI::VM> vm1_ = std::make_unique<QBDI::VM>(vm1__.vm); std::unique_ptr<QBDI::VM> vm2_ = std::make_unique<QBDI::VM>(vm2__.vm); QBDI::VM *vm1 = vm1_.get(); QBDI::VM *vm2 = vm2_.get(); REQUIRE(vm1 != vm2); MoveCallbackStruct data1{vm1, true, false, false, false, false}; MoveCallbackStruct data2{vm2, true, false, false, false, false}; bool instrumented = vm1->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); instrumented = vm2->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); vm1->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data1); vm1->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data1); vm1->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data1); vm2->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data2); vm2->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data2); vm2->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data2); QBDI::rword retvalue; vm1->call(&retvalue, (QBDI::rword)dummyFun1, {350}); REQUIRE(retvalue == 350); REQUIRE(data1.reachEventCB); REQUIRE(data1.reachInstCB); REQUIRE(data1.reachInstrumentCB); data1.reachEventCB = false; data1.reachInstCB = false; data1.reachInstrumentCB = false; data1.allowedNewBlock = false; vm2->call(&retvalue, (QBDI::rword)dummyFun1, {670}); REQUIRE(retvalue == 670); REQUIRE(data2.reachEventCB); REQUIRE(data2.reachInstCB); REQUIRE(data2.reachInstrumentCB); data2.reachEventCB = false; data2.reachInstCB = false; data2.reachInstrumentCB = false; data2.allowedNewBlock = false; data1.expectedRef = vm2; data2.expectedRef = nullptr; // move vm *vm2 = std::move(*vm1); vm1 = nullptr; vm1_.reset(); REQUIRE(vm1_.get() == nullptr); vm2->call(&retvalue, (QBDI::rword)dummyFun1, {780}); REQUIRE(retvalue == 780); REQUIRE(data1.reachEventCB); REQUIRE(data1.reachInstCB); REQUIRE_FALSE(data1.reachInstrumentCB); REQUIRE_FALSE(data2.reachEventCB); REQUIRE_FALSE(data2.reachInstCB); REQUIRE_FALSE(data2.reachInstrumentCB); data1.allowedNewBlock = true; vm2->precacheBasicBlock((QBDI::rword)dummyFun0); REQUIRE(data1.reachInstrumentCB); } TEST_CASE("VMTest-CopyAssignmentOperator") { APITest vm1_; APITest vm2_; QBDI::VM *vm1 = &vm1_.vm; QBDI::VM *vm2 = &vm2_.vm; REQUIRE(vm1 != vm2); MoveCallbackStruct data1{vm1, true, false, false, false, false}; MoveCallbackStruct data2{vm2, true, false, false, false, false}; bool instrumented = vm1->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); instrumented = vm2->addInstrumentedModuleFromAddr((QBDI::rword)&dummyFunCall); REQUIRE(instrumented); vm1->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data1); vm1->addCodeCB(QBDI::InstPosition::POSTINST, verifyCB2, &data1); vm1->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data1); vm1->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data1); vm2->addCodeCB(QBDI::InstPosition::POSTINST, verifyVMRef, &data2); vm2->addInstrRule(instrumentCopyCB, QBDI::ANALYSIS_INSTRUCTION, &data2); vm2->addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, allowedNewBlock, &data2); QBDI::rword retvalue; vm1->call(&retvalue, (QBDI::rword)dummyFun1, {350}); REQUIRE(retvalue == 350); REQUIRE(data1.reachEventCB); REQUIRE(data1.reachInstCB); REQUIRE(data1.reachInstrumentCB); REQUIRE(data1.reachCB2); data1.reachEventCB = false; data1.reachInstCB = false; data1.reachInstrumentCB = false; data1.allowedNewBlock = false; data1.reachCB2 = false; vm2->call(&retvalue, (QBDI::rword)dummyFun1, {670}); REQUIRE(retvalue == 670); REQUIRE(data2.reachEventCB); REQUIRE(data2.reachInstCB); REQUIRE(data2.reachInstrumentCB); REQUIRE_FALSE(data2.reachCB2); data2.reachEventCB = false; data2.reachInstCB = false; data2.reachInstrumentCB = false; data2.allowedNewBlock = false; data2.expectedRef = nullptr; // copy vm *vm2 = *vm1; vm1->call(&retvalue, (QBDI::rword)dummyFun1, {780}); REQUIRE(retvalue == 780); REQUIRE(data1.reachEventCB); REQUIRE(data1.reachInstCB); REQUIRE_FALSE(data1.reachInstrumentCB); REQUIRE(data1.reachCB2); REQUIRE_FALSE(data2.reachEventCB); REQUIRE_FALSE(data2.reachInstCB); REQUIRE_FALSE(data2.reachCB2); REQUIRE_FALSE(data2.reachInstrumentCB); data1.reachEventCB = false; data1.reachInstCB = false; data1.reachInstrumentCB = false; data1.allowedNewBlock = true; data1.expectedRef = vm2; data1.reachCB2 = false; vm2->call(&retvalue, (QBDI::rword)dummyFun1, {567}); REQUIRE(retvalue == 567); REQUIRE(data1.reachEventCB); REQUIRE(data1.reachInstCB); REQUIRE(data1.reachInstrumentCB); REQUIRE(data1.reachCB2); REQUIRE_FALSE(data2.reachEventCB); REQUIRE_FALSE(data2.reachInstCB); REQUIRE_FALSE(data2.reachCB2); REQUIRE_FALSE(data2.reachInstrumentCB); } TEST_CASE_METHOD(APITest, "VMTest-VMEventLambda-VMcpy") { QBDI::rword retval; bool cbCalled = false; QBDI::VMCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, const QBDI::VMState *, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addVMEventCB( QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, cbk); // copy constructor QBDI::VM vm2 = vm; // copy operator QBDI::VM vm3; vm3.precacheBasicBlock((QBDI::rword)dummyFun0); vm3 = vm; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm2.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm3.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstrRuleCbLambda-VMCpy") { QBDI::rword retval; bool cbCalled = false; vm.addInstrRule( [&cbCalled](QBDI::VMInstanceRef, const QBDI::InstAnalysis *) -> std::vector<QBDI::InstrRuleDataCBK> { cbCalled = true; return {}; }, QBDI::ANALYSIS_INSTRUCTION); // copy constructor QBDI::VM vm2 = vm; // copy operator QBDI::VM vm3; vm3.precacheBasicBlock((QBDI::rword)dummyFun0); vm3 = vm; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm2.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm3.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-VMCpy") { QBDI::rword retval; bool cbCalled = false; vm.addCodeCB( QBDI::InstPosition::PREINST, [&cbCalled](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }); // copy constructor QBDI::VM vm2 = vm; // copy operator QBDI::VM vm3; vm3.precacheBasicBlock((QBDI::rword)dummyFun0); vm3 = vm; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm2.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm3.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); } TEST_CASE_METHOD(APITest, "VMTest-VMEventLambda") { QBDI::rword retval; bool cbCalled = false; QBDI::VMCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, const QBDI::VMState *, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addVMEventCB( QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, cbk); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addVMEventCB(QBDI::SEQUENCE_ENTRY | QBDI::SEQUENCE_EXIT | QBDI::BASIC_BLOCK_NEW, std::move(cbk)); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstrRuleCbLambda-addInstrRule") { QBDI::rword retval; bool cbCalled = false; QBDI::InstrRuleCbLambda cbk = [&cbCalled]( QBDI::VMInstanceRef, const QBDI::InstAnalysis *) -> std::vector<QBDI::InstrRuleDataCBK> { cbCalled = true; return {}; }; vm.addInstrRule(cbk, QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addInstrRule(std::move(cbk), QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstrRuleCbLambda-addInstrRuleRange") { QBDI::rword retval; bool cbCalled = false; QBDI::InstrRuleCbLambda cbk = [&cbCalled]( QBDI::VMInstanceRef, const QBDI::InstAnalysis *) -> std::vector<QBDI::InstrRuleDataCBK> { cbCalled = true; return {}; }; vm.addInstrRuleRange((QBDI::rword)dummyFun0, (QBDI::rword)dummyFun0 + 0x100, cbk, QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addInstrRuleRange((QBDI::rword)dummyFun0, (QBDI::rword)dummyFun0 + 0x100, std::move(cbk), QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstrRuleCbLambda-addInstrRuleRangeSet") { QBDI::rword retval; bool cbCalled = false; QBDI::InstrRuleCbLambda cbk = [&cbCalled]( QBDI::VMInstanceRef, const QBDI::InstAnalysis *) -> std::vector<QBDI::InstrRuleDataCBK> { cbCalled = true; return {}; }; QBDI::RangeSet<QBDI::rword> s; s.add({(QBDI::rword)dummyFun0, (QBDI::rword)dummyFun0 + 0x100}); vm.addInstrRuleRangeSet(s, cbk, QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addInstrRuleRangeSet(s, std::move(cbk), QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-addMnemonicCB") { QBDI::rword retval; bool cbCalled = false; QBDI::InstCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addMnemonicCB("*", QBDI::InstPosition::PREINST, cbk); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addMnemonicCB("*", QBDI::InstPosition::PREINST, std::move(cbk)); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-addCodeCB") { QBDI::rword retval; bool cbCalled = false; QBDI::InstCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addCodeCB(QBDI::InstPosition::PREINST, cbk); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addCodeCB(QBDI::InstPosition::PREINST, std::move(cbk)); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-addCodeAddrCB") { QBDI::rword retval; bool cbCalled = false; QBDI::InstCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addCodeAddrCB((QBDI::rword)dummyFun0, QBDI::InstPosition::PREINST, cbk); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addCodeAddrCB((QBDI::rword)dummyFun0, QBDI::InstPosition::PREINST, std::move(cbk)); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-addCodeRangeCB") { QBDI::rword retval; bool cbCalled = false; QBDI::InstCbLambda cbk = [&cbCalled](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; return QBDI::VMAction::CONTINUE; }; vm.addCodeRangeCB((QBDI::rword)dummyFun0, (QBDI::rword)dummyFun0 + 0x100, QBDI::InstPosition::PREINST, cbk); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); cbCalled = false; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); vm.addCodeRangeCB((QBDI::rword)dummyFun0, (QBDI::rword)dummyFun0 + 0x100, QBDI::InstPosition::PREINST, std::move(cbk)); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InstCbLambda-InstrRuleDataCBK") { QBDI::rword retval; bool cbCalled = false; uint32_t count1 = 0; uint32_t count2 = 0; uint32_t *count = &count1; QBDI::InstrRuleCbLambda cbk = [&cbCalled, &count]( QBDI::VMInstanceRef, const QBDI::InstAnalysis *) -> std::vector<QBDI::InstrRuleDataCBK> { return {{QBDI::InstPosition::PREINST, [&cbCalled, count](QBDI::VMInstanceRef, QBDI::GPRState *, QBDI::FPRState *) { cbCalled = true; (*count)++; return QBDI::VMAction::CONTINUE; }}}; }; vm.addInstrRule(cbk, QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); REQUIRE(count1 != 0); REQUIRE(count2 == 0); uint32_t backcount1 = count1; cbCalled = false; count1 = 0; count = &count2; vm.deleteAllInstrumentations(); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(!cbCalled); REQUIRE(count1 == 0); REQUIRE(count2 == 0); vm.addInstrRule(std::move(cbk), QBDI::ANALYSIS_INSTRUCTION); vm.call(&retval, (QBDI::rword)dummyFun0); REQUIRE(retval == (QBDI::rword)42); REQUIRE(cbCalled); REQUIRE(count1 == 0); REQUIRE(count2 == backcount1); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-InvalidInstruction") { auto tc = TestCode["VMTest-InvalidInstruction"]; auto code = tc.code; if (code.empty()) { return; } auto start = (QBDI::rword)code.data(); auto stop = (QBDI::rword)(code.data() + code.size()); QBDI::simulateCall(state, FAKE_RET_ADDR); // Instrument the whole code but only execute what is valid vm.addInstrumentedRange(start, stop); bool ran = vm.run(start, start + tc.size); REQUIRE(ran); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-SelfModifyingCode1") { auto tc = TestCode["VMTest-SelfModifyingCode1"]; auto code = tc.code; if (code.empty()) { return; } auto start = (QBDI::rword)code.data(); auto stop = (QBDI::rword)(code.data() + code.size()); QBDI::simulateCall(state, FAKE_RET_ADDR); vm.addInstrumentedRange(start, stop); bool ran = vm.run(start, FAKE_RET_ADDR); REQUIRE(ran); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)42); SUCCEED(); } TEST_CASE_METHOD(APITest, "VMTest-SelfModifyingCode2") { /** * Test a strategy to handle self modifying code. Add a callback on write in * the current basic block and invalid the cache if so. * */ auto tc = TestCode["VMTest-SelfModifyingCode2"]; auto code = tc.code; if (code.empty()) { return; } auto start = (QBDI::rword)code.data(); auto stop = (QBDI::rword)(code.data() + code.size()); QBDI::simulateCall(state, FAKE_RET_ADDR); vm.addInstrumentedRange(start, stop); QBDI::RangeSet<QBDI::rword> instrumentedRange{}; QBDI::Range<QBDI::rword> currentSeq{0, 0}; // set the current sequence vm.addVMEventCB(QBDI::VMEvent::SEQUENCE_ENTRY, [&instrumentedRange, &currentSeq]( QBDI::VMInstanceRef vm, const QBDI::VMState *vmState, QBDI::GPRState *, QBDI::FPRState *) { currentSeq = {vmState->sequenceStart, vmState->sequenceEnd}; instrumentedRange.add(currentSeq); return QBDI::VMAction::CONTINUE; }); // Detect self modifing code in already cached code vm.addMemAccessCB( QBDI::MemoryAccessType::MEMORY_WRITE, [&instrumentedRange, &currentSeq](QBDI::VMInstanceRef vm, QBDI::GPRState *, QBDI::FPRState *) { for (const auto &acc : vm->getInstMemoryAccess()) { if ((acc.type & QBDI::MemoryAccessType::MEMORY_WRITE) == 0) { continue; } if ((acc.flags & QBDI::MemoryAccessFlags::MEMORY_UNKNOWN_SIZE) != 0) { continue; } if (instrumentedRange.overlaps( {acc.accessAddress, acc.accessAddress + acc.size})) { // the access override a code address, clear the cache vm->clearCache(acc.accessAddress, acc.accessAddress + acc.size); // if the access is in the current sequence, schedule // the clear now if (currentSeq.overlaps( {acc.accessAddress, acc.accessAddress + acc.size})) { return QBDI::VMAction::BREAK_TO_VM; } } } return QBDI::VMAction::CONTINUE; }); bool ran = vm.run(start, FAKE_RET_ADDR); REQUIRE(ran); QBDI::rword ret = QBDI_GPR_GET(state, QBDI::REG_RETURN); REQUIRE(ret == (QBDI::rword)42); SUCCEED(); }
31.173493
80
0.644837
gmh5225
d104354102fd114bdc29eff8f74902da42a0cb51
6,110
cpp
C++
winsdkfb/winsdkfb/winsdkfb.Shared/FacebookProfilePictureControl.xaml.cpp
omer-ispl/winsdkfb1
e3bcd1d1e49e5ff94e6a9c971e4d8a9c82fad93b
[ "MIT" ]
197
2015-07-14T22:33:14.000Z
2019-05-05T15:26:15.000Z
winsdkfb/winsdkfb/winsdkfb.Shared/FacebookProfilePictureControl.xaml.cpp
omer-ispl/winsdkfb1
e3bcd1d1e49e5ff94e6a9c971e4d8a9c82fad93b
[ "MIT" ]
209
2015-07-15T14:49:48.000Z
2019-02-15T14:39:48.000Z
winsdkfb/winsdkfb/winsdkfb.Shared/FacebookProfilePictureControl.xaml.cpp
omer-ispl/winsdkfb1
e3bcd1d1e49e5ff94e6a9c971e4d8a9c82fad93b
[ "MIT" ]
115
2015-07-15T06:57:34.000Z
2019-01-12T08:55:15.000Z
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** // // ProfilePictureControl.xaml.cpp // Implementation of the ProfilePictureControl class // #include "pch.h" #include "FacebookProfilePictureControl.xaml.h" #include "FBSingleValue.h" #include <string> using namespace concurrency; using namespace winsdkfb; using namespace winsdkfb::Graph; using namespace Platform; using namespace Windows::ApplicationModel::Core; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::Storage; using namespace Windows::Storage::Streams; using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Controls::Primitives; using namespace Windows::UI::Xaml::Data; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; using namespace Windows::UI::Xaml::Media::Imaging; using namespace Windows::UI::Xaml::Interop; // At least enough characters to hold a string representation of 32-bit int, // in decimal. Used for width and height of profile picture. #define INT_STRING_LENGTH 16 #define ProfilePictureSillhouetteImage \ "ms-appx:///winsdkfb/Images/fb_blank_profile_portrait.png" DependencyProperty^ ProfilePictureControl::_userIdProperty = DependencyProperty::Register( L"UserId", TypeName(String::typeid), TypeName(ProfilePictureControl::typeid), ref new PropertyMetadata( nullptr, ref new PropertyChangedCallback(&ProfilePictureControl::UserIdPropertyChanged))); ProfilePictureControl::ProfilePictureControl() : _CropMode(CroppingType::Square) { InitializeComponent(); Update(); } void ProfilePictureControl::UserIdPropertyChanged(DependencyObject^ d, DependencyPropertyChangedEventArgs^ e) { ProfilePictureControl^ instance = static_cast<ProfilePictureControl^>(d); instance->UserId = static_cast<String^>(e->NewValue); } String^ ProfilePictureControl::UserId::get() { return safe_cast<String^>(GetValue(_userIdProperty)); } void ProfilePictureControl::UserId::set(String^ value) { SetValue(_userIdProperty, value); Update(); } CroppingType ProfilePictureControl::CropMode::get() { return _CropMode; } void ProfilePictureControl::CropMode::set(CroppingType value) { if (_CropMode != value) { _CropMode = value; Update(); } } void ProfilePictureControl::SetImageSourceFromUserId() { int height = -1; // specify height == width for square. If user wants original aspect ratio, // only specify width, and FB graph API will scale and preserve ratio. if (CropMode == CroppingType::Square) { height = (int)this->Width; } create_task(GetProfilePictureInfo((int)this->Width, height)) .then([=](FBResult^ result) { FBProfilePicture^ info = nullptr; if (result && (result->Succeeded)) { info = static_cast<FBProfilePicture^>(result->Object); } return info; }) .then([=](FBProfilePicture^ info) { Windows::UI::Core::CoreWindow^ wnd = CoreApplication::MainView->CoreWindow; if (wnd) { wnd->Dispatcher->RunAsync(CoreDispatcherPriority::Low, ref new DispatchedHandler([info, this]() { if (info) { ProfilePic->Stretch = Stretch::Uniform; ProfilePic->Source = ref new BitmapImage(ref new Uri(info->Url)); } })); } }); } void ProfilePictureControl::SetImageSourceFromResource() { Windows::UI::Core::CoreWindow^ wnd = CoreApplication::MainView->CoreWindow; if (wnd) { wnd->Dispatcher->RunAsync(CoreDispatcherPriority::Low, ref new DispatchedHandler([=]() { Uri^ u = ref new Uri(ProfilePictureSillhouetteImage); ProfilePic->Stretch = Stretch::Uniform; ProfilePic->Source = ref new BitmapImage(u); })); } } void ProfilePictureControl::Update() { if (UserId) { SetImageSourceFromUserId(); } else { SetImageSourceFromResource(); } } task<FBResult^> ProfilePictureControl::GetProfilePictureInfo( int width, int height ) { PropertySet^ parameters = ref new PropertySet(); wchar_t whBuffer[INT_STRING_LENGTH]; task<FBResult^> result; parameters->Insert(L"redirect", L"false"); if (width > -1) { if (!_itow_s(width, whBuffer, INT_STRING_LENGTH, 10)) { String^ Value = ref new String(whBuffer); parameters->Insert(L"width", Value); } } if (height > -1) { if (!_itow_s(height, whBuffer, INT_STRING_LENGTH, 10)) { String^ Value = ref new String(whBuffer); parameters->Insert(L"height", Value); } } if (UserId) { String^ path = UserId + L"/picture"; FBSingleValue^ value = ref new FBSingleValue( path, parameters, ref new FBJsonClassFactory([](String^ JsonText) -> Object^ { return FBProfilePicture::FromJson(JsonText); })); result = create_task(value->GetAsync()); } return result; }
28.287037
109
0.642881
omer-ispl
d104c774952e0b052fc9eb7f4410b13c11603495
1,196
inl
C++
Breakout/MacOS-Demo/Glm/gtx/vector_access.inl
CoderYQ/LearnOpenGL
2fbb251d939df0d9d23d92346aa5d46a0ba6f91f
[ "MIT" ]
455
2015-02-04T01:39:12.000Z
2022-03-18T17:28:34.000Z
Breakout/MacOS-Demo/Glm/gtx/vector_access.inl
CoderYQ/LearnOpenGL
2fbb251d939df0d9d23d92346aa5d46a0ba6f91f
[ "MIT" ]
9
2016-09-12T05:00:23.000Z
2021-05-14T18:38:51.000Z
Breakout/MacOS-Demo/Glm/gtx/vector_access.inl
CoderYQ/LearnOpenGL
2fbb251d939df0d9d23d92346aa5d46a0ba6f91f
[ "MIT" ]
117
2015-01-30T10:13:54.000Z
2022-03-08T03:46:42.000Z
/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2006-01-16 // Updated : 2008-10-07 // Licence : This source is under MIT License // File : glm/gtx/vector_access.inl /////////////////////////////////////////////////////////////////////////////////////////////////// namespace glm { template <typename valType> GLM_FUNC_QUALIFIER void set ( detail::tvec2<valType>& v, valType const & x, valType const & y ) { v.x = x; v.y = y; } template <typename valType> GLM_FUNC_QUALIFIER void set ( detail::tvec3<valType>& v, valType const & x, valType const & y, valType const & z ) { v.x = x; v.y = y; v.z = z; } template <typename valType> GLM_FUNC_QUALIFIER void set ( detail::tvec4<valType>& v, valType const & x, valType const & y, valType const & z, valType const & w ) { v.x = x; v.y = y; v.z = z; v.w = w; } }//namespace glm
22.148148
100
0.43311
CoderYQ
d104e822805402d917967d9d57602ed38ab66986
7,577
cpp
C++
test/blockchain/pop/pop_vbk_block_tree_test.cpp
overcookedpanda/alt-integration-cpp
7932e79a77d9514ca0e0354636e77fba1845d707
[ "MIT" ]
null
null
null
test/blockchain/pop/pop_vbk_block_tree_test.cpp
overcookedpanda/alt-integration-cpp
7932e79a77d9514ca0e0354636e77fba1845d707
[ "MIT" ]
null
null
null
test/blockchain/pop/pop_vbk_block_tree_test.cpp
overcookedpanda/alt-integration-cpp
7932e79a77d9514ca0e0354636e77fba1845d707
[ "MIT" ]
null
null
null
#include <gtest/gtest.h> #include <exception> #include <memory> #include "util/pop_test_fixture.hpp" #include "veriblock/blockchain/pop/fork_resolution.hpp" using namespace altintegration; struct VbkBlockTreeTestFixture : public ::testing::Test { MockMiner popminer; void endorseVBK(size_t height) { auto* endorsedIndex = popminer.vbk().getBestChain()[(int32_t)height]; ASSERT_TRUE(endorsedIndex); auto btctx = popminer.createBtcTxEndorsingVbkBlock(*endorsedIndex->header); auto btccontaining = popminer.mineBtcBlocks(1); auto vbkpoptx = popminer.createVbkPopTxEndorsingVbkBlock( *btccontaining->header, btctx, *endorsedIndex->header, popminer.getBtcParams().getGenesisBlock().getHash()); popminer.mineVbkBlocks(1); } VbkPopTx generatePopTx(const VbkBlock& endorsedBlock) { auto Btctx = popminer.createBtcTxEndorsingVbkBlock(endorsedBlock); auto* btcBlockTip = popminer.mineBtcBlocks(1); return popminer.createVbkPopTxEndorsingVbkBlock( *btcBlockTip->header, Btctx, endorsedBlock, popminer.getBtcParams().getGenesisBlock().getHash()); } }; TEST_F(VbkBlockTreeTestFixture, FilterChainForForkResolution) { using namespace internal; size_t numVbkBlocks = 200ull; ASSERT_EQ(popminer.vbk().getComparator().getIndex(), popminer.vbk().getBestChain().tip()); popminer.mineVbkBlocks(numVbkBlocks); auto& best = popminer.vbk().getBestChain(); ASSERT_EQ(best.blocksCount(), numVbkBlocks + 1); endorseVBK(176); endorseVBK(166); endorseVBK(169); endorseVBK(143); endorseVBK(143); endorseVBK(87); endorseVBK(87); endorseVBK(91); endorseVBK(91); ASSERT_EQ(best.blocksCount(), numVbkBlocks + 10); popminer.mineVbkBlocks(1); ASSERT_EQ(best.blocksCount(), numVbkBlocks + 11); auto protoContext = getProtoKeystoneContext(best, popminer.btc(), popminer.getVbkParams()); EXPECT_EQ(protoContext.size(), numVbkBlocks / popminer.getVbkParams().getKeystoneInterval()); EXPECT_EQ(protoContext[0].blockHeight, 20); EXPECT_EQ(protoContext[0].referencedByBlocks.size(), 0); EXPECT_EQ(protoContext[1].blockHeight, 40); EXPECT_EQ(protoContext[1].referencedByBlocks.size(), 0); EXPECT_EQ(protoContext[2].blockHeight, 60); EXPECT_EQ(protoContext[2].referencedByBlocks.size(), 0); EXPECT_EQ(protoContext[3].blockHeight, 80); EXPECT_EQ(protoContext[3].referencedByBlocks.size(), 4); EXPECT_EQ(protoContext[4].blockHeight, 100); EXPECT_EQ(protoContext[4].referencedByBlocks.size(), 0); EXPECT_EQ(protoContext[5].blockHeight, 120); EXPECT_EQ(protoContext[5].referencedByBlocks.size(), 0); EXPECT_EQ(protoContext[6].blockHeight, 140); EXPECT_EQ(protoContext[6].referencedByBlocks.size(), 2); EXPECT_EQ(protoContext[7].blockHeight, 160); EXPECT_EQ(protoContext[7].referencedByBlocks.size(), 3); auto keystoneContext = getKeystoneContext(protoContext, popminer.btc()); EXPECT_EQ(keystoneContext.size(), numVbkBlocks / popminer.getVbkParams().getKeystoneInterval()); auto max = std::numeric_limits<int32_t>::max(); EXPECT_EQ(keystoneContext[0].blockHeight, 20); EXPECT_EQ(keystoneContext[0].firstBlockPublicationHeight, max); EXPECT_EQ(keystoneContext[1].blockHeight, 40); EXPECT_EQ(keystoneContext[1].firstBlockPublicationHeight, max); EXPECT_EQ(keystoneContext[2].blockHeight, 60); EXPECT_EQ(keystoneContext[2].firstBlockPublicationHeight, max); EXPECT_EQ(keystoneContext[3].blockHeight, 80); EXPECT_EQ(keystoneContext[3].firstBlockPublicationHeight, 6); EXPECT_EQ(keystoneContext[4].blockHeight, 100); EXPECT_EQ(keystoneContext[4].firstBlockPublicationHeight, max); EXPECT_EQ(keystoneContext[5].blockHeight, 120); EXPECT_EQ(keystoneContext[5].firstBlockPublicationHeight, max); EXPECT_EQ(keystoneContext[6].blockHeight, 140); EXPECT_EQ(keystoneContext[6].firstBlockPublicationHeight, 4); EXPECT_EQ(keystoneContext[7].blockHeight, 160); EXPECT_EQ(keystoneContext[7].firstBlockPublicationHeight, 1); } TEST_F(VbkBlockTreeTestFixture, addAllPayloads_failure_test) { // start with 30 BTC blocks auto* btcBlockTip = popminer.mineBtcBlocks(30); ASSERT_EQ(btcBlockTip->getHash(), popminer.btc().getBestChain().tip()->getHash()); // start with 65 VBK blocks auto* vbkBlockTip = popminer.mineVbkBlocks(65); ASSERT_EQ(popminer.vbk().getBestChain().tip()->getHash(), vbkBlockTip->getHash()); // Make 5 endorsements valid endorsements auto* endorsedVbkBlock1 = vbkBlockTip->getAncestor(vbkBlockTip->height - 11); ASSERT_EQ(endorsedVbkBlock1->endorsedBy.size(), 0); auto* endorsedVbkBlock2 = vbkBlockTip->getAncestor(vbkBlockTip->height - 12); ASSERT_EQ(endorsedVbkBlock2->endorsedBy.size(), 0); auto* endorsedVbkBlock3 = vbkBlockTip->getAncestor(vbkBlockTip->height - 13); ASSERT_EQ(endorsedVbkBlock3->endorsedBy.size(), 0); auto* endorsedVbkBlock4 = vbkBlockTip->getAncestor(vbkBlockTip->height - 14); ASSERT_EQ(endorsedVbkBlock4->endorsedBy.size(), 0); auto* endorsedVbkBlock5 = vbkBlockTip->getAncestor(vbkBlockTip->height - 15); ASSERT_EQ(endorsedVbkBlock5->endorsedBy.size(), 0); generatePopTx(*endorsedVbkBlock1->header); generatePopTx(*endorsedVbkBlock2->header); generatePopTx(*endorsedVbkBlock3->header); generatePopTx(*endorsedVbkBlock4->header); generatePopTx(*endorsedVbkBlock5->header); ASSERT_EQ(popminer.vbkmempool.size(), 5); vbkBlockTip = popminer.mineVbkBlocks(1); ASSERT_EQ(popminer.vbk().getBestChain().tip()->getHash(), vbkBlockTip->getHash()); // check that we have endorsements to the VbBlocks ASSERT_EQ(endorsedVbkBlock1->endorsedBy.size(), 1); ASSERT_EQ(endorsedVbkBlock2->endorsedBy.size(), 1); ASSERT_EQ(endorsedVbkBlock3->endorsedBy.size(), 1); ASSERT_EQ(endorsedVbkBlock4->endorsedBy.size(), 1); ASSERT_EQ(endorsedVbkBlock5->endorsedBy.size(), 1); // mine 40 Vbk blocks vbkBlockTip = popminer.mineVbkBlocks(40); ASSERT_EQ(popminer.vbk().getBestChain().tip()->getHash(), vbkBlockTip->getHash()); // Make 5 endorsements valid endorsements endorsedVbkBlock1 = vbkBlockTip->getAncestor(vbkBlockTip->height - 11); ASSERT_EQ(endorsedVbkBlock1->endorsedBy.size(), 0); endorsedVbkBlock2 = vbkBlockTip->getAncestor(vbkBlockTip->height - 12); ASSERT_EQ(endorsedVbkBlock2->endorsedBy.size(), 0); endorsedVbkBlock3 = vbkBlockTip->getAncestor(vbkBlockTip->height - 13); ASSERT_EQ(endorsedVbkBlock3->endorsedBy.size(), 0); endorsedVbkBlock4 = vbkBlockTip->getAncestor(vbkBlockTip->height - 14); ASSERT_EQ(endorsedVbkBlock4->endorsedBy.size(), 0); endorsedVbkBlock5 = vbkBlockTip->getAncestor(vbkBlockTip->height - 15); ASSERT_EQ(endorsedVbkBlock5->endorsedBy.size(), 0); generatePopTx(*endorsedVbkBlock1->header); generatePopTx(*endorsedVbkBlock2->header); generatePopTx(*endorsedVbkBlock3->header); generatePopTx(*endorsedVbkBlock4->header); generatePopTx(*endorsedVbkBlock5->header); ASSERT_EQ(popminer.vbkmempool.size(), 5); // corrupt one of the endorsement std::vector<uint8_t> new_hash = {1, 2, 3}; popminer.vbkmempool[0].blockOfProof.previousBlock = uint256(new_hash); EXPECT_THROW(popminer.mineVbkBlocks(1), std::domain_error); // check that all endorsement have not been applied ASSERT_EQ(endorsedVbkBlock1->endorsedBy.size(), 0); ASSERT_EQ(endorsedVbkBlock2->endorsedBy.size(), 0); ASSERT_EQ(endorsedVbkBlock3->endorsedBy.size(), 0); ASSERT_EQ(endorsedVbkBlock4->endorsedBy.size(), 0); ASSERT_EQ(endorsedVbkBlock5->endorsedBy.size(), 0); }
40.089947
79
0.749901
overcookedpanda
d105bba5b5a279a10438e98316d36bba376f6309
7,084
cpp
C++
shadow/operators/kernels/pooling.cpp
junluan/shadow
067d1c51d7c38bc1c985008a2e2e1599bbf11a8c
[ "Apache-2.0" ]
20
2017-07-04T11:22:47.000Z
2022-01-16T03:58:32.000Z
shadow/operators/kernels/pooling.cpp
junluan/shadow
067d1c51d7c38bc1c985008a2e2e1599bbf11a8c
[ "Apache-2.0" ]
2
2017-12-03T13:07:39.000Z
2021-01-13T11:11:52.000Z
shadow/operators/kernels/pooling.cpp
junluan/shadow
067d1c51d7c38bc1c985008a2e2e1599bbf11a8c
[ "Apache-2.0" ]
10
2017-09-30T05:06:30.000Z
2020-11-13T05:43:44.000Z
#include "pooling.hpp" namespace Shadow { namespace Vision { template <> void Pooling2D<DeviceType::kCPU, float>(const float* in_data, const VecInt& in_shape, int pool_type, int kernel_size_h, int kernel_size_w, int stride_h, int stride_w, int pad_h, int pad_w, const VecInt& out_shape, float* out_data, Context* context) { int batch = in_shape[0], channel = in_shape[1]; int in_h = in_shape[2], in_w = in_shape[3]; int out_h = out_shape[2], out_w = out_shape[3]; for (int b = 0; b < batch; ++b) { for (int c = 0; c < channel; ++c, in_data += in_h * in_w) { for (int h = 0; h < out_h; ++h) { for (int w = 0; w < out_w; ++w) { int hstart = h * stride_h - pad_h; int wstart = w * stride_w - pad_w; int hend = std::min(hstart + kernel_size_h, in_h + pad_h); int wend = std::min(wstart + kernel_size_w, in_w + pad_w); int pool_size = (hend - hstart) * (wend - wstart); hstart = std::max(hstart, 0), wstart = std::max(wstart, 0); hend = std::min(hend, in_h), wend = std::min(wend, in_w); auto max_val = std::numeric_limits<float>::lowest(), sum_val = 0.f; for (int ph = hstart; ph < hend; ++ph) { for (int pw = wstart; pw < wend; ++pw) { auto value = in_data[ph * in_w + pw]; max_val = std::max(max_val, value); sum_val += value; } } *out_data++ = (pool_type == 0) ? max_val : sum_val / pool_size; } } } } } template <> void Pooling3D<DeviceType::kCPU, float>( const float* in_data, const VecInt& in_shape, int pool_type, int kernel_size_d, int kernel_size_h, int kernel_size_w, int stride_d, int stride_h, int stride_w, int pad_d, int pad_h, int pad_w, const VecInt& out_shape, float* out_data, Context* context) { int batch = in_shape[0], channel = in_shape[1]; int in_d = in_shape[2], in_h = in_shape[3], in_w = in_shape[4]; int out_d = out_shape[2], out_h = out_shape[3], out_w = out_shape[4]; for (int b = 0; b < batch; ++b) { for (int c = 0; c < channel; ++c, in_data += in_d * in_h * in_w) { for (int d = 0; d < out_d; ++d) { for (int h = 0; h < out_h; ++h) { for (int w = 0; w < out_w; ++w) { int dstart = d * stride_d - pad_d; int hstart = h * stride_h - pad_h; int wstart = w * stride_w - pad_w; int dend = std::min(dstart + kernel_size_d, in_d + pad_d); int hend = std::min(hstart + kernel_size_h, in_h + pad_h); int wend = std::min(wstart + kernel_size_w, in_w + pad_w); int pool_size = (dend - dstart) * (hend - hstart) * (wend - wstart); dstart = std::max(dstart, 0), hstart = std::max(hstart, 0), wstart = std::max(wstart, 0); dend = std::min(dend, in_d), hend = std::min(hend, in_h), wend = std::min(wend, in_w); auto max_val = std::numeric_limits<float>::lowest(), sum_val = 0.f; for (int pd = dstart; pd < dend; ++pd) { for (int ph = hstart; ph < hend; ++ph) { for (int pw = wstart; pw < wend; ++pw) { auto value = in_data[(pd * in_h + ph) * in_w + pw]; max_val = std::max(max_val, value); sum_val += value; } } } *out_data++ = (pool_type == 0) ? max_val : sum_val / pool_size; } } } } } } } // namespace Vision } // namespace Shadow namespace Shadow { REGISTER_OP_KERNEL_DEFAULT(PoolingCPU, PoolingKernelDefault<DeviceType::kCPU>); #if defined(USE_DNNL) class PoolingKernelDNNL : public PoolingKernel { public: PoolingKernelDNNL() { default_kernel_ = std::make_shared<PoolingKernelDefault<DeviceType::kCPU>>(); } void Run(const std::shared_ptr<Blob>& input, std::shared_ptr<Blob>& output, Workspace* ws, int pool_type, int kernel_size_h, int kernel_size_w, int stride_h, int stride_w, int pad_h, int pad_w, bool full_pooling) override { if (full_pooling) { default_kernel_->Run(input, output, ws, pool_type, kernel_size_h, kernel_size_w, stride_h, stride_w, pad_h, pad_w, full_pooling); } else { const auto& src_desc = idnnl::create_memory_desc<float>( input->shape(), dnnl::memory::format_tag::nchw); const auto& dst_desc = idnnl::create_memory_desc<float>( output->shape(), dnnl::memory::format_tag::nchw); idnnl::common_forward<dnnl::pooling_forward>( ws->Ctx()->dnnl_handle(), dnnl::pooling_forward::desc( dnnl::prop_kind::forward_inference, get_algorithm(pool_type), src_desc, dst_desc, {stride_h, stride_w}, {kernel_size_h, kernel_size_w}, {pad_h, pad_w}, {pad_h, pad_w}), input->data<float>(), output->mutable_data<float>()); } } void Run(const std::shared_ptr<Blob>& input, std::shared_ptr<Blob>& output, Workspace* ws, int pool_type, int kernel_size_d, int kernel_size_h, int kernel_size_w, int stride_d, int stride_h, int stride_w, int pad_d, int pad_h, int pad_w, bool full_pooling) override { if (full_pooling) { default_kernel_->Run(input, output, ws, pool_type, kernel_size_d, kernel_size_h, kernel_size_w, stride_d, stride_h, stride_w, pad_d, pad_h, pad_w, full_pooling); } else { const auto& src_desc = idnnl::create_memory_desc<float>( input->shape(), dnnl::memory::format_tag::ncdhw); const auto& dst_desc = idnnl::create_memory_desc<float>( output->shape(), dnnl::memory::format_tag::ncdhw); idnnl::common_forward<dnnl::pooling_forward>( ws->Ctx()->dnnl_handle(), dnnl::pooling_forward::desc( dnnl::prop_kind::forward_inference, get_algorithm(pool_type), src_desc, dst_desc, {stride_d, stride_h, stride_w}, {kernel_size_d, kernel_size_h, kernel_size_w}, {pad_d, pad_h, pad_w}, {pad_d, pad_h, pad_w}), input->data<float>(), output->mutable_data<float>()); } } DeviceType device_type() const override { return DeviceType::kCPU; } std::string kernel_type() const override { return "DNNL"; } private: static dnnl::algorithm get_algorithm(int pool_type) { switch (pool_type) { case 0: return dnnl::algorithm::pooling_max; case 1: return dnnl::algorithm::pooling_avg_include_padding; default: return dnnl::algorithm::undef; } } std::shared_ptr<PoolingKernelDefault<DeviceType::kCPU>> default_kernel_ = nullptr; }; REGISTER_OP_KERNEL_DNNL(PoolingCPU, PoolingKernelDNNL); #endif } // namespace Shadow
40.022599
80
0.571429
junluan
d1069101a8af09186c744a8c372719a30d026858
13,059
cpp
C++
NanoTest/Source/Nano/Types/TRange.cpp
refnum/Nano
dceb0907061f7845d8a3c662f309ca164e932e6f
[ "BSD-3-Clause" ]
23
2019-11-12T09:31:11.000Z
2021-09-13T08:59:37.000Z
NanoTest/Source/Nano/Types/TRange.cpp
refnum/nano
dceb0907061f7845d8a3c662f309ca164e932e6f
[ "BSD-3-Clause" ]
1
2020-10-30T09:54:12.000Z
2020-10-30T09:54:12.000Z
NanoTest/Source/Nano/Types/TRange.cpp
refnum/Nano
dceb0907061f7845d8a3c662f309ca164e932e6f
[ "BSD-3-Clause" ]
3
2015-09-08T11:00:02.000Z
2017-09-11T05:42:30.000Z
/* NAME: TRange.cpp DESCRIPTION: NRange tests. COPYRIGHT: Copyright (c) 2006-2021, refNum Software 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 copyright holder 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 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. ___________________________________________________________________________ */ //============================================================================= // Includes //----------------------------------------------------------------------------- // Nano #include "NFormat.h" #include "NRange.h" #include "NTestFixture.h" //============================================================================= // Internal Constants //----------------------------------------------------------------------------- static const NRange kTestRange1{0, 5}; static const NRange kTestRange2{3, 7}; static const NRange kTestRange3{3, 4}; //============================================================================= // Fixture //----------------------------------------------------------------------------- NANO_FIXTURE(TRange) { NRange theRange; }; //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "Default") { // Perform the test REQUIRE(theRange.GetLocation() == 0); REQUIRE(theRange.GetSize() == 0); REQUIRE(kNRangeNone.GetLocation() == kNNotFound); REQUIRE(kNRangeNone.GetSize() == 0); REQUIRE(kNRangeAll.GetLocation() == 0); REQUIRE(kNRangeAll.GetSize() == kNNotFound); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "Intersects") { // Perform the test REQUIRE(NRange(4, 3).Intersects(NRange(6, 2))); // 456 ~ 67 = true (after) REQUIRE(!NRange(4, 3).Intersects(NRange(8, 2))); // 456 ~ 89 = false (after gap) REQUIRE(NRange(4, 3).Intersects(NRange(3, 2))); // 456 ~ 34 = true (before) REQUIRE(!NRange(4, 3).Intersects(NRange(1, 2))); // 456 ~ 12 = false (before gap) REQUIRE(!NRange(4, 3).Intersects(NRange(0, 0))); // 456 ~ . = false (empty) REQUIRE(!NRange(4, 3).Intersects(NRange(3, 0))); // 456 ~ . = false (empty) } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "Contains") { // Perform the test REQUIRE(!NRange(4, 3).Contains(3)); // 456 ~ 3 = false (before) REQUIRE(NRange(4, 3).Contains(4)); // 456 ~ 4 = true (first) REQUIRE(NRange(4, 3).Contains(5)); // 456 ~ 5 = true (inside) REQUIRE(NRange(4, 3).Contains(6)); // 456 ~ 6 = true (last) REQUIRE(!NRange(4, 3).Contains(7)); // 456 ~ 7 = false (after) REQUIRE(!NRange(4, 0).Contains(3)); // . ~ 3 = false (never) REQUIRE(!NRange(4, 0).Contains(4)); // . ~ 4 = false (never) REQUIRE(!NRange(4, 0).Contains(5)); // . ~ 5 = false (never) } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "IsMeta") { // Perform the test REQUIRE(!kTestRange1.IsMeta()); REQUIRE(!kTestRange2.IsMeta()); REQUIRE(kNRangeNone.IsMeta()); REQUIRE(kNRangeAll.IsMeta()); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "IsEmpty") { // Perform the test REQUIRE(kNRangeNone.IsEmpty()); REQUIRE(!NRange(4, 3).IsEmpty()); REQUIRE(NRange(4, 0).IsEmpty()); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetLocation") { // Perform the test theRange = kTestRange1; REQUIRE(theRange.GetLocation() == kTestRange1.GetLocation()); theRange.SetLocation(theRange.GetLocation() + 1); REQUIRE(theRange.GetLocation() != kTestRange1.GetLocation()); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "AddOffset") { // Perform the test theRange.SetRange(0, 3); theRange.AddOffset(0); REQUIRE(theRange == NRange(0, 3)); theRange.SetRange(0, 3); theRange.AddOffset(1); REQUIRE(theRange == NRange(1, 3)); theRange.SetRange(0, 3); theRange.AddOffset(2); REQUIRE(theRange == NRange(2, 3)); theRange.SetRange(1, 3); theRange.AddOffset(0); REQUIRE(theRange == NRange(1, 3)); theRange.SetRange(2, 3); theRange.AddOffset(1); REQUIRE(theRange == NRange(3, 3)); theRange.SetRange(3, 3); theRange.AddOffset(2); REQUIRE(theRange == NRange(5, 3)); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetSize") { // Perform the test theRange = kTestRange1; REQUIRE(theRange.GetSize() == kTestRange1.GetSize()); theRange.SetSize(theRange.GetSize() + 1); REQUIRE(theRange.GetSize() != kTestRange1.GetSize()); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "Contents") { // Perform the test REQUIRE(kTestRange1.GetLocation() == 0); REQUIRE(kTestRange1.GetSize() == 5); REQUIRE(kTestRange1.GetPosition(0) == kTestRange1.GetFirst()); REQUIRE(kTestRange1.GetPosition(1) == kTestRange1.GetFirst() + 1); REQUIRE(kTestRange1.GetPosition(2) == kTestRange1.GetFirst() + 2); REQUIRE(kTestRange1.GetFirst() == 0); REQUIRE(kTestRange1.GetLast() == 4); REQUIRE(kTestRange1.GetNext() == 5); // Perform the test REQUIRE(kTestRange2.GetLocation() == 3); REQUIRE(kTestRange2.GetSize() == 7); REQUIRE(kTestRange2.GetPosition(0) == kTestRange2.GetFirst()); REQUIRE(kTestRange2.GetPosition(1) == kTestRange2.GetFirst() + 1); REQUIRE(kTestRange2.GetPosition(2) == kTestRange2.GetFirst() + 2); REQUIRE(kTestRange2.GetFirst() == 3); REQUIRE(kTestRange2.GetLast() == 9); REQUIRE(kTestRange2.GetNext() == 10); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetOffset") { // Perform the test REQUIRE(NRange(0, 3).GetOffset(0) == NRange(0, 3)); REQUIRE(NRange(0, 3).GetOffset(1) == NRange(1, 3)); REQUIRE(NRange(0, 3).GetOffset(2) == NRange(2, 3)); REQUIRE(NRange(1, 3).GetOffset(0) == NRange(1, 3)); REQUIRE(NRange(2, 3).GetOffset(1) == NRange(3, 3)); REQUIRE(NRange(3, 3).GetOffset(2) == NRange(5, 3)); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetUnion") { // Perform the test REQUIRE(NRange(4, 3).GetUnion(NRange(6, 2)) == NRange(4, 4)); // 456 + 67 = 4567 (after) REQUIRE(NRange(4, 3).GetUnion(NRange(8, 2)) == NRange(4, 6)); // 456 + 89 = 456789 (after gap) REQUIRE(NRange(4, 3).GetUnion(NRange(3, 2)) == NRange(3, 4)); // 456 + 34 = 3456 (before) REQUIRE(NRange(4, 3).GetUnion(NRange(1, 2)) == NRange(1, 6)); // 456 + 12 = 123456 (before gap) REQUIRE(NRange(4, 3).GetUnion(NRange(0, 0)) == NRange(4, 3)); // 456 + . = 456 (empty) REQUIRE(NRange(4, 3).GetUnion(NRange(3, 0)) == NRange(4, 3)); // 456 + . = 456 (empty) } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetIntersection") { // Perform the test REQUIRE(NRange(4, 3).GetIntersection(NRange(6, 2)) == NRange(6, 1)); // 456 ~ 67 = 6 (end) REQUIRE(NRange(4, 3).GetIntersection(NRange(8, 2)) == NRange(0, 0)); // 456 ~ 89 = . (after) REQUIRE(NRange(4, 3).GetIntersection(NRange(3, 2)) == NRange(4, 1)); // 456 ~ 34 = 4 (start) REQUIRE(NRange(4, 3).GetIntersection(NRange(1, 2)) == NRange(0, 0)); // 456 ~ 12 = . (before) REQUIRE(NRange(4, 3).GetIntersection(NRange(5, 1)) == NRange(5, 1)); // 456 ~ 5 = 5 (inside) REQUIRE(NRange(4, 3).GetIntersection(NRange(3, 5)) == NRange(4, 3)); // 456 ~ 34567 = 456 (within) REQUIRE(NRange(4, 3).GetIntersection(NRange(1, 0)) == NRange(0, 0)); // 456 ~ . = . (empty) REQUIRE(NRange(0, 0).GetIntersection(NRange(1, 2)) == NRange(0, 0)); // . ~ 12 = . (empty) REQUIRE(NRange(4, 0).GetIntersection(NRange(1, 0)) == NRange(0, 0)); // . ~ . = . (empty) } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "GetNormalized") { // Perform the test theRange = kNRangeNone.GetNormalized(10); REQUIRE((theRange.GetLocation() == 0 && theRange.GetSize() == 0)); // Meta (none) theRange = kNRangeAll.GetNormalized(10); REQUIRE((theRange.GetLocation() == 0 && theRange.GetSize() == 10)); // Meta (all) theRange = NRange(3, 7).GetNormalized(10); REQUIRE( (theRange.GetLocation() == 3 && theRange.GetSize() == 7)); // Within (non-zero length) theRange = NRange(3, 9).GetNormalized(10); REQUIRE((theRange.GetLocation() == 3 && theRange.GetSize() == 7)); // Within (clamped length) theRange = NRange(3, 0).GetNormalized(10); REQUIRE((theRange.GetLocation() == 3 && theRange.GetSize() == 0)); // Within (zero length) theRange = NRange(30, 7).GetNormalized(10); REQUIRE( (theRange.GetLocation() == 30 && theRange.GetSize() == 0)); // Outside (non-zero length) theRange = NRange(30, 0).GetNormalized(0); REQUIRE((theRange.GetLocation() == 30 && theRange.GetSize() == 0)); // Outside (zero length) } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "CompareEqual") { // Perform the test REQUIRE(kTestRange1 == kTestRange1); REQUIRE(kTestRange1 != kTestRange2); REQUIRE(kNRangeNone == kNRangeNone); REQUIRE(kNRangeNone != kNRangeAll); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "CompareOrder") { // Perform the test REQUIRE(kTestRange1 <= kTestRange1); REQUIRE(kTestRange1 < kTestRange2); REQUIRE(kTestRange1 < kTestRange3); REQUIRE(kTestRange2 > kTestRange1); REQUIRE(kTestRange2 >= kTestRange2); REQUIRE(kTestRange2 > kTestRange3); REQUIRE(kTestRange3 > kTestRange1); REQUIRE(kTestRange3 < kTestRange2); REQUIRE(kTestRange3 >= kTestRange3); } //============================================================================= // Test Case //----------------------------------------------------------------------------- NANO_TEST(TRange, "Format") { // Perform the test REQUIRE(NFormat("{}", kTestRange1) == "{location = 0, size = 5}"); REQUIRE(NFormat("{}", kTestRange2) == "{location = 3, size = 7}"); REQUIRE(NFormat("{}", kTestRange3) == "{location = 3, size = 4}"); }
28.575492
97
0.50402
refnum
d10ae5fba69de104b27f9d9f39f7a59fa0c850af
27,033
cpp
C++
soundlib/tuning.cpp
sitomani/openmpt
913396209c22a1fc6dfb29f0e34893dfb0ffa591
[ "BSD-3-Clause" ]
null
null
null
soundlib/tuning.cpp
sitomani/openmpt
913396209c22a1fc6dfb29f0e34893dfb0ffa591
[ "BSD-3-Clause" ]
null
null
null
soundlib/tuning.cpp
sitomani/openmpt
913396209c22a1fc6dfb29f0e34893dfb0ffa591
[ "BSD-3-Clause" ]
null
null
null
/* * tuning.cpp * ---------- * Purpose: Alternative sample tuning. * Notes : (currently none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #include "stdafx.h" #include "tuning.h" #include "../common/mptIO.h" #include "../common/serialization_utils.h" #include "../common/misc_util.h" #include <string> #include <cmath> OPENMPT_NAMESPACE_BEGIN namespace Tuning { namespace CTuningS11n { void ReadStr(std::istream &iStrm, mpt::ustring &ustr, const std::size_t dummy, mpt::Charset charset); void ReadNoteMap(std::istream &iStrm, std::map<NOTEINDEXTYPE, mpt::ustring> &m, const std::size_t dummy, mpt::Charset charset); void ReadRatioTable(std::istream& iStrm, std::vector<RATIOTYPE>& v, const size_t); void WriteNoteMap(std::ostream &oStrm, const std::map<NOTEINDEXTYPE, mpt::ustring> &m); void WriteStr(std::ostream &oStrm, const mpt::ustring &ustr); struct RatioWriter { RatioWriter(uint16 nWriteCount = s_nDefaultWriteCount) : m_nWriteCount(nWriteCount) {} void operator()(std::ostream& oStrm, const std::vector<float>& v); uint16 m_nWriteCount; enum : uint16 { s_nDefaultWriteCount = (uint16_max >> 2) }; }; } using namespace CTuningS11n; /* Version history: 4->5: Lots of changes, finestep interpretation revamp, fileformat revamp. 3->4: Changed sizetypes in serialisation from size_t(uint32) to smaller types (uint8, USTEPTYPE) (March 2007) */ /* Version changes: 3->4: Finetune related internal structure and serialization revamp. 2->3: The type for the size_type in the serialisation changed from default(size_t, uint32) to unsigned STEPTYPE. (March 2007) */ static_assert(CTuning::s_RatioTableFineSizeMaxDefault < static_cast<USTEPINDEXTYPE>(FINESTEPCOUNT_MAX)); CTuning::CTuning() : m_TuningType(Type::GENERAL) , m_FineStepCount(0) { m_RatioTable.clear(); m_NoteMin = s_NoteMinDefault; m_RatioTable.resize(s_RatioTableSizeDefault, 1); m_GroupSize = 0; m_GroupRatio = 0; m_RatioTableFine.clear(); } bool CTuning::CreateGroupGeometric(const NOTEINDEXTYPE &s, const RATIOTYPE &r, const NOTEINDEXTYPE &startindex) { if(s < 1 || !IsValidRatio(r) || startindex < GetNoteRange().first) { return false; } std::vector<RATIOTYPE> v; v.reserve(s); for(NOTEINDEXTYPE i = startindex; i < startindex + s; i++) { v.push_back(GetRatio(i)); } return CreateGroupGeometric(v, r, GetNoteRange(), startindex); } bool CTuning::CreateGroupGeometric(const std::vector<RATIOTYPE> &v, const RATIOTYPE &r, const NoteRange &range, const NOTEINDEXTYPE &ratiostartpos) { if(range.first > range.last || v.size() == 0) { return false; } if(ratiostartpos < range.first || range.last < ratiostartpos || static_cast<UNOTEINDEXTYPE>(range.last - ratiostartpos) < static_cast<UNOTEINDEXTYPE>(v.size() - 1)) { return false; } if(GetFineStepCount() > FINESTEPCOUNT_MAX) { return false; } for(size_t i = 0; i < v.size(); i++) { if(v[i] < 0) { return false; } } if(r <= 0) { return false; } m_TuningType = Type::GROUPGEOMETRIC; m_NoteMin = range.first; m_GroupSize = mpt::saturate_cast<NOTEINDEXTYPE>(v.size()); m_GroupRatio = std::fabs(r); m_RatioTable.resize(range.last - range.first + 1); std::copy(v.begin(), v.end(), m_RatioTable.begin() + (ratiostartpos - range.first)); for(int32 i = ratiostartpos - 1; i >= m_NoteMin && ratiostartpos > NOTEINDEXTYPE_MIN; i--) { m_RatioTable[i - m_NoteMin] = m_RatioTable[i - m_NoteMin + m_GroupSize] / m_GroupRatio; } for(int32 i = ratiostartpos + m_GroupSize; i <= range.last && ratiostartpos <= (NOTEINDEXTYPE_MAX - m_GroupSize); i++) { m_RatioTable[i - m_NoteMin] = m_GroupRatio * m_RatioTable[i - m_NoteMin - m_GroupSize]; } UpdateFineStepTable(); return true; } bool CTuning::CreateGeometric(const UNOTEINDEXTYPE &p, const RATIOTYPE &r) { return CreateGeometric(p, r, GetNoteRange()); } bool CTuning::CreateGeometric(const UNOTEINDEXTYPE &s, const RATIOTYPE &r, const NoteRange &range) { if(range.first > range.last) { return false; } if(s < 1 || !IsValidRatio(r)) { return false; } if(range.last - range.first + 1 > NOTEINDEXTYPE_MAX) { return false; } m_TuningType = Type::GEOMETRIC; m_RatioTable.clear(); m_NoteMin = s_NoteMinDefault; m_RatioTable.resize(s_RatioTableSizeDefault, static_cast<RATIOTYPE>(1.0)); m_GroupSize = 0; m_GroupRatio = 0; m_RatioTableFine.clear(); m_NoteMin = range.first; m_GroupSize = mpt::saturate_cast<NOTEINDEXTYPE>(s); m_GroupRatio = std::fabs(r); const RATIOTYPE stepRatio = std::pow(m_GroupRatio, static_cast<RATIOTYPE>(1.0) / static_cast<RATIOTYPE>(m_GroupSize)); m_RatioTable.resize(range.last - range.first + 1); for(int32 i = range.first; i <= range.last; i++) { m_RatioTable[i - m_NoteMin] = std::pow(stepRatio, static_cast<RATIOTYPE>(i)); } UpdateFineStepTable(); return true; } mpt::ustring CTuning::GetNoteName(const NOTEINDEXTYPE &x, bool addOctave) const { if(!IsValidNote(x)) { return mpt::ustring(); } if(GetGroupSize() < 1) { const auto i = m_NoteNameMap.find(x); if(i != m_NoteNameMap.end()) return i->second; else return mpt::ufmt::val(x); } else { const NOTEINDEXTYPE pos = static_cast<NOTEINDEXTYPE>(mpt::wrapping_modulo(x, m_GroupSize)); const NOTEINDEXTYPE middlePeriodNumber = 5; mpt::ustring rValue; const auto nmi = m_NoteNameMap.find(pos); if(nmi != m_NoteNameMap.end()) { rValue = nmi->second; if(addOctave) { rValue += mpt::ufmt::val(middlePeriodNumber + mpt::wrapping_divide(x, m_GroupSize)); } } else { //By default, using notation nnP for notes; nn <-> note character starting //from 'A' with char ':' as fill char, and P is period integer. For example: //C:5, D:3, R:7 if(m_GroupSize <= 26) { rValue = mpt::ToUnicode(mpt::Charset::UTF8, std::string(1, static_cast<char>(pos + 'A'))); rValue += UL_(":"); } else { rValue = mpt::ufmt::HEX0<1>(pos % 16) + mpt::ufmt::HEX0<1>((pos / 16) % 16); if(pos > 0xff) { rValue = mpt::ToUnicode(mpt::Charset::UTF8, mpt::ToLowerCaseAscii(mpt::ToCharset(mpt::Charset::UTF8, rValue))); } } if(addOctave) { rValue += mpt::ufmt::val(middlePeriodNumber + mpt::wrapping_divide(x, m_GroupSize)); } } return rValue; } } void CTuning::SetNoteName(const NOTEINDEXTYPE &n, const mpt::ustring &str) { const NOTEINDEXTYPE pos = (GetGroupSize() < 1) ? n : static_cast<NOTEINDEXTYPE>(mpt::wrapping_modulo(n, m_GroupSize)); if(!str.empty()) { m_NoteNameMap[pos] = str; } else { const auto iter = m_NoteNameMap.find(pos); if(iter != m_NoteNameMap.end()) { m_NoteNameMap.erase(iter); } } } // Without finetune RATIOTYPE CTuning::GetRatio(const NOTEINDEXTYPE note) const { if(!IsValidNote(note)) { return s_DefaultFallbackRatio; } return m_RatioTable[note - m_NoteMin]; } // With finetune RATIOTYPE CTuning::GetRatio(const NOTEINDEXTYPE baseNote, const STEPINDEXTYPE baseFineSteps) const { const STEPINDEXTYPE fineStepCount = static_cast<STEPINDEXTYPE>(GetFineStepCount()); if(fineStepCount == 0 || baseFineSteps == 0) { return GetRatio(static_cast<NOTEINDEXTYPE>(baseNote + baseFineSteps)); } // If baseFineSteps is more than the number of finesteps between notes, note is increased. // So first figuring out what note and fineStep values to actually use. // Interpreting finestep==-1 on note x so that it is the same as finestep==fineStepCount on note x-1. // Note: If fineStepCount is n, n+1 steps are needed to get to next note. const NOTEINDEXTYPE note = static_cast<NOTEINDEXTYPE>(baseNote + mpt::wrapping_divide(baseFineSteps, (fineStepCount + 1))); const STEPINDEXTYPE fineStep = mpt::wrapping_modulo(baseFineSteps, (fineStepCount + 1)); if(!IsValidNote(note)) { return s_DefaultFallbackRatio; } if(fineStep == 0) { return m_RatioTable[note - m_NoteMin]; } RATIOTYPE fineRatio = static_cast<RATIOTYPE>(1.0); if(GetType() == Type::GEOMETRIC && m_RatioTableFine.size() > 0) { fineRatio = m_RatioTableFine[fineStep - 1]; } else if(GetType() == Type::GROUPGEOMETRIC && m_RatioTableFine.size() > 0) { fineRatio = m_RatioTableFine[GetRefNote(note) * fineStepCount + fineStep - 1]; } else { // Geometric finestepping fineRatio = std::pow(GetRatio(note + 1) / GetRatio(note), static_cast<RATIOTYPE>(fineStep) / (fineStepCount + 1)); } return m_RatioTable[note - m_NoteMin] * fineRatio; } bool CTuning::SetRatio(const NOTEINDEXTYPE& s, const RATIOTYPE& r) { if(GetType() != Type::GROUPGEOMETRIC && GetType() != Type::GENERAL) { return false; } //Creating ratio table if doesn't exist. if(m_RatioTable.empty()) { m_RatioTable.assign(s_RatioTableSizeDefault, 1); m_NoteMin = s_NoteMinDefault; } if(!IsValidNote(s)) { return false; } m_RatioTable[s - m_NoteMin] = std::fabs(r); if(GetType() == Type::GROUPGEOMETRIC) { // update other groups for(NOTEINDEXTYPE n = m_NoteMin; n < m_NoteMin + static_cast<NOTEINDEXTYPE>(m_RatioTable.size()); ++n) { if(n == s) { // nothing } else if(std::abs(n - s) % m_GroupSize == 0) { m_RatioTable[n - m_NoteMin] = std::pow(m_GroupRatio, static_cast<RATIOTYPE>(n - s) / static_cast<RATIOTYPE>(m_GroupSize)) * m_RatioTable[s - m_NoteMin]; } } UpdateFineStepTable(); } return true; } void CTuning::SetFineStepCount(const USTEPINDEXTYPE& fs) { m_FineStepCount = std::clamp(mpt::saturate_cast<STEPINDEXTYPE>(fs), STEPINDEXTYPE(0), FINESTEPCOUNT_MAX); UpdateFineStepTable(); } void CTuning::UpdateFineStepTable() { if(m_FineStepCount <= 0) { m_RatioTableFine.clear(); return; } if(GetType() == Type::GEOMETRIC) { if(m_FineStepCount > s_RatioTableFineSizeMaxDefault) { m_RatioTableFine.clear(); return; } m_RatioTableFine.resize(m_FineStepCount); const RATIOTYPE q = GetRatio(GetNoteRange().first + 1) / GetRatio(GetNoteRange().first); const RATIOTYPE rFineStep = std::pow(q, static_cast<RATIOTYPE>(1)/(m_FineStepCount+1)); for(USTEPINDEXTYPE i = 1; i<=m_FineStepCount; i++) m_RatioTableFine[i-1] = std::pow(rFineStep, static_cast<RATIOTYPE>(i)); return; } if(GetType() == Type::GROUPGEOMETRIC) { const UNOTEINDEXTYPE p = GetGroupSize(); if(p > s_RatioTableFineSizeMaxDefault / m_FineStepCount) { //In case fineratiotable would become too large, not using //table for it. m_RatioTableFine.clear(); return; } else { //Creating 'geometric' finestepping between notes. m_RatioTableFine.resize(p * m_FineStepCount); const NOTEINDEXTYPE startnote = GetRefNote(GetNoteRange().first); for(UNOTEINDEXTYPE i = 0; i<p; i++) { const NOTEINDEXTYPE refnote = GetRefNote(startnote+i); const RATIOTYPE rFineStep = std::pow(GetRatio(refnote+1) / GetRatio(refnote), static_cast<RATIOTYPE>(1)/(m_FineStepCount+1)); for(UNOTEINDEXTYPE j = 1; j<=m_FineStepCount; j++) { m_RatioTableFine[m_FineStepCount * refnote + (j-1)] = std::pow(rFineStep, static_cast<RATIOTYPE>(j)); } } return; } } if(GetType() == Type::GENERAL) { //Not using table with tuning of type general. m_RatioTableFine.clear(); return; } //Should not reach here. m_RatioTableFine.clear(); m_FineStepCount = 0; } bool CTuning::Multiply(const RATIOTYPE r) { if(!IsValidRatio(r)) { return false; } for(auto & ratio : m_RatioTable) { ratio *= r; } return true; } bool CTuning::ChangeGroupsize(const NOTEINDEXTYPE& s) { if(s < 1) return false; if(m_TuningType == Type::GROUPGEOMETRIC) return CreateGroupGeometric(s, GetGroupRatio(), 0); if(m_TuningType == Type::GEOMETRIC) return CreateGeometric(s, GetGroupRatio()); return false; } bool CTuning::ChangeGroupRatio(const RATIOTYPE& r) { if(!IsValidRatio(r)) return false; if(m_TuningType == Type::GROUPGEOMETRIC) return CreateGroupGeometric(GetGroupSize(), r, 0); if(m_TuningType == Type::GEOMETRIC) return CreateGeometric(GetGroupSize(), r); return false; } SerializationResult CTuning::InitDeserialize(std::istream &iStrm, mpt::Charset defaultCharset) { // Note: OpenMPT since at least r323 writes version number (4<<24)+4 while it // reads version number (5<<24)+4 or earlier. // We keep this behaviour. if(iStrm.fail()) return SerializationResult::Failure; srlztn::SsbRead ssb(iStrm); ssb.BeginRead("CTB244RTI", (5 << 24) + 4); // version int8 use_utf8 = 0; ssb.ReadItem(use_utf8, "UTF8"); const mpt::Charset charset = use_utf8 ? mpt::Charset::UTF8 : defaultCharset; ssb.ReadItem(m_TuningName, "0", [charset](std::istream &iStrm, mpt::ustring &ustr, const std::size_t dummy){ return ReadStr(iStrm, ustr, dummy, charset); }); uint16 dummyEditMask = 0xffff; ssb.ReadItem(dummyEditMask, "1"); std::underlying_type<Type>::type type = 0; ssb.ReadItem(type, "2"); m_TuningType = static_cast<Type>(type); ssb.ReadItem(m_NoteNameMap, "3", [charset](std::istream &iStrm, std::map<NOTEINDEXTYPE, mpt::ustring> &m, const std::size_t dummy){ return ReadNoteMap(iStrm, m, dummy, charset); }); ssb.ReadItem(m_FineStepCount, "4"); // RTI entries. ssb.ReadItem(m_RatioTable, "RTI0", ReadRatioTable); ssb.ReadItem(m_NoteMin, "RTI1"); ssb.ReadItem(m_GroupSize, "RTI2"); ssb.ReadItem(m_GroupRatio, "RTI3"); UNOTEINDEXTYPE ratiotableSize = 0; ssb.ReadItem(ratiotableSize, "RTI4"); // If reader status is ok and m_NoteMin is somewhat reasonable, process data. if(!((ssb.GetStatus() & srlztn::SNT_FAILURE) == 0 && m_NoteMin >= -300 && m_NoteMin <= 300)) { return SerializationResult::Failure; } // reject unknown types if(m_TuningType != Type::GENERAL && m_TuningType != Type::GROUPGEOMETRIC && m_TuningType != Type::GEOMETRIC) { return SerializationResult::Failure; } if(m_GroupSize < 0) { return SerializationResult::Failure; } m_FineStepCount = std::clamp(mpt::saturate_cast<STEPINDEXTYPE>(m_FineStepCount), STEPINDEXTYPE(0), FINESTEPCOUNT_MAX); if(m_RatioTable.size() > static_cast<size_t>(NOTEINDEXTYPE_MAX)) { return SerializationResult::Failure; } if((GetType() == Type::GROUPGEOMETRIC) || (GetType() == Type::GEOMETRIC)) { if(ratiotableSize < 1 || ratiotableSize > NOTEINDEXTYPE_MAX) { return SerializationResult::Failure; } if(GetType() == Type::GEOMETRIC) { if(!CreateGeometric(GetGroupSize(), GetGroupRatio(), NoteRange{m_NoteMin, static_cast<NOTEINDEXTYPE>(m_NoteMin + ratiotableSize - 1)})) { return SerializationResult::Failure; } } else { if(!CreateGroupGeometric(m_RatioTable, GetGroupRatio(), NoteRange{m_NoteMin, static_cast<NOTEINDEXTYPE>(m_NoteMin + ratiotableSize - 1)}, m_NoteMin)) { return SerializationResult::Failure; } } } else { UpdateFineStepTable(); } return SerializationResult::Success; } template<class T, class SIZETYPE, class Tdst> static bool VectorFromBinaryStream(std::istream& inStrm, std::vector<Tdst>& v, const SIZETYPE maxSize = (std::numeric_limits<SIZETYPE>::max)()) { if(!inStrm.good()) return false; SIZETYPE size = 0; mpt::IO::ReadIntLE<SIZETYPE>(inStrm, size); if(size > maxSize) return false; v.resize(size); for(std::size_t i = 0; i<size; i++) { T tmp = T(); mpt::IO::Read(inStrm, tmp); v[i] = tmp; } return inStrm.good(); } SerializationResult CTuning::InitDeserializeOLD(std::istream &inStrm, mpt::Charset defaultCharset) { if(!inStrm.good()) return SerializationResult::Failure; const std::streamoff startPos = inStrm.tellg(); //First checking is there expected begin sequence. char begin[8]; MemsetZero(begin); inStrm.read(begin, sizeof(begin)); if(std::memcmp(begin, "CTRTI_B.", 8)) { //Returning stream position if beginmarker was not found. inStrm.seekg(startPos); return SerializationResult::Failure; } //Version int16 version = 0; mpt::IO::ReadIntLE<int16>(inStrm, version); if(version != 2 && version != 3) return SerializationResult::Failure; char begin2[8]; MemsetZero(begin2); inStrm.read(begin2, sizeof(begin2)); if(std::memcmp(begin2, "CT<sfs>B", 8)) { return SerializationResult::Failure; } int16 version2 = 0; mpt::IO::ReadIntLE<int16>(inStrm, version2); if(version2 != 3 && version2 != 4) { return SerializationResult::Failure; } //Tuning name if(version2 <= 3) { std::string tmpName; if(!mpt::IO::ReadSizedStringLE<uint32>(inStrm, tmpName, 0xffff)) { return SerializationResult::Failure; } m_TuningName = mpt::ToUnicode(defaultCharset, tmpName); } else { std::string tmpName; if(!mpt::IO::ReadSizedStringLE<uint8>(inStrm, tmpName)) { return SerializationResult::Failure; } m_TuningName = mpt::ToUnicode(defaultCharset, tmpName); } //Const mask int16 em = 0; mpt::IO::ReadIntLE<int16>(inStrm, em); //Tuning type int16 tt = 0; mpt::IO::ReadIntLE<int16>(inStrm, tt); m_TuningType = static_cast<Type>(tt); //Notemap uint16 size = 0; if(version2 <= 3) { uint32 tempsize = 0; mpt::IO::ReadIntLE<uint32>(inStrm, tempsize); if(tempsize > 0xffff) { return SerializationResult::Failure; } size = mpt::saturate_cast<uint16>(tempsize); } else { mpt::IO::ReadIntLE<uint16>(inStrm, size); } for(UNOTEINDEXTYPE i = 0; i<size; i++) { std::string str; int16 n = 0; mpt::IO::ReadIntLE<int16>(inStrm, n); if(version2 <= 3) { if(!mpt::IO::ReadSizedStringLE<uint32>(inStrm, str, 0xffff)) { return SerializationResult::Failure; } } else { if(!mpt::IO::ReadSizedStringLE<uint8>(inStrm, str)) { return SerializationResult::Failure; } } m_NoteNameMap[n] = mpt::ToUnicode(defaultCharset, str); } //End marker char end2[8]; MemsetZero(end2); inStrm.read(end2, sizeof(end2)); if(std::memcmp(end2, "CT<sfs>E", 8)) { return SerializationResult::Failure; } // reject unknown types if(m_TuningType != Type::GENERAL && m_TuningType != Type::GROUPGEOMETRIC && m_TuningType != Type::GEOMETRIC) { return SerializationResult::Failure; } //Ratiotable if(version <= 2) { if(!VectorFromBinaryStream<IEEE754binary32LE, uint32>(inStrm, m_RatioTable, 0xffff)) { return SerializationResult::Failure; } } else { if(!VectorFromBinaryStream<IEEE754binary32LE, uint16>(inStrm, m_RatioTable)) { return SerializationResult::Failure; } } //Fineratios if(version <= 2) { if(!VectorFromBinaryStream<IEEE754binary32LE, uint32>(inStrm, m_RatioTableFine, 0xffff)) { return SerializationResult::Failure; } } else { if(!VectorFromBinaryStream<IEEE754binary32LE, uint16>(inStrm, m_RatioTableFine)) { return SerializationResult::Failure; } } m_FineStepCount = mpt::saturate_cast<USTEPINDEXTYPE>(m_RatioTableFine.size()); // m_NoteMin int16 notemin = 0; mpt::IO::ReadIntLE<int16>(inStrm, notemin); m_NoteMin = notemin; if(m_NoteMin < -200 || m_NoteMin > 200) { return SerializationResult::Failure; } //m_GroupSize int16 groupsize = 0; mpt::IO::ReadIntLE<int16>(inStrm, groupsize); m_GroupSize = groupsize; if(m_GroupSize < 0) { return SerializationResult::Failure; } //m_GroupRatio IEEE754binary32LE groupratio = IEEE754binary32LE(0.0f); mpt::IO::Read(inStrm, groupratio); m_GroupRatio = groupratio; if(m_GroupRatio < 0) { return SerializationResult::Failure; } char end[8]; MemsetZero(end); inStrm.read(reinterpret_cast<char*>(&end), sizeof(end)); if(std::memcmp(end, "CTRTI_E.", 8)) { return SerializationResult::Failure; } // reject corrupt tunings if(m_RatioTable.size() > static_cast<std::size_t>(NOTEINDEXTYPE_MAX)) { return SerializationResult::Failure; } if((m_GroupSize <= 0 || m_GroupRatio <= 0) && m_TuningType != Type::GENERAL) { return SerializationResult::Failure; } if(m_TuningType == Type::GROUPGEOMETRIC || m_TuningType == Type::GEOMETRIC) { if(m_RatioTable.size() < static_cast<std::size_t>(m_GroupSize)) { return SerializationResult::Failure; } } // convert old finestepcount if(m_FineStepCount > 0) { m_FineStepCount -= 1; } m_FineStepCount = std::clamp(mpt::saturate_cast<STEPINDEXTYPE>(m_FineStepCount), STEPINDEXTYPE(0), FINESTEPCOUNT_MAX); UpdateFineStepTable(); if(m_TuningType == Type::GEOMETRIC) { // Convert old geometric to new groupgeometric because old geometric tunings // can have ratio(0) != 1.0, which would get lost when saving nowadays. if(mpt::saturate_cast<NOTEINDEXTYPE>(m_RatioTable.size()) >= m_GroupSize - m_NoteMin) { std::vector<RATIOTYPE> ratios; for(NOTEINDEXTYPE n = 0; n < m_GroupSize; ++n) { ratios.push_back(m_RatioTable[n - m_NoteMin]); } CreateGroupGeometric(ratios, m_GroupRatio, GetNoteRange(), 0); } } return SerializationResult::Success; } Tuning::SerializationResult CTuning::Serialize(std::ostream& outStrm) const { // Note: OpenMPT since at least r323 writes version number (4<<24)+4 while it // reads version number (5<<24)+4. // We keep this behaviour. srlztn::SsbWrite ssb(outStrm); ssb.BeginWrite("CTB244RTI", (4 << 24) + 4); // version ssb.WriteItem(int8(1), "UTF8"); if (m_TuningName.length() > 0) ssb.WriteItem(m_TuningName, "0", WriteStr); uint16 dummyEditMask = 0xffff; ssb.WriteItem(dummyEditMask, "1"); ssb.WriteItem(static_cast<std::underlying_type<Type>::type>(m_TuningType), "2"); if (m_NoteNameMap.size() > 0) ssb.WriteItem(m_NoteNameMap, "3", WriteNoteMap); if (GetFineStepCount() > 0) ssb.WriteItem(m_FineStepCount, "4"); const Tuning::Type tt = GetType(); if (GetGroupRatio() > 0) ssb.WriteItem(m_GroupRatio, "RTI3"); if (tt == Type::GROUPGEOMETRIC) ssb.WriteItem(m_RatioTable, "RTI0", RatioWriter(GetGroupSize())); if (tt == Type::GENERAL) ssb.WriteItem(m_RatioTable, "RTI0", RatioWriter()); if (tt == Type::GEOMETRIC) ssb.WriteItem(m_GroupSize, "RTI2"); if(tt == Type::GEOMETRIC || tt == Type::GROUPGEOMETRIC) { //For Groupgeometric this data is the number of ratios in ratiotable. UNOTEINDEXTYPE ratiotableSize = static_cast<UNOTEINDEXTYPE>(m_RatioTable.size()); ssb.WriteItem(ratiotableSize, "RTI4"); } // m_NoteMin ssb.WriteItem(m_NoteMin, "RTI1"); ssb.FinishWrite(); return ((ssb.GetStatus() & srlztn::SNT_FAILURE) != 0) ? Tuning::SerializationResult::Failure : Tuning::SerializationResult::Success; } #ifdef MODPLUG_TRACKER bool CTuning::WriteSCL(std::ostream &f, const mpt::PathString &filename) const { mpt::IO::WriteTextCRLF(f, MPT_FORMAT("! {}")(mpt::ToCharset(mpt::Charset::ISO8859_1, (filename.GetFileName() + filename.GetFileExt()).ToUnicode()))); mpt::IO::WriteTextCRLF(f, "!"); std::string name = mpt::ToCharset(mpt::Charset::ISO8859_1, GetName()); for(auto & c : name) { if(static_cast<uint8>(c) < 32) c = ' '; } // remove control characters if(name.length() >= 1 && name[0] == '!') name[0] = '?'; // do not confuse description with comment mpt::IO::WriteTextCRLF(f, name); if(GetType() == Type::GEOMETRIC) { mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {}")(m_GroupSize)); mpt::IO::WriteTextCRLF(f, "!"); for(NOTEINDEXTYPE n = 0; n < m_GroupSize; ++n) { double ratio = std::pow(static_cast<double>(m_GroupRatio), static_cast<double>(n + 1) / static_cast<double>(m_GroupSize)); double cents = std::log2(ratio) * 1200.0; mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {} ! {}")( mpt::fmt::fix(cents), mpt::ToCharset(mpt::Charset::ISO8859_1, GetNoteName((n + 1) % m_GroupSize, false)) )); } } else if(GetType() == Type::GROUPGEOMETRIC) { mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {}")(m_GroupSize)); mpt::IO::WriteTextCRLF(f, "!"); for(NOTEINDEXTYPE n = 0; n < m_GroupSize; ++n) { bool last = (n == (m_GroupSize - 1)); double baseratio = static_cast<double>(GetRatio(0)); double ratio = static_cast<double>(last ? m_GroupRatio : GetRatio(n + 1)) / baseratio; double cents = std::log2(ratio) * 1200.0; mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {} ! {}")( mpt::fmt::fix(cents), mpt::ToCharset(mpt::Charset::ISO8859_1, GetNoteName((n + 1) % m_GroupSize, false)) )); } } else if(GetType() == Type::GENERAL) { mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {}")(m_RatioTable.size() + 1)); mpt::IO::WriteTextCRLF(f, "!"); double baseratio = 1.0; for(NOTEINDEXTYPE n = 0; n < mpt::saturate_cast<NOTEINDEXTYPE>(m_RatioTable.size()); ++n) { baseratio = std::min(baseratio, static_cast<double>(m_RatioTable[n])); } for(NOTEINDEXTYPE n = 0; n < mpt::saturate_cast<NOTEINDEXTYPE>(m_RatioTable.size()); ++n) { double ratio = static_cast<double>(m_RatioTable[n]) / baseratio; double cents = std::log2(ratio) * 1200.0; mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {} ! {}")( mpt::fmt::fix(cents), mpt::ToCharset(mpt::Charset::ISO8859_1, GetNoteName(n + m_NoteMin, false)) )); } mpt::IO::WriteTextCRLF(f, MPT_FORMAT(" {} ! {}")( mpt::fmt::val(1), std::string() )); } else { return false; } return true; } #endif namespace CTuningS11n { void RatioWriter::operator()(std::ostream& oStrm, const std::vector<float>& v) { const std::size_t nWriteCount = std::min(v.size(), static_cast<std::size_t>(m_nWriteCount)); mpt::IO::WriteAdaptiveInt64LE(oStrm, nWriteCount); for(size_t i = 0; i < nWriteCount; i++) mpt::IO::Write(oStrm, IEEE754binary32LE(v[i])); } void ReadNoteMap(std::istream &iStrm, std::map<NOTEINDEXTYPE, mpt::ustring> &m, const std::size_t dummy, mpt::Charset charset) { MPT_UNREFERENCED_PARAMETER(dummy); uint64 val; mpt::IO::ReadAdaptiveInt64LE(iStrm, val); LimitMax(val, 256u); // Read 256 at max. for(size_t i = 0; i < val; i++) { int16 key; mpt::IO::ReadIntLE<int16>(iStrm, key); std::string str; mpt::IO::ReadSizedStringLE<uint8>(iStrm, str); m[key] = mpt::ToUnicode(charset, str); } } void ReadRatioTable(std::istream& iStrm, std::vector<RATIOTYPE>& v, const size_t) { uint64 val; mpt::IO::ReadAdaptiveInt64LE(iStrm, val); v.resize(std::min(mpt::saturate_cast<std::size_t>(val), std::size_t(256))); // Read 256 vals at max. for(size_t i = 0; i < v.size(); i++) { IEEE754binary32LE tmp(0.0f); mpt::IO::Read(iStrm, tmp); v[i] = tmp; } } void ReadStr(std::istream &iStrm, mpt::ustring &ustr, const std::size_t dummy, mpt::Charset charset) { MPT_UNREFERENCED_PARAMETER(dummy); std::string str; uint64 val; mpt::IO::ReadAdaptiveInt64LE(iStrm, val); size_t nSize = (val > 255) ? 255 : static_cast<size_t>(val); // Read 255 characters at max. str.clear(); str.resize(nSize); for(size_t i = 0; i < nSize; i++) mpt::IO::ReadIntLE(iStrm, str[i]); if(str.find_first_of('\0') != std::string::npos) { // trim \0 at the end str.resize(str.find_first_of('\0')); } ustr = mpt::ToUnicode(charset, str); } void WriteNoteMap(std::ostream &oStrm, const std::map<NOTEINDEXTYPE, mpt::ustring> &m) { mpt::IO::WriteAdaptiveInt64LE(oStrm, m.size()); for(auto &mi : m) { mpt::IO::WriteIntLE<int16>(oStrm, mi.first); mpt::IO::WriteSizedStringLE<uint8>(oStrm, mpt::ToCharset(mpt::Charset::UTF8, mi.second)); } } void WriteStr(std::ostream &oStrm, const mpt::ustring &ustr) { std::string str = mpt::ToCharset(mpt::Charset::UTF8, ustr); mpt::IO::WriteAdaptiveInt64LE(oStrm, str.size()); oStrm.write(str.c_str(), str.size()); } } // namespace CTuningS11n. } // namespace Tuning OPENMPT_NAMESPACE_END
27.556575
182
0.693449
sitomani
d10c0dadc94b54375b061dcfecd187a6d48e6d7a
8,088
cpp
C++
camera/hal/mediatek/mtkcam/utils/exif/v3/DebugExifUtils.cpp
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
4
2020-07-24T06:54:16.000Z
2021-06-16T17:13:53.000Z
camera/hal/mediatek/mtkcam/utils/exif/v3/DebugExifUtils.cpp
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
1
2021-04-02T17:35:07.000Z
2021-04-02T17:35:07.000Z
camera/hal/mediatek/mtkcam/utils/exif/v3/DebugExifUtils.cpp
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
1
2020-11-04T22:31:45.000Z
2020-11-04T22:31:45.000Z
/* * Copyright (C) 2019 MediaTek 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. */ #define LOG_TAG "MtkCam/DebugExifUtils" #include <map> #include <vector> // #include <mtkcam/custom/ExifFactory.h> // #include <mtkcam/utils/std/Log.h> #include <mtkcam/utils/metadata/IMetadata.h> #include <mtkcam/utils/exif/DebugExifUtils.h> // using NSCam::DebugExifUtils; using NSCam::IMetadata; using NSCam::MPoint; using NSCam::MPointF; using NSCam::MRect; using NSCam::MRectF; using NSCam::MSize; using NSCam::MSizeF; using NSCam::Type2Type; /****************************************************************************** * ******************************************************************************/ static auto getDebugExif() { static auto const inst = MAKE_DebugExif(); return inst; } static auto getBufInfo_cam() { static auto const inst = ((NULL != getDebugExif()) ? getDebugExif()->getBufInfo(DEBUG_EXIF_KEYID_CAM) : NULL); return inst; } // --------------------------------------------------------------------------- template <typename T> static inline MVOID updateEntry(IMetadata* metadata, const MUINT32 tag, const T& val) { if (metadata == NULL) { CAM_LOGW("pMetadata is NULL"); return; } IMetadata::IEntry entry(tag); entry.push_back(val, Type2Type<T>()); metadata->update(tag, entry); } template <class T> static MBOOL tryGetMetaData(IMetadata* pMetadata, MUINT32 const tag, T* rVal) { if (pMetadata == NULL) { return MFALSE; } IMetadata::IEntry entry = pMetadata->entryFor(tag); if (!entry.isEmpty()) { *rVal = entry.itemAt(0, Type2Type<T>()); return MTRUE; } return MFALSE; } static bool setDebugExifMF(const MUINT32 tagKey, const MUINT32 tagData, const std::map<MUINT32, MUINT32>& debugInfoList, IMetadata* exifMetadata) { auto it = getBufInfo_cam()->body_layout.find(DEBUG_EXIF_MID_CAM_MF); if (it == getBufInfo_cam()->body_layout.end()) { CAM_LOGE("cannot find the layout: DEBUG_EXIF_MID_CAM_MF"); return false; } auto const& info = it->second; // allocate memory of debug information IMetadata::Memory debugInfoSet; debugInfoSet.resize(info.size); // add debug information { auto const tagId_MF_TAG_VERSION = getDebugExif()->getTagId_MF_TAG_VERSION(); auto pTag = reinterpret_cast<debug_exif_field*>(debugInfoSet.editArray()); pTag[tagId_MF_TAG_VERSION].u4FieldID = (0x1000000 | tagId_MF_TAG_VERSION); pTag[tagId_MF_TAG_VERSION].u4FieldValue = info.version; for (const auto& item : debugInfoList) { const MUINT32 index = item.first; pTag[index].u4FieldID = (0x1000000 | index); pTag[index].u4FieldValue = item.second; } } // update debug exif metadata updateEntry<MINT32>(exifMetadata, tagKey, DEBUG_EXIF_MID_CAM_MF); updateEntry<IMetadata::Memory>(exifMetadata, tagData, debugInfoSet); return true; } static bool setDebugExifRESERVE3(const MUINT32 tagKey, const MUINT32 tagData, const MUINT32 size, const void* debugInfoList, IMetadata* exifMetadata) { auto it = getBufInfo_cam()->body_layout.find(DEBUG_EXIF_MID_CAM_RESERVE3); // MDP if (it == getBufInfo_cam()->body_layout.end()) { CAM_LOGE("cannot find the layout: DEBUG_EXIF_MID_CAM_RESERVE3"); return false; } auto const& info = it->second; // allocate memory of debug information IMetadata::Memory debugInfoValue; debugInfoValue.resize(info.size); // add debug information { auto pTag = reinterpret_cast<MUINT32*>(debugInfoValue.editArray()); ::memcpy(pTag, debugInfoList, size); } // update debug exif metadata updateEntry<MINT32>(exifMetadata, tagKey, DEBUG_EXIF_MID_CAM_RESERVE3); updateEntry<IMetadata::Memory>(exifMetadata, tagData, debugInfoValue); return true; } static bool setDebugExifCAM(const MUINT32 tagKey, const MUINT32 tagData, const std::map<MUINT32, MUINT32>& debugInfoList, IMetadata* exifMetadata) { auto it = getBufInfo_cam()->body_layout.find(DEBUG_EXIF_MID_CAM_CMN); if (it == getBufInfo_cam()->body_layout.end()) { CAM_LOGE("cannot find the layout: DEBUG_EXIF_MID_CAM_CMN"); return false; } IMetadata::Memory debugInfoSet; if (!tryGetMetaData(exifMetadata, tagData, &debugInfoSet)) { // CAM_LOGD("[debug mode] debugInfoList size: %d", debugInfoList.size()); // allocate memory of debug information auto const& info = it->second; debugInfoSet.resize(info.size); } // allocate memory of debug information auto pTag = reinterpret_cast<debug_exif_field*>(debugInfoSet.editArray()); for (const auto& item : debugInfoList) { const MUINT32 index = item.first; // CAM_LOGD("[debug mode] item: %d value: %d", item.first, item.second); pTag[index].u4FieldID = (0x1000000 | index); pTag[index].u4FieldValue = item.second; } // update debug exif metadata updateEntry<MINT32>(exifMetadata, tagKey, DEBUG_EXIF_MID_CAM_CMN); updateEntry<IMetadata::Memory>(exifMetadata, tagData, debugInfoSet); return true; } // --------------------------------------------------------------------------- IMetadata* DebugExifUtils::setDebugExif( const DebugExifType type, const MUINT32 tagKey, const MUINT32 tagData, const std::map<MUINT32, MUINT32>& debugInfoList, IMetadata* exifMetadata) { if (exifMetadata == NULL) { CAM_LOGW("invalid metadata(%p)", exifMetadata); return nullptr; } if (!getDebugExif()) { CAM_LOGE("bad getDebugExif()"); return nullptr; } if (!getBufInfo_cam()) { CAM_LOGE("bad getBufInfo_cam()"); return nullptr; } bool ret = [=, &type, &debugInfoList](IMetadata* metadata) -> bool { switch (type) { case DebugExifType::DEBUG_EXIF_MF: return setDebugExifMF(tagKey, tagData, debugInfoList, metadata); case DebugExifType::DEBUG_EXIF_CAM: return setDebugExifCAM(tagKey, tagData, debugInfoList, metadata); default: CAM_LOGW("invalid debug exif type, do nothing"); return false; } }(exifMetadata); return ret ? exifMetadata : nullptr; } // --------------------------------------------------------------------------- IMetadata* DebugExifUtils::setDebugExif(const DebugExifType type, const MUINT32 tagKey, const MUINT32 tagData, const MUINT32 size, const void* debugInfoList, IMetadata* exifMetadata) { if (exifMetadata == NULL) { CAM_LOGW("invalid metadata(%p)", exifMetadata); return nullptr; } if (!getDebugExif()) { CAM_LOGE("bad getDebugExif()"); return nullptr; } if (!getBufInfo_cam()) { CAM_LOGE("bad getBufInfo_cam()"); return nullptr; } bool ret = [=, &type, &debugInfoList](IMetadata* metadata) -> bool { switch (type) { case DebugExifType::DEBUG_EXIF_RESERVE3: return setDebugExifRESERVE3(tagKey, tagData, size, debugInfoList, metadata); default: CAM_LOGW("invalid debug exif type, do nothing"); return false; } }(exifMetadata); return ret ? exifMetadata : nullptr; }
31.470817
80
0.61956
strassek
d10cfad6d00593f9216095c2e7036837eec9b537
3,968
cpp
C++
Source/LaunchDarklyClient/Private/LaunchDarklyHelpers.cpp
Mohawk-Valley-Interactive/launchdarkly-client-ue4-plugin
183f856266e97537c3af9f519dd61b0a1cdc7c73
[ "Apache-2.0" ]
1
2021-02-05T22:57:39.000Z
2021-02-05T22:57:39.000Z
Source/LaunchDarklyClient/Private/LaunchDarklyHelpers.cpp
launchdarkly-labs/launchdarkly-client-ue4-plugin
7bd59afb384ae3ca7302af534752abac2b2c5239
[ "Apache-2.0" ]
null
null
null
Source/LaunchDarklyClient/Private/LaunchDarklyHelpers.cpp
launchdarkly-labs/launchdarkly-client-ue4-plugin
7bd59afb384ae3ca7302af534752abac2b2c5239
[ "Apache-2.0" ]
1
2020-04-16T17:33:33.000Z
2020-04-16T17:33:33.000Z
#include "LaunchDarklyHelpers.h" #include "Dom/JsonObject.h" #include "Serialization/JsonSerializer.h" #include "Serialization/JsonWriter.h" #include "LdNodeObject.h" #include "LdUserObject.h" FVector ULaunchDarklyHelpers::LdNodeObjectToVector(ULdNodeObject* LdDataObject) { TSharedPtr<FJsonObject> LdData = LdDataObject->GetObjectData(); if(LdData == nullptr) { return FVector(); } FVector V( LdData->HasTypedField<EJson::Number>("x") ? LdData->GetNumberField("x") : 0.0f, LdData->HasTypedField<EJson::Number>("y") ? LdData->GetNumberField("y") : 0.0f, LdData->HasTypedField<EJson::Number>("z") ? LdData->GetNumberField("z") : 0.0f ); return V; } ULdNodeObject* ULaunchDarklyHelpers::VectorToLdNodeObject(FVector V) { ULdNodeObject* NodeObject = NewObject<ULdNodeObject>(); TSharedPtr<FJsonObject> Node = MakeShared<FJsonObject>(); Node->SetNumberField("x", V.X); Node->SetNumberField("y", V.Y); Node->SetNumberField("z", V.Z); NodeObject->Initialize(Node); return NodeObject; } FColor ULaunchDarklyHelpers::LdNodeObjectToColor(ULdNodeObject* LdDataObject) { TSharedPtr<FJsonObject> LdData = LdDataObject->GetObjectData(); if(LdData == nullptr) { return FColor(); } FColor C( LdData->HasTypedField<EJson::Number>("r") ? (uint8)LdData->GetNumberField("r") : 0, LdData->HasTypedField<EJson::Number>("g") ? (uint8)LdData->GetNumberField("g") : 0, LdData->HasTypedField<EJson::Number>("b") ? (uint8)LdData->GetNumberField("b") : 0, LdData->HasTypedField<EJson::Number>("a") ? (uint8)LdData->GetNumberField("a") : 0 ); return C; } ULdNodeObject* ULaunchDarklyHelpers::ColorToLdNodeObject(FColor C) { ULdNodeObject* NodeObject = NewObject<ULdNodeObject>(); TSharedPtr<FJsonObject> Node = MakeShared<FJsonObject>(); Node->SetNumberField("a", C.A); Node->SetNumberField("r", C.R); Node->SetNumberField("g", C.G); Node->SetNumberField("b", C.B); NodeObject->Initialize(Node); return NodeObject; } FLinearColor ULaunchDarklyHelpers::LdNodeObjectToLinearColor(ULdNodeObject* LdDataObject) { TSharedPtr<FJsonObject> LdData = LdDataObject->GetObjectData(); if(LdData == nullptr) { return FLinearColor(); } FLinearColor C( LdData->HasTypedField<EJson::Number>("r") ? LdData->GetNumberField("r") : 0.0f, LdData->HasTypedField<EJson::Number>("g") ? LdData->GetNumberField("g") : 0.0f, LdData->HasTypedField<EJson::Number>("b") ? LdData->GetNumberField("b") : 0.0f, LdData->HasTypedField<EJson::Number>("a") ? LdData->GetNumberField("a") : 0.0f ); return C; } ULdNodeObject* ULaunchDarklyHelpers::LinearColorToLdNodeObject(FLinearColor LC) { ULdNodeObject* NodeObject = NewObject<ULdNodeObject>(); TSharedPtr<FJsonObject> Node = MakeShared<FJsonObject>(); Node->SetNumberField("a", LC.A); Node->SetNumberField("r", LC.R); Node->SetNumberField("g", LC.G); Node->SetNumberField("b", LC.B); NodeObject->Initialize(Node); return NodeObject; } FString ULaunchDarklyHelpers::LdNodeObjectHashToString(ULdNodeObject* const LdNodeData) { return LdNodeData != nullptr ? JsonObjectToString(LdNodeData->GetObjectData()) : FString("NULL NODE"); } FString ULaunchDarklyHelpers::JsonObjectToString(TSharedPtr<FJsonObject> LdNodeData) { if(LdNodeData != nullptr) { FString JsonOutput; TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&JsonOutput); FJsonSerializer::Serialize(LdNodeData.ToSharedRef(), Writer); return JsonOutput.IsEmpty() ? FString("{}") : JsonOutput; } return FString("{}"); } TSharedPtr<FJsonObject> ULaunchDarklyHelpers::StringToJsonObject(FString LdNodeData) { TSharedPtr<FJsonObject> JsonOutput = MakeShared<FJsonObject>(); if(LdNodeData.IsEmpty() == false) { TSharedRef< TJsonReader<> > Writer = TJsonReaderFactory<>::Create(LdNodeData); FJsonSerializer::Deserialize(Writer, JsonOutput); } return JsonOutput; }
30.060606
104
0.709173
Mohawk-Valley-Interactive
d10d22a81ca7da0eb2082636b830b1e0e56ca319
1,675
cpp
C++
windows/pw6e.official/CPlusPlus/Chapter13/DialSketch/DialSketch/MainPage.xaml.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
1
2016-11-23T08:18:08.000Z
2016-11-23T08:18:08.000Z
windows/pw6e.official/CPlusPlus/Chapter13/DialSketch/DialSketch/MainPage.xaml.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
null
null
null
windows/pw6e.official/CPlusPlus/Chapter13/DialSketch/DialSketch/MainPage.xaml.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
1
2016-11-23T08:17:34.000Z
2016-11-23T08:17:34.000Z
// // MainPage.xaml.cpp // Implementation of the MainPage class. // #include "pch.h" #include "MainPage.xaml.h" using namespace DialSketch; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Controls::Primitives; using namespace Windows::UI::Xaml::Data; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; MainPage::MainPage() { InitializeComponent(); Loaded += ref new RoutedEventHandler([this] (Object^ sender, RoutedEventArgs^ args) { polyline->Points->Append(Point((float)(drawingGrid->ActualWidth / 2), (float)(drawingGrid->ActualHeight / 2))); }); } void MainPage::OnDialValueChanged(Object^ sender, RangeBaseValueChangedEventArgs^ args) { Dial^ dial = dynamic_cast<Dial^>(sender); RotateTransform^ rotate = dynamic_cast<RotateTransform^>(dial->RenderTransform); rotate->Angle = args->NewValue; double xFraction = (horzDial->Value - horzDial->Minimum) / (horzDial->Maximum - horzDial->Minimum); double yFraction = (vertDial->Value - vertDial->Minimum) / (vertDial->Maximum - vertDial->Minimum); double x = xFraction * drawingGrid->ActualWidth; double y = yFraction * drawingGrid->ActualHeight; polyline->Points->Append(Point((float)x, (float)y)); } void MainPage::OnClearButtonClick(Object^ sender, RoutedEventArgs^ args) { polyline->Points->Clear(); }
32.211538
104
0.688955
nnaabbcc
d1110c51b076ce5fb65e3df0b5f00a1f23f4d286
20,497
cpp
C++
middleware/serviceframework/source/archive/ini.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
middleware/serviceframework/source/archive/ini.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
middleware/serviceframework/source/archive/ini.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
/* * ini.cpp * * Created on: Feb 11, 2015 * Author: kristone */ #include "sf/archive/ini.h" #include "sf/exception.h" #include "common/transcode.h" #include <iterator> #include <algorithm> #include <locale> namespace casual { namespace sf { namespace archive { namespace ini { namespace { namespace local { const std::string magic{ '@' }; } // local } // Load::Load() = default; Load::~Load() = default; namespace { namespace local { std::string trim( std::string string) { const auto trimmer = [] ( const std::string::value_type character) { return ! std::isspace( character, std::locale::classic()); }; string.erase( string.begin(), std::find_if( string.begin(), string.end(), trimmer)); string.erase( std::find_if( string.rbegin(), string.rend(), trimmer).base(), string.end()); return string; } // TODO: Make it streamable std::string decode( const std::string& data) { std::ostringstream stream; for( std::string::size_type idx = 0; idx < data.size(); ++idx) { if( data[idx] == '\\') { // TODO: handle all control-characters (and back-slash) switch( data[++idx]) { case '\\': stream.put( '\\'); break; case '0': stream.put( '\0'); break; case 'a': stream.put( '\a'); break; case 'b': stream.put( '\b'); break; case 'f': stream.put( '\f'); break; case 'n': stream.put( '\n'); break; case 'r': stream.put( '\r'); break; case 't': stream.put( '\t'); break; case 'v': stream.put( '\v'); break; default: throw exception::archive::invalid::Document{ "Invalid content"}; } } else { stream.put( data[idx]); } } return stream.str(); } void parse_flat( tree& document, std::istream& stream) { // // This function would make Sean Parent cry !!! // auto composite = &document; std::vector<std::string> last; std::string line; while( std::getline( stream, line)) { const auto candidate = trim( line); if( candidate.empty()) { // // Found nothing and we just ignore it // continue; } if( candidate.find_first_of( "#;") == 0) { // // Found a comment and we just ignore it // continue; } const auto separator = line.find_first_of( '='); if( separator != std::string::npos) { // // We found a (potential) value and some data // auto name = trim( line.substr( 0, separator)); auto data = line.substr( separator + 1); // // Add it to the tree after some unmarshalling // composite->values.emplace( std::move( name), decode( data)); continue; } if( candidate.front() == '[' && candidate.back() == ']') { // // Found a potential section (a.k.a. composite a.k.a. serializable) // // // An internal lambda-helper to split a qualified name // const auto splitter = [] ( std::string qualified) { std::vector<std::string> result; std::istringstream stream( std::move( qualified)); std::string name; while( std::getline( stream, name, '.')) { auto candidate = trim( std::move( name) ); if( candidate.empty()) { throw exception::archive::invalid::Document{ "Invalid name"}; } else { result.push_back( std::move( candidate)); } } if( result.empty()) { throw exception::archive::invalid::Document{ "Invalid name"}; } return result; }; // // An internal lambda-helper to help out where to add this section // const auto finder = [] ( const std::vector<std::string>& last, const std::vector<std::string>& next) { if( next.size() > last.size()) { return std::mismatch( last.begin(), last.end(), next.begin()).second; } auto match = std::mismatch( next.begin(), next.end(), last.begin()); return match.first != next.end() ? match.first : std::prev( match.first); }; // // First we split the string (e.g. 'foo.bar' into 'foo' and 'bar') // auto next = splitter( { candidate.begin() + 1, candidate.end() - 1 } ); const auto inserter = finder( last, next); composite = &document; // // Search from root to find out where this should be added // for( auto name = next.begin(); name != inserter; ++name) { composite = &std::prev( composite->children.upper_bound( *name))->second; } // // Add all names where they should be added // for( auto name = inserter; name != next.end(); ++name) { composite = &composite->children.emplace( *name, tree())->second; } // // Keep this qualified name until next time // std::swap( last, next); continue; } if( candidate.back() == '\\') { // // TODO: Possibly append to previous data // // Can be done by using 'inserter' and previous.back() // } // // Unknown content // exception::archive::invalid::Document( "Invalid document"); } } } // local } // const tree& Load::serialize( std::istream& stream) { local::parse_flat( m_document, stream); return source(); } const tree& Load::serialize( const std::string& ini) { std::istringstream stream( ini); return serialize( stream); } const tree& Load::source() const { return m_document; } namespace reader { Implementation::Implementation( const tree& document) : m_node_stack{ &document } {} std::tuple< std::size_t, bool> Implementation::container_start( const std::size_t size, const char* const name) { if( name) { // // We do not know whether it's a node or data // const auto node = m_node_stack.back()->children.equal_range( name); if( node.first != node.second) { // // Transform backwards // for( auto iterator = node.second; iterator != node.first; --iterator) { m_node_stack.push_back( &std::prev( iterator)->second); } return std::make_tuple( std::distance( node.first, node.second), true); } const auto data = m_node_stack.back()->values.equal_range( name); if( data.first != data.second) { // // Transform backwards // for( auto iterator = data.second; iterator != data.first; --iterator) { m_data_stack.push_back( &std::prev( iterator)->second); } return std::make_tuple( std::distance( data.first, data.second), true); } } else { // // An idea to handle this is by creating fake serializable // // E.g. [@name], [@name.@name], etc or something // throw exception::archive::invalid::Node{ "Nested containers not supported (yet)"}; } // // Note that we return 'true' anyway // return std::make_tuple( 0, true); } void Implementation::container_end( const char* const name) { } bool Implementation::serialtype_start( const char* const name) { if( name) { const auto node = m_node_stack.back()->children.find( name); if( node != m_node_stack.back()->children.end()) { m_node_stack.push_back( &node->second); } else { return false; } } else { // // It must have been a container-content and thus already found // } return true; } void Implementation::serialtype_end( const char* const name) { m_node_stack.pop_back(); } bool Implementation::value_start( const char* name) { if( name) { const auto data = m_node_stack.back()->values.find( name); if( data != m_node_stack.back()->values.end()) { m_data_stack.push_back( &data->second); } else { return false; } } else { // // It must have been a container-content and thus already found // } return true; } void Implementation::value_end( const char* name) { m_data_stack.pop_back(); } void Implementation::decode( const std::string& data, bool& value) const { std::istringstream stream( data); stream >> std::boolalpha >> value; } void Implementation::decode( const std::string& data, char& value) const { value = data.empty() ? '\0' : data.front(); } void Implementation::decode( const std::string& data, std::string& value) const { value = data; } void Implementation::decode( const std::string& data, std::vector<char>& value) const { // // Binary data might be double-decoded (in the end) // value = common::transcode::base64::decode( data); } } // reader namespace { namespace local { // TODO: Make it streamable std::string encode( const std::string& data) { std::ostringstream stream; for( const auto sign : data) { // TODO: handle all control-characters (and back-slash) //if( std::iscntrl( sign, std::locale::classic())){ ... } switch( sign) { case '\\': stream << "\\\\"; break; case '\0': stream << "\\0"; break; case '\a': stream << "\\a"; break; case '\b': stream << "\\b"; break; case '\f': stream << "\\f"; break; case '\n': stream << "\\n"; break; case '\r': stream << "\\r"; break; case '\t': stream << "\\t"; break; case '\v': stream << "\\v"; break; default: stream.put( sign); break; } } return stream.str(); } void write_flat( const tree& node, std::ostream& stream, const std::string& name = "") { for( const auto& value : node.values) { stream << value.first << '=' << encode( value.second) << '\n'; } for( const auto& child : node.children) { const auto qualified = name.empty() ? child.first : name + '.' + child.first; // // Let's print useless empty sections anyway ('cause // reading need 'em as of today) // //if( ! child.second.values.empty()) { stream << '\n' << '[' << qualified << ']' << '\n'; } write_flat( child.second, stream, qualified); } } /* void write_tree( const tree& node, std::ostream& stream, std::string::size_type indent = 0) { for( const auto& value : node.values) { stream << std::string( indent, ' ') << value.first << '=' << value.second << '\n'; } for( const auto& child : node.children) { ++indent; stream << '\n' << std::string( indent, ' ') << '[' << child.first << ']' << '\n'; write_tree( child.second, stream, indent); ++indent; } } */ } // local } // Save::Save() = default; Save::~Save() = default; void Save::serialize( std::ostream& stream) const { local::write_flat( m_document, stream); } void Save::serialize( std::string& ini) const { std::ostringstream stream; serialize( stream); ini.assign( stream.str()); } tree& Save::target() { return m_document; } namespace writer { Implementation::Implementation( tree& document) : m_node_stack{ &document } {} std::size_t Implementation::container_start( const std::size_t size, const char* const name) { // // We do not know where it's node or data // if( name) { m_name_stack.push_back( name); } else { throw exception::archive::invalid::Node{ "Nested containers not supported (yet)"}; } return size; } void Implementation::container_end( const char* const name) { if( name) { m_name_stack.pop_back(); } } void Implementation::serialtype_start( const char* const name) { const auto final = name ? name : m_name_stack.back(); const auto child = m_node_stack.back()->children.emplace( final, tree()); m_node_stack.push_back( &child->second); } void Implementation::serialtype_end( const char* const name) { m_node_stack.pop_back(); } void Implementation::write( std::string data, const char* const name) { const auto final = name ? name : m_name_stack.back(); m_node_stack.back()->values.emplace( final, std::move( data)); } std::string Implementation::encode( const bool& value) const { std::ostringstream stream; stream << std::boolalpha << value; return stream.str(); } std::string Implementation::encode( const char& value) const { return std::string{ value}; } std::string Implementation::encode( const std::vector<char>& value) const { // // Binary data might be double-encoded // return common::transcode::base64::encode( value); } } // writer } // xml } // archive } // sf } // casual
33.166667
127
0.354296
tompis
d1170012f63438cfd843d6df93e963044cebcf69
4,516
cpp
C++
Source/Renderer/Resources/Shader/Preprocessor.cpp
pgrabas/MoonGlare
25807680700697023d04830402af168f624ffb35
[ "MIT" ]
1
2018-03-18T16:29:16.000Z
2018-03-18T16:29:16.000Z
Source/Renderer/Resources/Shader/Preprocessor.cpp
pgrabas/MoonGlare
25807680700697023d04830402af168f624ffb35
[ "MIT" ]
null
null
null
Source/Renderer/Resources/Shader/Preprocessor.cpp
pgrabas/MoonGlare
25807680700697023d04830402af168f624ffb35
[ "MIT" ]
null
null
null
#include "Preprocessor.h" #include <functional> namespace MoonGlare::Renderer::Resources::Shader { bool ShaderFileCache::ReadFile(const std::string &FName, const ReadBuffer *&out) { auto it = loadedFiles.find(FName); if (it != loadedFiles.end()) { if (!it->second.has_value()) { AddLogf(Warning, "Unable to load file '%s'", FName.c_str()); return false; } out = &it->second.value(); return true; } StarVFS::ByteTable data; if (!GetFileSystem()->OpenFile(data, "file:///Shaders/" + FName)) { return false; } ReadBuffer buf; std::stringstream ss; ss << data.c_str(); while (ss) { std::string line; std::getline(ss, line); buf.emplace_back(std::move(line)); } loadedFiles[FName] = std::move(buf); out = &loadedFiles[FName].value(); return true; } //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- const std::array<Preprocessor::PreprocessorToken, 1> Preprocessor::s_Tokens = { PreprocessorToken{ std::regex(R"(^\s*#include\s+[<"]([/A-Za-z0-9_\.]+)[">]\s*)"), &Preprocessor::IncludeToken }, }; Preprocessor::Preprocessor(ShaderFileCache *fc): fileCache(fc) { } Preprocessor::~Preprocessor() { } void Preprocessor::PushFile(const std::string & Name) { try { if (outputBuffer.empty()) GenerateDefines(); Process(Name, 0); } catch (MissingFileException &e) { if (e.m_IncludeLevel > 0) { AddLogf(Error, "Error while processing file %s", Name.c_str()); throw e; } } catch (ParseException &e) { AddLogf(Error, "Error while processing file %s", Name.c_str()); throw e; } } void Preprocessor::GetOutput(std::string &Output) { std::stringstream ss; for (auto line : outputBuffer) ss << line << std::endl; Output = ss.str(); } void Preprocessor::ClearOutput() { includedFiles.clear(); outputBuffer.clear(); } void Preprocessor::Clear() { ClearOutput(); defines.clear(); } void Preprocessor::Process(const std::string &FName, int level) { if (includedFiles.find(FName) != includedFiles.end()) { outputBuffer.pushf("//@ skip[%d] %s - included", level, FName.c_str()); return; } includedFiles[FName] = true; const ReadBuffer *lines; if (!fileCache->ReadFile(FName, lines)) { if (level > 0) { AddLogf(Error, "Unable to load file '%s'", FName.c_str()); } throw MissingFileException{ FName , level }; } outputBuffer.pushf("//@ start[%d] %s", level, FName.c_str()); unsigned linenum = 0; try { outputBuffer.push(fmt::format("#line {}", 1)); for(const auto &line : *lines) { ++linenum; bool handled = false; std::smatch match; for (auto token : s_Tokens) { if (std::regex_search(line, match, token.regExp)) { outputBuffer.pushs("//@ %s", line); (this->*token.handler)(FName, line, level, std::move(match)); outputBuffer.push(fmt::format("#line {}", linenum)); handled = true; break; } } if (!handled) { outputBuffer.push_back(line); } } } catch (ParseException &e) { AddLogf(Error, "Error while processing included file %s at line %d", FName.c_str(), linenum); throw e; } outputBuffer.pushf("//@ end[%d] %s", level, FName.c_str()); } void Preprocessor::GenerateDefines() { for (auto &it : defines) { std::string line; line = "#define "; line += it.first; line += " "; line += it.second; outputBuffer.push_back(line); } } void Preprocessor::IncludeToken(const std::string &FName, const std::string &line, int level, std::smatch match) { std::string iName = match[1]; try { outputBuffer.pushf("//@ pause[%d] %s", level, FName.c_str()); Process(iName, level + 1); outputBuffer.pushf("//@ continue[%d] %s", level, FName.c_str()); } catch (ParseException &) { AddLogf(Error, "Error while processing included file %s", iName.c_str()); throw; } } } //namespace MoonGlare::Asset::Shader
26.880952
116
0.534544
pgrabas
d1176f4566218035d596cbd43da3daa038bbc002
1,177
cpp
C++
Failed/1118E-failed.cpp
fahimfarhan/legendary-coding-odyssey
55289e05aa04f866201c607bed00c505cd9c4df9
[ "MIT" ]
3
2019-07-20T07:26:31.000Z
2020-08-06T09:31:09.000Z
Failed/1118E-failed.cpp
fahimfarhan/legendary-coding-odyssey
55289e05aa04f866201c607bed00c505cd9c4df9
[ "MIT" ]
null
null
null
Failed/1118E-failed.cpp
fahimfarhan/legendary-coding-odyssey
55289e05aa04f866201c607bed00c505cd9c4df9
[ "MIT" ]
4
2019-06-20T18:43:32.000Z
2020-10-07T16:45:23.000Z
#include <bits/stdc++.h> using namespace std; #define PI 2*acos(0) #define ll long long int bool myAssert(bool b); void testDrivenDevelopment(); int start(int argc=0, char const *argv[] = NULL); ll n,k; vector<int> *g; bool *isvisited; int main(int argc, char const *argv[]) { /* code */ /* Soln soln */ // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); /* cout << setprecision(8); cout << num1 << endl; */ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>k; ll count=0; /* for(int i=1; i<=k; i++){ for(int j=i+1; j<=k; j++){ count+=2; } }*/ double temp1=0,temp2 = log(n); for(int i=1; i<k; i++){ temp1+=log(i); if(temp1>=temp2){ break; } } if(temp1<temp2){ cout<<"NO\n"; exit(0); }else{ cout<<"YES\n"; } /* if(count < n){ cout<<"NO\n"; exit(0); }else{ cout<<"YES\n"; }*/ count=0; for(int i=1; i<k; i++){ for(int j=i+1; j<=k; j++){ cout<<i<<" "<<j<<"\n"; count++; if(count == n){ exit(0); } cout<<j<<" "<<i<<"\n"; count++; if(count == n){ exit(0); } } } return 0; }
16.123288
49
0.486831
fahimfarhan
d11a0dafe97ebc1495c91642b9e8c182c6e54f88
916
cpp
C++
TallerProgra/Introduccion/A_HolidayOfEquality.cpp
CaDe27/Co-digos
9eea1dbf6ed06fd115391328c0a2481029c83fc0
[ "MIT" ]
null
null
null
TallerProgra/Introduccion/A_HolidayOfEquality.cpp
CaDe27/Co-digos
9eea1dbf6ed06fd115391328c0a2481029c83fc0
[ "MIT" ]
null
null
null
TallerProgra/Introduccion/A_HolidayOfEquality.cpp
CaDe27/Co-digos
9eea1dbf6ed06fd115391328c0a2481029c83fc0
[ "MIT" ]
null
null
null
/* Pensemos en cuánto va a tener cada persona despues de darles el dinero Como quiero dar lo menos posible, quiero que esta altura sea minima esta altura puede ser la de la persona con mas dinero no puede ser menos porque tendria que quitarle dinero a esta persona y si fuera mayor que esta, involucraría dar más dinero Reto: hazlo con memoria O(1), es decir, sin usar el arreglo */ #include <iostream> using namespace std; int main(){ int n; cin>>n; int welfare[n], maxWelfare; maxWelfare = 0; for(int i = 0; i < n; i++){ cin>>welfare[i]; maxWelfare = max(maxWelfare, welfare[i]); } //calculamos la cantidad de monedas que debemos dar int monedas, totalQueDoy = 0; for(int i = 0; i < n; ++i){ monedas = maxWelfare - welfare[i]; totalQueDoy += monedas; } cout<<totalQueDoy<<"\n"; return 0; }
24.756757
74
0.626638
CaDe27
d11a57104e47857ede1af0d7f2cc5eff68fef707
2,314
cpp
C++
geometry/barycentre_calculator_test.cpp
tinygrox/Principia
49a25646c673dcd84cefbc6295df410fc6d927d5
[ "MIT" ]
565
2015-01-04T21:47:18.000Z
2022-03-22T12:04:58.000Z
geometry/barycentre_calculator_test.cpp
tinygrox/Principia
49a25646c673dcd84cefbc6295df410fc6d927d5
[ "MIT" ]
1,019
2015-01-03T11:42:27.000Z
2022-03-29T21:02:15.000Z
geometry/barycentre_calculator_test.cpp
tinygrox/Principia
49a25646c673dcd84cefbc6295df410fc6d927d5
[ "MIT" ]
92
2015-02-11T23:08:58.000Z
2022-03-21T03:35:37.000Z
 #include "geometry/barycentre_calculator.hpp" #include <vector> #include "geometry/frame.hpp" #include "geometry/grassmann.hpp" #include "gtest/gtest.h" #include "quantities/named_quantities.hpp" #include "quantities/quantities.hpp" #include "quantities/si.hpp" #include "testing_utilities/almost_equals.hpp" namespace principia { using geometry::Frame; using quantities::Entropy; using quantities::KinematicViscosity; using testing_utilities::AlmostEquals; namespace si = quantities::si; namespace geometry { class BarycentreCalculatorTest : public testing::Test { protected: using World = Frame<enum class WorldTag>; BarycentreCalculatorTest() : b1_({1 * si::Unit<Entropy>, -2 * si::Unit<Entropy>, 3 * si::Unit<Entropy>}), b2_({-9 * si::Unit<Entropy>, 8 * si::Unit<Entropy>, 7 * si::Unit<Entropy>}), k1_(4 * si::Unit<KinematicViscosity>), k2_(5 * si::Unit<KinematicViscosity>) {} Bivector<Entropy, World> b1_; Bivector<Entropy, World> b2_; KinematicViscosity k1_; KinematicViscosity k2_; }; using BarycentreCalculatorDeathTest = BarycentreCalculatorTest; TEST_F(BarycentreCalculatorDeathTest, Error) { using Calculator = BarycentreCalculator<Bivector<Entropy, World>, double>; EXPECT_DEATH({ Calculator calculator; calculator.Get(); }, "Empty BarycentreCalculator"); } TEST_F(BarycentreCalculatorTest, Bivector) { BarycentreCalculator<Bivector<Entropy, World>, KinematicViscosity> barycentre_calculator; barycentre_calculator.Add(b1_, k1_); barycentre_calculator.Add(b2_, k2_); EXPECT_THAT(barycentre_calculator.Get(), AlmostEquals( Bivector<Entropy, World>({(-41.0 / 9.0) * si::Unit<Entropy>, (32.0 / 9.0) * si::Unit<Entropy>, (47.0 / 9.0) * si::Unit<Entropy>}), 0)); } TEST_F(BarycentreCalculatorTest, Scalar) { BarycentreCalculator<KinematicViscosity, double> barycentre_calculator; barycentre_calculator.Add(k1_, -3); barycentre_calculator.Add(k2_, 7); EXPECT_THAT(barycentre_calculator.Get(), AlmostEquals((23.0 / 4.0) * si::Unit<KinematicViscosity>, 0)); } } // namespace geometry } // namespace principia
30.051948
79
0.671997
tinygrox
d11a5f09e4d7dbc6725bf80f68773ecb9157fcac
555
hpp
C++
include/RED4ext/Types/generated/anim/PoseLink.hpp
Cyberpunk-Extended-Development-Team/RED4ext.SDK
2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae
[ "MIT" ]
1
2021-02-01T23:07:50.000Z
2021-02-01T23:07:50.000Z
include/RED4ext/Types/generated/anim/PoseLink.hpp
Cyberpunk-Extended-Development-Team/RED4ext.SDK
2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae
[ "MIT" ]
null
null
null
include/RED4ext/Types/generated/anim/PoseLink.hpp
Cyberpunk-Extended-Development-Team/RED4ext.SDK
2dc828c761d87a1b4235ce9ca4fbdf9fb4312fae
[ "MIT" ]
null
null
null
#pragma once // This file is generated from the Game's Reflection data #include <cstdint> #include <RED4ext/Common.hpp> #include <RED4ext/REDhash.hpp> #include <RED4ext/Handle.hpp> namespace RED4ext { namespace anim { struct AnimNode_Base; } namespace anim { struct PoseLink { static constexpr const char* NAME = "animPoseLink"; static constexpr const char* ALIAS = NAME; WeakHandle<anim::AnimNode_Base> node; // 00 uint8_t unk10[0x18 - 0x10]; // 10 }; RED4EXT_ASSERT_SIZE(PoseLink, 0x18); } // namespace anim } // namespace RED4ext
21.346154
57
0.724324
Cyberpunk-Extended-Development-Team
d1206e83b62507b2425d11c2a415be73fe2dd32f
7,890
cc
C++
mysql-secret-store/windows-credential/windows_credential_helper.cc
mueller/mysql-shell
29bafc5692bd536a12c4e41c54cb587375fe52cf
[ "Apache-2.0" ]
119
2016-04-14T14:16:22.000Z
2022-03-08T20:24:38.000Z
mysql-secret-store/windows-credential/windows_credential_helper.cc
mueller/mysql-shell
29bafc5692bd536a12c4e41c54cb587375fe52cf
[ "Apache-2.0" ]
9
2017-04-26T20:48:42.000Z
2021-09-07T01:52:44.000Z
mysql-secret-store/windows-credential/windows_credential_helper.cc
mueller/mysql-shell
29bafc5692bd536a12c4e41c54cb587375fe52cf
[ "Apache-2.0" ]
51
2016-07-20T05:06:48.000Z
2022-03-09T01:20:53.000Z
/* * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, * as published by the Free Software Foundation. * * This program is also distributed with certain software (including * but not limited to OpenSSL) that is licensed under separate terms, as * designated in a particular file or component or in included license * documentation. The authors of MySQL hereby grant you an additional * permission to link the program and your derivative works with the * separately licensed software that they have included with MySQL. * 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, version 2.0, for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mysql-secret-store/windows-credential/windows_credential_helper.h" #include <WinCred.h> #include <memory> #include <utility> #include "mysqlshdk/libs/utils/utils_file.h" #include "mysqlshdk/libs/utils/utils_general.h" #include "mysqlshdk/libs/utils/utils_string.h" using mysql::secret_store::common::get_helper_exception; using mysql::secret_store::common::Helper_exception; using mysql::secret_store::common::Helper_exception_code; namespace mysql { namespace secret_store { namespace windows_credential { namespace { constexpr auto k_company_name = "Oracle"; constexpr auto k_name_separator = "|"; constexpr DWORD k_credential_type = CRED_TYPE_GENERIC; // generic credential } // namespace Windows_credential_helper::Windows_credential_helper() : common::Helper("windows-credential", shcore::get_long_version(), MYSH_HELPER_COPYRIGHT), m_persist_mode{CRED_PERSIST_LOCAL_MACHINE} {} void Windows_credential_helper::check_requirements() { DWORD maximum_persist[CRED_TYPE_MAXIMUM]; if (!CredGetSessionTypes(CRED_TYPE_MAXIMUM, maximum_persist)) { throw Helper_exception{"Failed to check persistent mode: " + shcore::get_last_error()}; } if (maximum_persist[k_credential_type] < CRED_PERSIST_LOCAL_MACHINE) { throw Helper_exception{"Credentials cannot be persisted"}; } m_persist_mode = maximum_persist[k_credential_type]; } void Windows_credential_helper::store(const common::Secret &secret) { auto url_keyword = get_url_keyword(); auto secret_type_keyword = get_secret_type_keyword(); CREDENTIAL_ATTRIBUTE attributes[2]; attributes[0].Keyword = (LPSTR)url_keyword.c_str(); attributes[0].Flags = 0; attributes[0].ValueSize = secret.id.url.length(); attributes[0].Value = (LPBYTE)secret.id.url.c_str(); attributes[1].Keyword = (LPSTR)secret_type_keyword.c_str(); attributes[1].Flags = 0; attributes[1].ValueSize = secret.id.secret_type.length(); attributes[1].Value = (LPBYTE)secret.id.secret_type.c_str(); auto name = get_name(secret.id); CREDENTIAL cred; cred.Flags = 0; // no flags cred.Type = k_credential_type; cred.TargetName = (LPSTR)name.c_str(); // unique name cred.Comment = nullptr; // no comments! cred.LastWritten = {0, 0}; // ignored for write operations cred.CredentialBlobSize = secret.secret.length(); cred.CredentialBlob = (LPBYTE)secret.secret.c_str(); cred.Persist = m_persist_mode; cred.AttributeCount = shcore::array_size(attributes); cred.Attributes = attributes; cred.TargetAlias = nullptr; // ignored in case of CRED_TYPE_GENERIC cred.UserName = nullptr; // ignored in case of CRED_TYPE_GENERIC if (!CredWrite(&cred, 0)) { throw Helper_exception{"Failed to store the secret: " + shcore::get_last_error()}; } } void Windows_credential_helper::get(const common::Secret_id &id, std::string *secret) { auto name = get_name(id); PCREDENTIAL cred = nullptr; if (!CredRead(name.c_str(), k_credential_type, 0, &cred)) { if (GetLastError() == ERROR_NOT_FOUND) { throw get_helper_exception(Helper_exception_code::NO_SUCH_SECRET); } else { throw Helper_exception{"Failed to get the secret: " + shcore::get_last_error()}; } } else { const std::unique_ptr<CREDENTIAL, decltype(&CredFree)> deleter{cred, CredFree}; *secret = std::string(reinterpret_cast<char *>(cred->CredentialBlob), cred->CredentialBlobSize); } } void Windows_credential_helper::erase(const common::Secret_id &id) { auto name = get_name(id); if (!CredDelete(name.c_str(), k_credential_type, 0)) { if (GetLastError() == ERROR_NOT_FOUND) { throw get_helper_exception(Helper_exception_code::NO_SUCH_SECRET); } else { throw Helper_exception{"Failed to erase the secret: " + shcore::get_last_error()}; } } } void Windows_credential_helper::list(std::vector<common::Secret_id> *secrets) { PCREDENTIAL *credentials = nullptr; DWORD count = 0; auto filter = get_search_pattern(); if (!CredEnumerate(filter.c_str(), 0, &count, &credentials)) { if (GetLastError() == ERROR_NOT_FOUND) { // empty list, not an error return; } else { throw Helper_exception{"Failed to list the secrets: " + shcore::get_last_error()}; } } else { const std::unique_ptr<PCREDENTIAL, decltype(&CredFree)> deleter{credentials, CredFree}; const auto url_keyword = get_url_keyword(); const auto secret_type_keyword = get_secret_type_keyword(); for (DWORD i = 0; i < count; ++i) { std::string url; std::string secret_type; for (DWORD j = 0; j < credentials[i]->AttributeCount; ++j) { const auto &attribute = credentials[i]->Attributes[j]; const auto keyword = std::string{attribute.Keyword}; auto value = std::string(reinterpret_cast<char *>(attribute.Value), attribute.ValueSize); if (keyword == url_keyword) { url = std::move(value); } else if (keyword == secret_type_keyword) { secret_type = std::move(value); } } if (url.empty() || secret_type.empty()) { throw Helper_exception{"Invalid entry detected"}; } secrets->emplace_back(common::Secret_id{secret_type, url}); } } } std::string Windows_credential_helper::get_name_prefix() const { return shcore::str_join(std::vector<std::string>{k_company_name, name()}, k_name_separator); } std::string Windows_credential_helper::get_name( const common::Secret_id &id) const { return shcore::str_join( std::vector<std::string>{get_name_prefix(), id.secret_type, id.url}, k_name_separator); } std::string Windows_credential_helper::get_search_pattern() const { return shcore::str_join(std::vector<std::string>{get_name_prefix(), "*"}, k_name_separator); } std::string Windows_credential_helper::get_keyword_prefix() const { return shcore::str_join( std::vector<std::string>{k_company_name, name() + "-"}, "_"); } std::string Windows_credential_helper::get_url_keyword() const { return get_keyword_prefix() + "url"; } std::string Windows_credential_helper::get_secret_type_keyword() const { return get_keyword_prefix() + "secret-type"; } } // namespace windows_credential } // namespace secret_store } // namespace mysql
35.701357
80
0.679341
mueller
d1234c0f804861dc40b643f7929a0fa018642dec
45,488
cpp
C++
3rdparty/dshowbase/src/gmf/sink.cpp
jpjodoin/litiv
435556bea20d60816aff492f50587b1a2d748b21
[ "BSD-3-Clause" ]
97
2015-10-16T04:32:33.000Z
2022-03-29T07:04:02.000Z
3rdparty/dshowbase/src/gmf/sink.cpp
jpjodoin/litiv
435556bea20d60816aff492f50587b1a2d748b21
[ "BSD-3-Clause" ]
19
2016-07-01T16:37:02.000Z
2020-09-10T06:09:39.000Z
3rdparty/dshowbase/src/gmf/sink.cpp
jpjodoin/litiv
435556bea20d60816aff492f50587b1a2d748b21
[ "BSD-3-Clause" ]
41
2015-11-17T05:59:23.000Z
2022-02-16T09:30:28.000Z
// // GDCL Multigraph Framework // // Sink.cpp: implementation of sink filter and input pin // // Copyright (c) GDCL 2004. All Rights Reserved. // You are free to re-use this as the basis for your own filter development, // provided you retain this copyright notice in the source. // http://www.gdcl.co.uk #pragma warning(push) #pragma warning(disable:4312) #pragma warning(disable:4995) #include "litiv/3rdparty/dshowbase/streams.h" #include <comdef.h> _COM_SMARTPTR_TYPEDEF(IMemAllocator, IID_IMemAllocator); _COM_SMARTPTR_TYPEDEF(IGraphBuilder, IID_IGraphBuilder); _COM_SMARTPTR_TYPEDEF(IBaseFilter, IID_IBaseFilter); _COM_SMARTPTR_TYPEDEF(IEnumMediaTypes, IID_IEnumMediaTypes); _COM_SMARTPTR_TYPEDEF(IMediaSample, IID_IMediaSample); _COM_SMARTPTR_TYPEDEF(IMediaSample2, IID_IMediaSample2); _COM_SMARTPTR_TYPEDEF(IEnumFilters, IID_IEnumFilters); _COM_SMARTPTR_TYPEDEF(IQualityControl, IID_IQualityControl); _COM_SMARTPTR_TYPEDEF(IEnumPins, IID_IEnumPins); _COM_SMARTPTR_TYPEDEF(IPin, IID_IPin); _COM_SMARTPTR_TYPEDEF(IEnumMediaTypes, IID_IEnumMediaTypes); _COM_SMARTPTR_TYPEDEF(IMediaControl, IID_IMediaControl); _COM_SMARTPTR_TYPEDEF(IMediaSeeking, IID_IMediaSeeking); _COM_SMARTPTR_TYPEDEF(IVideoWindow, IID_IVideoWindow); _COM_SMARTPTR_TYPEDEF(IBasicVideo, IID_IBasicVideo); _COM_SMARTPTR_TYPEDEF(IPinConnection, IID_IPinConnection); #pragma warning(pop) #include "litiv/3rdparty/dshowbase/gmf/smartPtr.h" #include "litiv/3rdparty/dshowbase/gmf/bridge.h" #include "litiv/3rdparty/dshowbase/gmf/sink.h" #pragma warning(disable: 4786) // debug info truncated #include <list> using namespace std; #include <sstream> BridgeSink::BridgeSink(BridgeController* pController) : m_tFirst(0), m_bLastDiscarded(false), m_nEOS(0), m_dwROT(0), CBaseFilter(NAME("BridgeSink filter"), NULL, &m_csFilter, GUID_NULL) { HRESULT hr = S_OK; m_nPins = pController->StreamCount(); m_pPins = new smart_ptr<BridgeSinkInput>[m_nPins]; for(int n = 0; n < m_nPins; n++) { ostringstream strm; strm << "Input " << (n+1); _bstr_t strName = strm.str().c_str(); m_pPins[n] = new BridgeSinkInput(this, pController->GetStream(n), m_pLock, &hr, strName); } LOG((TEXT("Sink 0x%x has %d pins"), this, m_nPins)); } STDMETHODIMP BridgeSink::NonDelegatingQueryInterface(REFIID iid, void** ppv) { if (iid == IID_IMediaSeeking) { // implement IMediaSeeking directly ourselves, not via // a pass-through proxy, so that we can aggregate multiple input pins // (needed for WMV playback) return GetInterface((IMediaSeeking*)this, ppv); } else if (iid == __uuidof(IBridgeSink)) { return GetInterface((IBridgeSink*)this, ppv); } else { return CBaseFilter::NonDelegatingQueryInterface(iid, ppv); } } int BridgeSink::GetPinCount() { return m_nPins; } CBasePin* BridgeSink::GetPin(int n) { if ((n < 0) || (n >= m_nPins)) { return NULL; } return m_pPins[n]; } STDMETHODIMP BridgeSink::GetBridgePin(int nPin, BridgeSinkInput** ppPin) { if ((nPin < 0) || (nPin >= m_nPins)) { return E_INVALIDARG; } *ppPin = m_pPins[nPin]; return S_OK; } void BridgeSink::OnEOS(bool bConnected) { { CAutoLock lock(&m_csEOS); m_nEOS += 1; if (!IsAtEOS()) { LOG((TEXT("Sink 0x%x EOS discarded"), this)); return; } } if (bConnected) { BridgeController* pC = m_pPins[0]->GetStream()->GetController(); LOG((TEXT("Sink 0x%x EOS"), this)); pC->OnEndOfSegment(); } } STDMETHODIMP_(BOOL) BridgeSink::IsAtEOS() { CAutoLock lock(&m_csEOS); long nPins = 0; for (int n = 0; n < m_nPins; n++) { if (m_pPins[n]->IsConnected()) { nPins++; } } return (m_nEOS == nPins); } void BridgeSink::ResetEOSCount() { CAutoLock lock(&m_csEOS); m_nEOS = 0; m_tFirst = 0; m_bLastDiscarded = false; LOG((TEXT("Sink 0x%x ResetEOSCount"), this)); } STDMETHODIMP BridgeSink::Stop() { LOG((TEXT("Sink 0x%x Stop"), this)); HRESULT hr = CBaseFilter::Stop(); ResetEOSCount(); return hr; } void BridgeSink::Discard() { CAutoLock lock(&m_csEOS); m_bLastDiscarded = true; } void BridgeSink::AdjustTime(IMediaSample* pIn) { CAutoLock lock(&m_csEOS); REFERENCE_TIME tStart, tEnd; if (SUCCEEDED(pIn->GetTime(&tStart, &tEnd))) { if (m_bLastDiscarded) { LOG((TEXT("Sink 0x%x setting offset %d msecs"), this, long(tStart / 10000))); m_tFirst = tStart; m_bLastDiscarded = false; } if (m_tFirst != 0) { LOG((TEXT("Sink adjusting %d to %d msecs"), long(tStart/10000), long((tStart-m_tFirst)/10000))); } tStart -= m_tFirst; tEnd -= m_tFirst; pIn->SetTime(&tStart, &tEnd); } } // register in the running object table for graph debugging STDMETHODIMP BridgeSink::JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName) { HRESULT hr = CBaseFilter::JoinFilterGraph(pGraph, pName); // for debugging, we register in the ROT so that you can use // Graphedt's Connect command to view the graphs // disabled by default owing to refcount leak issue if (false) //SUCCEEDED(hr)) { if (pGraph == NULL) { if (m_dwROT) { IRunningObjectTablePtr pROT; if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) { pROT->Revoke(m_dwROT); } } } else { IMonikerPtr pMoniker; IRunningObjectTablePtr pROT; if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) { ostringstream strm; DWORD graphaddress = (DWORD)((DWORD_PTR)(IUnknown*)pGraph) & 0xFFFFFFFF; strm << "FilterGraph " << hex << graphaddress << " pid " << hex << GetCurrentProcessId(); _bstr_t strName = strm.str().c_str(); HRESULT hr = CreateItemMoniker(L"!", strName, &pMoniker); if (SUCCEEDED(hr)) { hr = pROT->Register(0, pGraph, pMoniker, &m_dwROT); } } } } return hr; } // BridgeSink seeking implementation // holds all the input pins that support seeking class SeekingCollection { public: typedef list<IMediaSeeking*>::iterator iterator; // if bSet, only accept settable pins SeekingCollection(CBaseFilter* pFilter) { for (int i = 0; i < pFilter->GetPinCount(); i++) { CBasePin* pPin = pFilter->GetPin(i); PIN_DIRECTION pindir; pPin->QueryDirection(&pindir); if (pindir == PINDIR_INPUT) { IMediaSeekingPtr pSeek = pPin->GetConnected(); if (pSeek != NULL) { m_Pins.push_back(pSeek.Detach()); } } } } ~SeekingCollection() { while (!m_Pins.empty()) { IMediaSeekingPtr pSeek(m_Pins.front(), 0); m_Pins.pop_front(); pSeek = NULL; } } iterator Begin() { return m_Pins.begin(); } iterator End() { return m_Pins.end(); } private: list<IMediaSeeking*> m_Pins; }; // --- not implemented ------------- STDMETHODIMP BridgeSink::GetCurrentPosition(LONGLONG *pCurrent) { UNREFERENCED_PARAMETER(pCurrent); // implemented in graph manager using stream time return E_NOTIMPL; } // ---- by aggregation of input pin responses -------------- STDMETHODIMP BridgeSink::GetCapabilities(DWORD * pCapabilities) { SeekingCollection pins(this); DWORD caps = 0; for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; DWORD capsThis; HRESULT hr = pSeek->GetCapabilities(&capsThis); if (SUCCEEDED(hr)) { caps |= capsThis; } } *pCapabilities = caps; return S_OK; } STDMETHODIMP BridgeSink::SetPositions(LONGLONG * pCurrent, DWORD dwCurrentFlags , LONGLONG * pStop, DWORD dwStopFlags) { // pass call to all pins. Fails if any fail. SeekingCollection pins(this); HRESULT hr = S_OK; for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; if (pSeek->IsUsingTimeFormat(&TIME_FORMAT_MEDIA_TIME) == S_OK) { HRESULT hrThis = pSeek->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags); if (FAILED(hrThis) && (hrThis != E_NOTIMPL) && SUCCEEDED(hr)) { hr = hrThis; } } } return hr; } STDMETHODIMP BridgeSink::GetPositions(LONGLONG * pCurrent, LONGLONG * pStop) { // cannot really aggregate this -- just return the // first one and assume they are all the same (they will // be if we set the params) SeekingCollection pins(this); HRESULT hr; if (pins.Begin() == pins.End()) { hr = E_NOINTERFACE; } else { IMediaSeekingPtr pSeek = *pins.Begin(); hr = pSeek->GetPositions(pCurrent, pStop); } return hr; } STDMETHODIMP BridgeSink::GetAvailable(LONGLONG * pEarliest, LONGLONG * pLatest) { // the available section reported is what is common to all inputs LONGLONG tEarly = 0; LONGLONG tLate = 0x7fffffffffffffff; SeekingCollection pins(this); for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; LONGLONG tThisEarly, tThisLate; HRESULT hr = pSeek->GetAvailable(&tThisEarly, &tThisLate); if (SUCCEEDED(hr)) { if (tThisEarly > tEarly) { tEarly = tThisEarly; } if (tThisLate < tLate) { tLate = tThisLate; } } } *pEarliest = tEarly; *pLatest = tLate; return S_OK; } STDMETHODIMP BridgeSink::SetRate(double dRate) { // pass call to all pins. Fails if any fail. SeekingCollection pins(this); HRESULT hr = S_OK; for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; HRESULT hrThis = pSeek->SetRate(dRate); if (FAILED(hrThis) && SUCCEEDED(hr)) { hr = hrThis; } } return hr; } STDMETHODIMP BridgeSink::GetRate(double * pdRate) { // cannot really aggregate this -- just return the // first one and assume they are all the same (they will // be if we set the params) SeekingCollection pins(this); HRESULT hr; if (pins.Begin() == pins.End()) { hr = E_NOINTERFACE; } else { IMediaSeekingPtr pSeek = *pins.Begin(); hr = pSeek->GetRate(pdRate); } return hr; } STDMETHODIMP BridgeSink::GetPreroll(LONGLONG * pllPreroll) { // the preroll requirement is the longest of any input SeekingCollection pins(this); LONGLONG tPreroll = 0; for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; LONGLONG tThis; HRESULT hr = pSeek->GetPreroll(&tThis); if (SUCCEEDED(hr)) { if (tThis > tPreroll) { tPreroll = tThis; } } } *pllPreroll = tPreroll; return S_OK; } STDMETHODIMP BridgeSink::GetDuration(LONGLONG *pDuration) { // the duration we report is the longest of any input duration SeekingCollection pins(this); LONGLONG tDur = 0; for (SeekingCollection::iterator it = pins.Begin(); it != pins.End(); it++) { IMediaSeekingPtr pSeek = *it; LONGLONG tThis; HRESULT hr = pSeek->GetDuration(&tThis); if (SUCCEEDED(hr)) { if (tThis > tDur) { tDur = tThis; } } } *pDuration = tDur; return S_OK; } STDMETHODIMP BridgeSink::GetStopPosition(LONGLONG *pStop) { // cannot really aggregate this -- just return the // first one and assume they are all the same (they will // be if we set the params) SeekingCollection pins(this); HRESULT hr; if (pins.Begin() == pins.End()) { hr = E_NOINTERFACE; } else { IMediaSeekingPtr pSeek = *pins.Begin(); hr = pSeek->GetStopPosition(pStop); } return hr; } // -- implemented directly here -------------- STDMETHODIMP BridgeSink::CheckCapabilities(DWORD * pCapabilities ) { DWORD dwActual; GetCapabilities(&dwActual); if (*pCapabilities & (~dwActual)) { return S_FALSE; } return S_OK; } STDMETHODIMP BridgeSink::IsFormatSupported(const GUID * pFormat) { if (*pFormat == TIME_FORMAT_MEDIA_TIME) { return S_OK; } return S_FALSE; } STDMETHODIMP BridgeSink::QueryPreferredFormat(GUID * pFormat) { *pFormat = TIME_FORMAT_MEDIA_TIME; return S_OK; } STDMETHODIMP BridgeSink::GetTimeFormat(GUID *pFormat) { return QueryPreferredFormat(pFormat); } STDMETHODIMP BridgeSink::IsUsingTimeFormat(const GUID * pFormat) { GUID guidActual; HRESULT hr = GetTimeFormat(&guidActual); if (SUCCEEDED(hr) && (guidActual == *pFormat)) { return S_OK; } else { return S_FALSE; } } STDMETHODIMP BridgeSink::SetTimeFormat(const GUID * pFormat) { if ((*pFormat == TIME_FORMAT_MEDIA_TIME) || (*pFormat == TIME_FORMAT_NONE)) { return S_OK; } else { return E_NOTIMPL; } } STDMETHODIMP BridgeSink::ConvertTimeFormat(LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat) { // since we only support TIME_FORMAT_MEDIA_TIME, we don't really // offer any conversions. if(pTargetFormat == 0 || *pTargetFormat == TIME_FORMAT_MEDIA_TIME) { if(pSourceFormat == 0 || *pSourceFormat == TIME_FORMAT_MEDIA_TIME) { *pTarget = Source; return S_OK; } } return E_INVALIDARG; } // --- input pin implementation -------------------------------- BridgeSinkInput::BridgeSinkInput( BridgeSink* pFilter, BridgeStream* pStream, CCritSec* pLock, HRESULT* phr, LPCWSTR pName) : CBaseInputPin(NAME("BridgeSinkInput"), pFilter, pLock, phr, pName), m_pStream(pStream), m_pRedirectedAlloc(NULL), m_bConnected(false), m_nDeliveryLocks(0), m_bSendDTC(false), m_bStoppedWhileConnected(false) { m_bAudio = !m_pStream->IsVideo(); m_hsemDelivery = CreateSemaphore(NULL, 1, 1, NULL); if (!m_pStream->DiscardMode()) { m_pRedirectedAlloc = new BridgeAllocator(this); m_pRedirectedAlloc->AddRef(); } } BridgeSinkInput::~BridgeSinkInput() { if (m_pRedirectedAlloc) { m_pRedirectedAlloc->Release(); } CloseHandle(m_hsemDelivery); } void BridgeSinkInput::LockIncremental() { // if there are multiple calls to this on separate // threads, there's a chance that the second one // will be left blocked on the semaphore when he should be seeing the // incremental indicator. To avoid this, timeout the semaphore and loop for (;;) { { CAutoLock lock(&m_csDelivery); if (m_nDeliveryLocks > 0) { // lock is incremental -- can add to it m_nDeliveryLocks++; return; } } // acquire exclusive lock DWORD dw = WaitForSingleObject(DeliveryLock(), 100); if (dw == WAIT_OBJECT_0) { break; } } // now mark it as incremental CAutoLock lock(&m_csDelivery); m_nDeliveryLocks++; } // if incremental, decrease count and release semaphore if 0. // if exclusive, release semaphore (count is 0) void BridgeSinkInput::Unlock() { CAutoLock lock(&m_csDelivery); if (m_nDeliveryLocks > 0) { // incremental lock m_nDeliveryLocks--; if (m_nDeliveryLocks > 0) { // not idle yet return; } } ReleaseSemaphore(m_hsemDelivery, 1, NULL); } // CBaseInputPin overrides STDMETHODIMP BridgeSinkInput::Receive(IMediaSample *pSampleIn) { LOG((TEXT("Pin 0x%x receive 0x%x"), this, pSampleIn)); // check state HRESULT hr = CBaseInputPin::Receive(pSampleIn); if (hr == S_OK) { // if not connected, do nothing. // For the "discard on not connected" option, this // is the correct behaviour. For the suspend on not connected option, // we should not get here since GetBuffer will suspend. { // restrict critsec -- don't hold over blocking call CAutoLock lock(&m_csConnect); if (!m_bConnected) { LOG((TEXT("Sink pin 0x%x disconnected: discarding 0x%x"), this, pSampleIn)); // remember that the segment is broken Filter()->Discard(); // just ignore this sample return S_OK; } } // we must hold a lock during receive. If upstream is using the proxy alloc, // then the lock is held by the proxy sample. If not, we should get a proxy sample // just for the duration of Receive so it will hold the lock IProxySamplePtr pProxy = pSampleIn; IMediaSamplePtr pInner; if (pProxy != NULL) { // already has proxy and lock -- extract inner pProxy->GetInner(&pInner); } else { // make new proxy to hold lock hr = S_OK; pProxy = new ProxySample(this, &hr); // we already have the inner pInner = pSampleIn; } LOG((TEXT("Pin 0x%x outer 0x%x, inner 0x%x"), this, pSampleIn, pInner)); // if we stopped while connected, our times will be reset to 0 // so we must notify the source if (m_bStoppedWhileConnected) { GetStream()->ResetOnStop(); m_bStoppedWhileConnected = false; } // before changing it, we must make a copy IMediaSamplePtr pLocal = pInner; hr = S_OK; if (GetStream()->GetController()->LiveTiming()) { // map to absolute clock time here // (and back in source graph) // depends on using a common clock. REFERENCE_TIME tStart, tStop; if (pLocal->GetTime(&tStart, &tStop) == S_OK) { REFERENCE_TIME tSTO = Filter()->STO(); tStart += tSTO; tStop += tSTO; pLocal->SetTime(&tStart, &tStop); pLocal->SetMediaTime(NULL, NULL); } } else { // if we are starting delivery after being disconnected, // the timestamps should begin at 0 // -- handled in filter to ensure common adjustment for all streams Filter()->AdjustTime(pLocal); } // check for media type change AM_MEDIA_TYPE* pmt; CMediaType mtFromUpstream; bool bTypeChange = false; if (pLocal->GetMediaType(&pmt) == S_OK) { CMediaType mt(*pmt); DeleteMediaType(pmt); // is this a new type? CMediaType mtDownstream; GetStream()->GetSelectedType(&mtDownstream); if (mt != mtDownstream) { // must be upstream-originated GetStream()->SetSelectedType(&mt); mtFromUpstream = mt; bTypeChange = true; } } else if (pProxy->GetType(&mtFromUpstream) == S_OK) { LOG((TEXT("Using DTC from proxy"))); // type change was attached to sample in GetBuffer // but then erased in upstream filter //re-attach to inner sample pLocal->SetMediaType(&mtFromUpstream); CMediaType mtDownstream; GetStream()->GetSelectedType(&mtDownstream); if (mtFromUpstream != mtDownstream) { // must be upstream-originated GetStream()->SetSelectedType(&mtFromUpstream); bTypeChange = true; } } else if (m_bSendDTC) { // the type of the input needs to be passed downstream. LOG((TEXT("Type change sample lost -- setting on next sample"))); m_bSendDTC = false; mtFromUpstream = m_mt; bTypeChange = true; pLocal->SetMediaType(&m_mt); } // if we are in "discard" mode, we are not using the // same allocator, so we must copy here if (m_bUsingProxyAllocator) { hr = GetStream()->Deliver(pLocal); } else { // need to copy. For audio this might mean a repeated copy int cIn = pLocal->GetActualDataLength(); int cOffset = 0; while (cOffset < cIn) { IMediaSamplePtr pOut; if (m_pCopyAllocator == NULL) { return VFW_E_NO_ALLOCATOR; } hr = m_pCopyAllocator->GetBuffer(&pOut, NULL, NULL, 0); if (SUCCEEDED(hr)) { hr = CopySample(pLocal, pOut, cOffset, cIn - cOffset); cOffset += pOut->GetActualDataLength(); } if (SUCCEEDED(hr)) { if (bTypeChange) { pOut->SetMediaType(&mtFromUpstream); bTypeChange = false; } hr = GetStream()->Deliver(pOut == NULL? pLocal : pOut); } if (FAILED(hr)) { return hr; } } } } return hr; } // copy a portion of the input buffer to the output. Copy times and flags on first portion // only. HRESULT BridgeSinkInput::CopySample(IMediaSample* pIn, IMediaSample* pOut, int cOffset, int cLength) { BYTE* pDest; pOut->GetPointer(&pDest); BYTE* pSrc; pIn->GetPointer(&pSrc); pSrc += cOffset; long cOut = pOut->GetSize(); long cIn = pIn->GetActualDataLength(); cLength = min(cLength, cOut); // ensure we copy whole samples if audio if ((*m_mt.Type() == MEDIATYPE_Audio) && (*m_mt.FormatType() == FORMAT_WaveFormatEx)) { WAVEFORMATEX* pwfx = (WAVEFORMATEX*)m_mt.Format(); cLength -= cLength % pwfx->nBlockAlign; } if ((cOffset + cLength) > cIn) { return VFW_E_BUFFER_OVERFLOW; } CopyMemory(pDest, pSrc, cLength); pOut->SetActualDataLength(cLength); // properties are set on first buffer only if (cOffset == 0) { REFERENCE_TIME tStart, tEnd; if (SUCCEEDED(pIn->GetTime(&tStart, &tEnd))) { pOut->SetTime(&tStart, &tEnd); } if (SUCCEEDED(pIn->GetMediaTime(&tStart, &tEnd))) { pOut->SetMediaTime(&tStart, &tEnd); } if (pIn->IsSyncPoint() == S_OK) { pOut->SetSyncPoint(true); } if (pIn->IsDiscontinuity() == S_OK) { pOut->SetDiscontinuity(true); } if (pIn->IsPreroll() == S_OK) { pOut->SetPreroll(true); } } return S_OK; } STDMETHODIMP BridgeSinkInput::EndOfStream(void) { HRESULT hr = Filter()->NotifyEvent(EC_COMPLETE, S_OK, NULL); Filter()->OnEOS(m_bConnected); return CBaseInputPin::EndOfStream(); } HRESULT BridgeSinkInput::CheckMediaType(const CMediaType* pmt) { // do we insist on the decoder being in the upstream segment? if (GetStream()->AllowedTypes() == eUncompressed) { if (!IsUncompressed(pmt)) { return VFW_E_TYPE_NOT_ACCEPTED; } } else if (GetStream()->AllowedTypes() == eMuxInputs) { if (!IsAllowedMuxInput(pmt)) { return VFW_E_TYPE_NOT_ACCEPTED; } } // check with bridge stream -- type is fixed once output // stage has been built return GetStream()->CanReceiveType(pmt); } HRESULT BridgeSinkInput::GetMediaType(int iPosition, CMediaType* pmt) { UNREFERENCED_PARAMETER(iPosition); UNREFERENCED_PARAMETER(pmt); return VFW_S_NO_MORE_ITEMS; } HRESULT BridgeSinkInput::SetMediaType(const CMediaType* pmt) { HRESULT hr = CBaseInputPin::SetMediaType(pmt); if (SUCCEEDED(hr)) { CAutoLock lock(&m_csConnect); if (m_bConnected) { GetStream()->SetSelectedType(pmt); } } return hr; } bool BridgeSinkInput::IsUncompressed(const CMediaType* pmt) { if (m_bAudio) { if (*pmt->Type() != MEDIATYPE_Audio) { return false; } if (*pmt->FormatType() != FORMAT_WaveFormatEx) { return false; } WAVEFORMATEX* pwfx = (WAVEFORMATEX*)pmt->Format(); if (pwfx->wFormatTag != WAVE_FORMAT_PCM) { return false; } return true; } else { if (*pmt->Type() != MEDIATYPE_Video) { return false; } if ( (*pmt->Subtype() == MEDIASUBTYPE_ARGB32)|| (*pmt->Subtype() == MEDIASUBTYPE_RGB32) || (*pmt->Subtype() == MEDIASUBTYPE_RGB24) || (*pmt->Subtype() == MEDIASUBTYPE_YUY2) || (*pmt->Subtype() == MEDIASUBTYPE_UYVY) || (*pmt->Subtype() == MEDIASUBTYPE_Y41P) || (*pmt->Subtype() == MEDIASUBTYPE_RGB555) || (*pmt->Subtype() == MEDIASUBTYPE_RGB565) || (*pmt->Subtype() == MEDIASUBTYPE_RGB8) ) { return true; } } return false; } bool BridgeSinkInput::IsAllowedMuxInput(const CMediaType* pmt) { // the AVI Mux only accepts certain formats -- we // must check for them at the sink. if (*pmt->Type() == MEDIATYPE_Video) { //must be either VideoInfo or DvInfo if (*pmt->FormatType() == FORMAT_VideoInfo) { // for VideoInfo, must have no target rect and no negative height VIDEOINFOHEADER* pvi = (VIDEOINFOHEADER*)pmt->Format(); if ((pvi->bmiHeader.biHeight < 0) || (pvi->rcTarget.left != 0) || ((pvi->rcTarget.right != 0) && (pvi->rcTarget.right != pvi->bmiHeader.biWidth))) { return false; } } else if (*pmt->FormatType() != FORMAT_DvInfo) { return false; } } else if (*pmt->Type() == MEDIATYPE_Audio) { // audio must be WaveFormatEx with a valid nBlockAlign if (*pmt->FormatType() != FORMAT_WaveFormatEx) { return false; } WAVEFORMATEX* pwfx = (WAVEFORMATEX*)pmt->Format(); if (pwfx->nBlockAlign == 0) { return false; } } else { return false; } return true; } STDMETHODIMP BridgeSinkInput::GetAllocator(IMemAllocator **ppAllocator) { /// if not connected, should we discard? HRESULT hr; if (GetStream()->DiscardMode()) { // yes -- so we must use a standard allocator // (which will still work when not connected hr = CBaseInputPin::GetAllocator(ppAllocator); } else { // prefer our allocator since this handles dynamic type changes // as well as preventing copies hr = m_pRedirectedAlloc->QueryInterface(IID_IMemAllocator, (void**)ppAllocator); } return hr; } STDMETHODIMP BridgeSinkInput::NotifyAllocator(IMemAllocator * pAllocator, BOOL bReadOnly) { if (!GetStream()->DiscardMode()) { // insist on our allocator IUnknownPtr pOurs = m_pRedirectedAlloc; IUnknownPtr pNotified = pAllocator; if (pOurs == pNotified) { m_bUsingProxyAllocator = true; } else { m_bUsingProxyAllocator = false; // for video, we must use the proxy alloc or we can't handle // type switching. // for audio, we could allow this, but we would need to add // code in Receive, since currently we rely on the allocator blocking // until connected -- with a foreign allocator, we would need to block in receive instead. // This would be a benefit in some DV cases where the audio buffer size is an issue and // hard to renegotiate between clips. // error code is not quite ideal, but at least points at the offending object return VFW_E_NO_ALLOCATOR; } } else { m_bUsingProxyAllocator = false; } return CBaseInputPin::NotifyAllocator(pAllocator, bReadOnly); } STDMETHODIMP BridgeSinkInput::BeginFlush() { LOG((TEXT("Pin 0x%x BeginFlush"), this)); HRESULT hr = CBaseInputPin::BeginFlush(); // allocator must fail without blocking while flushing - this is // the same as decommit state if (m_pRedirectedAlloc && m_bUsingProxyAllocator) { m_pRedirectedAlloc->Decommit(); } // pass on to the downstream graph if connected CAutoLock lock(&m_csConnect); if (m_bConnected) { hr = GetStream()->BeginFlush(); } return hr; } STDMETHODIMP BridgeSinkInput::EndFlush() { LOG((TEXT("Pin 0x%x EndFlush"), this)); HRESULT hr = CBaseInputPin::EndFlush(); // reset end-of-stream if delivered Filter()->ResetEOSCount(); // undo the Decommit done during BeginFlush if (m_pRedirectedAlloc && m_bUsingProxyAllocator) { m_pRedirectedAlloc->Commit(); } // pass on to the downstream graph if connected CAutoLock lock(&m_csConnect); if (m_bConnected) { hr = GetStream()->EndFlush(); } return hr; } // we are now the selected source for the downstream // graph. HRESULT BridgeSinkInput::MakeBridge(IMemAllocator* pAlloc) { LOG((TEXT("Pin 0x%x Bridge to alloc 0x%x"), this, pAlloc)); CAutoLock lock(&m_csConnect); m_bStoppedWhileConnected = false; m_bConnected = true; HRESULT hr = S_OK; if (m_bUsingProxyAllocator) { // the previous source graph or the renderer may have // made a type change -- ensure this is on the first sample // -- so we set it before enabling the GetBuffer CMediaType mt; GetStream()->GetSelectedType(&mt); // is it compatible? if (mt != m_mt) { // dynamic changes sent upstream with GetBuffer only work reliably with video if (*m_mt.Type() == MEDIATYPE_Video) { hr = CanDeliverType(&mt); if (hr == S_OK) { // sadly, many codecs do not check the size // they are offered, and will claim to output anything hr = BridgeStream::CheckMismatchedVideo(&mt, &m_mt); } } else { hr = E_FAIL; } if (hr == S_OK) { // switch our source to this type by attaching at // next GetBuffer LOG((TEXT("Switching source to stream type"))); m_pRedirectedAlloc->ForceDTC(&mt); } else if ((*m_mt.Type() == MEDIATYPE_Video)) { // don't switch back to the previously connected type, or the VR might // see an extended stride as part of the video. Instead, enumerate // the preferred formats from the source and try those. However, stick to // the same subtype. hr = VFW_E_TYPE_NOT_ACCEPTED; IEnumMediaTypesPtr pEnum; GetConnected()->EnumMediaTypes(&pEnum); AM_MEDIA_TYPE* pmt; while(pEnum->Next(1, &pmt, NULL) == S_OK) { CMediaType mtEnum(*pmt); DeleteMediaType(pmt); if ((CanDeliverType(&mtEnum) == S_OK) && (*mtEnum.Subtype() == *m_mt.Subtype()) && GetStream()->CanSwitchTo(&mtEnum)) { LOG((TEXT("ReceiveConnect to enumerated source type"))); m_pRedirectedAlloc->SwitchFormatTo(&mtEnum); hr = S_OK; break; } } if (hr != S_OK) { LOG((TEXT("No suitable video type - failing bridge"))); return hr; } } else { // attempt a dynamic switch downstream to the format // that our source is using LOG((TEXT("Switching downstream to source type"))); m_pRedirectedAlloc->ForceDTC(&m_mt); // the type change is attached to a buffer from our GetBuffer, // and we need to pass it downstream, even if that sample is discarded // or the mt is cleared. So we set a flag here indicating that // we need to set the type onto the next incoming sample. m_bSendDTC = true; } } // redirect allocator hr = m_pRedirectedAlloc->SetDownstreamAlloc(pAlloc); } else { m_pCopyAllocator = pAlloc; } return hr; } // we are now disconnected from downstream HRESULT BridgeSinkInput::DisconnectBridge() { LOG((TEXT("Pin 0x%x disconnect"), this)); if (m_pRedirectedAlloc && m_bUsingProxyAllocator) { m_pRedirectedAlloc->SetDownstreamAlloc(NULL); } CAutoLock lock(&m_csConnect); // if we are in mid-flush, remember that the endflush will // not be passed on if (m_bFlushing && m_bConnected) { LOG((TEXT("Pin 0x%x disconnect when mid-flush"), this)); GetStream()->EndFlush(); } m_bConnected = false; m_bStoppedWhileConnected = false; return S_OK; } HRESULT BridgeSinkInput::GetBufferProps(long* pcBuffers, long* pcBytes) { // return whatever we have agreed, whether the bridge allocator or not HRESULT hr = VFW_E_NO_ALLOCATOR; if (m_pAllocator) { ALLOCATOR_PROPERTIES prop; hr = m_pAllocator->GetProperties(&prop); *pcBuffers = prop.cBuffers; *pcBytes = prop.cbBuffer; } return hr; } HRESULT BridgeSinkInput::CanDeliverType(const CMediaType* pmt) { // do we insist on the decoder being in the upstream segment? if (GetStream()->AllowedTypes() == eUncompressed) { if (!IsUncompressed(pmt)) { return VFW_E_TYPE_NOT_ACCEPTED; } } else if (GetStream()->AllowedTypes() == eMuxInputs) { if (!IsAllowedMuxInput(pmt)) { return VFW_E_TYPE_NOT_ACCEPTED; } } if (!IsConnected()) { return VFW_E_NOT_CONNECTED; } // query accept on upstream output pin return GetConnected()->QueryAccept(pmt); } HRESULT BridgeSinkInput::EnumOutputType(int iPosition, CMediaType* pmt) { // enumerate output types on upstream pin if (!IsConnected()) { return VFW_E_NOT_CONNECTED; } IEnumMediaTypesPtr pEnum; HRESULT hr = GetConnected()->EnumMediaTypes(&pEnum); if (SUCCEEDED(hr)) { pEnum->Skip(iPosition); AM_MEDIA_TYPE* amt; hr = pEnum->Next(1, &amt, NULL); if (hr == S_OK) { *pmt = *amt; DeleteMediaType(amt); } } return hr; } HRESULT BridgeSinkInput::Inactive() { if (Filter()->IsActive() && m_bConnected) { m_bStoppedWhileConnected = true; } return __super::Inactive(); } // --------- Redirecting allocator implementation -------------------------- BridgeAllocator::BridgeAllocator(BridgeSinkInput* pPin) : CUnknown(NAME("BridgeAllocator"), NULL), m_pPin(pPin), m_bForceDTC(false), m_bSwitchConnection(false), m_bCommitted(false), m_evNonBlocking(true) // manual reset { ZeroMemory(&m_props, sizeof(m_props)); // while not committed, we just reject calls, not block // (blocking is only when we are active, but not connected to // the downstream graph) m_evNonBlocking.Set(); } STDMETHODIMP BridgeAllocator::NonDelegatingQueryInterface(REFIID iid, void** ppv) { if (iid == IID_IMemAllocator) { return GetInterface((IMemAllocator*)this, ppv); } else { return CUnknown::NonDelegatingQueryInterface(iid, ppv); } } STDMETHODIMP BridgeAllocator::SetProperties( ALLOCATOR_PROPERTIES* pRequest, ALLOCATOR_PROPERTIES* pActual) { // requests are passed to the downstream allocator by // the BridgeSourceOutput pin when the downstream graph // is being built. CAutoLock lock(&m_csAlloc); m_props = *pRequest; // for uncompressed video, the buffer size will change as the output type changes // so we accept any properties HRESULT hr = S_OK; if (!m_pPin->GetStream()->IsVideo()) { // for audio, we should tell the caller what buffers are actually in use and // allow them to reject it. long cBuffers, cBytes; if (m_pPin->GetStream()->GetDownstreamBufferProps(&cBuffers, &cBytes)) { m_props.cbBuffer = cBytes; m_props.cBuffers = cBuffers; if (cBytes < pRequest->cbBuffer) { hr = VFW_E_BUFFER_UNDERFLOW; } } } *pActual = m_props; return hr; } STDMETHODIMP BridgeAllocator::GetProperties(ALLOCATOR_PROPERTIES *pProps) { // it's probably best to pass on the actual props if possible CAutoLock lock(&m_csAlloc); HRESULT hr = S_OK; if (m_pTarget == NULL) { *pProps = m_props; } else { hr = m_pTarget->GetProperties(pProps); } return hr; } STDMETHODIMP BridgeAllocator::ReleaseBuffer(IMediaSample *pSample) { UNREFERENCED_PARAMETER(pSample); // called via sample's pointer to originating allocator -- so // our implementation will never be called. return S_OK; } STDMETHODIMP BridgeAllocator::GetBuffer( IMediaSample **ppBuffer, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd, DWORD dwFlags) { LOG((TEXT("GetBuffer on sink pin 0x%x"), m_pPin)); IProxySamplePtr pProxy; // block until connected and committed for(;;) { // wait on the event, then grab the locks in // the right order. Then check that we are // connected/committed, and if not, release the locks and try again m_evNonBlocking.Wait(); // create a proxy -- locks the pin HRESULT hr = S_OK; pProxy = new ProxySample(m_pPin, &hr); // target-alloc critsec CAutoLock lock(&m_csAlloc); // committed? if (!m_bCommitted) { return VFW_E_NOT_COMMITTED; } // connected? if (m_pTarget != NULL) { break; } pProxy = NULL; } HRESULT hr = S_OK; if (m_bSwitchConnection) { hr = m_pPin->GetStream()->SwitchTo(&m_mtDTC); if (SUCCEEDED(hr)) { m_bForceDTC = true; m_bSwitchConnection = false; } } // call target allocator // target cannot change while we hold the semaphore IMediaSamplePtr pSample; if (SUCCEEDED(hr)) { hr = m_pTarget->GetBuffer(&pSample, pStart, pEnd, dwFlags); } // dynamic type changes? if (SUCCEEDED(hr)) { CAutoLock lock(&m_csAlloc); // check for dynamic type change from downstream AM_MEDIA_TYPE* pmt; if (pSample->GetMediaType(&pmt) == S_OK) { CMediaType mt(*pmt); DeleteMediaType(pmt); // notify controller that this sample has a type change // (the source will normally clear it before calling our Receive method). // If we were actually processing the data within the sink, we would // need to switch type when this exact sample reappears at the input // (although by then the media type will have been removed from the sample). // However, for our purposes, we can switch now. m_pPin->SetMediaType(&mt); } else if (m_bForceDTC) { // initiate a dynamic type change ourselves pSample->SetMediaType(&m_mtDTC); // attach to our proxy so that we can detect this type change // on the way downstream even if the upstream filter erases it pProxy->SetType(&m_mtDTC); // if this is a switch to a new format, tell the pin & stream m_pPin->SetMediaType(&m_mtDTC); } m_bForceDTC = false; } if (SUCCEEDED(hr)) { pProxy->SetInner(pSample); IMediaSamplePtr pOuter = pProxy; *ppBuffer = pOuter.Detach(); } if (hr != S_OK) { LOG((TEXT("GetBuffer on pin 0x%x returns 0x%x"), m_pPin, hr)); } return hr; } STDMETHODIMP BridgeAllocator::Commit() { // ensure that we block when active but disconnected CAutoLock lock(&m_csAlloc); m_bCommitted = true; if (m_pTarget == NULL) { m_evNonBlocking.Reset(); } LOG((TEXT("BridgeAlloc 0x%x commit, %s"), this, m_pTarget==NULL?TEXT("Disconnected"):TEXT("Connected"))); return S_OK; } STDMETHODIMP BridgeAllocator::Decommit() { // ensure that we block when active but disconnected // -- we are now inactive CAutoLock lock(&m_csAlloc); m_bCommitted = false; m_evNonBlocking.Set(); LOG((TEXT("BridgeAlloc 0x%x decommit, %s"), this, m_pTarget==NULL?TEXT("Disconnected"):TEXT("Connected"))); return S_OK; } HRESULT BridgeAllocator::SetDownstreamAlloc(IMemAllocator* pAlloc) { // lock cs *after* semaphore CAutoLock lock(&m_csAlloc); // target allocator -- could be null if disconnecting m_pTarget = pAlloc; // ensure non-blocking when connected or not active if ((m_pTarget != NULL) || !m_bCommitted) { m_evNonBlocking.Set(); } else { m_evNonBlocking.Reset(); } return S_OK; } // -- sample proxy implementation ------------------ ProxySample::ProxySample(BridgeSinkInput* pPin, HRESULT* phr) : CUnknown(NAME("ProxySample"), NULL, phr), m_pPin(pPin), m_bDTC(false) { // increment lock for each outstanding buffer m_pPin->LockIncremental(); } ProxySample::~ProxySample() { // release lock on deletion m_pPin->Unlock(); } STDMETHODIMP ProxySample::NonDelegatingQueryInterface(REFIID iid, void** ppv) { if ((iid == IID_IMediaSample) || (iid == IID_IMediaSample2)) { return GetInterface((IMediaSample2*)this, ppv); } else if (iid == __uuidof(IProxySample)) { return GetInterface((IProxySample*)this, ppv); } else { return CUnknown::NonDelegatingQueryInterface(iid, ppv); } } STDMETHODIMP ProxySample::SetInner(IMediaSample* pSample) { m_pInner = pSample; return S_OK; } STDMETHODIMP ProxySample::GetInner(IMediaSample** ppSample) { *ppSample = m_pInner; if (m_pInner != NULL) { m_pInner->AddRef(); return S_OK; } return S_FALSE; } STDMETHODIMP ProxySample::ReleaseInner() { m_pInner = NULL; return S_OK; } STDMETHODIMP ProxySample::SetType(const CMediaType* pType) { m_mtDTC = *pType; m_bDTC = true; return S_OK; } STDMETHODIMP ProxySample::GetType(CMediaType* pType) { if (m_bDTC) { *pType = m_mtDTC; return S_OK; } return S_FALSE; } STDMETHODIMP ProxySample::GetPointer(BYTE ** ppBuffer) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->GetPointer(ppBuffer); } STDMETHODIMP_(LONG) ProxySample::GetSize(void) { if (m_pInner == NULL) { return 0; } return m_pInner->GetSize(); } STDMETHODIMP ProxySample::GetTime( REFERENCE_TIME * pTimeStart, // put time here REFERENCE_TIME * pTimeEnd ) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->GetTime(pTimeStart, pTimeEnd); } STDMETHODIMP ProxySample::SetTime( REFERENCE_TIME * pTimeStart, // put time here REFERENCE_TIME * pTimeEnd ) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetTime(pTimeStart, pTimeEnd); } STDMETHODIMP ProxySample::IsSyncPoint(void) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->IsSyncPoint(); } STDMETHODIMP ProxySample::SetSyncPoint(BOOL bIsSyncPoint) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetSyncPoint(bIsSyncPoint); } STDMETHODIMP ProxySample::IsPreroll(void) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->IsPreroll(); } STDMETHODIMP ProxySample::SetPreroll(BOOL bIsPreroll) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetPreroll(bIsPreroll); } STDMETHODIMP_(LONG) ProxySample::GetActualDataLength(void) { if (m_pInner == NULL) { return 0; } return m_pInner->GetActualDataLength(); } STDMETHODIMP ProxySample::SetActualDataLength(LONG lActual) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetActualDataLength(lActual); } STDMETHODIMP ProxySample::GetMediaType(AM_MEDIA_TYPE **ppMediaType) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->GetMediaType(ppMediaType); } STDMETHODIMP ProxySample::SetMediaType(AM_MEDIA_TYPE *pMediaType) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetMediaType(pMediaType); } STDMETHODIMP ProxySample::IsDiscontinuity(void) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->IsDiscontinuity(); } STDMETHODIMP ProxySample::SetDiscontinuity(BOOL bDiscontinuity) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetDiscontinuity(bDiscontinuity); } STDMETHODIMP ProxySample::GetMediaTime( LONGLONG * pTimeStart, LONGLONG * pTimeEnd ) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->GetMediaTime(pTimeStart, pTimeEnd); } STDMETHODIMP ProxySample::SetMediaTime( LONGLONG * pTimeStart, LONGLONG * pTimeEnd ) { if (m_pInner == NULL) { return E_NOINTERFACE; } return m_pInner->SetMediaTime(pTimeStart, pTimeEnd); } STDMETHODIMP ProxySample::GetProperties( DWORD cbProperties, BYTE * pbProperties ) { IMediaSample2Ptr p2 = m_pInner; if (p2 == NULL) { return E_NOINTERFACE; } return p2->GetProperties(cbProperties, pbProperties); } STDMETHODIMP ProxySample::SetProperties( DWORD cbProperties, const BYTE * pbProperties ) { IMediaSample2Ptr p2 = m_pInner; if (p2 == NULL) { return E_NOINTERFACE; } return p2->SetProperties(cbProperties, pbProperties); }
24.535059
108
0.615767
jpjodoin
d12692abfd69ac17723509f519c82bd2493f4c8a
2,387
cpp
C++
src/backend/runtime/loader/ShaderUtils.cpp
HenryJanson707/Ignis
f8a3769ecd0fe371993ff2c78e41bb0030d5caa8
[ "MIT" ]
6
2021-08-19T08:38:37.000Z
2022-01-26T20:29:24.000Z
src/backend/runtime/loader/ShaderUtils.cpp
HenryJanson707/Ignis
f8a3769ecd0fe371993ff2c78e41bb0030d5caa8
[ "MIT" ]
17
2021-09-30T19:41:47.000Z
2022-02-27T11:10:49.000Z
src/backend/runtime/loader/ShaderUtils.cpp
HenryJanson707/Ignis
f8a3769ecd0fe371993ff2c78e41bb0030d5caa8
[ "MIT" ]
2
2022-01-11T14:45:26.000Z
2022-01-24T15:38:39.000Z
#include "ShaderUtils.h" #include <cctype> #include <sstream> namespace IG { std::string ShaderUtils::constructDevice(Target target) { std::stringstream stream; switch (target) { case Target::AVX: stream << "let device = make_avx_device();"; break; case Target::AVX2: stream << "let device = make_avx2_device();"; break; case Target::AVX512: stream << "let device = make_avx512_device();"; break; case Target::SSE42: stream << "let device = make_sse42_device();"; break; case Target::ASIMD: stream << "let device = make_asimd_device();"; break; case Target::NVVM: stream << "let device = make_nvvm_device(settings.device);"; break; case Target::AMDGPU: stream << "let device = make_amdgpu_device(settings.device);"; break; default: stream << "let device = make_cpu_default_device();"; break; } return stream.str(); } std::string ShaderUtils::generateDatabase() { std::stringstream stream; stream << " let dtb = device.load_scene_database();" << std::endl << " let shapes = device.load_shape_table(dtb.shapes);" << std::endl << " let entities = device.load_entity_table(dtb.entities);" << std::endl; return stream.str(); } std::string ShaderUtils::generateSceneInfoInline(const LoaderContext& ctx) { std::stringstream stream; stream << "SceneInfo { num_entities = " << ctx.Environment.EntityIDs.size() << " }"; return stream.str(); } std::string ShaderUtils::escapeIdentifier(const std::string& name) { IG_ASSERT(!name.empty(), "Given string should not be empty"); std::string copy = name; if (!std::isalpha(copy[0])) { copy = "_" + copy; } for (size_t i = 1; i < copy.size(); ++i) { char& c = copy[i]; if (!std::isalnum(c)) c = '_'; } return copy; } std::string ShaderUtils::inlineVector(const Vector3f& pos) { std::stringstream stream; stream << "make_vec3(" << pos.x() << ", " << pos.y() << ", " << pos.z() << ")"; return stream.str(); } std::string ShaderUtils::inlineColor(const Vector3f& color) { std::stringstream stream; stream << "make_color(" << color.x() << ", " << color.y() << ", " << color.z() << ")"; return stream.str(); } } // namespace IG
27.125
90
0.585672
HenryJanson707
d127db0bd8c6ffd0cb6bd85b78870b89b178f4c8
68,099
cxx
C++
test/7cursor_primary.cxx
PositiveTechnologies/libfpta
57aff3aa85739fd9dce6a0b44955204d44e3c3b4
[ "Apache-2.0" ]
33
2017-07-13T10:38:11.000Z
2022-02-22T08:05:06.000Z
test/7cursor_primary.cxx
PositiveTechnologies/libfpta
57aff3aa85739fd9dce6a0b44955204d44e3c3b4
[ "Apache-2.0" ]
2
2017-07-13T21:25:16.000Z
2020-07-09T23:14:27.000Z
test/7cursor_primary.cxx
PositiveTechnologies/libfpta
57aff3aa85739fd9dce6a0b44955204d44e3c3b4
[ "Apache-2.0" ]
8
2017-10-04T20:07:41.000Z
2021-05-15T16:39:18.000Z
/* * Fast Positive Tables (libfpta), aka Позитивные Таблицы. * Copyright 2016-2020 Leonid Yuriev <leo@yuriev.ru> * * 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 "fpta_test.h" #include "keygen.hpp" /* Кол-во проверочных точек в диапазонах значений индексируемых типов. * * Значение не может быть больше чем 65536, так как это предел кол-ва * уникальных значений для fptu_uint16. * * Использовать тут большие значения смысла нет. Время работы тестов * растет примерно линейно (чуть быстрее), тогда как вероятность * проявления каких-либо ошибок растет в лучшем случае как Log(NNN), * а скорее даже как SquareRoot(Log(NNN)). */ #ifdef FPTA_CURSOR_UT_LONG static cxx11_constexp_varr int NNN = 65521; // около 1-2 минуты в /dev/shm/ #else static cxx11_constexpr_var int NNN = 509; // менее секунды в /dev/shm/ #endif static const char testdb_name[] = TEST_DB_DIR "ut_cursor_primary.fpta"; static const char testdb_name_lck[] = TEST_DB_DIR "ut_cursor_primary.fpta" MDBX_LOCK_SUFFIX; class CursorPrimary : public ::testing::TestWithParam<GTEST_TUPLE_NAMESPACE_::tuple< fptu_type, fpta_index_type, fpta_cursor_options>> { public: fptu_type type; fpta_index_type index; fpta_cursor_options ordering; bool valid_index_ops; bool valid_cursor_ops; bool skipped; scoped_db_guard db_quard; scoped_txn_guard txn_guard; scoped_cursor_guard cursor_guard; std::string pk_col_name; fpta_name table, col_pk, col_order, col_dup_id, col_t1ha; static cxx11_constexpr_var int n_dups = 5; int n_records; std::unordered_map<int, int> reorder; static int mesh(int n) { return (int)((163 + (unsigned)n * 42101) % NNN); } void CheckPosition(int linear, int dup_id, int expected_n_dups = 0, bool check_dup_id = true) { if (linear < 0) { /* для удобства и выразительности теста linear = -1 здесь * означает последнюю запись, -2 = предпоследнюю и т.д. */ linear += (int)reorder.size(); } if (dup_id < 0) { /* для удобства и выразительности теста dup_id = -1 здесь * означает последний дубликат, -2 = предпоследний и т.д. */ dup_id += n_dups; } if (expected_n_dups == 0) { /* для краткости теста expected_n_dups = 0 здесь означает значение * по-умолчанию, когда строки-дубликаты не удаляются в ходе теста */ expected_n_dups = fpta_index_is_unique(index) ? 1 : n_dups; } SCOPED_TRACE("linear-order " + std::to_string(linear) + " [0..." + std::to_string(reorder.size() - 1) + "], linear-dup " + (check_dup_id ? std::to_string(dup_id) : "any")); ASSERT_EQ(1u, reorder.count(linear)); const auto expected_order = reorder.at(linear); /* Следует пояснить (в том числе напомнить себе), почему порядок * следования строк-дубликатов (с одинаковым значением PK) здесь * совпадает с dup_id: * - При формировании строк-дубликатов, их кортежи полностью совпадают, * за исключением поля dup_id. При этом dup_id отличается только * одним байтом. * - В случае primary-индекса данные, соответствующие одному значению * ключа, сортируются при помощи компаратора fptu_cmp_tuples(), что * формирует порядок по возрастанию dup_id. Однако, даже при * сравнении посредством memcmp(), различие только в одном байте * также сформирует порядок по возрастанию dup_id. * * Таким образом, физический порядок строк-дубликатов всегда по * возрастанию dup_id (причем нет видимых причин это как-либо менять). * * -------------------------------------------------------------------- * * Далее, для курсора с обратным порядком сортировки (descending) * видимый порядок строк будет изменен на обратный, включая порядок * строк-дубликатов. Предполагается что такая симметричность будет * более ожидаема и удобна, нежели если порядок дубликатов * сохранится (не будет обратным). * * Соответственно ниже для descending-курсора выполняется "переворот" * контрольного номера дубликата. */ const int expected_dup_id = fpta_index_is_unique(index) ? 42 : fpta_cursor_is_descending(ordering) ? n_dups - (dup_id + 1) : dup_id; SCOPED_TRACE("logical-order " + std::to_string(expected_order) + " [" + std::to_string(0) + "..." + std::to_string(NNN) + "), logical-dup " + (check_dup_id ? std::to_string(expected_dup_id) : "any")); ASSERT_EQ(FPTA_OK, fpta_cursor_eof(cursor_guard.get())); fptu_ro tuple; ASSERT_EQ(FPTA_OK, fpta_cursor_get(cursor_guard.get(), &tuple)); ASSERT_STREQ(nullptr, fptu::check(tuple)); int error; fpta_value key; ASSERT_EQ(FPTA_OK, fpta_cursor_key(cursor_guard.get(), &key)); SCOPED_TRACE("key: " + std::to_string(key.type) + ", length " + std::to_string(key.binary_length)); auto tuple_order = (int)fptu_get_sint(tuple, col_order.column.num, &error); ASSERT_EQ(FPTU_OK, error); ASSERT_EQ(expected_order, tuple_order); auto tuple_checksum = fptu_get_uint(tuple, col_t1ha.column.num, &error); ASSERT_EQ(FPTU_OK, error); auto checksum = order_checksum(tuple_order, type, index).uint; ASSERT_EQ(checksum, tuple_checksum); auto tuple_dup_id = (int)fptu_get_uint(tuple, col_dup_id.column.num, &error); ASSERT_EQ(FPTU_OK, error); if (check_dup_id || fpta_index_is_unique(index)) { EXPECT_EQ(expected_dup_id, tuple_dup_id); } size_t dups = 100500; ASSERT_EQ(FPTA_OK, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ(expected_n_dups, (int)dups); } virtual void Fill() { fptu_rw *row = fptu_alloc(4, fpta_max_keylen * 2 + 4 + 4); ASSERT_NE(nullptr, row); ASSERT_STREQ(nullptr, fptu::check(row)); fpta_txn *const txn = txn_guard.get(); any_keygen keygen(type, index); n_records = 0; for (int linear = 0; linear < NNN; ++linear) { int order = mesh(linear); SCOPED_TRACE("order " + std::to_string(order)); fpta_value value_pk = keygen.make(order, NNN); if (value_pk.type == fpta_end) break; if (value_pk.type == fpta_begin) continue; // теперь формируем кортеж ASSERT_EQ(FPTU_OK, fptu_clear(row)); ASSERT_STREQ(nullptr, fptu::check(row)); ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_order, fpta_value_sint(order))); ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_pk, value_pk)); // t1ha как "checksum" для order ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_t1ha, order_checksum(order, type, index))); if (fpta_index_is_unique(index)) { // вставляем одну запись с dup_id = 42 ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_dup_id, fpta_value_uint(42))); ASSERT_EQ(FPTA_OK, fpta_insert_row(txn, &table, fptu_take_noshrink(row))); ++n_records; } else { for (int dup_id = 0; dup_id < n_dups; ++dup_id) { ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_dup_id, fpta_value_sint(dup_id))); ASSERT_EQ(FPTA_OK, fpta_insert_row(txn, &table, fptu_take_noshrink(row))); ++n_records; } } } // разрушаем кортеж ASSERT_STREQ(nullptr, fptu::check(row)); free(row); } virtual void SetUp() { // нужно простое число, иначе сломается переупорядочивание ASSERT_TRUE(isPrime(NNN)); // иначе не сможем проверить fptu_uint16 ASSERT_GE(65535, NNN); type = GTEST_TUPLE_NAMESPACE_::get<0>(GetParam()); index = GTEST_TUPLE_NAMESPACE_::get<1>(GetParam()); ordering = GTEST_TUPLE_NAMESPACE_::get<2>(GetParam()); valid_index_ops = is_valid4primary(type, index); valid_cursor_ops = is_valid4cursor(index, ordering); SCOPED_TRACE( "type " + std::to_string(type) + ", index " + std::to_string(index) + (valid_index_ops ? ", (valid index case)" : ", (invalid index case)")); SCOPED_TRACE("ordering " + std::to_string(ordering) + ", index " + std::to_string(index) + (valid_cursor_ops ? ", (valid cursor case)" : ", (invalid cursor case)")); skipped = GTEST_IS_EXECUTION_TIMEOUT(); if (skipped) return; // инициализируем идентификаторы колонок ASSERT_EQ(FPTA_OK, fpta_table_init(&table, "table")); pk_col_name = "pk_" + std::to_string(type); ASSERT_EQ(FPTA_OK, fpta_column_init(&table, &col_pk, pk_col_name.c_str())); ASSERT_EQ(FPTA_OK, fpta_column_init(&table, &col_order, "order")); ASSERT_EQ(FPTA_OK, fpta_column_init(&table, &col_dup_id, "dup_id")); ASSERT_EQ(FPTA_OK, fpta_column_init(&table, &col_t1ha, "t1ha")); // создаем четыре колонки: pk, order, t1ha и dup_id fpta_column_set def; fpta_column_set_init(&def); if (!valid_index_ops) { EXPECT_NE(FPTA_OK, fpta_column_describe(pk_col_name.c_str(), type, index, &def)); EXPECT_EQ(FPTA_OK, fpta_column_describe("order", fptu_int32, fpta_index_none, &def)); ASSERT_NE(FPTA_OK, fpta_column_set_validate(&def)); // разрушаем описание таблицы EXPECT_EQ(FPTA_OK, fpta_column_set_destroy(&def)); EXPECT_NE(FPTA_OK, fpta_column_set_validate(&def)); return; } EXPECT_EQ(FPTA_OK, fpta_column_describe(pk_col_name.c_str(), type, index, &def)); EXPECT_EQ(FPTA_OK, fpta_column_describe("order", fptu_int32, fpta_index_none, &def)); EXPECT_EQ(FPTA_OK, fpta_column_describe("dup_id", fptu_uint16, fpta_noindex_nullable, &def)); EXPECT_EQ(FPTA_OK, fpta_column_describe("t1ha", fptu_uint64, fpta_index_none, &def)); ASSERT_EQ(FPTA_OK, fpta_column_set_validate(&def)); // чистим if (REMOVE_FILE(testdb_name) != 0) { ASSERT_EQ(ENOENT, errno); } if (REMOVE_FILE(testdb_name_lck) != 0) { ASSERT_EQ(ENOENT, errno); } #ifdef FPTA_CURSOR_UT_LONG // пытаемся обойтись меньшей базой, // но для строк потребуется больше места unsigned megabytes = 32; if (type > fptu_96) megabytes = 56; if (type > fptu_256) megabytes = 64; #else unsigned megabytes = 1; #endif /* В пике нужно примерно вдвое больше места, так как один из тестов * будет выполнять удаление до половины строк в случайном порядке, * и в результате может обновить почти каждую страницу БД. */ megabytes += megabytes; fpta_db *db = nullptr; ASSERT_EQ(FPTA_OK, test_db_open(testdb_name, fpta_weak, fpta_regime_default, megabytes, true, &db)); ASSERT_NE(nullptr, db); db_quard.reset(db); // создаем таблицу fpta_txn *txn = nullptr; EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db, fpta_schema, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); ASSERT_EQ(FPTA_OK, fpta_table_create(txn, "table", &def)); ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), false)); txn = nullptr; // разрушаем описание таблицы EXPECT_EQ(FPTA_OK, fpta_column_set_destroy(&def)); EXPECT_NE(FPTA_OK, fpta_column_set_validate(&def)); /* Для полноты тесты переоткрываем базу. В этом нет явной необходимости, * но только так можно проверить работу некоторых механизмов. * * В частности: * - внутри движка создание таблицы одновременно приводит к открытию её * dbi-хендла, с размещением его во внутренних структурах. * - причем этот хендл будет жив до закрытии всей базы, либо до удаления * таблицы. * - поэтому для проверки кода открывающего существующую таблицы * необходимо закрыть и повторно открыть всю базу. */ // закрываем базу ASSERT_EQ(FPTA_SUCCESS, fpta_db_close(db_quard.release())); db = nullptr; // открываем заново ASSERT_EQ(FPTA_OK, test_db_open(testdb_name, fpta_weak, fpta_regime_default, megabytes, false, &db)); ASSERT_NE(nullptr, db); db_quard.reset(db); //------------------------------------------------------------------------ // начинаем транзакцию записи EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db, fpta_write, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); // связываем идентификаторы с ранее созданной схемой ASSERT_EQ(FPTA_OK, fpta_name_refresh_couple(txn, &table, &col_pk)); ASSERT_EQ(FPTA_OK, fpta_name_refresh(txn, &col_order)); ASSERT_EQ(FPTA_OK, fpta_name_refresh(txn, &col_dup_id)); ASSERT_EQ(FPTA_OK, fpta_name_refresh(txn, &col_t1ha)); ASSERT_NO_FATAL_FAILURE(Fill()); // завершаем транзакцию ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), false)); txn = nullptr; //------------------------------------------------------------------------ // начинаем транзакцию чтения EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db, fpta_read, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); fpta_cursor *cursor; if (valid_cursor_ops) { EXPECT_EQ(FPTA_OK, fpta_cursor_open(txn, &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, ordering, &cursor)); ASSERT_NE(nullptr, cursor); cursor_guard.reset(cursor); } else { EXPECT_EQ(FPTA_NO_INDEX, fpta_cursor_open(txn, &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, ordering, &cursor)); cursor_guard.reset(cursor); ASSERT_EQ(nullptr, cursor); return; } // формируем линейную карту, чтобы проще проверять переходы reorder.clear(); reorder.reserve(NNN); int prev_order = -1; for (int linear = 0; fpta_cursor_eof(cursor) == FPTA_OK; ++linear) { fptu_ro tuple; EXPECT_EQ(FPTA_OK, fpta_cursor_get(cursor_guard.get(), &tuple)); ASSERT_STREQ(nullptr, fptu::check(tuple)); int error; auto tuple_order = (int)fptu_get_sint(tuple, col_order.column.num, &error); ASSERT_EQ(FPTU_OK, error); auto tuple_checksum = fptu_get_uint(tuple, col_t1ha.column.num, &error); ASSERT_EQ(FPTU_OK, error); auto checksum = order_checksum(tuple_order, type, index).uint; ASSERT_EQ(checksum, tuple_checksum); reorder[linear] = tuple_order; error = fpta_cursor_move(cursor, fpta_key_next); if (error == FPTA_NODATA) break; ASSERT_EQ(FPTA_SUCCESS, error); // проверяем упорядоченность if (fpta_cursor_is_ordered(ordering) && linear > 0) { if (fpta_cursor_is_ascending(ordering)) { ASSERT_LE(prev_order, tuple_order); } else { ASSERT_GE(prev_order, tuple_order); } } prev_order = tuple_order; } ASSERT_EQ(NNN, (int)reorder.size()); } virtual void TearDown() { if (skipped) return; // разрушаем привязанные идентификаторы fpta_name_destroy(&table); fpta_name_destroy(&col_pk); fpta_name_destroy(&col_order); fpta_name_destroy(&col_dup_id); fpta_name_destroy(&col_t1ha); // закрываем курсор и завершаем транзакцию if (cursor_guard) { EXPECT_EQ(FPTA_OK, fpta_cursor_close(cursor_guard.release())); } if (txn_guard) { ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), true)); } if (db_quard) { // закрываем и удаляем базу ASSERT_EQ(FPTA_SUCCESS, fpta_db_close(db_quard.release())); ASSERT_TRUE(REMOVE_FILE(testdb_name) == 0); ASSERT_TRUE(REMOVE_FILE(testdb_name_lck) == 0); } } }; cxx11_constexpr_var int CursorPrimary::n_dups; TEST_P(CursorPrimary, basicMoves) { /* Проверка базовых перемещений курсора по первичному (primary) индексу. * * Сценарий (общий для всех типов полей и всех видов первичных индексов): * 1. Создается тестовая база с одной таблицей, в которой четыре колонки: * - "col_pk" (primary key) с типом, для которого производится * тестирование работы индекса. * - Колонка "order", в которую записывается контрольный (ожидаемый) * порядковый номер следования строки, при сортировке по col_pk и * проверяемому виду индекса. * - Колонка "dup_id", которая используется для идентификации * дубликатов индексов допускающих не-уникальные ключи. * - Колонка "t1ha", в которую записывается "контрольная сумма" от * ожидаемого порядка строки, типа PK и вида индекса. * Принципиальной необходимости в этой колонке нет, она используется * как "утяжелитель", а также для дополнительного контроля. * * 2. Для валидных комбинаций вида индекса и типа данных col_pk таблица * заполняется строками, значение col_pk в которых генерируется * соответствующим генератором значений: * - Сами генераторы проверяются в одном из тестов 0corny. * - Для индексов без уникальности для каждого ключа вставляется * 5 строк с разным dup_id. * * 3. Перебираются все комбинации индексов, типов колонок и видов курсора. * Для НЕ валидных комбинаций контролируются коды ошибок. * * 4. Для валидных комбинаций индекса и типа курсора, после заполнения * в отдельной транзакции формируется "карта" верификации перемещений: * - "карта" строится как неупорядоченное отображение линейных номеров * строк в порядке просмотра через курсор, на ожидаемые (контрольные) * значения колонки "order". * - при построении "карты" все строки читаются последовательно через * проверяемый курсор. * - для построенной "карты" проверяется размер (что прочитали все * строки и только по одному разу) и соответствия порядка строк * типу курсора (возрастание/убывание). * * 5. После формирования "карты" верификации перемещений выполняется ряд * базовых перемещений курсора: * - переход к первой/последней строке. * - попытки перейти за последнюю и за первую строки. * - переход в начало с отступлением к концу. * - переход к концу с отступление к началу. * - при каждом перемещении проверяется корректность кода ошибки, * соответствие текущей строки ожидаемому порядку, включая * содержимое строки и номера дубликата. * * 6. Завершаются операции и освобождаются ресурсы. */ if (!valid_index_ops || !valid_cursor_ops || skipped) return; SCOPED_TRACE("type " + std::to_string(type) + ", index " + std::to_string(index) + (valid_index_ops ? ", (valid case)" : ", (invalid case)")); SCOPED_TRACE( "ordering " + std::to_string(ordering) + ", index " + std::to_string(index) + (valid_cursor_ops ? ", (valid cursor case)" : ", (invalid cursor case)")); ASSERT_LT(5, n_records); fpta_cursor *const cursor = cursor_guard.get(); ASSERT_NE(nullptr, cursor); // переходим туда-сюда и к первой строке ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // пробуем уйти дальше последней строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_last)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_first)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); // пробуем выйти за первую строку ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_last)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_first)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); // идем в конец и проверяем назад/вперед ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_next)); // идем в начало и проверяем назад/вперед ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, -1)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, -1)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_prev)); } //---------------------------------------------------------------------------- /* Другое имя класса требуется для инстанцирования другого (меньшего) * набора комбинаций в INSTANTIATE_TEST_SUITE_P. */ class CursorPrimaryDups : public CursorPrimary {}; TEST_P(CursorPrimaryDups, dupMoves) { /* Проверка перемещений курсора по дубликатами в первичном (primary) * индексе. * * Сценарий (общий для всех типов полей и всех видов первичных индексов): * 1. Создается тестовая база с одной таблицей, в которой четыре колонки: * - "col_pk" (primary key) с типом, для которого производится * тестирование работы индекса. * - Колонка "order", в которую записывается контрольный (ожидаемый) * порядковый номер следования строки, при сортировке по col_pk и * проверяемому виду индекса. * - Колонка "dup_id", которая используется для нумерации дубликатов. * - Колонка "t1ha", в которую записывается "контрольная сумма" от * ожидаемого порядка строки, типа PK и вида индекса. Принципиальной * необходимости в этой колонке нет, она используется как * "утяжелитель", а также для дополнительного контроля. * * 2. Для валидных комбинаций вида индекса и типа данных col_pk таблица * заполняется строками, значение PK в которых генерируется * соответствующим генератором значений: * - Сами генераторы проверяются в одном из тестов 0corny. * - Для каждого значения ключа вставляется 5 строк с разным dup_id. * - FIXME: Дополнительно, для тестирования межстраничных переходов, * генерируется длинная серия повторов, которая более чем в три раза * превышает размер страницы БД. * * 3. Перебираются все комбинации индексов, типов колонок и видов курсора. * Для НЕ валидных комбинаций контролируются коды ошибок. * * 4. Для валидных комбинаций индекса и типа курсора, после заполнения * в отдельной транзакции формируется "карта" верификации перемещений: * - "карта" строится как неупорядоченное отображение линейных номеров * строк в порядке просмотра через курсор, на ожидаемые (контрольные) * значения колонки "order". * - при построении "карты" все строки читаются последовательно через * проверяемый курсор. * - для построенной "карты" проверяется размер (что прочитали все * строки и только по одному разу) и соответствия порядка строк * типу курсора (возрастание/убывание). * * 5. После формирования "карты" верификации перемещений выполняется ряд * базовых перемещений курсора по дубликатам: * - переход к первой/последней строке, * к первому и последнему дубликату. * - попытки перейти за последнюю и за первую строки, * за первый/последний дубликат. * - переход в начало с отступлением к концу. * - переход к концу с отступление к началу. * - при каждом перемещении проверяется корректность кода ошибки, * соответствие текущей строки ожидаемому порядку, включая * содержимое строки и номера дубликата. * * 6. Завершаются операции и освобождаются ресурсы. */ if (!valid_index_ops || !valid_cursor_ops || skipped || fpta_index_is_unique(index)) return; SCOPED_TRACE("type " + std::to_string(type) + ", index " + std::to_string(index) + (valid_index_ops ? ", (valid case)" : ", (invalid case)")); SCOPED_TRACE( "ordering " + std::to_string(ordering) + ", index " + std::to_string(index) + (valid_cursor_ops ? ", (valid cursor case)" : ", (invalid cursor case)")); ASSERT_LT(5, n_records); fpta_cursor *const cursor = cursor_guard.get(); ASSERT_NE(nullptr, cursor); /* переходим туда-сюда и к первой строке, такие переходы уже проверялись * в предыдущем тесте, здесь же для проверки жизнеспособности курсора. */ ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // к последнему, затем к первому дубликату первой строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // вперед по дубликатам первой строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 4)); // пробуем выйти за последний дубликат ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 4)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 4)); // назад по дубликатам первой строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // пробуем выйти за первый дубликат ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // вперед в обход дубликатов, ко второй строке, затем к третьей и четвертой ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(3, 0)); // назад в обход дубликатов, до первой строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, -1)); // пробуем выйти за первую строку ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); // последовательно вперед от начала по каждому дубликату ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(3, 0)); // последовательно назад к началу по каждому дубликату ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(0, 0)); // пробуем выйти за первую строку ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_prev)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); //-------------------------------------------------------------------------- // к последней строке ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); // к первому, затем к последнему дубликату последней строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_first)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_last)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); // назад по дубликатам последней строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); // пробуем выйти за первый дубликат ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); // вперед по дубликатам первой строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 4)); // пробуем выйти за последний дубликат ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_dup_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, -1)); // назад в обход дубликатов, к предпоследней строке, // затем к пред-предпоследней... ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, -1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-4, -1)); // вперед в обход дубликатов, до последней строки ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); // пробуем выйти за первую строку ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_key_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); // последовательно назад от конца по каждому дубликату ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 0)); // последовательно вперед до конца по каждому дубликату ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-3, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-2, 4)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 0)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 1)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 2)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 3)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_next)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 4)); // пробуем выйти за последнюю строку ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_move(cursor, fpta_next)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_prev)); ASSERT_NO_FATAL_FAILURE(CheckPosition(-1, 4)); } //---------------------------------------------------------------------------- TEST_P(CursorPrimary, locate_and_delele) { /* Проверка позиционирования курсора по первичному (primary) индексу. * * Сценарий (общий для всех типов полей и всех видов первичных индексов): * 1. Создается тестовая база с одной таблицей, в которой четыре колонки: * - "col_pk" (primary key) с типом, для которого производится * тестирование работы индекса. * - Колонка "order", в которую записывается контрольный (ожидаемый) * порядковый номер следования строки, при сортировке по col_pk и * проверяемому виду индекса. * - Колонка "dup_id", которая используется для идентификации * дубликатов индексов допускающих не-уникальные ключи. * - Колонка "t1ha", в которую записывается "контрольная сумма" от * ожидаемого порядка строки, типа PK и вида индекса. * Принципиальной необходимости в этой колонке нет, она используется * как "утяжелитель", а также для дополнительного контроля. * * 2. Для валидных комбинаций вида индекса и типа данных col_pk таблица * заполняется строками, значение col_pk в которых генерируется * соответствующим генератором значений: * - Сами генераторы проверяются в одном из тестов 0corny. * - Для индексов без уникальности для каждого ключа вставляется * 5 строк с разным dup_id. * * 3. Перебираются все комбинации индексов, типов колонок и видов курсора. * Для НЕ валидных комбинаций контролируются коды ошибок. * * 4. Для валидных комбинаций индекса и типа курсора, после заполнения * в отдельной транзакции формируется "карта" верификации перемещений: * - "карта" строится как неупорядоченное отображение линейных номеров * строк в порядке просмотра через курсор, на ожидаемые (контрольные) * значения колонки "order". * - при построении "карты" все строки читаются последовательно через * проверяемый курсор. * - для построенной "карты" проверяется размер (что прочитали все * строки и только по одному разу) и соответствия порядка строк * типу курсора (возрастание/убывание). * * 5. После формирования "карты" выполняются несколько проверочных * итераций, в конце каждой из которых часть записей удаляется: * - выполняется позиционирование на значение ключа для каждого * элемента проверочной "карты", которая была сформирована * на предыдущем шаге. * - проверяется успешность операции с учетом того был ли элемент * уже удален или еще нет. * - проверяется результирующая позиция курсора. * - удаляется часть строк: текущая транзакция чтения закрывается, * открывается пишущая, выполняется удаление, курсор переоткрывается. * - после каждого удаления проверяется что позиция курсора * соответствует ожиданиям (сделан переход к следующей записи * в порядке курсора). * - итерации повторяются пока не будут удалены все строки. * - при выполнении всех проверок и удалений строки выбираются * в стохастическом порядке. * * 6. Завершаются операции и освобождаются ресурсы. */ if (!valid_index_ops || !valid_cursor_ops || skipped) return; SCOPED_TRACE("type " + std::to_string(type) + ", index " + std::to_string(index) + (valid_index_ops ? ", (valid case)" : ", (invalid case)")); SCOPED_TRACE( "ordering " + std::to_string(ordering) + ", index " + std::to_string(index) + (valid_cursor_ops ? ", (valid cursor case)" : ", (invalid cursor case)")); ASSERT_LT(5, n_records); /* заполняем present "номерами" значений ключа существующих записей, * важно что эти "номера" через карту позволяют получить соответствующее * значения от генератора ключей */ std::vector<int> present; std::map<int, int> dups_countdown; for (const auto &pair : reorder) { present.push_back(pair.first); dups_countdown[pair.first] = fpta_index_is_unique(index) ? 1 : n_dups; } // сохраняем исходный полный набор auto initial = present; any_keygen keygen(type, index); for (;;) { SCOPED_TRACE("records left " + std::to_string(present.size())); // перемешиваем for (size_t i = 0; i < present.size(); ++i) { auto remix = (4201 + i * 2017) % present.size(); std::swap(present[i], present[remix]); } for (size_t i = 0; i < initial.size(); ++i) { auto remix = (44741 + i * 55001) % initial.size(); std::swap(initial[i], initial[remix]); } // начинаем транзакцию чтения если предыдущая закрыта fpta_txn *txn = txn_guard.get(); if (!txn_guard) { EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db_quard.get(), fpta_read, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); } // открываем курсор для чтения fpta_cursor *cursor = nullptr; EXPECT_EQ(FPTA_OK, fpta_cursor_open( txn_guard.get(), &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, (fpta_cursor_options)(ordering | fpta_dont_fetch), &cursor)); ASSERT_NE(nullptr, cursor); cursor_guard.reset(cursor); // проверяем позиционирование for (size_t i = 0; i < initial.size(); ++i) { const auto linear = initial.at(i); ASSERT_EQ(1u, reorder.count(linear)); const auto order = reorder[linear]; int expected_dups = dups_countdown.count(linear) ? dups_countdown.at(linear) : 0; SCOPED_TRACE("linear " + std::to_string(linear) + ", order " + std::to_string(order) + (dups_countdown.count(linear) ? ", present" : ", deleted")); fpta_value key = keygen.make(order, NNN); size_t dups = 100500; switch (expected_dups) { case 0: /* все значения уже были удалены, * точный поиск (exactly=true) должен вернуть "нет данных" */ ASSERT_EQ(FPTA_NODATA, fpta_cursor_locate(cursor, true, &key, nullptr)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_ECURSOR, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ((size_t)FPTA_DEADBEEF, dups); if (present.size()) { /* но какие-то строки в таблице еще есть, поэтому неточный * поиск (exactly=false) должен вернуть "ОК" если: * - для курсора определен порядок строк. * - в порядке курсора есть строки "после" запрошенного значения * ключа (аналогично lower_bound и с учетом того, что строк * с заданным значением ключа уже нет). */ const auto lower_bound = dups_countdown.lower_bound(linear); if (fpta_cursor_is_ordered(ordering) && lower_bound != dups_countdown.end()) { const auto SCOPED_TRACE_ONLY expected_linear = lower_bound->first; const auto SCOPED_TRACE_ONLY expected_order = reorder[expected_linear]; expected_dups = lower_bound->second; SCOPED_TRACE("lower-bound: linear " + std::to_string(expected_linear) + ", order " + std::to_string(expected_order) + ", n-dups " + std::to_string(expected_dups)); ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); ASSERT_NO_FATAL_FAILURE( CheckPosition(expected_linear, /* см ниже пояснение о expected_dup_number */ n_dups - expected_dups, expected_dups)); } else { if (fpta_cursor_is_ordered(ordering) || !FPTA_PROHIBIT_NEARBY4UNORDERED) { ASSERT_EQ(FPTA_NODATA, fpta_cursor_locate(cursor, false, &key, nullptr)); } else { ASSERT_NE(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); } ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_ECURSOR, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ((size_t)FPTA_DEADBEEF, dups); } } else { if (fpta_cursor_is_ordered(ordering) || !FPTA_PROHIBIT_NEARBY4UNORDERED) { ASSERT_EQ(FPTA_NODATA, fpta_cursor_locate(cursor, false, &key, nullptr)); } else { ASSERT_NE(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); } ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_ECURSOR, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ((size_t)FPTA_DEADBEEF, dups); } continue; case 1: if (fpta_cursor_is_ordered(ordering) || !FPTA_PROHIBIT_NEARBY4UNORDERED) { ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); ASSERT_NO_FATAL_FAILURE(CheckPosition(linear, -1, 1)); } else { ASSERT_NE(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_ECURSOR, fpta_cursor_dups(cursor_guard.get(), &dups)); } ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, true, &key, nullptr)); ASSERT_NO_FATAL_FAILURE(CheckPosition(linear, -1, 1)); break; default: /* Пояснения о expected_dup_number: * - курсор позиционируется на первый дубликат в порядке сортировки * в соответствии с типом курсора; * - удаление записей (ниже по коду) выполняется после такого * позиционирования; * - соответственно, постепенно удаляются все дубликаты, * начиная с первого в порядке сортировки курсора. * * Таким образом, ожидаемое количество дубликатов также определяет * dup_id первой строки-дубликата, на которую должен встать курсор. */ int const expected_dup_number = n_dups - expected_dups; SCOPED_TRACE("multi-val: n-dups " + std::to_string(expected_dups) + ", here-dup " + std::to_string(expected_dup_number)); ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, true, &key, nullptr)); ASSERT_EQ(FPTA_OK, fpta_cursor_eof(cursor)); ASSERT_NO_FATAL_FAILURE( CheckPosition(linear, expected_dup_number, expected_dups)); if (fpta_cursor_is_ordered(ordering) || !FPTA_PROHIBIT_NEARBY4UNORDERED) { ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); ASSERT_NO_FATAL_FAILURE( CheckPosition(linear, expected_dup_number, expected_dups)); } else { ASSERT_NE(FPTA_OK, fpta_cursor_locate(cursor, false, &key, nullptr)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_ECURSOR, fpta_cursor_dups(cursor_guard.get(), &dups)); } break; } } // закрываем читающий курсор и транзакцию ASSERT_EQ(FPTA_OK, fpta_cursor_close(cursor_guard.release())); cursor = nullptr; ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), true)); txn = nullptr; if (present.size() == 0) break; // начинаем пишущую транзакцию для удаления EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db_quard.get(), fpta_write, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); // открываем курсор для удаления EXPECT_EQ(FPTA_OK, fpta_cursor_open(txn_guard.get(), &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, ordering, &cursor)); ASSERT_NE(nullptr, cursor); cursor_guard.reset(cursor); // проверяем позиционирование и удаляем for (size_t i = present.size(); i > present.size() / 2;) { const auto linear = present.at(--i); const auto order = reorder.at(linear); int expected_dups = dups_countdown.at(linear); SCOPED_TRACE("delete: linear " + std::to_string(linear) + ", order " + std::to_string(order) + ", dups left " + std::to_string(expected_dups)); fpta_value key = keygen.make(order, NNN); ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, true, &key, nullptr)); ASSERT_EQ(0, fpta_cursor_eof(cursor)); size_t dups = 100500; ASSERT_EQ(FPTA_OK, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ(expected_dups, (int)dups); ASSERT_EQ(FPTA_OK, fpta_cursor_delete(cursor)); expected_dups = --dups_countdown.at(linear); if (expected_dups == 0) { present.erase(present.begin() + (int)i); dups_countdown.erase(linear); } // проверяем состояние курсора и его переход к следующей строке if (present.empty()) { ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ(0u, dups); } else if (expected_dups) { ASSERT_NO_FATAL_FAILURE( CheckPosition(linear, /* см выше пояснение о expected_dup_number */ n_dups - expected_dups, expected_dups)); } else if (fpta_cursor_is_ordered(ordering)) { const auto lower_bound = dups_countdown.lower_bound(linear); if (lower_bound != dups_countdown.end()) { const auto SCOPED_TRACE_ONLY expected_linear = lower_bound->first; const auto SCOPED_TRACE_ONLY expected_order = reorder[expected_linear]; expected_dups = lower_bound->second; SCOPED_TRACE("after-delete: linear " + std::to_string(expected_linear) + ", order " + std::to_string(expected_order) + ", n-dups " + std::to_string(expected_dups)); ASSERT_NO_FATAL_FAILURE( CheckPosition(expected_linear, /* см выше пояснение о expected_dup_number */ n_dups - expected_dups, expected_dups)); } else { ASSERT_EQ(FPTA_NODATA, fpta_cursor_eof(cursor)); ASSERT_EQ(FPTA_NODATA, fpta_cursor_dups(cursor_guard.get(), &dups)); ASSERT_EQ(0u, dups); } } } // завершаем транзакцию удаления ASSERT_EQ(FPTA_OK, fpta_cursor_close(cursor_guard.release())); cursor = nullptr; ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), false)); txn = nullptr; } } //---------------------------------------------------------------------------- TEST_P(CursorPrimary, update_and_KeyMismatch) { /* Проверка обновления через курсор, в том числе с попытками изменить * значение "курсорной" колонки. * * Сценарий (общий для всех типов полей и всех видов первичных индексов): * 1. Создается тестовая база с одной таблицей, в которой четыре колонки: * - "col_pk" (primary key) с типом, для которого производится * тестирование работы индекса. * - Колонка "order", в которую записывается контрольный (ожидаемый) * порядковый номер следования строки, при сортировке по col_pk и * проверяемому виду индекса. * - Колонка "dup_id", которая используется для идентификации * дубликатов индексов допускающих не-уникальные ключи. * - Колонка "t1ha", в которую записывается "контрольная сумма" от * ожидаемого порядка строки, типа PK и вида индекса. * Принципиальной необходимости в этой колонке нет, она используется * как "утяжелитель", а также для дополнительного контроля. * * 2. Для валидных комбинаций вида индекса и типа данных col_pk таблица * заполняется строками, значение col_pk в которых генерируется * соответствующим генератором значений: * - Сами генераторы проверяются в одном из тестов 0corny. * - Для индексов без уникальности для каждого ключа вставляется * 5 строк с разным dup_id. * * 3. Перебираются все комбинации индексов, типов колонок и видов курсора. * Для НЕ валидных комбинаций контролируются коды ошибок. * * 4. Для валидных комбинаций индекса и типа курсора, после заполнения * в отдельной транзакции формируется "карта" верификации перемещений: * - "карта" строится как неупорядоченное отображение линейных номеров * строк в порядке просмотра через курсор, на ожидаемые (контрольные) * значения колонки "order". * - при построении "карты" все строки читаются последовательно через * проверяемый курсор. * - для построенной "карты" проверяется размер (что прочитали все * строки и только по одному разу) и соответствия порядка строк * типу курсора (возрастание/убывание). * * 5. Примерно половина строк (без учета дубликатов) изменяется * через курсор: * - в качестве критерия изменять/не-менять используется * младший бит значения колонки "t1ha". * - в изменяемых строках инвертируется знак колонки "order", * а колонка "dup_id" устанавливается в 4242. * - при каждом реальном обновлении делается две попытки обновить * строку с изменением значения ключевой "курсорной" колонки. * * 6. Выполняется проверка всех строк, как исходных, так и измененных. * При наличии дубликатов, измененные строки ищутся по значению * колонки "dup_id". */ if (!valid_index_ops || !valid_cursor_ops || skipped) return; SCOPED_TRACE("type " + std::to_string(type) + ", index " + std::to_string(index) + (valid_index_ops ? ", (valid case)" : ", (invalid case)")); SCOPED_TRACE( "ordering " + std::to_string(ordering) + ", index " + std::to_string(index) + (valid_cursor_ops ? ", (valid cursor case)" : ", (invalid cursor case)")); any_keygen keygen(type, index); const int expected_dups = fpta_index_is_unique(index) ? 1 : n_dups; // закрываем читающий курсор и транзакцию ASSERT_EQ(FPTA_OK, fpta_cursor_close(cursor_guard.release())); ASSERT_EQ(FPTA_OK, fpta_transaction_end(txn_guard.release(), true)); // начинаем пишущую транзакцию для изменений fpta_txn *txn = nullptr; EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db_quard.get(), fpta_write, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); // открываем курсор для изменения fpta_cursor *cursor = nullptr; EXPECT_EQ(FPTA_OK, fpta_cursor_open(txn_guard.get(), &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, ordering, &cursor)); ASSERT_NE(nullptr, cursor); cursor_guard.reset(cursor); // обновляем половину строк for (int order = 0; order < NNN; ++order) { SCOPED_TRACE("order " + std::to_string(order)); fpta_value value_pk = keygen.make(order, NNN); ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, true, &value_pk, nullptr)); ASSERT_EQ(FPTA_OK, fpta_cursor_eof(cursor_guard.get())); fptu_ro tuple; ASSERT_EQ(FPTA_OK, fpta_cursor_get(cursor_guard.get(), &tuple)); ASSERT_STREQ(nullptr, fptu::check(tuple)); int error; auto tuple_order = (int)fptu_get_sint(tuple, col_order.column.num, &error); ASSERT_EQ(FPTU_OK, error); ASSERT_EQ(order, tuple_order); auto tuple_checksum = fptu_get_uint(tuple, col_t1ha.column.num, &error); ASSERT_EQ(FPTU_OK, error); const auto checksum = order_checksum(tuple_order, type, index).uint; ASSERT_EQ(checksum, tuple_checksum); if (checksum & 1) { uint8_t buffer[(fpta_max_keylen + 4) * 4 + sizeof(fptu_rw)]; fptu_rw *row = fptu_fetch(tuple, buffer, sizeof(buffer), 1); ASSERT_NE(nullptr, row); ASSERT_STREQ(nullptr, fptu::check(row)); // инвертируем знак order и пытаемся обновить строку с изменением ключа ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_order, fpta_value_sint(-tuple_order))); value_pk = keygen.make((order + 42) % NNN, NNN); ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_pk, value_pk)); ASSERT_EQ(FPTA_KEY_MISMATCH, fpta_cursor_probe_and_update(cursor, fptu_take(row))); // восстанавливаем значение ключа и обновляем строку value_pk = keygen.make(order, NNN); ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_pk, value_pk)); // для простоты контроля среди дубликатов устанавливаем dup_id = 4242 ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_dup_id, fpta_value_sint(4242))); ASSERT_EQ(FPTA_OK, fpta_cursor_probe_and_update(cursor, fptu_take(row))); // для проверки еще раз пробуем "сломать" ключ value_pk = keygen.make((order + 24) % NNN, NNN); ASSERT_EQ(FPTA_OK, fpta_upsert_column(row, &col_pk, value_pk)); ASSERT_EQ(FPTA_KEY_MISMATCH, fpta_cursor_probe_and_update(cursor, fptu_take_noshrink(row))); size_t ndups; ASSERT_EQ(FPTA_OK, fpta_cursor_dups(cursor, &ndups)); ASSERT_EQ(expected_dups, (int)ndups); } } // завершаем транзакцию изменения ASSERT_EQ(FPTA_OK, fpta_cursor_close(cursor_guard.release())); cursor = nullptr; ASSERT_EQ(FPTA_OK, fpta_transaction_commit(txn_guard.release())); txn = nullptr; // начинаем транзакцию чтения если предыдущая закрыта EXPECT_EQ(FPTA_OK, fpta_transaction_begin(db_quard.get(), fpta_read, &txn)); ASSERT_NE(nullptr, txn); txn_guard.reset(txn); // открываем курсор для чтения EXPECT_EQ(FPTA_OK, fpta_cursor_open(txn_guard.get(), &col_pk, fpta_value_begin(), fpta_value_end(), nullptr, (fpta_cursor_options)(ordering | fpta_dont_fetch), &cursor)); ASSERT_NE(nullptr, cursor); cursor_guard.reset(cursor); // проверяем обновления for (int order = 0; order < NNN; ++order) { SCOPED_TRACE("order " + std::to_string(order)); const fpta_value value_pk = keygen.make(order, NNN); fptu_ro tuple; int error; ASSERT_EQ(FPTA_OK, fpta_cursor_locate(cursor, true, &value_pk, nullptr)); ASSERT_EQ(FPTA_OK, fpta_cursor_eof(cursor_guard.get())); size_t ndups; ASSERT_EQ(FPTA_OK, fpta_cursor_dups(cursor, &ndups)); ASSERT_EQ(expected_dups, (int)ndups); const auto checksum = order_checksum(order, type, index).uint; for (;;) { ASSERT_EQ(FPTA_OK, fpta_cursor_get(cursor_guard.get(), &tuple)); ASSERT_STREQ(nullptr, fptu::check(tuple)); auto tuple_checksum = fptu_get_uint(tuple, col_t1ha.column.num, &error); ASSERT_EQ(FPTU_OK, error); ASSERT_EQ(checksum, tuple_checksum); auto tuple_dup_id = (int)fptu_get_uint(tuple, col_dup_id.column.num, &error); ASSERT_EQ(FPTU_OK, error); // идем по строкам-дубликатом до той, которую обновляли if (tuple_dup_id != 4242 && (checksum & 1)) ASSERT_EQ(FPTA_OK, fpta_cursor_move(cursor, fpta_dup_next)); else break; } auto tuple_order = (int)fptu_get_sint(tuple, col_order.column.num, &error); ASSERT_EQ(FPTU_OK, error); int expected_order = order; if (checksum & 1) expected_order = -expected_order; EXPECT_EQ(expected_order, tuple_order); } } //---------------------------------------------------------------------------- #ifdef INSTANTIATE_TEST_SUITE_P INSTANTIATE_TEST_SUITE_P( Combine, CursorPrimary, ::testing::Combine( ::testing::Values(fptu_null, fptu_uint16, fptu_int32, fptu_uint32, fptu_fp32, fptu_int64, fptu_uint64, fptu_fp64, fptu_datetime, fptu_96, fptu_128, fptu_160, fptu_256, fptu_cstr, fptu_opaque /*, fptu_nested, fptu_farray */), ::testing::Values(fpta_primary_unique_ordered_obverse, fpta_primary_unique_ordered_reverse, fpta_primary_withdups_ordered_obverse, fpta_primary_withdups_ordered_reverse, fpta_primary_unique_unordered, fpta_primary_withdups_unordered), ::testing::Values(fpta_unsorted, fpta_ascending, fpta_descending))); INSTANTIATE_TEST_SUITE_P( Combine, CursorPrimaryDups, ::testing::Combine( ::testing::Values(fptu_null, fptu_uint16, fptu_int32, fptu_uint32, fptu_fp32, fptu_int64, fptu_uint64, fptu_fp64, fptu_datetime, fptu_96, fptu_128, fptu_160, fptu_256, fptu_cstr, fptu_opaque /*, fptu_nested, fptu_farray */), ::testing::Values(fpta_primary_withdups_ordered_obverse, fpta_primary_withdups_ordered_reverse, fpta_primary_withdups_unordered), ::testing::Values(fpta_unsorted, fpta_ascending, fpta_descending))); #else INSTANTIATE_TEST_CASE_P( Combine, CursorPrimary, ::testing::Combine( ::testing::Values(fptu_null, fptu_uint16, fptu_int32, fptu_uint32, fptu_fp32, fptu_int64, fptu_uint64, fptu_fp64, fptu_datetime, fptu_96, fptu_128, fptu_160, fptu_256, fptu_cstr, fptu_opaque /*, fptu_nested, fptu_farray */), ::testing::Values(fpta_primary_unique_ordered_obverse, fpta_primary_unique_ordered_reverse, fpta_primary_withdups_ordered_obverse, fpta_primary_withdups_ordered_reverse, fpta_primary_unique_unordered, fpta_primary_withdups_unordered), ::testing::Values(fpta_unsorted, fpta_ascending, fpta_descending))); INSTANTIATE_TEST_CASE_P( Combine, CursorPrimaryDups, ::testing::Combine( ::testing::Values(fptu_null, fptu_uint16, fptu_int32, fptu_uint32, fptu_fp32, fptu_int64, fptu_uint64, fptu_fp64, fptu_datetime, fptu_96, fptu_128, fptu_160, fptu_256, fptu_cstr, fptu_opaque /*, fptu_nested, fptu_farray */), ::testing::Values(fpta_primary_withdups_ordered_obverse, fpta_primary_withdups_ordered_reverse, fpta_primary_withdups_unordered), ::testing::Values(fpta_unsorted, fpta_ascending, fpta_descending))); #endif int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
44.480078
80
0.68092
PositiveTechnologies
d12a1fe9644f19b49ca1359b0d87c8bfa1113e41
2,608
cpp
C++
LeetCode/103_zig_zag_level_order_traversal.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
LeetCode/103_zig_zag_level_order_traversal.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
LeetCode/103_zig_zag_level_order_traversal.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <unordered_map> #include <string> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { struct stackst{ TreeNode * node; int depth; stackst(TreeNode * n, int d): node(n), depth(d){} }; public: vector<vector<int>> zigzagLevelOrder(TreeNode* root) { vector<vector<int> > re; if(!root) return re; queue<stackst> st; stackst temp = stackst(NULL, -1); int curd= 0; vector<int> ve; bool l2r = true; st.push(stackst(root, 0)); while(!st.empty()){ temp = st.front(); st.pop(); // cout<<temp.node->val<<'\n'; if(temp.node->left) st.push(stackst(temp.node->left, temp.depth + 1)); if(temp.node->right) st.push(stackst(temp.node->right, temp.depth + 1)); if(temp.depth != curd){ if(l2r){ re.push_back(ve); l2r = false; } else{ reverse(ve.begin(), ve.end()); re.push_back(ve); l2r = true; } curd++; ve = {}; } ve.push_back(temp.node->val); // cout<<ve.size()<<"ASdf\n"; } if(l2r){ re.push_back(ve); l2r = false; } else{ reverse(ve.begin(), ve.end()); re.push_back(ve); l2r = true; } return re; } // WITHOUT STACKST vector<vector<int>> zigzagLevelOrder(TreeNode* root) { vector<vector<int>> res; queue<TreeNode*> q; auto level = 0; if (!root) return res; q.push(root); while (not q.empty()) { auto size = q.size(); vector<int> v; for (auto i = 0; i < size; i++) { TreeNode *t = q.front(); q.pop(); v.push_back(t->val); if (t->left) q.push(t->left); if (t->right) q.push(t->right); } if (level % 2 == 1) reverse(v.begin(), v.end()); res.push_back(v); level++; } return res; } };
25.076923
67
0.409893
tanishq1g
d1359829334d73316421b50e476485f93b7db421
12,315
cc
C++
cartographer/cloud/internal/map_builder_server.cc
sotnik-github/cartographer
73d18e5fc54bfa4e4e61fd7feb615b46834aa584
[ "Apache-2.0" ]
30
2017-08-12T21:44:47.000Z
2022-03-23T09:31:05.000Z
cartographer/cloud/internal/map_builder_server.cc
sotnik-github/cartographer
73d18e5fc54bfa4e4e61fd7feb615b46834aa584
[ "Apache-2.0" ]
17
2017-06-02T01:55:21.000Z
2022-03-02T01:52:58.000Z
cartographer/cloud/internal/map_builder_server.cc
sotnik-github/cartographer
73d18e5fc54bfa4e4e61fd7feb615b46834aa584
[ "Apache-2.0" ]
16
2018-04-12T18:35:59.000Z
2022-01-03T14:25:35.000Z
/* * Copyright 2017 The Cartographer Authors * * 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 "cartographer/cloud/internal/map_builder_server.h" #include "cartographer/cloud/internal/handlers/add_fixed_frame_pose_data_handler.h" #include "cartographer/cloud/internal/handlers/add_imu_data_handler.h" #include "cartographer/cloud/internal/handlers/add_landmark_data_handler.h" #include "cartographer/cloud/internal/handlers/add_odometry_data_handler.h" #include "cartographer/cloud/internal/handlers/add_rangefinder_data_handler.h" #include "cartographer/cloud/internal/handlers/add_sensor_data_batch_handler.h" #include "cartographer/cloud/internal/handlers/add_trajectory_handler.h" #include "cartographer/cloud/internal/handlers/finish_trajectory_handler.h" #include "cartographer/cloud/internal/handlers/get_all_submap_poses.h" #include "cartographer/cloud/internal/handlers/get_constraints_handler.h" #include "cartographer/cloud/internal/handlers/get_landmark_poses_handler.h" #include "cartographer/cloud/internal/handlers/get_local_to_global_transform_handler.h" #include "cartographer/cloud/internal/handlers/get_submap_handler.h" #include "cartographer/cloud/internal/handlers/get_trajectory_node_poses_handler.h" #include "cartographer/cloud/internal/handlers/is_trajectory_finished_handler.h" #include "cartographer/cloud/internal/handlers/is_trajectory_frozen_handler.h" #include "cartographer/cloud/internal/handlers/load_state_handler.h" #include "cartographer/cloud/internal/handlers/receive_global_slam_optimizations_handler.h" #include "cartographer/cloud/internal/handlers/receive_local_slam_results_handler.h" #include "cartographer/cloud/internal/handlers/run_final_optimization_handler.h" #include "cartographer/cloud/internal/handlers/set_landmark_pose_handler.h" #include "cartographer/cloud/internal/handlers/write_state_handler.h" #include "cartographer/cloud/internal/sensor/serialization.h" #include "glog/logging.h" namespace cartographer { namespace cloud { namespace { static auto* kIncomingDataQueueMetric = metrics::Gauge::Null(); const common::Duration kPopTimeout = common::FromMilliseconds(100); } // namespace MapBuilderServer::MapBuilderServer( const proto::MapBuilderServerOptions& map_builder_server_options, std::unique_ptr<mapping::MapBuilderInterface> map_builder) : map_builder_(std::move(map_builder)) { async_grpc::Server::Builder server_builder; server_builder.SetServerAddress(map_builder_server_options.server_address()); server_builder.SetNumGrpcThreads( map_builder_server_options.num_grpc_threads()); server_builder.SetNumEventThreads( map_builder_server_options.num_event_threads()); if (!map_builder_server_options.uplink_server_address().empty()) { local_trajectory_uploader_ = CreateLocalTrajectoryUploader( map_builder_server_options.uplink_server_address(), map_builder_server_options.upload_batch_size(), map_builder_server_options.enable_ssl_encryption()); } server_builder.RegisterHandler<handlers::AddTrajectoryHandler>(); server_builder.RegisterHandler<handlers::AddOdometryDataHandler>(); server_builder.RegisterHandler<handlers::AddImuDataHandler>(); server_builder.RegisterHandler<handlers::AddRangefinderDataHandler>(); server_builder.RegisterHandler<handlers::AddFixedFramePoseDataHandler>(); server_builder.RegisterHandler<handlers::AddLandmarkDataHandler>(); server_builder.RegisterHandler<handlers::AddSensorDataBatchHandler>(); server_builder.RegisterHandler<handlers::FinishTrajectoryHandler>(); server_builder .RegisterHandler<handlers::ReceiveGlobalSlamOptimizationsHandler>(); server_builder.RegisterHandler<handlers::ReceiveLocalSlamResultsHandler>(); server_builder.RegisterHandler<handlers::GetSubmapHandler>(); server_builder.RegisterHandler<handlers::GetTrajectoryNodePosesHandler>(); server_builder.RegisterHandler<handlers::GetLandmarkPosesHandler>(); server_builder.RegisterHandler<handlers::GetAllSubmapPosesHandler>(); server_builder.RegisterHandler<handlers::GetLocalToGlobalTransformHandler>(); server_builder.RegisterHandler<handlers::GetConstraintsHandler>(); server_builder.RegisterHandler<handlers::IsTrajectoryFinishedHandler>(); server_builder.RegisterHandler<handlers::IsTrajectoryFrozenHandler>(); server_builder.RegisterHandler<handlers::LoadStateHandler>(); server_builder.RegisterHandler<handlers::RunFinalOptimizationHandler>(); server_builder.RegisterHandler<handlers::WriteStateHandler>(); server_builder.RegisterHandler<handlers::SetLandmarkPoseHandler>(); grpc_server_ = server_builder.Build(); if (map_builder_server_options.map_builder_options() .use_trajectory_builder_2d()) { grpc_server_->SetExecutionContext( common::make_unique<MapBuilderContext<mapping::Submap2D>>(this)); } else if (map_builder_server_options.map_builder_options() .use_trajectory_builder_3d()) { grpc_server_->SetExecutionContext( common::make_unique<MapBuilderContext<mapping::Submap3D>>(this)); } else { LOG(FATAL) << "Set either use_trajectory_builder_2d or use_trajectory_builder_3d"; } map_builder_->pose_graph()->SetGlobalSlamOptimizationCallback( std::bind(&MapBuilderServer::OnGlobalSlamOptimizations, this, std::placeholders::_1, std::placeholders::_2)); } void MapBuilderServer::Start() { shutting_down_ = false; if (local_trajectory_uploader_) { local_trajectory_uploader_->Start(); } StartSlamThread(); grpc_server_->Start(); } void MapBuilderServer::WaitForShutdown() { grpc_server_->WaitForShutdown(); if (slam_thread_) { slam_thread_->join(); } if (local_trajectory_uploader_) { local_trajectory_uploader_->Shutdown(); } } void MapBuilderServer::Shutdown() { shutting_down_ = true; grpc_server_->Shutdown(); if (slam_thread_) { slam_thread_->join(); slam_thread_.reset(); } if (local_trajectory_uploader_) { local_trajectory_uploader_->Shutdown(); local_trajectory_uploader_.reset(); } } void MapBuilderServer::ProcessSensorDataQueue() { LOG(INFO) << "Starting SLAM thread."; while (!shutting_down_) { kIncomingDataQueueMetric->Set(incoming_data_queue_.Size()); std::unique_ptr<MapBuilderContextInterface::Data> sensor_data = incoming_data_queue_.PopWithTimeout(kPopTimeout); if (sensor_data) { grpc_server_->GetContext<MapBuilderContextInterface>() ->AddSensorDataToTrajectory(*sensor_data); } } } void MapBuilderServer::StartSlamThread() { CHECK(!slam_thread_); // Start the SLAM processing thread. slam_thread_ = common::make_unique<std::thread>( [this]() { this->ProcessSensorDataQueue(); }); } void MapBuilderServer::OnLocalSlamResult( int trajectory_id, common::Time time, transform::Rigid3d local_pose, sensor::RangeData range_data, std::unique_ptr<const mapping::TrajectoryBuilderInterface::InsertionResult> insertion_result) { auto shared_range_data = std::make_shared<sensor::RangeData>(std::move(range_data)); // If there is an uplink server and a submap insertion happened, enqueue this // local SLAM result for uploading. if (insertion_result && grpc_server_->GetUnsynchronizedContext<MapBuilderContextInterface>() ->local_trajectory_uploader()) { auto sensor_data = common::make_unique<proto::SensorData>(); auto sensor_id = grpc_server_->GetUnsynchronizedContext<MapBuilderContextInterface>() ->local_trajectory_uploader() ->GetLocalSlamResultSensorId(trajectory_id); CreateSensorDataForLocalSlamResult(sensor_id.id, trajectory_id, time, starting_submap_index_, *insertion_result, sensor_data.get()); // TODO(cschuet): Make this more robust. if (insertion_result->insertion_submaps.front()->finished()) { ++starting_submap_index_; } grpc_server_->GetUnsynchronizedContext<MapBuilderContextInterface>() ->local_trajectory_uploader() ->EnqueueSensorData(std::move(sensor_data)); } common::MutexLocker locker(&subscriptions_lock_); for (auto& entry : local_slam_subscriptions_[trajectory_id]) { auto copy_of_insertion_result = insertion_result ? common::make_unique< const mapping::TrajectoryBuilderInterface::InsertionResult>( *insertion_result) : nullptr; MapBuilderContextInterface::LocalSlamSubscriptionCallback callback = entry.second; if (!callback( common::make_unique<MapBuilderContextInterface::LocalSlamResult>( MapBuilderContextInterface::LocalSlamResult{ trajectory_id, time, local_pose, shared_range_data, std::move(copy_of_insertion_result)}))) { LOG(INFO) << "Removing subscription with index: " << entry.first; CHECK_EQ(local_slam_subscriptions_[trajectory_id].erase(entry.first), 1u); } } } void MapBuilderServer::OnGlobalSlamOptimizations( const std::map<int, mapping::SubmapId>& last_optimized_submap_ids, const std::map<int, mapping::NodeId>& last_optimized_node_ids) { common::MutexLocker locker(&subscriptions_lock_); for (auto& entry : global_slam_subscriptions_) { if (!entry.second(last_optimized_submap_ids, last_optimized_node_ids)) { LOG(INFO) << "Removing subscription with index: " << entry.first; CHECK_EQ(global_slam_subscriptions_.erase(entry.first), 1u); } } } MapBuilderContextInterface::LocalSlamSubscriptionId MapBuilderServer::SubscribeLocalSlamResults( int trajectory_id, MapBuilderContextInterface::LocalSlamSubscriptionCallback callback) { common::MutexLocker locker(&subscriptions_lock_); local_slam_subscriptions_[trajectory_id].emplace(current_subscription_index_, callback); return MapBuilderContextInterface::LocalSlamSubscriptionId{ trajectory_id, current_subscription_index_++}; } void MapBuilderServer::UnsubscribeLocalSlamResults( const MapBuilderContextInterface::LocalSlamSubscriptionId& subscription_id) { common::MutexLocker locker(&subscriptions_lock_); CHECK_EQ(local_slam_subscriptions_[subscription_id.trajectory_id].erase( subscription_id.subscription_index), 1u); } int MapBuilderServer::SubscribeGlobalSlamOptimizations( MapBuilderContextInterface::GlobalSlamOptimizationCallback callback) { common::MutexLocker locker(&subscriptions_lock_); global_slam_subscriptions_.emplace(current_subscription_index_, callback); return current_subscription_index_++; } void MapBuilderServer::UnsubscribeGlobalSlamOptimizations( int subscription_index) { common::MutexLocker locker(&subscriptions_lock_); CHECK_EQ(global_slam_subscriptions_.erase(subscription_index), 1u); } void MapBuilderServer::NotifyFinishTrajectory(int trajectory_id) { common::MutexLocker locker(&subscriptions_lock_); for (auto& entry : local_slam_subscriptions_[trajectory_id]) { MapBuilderContextInterface::LocalSlamSubscriptionCallback callback = entry.second; // 'nullptr' signals subscribers that the trajectory finished. callback(nullptr); } } void MapBuilderServer::WaitUntilIdle() { incoming_data_queue_.WaitUntilEmpty(); map_builder_->pose_graph()->RunFinalOptimization(); } void MapBuilderServer::RegisterMetrics(metrics::FamilyFactory* factory) { auto* queue_length = factory->NewGaugeFamily( "cloud_internal_map_builder_server_incoming_data_queue_length", "Incoming SLAM Data Queue length"); kIncomingDataQueueMetric = queue_length->Add({}); } } // namespace cloud } // namespace cartographer
43.515901
91
0.769306
sotnik-github
d136bcc92eef1f38d6d9e2da9fedf38a8857c027
15,235
cpp
C++
src/qos/monitoring_manager.cpp
poseidonos/poseidonos
1d4a72c823739ef3eaf86e65c57d166ef8f18919
[ "BSD-3-Clause" ]
38
2021-04-06T03:20:55.000Z
2022-03-02T09:33:28.000Z
src/qos/monitoring_manager.cpp
gye-ul/poseidonos
bce8fe2cd1f36ede8647446ecc4cf8a9749e6918
[ "BSD-3-Clause" ]
19
2021-04-08T02:27:44.000Z
2022-03-23T00:59:04.000Z
src/qos/monitoring_manager.cpp
gye-ul/poseidonos
bce8fe2cd1f36ede8647446ecc4cf8a9749e6918
[ "BSD-3-Clause" ]
28
2021-04-08T04:39:18.000Z
2022-03-24T05:56:00.000Z
/* * BSD LICENSE * Copyright (c) 2021 Samsung Electronics Corporation * 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. * * Neither the name of Samsung Electronics Corporation 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 "src/qos/monitoring_manager.h" #include "src/include/pos_event_id.hpp" #include "src/qos/qos_context.h" #include "src/qos/qos_manager.h" #include "src/spdk_wrapper/event_framework_api.h" #define VALID_ENTRY (1) #define INVALID_ENTRY (0) #define NVMF_CONNECT (0) #define NVMF_DISCONNECT (1) namespace pos { /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ QosMonitoringManager::QosMonitoringManager(QosContext* qosCtx, QosManager* qosManager, SpdkPosNvmfCaller* spdkPosNvmfCaller, AffinityManager* affinityManager) : qosContext(qosCtx), qosManager(qosManager), spdkPosNvmfCaller(spdkPosNvmfCaller), affinityManager(affinityManager) { nextManagerType = QosInternalManager_Unknown; for (uint32_t i = 0; i < MAX_ARRAY_COUNT; i++) { qosMonitoringManagerArray[i] = new QosMonitoringManagerArray(i, qosCtx, qosManager); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ QosMonitoringManager::~QosMonitoringManager(void) { for (uint32_t i = 0; i < MAX_ARRAY_COUNT; i++) { delete qosMonitoringManagerArray[i]; } if (spdkPosNvmfCaller != nullptr) { delete spdkPosNvmfCaller; } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::Execute(void) { if (qosManager->IsFeQosEnabled() == true) { _UpdateContextUserVolumePolicy(); if (true == _GatherActiveVolumeParameters()) { _ComputeTotalActiveConnection(); } _UpdateAllVolumeParameter(); } _UpdateContextUserRebuildPolicy(); _GatherActiveEventParameters(); _UpdateContextResourceDetails(); _SetNextManagerType(); } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_ComputeTotalActiveConnection(void) { uint32_t totalConntection = 0; std::map<uint32_t, uint32_t> activeVolumeMap = qosContext->GetActiveVolumes(); std::map<uint32_t, map<uint32_t, uint32_t>> volReactorMap = qosContext->GetActiveVolumeReactors(); for (map<uint32_t, uint32_t>::iterator it = activeVolumeMap.begin(); it != activeVolumeMap.end(); it++) { uint32_t volId = it->first; for (map<uint32_t, uint32_t>::iterator it = volReactorMap[volId].begin(); it != volReactorMap[volId].end(); ++it) { totalConntection += it->second; } qosContext->SetTotalConnection(volId, totalConntection); totalConntection = 0; } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateContextUserVolumePolicy(void) { uint32_t maxArrays = qosManager->GetNumberOfArrays(); for (uint32_t i = 0; i < maxArrays; i++) { qosMonitoringManagerArray[i]->UpdateContextUserVolumePolicy(); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateContextUserRebuildPolicy(void) { for (uint32_t i = 0; i < MAX_ARRAY_COUNT; i++) { qosMonitoringManagerArray[i]->UpdateContextUserRebuildPolicy(); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateContextResourceDetails(void) { uint32_t maxArrays = qosManager->GetNumberOfArrays(); for (uint32_t i = 0; i < maxArrays; i++) { qosMonitoringManagerArray[i]->UpdateContextResourceDetails(); } QosResource& resourceDetails = qosContext->GetQosResource(); ResourceCpu& resourceCpu = resourceDetails.GetResourceCpu(); for (uint32_t event = 0; event < BackendEvent_Count; event++) { uint32_t pendingEventCount = qosManager->GetPendingBackendEvents(static_cast<BackendEvent>(event)); resourceCpu.SetEventPendingCpuCount(static_cast<BackendEvent>(event), pendingEventCount); uint32_t generatedCpuEvents = qosManager->GetEventLog(static_cast<BackendEvent>(event)); resourceCpu.SetTotalGeneratedEvents(static_cast<BackendEvent>(event), generatedCpuEvents); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateContextActiveVolumeReactors(std::map<uint32_t, map<uint32_t, uint32_t>> map, std::map<uint32_t, std::vector<uint32_t>> &inactiveReactors) { qosContext->InsertActiveVolumeReactor(map); qosContext->InsertInactiveReactors(inactiveReactors); } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateAllVolumeParameter(void) { std::map<uint32_t, uint32_t> activeVolumeMap = qosContext->GetActiveVolumes(); for (map<uint32_t, uint32_t>::iterator it = activeVolumeMap.begin(); it != activeVolumeMap.end(); it++) { uint32_t volId = it->first; uint32_t arrVolId = volId % MAX_VOLUME_COUNT; uint32_t arrayId = volId / MAX_VOLUME_COUNT; qosMonitoringManagerArray[arrayId]->UpdateVolumeParameter(arrVolId); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ bool QosMonitoringManager::_GatherActiveVolumeParameters(void) { qosContext->ResetActiveVolume(); qosContext->ResetActiveReactorVolume(); qosContext->ResetAllReactorsProcessed(); QosCorrection& qosCorrection = qosContext->GetQosCorrection(); AllVolumeThrottle& allVolumeThrottle = qosCorrection.GetVolumeThrottlePolicy(); allVolumeThrottle.Reset(); QosParameters& qosParameters = qosContext->GetQosParameters(); AllVolumeParameter& allVolumeParameter = qosParameters.GetAllVolumeParameter(); allVolumeParameter.Reset(); QosParameters& qosParameter = qosContext->GetQosParameters(); qosParameter.Reset(); bool changeDetected = false; std::vector<uint32_t> reactorCoreList = qosContext->GetReactorCoreList(); std::unordered_map<int32_t, std::vector<int>> subsystemVolumeMap; std::map<uint32_t, vector<int>> volList[M_MAX_REACTORS]; while (!IsExitQosSet()) { if (true == qosContext->AllReactorsProcessed()) { break; } } const std::map<uint32_t, map<uint32_t, uint32_t>> lastVolReactorMap = volReactorMap; volReactorMap.clear(); reactorVolMap.clear(); inactiveReactors.clear(); bool reactorActive = false; for (auto& reactor : reactorCoreList) { reactorActive = false; volList[reactor].clear(); for (uint32_t arrayId = 0; arrayId < qosManager->GetNumberOfArrays(); arrayId++) { if (true == IsExitQosSet()) { break; } qosManager->GetSubsystemVolumeMap(subsystemVolumeMap, arrayId); for (auto& subsystemVolume : subsystemVolumeMap) { uint32_t subsystemId = subsystemVolume.first; if (spdkPosNvmfCaller->SpdkNvmfGetReactorSubsystemMapping(reactor, subsystemId) != INVALID_SUBSYSTEM) { volList[reactor][subsystemId] = qosManager->GetVolumeFromActiveSubsystem(subsystemId, arrayId); } std::vector<int> volumeList = volList[reactor][subsystemId]; for (auto& volumeId : volumeList) { bool validParam = false; reactorActive = false; while (true) { bool valid = qosMonitoringManagerArray[arrayId]->VolParamActivities(volumeId, reactor); if (valid == false) { break; } else { validParam = true; } } uint32_t globalVolId = arrayId * MAX_VOLUME_COUNT + volumeId; if (true == validParam) { reactorVolMap[reactor].insert({globalVolId, 1}); volReactorMap[globalVolId].insert({reactor, 1}); reactorActive = true; } if (reactorActive == false) { inactiveReactors[globalVolId].push_back(reactor); } } } } } if (lastVolReactorMap == volReactorMap) { changeDetected = false; } else { _UpdateContextActiveVolumeReactors(volReactorMap, inactiveReactors); changeDetected = true; } if (_CheckChangeInActiveVolumes() == true) { qosManager->ResetCorrection(); } return changeDetected; } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ bool QosMonitoringManager::_CheckChangeInActiveVolumes(void) { static int stabilityCycleCheck = 0; std::map<uint32_t, uint32_t> activeVolumeMap = qosContext->GetActiveVolumes(); bool ret = false; if (stabilityCycleCheck == 0) { if (prevActiveVolumeMap == activeVolumeMap) { ret = false; } else { stabilityCycleCheck++; ret = false; } } else { if (prevActiveVolumeMap == activeVolumeMap) { stabilityCycleCheck++; if (stabilityCycleCheck == 10) { stabilityCycleCheck = 0; ret = true; } else { ret = false; } } else { stabilityCycleCheck = 0; ret = false; } } prevActiveVolumeMap = activeVolumeMap; return ret; } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_UpdateEventParameter(BackendEvent event) { QosParameters& qosParam = qosContext->GetQosParameters(); AllEventParameter& allEventParam = qosParam.GetAllEventParameter(); bool eventFound = allEventParam.EventExists(event); if (true == eventFound) { EventParameter& eventParam = allEventParam.GetEventParameter(event); eventParam.IncreaseBandwidth(eventParams[event].currentBW); } else { EventParameter eventParam; eventParam.SetBandwidth(eventParams[event].currentBW); allEventParam.InsertEventParameter(event, eventParam); } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_GatherActiveEventParameters(void) { cpu_set_t cpuSet = affinityManager->GetCpuSet(CoreType::UDD_IO_WORKER); uint32_t cpuCount = CPU_COUNT(&cpuSet); for (uint32_t workerId = 0; workerId < cpuCount; workerId++) { for (uint32_t event = 0; (BackendEvent)event < BackendEvent_Count; event++) { do { eventParams[event].valid = M_INVALID_ENTRY; eventParams[event] = qosManager->DequeueEventParams(workerId, (BackendEvent)event); if (eventParams[event].valid == M_VALID_ENTRY) { _UpdateEventParameter(static_cast<BackendEvent>(event)); } } while ((eventParams[event].valid == M_VALID_ENTRY) && (!IsExitQosSet())); } } } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ void QosMonitoringManager::_SetNextManagerType(void) { nextManagerType = QosInternalManager_Processing; } /* --------------------------------------------------------------------------*/ /** * @Synopsis * * @Returns */ /* --------------------------------------------------------------------------*/ QosInternalManagerType QosMonitoringManager::GetNextManagerType(void) { return nextManagerType; } } // namespace pos
32.209302
166
0.536856
poseidonos
d13948567ec8186633fb1fed03ad17ae1bd1e8ef
5,708
cpp
C++
cpp/libs/src/opendnp3/app/IINField.cpp
spazzarama/opendnp3
44c06cb148d40ed150e539895b3fa951376e5f74
[ "Apache-2.0" ]
1
2020-05-07T16:31:30.000Z
2020-05-07T16:31:30.000Z
cpp/libs/src/opendnp3/app/IINField.cpp
spazzarama/opendnp3
44c06cb148d40ed150e539895b3fa951376e5f74
[ "Apache-2.0" ]
null
null
null
cpp/libs/src/opendnp3/app/IINField.cpp
spazzarama/opendnp3
44c06cb148d40ed150e539895b3fa951376e5f74
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2013-2019 Automatak, LLC * * Licensed to Green Energy Corp (www.greenenergycorp.com) and Automatak * LLC (www.automatak.com) under one or more contributor license agreements. * See the NOTICE file distributed with this work for additional information * regarding copyright ownership. Green Energy Corp and Automatak LLC license * 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. */ #include "opendnp3/app/IINField.h" #include <openpal/util/ToHex.h> using namespace openpal; using namespace std; namespace opendnp3 { bool IINField::IsSet(IINBit bit) const { switch (bit) { case (IINBit::ALL_STATIONS): return Get(LSBMask::ALL_STATIONS); case (IINBit::CLASS1_EVENTS): return Get(LSBMask::CLASS1_EVENTS); case (IINBit::CLASS2_EVENTS): return Get(LSBMask::CLASS2_EVENTS); case (IINBit::CLASS3_EVENTS): return Get(LSBMask::CLASS3_EVENTS); case (IINBit::NEED_TIME): return Get(LSBMask::NEED_TIME); case (IINBit::LOCAL_CONTROL): return Get(LSBMask::LOCAL_CONTROL); case (IINBit::DEVICE_TROUBLE): return Get(LSBMask::DEVICE_TROUBLE); case (IINBit::DEVICE_RESTART): return Get(LSBMask::DEVICE_RESTART); case (IINBit::FUNC_NOT_SUPPORTED): return Get(MSBMask::FUNC_NOT_SUPPORTED); case (IINBit::OBJECT_UNKNOWN): return Get(MSBMask::OBJECT_UNKNOWN); case (IINBit::PARAM_ERROR): return Get(MSBMask::PARAM_ERROR); case (IINBit::EVENT_BUFFER_OVERFLOW): return Get(MSBMask::EVENT_BUFFER_OVERFLOW); case (IINBit::ALREADY_EXECUTING): return Get(MSBMask::ALREADY_EXECUTING); case (IINBit::CONFIG_CORRUPT): return Get(MSBMask::CONFIG_CORRUPT); case (IINBit::RESERVED1): return Get(MSBMask::RESERVED1); case (IINBit::RESERVED2): return Get(MSBMask::RESERVED2); default: return false; }; } void IINField::SetBitToValue(IINBit bit, bool value) { if (value) { SetBit(bit); } else { ClearBit(bit); } } void IINField::SetBit(IINBit bit) { switch (bit) { case (IINBit::ALL_STATIONS): Set(LSBMask::ALL_STATIONS); break; case (IINBit::CLASS1_EVENTS): Set(LSBMask::CLASS1_EVENTS); break; case (IINBit::CLASS2_EVENTS): Set(LSBMask::CLASS2_EVENTS); break; case (IINBit::CLASS3_EVENTS): Set(LSBMask::CLASS3_EVENTS); break; case (IINBit::NEED_TIME): Set(LSBMask::NEED_TIME); break; case (IINBit::LOCAL_CONTROL): Set(LSBMask::LOCAL_CONTROL); break; case (IINBit::DEVICE_TROUBLE): Set(LSBMask::DEVICE_TROUBLE); break; case (IINBit::DEVICE_RESTART): Set(LSBMask::DEVICE_RESTART); break; case (IINBit::FUNC_NOT_SUPPORTED): Set(MSBMask::FUNC_NOT_SUPPORTED); break; case (IINBit::OBJECT_UNKNOWN): Set(MSBMask::OBJECT_UNKNOWN); break; case (IINBit::PARAM_ERROR): Set(MSBMask::PARAM_ERROR); break; case (IINBit::EVENT_BUFFER_OVERFLOW): Set(MSBMask::EVENT_BUFFER_OVERFLOW); break; case (IINBit::ALREADY_EXECUTING): Set(MSBMask::ALREADY_EXECUTING); break; case (IINBit::CONFIG_CORRUPT): Set(MSBMask::CONFIG_CORRUPT); break; case (IINBit::RESERVED1): Set(MSBMask::RESERVED1); break; case (IINBit::RESERVED2): Set(MSBMask::RESERVED2); break; default: break; }; } void IINField::ClearBit(IINBit bit) { switch (bit) { case (IINBit::ALL_STATIONS): Clear(LSBMask::ALL_STATIONS); break; case (IINBit::CLASS1_EVENTS): Clear(LSBMask::CLASS1_EVENTS); break; case (IINBit::CLASS2_EVENTS): Clear(LSBMask::CLASS2_EVENTS); break; case (IINBit::CLASS3_EVENTS): Clear(LSBMask::CLASS3_EVENTS); break; case (IINBit::NEED_TIME): Clear(LSBMask::NEED_TIME); break; case (IINBit::LOCAL_CONTROL): Clear(LSBMask::LOCAL_CONTROL); break; case (IINBit::DEVICE_TROUBLE): Clear(LSBMask::DEVICE_TROUBLE); break; case (IINBit::DEVICE_RESTART): Clear(LSBMask::DEVICE_RESTART); break; case (IINBit::FUNC_NOT_SUPPORTED): Clear(MSBMask::FUNC_NOT_SUPPORTED); break; case (IINBit::OBJECT_UNKNOWN): Clear(MSBMask::OBJECT_UNKNOWN); break; case (IINBit::PARAM_ERROR): Clear(MSBMask::PARAM_ERROR); break; case (IINBit::EVENT_BUFFER_OVERFLOW): Clear(MSBMask::EVENT_BUFFER_OVERFLOW); break; case (IINBit::ALREADY_EXECUTING): Clear(MSBMask::ALREADY_EXECUTING); break; case (IINBit::CONFIG_CORRUPT): Clear(MSBMask::CONFIG_CORRUPT); break; case (IINBit::RESERVED1): Clear(MSBMask::RESERVED1); break; case (IINBit::RESERVED2): Clear(MSBMask::RESERVED2); break; default: break; }; } bool IINField::operator==(const IINField& aRHS) const { return (LSB == aRHS.LSB) && (MSB == aRHS.MSB); } } // namespace opendnp3
28.118227
78
0.639103
spazzarama
d13bdf53ff8dd887f93782cf6bb21a3bd4777a0d
2,281
cpp
C++
media/libmediaplayerservice/DeathNotifier.cpp
Dreadwyrm/lhos_frameworks_av
62c63ccfdf5c79a3ad9be4836f473da9398c671b
[ "Apache-2.0" ]
null
null
null
media/libmediaplayerservice/DeathNotifier.cpp
Dreadwyrm/lhos_frameworks_av
62c63ccfdf5c79a3ad9be4836f473da9398c671b
[ "Apache-2.0" ]
null
null
null
media/libmediaplayerservice/DeathNotifier.cpp
Dreadwyrm/lhos_frameworks_av
62c63ccfdf5c79a3ad9be4836f473da9398c671b
[ "Apache-2.0" ]
2
2021-07-08T07:42:11.000Z
2021-07-09T21:56:10.000Z
/* * Copyright 2019 The Android Open Source Project * * 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 LOG_NDEBUG 0 #define LOG_TAG "MediaPlayerService-DeathNotifier" #include <android-base/logging.h> #include "DeathNotifier.h" namespace android { class DeathNotifier::DeathRecipient : public IBinder::DeathRecipient, public hardware::hidl_death_recipient { public: using Notify = DeathNotifier::Notify; DeathRecipient(Notify const& notify): mNotify{notify} { } virtual void binderDied(wp<IBinder> const&) override { mNotify(); } virtual void serviceDied(uint64_t, wp<HBase> const&) override { mNotify(); } private: Notify mNotify; }; DeathNotifier::DeathNotifier(sp<IBinder> const& service, Notify const& notify) : mService{std::in_place_index<1>, service}, mDeathRecipient{new DeathRecipient(notify)} { service->linkToDeath(mDeathRecipient); } DeathNotifier::DeathNotifier(sp<HBase> const& service, Notify const& notify) : mService{std::in_place_index<2>, service}, mDeathRecipient{new DeathRecipient(notify)} { service->linkToDeath(mDeathRecipient, 0); } DeathNotifier::DeathNotifier(DeathNotifier&& other) : mService{other.mService}, mDeathRecipient{other.mDeathRecipient} { other.mService.emplace<0>(); other.mDeathRecipient = nullptr; } DeathNotifier::~DeathNotifier() { switch (mService.index()) { case 0: break; case 1: std::get<1>(mService)->unlinkToDeath(mDeathRecipient); break; case 2: std::get<2>(mService)->unlinkToDeath(mDeathRecipient); break; default: CHECK(false) << "Corrupted service type during destruction."; } } } // namespace android
28.160494
78
0.698816
Dreadwyrm
d1450db63ed155abcf68d26d6c58e8d9d098fddc
124
cpp
C++
Source/FSD/Private/TerminatorAnimInstance.cpp
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
Source/FSD/Private/TerminatorAnimInstance.cpp
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
Source/FSD/Private/TerminatorAnimInstance.cpp
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
#include "TerminatorAnimInstance.h" UTerminatorAnimInstance::UTerminatorAnimInstance() { this->ForwardLean = 0.00f; }
17.714286
52
0.766129
trumank
d145ee7c85328ff055a3b40f3816d1740405559a
7,683
hpp
C++
lib/integral/Reference.hpp
aphenriques/integral
157b1e07905a88f7786d8823bde19a3546502912
[ "MIT" ]
40
2015-01-18T19:03:12.000Z
2022-03-06T19:16:16.000Z
lib/integral/Reference.hpp
aphenriques/integral
157b1e07905a88f7786d8823bde19a3546502912
[ "MIT" ]
7
2019-06-25T20:53:27.000Z
2021-01-16T14:14:52.000Z
lib/integral/Reference.hpp
aphenriques/integral
157b1e07905a88f7786d8823bde19a3546502912
[ "MIT" ]
7
2015-05-13T12:31:15.000Z
2019-07-23T20:22:50.000Z
// // Reference.hpp // integral // // MIT License // // Copyright (c) 2016, 2017, 2019, 2020, 2021 André Pereira Henriques (aphenriques (at) outlook (dot) com) // // 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. #ifndef integral_Reference_hpp #define integral_Reference_hpp #include "ReferenceBase.hpp" #include "ArgumentException.hpp" #include "Caller.hpp" namespace integral::detail { template<typename K, typename C> class Reference : public ReferenceBase<Reference<K, C>> { public: template<typename L, typename D> inline Reference(L &&key, D &&chainedReference); inline lua_State * getLuaState() const; inline void push() const; bool isNil() const; template<typename T, typename ...A> Reference<K, C> & emplace(A &&...arguments); template<typename V> inline Reference<K, C> & set(V &&value); template<typename V> inline Reference<K, C> & operator=(V &&value); template<typename F, typename ...E, std::size_t ...I> inline Reference<K, C> & setFunction(F &&function, DefaultArgument<E, I> &&...defaultArguments); template<typename F> inline Reference<K, C> & setLuaFunction(F &&function); template<typename V> decltype(auto) get() const; // the conversion operator does not return a reference to an object // storing a reference to a Lua object is unsafe because it might be collected // Reference::get returns a reference to an object but it is not meant to be stored template<typename V> inline operator V() const; // the arguments are pushed by value onto the lua stack template<typename R, typename ...A> decltype(auto) call(A &&...arguments); }; //-- template<typename K, typename C> template<typename L, typename D> inline Reference<K, C>::Reference(L &&key, D &&chainedReference) : ReferenceBase<Reference<K, C>>(std::forward<L>(key), std::forward<D>(chainedReference)) {} template<typename K, typename C> inline lua_State * Reference<K, C>::getLuaState() const { return ReferenceBase<Reference<K, C>>::getChainedReference().getLuaState(); } template<typename K, typename C> inline void Reference<K, C>::push() const { ReferenceBase<Reference<K, C>>::getChainedReference().push(); ReferenceBase<Reference<K, C>>::pushValueFromTable(getLuaState()); } template<typename K, typename C> bool Reference<K, C>::isNil() const { push(); // stack: ? if (lua_isnil(getLuaState(), -1) == 0) { // stack: ? lua_pop(getLuaState(), 1); return false; } else { // stack: nil lua_pop(getLuaState(), 1); return true; } } template<typename K, typename C> template<typename T, typename ...A> Reference<K, C> & Reference<K, C>::emplace(A &&...arguments) { ReferenceBase<Reference<K, C>>::getChainedReference().push(); // stack: ? if (lua_istable(getLuaState(), -1) != 0) { // stack: chainedReferenceTable exchanger::push<K>(getLuaState(), ReferenceBase<Reference<K, C>>::getKey()); // stack: chainedReferenceTable | key exchanger::push<T>(getLuaState(), std::forward<A>(arguments)...); // stack: chainedReferenceTable | key | value lua_rawset(getLuaState(), -3); // stack: chainedReferenceTable lua_pop(getLuaState(), 1); // stack: return *this; } else { // stack: ? lua_pop(getLuaState(), 1); throw ReferenceException(__FILE__, __LINE__, __func__, std::string("[integral] reference ") + ReferenceBase<Reference<K, C>>::getReferenceString() + " is not a table"); } } template<typename K, typename C> template<typename V> inline Reference<K, C> & Reference<K, C>::set(V &&value) { return emplace<std::decay_t<V>>(std::forward<V>(value)); } template<typename K, typename C> template<typename V> inline Reference<K, C> & Reference<K, C>::operator=(V &&value) { return set(std::forward<V>(value)); } template<typename K, typename C> template<typename F, typename ...E, std::size_t ...I> inline Reference<K, C> & Reference<K, C>::setFunction(F &&function, DefaultArgument<E, I> &&...defaultArguments) { return set(makeFunctionWrapper(std::forward<F>(function), std::move(defaultArguments)...)); } template<typename K, typename C> template<typename F> inline Reference<K, C> & Reference<K, C>::setLuaFunction(F &&function) { return set(LuaFunctionWrapper(std::forward<F>(function))); } template<typename K, typename C> template<typename V> decltype(auto) Reference<K, C>::get() const { push(); // stack: ? try { decltype(auto) returnValue = exchanger::get<V>(getLuaState(), -1); // stack: value lua_pop(getLuaState(), 1); // stack: return returnValue; } catch (const ArgumentException &argumentException) { // stack: ? lua_pop(getLuaState(), 1); // stack: throw ReferenceException(__FILE__, __LINE__, __func__, std::string("[integral] invalid type getting reference " ) + ReferenceBase<Reference<K, C>>::getReferenceString() + ": " + argumentException.what()); } } template<typename K, typename C> template<typename V> inline Reference<K, C>::operator V() const { return get<V>(); } template<typename K, typename C> template<typename R, typename ...A> decltype(auto) Reference<K, C>::call(A &&...arguments) { push(); // stack: ? try { // detail::Caller<R, A...>::call pops the first element of the stack return detail::Caller<R, A...>::call(getLuaState(), std::forward<A>(arguments)...); } catch (const ArgumentException &argumentException) { throw ReferenceException(__FILE__, __LINE__, __func__, std::string("[integral] invalid type calling function reference " ) + ReferenceBase<Reference<K, C>>::getReferenceString() + ": " + argumentException.what()); } catch (const CallerException &callerException) { throw ReferenceException(__FILE__, __LINE__, __func__, std::string("[integral] error calling function reference " ) + ReferenceBase<Reference<K, C>>::getReferenceString() + ": " + callerException.what()); } } } #endif
39
225
0.62814
aphenriques
d14653eac2adba68e611977c15d3f59715e95c84
3,139
hpp
C++
vcd.hpp
matteo-maria-tommasini/polar
276b45a081af1b0dd0853fcb5111f8da1514bd18
[ "Apache-2.0" ]
null
null
null
vcd.hpp
matteo-maria-tommasini/polar
276b45a081af1b0dd0853fcb5111f8da1514bd18
[ "Apache-2.0" ]
null
null
null
vcd.hpp
matteo-maria-tommasini/polar
276b45a081af1b0dd0853fcb5111f8da1514bd18
[ "Apache-2.0" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // // // polar v1.0 - August the 15th 2019 // // // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // // Copyright 2019 Matteo Tommasini // // // // 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. // // // /////////////////////////////////////////////////////////////////////////////// #ifndef VCD_H #define VCD_H #include "units.hpp" #include "gaussiandataset.hpp" #include "vibrasolver.hpp" /////////////////////////////////////////////////////////////////////////////////// // VCD is a legacy class meant to reproduce data provided in Gaussian09 output, // // namely dipole and rotatory strengths (in deprecated CGS units). // // The simulation of VCD spectra is taken care of by the vibpolarizability class // /////////////////////////////////////////////////////////////////////////////////// class VCD { private: Eigen::VectorXd intensities; std::vector<Eigen::Vector3d> dmu_dq, dm_dqdot; Eigen::VectorXd m10_robust; Eigen::VectorXd mu01_robust; public: VCD(); VCD(const VibraSolver&, const GaussianDataset&); // getters Eigen::VectorXd GetIntensities() const; Eigen::VectorXd Get_m10_Robust() const; Eigen::VectorXd Get_mu01_Robust() const; std::vector<Eigen::Vector3d> GetElectricDipoleDerivativesVsNormalCoordinates() const; std::vector<Eigen::Vector3d> GetMagneticDipoleDerivativesVsNormalCoordinates() const; // utility void ComputeElectricDipoleDerivativesVsNormalCoordinates(const VibraSolver&, const GaussianDataset&); void ComputeMagneticDipoleDerivativesVsNormalCoordinates(const VibraSolver&, const GaussianDataset&); }; #endif // VCD_H
48.292308
104
0.431029
matteo-maria-tommasini
d14744eb77fb83cdd6be425381731e385d7c1450
25,583
cpp
C++
include/HGJPathSmooth/pathSmoother.cpp
imbaguanxin/cppAstar
3dc53c1581064fe70e2cb4642d0b6f9fc24b0e10
[ "MIT" ]
1
2021-12-09T13:32:23.000Z
2021-12-09T13:32:23.000Z
include/HGJPathSmooth/pathSmoother.cpp
imbaguanxin/cppAstar
3dc53c1581064fe70e2cb4642d0b6f9fc24b0e10
[ "MIT" ]
null
null
null
include/HGJPathSmooth/pathSmoother.cpp
imbaguanxin/cppAstar
3dc53c1581064fe70e2cb4642d0b6f9fc24b0e10
[ "MIT" ]
null
null
null
// // Created by stumbo on 18-11-5. // #include <ilcplex/ilocplex.h> #include "pathSmoother.h" #include "tools.h" #include "TurnPoint.h" #include <iostream> #include <cmath> #include <map> #include <set> using namespace std; HGJ::pathPlanner::pathPlanner() = default; const HGJ::WayPoints & HGJ::pathPlanner::genCurv(WayPoints wayPoints, double ts, double maxErr, double beginSpdInput, double endSpdInput) { if (!wayPoints.empty()) { WayPoints modifiedWP; modifiedWP.reserve(wayPoints.size()); modifiedWP.push_back(wayPoints.front()); for (int i = 1; i < wayPoints.size() - 1; ++i) { if (wayPoints[i] == wayPoints[i - 1]) { continue; } if (isnan(TurnPoint{wayPoints[i-1], wayPoints[i], wayPoints[i+1]}.beta)) { continue; } modifiedWP.push_back(wayPoints[i]); } size_t i = wayPoints.size() - 1; if (wayPoints[i] != wayPoints[i - 1]) { modifiedWP.push_back(wayPoints[i]); } wayPoints.swap(modifiedWP); } /// load the setting pathPlanner::maxErr = maxErr; pathPlanner::ts = ts; pathPlanner::beginSpd = beginSpdInput; pathPlanner::endSpd = endSpdInput; /// cal the point count int64_t pointCount = wayPoints.size(); int64_t lineCount = pointCount - 1; int64_t cornerCount = pointCount - 2; /// clear the last calculation resDis = 0.0; answerCurve.clear(); /// only one(zero) point is inputed, return the point if (pointCount <= 1) { cerr << "you only add 1 point" << endl; answerCurve = wayPoints; return answerCurve; } /// only two points are added, smooth the line if (pointCount == 2) { cerr << "you only add 2 points" << endl; turnPoints.clear(); lineTypes.clear(); turnPoints.emplace_back(wayPoints[0], wayPoints[0], wayPoints[1]); /// the distance may be not long enough for the speed change double safeDis = calChangeSpdDistance(pathPlanner::beginSpd, pathPlanner::endSpd); double theDis = (wayPoints[1] - wayPoints[0]).len(); /// the distance is not long enough, the end speed need to be modified if (theDis < safeDis) { pathPlanner::endSpd = calBestSpdFromDistance( pathPlanner::beginSpd, theDis, (pathPlanner::endSpd >pathPlanner::beginSpd)); cerr << "the end spd is not possible, fall back to:" << pathPlanner::endSpd << endl; lineTypes.emplace_back(ONEACC, pathPlanner::endSpd); } else { lineTypes.push_back( calLineType(pathPlanner::beginSpd, pathPlanner::endSpd, theDis)); } assignLinePartPoints(0); return answerCurve; } /// cal the curveLength, not used for now curveLength = 0.0; for (uint64_t i = 1; i < pointCount; ++i) { curveLength += (wayPoints[i] - wayPoints[i-1]).len(); } /// init the containers lineTypes.clear(); lineTypes.reserve(static_cast<unsigned long>(lineCount)); lineTypes.assign(static_cast<unsigned long>(lineCount), make_pair(UNSET, 0)); turnPoints.clear(); turnPoints.reserve(static_cast<unsigned long>(cornerCount)); for (int64_t i = 0; i < cornerCount; i++) { /// in the constructor, parameters about the corner are all calculated turnPoints.emplace_back(wayPoints[i], wayPoints[i + 1], wayPoints[i + 2]); } /// the answers(d) will be stored in "turnPoints" lpSolveTheDs(turnPoints); /// firstly set the speed of every corner to max for (auto & corner : turnPoints) { corner.speed = corner.maxSpd; } /// check the speed of every corner continously until they are all ok. /** * the violations: the length between two turns can't satisfy the speed change between * two max speed. the results are stored in map(speed, turns) in order of speed */ map<double, vector<uint64_t>> violations; /// check the first and the end turn, to set a better max speed /// which solve the condition when the begin/end speed is too small for the first/end turn auto & firstTurn = turnPoints.front(); if (pathPlanner::beginSpd < firstTurn.speed) { auto safeSpd = calBestSpdFromDistance( pathPlanner::beginSpd, firstTurn.lenBefore - firstTurn.d); if (safeSpd < firstTurn.speed) { firstTurn.maxSpd = safeSpd; firstTurn.speed = safeSpd; } } auto & endTurn = turnPoints.back(); if (pathPlanner::endSpd < endTurn.speed) { auto safeSpd = calBestSpdFromDistance( pathPlanner::endSpd, endTurn.lenAfter - endTurn.d); if (safeSpd < endTurn.speed) { endTurn.maxSpd = safeSpd; endTurn.speed = safeSpd; } } /**check lenBefore of every turn * if lenBefore is not long enough for the speed change * record the slower spd and the index*/ for (uint64_t i = 1; i < turnPoints.size(); i++) { auto & thisTurn = turnPoints[i]; auto & lastTurn = turnPoints[i - 1]; auto minDis = calChangeSpdDistance(lastTurn.speed, thisTurn.speed); if (minDis > thisTurn.lenBefore - thisTurn.d - lastTurn.d) { if (thisTurn.speed < lastTurn.speed) { violations[thisTurn.speed].push_back(i); } else { violations[lastTurn.speed].push_back(i-1); } } } /// modify the speed continusly, from the slower to faster to ensure the plan is the best. /// in the progress, new violations might be added for (auto & vioVectorPair: violations) { /// the index which violated at speed of "vioVectorPair.first" auto & vioIndexVector = vioVectorPair.second; /// the size of the vioIndexVector may changed, C++11 for (:) CAN NOT be used for (uint64_t vector_i = 0; vector_i < vioIndexVector.size(); vector_i++) { auto indexOfTurns = vioIndexVector[vector_i]; auto & thisTurn = turnPoints[indexOfTurns]; /// this means that the turn has been modified, no need to do it again if (thisTurn.isSpdModifiedComplete()) { continue; } if (indexOfTurns != 0) { /// it's not the first turn, check the spd of perious turn auto & turnBefore = turnPoints[indexOfTurns - 1]; if (turnBefore.speed > thisTurn.speed) { auto safeSpd = calBestSpdFromDistance( thisTurn.speed, thisTurn.lenBefore - thisTurn.d - turnBefore.d); if (turnBefore.speed > safeSpd) { /// turnBefore.speed is too fast! turnBefore.speed = safeSpd; if (indexOfTurns > 1) { /// check if the BBfore Turn becomces violation auto & turnBBefore = turnPoints[indexOfTurns - 2]; if (turnBBefore.speed > turnBefore.speed) { auto safeDis = calChangeSpdDistance (turnBefore.speed, turnBBefore.speed); if (safeDis > turnBefore.lenBefore - (turnBBefore.d + turnBefore.d)) { violations[turnBefore.speed].push_back(indexOfTurns - 1); } } } } } } /// it's almost the same as last section if (indexOfTurns != cornerCount - 1) { auto & turnAfter = turnPoints[indexOfTurns + 1]; if (turnAfter.speed > thisTurn.speed) { auto safeSpd = calBestSpdFromDistance( thisTurn.speed, thisTurn.lenAfter - thisTurn.d - turnAfter.d); if (turnAfter.speed > safeSpd) { turnAfter.speed = safeSpd; if (indexOfTurns < cornerCount - 2) { auto & turnAAfter = turnPoints[indexOfTurns + 2]; if (turnAAfter.speed > turnAfter.speed) { auto safeDis = calChangeSpdDistance (turnAAfter.speed, turnAfter.speed); if (safeDis > turnAfter.lenAfter - (turnAAfter.d + turnAfter.d)) { violations[turnAfter.speed].push_back(indexOfTurns + 1); } } } } } } /// one turn may be modified twice thisTurn.completeSpdModify(); } } /// at here, the spd of every turn has been set to the fastest speed. /// if the beginSpd or the endSpd are too fast, they need to be slower down if (firstTurn.speed < pathPlanner::beginSpd) { auto safeDis = calChangeSpdDistance(firstTurn.speed, pathPlanner::beginSpd); auto theReadDis = firstTurn.lenBefore - firstTurn.d; if (safeDis > theReadDis) { auto safeSpd = calBestSpdFromDistance(firstTurn.speed, theReadDis); cerr << "[WARNING] the begin speed you set is not safe:" << pathPlanner::beginSpd << " ,the plan will use the max safe speed: " << safeSpd << endl; pathPlanner::beginSpd = safeSpd; } } if (endTurn.speed < pathPlanner::endSpd) { auto safeDis = calChangeSpdDistance(endTurn.speed, pathPlanner::endSpd); auto theReadDis = endTurn.lenAfter - endTurn.d; if (safeDis > theReadDis) { auto safeSpd = calBestSpdFromDistance(endTurn.speed, theReadDis); cerr << "[WARNING] the end speed you set is not safe:" << pathPlanner::endSpd << " ,the plan will use the max safe speed: " << safeSpd << endl; pathPlanner::endSpd = safeSpd; } } /** * cal the speed type of erery line progress */ lineTypes.front() = calLineType(pathPlanner::beginSpd, turnPoints.front().speed, turnPoints.front().lenBefore - turnPoints.front().d); for (uint64_t index_line = 1; index_line < lineTypes.size() - 1; ++index_line) { auto & beforeTurn = turnPoints[index_line - 1]; auto & afterTurn = turnPoints[index_line]; lineTypes[index_line] = calLineType(beforeTurn.speed, afterTurn.speed, beforeTurn.lenAfter - beforeTurn.d - afterTurn.d); } lineTypes.back() = calLineType(turnPoints.back().speed, pathPlanner::endSpd, turnPoints.back().lenAfter - turnPoints.back().d); /** * plan the speed according to the ts */ for (uint32_t i = 0; i < turnPoints.size(); ++i) { assignLinePartPoints(i); assignTurnPartPoints(turnPoints[i], true); assignTurnPartPoints(turnPoints[i], false); } assignLinePartPoints(lineTypes.size() - 1); return answerCurve; } void HGJ::pathPlanner::lpSolveTheDs(vector<TurnPoint> & turnPoints) { /** * start linear programing * using library IBM CPLEX */ int64_t cornerCount = turnPoints.size(); IloEnv env; IloModel model(env); /** * d[0] ~ d[cornerCount - 1] is d * d[cornerCount] is the max curvature */ IloNumVarArray d(env); /** * constrictions */ IloRangeArray constrictions(env); /** * the optimize target (-sum(d) - n*maxcurvature) minnest */ IloObjective optimizeTarget = IloMinimize(env); /// adding the d varibles for (int i = 0; i < cornerCount; i++) { double minLen = min(turnPoints[i].lenAfter, turnPoints[i].lenBefore); /// adding 0.45 for some speed change available in some situations d.add(IloNumVar(env, 0.0, minLen * 0.45)); } /// this is the max curvature d.add(IloNumVar(env, 0.0, +IloInfinity)); for (int i = 0; i < cornerCount; i++) { /// the curvature of every corner should be smaller than the max curvature constrictions.add(IloRange(env, -IloInfinity, 0.0)); double coeff_d2Kmax = turnPoints[i].coeff_d2Rmin; constrictions[i].setLinearCoef(d[i], -coeff_d2Kmax); constrictions[i].setLinearCoef(d[cornerCount], 1); /// the optimization target of Ds optimizeTarget.setLinearCoef(d[i], -coeff_d2Kmax); } /// the maxcurvature with coeff of n-1 optimizeTarget.setLinearCoef(d[cornerCount], - cornerCount + 1); double coeff_beta2d = c4 * maxErr; for (int i = 0; i < cornerCount; i++) { /// d should not be too big to bigger than the global max error constrictions.add(IloRange(env, -IloInfinity, coeff_beta2d / cos(turnPoints[i].beta))); constrictions[cornerCount + i].setLinearCoef(d[i], 1); } /// d0 + d1 <= len(p1p2), might be useless with 0.45 coeff for (int i = 0; i < cornerCount - 1; i++) { constrictions.add(IloRange(env, -IloInfinity , turnPoints[i].lenAfter)); constrictions[cornerCount * 2 + i].setLinearCoef(d[i], 1); constrictions[cornerCount * 2 + i].setLinearCoef(d[i + 1], 1); } /// d0 < len(p0p1) / 2 (leave the space for speed up constrictions.add(IloRange(env, -IloInfinity , turnPoints.front().lenBefore / 2.0)); constrictions[cornerCount * 3 - 1].setLinearCoef(d[0], 1); /// dn < len(pn pn+1) / 2 constrictions.add(IloRange(env, -IloInfinity , turnPoints.back().lenAfter / 2.0)); constrictions[cornerCount * 3].setLinearCoef(d[cornerCount - 1], 1); model.add(optimizeTarget); model.add(constrictions); IloCplex cplex(model); cplex.solve(); IloNumArray ds(env); cplex.getValues(ds, d); // env.out() << "Solution status = " << cplex.getStatus() << endl; // env.out() << "Solution value = " << cplex.getObjValue() << endl; env.out() << "Values = " << ds << endl; /// load the answers(d) for (int i = 0; i < ds.getSize() - 1; i++) { auto & tp = turnPoints[i]; tp.setD(static_cast<double>(ds[i]), spdMax, accMax); /// use precise len may speed up the progress. but not tested // tp.calPreciseHalfLen(); curveLength += 2 * (tp.halfLength - tp.d); } env.end(); } double HGJ::pathPlanner::calChangeSpdDuration(double dv) { dv = abs(dv); double t1 = 1.875 * dv / accMax; double t2 = 5.7735 * dv / jerkMax; t2 = sqrt(t2); return max(t1, t2); } double HGJ::pathPlanner::calChangeSpdDistance(double v0, double v1) { return (v0 + v1) / 2.0 * calChangeSpdDuration(v0 - v1); } /** * represent the maxJerk when speed change form v0 to v1 * f(v1) = v1^3 + v0v1^2 - v0^2v1 - v0^3 * @return f(v1) */ inline double calFunc(double v0, double v1) { return (v1 + v0) * (v1 - v0) * (v1 + v0); } /** * the gradient of the previous function * f(v1) = v1^3 + v0v1^2 - v0^2v1 - v0^3 * f'(v1) = 3v1^2 + 2v0v1 - v0^2 * @return f'(v1) */ inline double calSlope(double v0, double v1) { return (v1 + v0) * (3.0 * v1 - v0); } double HGJ::pathPlanner::calBestSpdFromDistance(double v0, double dist, bool faster) { if (!faster) { cout << "[calBestSpdFromDistance] slower example" << endl; } if (abs(dist) < 0.01) { return v0; } /// cal the vel from the accMax constract double tempSqrtDiff = 1.06666666666 * accMax * dist; double v1Acc; if (faster) { v1Acc = sqrt(v0 * v0 + tempSqrtDiff); } else { if (v0 * v0 - tempSqrtDiff > 0) { v1Acc = sqrt(v0 * v0 - tempSqrtDiff); } else{ v1Acc = 0; } } /// cal the vel from the jerkMax constract /// solve the qubic function using gradient descent /// targetY represent the speed related to the JerkMax double targetY = 0.69282 * dist * dist * jerkMax; if (!faster) { targetY = - targetY; /// the function cal the min jerk, there is a local min at v0/3 double minJerk = calFunc(v0, v0 / 3.0); /// if the min is small enough, the constraction is from the accMax, return the v1Acc if (minJerk < targetY) { return v1Acc; } } /// starting at v0, the gradient descent progress may be not fast double v1Jerk = v0; double currentY = 0; double threshold = targetY * 1e-5; while (abs(currentY - targetY) > threshold) { v1Jerk += (targetY - currentY) / calSlope(v0, v1Jerk); currentY = calFunc(v0, v1Jerk); } if (faster) { return min(v1Acc, v1Jerk); } else { return max(v1Acc, v1Jerk); } } pair<HGJ::pathPlanner::LinearSpdType, double> HGJ::pathPlanner::calLineType(double v0, double v1, double dist) { /// the min lenth means the speed change is only speed up or speed down from v0 to v1 double minDist = calChangeSpdDistance(v0, v1); if (dist <= minDist * 1.025) { return make_pair(ONEACC, max(v0, v1)); } /// the min dist needed if we want to speed up to spdMax double minDist2SpdMax = calLineSpdUpDownMinDistance(v0, v1, spdMax); double distDiff = minDist2SpdMax - dist; /** * if maxDist < dist, means we can speed up to the max speed in the line */ if (distDiff < 0) { return make_pair(TOMAXSPD, spdMax); } /// if not, using dichotomy to find the max speed we can reach double upperBound = spdMax; double lowerBound = max(v0, v1); double midSpd = (upperBound + lowerBound) / 2; double tollerance = dist / 1000.0; while (true) { distDiff = calLineSpdUpDownMinDistance(v0, v1, midSpd) - dist; /** * CaledDist > realDist ==> spd need to be slower */ if (distDiff > tollerance) { upperBound = midSpd; midSpd = (midSpd + lowerBound) / 2.0; } /** * CaledDist > realDist ==> spd can be higher */ else if(distDiff < 0) { lowerBound = midSpd; midSpd = (midSpd + upperBound) / 2.0; } else { break; } } return make_pair(SPDUPDOWN, midSpd); } double HGJ::pathPlanner::calLineSpdUpDownMinDistance(double v0, double v1, double vMid) { auto dist = calChangeSpdDistance(v0, vMid); dist += calChangeSpdDistance(vMid, v1); return dist; } double HGJ::pathPlanner::calChangeSpdPosition(double v0, double dv, double t, double sumT) { double tRatio = t / sumT; double ans = 2.5 - (3 - tRatio) * tRatio; ans = ans * tRatio * tRatio * tRatio * dv + v0; return ans * t; } void HGJ::pathPlanner::assignSpdChangePoints(double beginV, double endV, const vec3f & posBegin, const vec3f & posEnd) { auto unitVec = posEnd - posBegin; /// means there is noting to assign if (unitVec.len() == 0.0) { return; } unitVec /= unitVec.len(); double dv = endV - beginV; double sumT = calChangeSpdDuration(dv); /// at the begin of the whole progress, the progress t_init will be NAN double t = ts - resDis / beginV; if (beginV == 0.0) { t = 0.0; } double distProgress; /// build the points while (t < sumT) { distProgress = calChangeSpdPosition(beginV, dv, t, sumT); answerCurve.emplace_back(posBegin + unitVec * distProgress); t += ts; } if (!answerCurve.empty()) { resDis = (answerCurve.back() - posEnd).len(); } if (resDis < 0) { cerr << "[pathPlanner::calChangeSpdPosition] reDis:" << resDis <<" is smaller than 0!" << endl; } } void HGJ::pathPlanner::assignLinearConstantSpeedPoints(double spd, const vec3f & posBegin, const vec3f & posEnd) { auto unitVec = posEnd - posBegin; if (unitVec.len() == 0.0) { return; } double sumT = unitVec.len() / spd; unitVec /= unitVec.len(); double t = ts - resDis / spd; while (t < sumT) { answerCurve.emplace_back(t * spd * unitVec + posBegin); t += ts; } if (!answerCurve.empty()) { resDis = (answerCurve.back() - posEnd).len(); } if (resDis < 0) { cerr << "[pathPlanner::assignLinearConstantSpeedPoints] reDis:" << resDis <<" is smaller than ""0!" << endl; } } void HGJ::pathPlanner::assignTurnPartPoints(const TurnPoint & turnPoint, bool firstPart) { /// at the corner, the speed is constrant, so the point gap is constrant double ds = ts * turnPoint.speed; if (ds < resDis) { cerr << "[pathPlanner::assignTurnPartPoints] the first Inc is < 0 !\nfirst part:" << firstPart << endl; resDis = ds; } /// the dU between the gap is about ds/wholeLen double increaseU = ds / turnPoint.halfLength; double firstU = (ds - resDis) / turnPoint.halfLength; double lastU = 0.0; vec3f lastPoint; if (firstPart) { lastPoint = turnPoint.B1[0]; } else { lastPoint = turnPoint.B2[3]; } /// considering the res error, the first currentU, targetLen is different double currentU = firstU; vec3f currentPoint = turnPoint.calPoint(currentU, firstPart); double targetLen = ds - resDis; double lenNow = (currentPoint - lastPoint).len(); double error = targetLen - lenNow; double tolleranceError = ds / 20000.0; while (true) { while (abs(error) > tolleranceError) { /// we need to modify the current U /// de/du = -len(C0C1) / delta(U) double dedu = lenNow / (currentU - lastU); /// newU = lastU + error / (de/du) currentU = currentU + error / dedu; /// after climbing it is still over 1? the curve is finished if (currentU > 1.0) { if (firstPart) { resDis = (answerCurve.back() - turnPoint.B1[3]).len(); } else { resDis = (answerCurve.back() - turnPoint.B2[0]).len(); } return; } currentPoint = turnPoint.calPoint(currentU, firstPart); lenNow = (currentPoint - lastPoint).len(); error = targetLen - lenNow; } /// come to here, we reslove a U that is accurate to record lastPoint = currentPoint; answerCurve.emplace_back(currentPoint); targetLen = ds; lastU = currentU; currentU = lastU + increaseU; /// if U is bigger than 1.0, we set it to 1.0, /// if it can go smaller than 1, it is a good point if (currentU > 1.0) { currentU = 1.0; } currentPoint = turnPoint.calPoint(currentU, firstPart); lenNow = (currentPoint - lastPoint).len(); error = targetLen - lenNow; } } void HGJ::pathPlanner::assignLinePartPoints(uint64_t index) { vec3f beginPos, endPos; double beginSpd, endSpd; /// at the start point and the end point, the spd and pos are special if (index == 0) { beginPos = turnPoints.front().p0; beginSpd = pathPlanner::beginSpd; } else { beginPos = turnPoints[index - 1].B2[0]; beginSpd = turnPoints[index - 1].speed; } if (index == lineTypes.size() - 1) { endPos = turnPoints.back().p2; endSpd = pathPlanner::endSpd; } else { endPos = turnPoints[index].B1[0]; endSpd = turnPoints[index].speed; } auto lineType = lineTypes[index].first; auto lineMaxSpd = lineTypes[index].second; if (lineType == ONEACC) { assignSpdChangePoints(beginSpd, endSpd, beginPos, endPos); return; } else if (lineType == SPDUPDOWN || lineType == TOMAXSPD) { vec3f unitVec = (endPos - beginPos) / (endPos - beginPos).len(); auto firstMaxSpdDis = calChangeSpdDistance(beginSpd, lineMaxSpd); auto firstMaxSpdPos = (unitVec * firstMaxSpdDis) + beginPos; auto endSpdChangeDis = calChangeSpdDistance(lineMaxSpd, endSpd); auto endMaxSpdPos = endPos - unitVec * endSpdChangeDis; assignSpdChangePoints(beginSpd, lineMaxSpd, beginPos, firstMaxSpdPos); if (lineType == TOMAXSPD) { assignLinearConstantSpeedPoints(lineMaxSpd, firstMaxSpdPos, endMaxSpdPos); assignSpdChangePoints(lineMaxSpd, endSpd, endMaxSpdPos, endPos); } else { assignSpdChangePoints(lineMaxSpd, endSpd, firstMaxSpdPos, endPos); } return; } else if (lineType == UNSET) { cerr << "assign a line with UNSET type!" << endl; throw; } else { cerr << "assign a line with UNKNOW type!" << endl; throw; } } void HGJ::pathPlanner::setMaxJerk(double jerkMax) { if (jerkMax > 0) { pathPlanner::jerkMax = jerkMax; } } void HGJ::pathPlanner::setMaxAcc(double accMax) { if (accMax > 0) { pathPlanner::accMax = accMax; } } void HGJ::pathPlanner::setMaxSpeed(double spdMax) { if (spdMax > 0) { pathPlanner::spdMax = spdMax; } } void HGJ::pathPlanner::setMaxErr(double maxErr) { if (maxErr > 0) { pathPlanner::maxErr = maxErr; } } const HGJ::WayPoints & HGJ::pathPlanner::getLastGeneratedCurve() { return answerCurve; }
34.110667
96
0.580112
imbaguanxin
d14ba8938709afc49e46dc49efac3620599ec721
817
cpp
C++
DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/08_DPCPP_Reduction/src/sum_single_task.cpp
yafshar/oneAPI-samples
592a2036e86e7083a05c0d6a1613fb826adf9a60
[ "MIT" ]
null
null
null
DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/08_DPCPP_Reduction/src/sum_single_task.cpp
yafshar/oneAPI-samples
592a2036e86e7083a05c0d6a1613fb826adf9a60
[ "MIT" ]
null
null
null
DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/08_DPCPP_Reduction/src/sum_single_task.cpp
yafshar/oneAPI-samples
592a2036e86e7083a05c0d6a1613fb826adf9a60
[ "MIT" ]
null
null
null
//============================================================== // Copyright © Intel Corporation // // SPDX-License-Identifier: MIT // ============================================================= #include <CL/sycl.hpp> using namespace sycl; static constexpr size_t N = 1024; // global size int main() { //# setup queue with in_order property queue q; std::cout << "Device : " << q.get_device().get_info<info::device::name>() << "\n"; //# initialize data array using usm auto data = malloc_shared<int>(N, q); for (int i = 0; i < N; i++) data[i] = i; //# user single_task to add all numbers q.single_task([=](){ int sum = 0; for(int i=0;i<N;i++){ sum += data[i]; } data[0] = sum; }).wait(); std::cout << "Sum = " << data[0] << "\n"; free(data, q); return 0; }
23.342857
84
0.47858
yafshar
d14c345bdd8aac1022127a4a00023565aeb2def9
1,434
hpp
C++
src/game/intro_screen.hpp
lowkey42/BanishedBlaze
71e66f444a84bea1eca3639de3f3ff1f79e385d1
[ "MIT" ]
null
null
null
src/game/intro_screen.hpp
lowkey42/BanishedBlaze
71e66f444a84bea1eca3639de3f3ff1f79e385d1
[ "MIT" ]
null
null
null
src/game/intro_screen.hpp
lowkey42/BanishedBlaze
71e66f444a84bea1eca3639de3f3ff1f79e385d1
[ "MIT" ]
null
null
null
/** The intro screen that is shown when launching the game ******************* * * * Copyright (c) 2014 Florian Oetke * * This file is distributed under the MIT License * * See LICENSE file for details. * \*****************************************************************************/ #pragma once #include "../core/engine.hpp" #include <core/renderer/camera.hpp> #include "../core/renderer/texture.hpp" #include "../core/renderer/shader.hpp" #include "../core/renderer/vertex_object.hpp" #include "../core/renderer/primitives.hpp" #include "../core/renderer/text.hpp" #include <core/renderer/command_queue.hpp> namespace lux { class Intro_screen : public Screen { public: Intro_screen(Engine& game_engine); ~Intro_screen()noexcept = default; protected: void _update(Time delta_time)override; void _draw()override; void _on_enter(util::maybe<Screen&> prev) override; void _on_leave(util::maybe<Screen&> next) override; auto _prev_screen_policy()const noexcept -> Prev_screen_policy override { return Prev_screen_policy::discard; } private: util::Mailbox_collection _mailbox; renderer::Camera_2d _camera; renderer::Text_dynamic _debug_Text; renderer::Command_queue _render_queue; }; }
29.875
79
0.584379
lowkey42
d14c9fd13fc189e0c23007aa42ce17fe3ed35ca6
24,731
cpp
C++
arch/common/dbt/mc/x86/reverse-allocator.cpp
tspink/captive
9db853df410e06ddb6384dc5e319b92f90483065
[ "MIT" ]
24
2017-01-02T18:46:34.000Z
2022-01-10T09:37:58.000Z
arch/common/dbt/mc/x86/reverse-allocator.cpp
tspink/captive
9db853df410e06ddb6384dc5e319b92f90483065
[ "MIT" ]
4
2019-09-19T17:48:03.000Z
2020-09-17T11:01:29.000Z
arch/common/dbt/mc/x86/reverse-allocator.cpp
tspink/captive
9db853df410e06ddb6384dc5e319b92f90483065
[ "MIT" ]
8
2017-04-28T04:53:42.000Z
2022-01-10T10:11:29.000Z
/* SPDX-License-Identifier: MIT */ #include <dbt/mc/x86/reverse-allocator.h> #include <dbt/mc/x86/formatter.h> #include <dbt/util/list.h> //#define PDEBUG #define VERIFY #define SUPPORT_VOLATILE #define CLEVER_ALLOCATION_STRATEGY using namespace captive::arch::dbt::mc::x86; using namespace captive::arch::dbt::util; #define MAX_PHYS_REGISTERS 24 template<typename UnderlyingType = dbt_u64, int NrBits = sizeof(UnderlyingType) * 8 > struct BitSet { static_assert(NrBits <= sizeof(UnderlyingType) * 8, "NrBits does not fit within underlying data type"); typedef BitSet<UnderlyingType, NrBits> Self; typedef int IndexType; BitSet() : state(0) { } BitSet(const BitSet& _o) : state(_o.state) { } inline operator UnderlyingType() const { return state; } inline void wipe() { state = 0; } inline void set(IndexType i) { state |= ((UnderlyingType) 1u << i); } inline void clear(IndexType i) { state &= ~((UnderlyingType) 1u << i); } inline bool is_set(IndexType i) const { return !!(state & ((UnderlyingType) 1u << i)); } inline bool is_clear(IndexType i) const { return !(state & ((UnderlyingType) 1u << i)); } inline IndexType find_first_set() const { if (state == 0) return -1; return __builtin_ffsll(state) - 1; } inline IndexType find_first_clear() const { if (~state == 0) return -1; return __builtin_ffsll(~state) - 1; } inline IndexType find_first_set_via_mask(UnderlyingType mask) const { if (state & mask == 0) return -1; return __builtin_ffsll(state & mask) - 1; } inline IndexType find_first_clear_via_mask(UnderlyingType mask) const { if (((~state) & mask) == 0) return -1; return __builtin_ffsll((~state) & mask) - 1; } friend Self operator|(const Self& lhs, const Self& rhs) { Self r; r.state = lhs.state | rhs.state; return r; } void operator|=(const Self& other) { state |= other.state; } private: UnderlyingType state; }; struct VirtualRegister { Instruction *first_def, *last_use; dbt_u64 physical_register_index; BitSet<> interference; int last_control_flow_count; }; bool ReverseAllocator::allocate(Instruction* head) { const X86PhysicalRegister& invalid_reg = X86PhysicalRegisters::RIZ; if (!number_and_legalise_instructions(head)) return false; // Allocate the dense vreg map. dbt_u64 nr_vregs = _vreg_allocator.next_index(); if (nr_vregs > 20000) { _support.debug_printf("there are too many vregs: %lu\n", nr_vregs); _support.assertion_fail("too many vregs"); return false; } VirtualRegister *vregs = (VirtualRegister *) _support.alloc(sizeof(VirtualRegister) * nr_vregs, AllocClass::DATA); if (!vregs) return false; // Initialise the vreg map. for (unsigned int i = 0; i < nr_vregs; i++) { vregs[i].first_def = nullptr; vregs[i].last_use = nullptr; vregs[i].physical_register_index = invalid_reg.unique_index(); vregs[i].last_control_flow_count = 0; } // Calculate VREG live ranges if (!calculate_vreg_live_ranges(vregs, head)) { _support.free(vregs, AllocClass::DATA); return false; } // Make fake uses for volatile memory accesses #ifdef SUPPORT_VOLATILE for (unsigned int i = 0; i < nr_vregs; i++) { if (vregs[i].first_def != nullptr && vregs[i].last_use == nullptr) { #ifdef PDEBUG _support.debug_printf("dead live range for vreg %lu\n", i); #endif Instruction *insn = vregs[i].first_def; if (insn->is_volatile()) { #ifdef PDEBUG _support.debug_printf("volatile instruction, so creating fake use for vreg %lu\n", i); Formatter __fmt; _support.debug_printf("[%u] %s\n", insn->nr, __fmt.format_instruction(insn)); #endif if (insn->kind() != InstructionKind::MOV) { _support.assertion_fail("fake use: not a mov"); } auto vreg_operand = insn->get_operand(1); if (!vreg_operand.is_reg() || !vreg_operand.reg.reg.is_virtual()) { _support.assertion_fail("fake use: not a vreg operand"); } insn->set_operand(1, Operand::make_register(X86PhysicalRegisters::R14, vreg_operand.reg.width)); } } } #endif // Perform allocation if (!do_allocate(vregs, head)) { _support.free(vregs, AllocClass::DATA); return false; } if (!commit(head, vregs)) { _support.free(vregs, AllocClass::DATA); return false; } #ifdef VERIFY if (!verify(head)) { _support.free(vregs, AllocClass::DATA); return false; } #endif if (!fixup_calls(head)) { _support.free(vregs, AllocClass::DATA); } _support.free(vregs, AllocClass::DATA); return true; } bool ReverseAllocator::calculate_vreg_live_ranges(VirtualRegister *vregs, Instruction *head) { #ifdef PDEBUG VirtualRegister *last_vreg = nullptr; #endif int cur_control_flow_count = 0; Instruction *current = head; do { if (current->is_control_flow()) { cur_control_flow_count++; } Instruction::UseDefList usedeflist; current->get_usedefs(usedeflist); for (unsigned int use_def_index = 0; use_def_index < usedeflist.next; use_def_index++) { const auto& usedef = usedeflist.get(use_def_index); if (!usedef.is_valid()) continue; // Skip invalid usedefs if (!usedef.is_def()) continue; // Skip non-def usedefs if (!usedef.reg.is_virtual()) continue; // Skip non-virtual registers VirtualRegister *vreg = &vregs[usedef.reg.unique_index()]; #ifdef PDEBUG if (vreg > last_vreg) { last_vreg = vreg; } #endif if (vreg->first_def == nullptr) { #ifdef PDEBUG _support.debug_printf("new definition of vreg %u\n", usedef.reg.unique_index()); #endif vreg->first_def = current; vreg->last_control_flow_count = cur_control_flow_count; } else if (vreg->last_use == nullptr && !usedef.is_usedef()) { #ifdef PDEBUG _support.debug_printf("definition of vreg %u, without use (and not a usedef) lcfc=%u, ccfc=%u\n", usedef.reg.unique_index(), vreg->last_control_flow_count, cur_control_flow_count); #endif #if 1 // Was there any intermediate controlflow/uses? if (vreg->last_control_flow_count == cur_control_flow_count) { #ifdef PDEBUG _support.debug_printf(" no control flow! killing %u\n", vregs[usedef.reg.unique_index()].first_def->nr); #endif vreg->first_def->change_kind(InstructionKind::DEAD); vreg->first_def = current; } #endif } } for (unsigned int use_def_index = 0; use_def_index < usedeflist.next; use_def_index++) { const auto& usedef = usedeflist.get(use_def_index); if (!usedef.is_valid()) continue; // Skip invalid usedefs if (!usedef.is_use()) continue; // Skip non-use usedefs if (!usedef.reg.is_virtual()) continue; // Skip non-virtual registers VirtualRegister *vreg = &vregs[usedef.reg.unique_index()]; #ifdef PDEBUG if (vreg > last_vreg) { last_vreg = vreg; } #endif vreg->last_use = current; } current = current->next(); } while (current != head); #ifdef PDEBUG if (last_vreg != nullptr) { for (VirtualRegister *vreg = vregs; vreg != last_vreg + 1; vreg++) { if (vreg->first_def == nullptr && vreg->last_use == nullptr) continue; dbt_u64 fd = -1, lu = -1; if (vreg->first_def != nullptr) { fd = vreg->first_def->nr; } if (vreg->last_use != nullptr) { lu = vreg->last_use->nr; } _support.debug_printf("vreg %lu: start:%lu, end:%lu\n", (vreg - vregs), fd, lu); } } #endif return true; } #define GPR_MASK 0x0000FFFF #define SSE_MASK 0xFFFF0000 bool ReverseAllocator::do_allocate(VirtualRegister* vregs, Instruction* head) { dbt_u64 phys_reg_tracking[MAX_PHYS_REGISTERS]; BitSet<> live_phys_regs; // HACK live_phys_regs.set(X86PhysicalRegisters::R15.unique_index()); live_phys_regs.set(X86PhysicalRegisters::BP.unique_index()); live_phys_regs.set(X86PhysicalRegisters::SP.unique_index()); phys_reg_tracking[X86PhysicalRegisters::R15.unique_index()] = X86PhysicalRegisters::R15.unique_index(); phys_reg_tracking[X86PhysicalRegisters::BP.unique_index()] = X86PhysicalRegisters::BP.unique_index(); phys_reg_tracking[X86PhysicalRegisters::SP.unique_index()] = X86PhysicalRegisters::SP.unique_index(); Instruction *last = head->prev(); Instruction *current = last; do { #ifdef PDEBUG { Formatter __debug_formatter; _support.debug_printf("@ %lu = %s\n", current->nr, __debug_formatter.format_instruction(current)); } #endif Instruction::UseDefList usedeflist; current->get_usedefs(usedeflist); bool skip = false; for (unsigned int use_def_index = 0; use_def_index < usedeflist.next; use_def_index++) { const auto& usedef = usedeflist.get(use_def_index); if (!usedef.is_valid()) continue; // Skip invalid usedefs if (!usedef.is_def()) continue; // Skip non-def usedefs dbt_u64 register_index = usedef.reg.unique_index(); if (usedef.reg.is_virtual()) { // Definition of VREG VirtualRegister *vreg = &vregs[register_index]; if (vreg->first_def == current) { if (vreg->last_use == nullptr) { #ifdef PDEBUG _support.debug_printf("def of unused vreg %u\n", register_index); #endif skip = true; break; } else { // If this is the first def, then release the allocated vreg live_phys_regs.clear(vreg->physical_register_index); #ifdef PDEBUG _support.debug_printf("ending live-range of vreg %u in preg %u\n", register_index, vreg->physical_register_index); #endif } } } else { if (register_index > MAX_PHYS_REGISTERS) { _support.assertion_fail("definition of invalid preg"); return false; } // Definition of PREG if (live_phys_regs.is_set(register_index)) { live_phys_regs.clear(register_index); if (phys_reg_tracking[register_index] > MAX_PHYS_REGISTERS) { dbt_u64 conflicting_vreg_index = phys_reg_tracking[register_index]; VirtualRegister *conflicting_vreg = &vregs[conflicting_vreg_index]; #ifdef PDEBUG _support.debug_printf("def of preg %u, but it's tracking vreg %u!\n", register_index, conflicting_vreg_index); #endif // Find a new preg for the vreg dbt_u64 mask = usedef.reg.is_sse() ? SSE_MASK : GPR_MASK; dbt_u64 new_preg = conflicting_vreg->interference.find_first_clear_via_mask(mask); if (new_preg == (dbt_u64) - 1) { #ifdef PDEBUG _support.debug_printf("vreg %u interference=%08x\n", conflicting_vreg_index, (dbt_u64) conflicting_vreg->interference); #endif _support.assertion_fail("out of registers in re-assignment"); } #ifdef PDEBUG _support.debug_printf("re-assigning vreg %u to preg %u (%08x)\n", conflicting_vreg_index, new_preg, (dbt_u64) conflicting_vreg->interference); #endif conflicting_vreg->physical_register_index = new_preg; phys_reg_tracking[conflicting_vreg->physical_register_index] = conflicting_vreg_index; live_phys_regs.set(conflicting_vreg->physical_register_index); vregs[conflicting_vreg_index].interference = live_phys_regs; // Update ALL vreg interferences for (int i = 0; i < MAX_PHYS_REGISTERS; i++) { if (live_phys_regs.is_set(i)) { #ifdef PDEBUG _support.debug_printf(" updating preg=%u, vreg=%u, prev=%08x, cur=%08x\n", i, phys_reg_tracking[i], (dbt_u64) vregs[phys_reg_tracking[i]].interference, (dbt_u64) live_phys_regs); #endif vregs[phys_reg_tracking[i]].interference |= live_phys_regs; } } } #ifdef PDEBUG _support.debug_printf("ending live-range of preg %u, tracking %u\n", register_index, phys_reg_tracking[register_index]); #endif } } } if (!skip) { for (unsigned int use_def_index = 0; use_def_index < usedeflist.next; use_def_index++) { const auto& usedef = usedeflist.get(use_def_index); if (!usedef.is_valid()) continue; // Skip invalid usedefs if (!usedef.is_use()) continue; // Skip non-use usedefs dbt_u64 register_index = usedef.reg.unique_index(); if (usedef.reg.is_virtual()) { // Use of VREG VirtualRegister *vreg = &vregs[register_index]; if (vreg->last_use == current || vreg->physical_register_index == 32) { // If this is the last use, then allocate a register to start tracking this vreg #ifdef PDEBUG dbt_u64 xxx = (dbt_u64) live_phys_regs; #endif // Now, hold the phone. We need to find a register of the correct class. dbt_u64 mask = usedef.reg.is_sse() ? SSE_MASK : GPR_MASK; #ifdef CLEVER_ALLOCATION_STRATEGY // Try to be smart about this if (current->kind() == InstructionKind::MOV || current->kind() == InstructionKind::MOVZX) { auto& srcop = current->get_operand(0); auto& dstop = current->get_operand(1); if (srcop.is_reg() && srcop.reg.reg.is_virtual() && dstop.is_reg() && !dstop.reg.reg.is_special()) { if (dstop.reg.reg.is_virtual()) { #ifdef PDEBUG _support.debug_printf(" selecting register for mov vreg->vreg instruction\n"); #endif vreg->physical_register_index = live_phys_regs.find_first_clear_via_mask(mask); } else { #ifdef PDEBUG _support.debug_printf(" selecting register for mov vreg->preg instruction - want preg=%u\n", dstop.reg.reg.unique_index()); #endif if (live_phys_regs.is_clear(dstop.reg.reg.unique_index())) { #ifdef PDEBUG _support.debug_printf(" available!\n", dstop.reg.reg.unique_index()); #endif vreg->physical_register_index = dstop.reg.reg.unique_index(); } else { #ifdef PDEBUG _support.debug_printf(" not available!\n", dstop.reg.reg.unique_index()); #endif vreg->physical_register_index = live_phys_regs.find_first_clear_via_mask(mask); } } } else { vreg->physical_register_index = live_phys_regs.find_first_clear_via_mask(mask); } } else { #endif vreg->physical_register_index = live_phys_regs.find_first_clear_via_mask(mask); #ifdef CLEVER_ALLOCATION_STRATEGY } #endif if (vreg->physical_register_index < 0) { _support.assertion_fail("out of registers in allocation"); } phys_reg_tracking[vreg->physical_register_index] = register_index; live_phys_regs.set(vreg->physical_register_index); vregs[register_index].interference = live_phys_regs; // TODO: Update ALL vreg interferences for (int i = 0; i < MAX_PHYS_REGISTERS; i++) { if (live_phys_regs.is_set(i)) { #ifdef PDEBUG _support.debug_printf(" updating preg=%u, vreg=%u, prev=%08x, cur=%08x\n", i, phys_reg_tracking[i], (dbt_u64) vregs[phys_reg_tracking[i]].interference, (dbt_u64) live_phys_regs); #endif vregs[phys_reg_tracking[i]].interference |= live_phys_regs; } } #ifdef PDEBUG _support.debug_printf("starting live-range of vreg %u, allocated to preg %u (%08x, %08x)\n", register_index, vreg->physical_register_index, xxx, (dbt_u64) live_phys_regs); #endif } } else { if (register_index > 32) { _support.assertion_fail("use of invalid preg"); return false; } // Use of PREG if (live_phys_regs.is_set(register_index) && phys_reg_tracking[register_index] != register_index) { dbt_u64 conflicting_vreg_index = phys_reg_tracking[register_index]; VirtualRegister *conflicting_vreg = &vregs[conflicting_vreg_index]; #ifdef PDEBUG _support.debug_printf("conflicting use of preg %u, currently tracking %u\n", register_index, conflicting_vreg_index); #endif // Find a new preg for the vreg dbt_u64 mask = usedef.reg.is_sse() ? SSE_MASK : GPR_MASK; dbt_u64 new_preg = conflicting_vreg->interference.find_first_clear_via_mask(mask); if (new_preg == (dbt_u64) - 1) { #ifdef PDEBUG _support.debug_printf("vreg %u interference=%08x\n", conflicting_vreg_index, (dbt_u64) conflicting_vreg->interference); #endif _support.assertion_fail("out of registers in re-assignment"); } #ifdef PDEBUG _support.debug_printf("re-assigning vreg %u to preg %u (%08x)\n", conflicting_vreg_index, new_preg, (dbt_u64) conflicting_vreg->interference); #endif conflicting_vreg->physical_register_index = new_preg; phys_reg_tracking[conflicting_vreg->physical_register_index] = conflicting_vreg_index; live_phys_regs.set(conflicting_vreg->physical_register_index); vregs[conflicting_vreg_index].interference = live_phys_regs; // Update ALL vreg interferences for (int i = 0; i < MAX_PHYS_REGISTERS; i++) { if (live_phys_regs.is_set(i)) { #ifdef PDEBUG _support.debug_printf(" updating preg=%u, vreg=%u, prev=%08x, cur=%08x\n", i, phys_reg_tracking[i], (dbt_u64) vregs[phys_reg_tracking[i]].interference, (dbt_u64) live_phys_regs); #endif vregs[phys_reg_tracking[i]].interference |= live_phys_regs; } } phys_reg_tracking[register_index] = register_index; } else { phys_reg_tracking[register_index] = register_index; live_phys_regs.set(register_index); vregs[register_index].interference = live_phys_regs; // Update ALL vreg interferences for (int i = 0; i < MAX_PHYS_REGISTERS; i++) { if (live_phys_regs.is_set(i)) { #ifdef PDEBUG _support.debug_printf(" updating preg=%u, vreg=%u, prev=%08x, cur=%08x\n", i, phys_reg_tracking[i], (dbt_u64) vregs[phys_reg_tracking[i]].interference, (dbt_u64) live_phys_regs); #endif vregs[phys_reg_tracking[i]].interference |= live_phys_regs; } } #ifdef PDEBUG _support.debug_printf("starting live-range of preg %u (%08x)\n", register_index, (dbt_u64) live_phys_regs); #endif } } } } current = current->prev(); } while (current != last); return true; } bool ReverseAllocator::commit(Instruction* head, const VirtualRegister* vreg_to_preg) { static const X86PhysicalRegister * assignments[] = { &X86PhysicalRegisters::A, &X86PhysicalRegisters::C, &X86PhysicalRegisters::D, &X86PhysicalRegisters::B, &X86PhysicalRegisters::RIZ, &X86PhysicalRegisters::RIZ, &X86PhysicalRegisters::SI, &X86PhysicalRegisters::DI, &X86PhysicalRegisters::R8, &X86PhysicalRegisters::R9, &X86PhysicalRegisters::R10, &X86PhysicalRegisters::R11, &X86PhysicalRegisters::R12, &X86PhysicalRegisters::R13, &X86PhysicalRegisters::R14, &X86PhysicalRegisters::R15, &X86PhysicalRegisters::XMM0, &X86PhysicalRegisters::XMM1, &X86PhysicalRegisters::XMM2, &X86PhysicalRegisters::XMM3, &X86PhysicalRegisters::XMM4, &X86PhysicalRegisters::XMM5, &X86PhysicalRegisters::XMM6, &X86PhysicalRegisters::XMM7, }; Instruction *current = head; do { if (current->kind() != InstructionKind::DEAD) { for (unsigned int i = 0; i < Instruction::NR_OPERANDS; i++) { const auto& operand = current->get_operand(i); if (operand.is_reg()) { if (operand.reg.reg.is_virtual()) { dbt_u64 preg_index = vreg_to_preg[operand.reg.reg.unique_index()].physical_register_index; if (preg_index == X86PhysicalRegisters::RIZ.unique_index()) { current->change_kind(InstructionKind::DEAD); break; } if (preg_index >= (sizeof(assignments) / sizeof(assignments[0]))) { #ifdef PDEBUG _support.debug_printf("illegal vreg %u to preg %u @ %u (reg operand)\n", operand.reg.reg.unique_index(), preg_index, current->nr); #endif _support.assertion_fail("assignment of preg out of range"); } #ifdef PDEBUG _support.debug_printf("committing vreg %u to preg %u @ %u (reg operand)\n", operand.reg.reg.unique_index(), preg_index, current->nr); #endif current->get_operand_nc(i).reg.reg = *assignments[preg_index]; } } else if (operand.is_mem()) { if (operand.mem.base_register.is_virtual()) { dbt_u64 preg_index = vreg_to_preg[operand.mem.base_register.unique_index()].physical_register_index; if (preg_index >= (sizeof(assignments) / sizeof(assignments[0]))) { _support.assertion_fail("assignment of preg out of range"); } #ifdef PDEBUG _support.debug_printf("committing vreg %u to preg %u @ %u (mem base operand)\n", operand.reg.reg.unique_index(), preg_index, current->nr); #endif current->get_operand_nc(i).mem.base_register = *assignments[preg_index]; } if (operand.mem.index_register.is_virtual()) { dbt_u64 preg_index = vreg_to_preg[operand.mem.index_register.unique_index()].physical_register_index; if (preg_index >= (sizeof(assignments) / sizeof(assignments[0]))) { _support.assertion_fail("assignment of preg out of range"); } #ifdef PDEBUG _support.debug_printf("committing vreg %u to preg %u @ %u (mem idx operand)\n", operand.reg.reg.unique_index(), preg_index, current->nr); #endif current->get_operand_nc(i).mem.index_register = *assignments[preg_index]; } } } } switch (current->kind()) { case InstructionKind::MOV: case InstructionKind::MOVQ: case InstructionKind::MOVDQA: if (current->get_operand(0) == current->get_operand(1)) { current->change_kind(InstructionKind::DEAD); } break; default: break; } current = current->next(); } while (current != head); return true; } bool ReverseAllocator::verify(const Instruction* head) { const Instruction *current = head; do { #ifndef PDEBUG if (!verify_instruction(current)) { #endif Formatter __fmt; _support.debug_printf("[%u] %s\n", current->nr, __fmt.format_instruction(current)); #ifndef PDEBUG return false; } #endif current = current->next(); } while (current != head); return true; } bool ReverseAllocator::verify_instruction(const Instruction* insn) { if (insn->kind() == InstructionKind::DEAD) return true; for (int i = 0; i < Instruction::NR_OPERANDS; i++) { auto op = insn->get_operand(0); if (op.is_reg()) { if (op.reg.reg.is_virtual()) { _support.debug_printf("verification failed: instruction has virtual register operand\n"); return false; } } else if (op.is_mem()) { if (op.mem.base_register.is_virtual()) { _support.debug_printf("verification failed: instruction has virtual base register operand\n"); return false; } if (op.mem.index_register.is_virtual()) { _support.debug_printf("verification failed: instruction has virtual index register operand\n"); return false; } } } return true; } bool ReverseAllocator::decorate_call(Instruction *call_instruction, int nr_args) { static const X86PhysicalRegister * caller_saved[] = { // Caller Saved &X86PhysicalRegisters::A, &X86PhysicalRegisters::R10, &X86PhysicalRegisters::R11, // Function Arguments &X86PhysicalRegisters::R9, &X86PhysicalRegisters::R8, &X86PhysicalRegisters::C, &X86PhysicalRegisters::D, &X86PhysicalRegisters::SI, &X86PhysicalRegisters::DI }; for (int i = 0; i < (3 + (6 - nr_args)); i++) { auto reg = caller_saved[i]; auto push = _support.alloc_obj<Instruction>(InstructionKind::PUSH); auto pop = _support.alloc_obj<Instruction>(InstructionKind::POP); push->set_operand(0, Operand::make_register(*reg, 64)); pop->set_operand(0, Operand::make_register(*reg, 64)); call_instruction->prev()->insert_after(push); call_instruction->insert_after(pop); } return true; } bool ReverseAllocator::fixup_calls(Instruction *head) { Instruction *current = head; do { switch (current->kind()) { case InstructionKind::CALL: case InstructionKind::CALL0: case InstructionKind::CALL1: case InstructionKind::CALL2: case InstructionKind::CALL3: case InstructionKind::CALL4: case InstructionKind::CALL5: case InstructionKind::CALL6: if (!decorate_call(current, 0)) { return false; } break; default: break; } current = current->next(); } while (current != head); return true; } bool ReverseAllocator::number_and_legalise_instructions(Instruction *head) { dbt_u64 idx = 0; Instruction *current = head; do { // Number the instruction. current->nr = idx++; // Any mem -> mem instructions must be performed via a temporary register if (current->match2() == InstructionMatch::MEM_MEM) { auto op0 = current->get_operand(0); // auto op1 = current->get_operand(1); auto tmp = Operand::make_register(_vreg_allocator.alloc_vreg(X86RegisterClasses::GENERAL_PURPOSE), op0.mem.access_width); auto mov_to_tmp = _support.alloc_obj<Instruction>(InstructionKind::MOV); mov_to_tmp->set_operand(0, op0); mov_to_tmp->set_operand(1, tmp); current->prev()->insert_after(mov_to_tmp); current->set_operand(0, tmp); mov_to_tmp->nr = current->nr; current->nr = idx++; } else if (current->kind() == InstructionKind::JMP) { if (current->get_operand(0).label.target == current->next()) { current->change_kind(InstructionKind::DEAD); } } #ifdef PDEBUG { Formatter __fmt; _support.debug_printf("[%u] %s\n", current->nr, __fmt.format_instruction(current)); } #endif current = current->next(); } while (current != head); return true; }
29.868357
186
0.696009
tspink
d14f7e52a0543a55f8a96b7b4a6b8b9fe2130192
2,630
cpp
C++
examples/ga_binary.cpp
kogyblack/ime_machinelearning
10b9e9f40b3d0d8cee63d0f19fcf4cd8c429816e
[ "Zlib", "MIT" ]
1
2018-01-20T15:36:30.000Z
2018-01-20T15:36:30.000Z
examples/ga_binary.cpp
kogyblack/ime_machinelearning
10b9e9f40b3d0d8cee63d0f19fcf4cd8c429816e
[ "Zlib", "MIT" ]
null
null
null
examples/ga_binary.cpp
kogyblack/ime_machinelearning
10b9e9f40b3d0d8cee63d0f19fcf4cd8c429816e
[ "Zlib", "MIT" ]
null
null
null
#include <stack> #include <cmath> #include "geneticalgorithm/binarygenome.h" #include "geneticalgorithm/genalg.h" int genomeValue(const ga::BinaryGenome& genome) { auto decoded = genome.decode(4); std::stack<int> values; for (unsigned i = 0; i < decoded.size(); ++i) { unsigned d = decoded[i]; if (d <= 9) values.push(d); else if (d >= 13) continue; else if (values.size() >= 2) { int a = values.top(); values.pop(); int b = values.top(); values.pop(); if (d == 10) // Sum values.push(b + a); else if (d == 11) // Difference values.push(b - a); else if (d == 12) // Multiplication values.push(a * b); } } if (values.size() == 0) return 0; return values.top(); } double fitnessFunc(ga::BinaryGenome& genome) { return 1.0 / (double)(exp(abs(genomeValue(genome) - 42) / 21.0)); } void printGenome(const ga::BinaryGenome& genome) { auto decoded = genome.decode(4); for (unsigned i = 0; i < decoded.size(); ++i) { int d = decoded[i]; if (d <= 9) printf("%d ", d); else if (d >= 13) printf("x "); else { if (d == 10) // Sum printf("+ "); else if (d == 11) // Difference printf("- "); else if (d == 12) // Multiplication printf("* "); } } printf(" | "); for (unsigned i = 0; i < 32; ++i) printf("%d", genome.extract()[i]); printf("\n"); } int main(int argc, char** argv) { int population_size = 20, generations = 100; unsigned elite = 2; double mutation = 0.01, crossover = 0.7; if (argc > 1) population_size = atoi(argv[1]); if (argc > 2) generations = atoi(argv[2]); if (argc > 3) elite = atoi(argv[3]); if (argc > 4) mutation = atof(argv[4]); if (argc > 5) crossover = atof(argv[5]); ga::GeneticAlgorithm<ga::BinaryGenome> evolution (population_size, 32, elite, mutation, crossover, fitnessFunc); for (int i = 0; i < generations; ++i) { if (i > 0) evolution.epoch(); printf("generation %d:\n", evolution.generation()); printf("best:\n %d %.2f: ", genomeValue(evolution.get_best_of_all()), evolution.get_best_of_all().getFitness()); printGenome(evolution.get_best_of_all()); printf("\n"); auto population = evolution.population(); for (unsigned j = 0; j < population.size(); ++j) { printf("%3d %3d %1.2f: ", j, genomeValue(population[j]), population[j].getFitness()); printGenome(population[j]); } printf("\n"); } printf("Best of all: %d\n", genomeValue(evolution.get_best_of_all())); return 0; }
23.693694
120
0.564259
kogyblack
d15013344bce2531ca9d4090bd948f167799be63
506
hpp
C++
src/timer.hpp
aalin/synthz0r
ecf35b3fec39020e46732a15874b66f07a3e48e9
[ "MIT" ]
1
2021-12-23T21:14:37.000Z
2021-12-23T21:14:37.000Z
src/timer.hpp
aalin/synthz0r
ecf35b3fec39020e46732a15874b66f07a3e48e9
[ "MIT" ]
null
null
null
src/timer.hpp
aalin/synthz0r
ecf35b3fec39020e46732a15874b66f07a3e48e9
[ "MIT" ]
null
null
null
#ifndef TIMER_HPP #define TIMER_HPP class Timer { public: Timer(float sampleRate) : _ticks(0), _seconds(0.0), _sampleRate(sampleRate) {} float seconds() const { return _seconds; } unsigned long int ticks() const { return _ticks; } void update(const float &sampleRate) { _seconds = _ticks++ / sampleRate; } const float & sampleRate() const { return _sampleRate; } private: unsigned long int _ticks; float _seconds; const float _sampleRate; }; #endif
14.457143
40
0.662055
aalin
d150b010adb13aa653b2eed74a47dec01ee5e66f
6,350
cpp
C++
engine/src/io/data_parser/ParquetParser.cpp
romulo-auccapuclla/blazingsql
c85429479cabc0907212e880d590441f25eb3b59
[ "Apache-2.0" ]
null
null
null
engine/src/io/data_parser/ParquetParser.cpp
romulo-auccapuclla/blazingsql
c85429479cabc0907212e880d590441f25eb3b59
[ "Apache-2.0" ]
null
null
null
engine/src/io/data_parser/ParquetParser.cpp
romulo-auccapuclla/blazingsql
c85429479cabc0907212e880d590441f25eb3b59
[ "Apache-2.0" ]
null
null
null
#include "metadata/parquet_metadata.h" #include "ParquetParser.h" #include "config/GPUManager.cuh" #include <blazingdb/io/Util/StringUtil.h> #include "utilities/CommonOperations.h" #include <algorithm> #include <string> #include <unordered_map> #include <vector> #include <memory> #include <algorithm> #include <numeric> #include <string> #include <iostream> #include <cudf/cudf.h> #include <cudf/io/functions.hpp> #include <unordered_map> #include <vector> #include <arrow/io/file.h> #include <parquet/file_reader.h> #include <parquet/schema.h> #include <parquet/types.h> #include <thread> #include <parquet/column_writer.h> #include <parquet/file_writer.h> #include <parquet/properties.h> #include <parquet/schema.h> #include <parquet/types.h> #include <parquet/api/reader.h> #include <parquet/api/writer.h> #include "../Schema.h" #include <numeric> namespace ral { namespace io { namespace cudf_io = cudf::experimental::io; parquet_parser::parquet_parser() { // TODO Auto-generated constructor stub } parquet_parser::~parquet_parser() { // TODO Auto-generated destructor stub } std::unique_ptr<ral::frame::BlazingTable> parquet_parser::parse( std::shared_ptr<arrow::io::RandomAccessFile> file, const std::string & user_readable_file_handle, const Schema & schema, std::vector<size_t> column_indices) { if(file == nullptr) { return schema.makeEmptyBlazingTable(column_indices); } if(column_indices.size() > 0) { // Fill data to pq_args cudf_io::read_parquet_args pq_args{cudf_io::source_info{file}}; pq_args.strings_to_categorical = false; pq_args.columns.resize(column_indices.size()); for(size_t column_i = 0; column_i < column_indices.size(); column_i++) { pq_args.columns[column_i] = schema.get_name(column_indices[column_i]); } std::vector<int> row_groups = schema.get_rowgroup_ids(0); // because the Schema we are using here was already filtered for a specific file by Schema::fileSchema we are simply getting the first set of rowgroup_ids if (row_groups.size() == 0){ // make empty table of the right schema return schema.makeEmptyBlazingTable(column_indices); } else { // now lets get these row_groups in batches of consecutive rowgroups because that is how the reader will want them std::vector<int> consecutive_row_group_start(1, row_groups[0]); std::vector<int> consecutive_row_group_length; int length_count = 1; int last_rowgroup = consecutive_row_group_start.back(); for (int i = 1; i < row_groups.size(); i++){ if (last_rowgroup + 1 == row_groups[i]){ // consecutive length_count++; last_rowgroup = row_groups[i]; } else { consecutive_row_group_length.push_back(length_count); consecutive_row_group_start.push_back(row_groups[i]); last_rowgroup = row_groups[i]; length_count = 1; } } consecutive_row_group_length.push_back(length_count); if (consecutive_row_group_start.size() == 1){ pq_args.row_group = consecutive_row_group_start[0]; pq_args.row_group_count = consecutive_row_group_length[0]; auto result = cudf_io::read_parquet(pq_args); if (result.tbl->num_columns() == 0){ return schema.makeEmptyBlazingTable(column_indices); } return std::make_unique<ral::frame::BlazingTable>(std::move(result.tbl), result.metadata.column_names); } else { std::vector<std::unique_ptr<ral::frame::BlazingTable>> table_outs; std::vector<ral::frame::BlazingTableView> table_view_outs; for (int i = 0; i < consecutive_row_group_start.size(); i++){ pq_args.row_group = consecutive_row_group_start[i]; pq_args.row_group_count = consecutive_row_group_length[i]; auto result = cudf_io::read_parquet(pq_args); if (result.tbl->num_columns() == 0){ return schema.makeEmptyBlazingTable(column_indices); } table_outs.emplace_back(std::make_unique<ral::frame::BlazingTable>(std::move(result.tbl), result.metadata.column_names)); table_view_outs.emplace_back(table_outs.back()->toBlazingTableView()); } return ral::utilities::experimental::concatTables(table_view_outs); } } } return nullptr; } void parquet_parser::parse_schema( std::vector<std::shared_ptr<arrow::io::RandomAccessFile>> files, ral::io::Schema & schema) { cudf_io::table_with_metadata table_out; for (auto file : files) { auto parquet_reader = parquet::ParquetFileReader::Open(file); if (parquet_reader->metadata()->num_rows() == 0) { parquet_reader->Close(); continue; } cudf_io::read_parquet_args pq_args{cudf_io::source_info{file}}; pq_args.strings_to_categorical = false; pq_args.row_group = 0; pq_args.num_rows = 1; table_out = cudf_io::read_parquet(pq_args); if (table_out.tbl->num_columns() > 0) { break; } } assert(table_out.tbl->num_columns() > 0); for(size_t i = 0; i < table_out.tbl->num_columns(); i++) { cudf::type_id type = table_out.tbl->get_column(i).type().id(); size_t file_index = i; bool is_in_file = true; std::string name = table_out.metadata.column_names.at(i); schema.add_column(name, type, file_index, is_in_file); } } std::unique_ptr<ral::frame::BlazingTable> parquet_parser::get_metadata(std::vector<std::shared_ptr<arrow::io::RandomAccessFile>> files, int offset){ std::vector<size_t> num_row_groups(files.size()); std::thread threads[files.size()]; std::vector<std::unique_ptr<parquet::ParquetFileReader>> parquet_readers(files.size()); for(int file_index = 0; file_index < files.size(); file_index++) { threads[file_index] = std::thread([&, file_index]() { parquet_readers[file_index] = std::move(parquet::ParquetFileReader::Open(files[file_index])); std::shared_ptr<parquet::FileMetaData> file_metadata = parquet_readers[file_index]->metadata(); const parquet::SchemaDescriptor * schema = file_metadata->schema(); num_row_groups[file_index] = file_metadata->num_row_groups(); }); } for(int file_index = 0; file_index < files.size(); file_index++) { threads[file_index].join(); } size_t total_num_row_groups = std::accumulate(num_row_groups.begin(), num_row_groups.end(), size_t(0)); auto minmax_metadata_table = get_minmax_metadata(parquet_readers, total_num_row_groups, offset); for (auto &reader : parquet_readers) { reader->Close(); } return std::move(minmax_metadata_table); } } /* namespace io */ } /* namespace ral */
32.397959
214
0.727559
romulo-auccapuclla
d1535016c4930684a9f9465fa42c728de581711b
1,610
cpp
C++
third party/openRTMFP-Cumulus/CumulusServer/sources/LUAAMFObjectWriter.cpp
Patrick-Bay/SocialCastr
888a57ca63037e566f6c0bf03a646ae91b484086
[ "MIT" ]
5
2015-04-30T09:08:30.000Z
2018-08-13T05:00:39.000Z
third party/openRTMFP-Cumulus/CumulusServer/sources/LUAAMFObjectWriter.cpp
Patrick-Bay/SocialCastr
888a57ca63037e566f6c0bf03a646ae91b484086
[ "MIT" ]
null
null
null
third party/openRTMFP-Cumulus/CumulusServer/sources/LUAAMFObjectWriter.cpp
Patrick-Bay/SocialCastr
888a57ca63037e566f6c0bf03a646ae91b484086
[ "MIT" ]
null
null
null
/* Copyright 2010 OpenRTMFP 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 3 of the License, 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 received along this program for more details (or else see http://www.gnu.org/licenses/). This file is a part of Cumulus. */ #include "LUAAMFObjectWriter.h" #include "AMFObjectWriter.h" using namespace Cumulus; const char* LUAAMFObjectWriter::Name="Cumulus::AMFObjectWriter"; int LUAAMFObjectWriter::Get(lua_State *pState) { SCRIPT_CALLBACK(AMFObjectWriter,LUAAMFObjectWriter,writer) SCRIPT_READ_STRING(name,"") if(name=="write") SCRIPT_WRITE_FUNCTION(&LUAAMFObjectWriter::Write) SCRIPT_CALLBACK_RETURN } int LUAAMFObjectWriter::Set(lua_State *pState) { SCRIPT_CALLBACK(AMFObjectWriter,LUAAMFObjectWriter,writer) SCRIPT_READ_STRING(name,"") lua_rawset(pState,1); // consumes key and value SCRIPT_CALLBACK_RETURN } int LUAAMFObjectWriter::Write(lua_State* pState) { SCRIPT_CALLBACK(AMFObjectWriter,LUAAMFObjectWriter,writer) SCRIPT_READ_STRING(name,"") if(SCRIPT_CAN_READ) { writer.writer.writePropertyName(name); Script::ReadAMF(pState,writer.writer,1); } else SCRIPT_ERROR("This function takes 2 parameters: name and value") SCRIPT_CALLBACK_RETURN }
32.2
72
0.775155
Patrick-Bay
d15453998041f2878223732791326256ad0c9b78
4,764
cpp
C++
core/sql/common/NAError.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
core/sql/common/NAError.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
core/sql/common/NAError.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
/********************************************************************** // @@@ START COPYRIGHT @@@ // // 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. // // @@@ END COPYRIGHT @@@ **********************************************************************/ /* -*-C++-*- ************************************************************************** * * File: NAError.C * Description: New Architecture Error Handler * Created: 01/24/95 * Language: C++ * * * ************************************************************************** */ #include "NAError.h" #include <iostream> // ----------------------------------------------------------------------- // NAErrorParamArray // ----------------------------------------------------------------------- NAErrorParamArray::NAErrorParamArray (Lng32 numParams, NAErrorParam * errParam1,NAErrorParam * errParam2, NAErrorParam * errParam3,NAErrorParam * errParam4, NAErrorParam * errParam5,NAErrorParam * errParam6, NAErrorParam * errParam7,NAErrorParam * errParam8, NAErrorParam * errParam9,NAErrorParam * errParam10) : numParams_(numParams) { array_ = new NAErrorParamArrayElement[numParams]; NAErrorParam * errParamPtr; for (Lng32 index = 0; index < numParams; index ++) { if (index == 0) errParamPtr = errParam1; else if (index == 1) errParamPtr = errParam2; else if (index == 2) errParamPtr = errParam3; else if (index == 3) errParamPtr = errParam4; else if (index == 4) errParamPtr = errParam5; else if (index == 5) errParamPtr = errParam6; else if (index == 6) errParamPtr = errParam7; else if (index == 7) errParamPtr = errParam8; else if (index == 8) errParamPtr = errParam9; else if (index == 9) errParamPtr = errParam10; array_[index].errParam_ = errParamPtr; } } // NAErrorParamArray::NAErrorParamArray() NAErrorParamArray::~NAErrorParamArray (void) { for (Int32 index=0; index<entries(); index++) { if (array_[index].errParam_ != 0) delete array_[index].errParam_; }; delete array_; }; // ----------------------------------------------------------------------- // Constructor // ----------------------------------------------------------------------- NAError::NAError(const NAErrorCode errCode, const NAErrorType errType, const NASubsys subsys, NAErrorParamArray * errParams, char * procName, const ULng32 lineNumber, const ULng32 offset ) : errCode_(errCode), errType_(errType), subsysId_(subsys), procName_(procName), #pragma nowarn(1506) // warning elimination lineNumber_(lineNumber), offset_(offset), next_(0) #pragma warn(1506) // warning elimination { errParams_ = errParams; } NAError::~NAError() { if (errParams_) delete errParams_; if (procName_ ) delete procName_; } // NAError::~NAError() NAErrorStack::~NAErrorStack() { NAErrorStack::clear(); } // NAErrorStack::~NAErrorStack() void NAErrorStack::clear() { NAError * errorPtr = errEntry_; NAError * nextPtr; while (errorPtr) { nextPtr = errorPtr->getNext(); delete errorPtr; errorPtr = nextPtr; } errEntry_ = 0; nextEntry_ = errEntry_; numEntries_ = 0; } // NAErrorStack::clear void NAErrorStack::addErrEntry(NAError * errPtr) { if (numEntries_ <= maxEntries_) { errPtr->setNext(errEntry_); errEntry_ = errPtr; numEntries_++; } else ; // I believe SQL2 wants us to issue an error here. } // NAErrorStack::addErrEntry() NAError * NAErrorStack::getNext() { if (iterEntries_ <= numEntries_) { iterEntries_++; NAError * ne = nextEntry_; if (nextEntry_ != 0) nextEntry_ = nextEntry_->getNext(); // init with -> to follower return ne; } else return 0; } // NAErrorStack::getNext() NAError * NAErrorStack::getFirst() { nextEntry_ = errEntry_; iterEntries_ = 0; return getNext(); } // NAErrorStack::getFirst()
28.872727
74
0.581024
anoopsharma00
d1558c651a06df869cc51ac3f987ce1671993103
3,907
cpp
C++
src/Utility/SharedStringBuilder.cpp
cpv-project/cpv-framework
b0da79c8c57ceecb6b13f4d8658ec4d4c0237668
[ "MIT" ]
86
2018-04-20T04:40:20.000Z
2022-02-09T08:36:28.000Z
src/Utility/SharedStringBuilder.cpp
cpv-project/cpv-framework
b0da79c8c57ceecb6b13f4d8658ec4d4c0237668
[ "MIT" ]
16
2018-04-25T09:34:40.000Z
2020-10-16T03:55:05.000Z
src/Utility/SharedStringBuilder.cpp
cpv-project/cpv-framework
b0da79c8c57ceecb6b13f4d8658ec4d4c0237668
[ "MIT" ]
10
2019-10-07T08:06:15.000Z
2021-07-26T18:46:11.000Z
#include <CPVFramework/Utility/SharedStringBuilder.hpp> namespace cpv { namespace { /** Get max string size of integer, doesn't include zero terminator */ template <class IntType> constexpr std::size_t getMaxStringSize(std::size_t base) { IntType max = std::numeric_limits<IntType>::max(); std::size_t result = 1; // the first digit if (std::numeric_limits<IntType>::is_signed) { ++result; // the sign } while (static_cast<std::make_unsigned_t<IntType>>(max) >= base) { ++result; max /= base; } return result; } /** For appending integer */ static const char DecimalDigits[] = "0123456789"; /** Remove tailing zero for string converted from double and append to builder */ template <class CharType> void trimTailingZeroAndAppend( BasicSharedStringBuilder<CharType>& builder, const char* data, std::size_t size) { const char* end = data + size; while (data < end && *(end - 1) == '0') { --end; } if (data < end && *(end - 1) == '.') { --end; } else { bool constantsDot = false; for (const char* begin = data; begin < end; ++begin) { constantsDot |= (*begin == '.'); } if (!constantsDot) { end = data + size; // should not trim 12300 to 123 } } CharType* ptr = builder.grow(end - data); while (data < end) { *ptr++ = static_cast<CharType>(*data++); } } } /** Append string representation of signed integer to end */ template <class CharType> BasicSharedStringBuilder<CharType>& BasicSharedStringBuilder<CharType>::appendImpl(std::intmax_t value) { static const constexpr std::size_t MaxSize = getMaxStringSize<std::intmax_t>(10); CharType* ptr = grow(MaxSize); if (value < 0) { *ptr++ = '-'; } CharType* ptrStart = ptr; do { int rem = value % 10; value /= 10; *ptr++ = static_cast<CharType>(DecimalDigits[rem >= 0 ? rem : -rem]); } while (value != 0); std::reverse(ptrStart, ptr); size_ = static_cast<std::size_t>(ptr - buffer_.data()); return *this; } /** Append string representation of unsigned integer to end */ template <class CharType> BasicSharedStringBuilder<CharType>& BasicSharedStringBuilder<CharType>::appendImpl(std::uintmax_t value) { static const constexpr std::size_t MaxSize = getMaxStringSize<std::uintmax_t>(10); CharType* ptr = grow(MaxSize); CharType* ptrStart = ptr; do { unsigned int rem = value % 10; value /= 10; *ptr++ = static_cast<CharType>(DecimalDigits[rem]); } while (value != 0); std::reverse(ptrStart, ptr); size_ = static_cast<std::size_t>(ptr - buffer_.data()); return *this; } /** Append string representation of double to end */ template <class CharType> BasicSharedStringBuilder<CharType>& BasicSharedStringBuilder<CharType>::appendImpl(double value) { // to_chars for float is not available in gcc 9, use snprintf now thread_local static std::array<char, 512> buffer; int size = std::snprintf(buffer.data(), buffer.size(), "%lf", value); if (CPV_LIKELY(size > 0)) { trimTailingZeroAndAppend(*this, buffer.data(), size); } else { std::string str = std::to_string(value); trimTailingZeroAndAppend(*this, str.data(), str.size()); } return *this; } /** Append string representation of long double to end */ template <class CharType> BasicSharedStringBuilder<CharType>& BasicSharedStringBuilder<CharType>::appendImpl(long double value) { // to_chars for float is not available in gcc 9, use snprintf now thread_local static std::array<char, 1024> buffer; int size = std::snprintf(buffer.data(), buffer.size(), "%Lf", value); if (CPV_LIKELY(size > 0)) { trimTailingZeroAndAppend(*this, buffer.data(), size); } else { std::string str = std::to_string(value); trimTailingZeroAndAppend(*this, str.data(), str.size()); } return *this; } // Template instatiations template class BasicSharedStringBuilder<char>; }
32.02459
85
0.668288
cpv-project
d15807a15a00ed306d3cfdacc35322432ec8ab60
2,078
cpp
C++
SOLVER/src/core/point/WindowSum.cpp
chaindl/AxiSEM-3D
0251f301c79c676fb37792209d6e24f107773b3d
[ "MIT" ]
null
null
null
SOLVER/src/core/point/WindowSum.cpp
chaindl/AxiSEM-3D
0251f301c79c676fb37792209d6e24f107773b3d
[ "MIT" ]
null
null
null
SOLVER/src/core/point/WindowSum.cpp
chaindl/AxiSEM-3D
0251f301c79c676fb37792209d6e24f107773b3d
[ "MIT" ]
null
null
null
#include "WindowSum.hpp" template <> void SFWindowSum<3>::feedComm(eigen::CColX &buffer, int &row) const { if (mStiffR.rows() > 0) { buffer.block(row, 0, mStiffR.size(), 1).real() = Eigen::Map<const eigen::RColX>(mStiffR.data(), mStiffR.size()); row += mStiffR.size(); } else if (mStiff.rows() > 0) { buffer.block(row, 0, mStiff.size(), 1) = Eigen::Map<const eigen::CColX>(mStiff.data(), mStiff.size()); row += mStiff.size(); } else { throw std::runtime_error("SolidWindowSum::feedComm || Buffer allocation failed."); } }; template <> void SFWindowSum<1>::feedComm(eigen::CColX &buffer, int &row) const { if (mStiffR.rows() > 0) { buffer.block(row, 0, mStiffR.rows(), 1).real() = mStiffR; row += mStiffR.rows(); } else if (mStiff.rows() > 0) { buffer.block(row, 0, mStiff.rows(), 1) = mStiff; row += mStiff.rows(); } else { throw std::runtime_error("FluidWindowSum::feedComm || Buffer allocation failed."); } }; template <> void SFWindowSum<3>::extractComm(const eigen::CColX &buffer, int &row) { if (mStiffR.rows() > 0) { mStiffR += Eigen::Map<const CMat>(&buffer(row), mStiffR.rows(), 3).real(); row += mStiffR.size(); } else if (mStiff.rows() > 0) { mStiff += Eigen::Map<const CMat>(&buffer(row), mStiff.rows(), 3); row += mStiff.size(); } else { throw std::runtime_error("SolidWindowSum::extractComm || Buffer allocation failed."); } }; template <> void SFWindowSum<1>::extractComm(const eigen::CColX &buffer, int &row) { if (mStiffR.rows() > 0) { mStiffR += buffer.block(row, 0, mStiffR.rows(), 1).real(); row += mStiffR.rows(); } else if (mStiff.rows() > 0) { mStiff += buffer.block(row, 0, mStiff.rows(), 1); row += mStiff.rows(); } else { throw std::runtime_error("FluidWindowSum::extractComm || Buffer allocation failed."); } };
34.633333
93
0.554379
chaindl
d15a8768711a61becc7a77f2558bcb80db3f4182
4,552
cpp
C++
admin/dcpromo/exe/welcomepage.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
admin/dcpromo/exe/welcomepage.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
admin/dcpromo/exe/welcomepage.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
// Copyright (C) 1997 Microsoft Corporation // // welcome page // // 12-15-97 sburns #include "headers.hxx" #include "page.hpp" #include "WelcomePage.hpp" #include "resource.h" #include "common.hpp" #include "state.hpp" WelcomePage::WelcomePage() : DCPromoWizardPage( IDD_WELCOME, IDS_WELCOME_PAGE_TITLE, IDS_WELCOME_PAGE_SUBTITLE, false) { LOG_CTOR(WelcomePage); } WelcomePage::~WelcomePage() { LOG_DTOR(WelcomePage); } // NTRAID#NTBUG9-510384-2002/01/22-sburns bool WelcomePage::OnNotify( HWND /* windowFrom */ , UINT_PTR controlIDFrom, UINT code, LPARAM /* lParam */ ) { // LOG_FUNCTION(WelcomePage::OnNotify); bool result = false; switch (code) { case NM_CLICK: case NM_RETURN: { switch (controlIDFrom) { case IDC_PRIMER_LINK: { Win::HtmlHelp( hwnd, L"adconcepts.chm::/sag_AD_DCInstallTopNode.htm", HH_DISPLAY_TOPIC, 0); result = true; break; } default: { // do nothing break; } } } default: { // do nothing break; } } return result; } void WelcomePage::OnInit() { LOG_FUNCTION(WelcomePage::OnInit); SetLargeFont(hwnd, IDC_BIG_BOLD_TITLE); Win::PropSheet_SetTitle( Win::GetParent(hwnd), 0, String::load(IDS_WIZARD_TITLE)); State& state = State::GetInstance(); int intro1TextId = IDS_INTRO1_INSTALL; String intro2Text; switch (state.GetRunContext()) { case State::NT5_DC: { intro1TextId = IDS_INTRO1_DEMOTE; intro2Text = String::load(IDS_INTRO2_DEMOTE); // no readme for demote. Win::ShowWindow(Win::GetDlgItem(hwnd, IDC_PRIMER_LINK), SW_HIDE); break; } case State::NT5_STANDALONE_SERVER: case State::NT5_MEMBER_SERVER: { intro2Text = String::load(IDS_INTRO2_INSTALL); break; } case State::BDC_UPGRADE: { intro1TextId = IDS_INTRO1_DC_UPGRADE; intro2Text = String::load(IDS_INTRO2_BDC_UPGRADE); break; } case State::PDC_UPGRADE: { intro1TextId = IDS_INTRO1_DC_UPGRADE; intro2Text = String::format( IDS_INTRO2_PDC_UPGRADE, state.GetComputer().GetDomainNetbiosName().c_str()); break; } default: { ASSERT(false); break; } } Win::SetDlgItemText(hwnd, IDC_INTRO1, String::load(intro1TextId)); Win::SetDlgItemText(hwnd, IDC_INTRO2, intro2Text); } bool WelcomePage::OnSetActive() { LOG_FUNCTION(WelcomePage::OnSetActive); Win::PropSheet_SetWizButtons(Win::GetParent(hwnd), PSWIZB_NEXT); Win::PostMessage( Win::GetParent(hwnd), WM_NEXTDLGCTL, (WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID), TRUE); State& state = State::GetInstance(); if (state.RunHiddenUnattended()) { int nextPage = Validate(); if (nextPage != -1) { GetWizard().SetNextPageID(hwnd, nextPage); } else { state.ClearHiddenWhileUnattended(); } } return true; } int WelcomePage::Validate() { LOG_FUNCTION(WelcomePage::Validate); int nextPage = -1; State& state = State::GetInstance(); switch (state.GetRunContext()) { case State::PDC_UPGRADE: case State::NT5_STANDALONE_SERVER: case State::NT5_MEMBER_SERVER: case State::BDC_UPGRADE: { nextPage = IDD_SECWARN; break; } case State::NT5_DC: { state.SetOperation(State::DEMOTE); // NTRAID#NTBUG9-496409-2001/11/29-sburns if (state.IsForcedDemotion()) { nextPage = IDD_FORCE_DEMOTE; } else { nextPage = IDD_DEMOTE; } break; } default: { ASSERT(false); break; } } return nextPage; }
19.536481
75
0.514719
npocmaka
d15b1074ba6c87946d8d14a2100e696fee3a6348
294
cpp
C++
test/test-Analyzer_LockedCandidates.cpp
jambolo/Sudoku
786499bfd6a8c948e91a1cfff7d65d38330b9efb
[ "MIT" ]
1
2021-12-24T07:29:41.000Z
2021-12-24T07:29:41.000Z
test/test-Analyzer_LockedCandidates.cpp
jambolo/Sudoku
786499bfd6a8c948e91a1cfff7d65d38330b9efb
[ "MIT" ]
1
2021-12-24T07:45:37.000Z
2021-12-24T08:40:57.000Z
test/test-Analyzer_LockedCandidates.cpp
jambolo/Sudoku
786499bfd6a8c948e91a1cfff7d65d38330b9efb
[ "MIT" ]
null
null
null
#include "Analyzer/LockedCandidates.h" #include <gtest/gtest.h> TEST(LockedCandidates, DISABLED_LockedCandidates) { } TEST(LockedCandidates, DISABLED_exists) { } int main(int argc, char ** argv) { ::testing::InitGoogleTest(&argc, argv); int rv = RUN_ALL_TESTS(); return rv; }
14
49
0.704082
jambolo
d15d5ee4bd3d6f47018a1baeec9d137dd46b1057
660
cpp
C++
cpp/0_check/johnstonc_programmingtoday_sourcecode/chapter04_pointers/ch4_knickknack/ch4knickknack.cpp
shadialameddin/numerical_tools_and_friends
cc9f10f58886ee286ed89080e38ebd303d3c72a5
[ "Unlicense" ]
null
null
null
cpp/0_check/johnstonc_programmingtoday_sourcecode/chapter04_pointers/ch4_knickknack/ch4knickknack.cpp
shadialameddin/numerical_tools_and_friends
cc9f10f58886ee286ed89080e38ebd303d3c72a5
[ "Unlicense" ]
null
null
null
cpp/0_check/johnstonc_programmingtoday_sourcecode/chapter04_pointers/ch4_knickknack/ch4knickknack.cpp
shadialameddin/numerical_tools_and_friends
cc9f10f58886ee286ed89080e38ebd303d3c72a5
[ "Unlicense" ]
null
null
null
//Program 4-8 Knick-knack Program with pointers and switch #include <iostream.h> int main() { int number; int *num_ptr; num_ptr = &number; cout << "\n Please enter an integer for knick-knacking "; cin >> *num_ptr; cout << "\n\n He played knick-knack "; switch(number) // the number was assigned using the pointer { case 1: cout << "with his thumb \n"; break; case 2: cout << "with my shoe \n"; break; case 3: cout << "on his knee \n"; break; case 4: cout << "at the door \n"; break; default: cout << "\n whoa! He doesn't play knick-knack there! \n"; } return 0; }
18.857143
63
0.568182
shadialameddin
d15f7eecddc206fa641d73c5320031e79717531c
547
cpp
C++
tests/swap.cpp
clayne/tight_pair
1ba432f8130ee24698486569bb66f31b04d448e5
[ "MIT" ]
20
2017-10-19T23:30:52.000Z
2021-12-23T06:00:21.000Z
tests/swap.cpp
clayne/tight_pair
1ba432f8130ee24698486569bb66f31b04d448e5
[ "MIT" ]
15
2018-12-05T03:46:53.000Z
2021-09-11T11:36:29.000Z
tests/swap.cpp
clayne/tight_pair
1ba432f8130ee24698486569bb66f31b04d448e5
[ "MIT" ]
4
2018-12-06T02:33:00.000Z
2020-08-01T05:35:34.000Z
/* * Copyright (c) 2021 Morwenn * SPDX-License-Identifier: MIT */ #include <catch2/catch.hpp> #include <tight_pair.h> constexpr auto test_swap() -> bool { cruft::tight_pair<int, bool> p1(5, false); cruft::tight_pair<int, bool> p2(8, true); swap(p1, p2); using cruft::get; return get<0>(p1) == 8 && get<1>(p1) == true && get<0>(p2) == 5 && get<1>(p2) == false; } TEST_CASE( "test constexpr swap (issue #15)" ) { constexpr bool res = test_swap(); CHECK( res ); static_assert(res); }
19.535714
46
0.572212
clayne
d16159ddf927a131b32b868753e0ed0698116d6e
903
cpp
C++
080_RemoveDuplicatesFromSortedArrayII.cpp
kun2012/Leetcode
fa6bbe3f559176911ebb12c9b911b969c6ec85fb
[ "MIT" ]
null
null
null
080_RemoveDuplicatesFromSortedArrayII.cpp
kun2012/Leetcode
fa6bbe3f559176911ebb12c9b911b969c6ec85fb
[ "MIT" ]
null
null
null
080_RemoveDuplicatesFromSortedArrayII.cpp
kun2012/Leetcode
fa6bbe3f559176911ebb12c9b911b969c6ec85fb
[ "MIT" ]
null
null
null
/**************************************************************** Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array nums = [1,1,1,2,2,3], Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3. It doesn't matter what you leave beyond the new length. ****************************************************************/ class Solution { public: int removeDuplicates(vector<int>& nums) { if (nums.size() <= 2) return nums.size(); int j = 0, c = 1; for (int i = 1; i < nums.size(); i++) { if (nums[i] == nums[j]) { c++; if (c <= 2) { nums[++j] = nums[i]; } } else { nums[++j] = nums[i]; c = 1; } } return j + 1; } };
33.444444
101
0.409745
kun2012
d16300ef66e4364be4bbf24581079cd33a91b6a7
793
cpp
C++
source/ArchLab.cpp
xzrunner/cgaview
559899f0f9bcb1186e41b4108388ee2c69008966
[ "MIT" ]
null
null
null
source/ArchLab.cpp
xzrunner/cgaview
559899f0f9bcb1186e41b4108388ee2c69008966
[ "MIT" ]
null
null
null
source/ArchLab.cpp
xzrunner/cgaview
559899f0f9bcb1186e41b4108388ee2c69008966
[ "MIT" ]
null
null
null
#include "archlab/ArchLab.h" #include "archlab/PinCallback.h" #include "archlab/Node.h" #include <blueprint/NodeBuilder.h> #include <blueprint/node/Commentary.h> #include <archgraph/ArchGraph.h> namespace archlab { CU_SINGLETON_DEFINITION(ArchLab); extern void regist_rttr(); ArchLab::ArchLab() { archgraph::ArchGraph::Instance(); regist_rttr(); InitNodes(); InitPinCallback(); } void ArchLab::InitNodes() { const int bp_count = 1; auto list = rttr::type::get<Node>().get_derived_classes(); m_nodes.reserve(bp_count + list.size()); m_nodes.push_back(std::make_shared<bp::node::Commentary>()); for (auto& t : list) { auto obj = t.create(); assert(obj.is_valid()); auto node = obj.get_value<bp::NodePtr>(); assert(node); m_nodes.push_back(node); } } }
16.87234
64
0.69483
xzrunner
d1645b4bb2b5a8fb2e7e02e3580d47db9ff27bfa
1,781
cc
C++
UVa Online Judge/v116/11692.cc
mjenrungrot/algorithm
e0e8174eb133ba20931c2c7f5c67732e4cb2b703
[ "MIT" ]
1
2021-12-08T08:58:43.000Z
2021-12-08T08:58:43.000Z
UVa Online Judge/v116/11692.cc
mjenrungrot/algorithm
e0e8174eb133ba20931c2c7f5c67732e4cb2b703
[ "MIT" ]
null
null
null
UVa Online Judge/v116/11692.cc
mjenrungrot/algorithm
e0e8174eb133ba20931c2c7f5c67732e4cb2b703
[ "MIT" ]
null
null
null
/*============================================================================= # Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/ # FileName: 11692.cc # Description: UVa Online Judge - 11692 =============================================================================*/ #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> using namespace std; const double EPS = 1e-9; double simulate(double L, double K, double T1, double T2, double rainfall_speed) { double rainfall_amount, time_to_leak, leak_amount, final_amount; rainfall_amount = rainfall_speed * T1; time_to_leak = L / rainfall_speed; leak_amount = max(min((T1 - time_to_leak + T2) * K, rainfall_amount - L), 0.0); final_amount = rainfall_amount - leak_amount; return final_amount; } int main() { ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while (T--) { double L, K, T1, T2, H; cin >> L >> K >> T1 >> T2 >> H; double F1, F2; double left = 0.001, right = 1000000.01, mid, amount; while (fabs(left - right) > EPS) { mid = (left + right) / 2.0; amount = simulate(L, K, T1, T2, mid); if (amount < H) left = mid; else right = mid; } F1 = left * T1; left = 0.001, right = 1000000.01; while (fabs(left - right) > EPS) { mid = (left + right) / 2.0; amount = simulate(L, K, T1, T2, mid); if (amount <= H) left = mid; else right = mid; } F2 = left * T1; cout << setprecision(8) << F1 << " " << F2 << endl; } return 0; }
29.196721
79
0.468276
mjenrungrot
d165203a3c66bbf57320802c6a7a6c7c56655d07
8,527
cpp
C++
multimedia/dshow/tools/graphedt/graphedt/reconfig.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
multimedia/dshow/tools/graphedt/graphedt/reconfig.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
multimedia/dshow/tools/graphedt/graphedt/reconfig.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
#include "stdafx.h" #include "ReConfig.h" /****************************************************************************** Internal Constants ******************************************************************************/ static const DWORD RECONFIGURE_NO_FLAGS = 0; static const HANDLE RECONFIGURE_NO_ABORT_EVENT = NULL; /****************************************************************************** Internal Declarations ******************************************************************************/ static HRESULT Reconnect( IGraphBuilder* pFilterGraph, IPin* pOutputPin ); template<class T> T* _CreateInstance( void ) { try { T* pNewObject = new T; pNewObject->AddRef(); return pNewObject; } catch( CMemoryException* pOutOfMemory ) { pOutOfMemory->Delete(); return NULL; } } /****************************************************************************** Reconfigure Helper Functions ******************************************************************************/ /****************************************************************************** PreventStateChangesWhileOperationExecutes PreventStateChangesWhileOperationExecutes() ensures that other threads do not change the filter graph's state while IGraphConfigCallback::Reconfigure() executes. If the current version of Direct Show does not support Dynamic Graph Building, then this function fails. Parameters: - pGraphBuilder [in] The filter graph which WILL be locked. Other threads cannot modify the filter graph's state while it's locked. - pCallback [in] The callback which will be called to preform a user defined operation. - pReconfigureParameter [in] The pvConext parameters IGraphConfigCallback::Reconfigure() receives when it's called. Return Value: An HRESULT. S_OK if no error occur. Otherwise, an error HRESULT. ******************************************************************************/ extern HRESULT PreventStateChangesWhileOperationExecutes ( IGraphBuilder* pGraphBuilder, IGraphConfigCallback* pCallback, void* pReconfigureParameter ) { // The user should pass a valid IGraphBuilder object and a // valid IGraphConfigCallback object. ASSERT( (NULL != pGraphBuilder) && (NULL != pCallback) ); IGraphConfig* pGraphConfig; // Does Direct Show supports Dynamic Graph Building? HRESULT hr = pGraphBuilder->QueryInterface( IID_IGraphConfig, (void**)&pGraphConfig ); if( FAILED( hr ) ) { return hr; } hr = pGraphConfig->Reconfigure( pCallback, (void*)pReconfigureParameter, RECONFIGURE_NO_FLAGS, RECONFIGURE_NO_ABORT_EVENT ); pGraphConfig->Release(); if( FAILED( hr ) ) { return hr; } return S_OK; } /****************************************************************************** IfPossiblePreventStateChangesWhileOperationExecutes If the current version of Direct Show supports Dynamic Graph Building, IfPossiblePreventStateChangesWhileOperationExecutes() ensures that other threads do not change the filter graph's state while IGraphConfigCallback::Reconfigure() executes. If the current version of Direct Show does not support Dynamic Graph Building, then the filter graph state should not change unless this thread changes it. Parameters: - pGraphBuilder [in] The filter graph which MAY be locked. Other threads cannot modify the filter graph's state while it's locked. - pCallback [in] The callback which will be called to preform a user defined operation. - pReconfigureParameter [in] The pvConext parameters IGraphConfigCallback::Reconfigure() receives when it's called. Return Value: An HRESULT. S_OK if no error occur. Otherwise, an error HRESULT. ******************************************************************************/ extern HRESULT IfPossiblePreventStateChangesWhileOperationExecutes ( IGraphBuilder* pGraphBuilder, IGraphConfigCallback* pCallback, void* pReconfigureParameter ) { // The user should pass a valid IGraphBuilder object and a // valid IGraphConfigCallback object. ASSERT( (NULL != pGraphBuilder) && (NULL != pCallback) ); IGraphConfig* pGraphConfig; // Does Direct Show supports Dynamic Graph Building? HRESULT hr = pGraphBuilder->QueryInterface( IID_IGraphConfig, (void**)&pGraphConfig ); if( SUCCEEDED( hr ) ) { // Dynamic Graph Building supported. hr = pGraphConfig->Reconfigure( pCallback, pReconfigureParameter, RECONFIGURE_NO_FLAGS, RECONFIGURE_NO_ABORT_EVENT ); pGraphConfig->Release(); if( FAILED( hr ) ) { return hr; } } else if( E_NOINTERFACE == hr ) { // Dynamic Graph Building is not supported. hr = pCallback->Reconfigure( pReconfigureParameter, RECONFIGURE_NO_FLAGS ); if( FAILED( hr ) ) { return hr; } } else { return hr; } return S_OK; } /****************************************************************************** CReconfigure Public Methods ******************************************************************************/ CGraphConfigCallback::CGraphConfigCallback( const TCHAR* pName, LPUNKNOWN pUnk ) : CUnknown( pName, pUnk ) { } STDMETHODIMP CGraphConfigCallback::NonDelegatingQueryInterface( REFIID riid, void** ppv ) { if( IID_IGraphConfigCallback == riid ) { return GetInterface( this, ppv ); } else { return CUnknown::NonDelegatingQueryInterface( riid, ppv ); } } /****************************************************************************** CPrintGraphAsHTMLCallback Public Methods ******************************************************************************/ CPrintGraphAsHTMLCallback::CPrintGraphAsHTMLCallback() : CGraphConfigCallback( NAME("CPrintGraphAsHTMLCallback"), NULL ) { } STDMETHODIMP CPrintGraphAsHTMLCallback::Reconfigure( PVOID pvContext, DWORD dwFlags ) { // No valid flags have been defined. Therefore, this parameter should be 0. ASSERT( 0 == dwFlags ); PARAMETERS_FOR_PRINTGRAPHASHTMLINTERNAL* pParameters = (PARAMETERS_FOR_PRINTGRAPHASHTMLINTERNAL*)pvContext; CBoxNetDoc* pDoc = pParameters->pDocument; pDoc->PrintGraphAsHTML( pParameters->hFileHandle ); return S_OK; } IGraphConfigCallback* CPrintGraphAsHTMLCallback::CreateInstance( void ) { return _CreateInstance<CPrintGraphAsHTMLCallback>(); } /****************************************************************************** CUpdateFiltersCallback Public Methods ******************************************************************************/ CUpdateFiltersCallback::CUpdateFiltersCallback() : CGraphConfigCallback( NAME("CUpdateFiltersCallback"), NULL ) { } STDMETHODIMP CUpdateFiltersCallback::Reconfigure( PVOID pvContext, DWORD dwFlags ) { // No valid flags have been defined. Therefore, this parameter should be 0. ASSERT( 0 == dwFlags ); CBoxNetDoc* pDoc = (CBoxNetDoc*)pvContext; pDoc->UpdateFiltersInternal(); return S_OK; } IGraphConfigCallback* CUpdateFiltersCallback::CreateInstance( void ) { return _CreateInstance<CUpdateFiltersCallback>(); } /****************************************************************************** CEnumerateFilterCacheCallback Public Methods ******************************************************************************/ CEnumerateFilterCacheCallback::CEnumerateFilterCacheCallback() : CGraphConfigCallback( NAME("CEnumerateFilterCacheCallback"), NULL ) { } STDMETHODIMP CEnumerateFilterCacheCallback::Reconfigure( PVOID pvContext, DWORD dwFlags ) { // No valid flags have been defined. Therefore, this parameter should be 0. ASSERT( 0 == dwFlags ); CBoxNetDoc* pDoc = (CBoxNetDoc*)pvContext; pDoc->OnGraphEnumCachedFiltersInternal(); return S_OK; } IGraphConfigCallback* CEnumerateFilterCacheCallback::CreateInstance( void ) { return _CreateInstance<CEnumerateFilterCacheCallback>(); }
33.439216
112
0.56456
npocmaka
d16821bba6dda4b93696f1adcbfaf6ee8ea6b9d4
272
cpp
C++
engine/src/awesome/editor/window.cpp
vitodtagliente/AwesomeEngine
eff06dbad1c4a168437f69800629a7e20619051c
[ "MIT" ]
3
2019-08-15T18:57:20.000Z
2020-01-09T22:19:26.000Z
engine/src/awesome/editor/window.cpp
vitodtagliente/AwesomeEngine
eff06dbad1c4a168437f69800629a7e20619051c
[ "MIT" ]
null
null
null
engine/src/awesome/editor/window.cpp
vitodtagliente/AwesomeEngine
eff06dbad1c4a168437f69800629a7e20619051c
[ "MIT" ]
null
null
null
#include "window.h" namespace editor { std::string Window::getTitle() const { return getTypeDescriptor().name; } void Window::setFocus(bool focus) { if (m_hasFocus != focus) { m_hasFocus = focus; onFocusChange(m_hasFocus); } } REFLECT_IMP(Window) }
13.6
37
0.672794
vitodtagliente
d16c86a8cf322fb3cd7c0b217cf19749928ea075
4,381
hpp
C++
src/file_raw.hpp
liquidum-network/chiapos
899be669838fbe59307e37be52fdb94ecb1f121f
[ "Apache-2.0" ]
2
2021-07-15T02:32:07.000Z
2021-07-19T19:43:40.000Z
src/file_raw.hpp
liquidum-network/chiapos
899be669838fbe59307e37be52fdb94ecb1f121f
[ "Apache-2.0" ]
null
null
null
src/file_raw.hpp
liquidum-network/chiapos
899be669838fbe59307e37be52fdb94ecb1f121f
[ "Apache-2.0" ]
1
2021-07-14T20:29:32.000Z
2021-07-14T20:29:32.000Z
#ifndef SRC_CPP_FILE_RAW_HPP_ #define SRC_CPP_FILE_RAW_HPP_ #include <fcntl.h> #include <fmt/core.h> #include <sys/stat.h> #include <unistd.h> #include <filesystem> #include "logging.hpp" #include "logging_helpers.hpp" #include "storage.hpp" class FileRaw { public: static FileRaw Create(const std::filesystem::path &filename, bool delete_before_open) { return FileRaw(StorageContext{.local_filename = filename}, delete_before_open); } static FileRaw CreateWithK( StorageContext storage_context, uint8_t k_unused, bool delete_before_open, bool file_size_known = false, size_t file_size = 0) { return FileRaw(std::move(storage_context), delete_before_open); } static FileRaw CreateForTesting( const std::filesystem::path &filename, size_t cache_size_unused = 0) { return FileRaw(StorageContext{.local_filename = filename}, true); } void Open() { // if the file is already open, don't do anything if (fileno_ > 0) return; fileno_ = open(GetFileName().c_str(), O_RDWR | O_CREAT, 0600); if (fileno_ < 0) { std::string error_message = "Could not open " + GetFileName() + ": " + ::strerror(errno) + "."; throw std::runtime_error(error_message); } } FileRaw(FileRaw &&other) { storage_context_ = std::move(other.storage_context_); fileno_ = other.fileno_; other.fileno_ = -1; } FileRaw(const FileRaw &) = delete; FileRaw &operator=(const FileRaw &) = delete; void Close() { if (fileno_ < 0) return; close(fileno_); fileno_ = -1; } void CloseAndDelete() { Close(); std::filesystem::remove(GetFileName()); } std::error_code CloseAndRename(const std::filesystem::path &to) { std::error_code ec; Close(); std::filesystem::rename(GetFileName(), to, ec); return ec; } ~FileRaw() { Close(); } void Read(uint64_t begin, uint8_t *memcache, uint64_t length) { Open(); logging::LogDiskAccess(GetFileName(), "read", begin, length); const auto result = pread(fileno_, memcache, length, begin); if (result < 0) { throw std::runtime_error(std::string("bad read: ") + ::strerror(errno)); } if (static_cast<uint64_t>(result) != length) { throw std::runtime_error(fmt::format( "read too few bytes: requested {}+{} from {} file {}", begin, length, FileSize(), GetFileName())); } } void Write(uint64_t begin, const uint8_t *memcache, uint64_t length) { Open(); logging::LogDiskAccess(GetFileName(), "write", begin, length); const auto result = pwrite(fileno_, memcache, length, begin); if (result < 0) { throw std::runtime_error(std::string("bad write: ") + ::strerror(errno)); } if (static_cast<uint64_t>(result) != length) { throw std::runtime_error("wrote too few bytes"); } } std::string GetFileName() const { return storage_context_.FullLocalPath(); } const StorageContext &GetStorageContext() const { return storage_context_; } void Truncate(uint64_t new_size) { Close(); logging::LogDiskAccess(GetFileName(), "truncate", 0, 0); const auto result = truncate(GetFileName().c_str(), new_size); if (result < 0) { throw std::runtime_error("bad truncate"); } } private: explicit FileRaw(StorageContext storage_context, bool delete_before_open) : storage_context_(std::move(storage_context)), fileno_(-1) { if (delete_before_open) { std::filesystem::remove(GetFileName()); } Open(); } size_t FileSize() const { struct stat st; logging::LogDiskAccess(GetFileName(), "stat", 0, 0); const auto result = fstat(fileno_, &st); if (result < 0) { throw std::runtime_error(std::string("couldn't get size: ") + ::strerror(errno)); } return st.st_size; } StorageContext storage_context_; int fileno_; }; #endif // SRC_CPP_FILE_RAW_HPP_
27.904459
93
0.584341
liquidum-network
d16e0521039cde6e4dbc62deeb2dfc0d6c5d5db9
1,165
cpp
C++
ydb/ydb_op.cpp
allenporter/thebends
5e35c7e654e5260b37218e59b02fb0b1a5cb2eca
[ "Apache-2.0" ]
4
2015-07-27T04:05:50.000Z
2021-01-28T21:56:09.000Z
ydb/ydb_op.cpp
allenporter/thebends
5e35c7e654e5260b37218e59b02fb0b1a5cb2eca
[ "Apache-2.0" ]
null
null
null
ydb/ydb_op.cpp
allenporter/thebends
5e35c7e654e5260b37218e59b02fb0b1a5cb2eca
[ "Apache-2.0" ]
null
null
null
// ydb_op.cpp // Author: Allen Porter <allen@thebends.org> #include <map> #include "ydb_lock.h" #include "ydb_map.h" #include "ydb_op.h" Ydb_ReadOp::Ydb_ReadOp(const string& key, string* retval) : Ydb_Op(READLOCK, key), retval_(retval) { } Ydb_RetCode Ydb_ReadOp::Execute(Ydb_Map& map) { if (map.Get(key_, retval_)) { return YDB_OK; } else { return YDB_NOT_FOUND; } } void Ydb_ReadOp::Rollback(Ydb_Map& map) { // nothing to do } Ydb_WriteOp::Ydb_WriteOp(const string& key, const string& value) : Ydb_Op(WRITELOCK, key), value_(value) { } Ydb_RetCode Ydb_WriteOp::Execute(Ydb_Map& map) { exists_ = map.Get(key_, &orig_value_); map.Put(key_, value_); return YDB_OK; } void Ydb_WriteOp::Rollback(Ydb_Map& map) { if (exists_) { map.Put(key_, orig_value_); } } Ydb_DeleteOp::Ydb_DeleteOp(const string& key) : Ydb_Op(WRITELOCK, key) { } Ydb_RetCode Ydb_DeleteOp::Execute(Ydb_Map& map) { exists_ = map.Get(key_, &orig_value_); if (exists_) { map.Del(key_); return YDB_OK; } else { return YDB_NOT_FOUND; } } void Ydb_DeleteOp::Rollback(Ydb_Map& map) { if (exists_) { map.Put(key_, orig_value_); } }
19.416667
64
0.677253
allenporter
d16e2fefb99254082c332e8adb0de08f2fc4c416
5,066
hpp
C++
firmware/library/L2_Utilities/enum.hpp
Jeremy-Chau/SJSU-Dev2
b3c0b008f9f19a12fe70d319760459b4b2111003
[ "Apache-2.0" ]
2
2020-07-04T18:19:57.000Z
2020-07-04T18:20:44.000Z
firmware/library/L2_Utilities/enum.hpp
hangbogu/SJSU-Dev2
38c9e993aa869c4b29abed470d7fd8affae0e655
[ "Apache-2.0" ]
null
null
null
firmware/library/L2_Utilities/enum.hpp
hangbogu/SJSU-Dev2
38c9e993aa869c4b29abed470d7fd8affae0e655
[ "Apache-2.0" ]
2
2018-07-27T20:48:40.000Z
2018-08-02T21:32:05.000Z
// Enum.hpp includes enhancements to the "enum class" types. #pragma once #include <type_traits> namespace util { // Returns the value of the enum class. This should be used in place of // static_cast<some_numeric_type>(some_variable). // // @example // // enum class SomeType : uint32_t { kValue1 = 1, kValue2 = 2 }; // SomeType some_variable = SomeType::kValue1; // uint32_t numeric_variable = util::Value(some_variable); // // @param enum_type_value variable you would like to get the value of. // @return the value of the enum class type variable of with the underlying // type of the enum class. template <typename Enum, typename Type = typename std::underlying_type_t<Enum>> constexpr Type Value(Enum enum_type_value) { return static_cast<Type>(enum_type_value); } } // namespace util // // Below is the set of bitwise operator overloads for enum class types // // This struct is used in the template evaluation to determine if bitwise // operators are enabled. // This generic instance will match with all enumeration types that do not have // their own template specializations. This will disable bit mask operations for // all types. See the comments for SJ2_ENABLE_BITMASK_OPERATIONS for more // details for the template specialization. template <typename Enum> struct EnableBitMaskOperators_t { static constexpr bool kEnable = false; }; // This macro, when used on an enum class type, will create a specialized // version of the "EnableBitMaskOperators_t" that enables that enum class // to use bitwise operators without the need of static_cast. // // Example from within a class: // // class SomeClass // { // enum class SomeEnum : int32_t { kValue1 = -1, kValue2 = 2 }; // }; // SJ2_ENABLE_BITMASK_OPERATORS(SomeClass::SomeEnum); // #define SJ2_ENABLE_BITMASK_OPERATORS(x) \ template <> \ struct EnableBitMaskOperators_t<x> \ { \ static constexpr bool kEnable = true; \ } // @tparam Enum is the type used in this operator overload // @tparam class= is used as a select. The compiler will use this // implementation of the | operator if that type has a // EnableBitMaskOperators_t<> specialization of the Enum type // or, in other words, the SJ2_ENABLE_BITMASK_OPERATORS was used // on it. // The following is the same for all operators beyond this point. template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum operator|(Enum lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; return static_cast<Enum>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs)); } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum operator&(Enum lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs)); } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum operator^(Enum lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; return static_cast<Enum>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs)); } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum operator~(Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; return static_cast<Enum>(~static_cast<underlying>(rhs)); } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum & operator|=(Enum & lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; lhs = static_cast<Enum>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs)); return lhs; } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum & operator&=(Enum & lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; lhs = static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs)); return lhs; } template <typename Enum, class = typename std::enable_if_t< EnableBitMaskOperators_t<Enum>::kEnable, Enum>> constexpr Enum & operator^=(Enum & lhs, Enum rhs) { using underlying = typename std::underlying_type<Enum>::type; lhs = static_cast<Enum>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs)); return lhs; }
38.378788
80
0.666601
Jeremy-Chau
d16eb6255da80f6b14890dccdf9c75c50c8e2430
3,427
cpp
C++
Code/WSTrainingTJM/FrmTXTRead/CopyPastMod.m/src/CopyPasteDlg.cpp
msdos41/CATIA_CAA_V5
bf831f7ecc3c4937b227782ee8bebf7c6675792a
[ "MIT" ]
5
2019-11-14T05:42:38.000Z
2022-03-12T12:51:46.000Z
Code/WSTrainingTJM/FrmTXTRead/CopyPastMod.m/src/CopyPasteDlg.cpp
msdos41/CATIA_CAA_V5
bf831f7ecc3c4937b227782ee8bebf7c6675792a
[ "MIT" ]
null
null
null
Code/WSTrainingTJM/FrmTXTRead/CopyPastMod.m/src/CopyPasteDlg.cpp
msdos41/CATIA_CAA_V5
bf831f7ecc3c4937b227782ee8bebf7c6675792a
[ "MIT" ]
4
2020-01-02T13:48:07.000Z
2022-01-05T04:23:30.000Z
// COPYRIGHT Dassault Systemes 2018 //=================================================================== // // CopyPasteDlg.cpp // The dialog : CopyPasteDlg // //=================================================================== // // Usage notes: // //=================================================================== // // Nov 2018 Creation: Code generated by the CAA wizard Administrator //=================================================================== #include "CopyPasteDlg.h" #include "CATApplicationFrame.h" #include "CATDlgGridConstraints.h" #include "CATMsgCatalog.h" #ifdef CopyPasteDlg_ParameterEditorInclude #include "CATIParameterEditorFactory.h" #include "CATIParameterEditor.h" #include "CATICkeParm.h" #endif //------------------------------------------------------------------------- // Constructor //------------------------------------------------------------------------- CopyPasteDlg::CopyPasteDlg() : CATDlgDialog ((CATApplicationFrame::GetApplicationFrame())->GetMainWindow(), //CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION "CopyPasteDlg",CATDlgWndBtnOKCancel|CATDlgWndTitleBarHelp|CATDlgGridLayout //END CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION ) { //CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION _LabelSource = NULL; _SelectorListSource = NULL; _LabelTarget = NULL; _SelectorListTarget = NULL; //END CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION } //------------------------------------------------------------------------- // Destructor //------------------------------------------------------------------------- CopyPasteDlg::~CopyPasteDlg() { // Do not delete the control elements of your dialog: // this is done automatically // -------------------------------------------------- //CAA2 WIZARD DESTRUCTOR DECLARATION SECTION _LabelSource = NULL; _SelectorListSource = NULL; _LabelTarget = NULL; _SelectorListTarget = NULL; //END CAA2 WIZARD DESTRUCTOR DECLARATION SECTION } void CopyPasteDlg::Build() { // TODO: This call builds your dialog from the layout declaration file // ------------------------------------------------------------------- //CAA2 WIZARD WIDGET CONSTRUCTION SECTION _LabelSource = new CATDlgLabel(this, "LabelSource"); _LabelSource -> SetGridConstraints(0, 0, 1, 1, CATGRID_4SIDES); _SelectorListSource = new CATDlgSelectorList(this, "SelectorListSource"); _SelectorListSource -> SetVisibleTextHeight(10); _SelectorListSource -> SetVisibleTextWidth(30); _SelectorListSource -> SetGridConstraints(0, 1, 1, 1, CATGRID_4SIDES); _LabelTarget = new CATDlgLabel(this, "LabelTarget"); _LabelTarget -> SetGridConstraints(1, 0, 1, 1, CATGRID_4SIDES); _SelectorListTarget = new CATDlgSelectorList(this, "SelectorListTarget"); _SelectorListTarget -> SetVisibleTextHeight(1); _SelectorListTarget -> SetGridConstraints(1, 1, 1, 1, CATGRID_4SIDES); //END CAA2 WIZARD WIDGET CONSTRUCTION SECTION //CAA2 WIZARD CALLBACK DECLARATION SECTION //END CAA2 WIZARD CALLBACK DECLARATION SECTION CATUnicodeString iInitialShow = "No Selection"; _SelectorListSource->SetLine(iInitialShow,-1,CATDlgDataAdd); _SelectorListTarget->SetLine(iInitialShow,-1,CATDlgDataAdd); int iTabRow = 0; _SelectorListSource->SetSelect(&iTabRow,1,1); } CATDlgSelectorList * CopyPasteDlg::GetSelectorListTarget() { return _SelectorListTarget; } CATDlgSelectorList * CopyPasteDlg::GetSelectorListSource() { return _SelectorListSource; }
33.271845
78
0.618909
msdos41
d16efddb5721e6fe9a8b58c63e72550a1dead48e
903
hpp
C++
include/mbgl/util/peer.hpp
RobertSasak/mapbox-gl-native
dabf5d0c3a76f9fbe8b866f64f51accf12d1a2a6
[ "BSL-1.0", "Apache-2.0" ]
2
2019-04-18T21:25:22.000Z
2019-04-18T21:25:24.000Z
include/mbgl/util/peer.hpp
RobertSasak/mapbox-gl-native
dabf5d0c3a76f9fbe8b866f64f51accf12d1a2a6
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
include/mbgl/util/peer.hpp
RobertSasak/mapbox-gl-native
dabf5d0c3a76f9fbe8b866f64f51accf12d1a2a6
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
#pragma once #include <memory> #include <type_traits> #include <utility> namespace mbgl { namespace util { class peer { public: peer() noexcept : storage(nullptr, noop_deleter) {} template <class T> peer(T&& value) noexcept : storage(new std::decay_t<T>(std::forward<T>(value)), cast_deleter<std::decay_t<T>>) { static_assert(!std::is_same<peer, std::decay_t<T>>::value, "Peer must not wrap itself."); } bool has_value() const noexcept { return static_cast<bool>(storage); } template <class T> T& get() noexcept { return *reinterpret_cast<T*>(storage.get()); } private: template <typename T> static void cast_deleter(void* ptr) noexcept { delete reinterpret_cast<T*>(ptr); } static void noop_deleter(void*) noexcept {} using storage_t = std::unique_ptr<void, void(*)(void*)>; storage_t storage; }; } // namespace util } // namespace mbgl
25.8
116
0.669989
RobertSasak
d16f2e4a6b9b55257c7b2be372e66cbf58f8c2a1
352
inl
C++
src/Core/Mesh/DCEL/Face.inl
nmellado/Radium-Engine
6e42e4be8d14bcd496371a5f58d483f7d03f9cf4
[ "Apache-2.0" ]
null
null
null
src/Core/Mesh/DCEL/Face.inl
nmellado/Radium-Engine
6e42e4be8d14bcd496371a5f58d483f7d03f9cf4
[ "Apache-2.0" ]
null
null
null
src/Core/Mesh/DCEL/Face.inl
nmellado/Radium-Engine
6e42e4be8d14bcd496371a5f58d483f7d03f9cf4
[ "Apache-2.0" ]
null
null
null
#include <Core/Mesh/DCEL/Face.hpp> #include <Core/Mesh/DCEL/HalfEdge.hpp> namespace Ra { namespace Core { /// HALFEDGE inline HalfEdge_ptr Face::HE() const { return m_he; } inline HalfEdge_ptr& Face::HE() { return m_he; } inline void Face::setHE( const HalfEdge_ptr& he ) { m_he = he; } } // namespace Core } // namespace Ra
11
51
0.650568
nmellado
d172484997a149287ef3b0867e5fdaae0201fd65
4,512
cpp
C++
Lab3.cpp
mikeandino/Lab3_P3_MichaelAndino
a0d2516e725d07c4b01036e4de7dd0653f02c2b7
[ "MIT" ]
null
null
null
Lab3.cpp
mikeandino/Lab3_P3_MichaelAndino
a0d2516e725d07c4b01036e4de7dd0653f02c2b7
[ "MIT" ]
null
null
null
Lab3.cpp
mikeandino/Lab3_P3_MichaelAndino
a0d2516e725d07c4b01036e4de7dd0653f02c2b7
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <vector> #include <stdlib.h> using namespace std; int main(); bool menu(); void ruffini(); void fechas(); int*** crearMatriz(int); void limpiarMatriz(int***, int); void imprimirMatriz(int***,int,int); string calculofechas(int,int,int,int); int main(){ while(menu()){ cout<<endl; } return 0; }//main bool menu(){ cout<<"Programacion 3 Laboratorio 3"<<endl <<" Numero 1: Poda y Busca"<<endl <<" Numero 2: Teorema de Rufinni"<<endl <<" Numero 3: Vector de Fechas"<<endl <<" Numero 4: Salir"<<endl <<" Ingrese su opcion: "; int opcion = 0; cin>>opcion; cout<<endl; if(opcion==1){ return true; }else if(opcion==2){ ruffini(); return true; }else if(opcion==3){ fechas(); return true; }else if(opcion==4){ return false; }else{ cout<<"Numero Invalido"; return true; }//if y elses }//menu void ruffini(){ cout<<"Ingrese el grado mas alto del polinomio: "; int grado; cin>>grado; int contador = grado; int*** matriz = crearMatriz(grado+1); while(contador>=0){ cout<<"Ingrese el valor de x^"<<contador<<": "; int valor; cin>>valor; for(int i=0;i<grado+1;i++){ matriz[i][0][grado-contador]=valor; }//for contador--; }//while int a; cout<<"Ingrese a: "; cin>>a; for(int i=0;i<grado+1;i++){ if(i==0){ for(int j=0;j<grado+1;j++){ matriz[j][2][i]=matriz[j][i][i]; }//for j }else{ for(int j=i;j<grado+1;j++){ matriz[j][1][i]=matriz[j][2][i-1]*a; matriz[j][2][i]=matriz[j][0][i]+matriz[j][1][i]; }//for j }//if else }//for cout<<"El cociente es: "; for(int i=0;i<grado;i++){ if(i==grado-1){ cout<<matriz[grado][2][grado-1]<<endl; }else{ cout<<matriz[grado][2][i]<<"x^"<<grado-1-i<<" + "; }//if }//for cout<<"El recipiente es: "<<matriz[grado][2][grado]<<endl; cout<<"------------------------------"<<endl; imprimirMatriz(matriz,grado+1,a); limpiarMatriz(matriz, grado+1); }//ruffini int*** crearMatriz(int size){ int*** matrix = new int**[size]; for(int i=0;i<size;i++){ matrix[i]= new int*[3]; } for(int i=0;i<size;i++){ for(int j=0;j<3;j++){ matrix[i][j]=new int[size]; } } return matrix; }//crearMatriz void limpiarMatriz(int*** matrix, int size){ for(int i=0;i<size;i++){ for(int j=0;j<3;j++){ delete [] matrix[i][j]; matrix[i][j]=NULL; }//for j }//for i for(int i=0;i<size;i++){ delete[] matrix[i]; matrix[i]=NULL; }//for i delete[] matrix; }//LimpiarMatriz void imprimirMatriz(int*** matrix,int size,int a){ for(int i=0;i<size;i++){ for(int j=0;j<3;j++){ for(int k=0;k<size;k++){ cout<<matrix[i][j][k]<<" "; }//for k if(j!=2){ cout<<"| "; if(j==0){ cout<<a; }else{ cout<<endl<<"-----------------------"; }//if else }//if cout<<endl; }//for j cout<<"-------------------------------"<<endl; }//for i }//imprimirMatriz void fechas(){ int bandera=0; vector <string> dates; do{ cout<<"1.Agregar Fecha"<<endl <<"2.Listar Todo"<<endl <<"3.Listar Ordenado"<<endl <<"4.Volver al menu"<<endl <<"Ingrese una opcion: "; cin>>bandera; if(bandera==1){ cout<<"Ingrese una cadena: "; string fecha; cin>>fecha; while(fecha.size()!=8){ cout<<"Formato no valido: "; cin>>fecha; }//while int ano = atoi((fecha.substr(0,2)).c_str()); int ano2 = atoi((fecha.substr(2,2)).c_str()); int mes = atoi((fecha.substr(4,2)).c_str()); int dia = atoi((fecha.substr(6,2)).c_str()); if(mes<0&&mes>13){ if(dia<0&&dia>32){ if((mes == 2 || mes == 4 ||mes == 6 || mes == 9 || mes == 11)&& dia==31){ cout<<"La fecha ingresada no existe."<<endl; }else{ if(mes==2){ if(ano2%4){ if(dia<30){ }else{ cout<<"La fecha ingresada no existe."<<endl; }//if dia febrero possible }else{ if(dia<29){ }else{ cout<<"La fecha ingresada no existe."<<endl; }//if dia febrero possible }//if año bisiestro }else{ }//if febrero }//if dia del mes possible }else{ cout<<"La fecha ingresada no existe,"<<endl; }//if dia possible }else{ cout<<"La fecha ingresada no existe."<<endl; }//if mes possible }else if(bandera==2){ }else if(bandera==3){ }else if(bandera==4){ }else{ cout<<"Opcion no valida."<<endl; }//if elses }while(bandera!=4); }//fecha //ano = año string calculofecha(int ano, int ano2,int mes, int dia){ return ""; }//calculofechas
21.084112
78
0.55164
mikeandino
d17295593fe5c854f7eaf8f3aeaf63a926d402b5
4,076
inl
C++
include/gum/vec/vec.inl
johannes-braun/gum
7f0cd74f0e4f8b6d9ffaf3312d24d0c720f6340a
[ "MIT" ]
null
null
null
include/gum/vec/vec.inl
johannes-braun/gum
7f0cd74f0e4f8b6d9ffaf3312d24d0c720f6340a
[ "MIT" ]
null
null
null
include/gum/vec/vec.inl
johannes-braun/gum
7f0cd74f0e4f8b6d9ffaf3312d24d0c720f6340a
[ "MIT" ]
null
null
null
#pragma once namespace gfx { inline namespace v1 { template<typename T, size_t S> template<std::size_t... Is> constexpr vec<T, S>::vec(std::index_sequence<Is...>, T&& value) noexcept : detail::vec_components<T, S>{(static_cast<void>(Is), value)...} {} template<typename T, size_t S> template<typename X, size_t D, std::size_t... Is> constexpr vec<T, S>::vec(std::index_sequence<Is...>, const vec<X, D>& other) noexcept : detail::vec_components<T, S>{static_cast<T>(other[Is])...} {} template<typename T, size_t S> template<typename X, std::size_t... Is> constexpr vec<T, S>::vec(std::index_sequence<Is...>, const X* other) noexcept : detail::vec_components<T, S>{static_cast<T>(other[Is])...} {} template<typename T, size_t S> constexpr vec<T, S>::vec() noexcept : vec(T{}) {} template<typename T, size_t S> template<typename X, size_t D, typename> constexpr vec<T, S>::vec(const vec<X, D>& other) noexcept : vec(std::make_index_sequence<std::min(S, D)>(), other) {} template<typename T, size_t S> template<typename X, typename> constexpr vec<T, S>::vec(const X* ptr) : vec(std::make_index_sequence<S>(), ptr) {} template<typename T, size_t S> template<typename X, typename> constexpr vec<T, S>::vec(X* ptr) : vec(std::make_index_sequence<S>(), ptr) {} template<typename T, size_t S> constexpr vec<T, S>::vec(T&& value) noexcept : vec(std::make_index_sequence<S>(), std::forward<T&&>(value)) {} template<typename T, size_t S> template<typename... Ts, typename> constexpr vec<T, S>::vec(Ts&&... ts) noexcept : detail::vec_components<T, S>{static_cast<value_type>(ts)...} {} template<typename T, size_t S> template<std::size_t ...Is, typename UnaryConvertFun> inline constexpr auto vec<T, S>::apply(std::index_sequence<Is...>, UnaryConvertFun && fun) const noexcept { using type = decltype(fun(this->components[0])); if constexpr (std::is_same_v< type, void>) (fun(this->components[Is]), ...); else return vec<type, S>(fun(this->components[Is])...); } template<typename T, size_t S> template<std::size_t ...Is, typename UnaryConvertFun> inline constexpr auto vec<T, S>::apply(std::index_sequence<Is...>, const vec & other, UnaryConvertFun && fun) const noexcept { using type = decltype(fun(this->components[0], other.components[0])); if constexpr (std::is_same_v<type, void>) (fun(this->components[Is], other.components[Is]), ...); else return vec<type, S>(fun(this->components[Is], other.components[Is])...); } template<typename T, size_t S> inline constexpr auto vec<T, S>::real() const noexcept { return apply(std::make_index_sequence<S>{}, [](const auto& x) { return std::real(x); }); } template<typename T, size_t S> inline constexpr auto vec<T, S>::imag() const noexcept { return apply(std::make_index_sequence<S>{}, [](const auto& x) { return std::real(x); }); } template<typename T, size_t S> constexpr typename vec<T, S>::reference vec<T, S>::at(size_type index) { return detail::vec_components<T, S>::components[index]; } template<typename T, size_t S> constexpr typename vec<T, S>::const_reference vec<T, S>::at(size_type index) const { return detail::vec_components<T, S>::components[index]; } template<typename T, size_t S> constexpr typename vec<T, S>::reference vec<T, S>::operator[](size_type index) { return detail::vec_components<T, S>::components[index]; } template<typename T, size_t S> constexpr typename vec<T, S>::const_reference vec<T, S>::operator[](size_type index) const { return detail::vec_components<T, S>::components[index]; } template<typename T, size_t S> constexpr typename vec<T, S>::pointer vec<T, S>::data() noexcept { return this->components; } template<typename T, size_t S> constexpr typename vec<T, S>::const_pointer vec<T, S>::data() const noexcept { return this->components; } template<typename T, size_t S> constexpr typename vec<T, S>::size_type vec<T, S>::size() const noexcept { return S; } template<typename T, size_t S> constexpr void vec<T, S>::fill(const T& value) { std::fill_n(this->components, S, value); } } // namespace v1 } // namespace gfx
31.114504
138
0.694553
johannes-braun
ab6e952cc54e52f391b08bc6f2354ffcaf3e25b3
1,147
cpp
C++
c++/NVIDIA/mutex.cpp
praveenpandit/programming
ee07b19d495f363297b5cc80d0b0a51b02cd964d
[ "MIT" ]
null
null
null
c++/NVIDIA/mutex.cpp
praveenpandit/programming
ee07b19d495f363297b5cc80d0b0a51b02cd964d
[ "MIT" ]
null
null
null
c++/NVIDIA/mutex.cpp
praveenpandit/programming
ee07b19d495f363297b5cc80d0b0a51b02cd964d
[ "MIT" ]
null
null
null
#include <iostream> #include <thread> #include <mutex> #include <condition_variable> using namespace std; void func(mutex &mx) { { lock_guard<mutex> lock(mx); cout << "Inside Thread :: " << this_thread::get_id() << endl; this_thread::sleep_for(chrono::seconds(4)); } } // bool run = true; void conFunc(mutex &mx, condition_variable &cvar) { unique_lock<mutex> lock(mx); cvar.wait(lock); // while (run) // { // } cout << "Inside conFunc Thread :: " << this_thread::get_id() << endl; lock.unlock(); } int main() { mutex mxt; // thread t1(func, ref(mxt)); // this_thread::sleep_for(chrono::seconds(1)); // unique_lock<mutex> lock(mxt); // cout << "Inside Main Thread :: " << this_thread::get_id() << endl; // lock.unlock(); // t1.join(); condition_variable cvar; thread t2(conFunc, ref(mxt), ref(cvar)); cout << "Inside Main Thread :: " << this_thread::get_id() << endl; this_thread::sleep_for(chrono::seconds(10)); { lock_guard<mutex> lock(mxt); cvar.notify_all(); } // run = false; t2.join(); return 0; }
23.408163
73
0.580645
praveenpandit
ab6f7ff2353ce86689413975f0d1e2a1fea6f50a
4,120
cpp
C++
src/example_all_pointers.cpp
vreverdy/type-utilities
510b558d30962973b983fd1d67bd8412dabf2fd5
[ "BSD-3-Clause" ]
5
2018-05-17T01:56:44.000Z
2021-03-13T11:53:24.000Z
src/example_all_pointers.cpp
vreverdy/type-utilities
510b558d30962973b983fd1d67bd8412dabf2fd5
[ "BSD-3-Clause" ]
2
2018-06-02T03:07:36.000Z
2018-08-03T21:36:53.000Z
src/example_all_pointers.cpp
vreverdy/type-utilities
510b558d30962973b983fd1d67bd8412dabf2fd5
[ "BSD-3-Clause" ]
null
null
null
// ========================== EXAMPLE ALL POINTERS ========================== // // Project: Type Utilities // Name: example_all_pointers.cpp // Description: Use cases for [remove/copy/clone]_all_pointers // Creator: Vincent Reverdy // Contributor(s): Vincent Reverdy [2018] // License: BSD 3-Clause License // ========================================================================== // // ================================ PREAMBLE ================================ // // C++ standard library #include <vector> #include <iostream> // Project sources #include "../include/type_utilities.hpp" // Third-party libraries // Miscellaneous using namespace type_utilities; // ========================================================================== // // ============================= IMPLEMENTATION ============================= // // Enables if the type is a pointer to a tensor element template <class T> using enable_if_element_pointer_t = std::enable_if_t< std::is_pointer_v<T> && !std::is_pointer_v<std::remove_pointer_t<T>> >; // Gets an element: tail template <class T, class = enable_if_element_pointer_t<T>> constexpr remove_all_pointers_t<T> get_element(T& tensor) { return tensor ? *tensor : remove_all_pointers_t<T>(); } // Gets an element: recursive call template <class T, class... Indices> constexpr remove_all_pointers_t<T> get_element( T& tensor, std::size_t idx, Indices&&... idxs ) { return tensor && tensor[idx] ? get_element(tensor[idx], std::forward<Indices>(idxs)...) : remove_all_pointers_t<T>(); } // Sets an element: tail template <std::size_t N, class T, class = enable_if_element_pointer_t<T>> void set_element(const remove_all_pointers_t<T>& val, T& tensor) { using raw_t = remove_all_pointers_t<T>; tensor ? (*tensor = val, 0) : (tensor = new raw_t(val), 0); } // Sets an element: recursive call template <std::size_t N, class T, class... I> void set_element( const remove_all_pointers_t<T>& val, T& tensor, std::size_t idx, I&&... idxs ) { if (!tensor) { tensor = new std::remove_pointer_t<T>[N]; for (std::size_t i = 0; i < N; ++i) tensor[i] = nullptr; } set_element<N>(val, tensor[idx], std::forward<I>(idxs)...); } // Deallocates the entire tensor template <std::size_t N, class T> void deallocate(T& tensor) { if constexpr (!std::is_pointer_v<std::remove_pointer_t<T>>) { delete tensor; tensor = nullptr; } else if constexpr (std::is_pointer_v<std::remove_pointer_t<T>>) { if (tensor) { for (std::size_t i = 0; i < N; ++i) deallocate<N>(tensor[i]); delete[] tensor; tensor = nullptr; } } } // ========================================================================== // // ================================== MAIN ================================== // // Main function int main(int, char**) { // Initialization constexpr std::size_t dimension = 4; using type = unsigned long long int; type***** tensor = nullptr; std::size_t i = 0; // Fill for (std::size_t i0 = 0; i0 < dimension; ++i0) { for (std::size_t i1 = 0; i1 < dimension; ++i1) { for (std::size_t i2 = 0; i2 < dimension; ++i2) { for (std::size_t i3 = 0; i3 < dimension; ++i3) { set_element<dimension>(i++, tensor, i0, i1, i2, i3); } } } } // Display for (std::size_t i0 = 0; i0 < dimension; ++i0) { for (std::size_t i1 = 0; i1 < dimension; ++i1) { for (std::size_t i2 = 0; i2 < dimension; ++i2) { for (std::size_t i3 = 0; i3 < dimension; ++i3) { std::cout << "[" << i0 << ", " << i1 << ", "; std::cout << i2 << ", " << i3 << "]: "; std::cout << get_element(tensor, i0, i1, i2, i3) << "\n"; } } } } // Finalization deallocate<dimension>(tensor); return 0; } // ========================================================================== //
33.495935
80
0.499272
vreverdy
ab7237df493381f35ef1107825da479322bc5814
2,646
hpp
C++
src/reyes/AddSymbolHelper.hpp
cwbaker/reyes
76bd5ed7fde8be2c771536a73234e3a12b3cd6f7
[ "MIT" ]
9
2019-01-10T21:37:24.000Z
2021-05-26T23:59:05.000Z
src/reyes/AddSymbolHelper.hpp
cwbaker/reyes
76bd5ed7fde8be2c771536a73234e3a12b3cd6f7
[ "MIT" ]
null
null
null
src/reyes/AddSymbolHelper.hpp
cwbaker/reyes
76bd5ed7fde8be2c771536a73234e3a12b3cd6f7
[ "MIT" ]
1
2018-09-05T01:40:09.000Z
2018-09-05T01:40:09.000Z
#ifndef REYES_ADDSYMBOLHELPER_HPP_INCLUDED #define REYES_ADDSYMBOLHELPER_HPP_INCLUDED #include "ValueType.hpp" #include "ValueStorage.hpp" #include <vector> #include <memory> namespace reyes { class Grid; class Symbol; class Value; class Renderer; class SymbolTable; /** // Syntax helper to provide a convenient syntax for constructing hierarchical // symbol tables. */ class AddSymbolHelper { SymbolTable* symbol_table_; ///< The SymbolTable to add Symbols to. std::shared_ptr<Symbol> symbol_; ///< The most recently added Symbol. public: AddSymbolHelper( SymbolTable* symbol_table ); AddSymbolHelper& operator()( const char* identifier, ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3, std::shared_ptr<Value> a4), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, void (*function)(const Renderer&, const Grid&, std::shared_ptr<Value> a0, std::shared_ptr<Value> a1, std::shared_ptr<Value> a2, std::shared_ptr<Value> a3, std::shared_ptr<Value> a4, std::shared_ptr<Value> a5), ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( ValueType type, ValueStorage storage = STORAGE_VARYING ); AddSymbolHelper& operator()( const char* identifier, float value ); }; } #endif
60.136364
325
0.741497
cwbaker
ab741b97af0ac3b1b1b9dc805af4061dd1318a2f
5,396
cc
C++
device/udev_linux/udev1_loader.cc
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2019-11-28T10:46:52.000Z
2019-11-28T10:46:52.000Z
device/udev_linux/udev1_loader.cc
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
device/udev_linux/udev1_loader.cc
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2015-03-27T11:15:39.000Z
2016-08-17T14:19:56.000Z
// Copyright 2014 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 "device/udev_linux/udev1_loader.h" #include "library_loaders/libudev1.h" namespace device { Udev1Loader::Udev1Loader() { } Udev1Loader::~Udev1Loader() { } bool Udev1Loader::Init() { if (lib_loader_) return lib_loader_->loaded(); lib_loader_.reset(new LibUdev1Loader); return lib_loader_->Load("libudev.so.1"); } const char* Udev1Loader::udev_device_get_action(udev_device* udev_device) { return lib_loader_->udev_device_get_action(udev_device); } const char* Udev1Loader::udev_device_get_devnode(udev_device* udev_device) { return lib_loader_->udev_device_get_devnode(udev_device); } udev_device* Udev1Loader::udev_device_get_parent(udev_device* udev_device) { return lib_loader_->udev_device_get_parent(udev_device); } udev_device* Udev1Loader::udev_device_get_parent_with_subsystem_devtype( udev_device* udev_device, const char* subsystem, const char* devtype) { return lib_loader_->udev_device_get_parent_with_subsystem_devtype( udev_device, subsystem, devtype); } const char* Udev1Loader::udev_device_get_property_value( udev_device* udev_device, const char* key) { return lib_loader_->udev_device_get_property_value(udev_device, key); } const char* Udev1Loader::udev_device_get_subsystem(udev_device* udev_device) { return lib_loader_->udev_device_get_subsystem(udev_device); } const char* Udev1Loader::udev_device_get_sysattr_value(udev_device* udev_device, const char* sysattr) { return lib_loader_->udev_device_get_sysattr_value(udev_device, sysattr); } const char* Udev1Loader::udev_device_get_sysname(udev_device* udev_device) { return lib_loader_->udev_device_get_sysname(udev_device); } const char* Udev1Loader::udev_device_get_syspath(udev_device* udev_device) { return lib_loader_->udev_device_get_syspath(udev_device); } udev_device* Udev1Loader::udev_device_new_from_devnum(udev* udev, char type, dev_t devnum) { return lib_loader_->udev_device_new_from_devnum(udev, type, devnum); } udev_device* Udev1Loader::udev_device_new_from_syspath(udev* udev, const char* syspath) { return lib_loader_->udev_device_new_from_syspath(udev, syspath); } void Udev1Loader::udev_device_unref(udev_device* udev_device) { lib_loader_->udev_device_unref(udev_device); } int Udev1Loader::udev_enumerate_add_match_subsystem( udev_enumerate* udev_enumerate, const char* subsystem) { return lib_loader_->udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); } udev_list_entry* Udev1Loader::udev_enumerate_get_list_entry( udev_enumerate* udev_enumerate) { return lib_loader_->udev_enumerate_get_list_entry(udev_enumerate); } udev_enumerate* Udev1Loader::udev_enumerate_new(udev* udev) { return lib_loader_->udev_enumerate_new(udev); } int Udev1Loader::udev_enumerate_scan_devices(udev_enumerate* udev_enumerate) { return lib_loader_->udev_enumerate_scan_devices(udev_enumerate); } void Udev1Loader::udev_enumerate_unref(udev_enumerate* udev_enumerate) { lib_loader_->udev_enumerate_unref(udev_enumerate); } udev_list_entry* Udev1Loader::udev_list_entry_get_next( udev_list_entry* list_entry) { return lib_loader_->udev_list_entry_get_next(list_entry); } const char* Udev1Loader::udev_list_entry_get_name(udev_list_entry* list_entry) { return lib_loader_->udev_list_entry_get_name(list_entry); } int Udev1Loader::udev_monitor_enable_receiving(udev_monitor* udev_monitor) { return lib_loader_->udev_monitor_enable_receiving(udev_monitor); } int Udev1Loader::udev_monitor_filter_add_match_subsystem_devtype( udev_monitor* udev_monitor, const char* subsystem, const char* devtype) { return lib_loader_->udev_monitor_filter_add_match_subsystem_devtype( udev_monitor, subsystem, devtype); } int Udev1Loader::udev_monitor_get_fd(udev_monitor* udev_monitor) { return lib_loader_->udev_monitor_get_fd(udev_monitor); } udev_monitor* Udev1Loader::udev_monitor_new_from_netlink(udev* udev, const char* name) { return lib_loader_->udev_monitor_new_from_netlink(udev, name); } udev_device* Udev1Loader::udev_monitor_receive_device( udev_monitor* udev_monitor) { return lib_loader_->udev_monitor_receive_device(udev_monitor); } void Udev1Loader::udev_monitor_unref(udev_monitor* udev_monitor) { lib_loader_->udev_monitor_unref(udev_monitor); } udev* Udev1Loader::udev_new() { return lib_loader_->udev_new(); } void Udev1Loader::udev_set_log_fn( struct udev* udev, void (*log_fn)(struct udev* udev, int priority, const char* file, int line, const char* fn, const char* format, va_list args)) { return lib_loader_->udev_set_log_fn(udev, log_fn); } void Udev1Loader::udev_set_log_priority(struct udev* udev, int priority) { return lib_loader_->udev_set_log_priority(udev, priority); } void Udev1Loader::udev_unref(udev* udev) { lib_loader_->udev_unref(udev); } } // namespace device
32.506024
80
0.744996
kjthegod
ab7732b7d370e272b69a32289605ea4001fe7b6e
31,194
cpp
C++
elftosb2/ElftosbAST.cpp
eewiki/elftosb
16d0f290f6ae20c646d9cdbf4724237a416a4a18
[ "BSD-3-Clause" ]
2
2017-12-09T15:26:37.000Z
2021-07-03T13:45:28.000Z
elftosb2/ElftosbAST.cpp
eewiki/elftosb
16d0f290f6ae20c646d9cdbf4724237a416a4a18
[ "BSD-3-Clause" ]
1
2019-12-04T20:03:25.000Z
2019-12-04T22:51:51.000Z
elftosb2/ElftosbAST.cpp
eewiki/elftosb
16d0f290f6ae20c646d9cdbf4724237a416a4a18
[ "BSD-3-Clause" ]
5
2015-05-15T14:41:14.000Z
2018-11-08T14:13:33.000Z
/* * File: ElftosbAST.cpp * * Copyright (c) Freescale Semiconductor, Inc. All rights reserved. * See included license file for license details. */ #include "ElftosbAST.h" #include <stdexcept> #include <math.h> #include <assert.h> #include "ElftosbErrors.h" #include "format_string.h" using namespace elftosb; #pragma mark = ASTNode = void ASTNode::printTree(int indent) const { printIndent(indent); printf("%s\n", nodeName().c_str()); } void ASTNode::printIndent(int indent) const { int i; for (i=0; i<indent; ++i) { printf(" "); } } void ASTNode::setLocation(token_loc_t & first, token_loc_t & last) { m_location.m_firstLine = first.m_firstLine; m_location.m_lastLine = last.m_lastLine; } void ASTNode::setLocation(ASTNode * first, ASTNode * last) { m_location.m_firstLine = first->getLocation().m_firstLine; m_location.m_lastLine = last->getLocation().m_lastLine; } #pragma mark = ListASTNode = ListASTNode::ListASTNode(const ListASTNode & other) : ASTNode(other), m_list() { // deep copy each item of the original's list const_iterator it = other.begin(); for (; it != other.end(); ++it) { m_list.push_back((*it)->clone()); } } //! Deletes child node in the list. //! ListASTNode::~ListASTNode() { iterator it = begin(); for (; it != end(); it++) { delete *it; } } //! If \a node is NULL then the list is left unmodified. //! //! The list node's location is automatically updated after the node is added by a call //! to updateLocation(). void ListASTNode::appendNode(ASTNode * node) { if (node) { m_list.push_back(node); updateLocation(); } } void ListASTNode::printTree(int indent) const { ASTNode::printTree(indent); int n = 0; const_iterator it = begin(); for (; it != end(); it++, n++) { printIndent(indent + 1); printf("%d:\n", n); (*it)->printTree(indent + 2); } } void ListASTNode::updateLocation() { token_loc_t current = { 0 }; const_iterator it = begin(); for (; it != end(); it++) { const ASTNode * node = *it; const token_loc_t & loc = node->getLocation(); // handle first node if (current.m_firstLine == 0) { current = loc; continue; } if (loc.m_firstLine < current.m_firstLine) { current.m_firstLine = loc.m_firstLine; } if (loc.m_lastLine > current.m_lastLine) { current.m_lastLine = loc.m_lastLine; } } setLocation(current); } #pragma mark = CommandFileASTNode = CommandFileASTNode::CommandFileASTNode() : ASTNode(), m_options(), m_constants(), m_sources(), m_sections() { } CommandFileASTNode::CommandFileASTNode(const CommandFileASTNode & other) : ASTNode(other), m_options(), m_constants(), m_sources(), m_sections() { m_options = dynamic_cast<ListASTNode*>(other.m_options->clone()); m_constants = dynamic_cast<ListASTNode*>(other.m_constants->clone()); m_sources = dynamic_cast<ListASTNode*>(other.m_sources->clone()); m_sections = dynamic_cast<ListASTNode*>(other.m_sections->clone()); } void CommandFileASTNode::printTree(int indent) const { ASTNode::printTree(indent); printIndent(indent + 1); printf("options:\n"); if (m_options) m_options->printTree(indent + 2); printIndent(indent + 1); printf("constants:\n"); if (m_constants) m_constants->printTree(indent + 2); printIndent(indent + 1); printf("sources:\n"); if (m_sources) m_sources->printTree(indent + 2); printIndent(indent + 1); printf("sections:\n"); if (m_sections) m_sections->printTree(indent + 2); } #pragma mark = ExprASTNode = int_size_t ExprASTNode::resultIntSize(int_size_t a, int_size_t b) { int_size_t result; switch (a) { case kWordSize: result = kWordSize; break; case kHalfWordSize: if (b == kWordSize) { result = kWordSize; } else { result = kHalfWordSize; } break; case kByteSize: if (b == kWordSize) { result = kWordSize; } else if (b == kHalfWordSize) { result = kHalfWordSize; } else { result = kByteSize; } break; } return result; } #pragma mark = IntConstExprASTNode = IntConstExprASTNode::IntConstExprASTNode(const IntConstExprASTNode & other) : ExprASTNode(other), m_value(other.m_value), m_size(other.m_size) { } void IntConstExprASTNode::printTree(int indent) const { printIndent(indent); char sizeChar='?'; switch (m_size) { case kWordSize: sizeChar = 'w'; break; case kHalfWordSize: sizeChar = 'h'; break; case kByteSize: sizeChar = 'b'; break; } printf("%s(%d:%c)\n", nodeName().c_str(), m_value, sizeChar); } #pragma mark = VariableExprASTNode = VariableExprASTNode::VariableExprASTNode(const VariableExprASTNode & other) : ExprASTNode(other), m_variable() { m_variable = new std::string(*other.m_variable); } void VariableExprASTNode::printTree(int indent) const { printIndent(indent); printf("%s(%s)\n", nodeName().c_str(), m_variable->c_str()); } ExprASTNode * VariableExprASTNode::reduce(EvalContext & context) { if (!context.isVariableDefined(*m_variable)) { throw std::runtime_error(format_string("line %d: undefined variable '%s'", getFirstLine(), m_variable->c_str())); } uint32_t value = context.getVariableValue(*m_variable); int_size_t size = context.getVariableSize(*m_variable); return new IntConstExprASTNode(value, size); } #pragma mark = SymbolRefExprASTNode = SymbolRefExprASTNode::SymbolRefExprASTNode(const SymbolRefExprASTNode & other) : ExprASTNode(other), m_symbol(NULL) { if (other.m_symbol) { m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone()); } } void SymbolRefExprASTNode::printTree(int indent) const { } ExprASTNode * SymbolRefExprASTNode::reduce(EvalContext & context) { EvalContext::SourceFileManager * manager = context.getSourceFileManager(); if (!manager) { throw std::runtime_error("no source manager available"); } if (!m_symbol) { throw semantic_error("no symbol provided"); } // Get the name of the symbol std::string * symbolName = m_symbol->getSymbolName(); // if (!symbolName) // { // throw semantic_error(format_string("line %d: no symbol name provided", getFirstLine())); // } // Get the source file. std::string * sourceName = m_symbol->getSource(); SourceFile * sourceFile; if (sourceName) { sourceFile = manager->getSourceFile(*sourceName); if (!sourceFile) { throw semantic_error(format_string("line %d: no source file named %s", getFirstLine(), sourceName->c_str())); } } else { sourceFile = manager->getDefaultSourceFile(); if (!sourceFile) { throw semantic_error(format_string("line %d: no default source file is set", getFirstLine())); } } // open the file if it hasn't already been if (!sourceFile->isOpen()) { sourceFile->open(); } // Make sure the source file supports symbols before going any further if (symbolName && !sourceFile->supportsNamedSymbols()) { throw semantic_error(format_string("line %d: source file %s does not support symbols", getFirstLine(), sourceFile->getPath().c_str())); } if (!symbolName && !sourceFile->hasEntryPoint()) { throw semantic_error(format_string("line %d: source file %s does not have an entry point", getFirstLine(), sourceFile->getPath().c_str())); } // Returns a const expr node with the symbol's value. uint32_t value; if (symbolName) { value = sourceFile->getSymbolValue(*symbolName); } else { value = sourceFile->getEntryPointAddress(); } return new IntConstExprASTNode(value); } #pragma mark = NegativeExprASTNode = NegativeExprASTNode::NegativeExprASTNode(const NegativeExprASTNode & other) : ExprASTNode(other), m_expr() { m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone()); } void NegativeExprASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); if (m_expr) m_expr->printTree(indent + 1); } ExprASTNode * NegativeExprASTNode::reduce(EvalContext & context) { if (!m_expr) { return this; } m_expr = m_expr->reduce(context); IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get()); if (intConst) { int32_t value = -(int32_t)intConst->getValue(); return new IntConstExprASTNode((uint32_t)value, intConst->getSize()); } else { return this; } } #pragma mark = BooleanNotExprASTNode = BooleanNotExprASTNode::BooleanNotExprASTNode(const BooleanNotExprASTNode & other) : ExprASTNode(other), m_expr() { m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone()); } void BooleanNotExprASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); if (m_expr) m_expr->printTree(indent + 1); } ExprASTNode * BooleanNotExprASTNode::reduce(EvalContext & context) { if (!m_expr) { return this; } m_expr = m_expr->reduce(context); IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get()); if (intConst) { int32_t value = !((int32_t)intConst->getValue()); return new IntConstExprASTNode((uint32_t)value, intConst->getSize()); } else { throw semantic_error(format_string("line %d: expression did not evaluate to an integer", m_expr->getFirstLine())); } } #pragma mark = SourceFileFunctionASTNode = SourceFileFunctionASTNode::SourceFileFunctionASTNode(const SourceFileFunctionASTNode & other) : ExprASTNode(other), m_functionName(), m_sourceFile() { m_functionName = new std::string(*other.m_functionName); m_sourceFile = new std::string(*other.m_sourceFile); } void SourceFileFunctionASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); printIndent(indent+1); // for some stupid reason the msft C++ compiler barfs on the following line if the ".get()" parts are remove, // even though the first line of reduce() below has the same expression, just in parentheses. stupid compiler. if (m_functionName.get() && m_sourceFile.get()) { printf("%s ( %s )\n", m_functionName->c_str(), m_sourceFile->c_str()); } } ExprASTNode * SourceFileFunctionASTNode::reduce(EvalContext & context) { if (!(m_functionName && m_sourceFile)) { throw std::runtime_error("unset function name or source file"); } // Get source file manager from evaluation context. This will be the // conversion controller itself. EvalContext::SourceFileManager * mgr = context.getSourceFileManager(); if (!mgr) { throw std::runtime_error("source file manager is not set"); } // Perform function uint32_t functionResult = 0; if (*m_functionName == "exists") { functionResult = static_cast<uint32_t>(mgr->hasSourceFile(*m_sourceFile)); } // Return function result as an expression node return new IntConstExprASTNode(functionResult); } #pragma mark = DefinedOperatorASTNode = DefinedOperatorASTNode::DefinedOperatorASTNode(const DefinedOperatorASTNode & other) : ExprASTNode(other), m_constantName() { m_constantName = new std::string(*other.m_constantName); } void DefinedOperatorASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); printIndent(indent+1); if (m_constantName) { printf("defined ( %s )\n", m_constantName->c_str()); } } ExprASTNode * DefinedOperatorASTNode::reduce(EvalContext & context) { assert(m_constantName); // Return function result as an expression node return new IntConstExprASTNode(context.isVariableDefined(m_constantName) ? 1 : 0); } #pragma mark = SizeofOperatorASTNode = SizeofOperatorASTNode::SizeofOperatorASTNode(const SizeofOperatorASTNode & other) : ExprASTNode(other), m_constantName(), m_symbol() { m_constantName = new std::string(*other.m_constantName); m_symbol = dynamic_cast<SymbolASTNode*>(other.m_symbol->clone()); } void SizeofOperatorASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); printIndent(indent+1); if (m_constantName) { printf("sizeof: %s\n", m_constantName->c_str()); } else if (m_symbol) { printf("sizeof:\n"); m_symbol->printTree(indent + 2); } } ExprASTNode * SizeofOperatorASTNode::reduce(EvalContext & context) { // One or the other must be defined. assert(m_constantName || m_symbol); EvalContext::SourceFileManager * manager = context.getSourceFileManager(); assert(manager); unsigned sizeInBytes = 0; SourceFile * sourceFile; if (m_symbol) { // Get the symbol name. std::string * symbolName = m_symbol->getSymbolName(); assert(symbolName); // Get the source file, using the default if one is not specified. std::string * sourceName = m_symbol->getSource(); if (sourceName) { sourceFile = manager->getSourceFile(*sourceName); if (!sourceFile) { throw semantic_error(format_string("line %d: invalid source file: %s", getFirstLine(), sourceName->c_str())); } } else { sourceFile = manager->getDefaultSourceFile(); if (!sourceFile) { throw semantic_error(format_string("line %d: no default source file is set", getFirstLine())); } } // Get the size of the symbol. if (sourceFile->hasSymbol(*symbolName)) { sizeInBytes = sourceFile->getSymbolSize(*symbolName); } } else if (m_constantName) { // See if the "constant" is really a constant or if it's a source name. if (manager->hasSourceFile(m_constantName)) { sourceFile = manager->getSourceFile(m_constantName); if (sourceFile) { sizeInBytes = sourceFile->getSize(); } } else { // Regular constant. if (!context.isVariableDefined(*m_constantName)) { throw semantic_error(format_string("line %d: cannot get size of undefined constant %s", getFirstLine(), m_constantName->c_str())); } int_size_t intSize = context.getVariableSize(*m_constantName); switch (intSize) { case kWordSize: sizeInBytes = sizeof(uint32_t); break; case kHalfWordSize: sizeInBytes = sizeof(uint16_t); break; case kByteSize: sizeInBytes = sizeof(uint8_t); break; } } } // Return function result as an expression node return new IntConstExprASTNode(sizeInBytes); } #pragma mark = BinaryOpExprASTNode = BinaryOpExprASTNode::BinaryOpExprASTNode(const BinaryOpExprASTNode & other) : ExprASTNode(other), m_left(), m_op(other.m_op), m_right() { m_left = dynamic_cast<ExprASTNode*>(other.m_left->clone()); m_right = dynamic_cast<ExprASTNode*>(other.m_right->clone()); } void BinaryOpExprASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); printIndent(indent + 1); printf("left:\n"); if (m_left) m_left->printTree(indent + 2); printIndent(indent + 1); printf("op: %s\n", getOperatorName().c_str()); printIndent(indent + 1); printf("right:\n"); if (m_right) m_right->printTree(indent + 2); } std::string BinaryOpExprASTNode::getOperatorName() const { switch (m_op) { case kAdd: return "+"; case kSubtract: return "-"; case kMultiply: return "*"; case kDivide: return "/"; case kModulus: return "%"; case kPower: return "**"; case kBitwiseAnd: return "&"; case kBitwiseOr: return "|"; case kBitwiseXor: return "^"; case kShiftLeft: return "<<"; case kShiftRight: return ">>"; case kLessThan: return "<"; case kGreaterThan: return ">"; case kLessThanEqual: return "<="; case kGreaterThanEqual: return ">"; case kEqual: return "=="; case kNotEqual: return "!="; case kBooleanAnd: return "&&"; case kBooleanOr: return "||"; } return "???"; } //! \todo Fix power operator under windows!!! //! ExprASTNode * BinaryOpExprASTNode::reduce(EvalContext & context) { if (!m_left || !m_right) { return this; } IntConstExprASTNode * leftIntConst = NULL; IntConstExprASTNode * rightIntConst = NULL; uint32_t leftValue; uint32_t rightValue; uint32_t result = 0; // Always reduce the left hand side. m_left = m_left->reduce(context); leftIntConst = dynamic_cast<IntConstExprASTNode*>(m_left.get()); if (!leftIntConst) { throw semantic_error(format_string("left hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str())); } leftValue = leftIntConst->getValue(); // Boolean && and || operators are handled separately so that we can perform // short-circuit evaluation. if (m_op == kBooleanAnd || m_op == kBooleanOr) { // Reduce right hand side only if required to evaluate the boolean operator. if ((m_op == kBooleanAnd && leftValue != 0) || (m_op == kBooleanOr && leftValue == 0)) { m_right = m_right->reduce(context); rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get()); if (!rightIntConst) { throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str())); } rightValue = rightIntConst->getValue(); // Perform the boolean operation. switch (m_op) { case kBooleanAnd: result = leftValue && rightValue; break; case kBooleanOr: result = leftValue && rightValue; break; } } else if (m_op == kBooleanAnd) { // The left hand side is false, so the && operator's result must be false // without regard to the right hand side. result = 0; } else if (m_op == kBooleanOr) { // The left hand value is true so the || result is automatically true. result = 1; } } else { // Reduce right hand side always for most operators. m_right = m_right->reduce(context); rightIntConst = dynamic_cast<IntConstExprASTNode*>(m_right.get()); if (!rightIntConst) { throw semantic_error(format_string("right hand side of %s operator failed to evaluate to an integer", getOperatorName().c_str())); } rightValue = rightIntConst->getValue(); switch (m_op) { case kAdd: result = leftValue + rightValue; break; case kSubtract: result = leftValue - rightValue; break; case kMultiply: result = leftValue * rightValue; break; case kDivide: result = leftValue / rightValue; break; case kModulus: result = leftValue % rightValue; break; case kPower: #ifdef WIN32 result = 0; #else result = lroundf(powf(float(leftValue), float(rightValue))); #endif break; case kBitwiseAnd: result = leftValue & rightValue; break; case kBitwiseOr: result = leftValue | rightValue; break; case kBitwiseXor: result = leftValue ^ rightValue; break; case kShiftLeft: result = leftValue << rightValue; break; case kShiftRight: result = leftValue >> rightValue; break; case kLessThan: result = leftValue < rightValue; break; case kGreaterThan: result = leftValue > rightValue; break; case kLessThanEqual: result = leftValue <= rightValue; break; case kGreaterThanEqual: result = leftValue >= rightValue; break; case kEqual: result = leftValue == rightValue; break; case kNotEqual: result = leftValue != rightValue; break; } } // Create the result value. int_size_t resultSize; if (leftIntConst && rightIntConst) { resultSize = resultIntSize(leftIntConst->getSize(), rightIntConst->getSize()); } else if (leftIntConst) { resultSize = leftIntConst->getSize(); } else { // This shouldn't really be possible, but just in case. resultSize = kWordSize; } return new IntConstExprASTNode(result, resultSize); } #pragma mark = IntSizeExprASTNode = IntSizeExprASTNode::IntSizeExprASTNode(const IntSizeExprASTNode & other) : ExprASTNode(other), m_expr(), m_size(other.m_size) { m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone()); } void IntSizeExprASTNode::printTree(int indent) const { ExprASTNode::printTree(indent); char sizeChar='?'; switch (m_size) { case kWordSize: sizeChar = 'w'; break; case kHalfWordSize: sizeChar = 'h'; break; case kByteSize: sizeChar = 'b'; break; } printIndent(indent + 1); printf("size: %c\n", sizeChar); printIndent(indent + 1); printf("expr:\n"); if (m_expr) m_expr->printTree(indent + 2); } ExprASTNode * IntSizeExprASTNode::reduce(EvalContext & context) { if (!m_expr) { return this; } m_expr = m_expr->reduce(context); IntConstExprASTNode * intConst = dynamic_cast<IntConstExprASTNode*>(m_expr.get()); if (!intConst) { return this; } return new IntConstExprASTNode(intConst->getValue(), m_size); } #pragma mark = ExprConstASTNode = ExprConstASTNode::ExprConstASTNode(const ExprConstASTNode & other) : ConstASTNode(other), m_expr() { m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone()); } void ExprConstASTNode::printTree(int indent) const { ConstASTNode::printTree(indent); if (m_expr) m_expr->printTree(indent + 1); } #pragma mark = StringConstASTNode = StringConstASTNode::StringConstASTNode(const StringConstASTNode & other) : ConstASTNode(other), m_value() { m_value = new std::string(other.m_value); } void StringConstASTNode::printTree(int indent) const { printIndent(indent); printf("%s(%s)\n", nodeName().c_str(), m_value->c_str()); } #pragma mark = BlobConstASTNode = BlobConstASTNode::BlobConstASTNode(const BlobConstASTNode & other) : ConstASTNode(other), m_blob() { m_blob = new Blob(*other.m_blob); } void BlobConstASTNode::printTree(int indent) const { printIndent(indent); const uint8_t * dataPtr = m_blob->getData(); unsigned dataLen = m_blob->getLength(); printf("%s(%p:%d)\n", nodeName().c_str(), dataPtr, dataLen); } #pragma mark = IVTConstASTNode = IVTConstASTNode::IVTConstASTNode(const IVTConstASTNode & other) : ConstASTNode(other), m_fields() { m_fields = dynamic_cast<ListASTNode*>(other.m_fields->clone()); } void IVTConstASTNode::printTree(int indent) const { printIndent(indent); printf("%s:\n", nodeName().c_str()); if (m_fields) { m_fields->printTree(indent + 1); } } #pragma mark = AssignmentASTNode = AssignmentASTNode::AssignmentASTNode(const AssignmentASTNode & other) : ASTNode(other), m_ident(), m_value() { m_ident = new std::string(*other.m_ident); m_value = dynamic_cast<ConstASTNode*>(other.m_value->clone()); } void AssignmentASTNode::printTree(int indent) const { printIndent(indent); printf("%s(%s)\n", nodeName().c_str(), m_ident->c_str()); if (m_value) m_value->printTree(indent + 1); } #pragma mark = SourceDefASTNode = SourceDefASTNode::SourceDefASTNode(const SourceDefASTNode & other) : ASTNode(other), m_name() { m_name = new std::string(*other.m_name); } #pragma mark = PathSourceDefASTNode = PathSourceDefASTNode::PathSourceDefASTNode(const PathSourceDefASTNode & other) : SourceDefASTNode(other), m_path() { m_path = new std::string(*other.m_path); } void PathSourceDefASTNode::printTree(int indent) const { SourceDefASTNode::printTree(indent); printIndent(indent+1); printf("path: %s\n", m_path->c_str()); printIndent(indent+1); printf("attributes:\n"); if (m_attributes) { m_attributes->printTree(indent+2); } } #pragma mark = ExternSourceDefASTNode = ExternSourceDefASTNode::ExternSourceDefASTNode(const ExternSourceDefASTNode & other) : SourceDefASTNode(other), m_expr() { m_expr = dynamic_cast<ExprASTNode*>(other.m_expr->clone()); } void ExternSourceDefASTNode::printTree(int indent) const { SourceDefASTNode::printTree(indent); printIndent(indent+1); printf("expr:\n"); if (m_expr) m_expr->printTree(indent + 2); printIndent(indent+1); printf("attributes:\n"); if (m_attributes) { m_attributes->printTree(indent+2); } } #pragma mark = SectionContentsASTNode = SectionContentsASTNode::SectionContentsASTNode(const SectionContentsASTNode & other) : ASTNode(other), m_sectionExpr() { m_sectionExpr = dynamic_cast<ExprASTNode*>(other.m_sectionExpr->clone()); } void SectionContentsASTNode::printTree(int indent) const { ASTNode::printTree(indent); printIndent(indent + 1); printf("section#:\n"); if (m_sectionExpr) m_sectionExpr->printTree(indent + 2); } #pragma mark = DataSectionContentsASTNode = DataSectionContentsASTNode::DataSectionContentsASTNode(const DataSectionContentsASTNode & other) : SectionContentsASTNode(other), m_contents() { m_contents = dynamic_cast<ASTNode*>(other.m_contents->clone()); } void DataSectionContentsASTNode::printTree(int indent) const { SectionContentsASTNode::printTree(indent); if (m_contents) { m_contents->printTree(indent + 1); } } #pragma mark = BootableSectionContentsASTNode = BootableSectionContentsASTNode::BootableSectionContentsASTNode(const BootableSectionContentsASTNode & other) : SectionContentsASTNode(other), m_statements() { m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone()); } void BootableSectionContentsASTNode::printTree(int indent) const { SectionContentsASTNode::printTree(indent); printIndent(indent + 1); printf("statements:\n"); if (m_statements) m_statements->printTree(indent + 2); } #pragma mark = IfStatementASTNode = //! \warning Be careful; this method could enter an infinite loop if m_nextIf feeds //! back onto itself. m_nextIf must be NULL at some point down the next if list. IfStatementASTNode::IfStatementASTNode(const IfStatementASTNode & other) : StatementASTNode(), m_conditionExpr(), m_ifStatements(), m_nextIf(), m_elseStatements() { m_conditionExpr = dynamic_cast<ExprASTNode*>(other.m_conditionExpr->clone()); m_ifStatements = dynamic_cast<ListASTNode*>(other.m_ifStatements->clone()); m_nextIf = dynamic_cast<IfStatementASTNode*>(other.m_nextIf->clone()); m_elseStatements = dynamic_cast<ListASTNode*>(other.m_elseStatements->clone()); } #pragma mark = ModeStatementASTNode = ModeStatementASTNode::ModeStatementASTNode(const ModeStatementASTNode & other) : StatementASTNode(other), m_modeExpr() { m_modeExpr = dynamic_cast<ExprASTNode*>(other.m_modeExpr->clone()); } void ModeStatementASTNode::printTree(int indent) const { StatementASTNode::printTree(indent); printIndent(indent + 1); printf("mode:\n"); if (m_modeExpr) m_modeExpr->printTree(indent + 2); } #pragma mark = MessageStatementASTNode = MessageStatementASTNode::MessageStatementASTNode(const MessageStatementASTNode & other) : StatementASTNode(other), m_type(other.m_type), m_message() { m_message = new std::string(*other.m_message); } void MessageStatementASTNode::printTree(int indent) const { StatementASTNode::printTree(indent); printIndent(indent + 1); printf("%s: %s\n", getTypeName(), m_message->c_str()); } const char * MessageStatementASTNode::getTypeName() const { switch (m_type) { case kInfo: return "info"; case kWarning: return "warning"; case kError: return "error"; } return "unknown"; } #pragma mark = LoadStatementASTNode = LoadStatementASTNode::LoadStatementASTNode(const LoadStatementASTNode & other) : StatementASTNode(other), m_data(), m_target(), m_isDCDLoad(other.m_isDCDLoad) { m_data = other.m_data->clone(); m_target = other.m_target->clone(); } void LoadStatementASTNode::printTree(int indent) const { StatementASTNode::printTree(indent); printIndent(indent + 1); printf("data:\n"); if (m_data) m_data->printTree(indent + 2); printIndent(indent + 1); printf("target:\n"); if (m_target) m_target->printTree(indent + 2); } #pragma mark = CallStatementASTNode = CallStatementASTNode::CallStatementASTNode(const CallStatementASTNode & other) : StatementASTNode(other), m_type(other.m_type), m_target(), m_arg() { m_target = other.m_target->clone(); m_arg = other.m_arg->clone(); } void CallStatementASTNode::printTree(int indent) const { printIndent(indent); printf("%s(%s)%s\n", nodeName().c_str(), (m_type == kCallType ? "call" : "jump"), (m_isHAB ? "/HAB" : "")); printIndent(indent + 1); printf("target:\n"); if (m_target) m_target->printTree(indent + 2); printIndent(indent + 1); printf("arg:\n"); if (m_arg) m_arg->printTree(indent + 2); } #pragma mark = SourceASTNode = SourceASTNode::SourceASTNode(const SourceASTNode & other) : ASTNode(other), m_name() { m_name = new std::string(*other.m_name); } void SourceASTNode::printTree(int indent) const { printIndent(indent); printf("%s(%s)\n", nodeName().c_str(), m_name->c_str()); } #pragma mark = SectionMatchListASTNode = SectionMatchListASTNode::SectionMatchListASTNode(const SectionMatchListASTNode & other) : ASTNode(other), m_sections(), m_source() { if (other.m_sections) { m_sections = dynamic_cast<ListASTNode *>(other.m_sections->clone()); } if (other.m_source) { m_source = new std::string(*other.m_source); } } void SectionMatchListASTNode::printTree(int indent) const { ASTNode::printTree(indent); printIndent(indent+1); printf("sections:\n"); if (m_sections) { m_sections->printTree(indent+2); } printIndent(indent+1); printf("source: ", m_source->c_str()); if (m_source) { printf("%s\n", m_source->c_str()); } else { printf("\n"); } } #pragma mark = SectionASTNode = SectionASTNode::SectionASTNode(const SectionASTNode & other) : ASTNode(other), m_name(), m_source() { m_action = other.m_action; if (other.m_name) { m_name = new std::string(*other.m_name); } if (other.m_source) { m_source = new std::string(*other.m_source); } } void SectionASTNode::printTree(int indent) const { printIndent(indent); const char * actionName; switch (m_action) { case kInclude: actionName = "include"; break; case kExclude: actionName = "exclude"; break; } if (m_source) { printf("%s(%s:%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str(), m_source->c_str()); } else { printf("%s(%s:%s)\n", nodeName().c_str(), actionName, m_name->c_str()); } } #pragma mark = SymbolASTNode = SymbolASTNode::SymbolASTNode(const SymbolASTNode & other) : ASTNode(other), m_symbol(), m_source() { m_symbol = new std::string(*other.m_symbol); m_source = new std::string(*other.m_source); } void SymbolASTNode::printTree(int indent) const { printIndent(indent); const char * symbol = NULL; if (m_symbol) { symbol = m_symbol->c_str(); } const char * source = NULL; if (m_source) { source = m_source->c_str(); } printf("%s(", nodeName().c_str()); if (source) { printf(source); } else { printf("."); } printf(":"); if (symbol) { printf(symbol); } else { printf("."); } printf(")\n"); } #pragma mark = AddressRangeASTNode = AddressRangeASTNode::AddressRangeASTNode(const AddressRangeASTNode & other) : ASTNode(other), m_begin(), m_end() { m_begin = other.m_begin->clone(); m_end = other.m_end->clone(); } void AddressRangeASTNode::printTree(int indent) const { ASTNode::printTree(indent); printIndent(indent + 1); printf("begin:\n"); if (m_begin) m_begin->printTree(indent + 2); printIndent(indent + 1); printf("end:\n"); if (m_end) m_end->printTree(indent + 2); } #pragma mark = FromStatementASTNode = FromStatementASTNode::FromStatementASTNode(std::string * source, ListASTNode * statements) : StatementASTNode(), m_source(source), m_statements(statements) { } FromStatementASTNode::FromStatementASTNode(const FromStatementASTNode & other) : StatementASTNode(), m_source(), m_statements() { m_source = new std::string(*other.m_source); m_statements = dynamic_cast<ListASTNode*>(other.m_statements->clone()); } void FromStatementASTNode::printTree(int indent) const { ASTNode::printTree(indent); printIndent(indent + 1); printf("source: "); if (m_source) printf("%s\n", m_source->c_str()); printIndent(indent + 1); printf("statements:\n"); if (m_statements) m_statements->printTree(indent + 2); }
23.055432
147
0.704046
eewiki
ab7962bec0dcc9793a9c4f0efce9e4fe650472ac
780
cpp
C++
events/gamepad_button_up_event.cpp
MrTAB/aabGameEngine
dc51c6e443bf087ca10e14e6884e4dfa6caef4a8
[ "MIT" ]
null
null
null
events/gamepad_button_up_event.cpp
MrTAB/aabGameEngine
dc51c6e443bf087ca10e14e6884e4dfa6caef4a8
[ "MIT" ]
null
null
null
events/gamepad_button_up_event.cpp
MrTAB/aabGameEngine
dc51c6e443bf087ca10e14e6884e4dfa6caef4a8
[ "MIT" ]
null
null
null
/** * * gamepad_button_up_event.cpp * **/ #include"gamepad_button_up_event.hpp" #include<sdl.h> #include<cmath> namespace aab { namespace events{ GamepadButtonUpEvent::GamepadButtonUpEvent (InternalEvent internalEvent) : Event (getClassEventType ()) { SDL_Event * event = static_cast <SDL_Event *> (internalEvent-> getReference ()); id = event-> jbutton.which; button = event-> jbutton.button; } GamepadButtonUpEvent::~GamepadButtonUpEvent () throw () { // nothing // } int GamepadButtonUpEvent::getGamePadId () const { return id; } int GamepadButtonUpEvent::getButton () const { return button; } EventType GamepadButtonUpEvent::getClassEventType () { return gamepad_button_up_event; } } // events } // aab
15.6
104
0.682051
MrTAB
ab79f13cc8f1473c2074e26fe6d2ff83e4c33844
3,777
cpp
C++
QHTML_Static/qhtm/HTMLImage.cpp
karolbe/DSS
5a834561fbe7345d0be36f41ed8620ebbdb2f222
[ "BSD-3-Clause" ]
null
null
null
QHTML_Static/qhtm/HTMLImage.cpp
karolbe/DSS
5a834561fbe7345d0be36f41ed8620ebbdb2f222
[ "BSD-3-Clause" ]
null
null
null
QHTML_Static/qhtm/HTMLImage.cpp
karolbe/DSS
5a834561fbe7345d0be36f41ed8620ebbdb2f222
[ "BSD-3-Clause" ]
1
2020-06-28T19:21:22.000Z
2020-06-28T19:21:22.000Z
/*---------------------------------------------------------------------- Copyright (c) 1998 Gipsysoft. All Rights Reserved. Please see the file "licence.txt" for licencing details. File: HTMLImage.cpp Owner: russf@gipsysoft.com Purpose: HTML Image object ----------------------------------------------------------------------*/ #include "stdafx.h" #include "HTMLParse.h" #include "defaults.h" #include "HTMLSectionCreator.h" #include "HTMLImageSection.h" CHTMLImage::CHTMLImage( int nWidth, int nHeight, int nBorder, LPCTSTR pcszFilename, CStyle::Align alg, CQHTMImageABC *pImage, const CStaticString &strALTText ) : CHTMLParagraphObject( CHTMLParagraphObject::knNone ) , m_nWidth( nWidth ) , m_nHeight( nHeight ) , m_nBorder( nBorder ) , m_strFilename( pcszFilename ) , m_alg( alg ) , m_pImage( pImage ) , m_strALTText( strALTText.GetData(), strALTText.GetLength() ) { } CHTMLImage::~CHTMLImage() { // Since images are cached in the document, they are not owned here. // This object just points to the image in the document. // delete m_pImage; } #ifdef _DEBUG void CHTMLImage::Dump() const { TRACENL( _T("Image\n") ); TRACENL( _T("\tName(%s)\n"), (LPCTSTR)m_strFilename ); TRACENL( _T("\t Width(%d)\n"), m_nWidth ); TRACENL( _T("\t Height(%d)\n"), m_nHeight ); TRACENL( _T("\tAlignment (%s)\n"), GetStringFromAlignment( m_alg ) ); } #endif // _DEBUG void CHTMLImage::AddDisplayElements( class CHTMLSectionCreator *psc ) { #ifdef QHTM_BUILD_INTERNAL_IMAGING ASSERT( m_pImage ); WinHelper::CSize size( m_pImage->GetSize() ); #else // QHTM_BUILD_INTERNAL_IMAGING WinHelper::CSize size( 100, 100 ); if( m_pImage ) size = m_pImage->GetSize(); #endif // QHTM_BUILD_INTERNAL_IMAGING if( psc->GetDC().IsPrinting() ) size = psc->GetDC().Scale( size ); int nWidth = m_nWidth; int nHeight = m_nHeight; const int nBorder = m_nBorder; if( nWidth == 0 ) { nWidth = size.cx; } else if( nWidth < 0 ) { nWidth = psc->GetCurrentWidth(); } else { nWidth = psc->GetDC().ScaleX( nWidth ); } if( nHeight == 0 ) nHeight = size.cy; else nHeight = psc->GetDC().ScaleY( nHeight ); nWidth += psc->GetDC().ScaleX(nBorder * 2); nHeight += psc->GetDC().ScaleY(nBorder * 2); int nTop = psc->GetCurrentYPos(); int nBaseline = nHeight; if( nWidth > psc->GetRightMargin() - psc->GetCurrentXPos() ) { psc->CarriageReturn( true ); nTop = psc->GetCurrentYPos(); } int nLeft = psc->GetCurrentXPos(); switch( m_alg ) { case CStyle::algBottom: break; case CStyle::algCentre: case CStyle::algMiddle: nBaseline = nHeight / 2; break; case CStyle::algTop: nBaseline = psc->GetDC().GetCurrentFontBaseline(); break; case CStyle::algLeft: { nLeft = psc->GetLeftMargin(); psc->AddNewLeftMargin( nLeft + nWidth + g_defaults.m_nImageMargin, psc->GetCurrentYPos() + nHeight ); if( psc->GetCurrentXPos() == nLeft ) psc->SetCurrentXPos( psc->GetLeftMargin() ); } break; case CStyle::algRight: { nLeft = psc->GetRightMargin() - nWidth; psc->AddNewRightMargin( nLeft - g_defaults.m_nImageMargin, psc->GetCurrentYPos() + nHeight ); } break; } CHTMLImageSection *pImageSection = (CHTMLImageSection *)psc->GetHTMLSection()->GetKeeperItemByID( m_uID ); if( !pImageSection ) { pImageSection = new CHTMLImageSection( psc->GetHTMLSection(), m_pImage, nBorder ); pImageSection->SetID( m_uID ); pImageSection->SetElementID( m_strElementID ); } if( m_strALTText.GetLength() ) { pImageSection->SetTipText( m_strALTText ); } psc->AddSection( pImageSection ); pImageSection->Set( nLeft, nTop, nLeft + nWidth, nTop + nHeight ); if( m_alg != CStyle::algLeft && m_alg != CStyle::algRight ) { psc->SetCurrentXPos( psc->GetCurrentXPos() + nWidth ); psc->AddBaseline( nBaseline ); } }
24.367742
159
0.664019
karolbe
ab82d063b854806f86cda0b52643df818c412182
1,479
cpp
C++
Jarawi/sol.cpp
papachristoumarios/IEEEXtreme11.0
4c3b5aaa71641a6d0b3e9823c4738050f2553b27
[ "MIT" ]
13
2018-10-11T14:13:56.000Z
2022-02-17T18:30:17.000Z
Jarawi/sol.cpp
papachristoumarios/IEEEXtreme11.0-PComplete
4c3b5aaa71641a6d0b3e9823c4738050f2553b27
[ "MIT" ]
null
null
null
Jarawi/sol.cpp
papachristoumarios/IEEEXtreme11.0-PComplete
4c3b5aaa71641a6d0b3e9823c4738050f2553b27
[ "MIT" ]
7
2018-10-24T08:36:59.000Z
2021-07-19T18:16:53.000Z
#include <cstdio> #include <cstring> #include <map> #include <vector> using namespace std; map<int, vector<int> > letter_bucket; char p[110]; bool check_suffix(char *p) { int length = strlen(p); int pointer = -1; for(int i = 0; i < length; i++) { if(('a' > p[i]) or ('z' < p[i])) continue; int ans = -1; int letter = p[i]; int left = 0; vector<int> arr = letter_bucket[letter]; int right = arr.size(); while(left <= right) { int middle = (left+right)/2; if (arr[middle] <= pointer) left = middle + 1; else { ans = middle; right = middle - 1; } } if(ans == -1) return false; else pointer = ans; } return true; } void solve() { scanf("%s\n", p); int length = strlen(p); int left = 0; int right = length; int ans; while(left <= right) { int middle = (left+right)/2; bool flag = check_suffix(p + middle); if(flag) { right = middle - 1; ans = middle; } else left = middle + 1; } printf("%d\n", (length - ans)); } int main() { char S[1000009]; int N; scanf("%s\n", S); for(int i = 0; S[i] != '\0'; i++) { letter_bucket[S[i]].push_back(i); } scanf("%d", &N); for(int i = 0; i < N; i++) solve(); }
21.434783
48
0.443543
papachristoumarios
ab834a86dd9e35e1876ba79edde3f1ba4f4ad0f7
7,265
cpp
C++
Common/Foundation/System/StreamParser.cpp
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
2
2017-04-19T01:38:30.000Z
2020-07-31T03:05:32.000Z
Common/Foundation/System/StreamParser.cpp
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
null
null
null
Common/Foundation/System/StreamParser.cpp
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
1
2021-12-29T10:46:12.000Z
2021-12-29T10:46:12.000Z
// // Copyright (C) 2004-2011 by Autodesk, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of version 2.1 of the GNU Lesser // General Public License as published by the Free Software Foundation. // // 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #include "Foundation.h" //------------------------------------------------------------------------- // Constructors and Destructors //------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////// // <summary> // The default constructor for a MgStreamParser object. However, since // this method is protected and this class is merely a wrapper for various // static methods, this constructor should never be called. // </summary> MgStreamParser::MgStreamParser( void ) { }; //------------------------------------------------------------------------- // Public Methods //------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////// // <summary> // This static method reads and consumes the STREAM START header from the // stream encapsulted by the given StreamData* parameter. It sets the // version of the StreamData object during the read. // </summary> // // <param name = "pStreamData"> // A pointer the the StreamData object that encapsulates the incoming and // outgoing stream information. // </param> // // <returns> // Returns true if successful; false otherwise. // </returns> bool MgStreamParser::ParseStreamHeader( MgStreamData* pStreamData ) { ACE_ASSERT( pStreamData ); bool ret = false; if ( pStreamData ) { MgStreamHelper* pHelper = pStreamData->GetStreamHelper(); UINT32 header = 0; MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true , false ); if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamStart == header ) { UINT32 version = 0; stat = pHelper->GetUINT32( version, true, false ); if ( MgStreamHelper::mssDone == stat ) { pStreamData->SetVersion( version ); ret = true; } } if (false == ret) { // The stream may contain garbage when the connection is dropped for // some reason. This exception may be ignored to reduce noise. throw new MgInvalidStreamHeaderException(L"MgStreamParser.ParseStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL); } else if (MgStreamParser::StreamVersion != pStreamData->GetVersion()) { throw new MgStreamIoException(L"MgStreamParser.ParseStreamHeader", __LINE__, __WFILE__, NULL, L"MgInvalidTCPProtocol", NULL); } } return ret; }; /////////////////////////////////////////////////////////////////////////// // <summary> // This static method reads and consumes the DATA header from the // stream encapsulted by the given StreamData* parameter. // </summary> // // <param name = "pStreamData"> // A pointer the the StreamData object that encapsulates the incoming and // outgoing stream information. // </param> // // <returns> // Returns true if successful; false otherwise. // </returns> bool MgStreamParser::ParseDataHeader( MgStreamData* pStreamData ) { ACE_ASSERT( pStreamData ); bool ret = false; if ( pStreamData ) { MgStreamHelper* pHelper = pStreamData->GetStreamHelper(); UINT32 header = 0; MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true, false ); if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamData == header ) { ret = true; } } return ret; }; /////////////////////////////////////////////////////////////////////////// // <summary> // This static method reads and consumes the STREAM END header from the // stream encapsulted by the given StreamData* parameter. // </summary> // // <param name = "pStreamData"> // A pointer the the StreamData object that encapsulates the incoming and // outgoing stream information. // </param> // // <returns> // Returns true if successful; false otherwise. // </returns> bool MgStreamParser::ParseEndHeader( MgStreamData* pStreamData ) { ACE_ASSERT( pStreamData ); bool ret = false; if ( pStreamData ) { MgStreamHelper* pHelper = pStreamData->GetStreamHelper(); UINT32 header = 0; MgStreamHelper::MgStreamStatus stat = pHelper->GetUINT32( header, true, false ); if ( MgStreamHelper::mssDone == stat && MgStreamParser::mshStreamEnd == header ) { ret = true; } } return ret; }; /////////////////////////////////////////////////////////////////////////// // <summary> // This static method writes a STREAM START header to the // stream encapsulted by the given StreamData* parameter. // </summary> // // <param name = "pStreamData"> // A pointer the the StreamData object that encapsulates the incoming and // outgoing stream information. // </param> // // <returns> // Returns true if successful; false otherwise. // </returns> bool MgStreamParser::WriteStreamHeader( MgStreamData* pStreamData ) { ACE_ASSERT ( pStreamData ); bool ret = false; if ( pStreamData ) { MgStreamHelper* pHelper = pStreamData->GetStreamHelper(); MgStreamHelper::MgStreamStatus stat = pHelper->WriteUINT32( MgStreamParser::mshStreamStart ); if ( MgStreamHelper::mssDone == stat ) { //stat = pHelper->WriteUINT32( pStreamData->GetVersion() ); stat = pHelper->WriteUINT32( 1 ); // TODO: majik number ret = ( stat != MgStreamHelper::mssDone ) ? false : true; } } return ret; }; /////////////////////////////////////////////////////////////////////////// // <summary> // This static method writes a STREAM END header to the // stream encapsulted by the given StreamData* parameter. // </summary> // // <param name = "pStreamData"> // A pointer the the StreamData object that encapsulates the incoming and // outgoing stream information. // </param> // // <returns> // Returns true if successful; false otherwise. // </returns> bool MgStreamParser::WriteEndHeader( MgStreamData* pStreamData ) { ACE_ASSERT( pStreamData ); bool ret = false; if ( pStreamData ) { MgStreamHelper* pHelper = pStreamData->GetStreamHelper(); MgStreamHelper::MgStreamStatus stat = pHelper->WriteUINT32( MgStreamParser::mshStreamEnd ); ret = ( stat != MgStreamHelper::mssDone ) ? false : true; } return ret; };
30.145228
101
0.585134
achilex
ab87d68707660a170dc7ba065ec3dbc4c2f401e9
3,267
cpp
C++
src/Particle.cpp
jildertviet/ofxJVisuals
878c5b0e7a7dda49ddb71b3f5d19c13987706a73
[ "MIT" ]
null
null
null
src/Particle.cpp
jildertviet/ofxJVisuals
878c5b0e7a7dda49ddb71b3f5d19c13987706a73
[ "MIT" ]
6
2021-10-16T07:10:04.000Z
2021-12-26T13:23:54.000Z
src/Particle.cpp
jildertviet/ofxJVisuals
878c5b0e7a7dda49ddb71b3f5d19c13987706a73
[ "MIT" ]
null
null
null
// // Particle.cpp // Shapes // // Created by Jildert Viet on 18-02-15. // // #include "Particle.h" Particle::Particle(){ } Particle::Particle(ofVec3f *destination, bool startAtDest){ this->destination = destination; if(startAtDest){ loc = ofVec2f(ofRandom(ofGetWindowWidth()),ofRandom(ofGetWindowHeight())); switch((int)ofRandom(4)){ case 0: loc.x = 0; break; case 1: loc.x = ofGetWindowWidth(); break; case 2: loc.y = 0; break; case 3: loc.y = ofGetWindowHeight(); break; } } else{ loc = *destination; } } Particle::Particle(ofVec2f destination){ loc = ofVec2f(ofRandom(ofGetWindowWidth()), ofRandom(ofGetWindowHeight())); *(this->destination) = destination; } void Particle::display(){ ofSetColor(ofColor::white); ofDrawRectangle(loc, 1, 1); } void Particle::update(){ if(!state){ // Free direction.normalize(); acceleration = direction * 0.5; velocity += acceleration; velocity.limit(topspeed); loc += velocity; // checkBorders(); } else{ // In formation ofVec2f dir2 = *destination - loc; dir2.normalize(); dir2 *= 0.4; acceleration = dir2; velocity += acceleration; if(addNoise){ loc += ofVec2f(ofRandom(-noise_max, noise_max), ofRandom(-noise_max, noise_max)); addNoise = false; } velocity.limit(topspeed); loc += velocity; // So it doesn't vibrate when in formation float distance = loc.squareDistance(*destination); if(distance < 100) velocity *= 0.001; } // checkBorders(); // if(loc.x > ofGetViewportWidth()) { //// cout << ofGetViewportWidth() << endl; // velocity.x *= -1; // direction.x *= -1; // return; // } // if(loc.x < 0){ // velocity.x *= -1; // direction.x *= -1; // return; // } // if (loc.y > ofGetViewportHeight()) { // direction.y *= -1; // velocity.y *= -1; // return; // } // if(loc.y < 0){ // direction.y *= -1; // velocity.y *= -1; // return; // } } void Particle::changeMode(){ state = !state; if(state) direction = ofVec2f( ((int)ofRandom(-8,8)) *0.25, ((int)ofRandom(-8, 8))*0.25 ); } void Particle::locationIsDestination(){ loc = *destination; } void Particle::connectParticle(Particle* p){ // if(checkIfConnected(p)){ connectedParticles.push_back(p); p->connectedParticles.push_back(this); // } } bool Particle::checkIfConnected(Particle* p){ for(int i=0; i<connectedParticles.size(); i++){ if(this==p){ return true; } } return false; } void Particle::clearConnectedParticles(){ connectedParticles.clear(); }
24.380597
98
0.486073
jildertviet
ab8b5c301835727578c7c6061e32396e5d47135b
847
cpp
C++
Clion_Code/Hash/Permutation.cpp
jbapple/Pocket_Dictionary
445e4d6cf8b9f13388fb2f2b66438330a40c02c2
[ "Apache-2.0" ]
null
null
null
Clion_Code/Hash/Permutation.cpp
jbapple/Pocket_Dictionary
445e4d6cf8b9f13388fb2f2b66438330a40c02c2
[ "Apache-2.0" ]
null
null
null
Clion_Code/Hash/Permutation.cpp
jbapple/Pocket_Dictionary
445e4d6cf8b9f13388fb2f2b66438330a40c02c2
[ "Apache-2.0" ]
null
null
null
// // Created by tomer on 11/4/19. // #include <cassert> #include <cstdlib> #include "Permutation.h" Permutation::Permutation(size_t mod) : mod(mod) { // assert (mod <= P31); // size_t index = rand() % 5; size_t index = 0; mult_const = primitive_root_array[index]; mult_inv_const = inv_primitive_root_array[index]; //todo: translate from python the general case. } uint32_t Permutation::get_perm(size_t el) { // if (DB) assert (el < mod); return (el * mult_const) % mod; } uint64_t Permutation::get_perm64(uint64_t el) { // if (DB) assert (el < mod); return (el * mult_const) % mod; } uint32_t Permutation::get_perm_inv(size_t el) { // if (DB) assert (el < mod); return (el * mult_inv_const) % mod; } //uint32_t Permutation::operator()(size_t el) { // assert (el < mod); // return el*mu; //}
22.891892
53
0.638725
jbapple
ab8ef5dca49c8814be008bec053324bf327883c2
7,456
hpp
C++
src/vendor/cget/cget/pkg/pqrs-org__cpp-osx-iokit_types/install/include/pqrs/osx/iokit_types/iokit_hid_usage.hpp
fe7/Karabiner-Elements
fdbf3b47d845e5d225c1d33f9b3c696406d404ba
[ "Unlicense" ]
1
2021-11-09T10:28:50.000Z
2021-11-09T10:28:50.000Z
src/vendor/cget/cget/pkg/pqrs-org__cpp-osx-iokit_types/install/include/pqrs/osx/iokit_types/iokit_hid_usage.hpp
fe7/Karabiner-Elements
fdbf3b47d845e5d225c1d33f9b3c696406d404ba
[ "Unlicense" ]
null
null
null
src/vendor/cget/cget/pkg/pqrs-org__cpp-osx-iokit_types/install/include/pqrs/osx/iokit_types/iokit_hid_usage.hpp
fe7/Karabiner-Elements
fdbf3b47d845e5d225c1d33f9b3c696406d404ba
[ "Unlicense" ]
2
2020-04-27T10:51:37.000Z
2020-09-09T03:44:04.000Z
#pragma once // (C) Copyright Takayama Fumihiko 2018. // Distributed under the Boost Software License, Version 1.0. // (See http://www.boost.org/LICENSE_1_0.txt) #include <IOKit/hid/IOHIDUsageTables.h> #include <functional> #include <iostream> #include <type_safe/strong_typedef.hpp> namespace pqrs { namespace osx { struct iokit_hid_usage : type_safe::strong_typedef<iokit_hid_usage, int32_t>, type_safe::strong_typedef_op::equality_comparison<iokit_hid_usage>, type_safe::strong_typedef_op::relational_comparison<iokit_hid_usage> { using strong_typedef::strong_typedef; }; inline std::ostream& operator<<(std::ostream& stream, const iokit_hid_usage& value) { return stream << type_safe::get(value); } constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_pointer(kHIDUsage_GD_Pointer); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_mouse(kHIDUsage_GD_Mouse); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_keyboard(kHIDUsage_GD_Keyboard); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_keypad(kHIDUsage_GD_Keypad); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_x(kHIDUsage_GD_X); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_y(kHIDUsage_GD_Y); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_z(kHIDUsage_GD_Z); constexpr iokit_hid_usage iokit_hid_usage_generic_desktop_wheel(kHIDUsage_GD_Wheel); constexpr iokit_hid_usage iokit_hid_usage_led_caps_lock(kHIDUsage_LED_CapsLock); constexpr iokit_hid_usage iokit_hid_usage_consumer_consumer_control(kHIDUsage_Csmr_ConsumerControl); constexpr iokit_hid_usage iokit_hid_usage_consumer_power(kHIDUsage_Csmr_Power); constexpr iokit_hid_usage iokit_hid_usage_consumer_display_brightness_increment(kHIDUsage_Csmr_DisplayBrightnessIncrement); constexpr iokit_hid_usage iokit_hid_usage_consumer_display_brightness_decrement(kHIDUsage_Csmr_DisplayBrightnessDecrement); constexpr iokit_hid_usage iokit_hid_usage_consumer_fast_forward(kHIDUsage_Csmr_FastForward); constexpr iokit_hid_usage iokit_hid_usage_consumer_rewind(kHIDUsage_Csmr_Rewind); constexpr iokit_hid_usage iokit_hid_usage_consumer_scan_next_track(kHIDUsage_Csmr_ScanNextTrack); constexpr iokit_hid_usage iokit_hid_usage_consumer_scan_previous_track(kHIDUsage_Csmr_ScanPreviousTrack); constexpr iokit_hid_usage iokit_hid_usage_consumer_eject(kHIDUsage_Csmr_Eject); constexpr iokit_hid_usage iokit_hid_usage_consumer_play_or_pause(kHIDUsage_Csmr_PlayOrPause); constexpr iokit_hid_usage iokit_hid_usage_consumer_mute(kHIDUsage_Csmr_Mute); constexpr iokit_hid_usage iokit_hid_usage_consumer_volume_increment(kHIDUsage_Csmr_VolumeIncrement); constexpr iokit_hid_usage iokit_hid_usage_consumer_volume_decrement(kHIDUsage_Csmr_VolumeDecrement); constexpr iokit_hid_usage iokit_hid_usage_consumer_ac_pan(kHIDUsage_Csmr_ACPan); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case(0x0001); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_display(0x0002); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accelerometer(0x0003); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_ambient_light_sensor(0x0004); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_temperature_sensor(0x0005); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard(0x0006); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_headset(0x0007); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_proximity_sensor(0x0008); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_gyro(0x0009); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_compass(0x000A); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_device_management(0x000B); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_trackpad(0x000C); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_reserved(0x000D); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_motion(0x000E); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_backlight(0x000F); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_device_motion_lite(0x0010); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_force(0x0011); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_bluetooth_radio(0x0012); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_orb(0x0013); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accessory_battery(0x0014); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_humidity(0x0015); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_hid_event_relay(0x0016); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event(0x0017); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event_translated(0x0018); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_nx_event_diagnostic(0x0019); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_homer(0x0020); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_color(0x0021); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_accessibility(0x0022); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_spotlight(0x0001); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_dashboard(0x0002); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_function(0x0003); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_launchpad(0x0004); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_reserved(0x000a); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_caps_lock_delay_enable(0x000b); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_power_state(0x000c); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_expose_all(0x0010); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_expose_desktop(0x0011); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_brightness_up(0x0020); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_brightness_down(0x0021); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_keyboard_language(0x0030); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_power_off(0x0001); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_device_ready(0x0002); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_external_message(0x0003); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_will_power_on(0x0004); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_multitouch_touch_cancel(0x0005); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_keyboard_fn(0x0003); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_brightness_up(0x0004); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_brightness_down(0x0005); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_video_mirror(0x0006); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_toggle(0x0007); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_up(0x0008); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_illumination_down(0x0009); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_clamshell_latched(0x000a); constexpr iokit_hid_usage iokit_hid_usage_apple_vendor_top_case_reserved_mouse_data(0x00c0); } // namespace osx } // namespace pqrs namespace std { template <> struct hash<pqrs::osx::iokit_hid_usage> : type_safe::hashable<pqrs::osx::iokit_hid_usage> { }; } // namespace std
64.834783
123
0.902495
fe7
ab91d189e724481634a22a03835bc6da31021bc4
3,513
hpp
C++
src/libtego/source/context.hpp
blueprint-freespeech/r2-rebound
65efe5bcea7c1222d0eef4ce447d3bebfee37779
[ "BSD-3-Clause" ]
1
2019-06-10T11:05:15.000Z
2019-06-10T11:05:15.000Z
src/libtego/source/context.hpp
blueprint-freespeech/r2-rebound
65efe5bcea7c1222d0eef4ce447d3bebfee37779
[ "BSD-3-Clause" ]
null
null
null
src/libtego/source/context.hpp
blueprint-freespeech/r2-rebound
65efe5bcea7c1222d0eef4ce447d3bebfee37779
[ "BSD-3-Clause" ]
null
null
null
#pragma once #include "signals.hpp" #include "tor.hpp" #include "user.hpp" #include "tor/TorControl.h" #include "tor/TorManager.h" #include "core/IdentityManager.h" // // Tego Context // struct tego_context { public: tego_context(); void start_tor(const tego_tor_launch_config_t* config); bool get_tor_daemon_configured() const; size_t get_tor_logs_size() const; const std::vector<std::string>& get_tor_logs() const; const char* get_tor_version_string() const; tego_tor_control_status_t get_tor_control_status() const; tego_tor_process_status_t get_tor_process_status() const; tego_tor_network_status_t get_tor_network_status() const; int32_t get_tor_bootstrap_progress() const; tego_tor_bootstrap_tag_t get_tor_bootstrap_tag() const; void start_service( tego_ed25519_private_key_t const* hostPrivateKey, tego_user_id_t const* const* userBuffer, tego_user_type_t* const userTypeBuffer, size_t userCount); void start_service(); void update_tor_daemon_config(const tego_tor_daemon_config_t* config); void update_disable_network_flag(bool disableNetwork); void save_tor_daemon_config(); void set_host_onion_service_state(tego_host_onion_service_state_t state); std::unique_ptr<tego_user_id_t> get_host_user_id() const; tego_host_onion_service_state_t get_host_onion_service_state() const; void send_chat_request( const tego_user_id_t* user, const char* message, size_t messageLength); void acknowledge_chat_request( const tego_user_id_t* user, tego_chat_acknowledge_t response); tego_message_id_t send_message( const tego_user_id_t* user, const std::string& message); tego_user_type_t get_user_type(tego_user_id_t const* user) const; size_t get_user_count() const; std::vector<tego_user_id_t*> get_users() const; void forget_user(const tego_user_id_t* user); std::tuple<tego_file_transfer_id_t, std::unique_ptr<tego_file_hash_t>, tego_file_size_t> send_file_transfer_request( tego_user_id_t const* user, std::string const& filePath); void respond_file_transfer_request( tego_user_id_t const* user, tego_file_transfer_id_t fileTransfer, tego_file_transfer_response_t response, std::string const& destPath); void cancel_file_transfer_transfer( tego_user_id_t const* user, tego_file_transfer_id_t); tego::callback_registry callback_registry_; tego::callback_queue callback_queue_; // anything that touches internal state should do so through // this 'global' (actually per tego_context) mutex std::mutex mutex_; // TODO: figure out ownership of these Qt types Tor::TorManager* torManager = nullptr; Tor::TorControl* torControl = nullptr; IdentityManager* identityManager = nullptr; // we store the thread id that this context is associated with // calls which go into our qt internals must be called from the same // thread as the context was created on // (this is not entirely true, they must be called from the thread with the Qt // event loop, which in our case is the thread the context is created on) std::thread::id threadId; private: class ContactUser* getContactUser(const tego_user_id_t*) const; mutable std::string torVersion; mutable std::vector<std::string> torLogs; tego_host_onion_service_state_t hostUserState = tego_host_onion_service_state_none; };
38.604396
120
0.744663
blueprint-freespeech
ab91e8a62201f0561c9b0a2184a1d9ce92c13ba7
1,136
hpp
C++
src/marnav/seatalk/message_11.hpp
ShadowTeolog/marnav
094dd06a2b9e52591bc9c3879ea4b5cf34a92192
[ "BSD-4-Clause" ]
null
null
null
src/marnav/seatalk/message_11.hpp
ShadowTeolog/marnav
094dd06a2b9e52591bc9c3879ea4b5cf34a92192
[ "BSD-4-Clause" ]
null
null
null
src/marnav/seatalk/message_11.hpp
ShadowTeolog/marnav
094dd06a2b9e52591bc9c3879ea4b5cf34a92192
[ "BSD-4-Clause" ]
null
null
null
#ifndef MARNAV__SEATALK__MESSAGE_11__HPP #define MARNAV__SEATALK__MESSAGE_11__HPP #include "message.hpp" namespace marnav { namespace seatalk { /// @brief Apparent Wind Speed /// /// @code /// 11 01 XX 0Y /// /// Apparent Wind Speed: (XX & 0x7F) + Y/10 Knots /// Units flag: XX&0x80=0 => Display value in Knots /// XX&0x80=0x80 => Display value in Meter/Second /// @endcode /// /// Corresponding NMEA sentence: MWV /// class message_11 : public message { public: constexpr static const message_id ID = message_id::apparent_wind_speed; constexpr static size_t SIZE = 4; message_11(); message_11(const message_11 &) = default; message_11 & operator=(const message_11 &) = default; virtual raw get_data() const override; static std::unique_ptr<message> parse(const raw & data); private: uint8_t unit_; // unit of value uint16_t speed_; // wind speed in 1/10th of unit public: uint8_t get_unit() const noexcept { return unit_; } uint16_t get_speed() const noexcept { return speed_; } void set_unit(uint8_t t) noexcept { unit_ = t; } void set_speed(uint16_t t) noexcept { speed_ = t; } }; } } #endif
21.846154
72
0.704225
ShadowTeolog
ab93373ef1a46946f305da66c9395d39ae25cc12
381
cpp
C++
persona.cpp
equirosa/simulacion-conversacion
8fc3d3b3612175d3cb5e846e1c05f4129a53c9f5
[ "BSD-2-Clause" ]
null
null
null
persona.cpp
equirosa/simulacion-conversacion
8fc3d3b3612175d3cb5e846e1c05f4129a53c9f5
[ "BSD-2-Clause" ]
null
null
null
persona.cpp
equirosa/simulacion-conversacion
8fc3d3b3612175d3cb5e846e1c05f4129a53c9f5
[ "BSD-2-Clause" ]
null
null
null
#include "persona.h" #include <string> Persona::Persona(){} //Constructor por default. Persona::Persona(std::string nombre, std::string nacionalidad, int edad) { this->nombre=nombre; this->nacionalidad=nacionalidad; this->edad=edad; } Persona::saludar(Persona persona) { persona.devolverSaludo(nombre); return "Hola! Soy " << this->nombre << "\n ¿y tú?"; }
20.052632
72
0.677165
equirosa
ab9564926d739bfcf705d5e712dc44793722d0c4
6,351
cpp
C++
inference-engine/tests/unit/inference_engine_tests/ngraph_reader_tests/batch_norm_inference_tests.cpp
giulio1979/dldt
e7061922066ccefc54c8dae6e3215308ce9559e1
[ "Apache-2.0" ]
1
2021-07-30T17:03:50.000Z
2021-07-30T17:03:50.000Z
inference-engine/tests/unit/inference_engine_tests/ngraph_reader_tests/batch_norm_inference_tests.cpp
Dipet/dldt
b2140c083a068a63591e8c2e9b5f6b240790519d
[ "Apache-2.0" ]
null
null
null
inference-engine/tests/unit/inference_engine_tests/ngraph_reader_tests/batch_norm_inference_tests.cpp
Dipet/dldt
b2140c083a068a63591e8c2e9b5f6b240790519d
[ "Apache-2.0" ]
null
null
null
// Copyright (C) 2018-2020 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "ngraph_reader_tests.hpp" #include <string> TEST_F(NGraphReaderTests, ReadBatchNormInferenceNetwork) { std::string model = R"V0G0N( <net name="BNFusion" version="10"> <layers> <layer name="in1" type="Parameter" id="0" version="opset1"> <data element_type="f32" shape="1,3,22,22"/> <output> <port id="0" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </output> </layer> <layer id="11" name="conv_weights" type="Const" version="opset1"> <data offset="0" size="36" /> <output> <port id="0" precision="FP32"> <dim>3</dim> <dim>3</dim> <dim>1</dim> <dim>1</dim> </port> </output> </layer> <layer id="12" name="conv" type="Convolution" version="opset1"> <data dilations="1,1" group="1" kernel="1,1" output="0" pads_begin="0,0" pads_end="0,0" strides="1,1"/> <input> <port id="0" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> <port id="1" precision="FP32"> <dim>3</dim> <dim>3</dim> <dim>1</dim> <dim>1</dim> </port> </input> <output> <port id="2" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </output> </layer> <layer id="1" name="a" type="Const" version="opset1"> <data offset="0" size="12"/> <output> <port id="0" precision="FP32"> <dim>3</dim> </port> </output> </layer> <layer id="2" name="a1" type="Const" version="opset1"> <data offset="12" size="12"/> <output> <port id="0" precision="FP32"> <dim>3</dim> </port> </output> </layer> <layer id="3" name="a2" type="Const" version="opset1"> <data offset="24" size="12"/> <output> <port id="0" precision="FP32"> <dim>3</dim> </port> </output> </layer> <layer id="4" name="a3" type="Const" version="opset1"> <data offset="36" size="12"/> <output> <port id="0" precision="FP32"> <dim>3</dim> </port> </output> </layer> <layer name="bn" id="5" type="BatchNormInference" version="opset1"> <data eps="0.1" /> <input> <port id="1" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> <port id="2" precision="FP32"> <dim>3</dim> </port> <port id="3" precision="FP32"> <dim>3</dim> </port> <port id="4" precision="FP32"> <dim>3</dim> </port> <port id="5" precision="FP32"> <dim>3</dim> </port> </input> <output> <port id="6" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </output> </layer> <layer name="output" type="Result" id="6" version="opset1"> <input> <port id="0" precision="FP32"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </input> </layer> </layers> <edges> <edge from-layer="0" from-port="0" to-layer="12" to-port="0"/> <edge from-layer="11" from-port="0" to-layer="12" to-port="1"/> <edge from-layer="12" from-port="2" to-layer="5" to-port="1"/> <edge from-layer="1" from-port="0" to-layer="5" to-port="2"/> <edge from-layer="2" from-port="0" to-layer="5" to-port="3"/> <edge from-layer="3" from-port="0" to-layer="5" to-port="4"/> <edge from-layer="4" from-port="0" to-layer="5" to-port="5"/> <edge from-layer="5" from-port="6" to-layer="6" to-port="0"/> </edges> </net> )V0G0N"; std::string modelV5 = R"V0G0N( <net name="BNFusion" version="5" precision="FP32" batch="1"> <layers> <layer id="0" name="in1" precision="FP32" type="Input"> <output> <port id="0"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </output> </layer> <layer id="3" name="bn" precision="FP32" type="Convolution"> <data dilations="1,1" group="1" kernel="1,1" output="3" pads_begin="0,0" pads_end="0,0" strides="1,1"/> <input> <port id="0"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </input> <output> <port id="3"> <dim>1</dim> <dim>3</dim> <dim>22</dim> <dim>22</dim> </port> </output> <weights offset="0" size="36" /> <biases offset="0" size="12"/> </layer> </layers> <edges> <edge from-layer="0" from-port="0" to-layer="3" to-port="0"/> </edges> </net> )V0G0N"; compareIRs(model, modelV5, 139840); }
33.781915
116
0.387026
giulio1979
ab95bb7e8172882c583bb2dd14101aff896025c6
342
hpp
C++
lib/kernel/src/kernel.hpp
sinanislekdemir/minik
cde6f228e20c51d96cdb3c84e8ae4c85a5b2f4fb
[ "BSD-3-Clause" ]
8
2022-01-01T19:36:06.000Z
2022-01-25T15:57:28.000Z
lib/kernel/src/kernel.hpp
sinanislekdemir/minik
cde6f228e20c51d96cdb3c84e8ae4c85a5b2f4fb
[ "BSD-3-Clause" ]
4
2022-01-17T15:45:39.000Z
2022-02-27T19:52:42.000Z
lib/kernel/src/kernel.hpp
sinanislekdemir/minik
cde6f228e20c51d96cdb3c84e8ae4c85a5b2f4fb
[ "BSD-3-Clause" ]
null
null
null
/** * Main Kernel Definitions */ #ifndef _kernel_hpp #define _kernel_hpp #include "program.hpp" #include "statement.hpp" #include "status.hpp" #include <Arduino.h> struct setup { int num_cores; bool serial; bool net; bool sdcard; }; void stop(); int kmain(); // Add kernel tasks like breath or serial console to tasks list #endif
13.153846
63
0.710526
sinanislekdemir
ab95c251b22c3470b0c99a12ccac5bf1b3c0d8f9
5,519
cpp
C++
grasp_generation/graspitmodified_lm/Coin-3.1.3/src/caches/SoBoundingBoxCache.cpp
KraftOreo/EBM_Hand
9ab1722c196b7eb99b4c3ecc85cef6e8b1887053
[ "MIT" ]
null
null
null
grasp_generation/graspitmodified_lm/Coin-3.1.3/src/caches/SoBoundingBoxCache.cpp
KraftOreo/EBM_Hand
9ab1722c196b7eb99b4c3ecc85cef6e8b1887053
[ "MIT" ]
null
null
null
grasp_generation/graspitmodified_lm/Coin-3.1.3/src/caches/SoBoundingBoxCache.cpp
KraftOreo/EBM_Hand
9ab1722c196b7eb99b4c3ecc85cef6e8b1887053
[ "MIT" ]
null
null
null
/**************************************************************************\ * * This file is part of the Coin 3D visualization library. * Copyright (C) by Kongsberg Oil & Gas Technologies. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * ("GPL") version 2 as published by the Free Software Foundation. * See the file LICENSE.GPL at the root directory of this source * distribution for additional information about the GNU GPL. * * For using Coin with software that can not be combined with the GNU * GPL, and for taking advantage of the additional benefits of our * support services, please contact Kongsberg Oil & Gas Technologies * about acquiring a Coin Professional Edition License. * * See http://www.coin3d.org/ for more information. * * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. * http://www.sim.no/ sales@sim.no coin-support@coin3d.org * \**************************************************************************/ /*! \class SoBoundingBoxCache Inventor/caches/SoBoundingBoxCache.h \brief The SoBoundingBoxCache class is used to cache bounding boxes. \ingroup caches */ // ************************************************************************* #include <Inventor/caches/SoBoundingBoxCache.h> #include <Inventor/elements/SoCacheElement.h> #include <Inventor/errors/SoDebugError.h> #include "tidbitsp.h" // ************************************************************************* class SoBoundingBoxCacheP { public: SbXfBox3f bbox; SbBox3f localbbox; SbVec3f centerpoint; unsigned int centerset : 1; unsigned int linesorpoints : 1; }; #define PRIVATE(p) ((p)->pimpl) // ************************************************************************* /*! Constructor with \a state being the current state. */ SoBoundingBoxCache::SoBoundingBoxCache(SoState *state) : SoCache(state) { PRIVATE(this) = new SoBoundingBoxCacheP; PRIVATE(this)->centerset = 0; PRIVATE(this)->linesorpoints = 0; #if COIN_DEBUG if (coin_debug_caching_level() > 0) { SoDebugError::postInfo("SoBoundingBoxCache::SoBoundingBoxCache", "Cache created: %p", this); } #endif // debug } /*! Destructor. */ SoBoundingBoxCache::~SoBoundingBoxCache() { #if COIN_DEBUG if (coin_debug_caching_level() > 0) { SoDebugError::postInfo("SoBoundingBoxCache::~SoBoundingBoxCache", "Cache destructed: %p", this); } #endif // debug delete PRIVATE(this); } /*! Sets the data for this cache. \a boundingBox is the node's bounding box, \a centerSet and \a centerPoints specifies the center of the geometry inside \a boundingBox. */ void SoBoundingBoxCache::set(const SbXfBox3f & boundingbox, SbBool centerset, const SbVec3f & centerpoint) { PRIVATE(this)->bbox = boundingbox; PRIVATE(this)->localbbox = boundingbox.project(); PRIVATE(this)->centerset = centerset ? 1 : 0; if (centerset) { PRIVATE(this)->centerpoint = centerpoint; } } /*! Returns the bounding box for this cache. */ const SbXfBox3f & SoBoundingBoxCache::getBox(void) const { return PRIVATE(this)->bbox; } /*! Returns the projected bounding box for this cache. */ const SbBox3f & SoBoundingBoxCache::getProjectedBox(void) const { return PRIVATE(this)->localbbox; } /*! Returns whether the center of the bounding box was set in the SoBoundingBoxCache::set() method. \sa SoBoundingBoxCache::getCenter() */ SbBool SoBoundingBoxCache::isCenterSet(void) const { return PRIVATE(this)->centerset == 1; } /*! Returns the center of the bounding box. Should only be used if SoBoundingBoxCache::isCenterSet() returns \c TRUE. */ const SbVec3f & SoBoundingBoxCache::getCenter(void) const { return PRIVATE(this)->centerpoint; } /*! Sets the flag returned from SoBoundingBoxCache::hasLinesOrPoints() to \c TRUE for all open bounding box caches. The reason bounding box caches keep a lines-or-points flag is to make it known to client code if the shape(s) they contain have any of these primitives -- or are rendered with these primitives. The reason this is important to know for the client code is because it might need to add an "epsilon" slack value to the calculated bounding box to account for smoothing / anti-aliasing effects in the renderer, so lines and points graphics is not accidently clipped by near and far clipping planes, for instance. This method is a static method on the class. It will upon invocation scan through the state stack and set the flag for all open SoBoundingBoxCache elements. It has been made to work like this so it can easily be invoked on all current bounding box cache instances from the SoShape-type nodes using lines and / or point primitives. \sa hasLinesOrPoints() */ void SoBoundingBoxCache::setHasLinesOrPoints(SoState * state) { SoCacheElement * elem = static_cast<SoCacheElement *>( state->getElementNoPush(SoCacheElement::getClassStackIndex()) ); while (elem) { SoBoundingBoxCache * cache = static_cast<SoBoundingBoxCache *>(elem->getCache()); if (cache) { PRIVATE(cache)->linesorpoints = TRUE; } elem = elem->getNextCacheElement(); } } /*! Return \c TRUE if the hasLinesOrPoints flag has been set. \sa setHasLinesOrPoints() */ SbBool SoBoundingBoxCache::hasLinesOrPoints(void) const { return PRIVATE(this)->linesorpoints == 1; } #undef PRIVATE
29.047368
85
0.671498
KraftOreo
ab960e26a1af8dc50e165151594063ddfd971b02
12,618
cpp
C++
storage/walletdb.cpp
ouyun/FnFnCoreWallet
3aa61145bc3f524d1dc10ada22e164689a73d794
[ "MIT" ]
1
2019-12-23T11:56:55.000Z
2019-12-23T11:56:55.000Z
storage/walletdb.cpp
ouyun/FnFnCoreWallet
3aa61145bc3f524d1dc10ada22e164689a73d794
[ "MIT" ]
null
null
null
storage/walletdb.cpp
ouyun/FnFnCoreWallet
3aa61145bc3f524d1dc10ada22e164689a73d794
[ "MIT" ]
null
null
null
// Copyright (c) 2017-2019 The Multiverse developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletdb.h" #include "leveldbeng.h" #include <boost/foreach.hpp> #include <boost/bind.hpp> using namespace std; using namespace walleve; using namespace multiverse::storage; ////////////////////////////// // CWalletAddrDB bool CWalletAddrDB::Initialize(const boost::filesystem::path& pathWallet) { CLevelDBArguments args; args.path = (pathWallet / "addr").string(); args.syncwrite = true; args.files = 8; args.cache = 1 << 20; CLevelDBEngine *engine = new CLevelDBEngine(args); if (!Open(engine)) { delete engine; return false; } return true; } void CWalletAddrDB::Deinitialize() { Close(); } bool CWalletAddrDB::UpdateKey(const crypto::CPubKey& pubkey,int version,const crypto::CCryptoCipher& cipher) { vector<unsigned char> vch; vch.resize( 4 + 48 + 8); memcpy(&vch[0],&version,4); memcpy(&vch[4],cipher.encrypted,48); memcpy(&vch[52],&cipher.nonce,8); return Write(CDestination(pubkey),vch); } bool CWalletAddrDB::UpdateTemplate(const CTemplateId& tid,const vector<unsigned char>& vchData) { return Write(CDestination(tid),vchData); } bool CWalletAddrDB::EraseAddress(const CDestination& dest) { return Erase(dest); } bool CWalletAddrDB::WalkThroughAddress(CWalletDBAddrWalker& walker) { return WalkThrough(boost::bind(&CWalletAddrDB::AddressDBWalker,this,_1,_2,boost::ref(walker))); } bool CWalletAddrDB::AddressDBWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBAddrWalker& walker) { CDestination dest; vector<unsigned char> vch; ssKey >> dest; ssValue >> vch; if (dest.IsTemplate()) { return walker.WalkTemplate(dest.GetTemplateId(),vch); } crypto::CPubKey pubkey; if (dest.GetPubKey(pubkey) && vch.size() == 4 + 48 + 8) { int version; crypto::CCryptoCipher cipher; memcpy(&version,&vch[0],4); memcpy(cipher.encrypted,&vch[4],48); memcpy(&cipher.nonce,&vch[52],8); return walker.WalkPubkey(pubkey,version,cipher); } return false; } ////////////////////////////// // CWalletTxDB bool CWalletTxDB::Initialize(const boost::filesystem::path& pathWallet) { CLevelDBArguments args; args.path = (pathWallet / "wtx").string(); CLevelDBEngine *engine = new CLevelDBEngine(args); if (!Open(engine)) { delete engine; return false; } if (!Read(string("txcount"),nTxCount) || !Read(string("sequence"),nSequence)) { return Reset(); } return true; } void CWalletTxDB::Deinitialize() { Close(); } bool CWalletTxDB::Clear() { RemoveAll(); return Reset(); } bool CWalletTxDB::AddNewTx(const CWalletTx& wtx) { pair<uint64,CWalletTx> pairWalletTx; if (Read(make_pair(string("wtx"),wtx.txid),pairWalletTx)) { pairWalletTx.second = wtx; return Write(make_pair(string("wtx"),wtx.txid),pairWalletTx); } pairWalletTx.first = nSequence++; pairWalletTx.second = wtx; if (!TxnBegin()) { return false; } if (!Write(make_pair(string("wtx"),wtx.txid),pairWalletTx) || !Write(make_pair(string("seq"),pairWalletTx.first),CWalletTxSeq(wtx)) || !Write(string("txcount"),nTxCount + 1) || !Write(string("sequence"),nSequence)) { TxnAbort(); return false; } if (!TxnCommit()) { return false; } ++nTxCount; return true; } bool CWalletTxDB::UpdateTx(const vector<CWalletTx>& vWalletTx,const vector<uint256>& vRemove) { int nTxAddNew = 0; vector<pair<uint64,CWalletTx> > vTxUpdate; vTxUpdate.reserve(vWalletTx.size()); BOOST_FOREACH(const CWalletTx& wtx,vWalletTx) { pair<uint64,CWalletTx> pairWalletTx; if (Read(make_pair(string("wtx"),wtx.txid),pairWalletTx)) { vTxUpdate.push_back(make_pair(pairWalletTx.first,wtx)); } else { vTxUpdate.push_back(make_pair(nSequence++,wtx)); ++nTxAddNew; } } vector<pair<uint64,uint256> > vTxRemove; vTxRemove.reserve(vRemove.size()); BOOST_FOREACH(const uint256& txid,vRemove) { pair<uint64,CWalletTx> pairWalletTx; if (Read(make_pair(string("wtx"),txid),pairWalletTx)) { vTxRemove.push_back(make_pair(pairWalletTx.first,txid)); } } if (!TxnBegin()) { return false; } for (int i = 0;i < vTxUpdate.size();i++) { pair<uint64,CWalletTx>& pairWalletTx = vTxUpdate[i]; if (!Write(make_pair(string("wtx"),pairWalletTx.second.txid),pairWalletTx) || !Write(make_pair(string("seq"),pairWalletTx.first),CWalletTxSeq(pairWalletTx.second))) { TxnAbort(); return false; } } for (int i = 0;i < vTxRemove.size();i++) { if (!Erase(make_pair(string("wtx"),vTxRemove[i].second)) || !Erase(make_pair(string("seq"),vTxRemove[i].first))) { TxnAbort(); return false; } } if (!Write(string("txcount"),nTxCount + nTxAddNew - vTxRemove.size()) || !Write(string("sequence"),nSequence)) { TxnAbort(); return false; } if (!TxnCommit()) { return false; } nTxCount += nTxAddNew - vTxRemove.size(); return true; } bool CWalletTxDB::RetrieveTx(const uint256& txid,CWalletTx& wtx) { pair<uint64,CWalletTx> pairWalletTx; if (!Read(make_pair(string("wtx"),txid),pairWalletTx)) { return false; } wtx = pairWalletTx.second; return true; } bool CWalletTxDB::ExistsTx(const uint256& txid) { pair<uint64,CWalletTx> pairWalletTx; return Read(make_pair(string("wtx"),txid),pairWalletTx); } size_t CWalletTxDB::GetTxCount() { return nTxCount; } bool CWalletTxDB::WalkThroughTxSeq(CWalletDBTxSeqWalker& walker) { return WalkThrough(boost::bind(&CWalletTxDB::TxSeqWalker,this,_1,_2,boost::ref(walker)), make_pair(string("seq"),uint64(0))); } bool CWalletTxDB::WalkThroughTx(CWalletDBTxWalker& walker) { return WalkThrough(boost::bind(&CWalletTxDB::TxWalker,this,_1,_2,boost::ref(walker)), make_pair(string("seq"),uint64(0))); } bool CWalletTxDB::TxSeqWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBTxSeqWalker& walker) { string strPrefix; uint64 nSeqNum; CWalletTxSeq txSeq; ssKey >> strPrefix; if (strPrefix != "seq") { return false; } ssKey >> nSeqNum; ssValue >> txSeq; return walker.Walk(txSeq.txid,txSeq.hashFork,txSeq.nBlockHeight); } bool CWalletTxDB::TxWalker(CWalleveBufStream& ssKey,CWalleveBufStream& ssValue,CWalletDBTxWalker& walker) { string strPrefix; uint64 nSeqNum; CWalletTxSeq txSeq; ssKey >> strPrefix; if (strPrefix != "seq") { return false; } ssKey >> nSeqNum; ssValue >> txSeq; CWalletTx wtx; if (!RetrieveTx(txSeq.txid,wtx)) { return false; } return walker.Walk(wtx); } bool CWalletTxDB::Reset() { nSequence = 0; nTxCount = 0; if (!TxnBegin()) { return false; } if (!Write(string("txcount"),size_t(0))) { TxnAbort(); return false; } if (!Write(string("sequence"),nSequence)) { TxnAbort(); return false; } return TxnCommit(); } ////////////////////////////// // CWalletDBListTxSeqWalker class CWalletDBListTxSeqWalker : public CWalletDBTxSeqWalker { public: CWalletDBListTxSeqWalker(int nOffsetIn,int nMaxCountIn) : nOffset(nOffsetIn), nMaxCount(nMaxCountIn), nIndex(0) { } bool Walk(const uint256& txid,const uint256& hashFork,const int nBlockHeight) { if (nIndex++ < nOffset) { return true; } vWalletTxid.push_back(txid); return (vWalletTxid.size() < nMaxCount); } public: int nOffset; int nMaxCount; int nIndex; vector<uint256> vWalletTxid; }; ////////////////////////////// // CWalletDBRollBackTxSeqWalker class CWalletDBRollBackTxSeqWalker : public CWalletDBTxSeqWalker { public: CWalletDBRollBackTxSeqWalker(const uint256& hashForkIn,int nMinHeightIn,vector<uint256>& vForkTxIn) : hashFork(hashForkIn), nMinHeight(nMinHeightIn), vForkTx(vForkTxIn) { } bool Walk(const uint256& txidIn,const uint256& hashForkIn,const int nBlockHeightIn) { if (hashForkIn == hashFork && (nBlockHeightIn < 0 || nBlockHeightIn >= nMinHeight)) { vForkTx.push_back(txidIn); } return true; } public: uint256 hashFork; int nMinHeight; vector<uint256>& vForkTx; }; ////////////////////////////// // CWalletDB CWalletDB::CWalletDB() { } CWalletDB::~CWalletDB() { Deinitialize(); } bool CWalletDB::Initialize(const boost::filesystem::path& pathWallet) { if (!boost::filesystem::exists(pathWallet)) { boost::filesystem::create_directories(pathWallet); } if (!boost::filesystem::is_directory(pathWallet)) { return false; } if (!dbAddr.Initialize(pathWallet)) { return false; } if (!dbWtx.Initialize(pathWallet)) { return false; } return true; } void CWalletDB::Deinitialize() { vector<CWalletTx> vWalletTx; txCache.ListTx(0,-1,vWalletTx); if (!vWalletTx.empty()) { UpdateTx(vWalletTx); } txCache.Clear(); dbWtx.Deinitialize(); dbAddr.Deinitialize(); } bool CWalletDB::UpdateKey(const crypto::CPubKey& pubkey,int version,const crypto::CCryptoCipher& cipher) { return dbAddr.UpdateKey(pubkey,version,cipher); } bool CWalletDB::UpdateTemplate(const CTemplateId& tid,const vector<unsigned char>& vchData) { return dbAddr.UpdateTemplate(tid,vchData); } bool CWalletDB::WalkThroughAddress(CWalletDBAddrWalker& walker) { return dbAddr.WalkThroughAddress(walker); } bool CWalletDB::AddNewTx(const CWalletTx& wtx) { if (wtx.nBlockHeight < 0) { txCache.AddNew(wtx); return true; } return dbWtx.AddNewTx(wtx); } bool CWalletDB::UpdateTx(const vector<CWalletTx>& vWalletTx,const vector<uint256>& vRemove) { if (!dbWtx.UpdateTx(vWalletTx,vRemove)) { return false; } BOOST_FOREACH(const CWalletTx& wtx,vWalletTx) { txCache.Remove(wtx.txid); } BOOST_FOREACH(const uint256& txid,vRemove) { txCache.Remove(txid); } return true; } bool CWalletDB::RetrieveTx(const uint256& txid,CWalletTx& wtx) { if (txCache.Get(txid,wtx)) { return true; } return dbWtx.RetrieveTx(txid,wtx); } bool CWalletDB::ExistsTx(const uint256& txid) { if (txCache.Exists(txid)) { return true; } return dbWtx.ExistsTx(txid); } size_t CWalletDB::GetTxCount() { return dbWtx.GetTxCount() + txCache.Count(); } bool CWalletDB::ListTx(int nOffset,int nCount,vector<CWalletTx>& vWalletTx) { size_t nDBTx = dbWtx.GetTxCount(); if (nOffset < nDBTx) { if (!ListDBTx(nOffset, nCount, vWalletTx)) { return false; } if (vWalletTx.size() < nCount) { txCache.ListTx(0, nCount - vWalletTx.size(), vWalletTx); } } else { txCache.ListTx(nOffset - nDBTx, nCount, vWalletTx); } return true; } bool CWalletDB::ListDBTx(int nOffset,int nCount,vector<CWalletTx>& vWalletTx) { CWalletDBListTxSeqWalker walker(nOffset,nCount); if (!dbWtx.WalkThroughTxSeq(walker)) { return false; } BOOST_FOREACH(const uint256& txid,walker.vWalletTxid) { CWalletTx wtx; if (!dbWtx.RetrieveTx(txid,wtx)) { return false; } vWalletTx.push_back(wtx); } return true; } bool CWalletDB::ListRollBackTx(const uint256& hashFork,int nMinHeight,vector<uint256>& vForkTx) { CWalletDBRollBackTxSeqWalker walker(hashFork,nMinHeight,vForkTx); if (!dbWtx.WalkThroughTxSeq(walker)) { return false; } txCache.ListForkTx(hashFork,vForkTx); return true; } bool CWalletDB::WalkThroughTx(CWalletDBTxWalker& walker) { return dbWtx.WalkThroughTx(walker); } bool CWalletDB::ClearTx() { txCache.Clear(); return dbWtx.Clear(); }
21.868284
116
0.624029
ouyun
ab967c96d59adb365b9e31659a8c6d6a18a571fb
270
hpp
C++
src/widgets/settingspages/CommandPage.hpp
agenttud/chatterino7
b40763c5f847c017106115f92b864b40b3a20501
[ "MIT" ]
1,145
2019-05-18T22:51:52.000Z
2022-03-31T22:12:39.000Z
src/widgets/settingspages/CommandPage.hpp
agenttud/chatterino7
b40763c5f847c017106115f92b864b40b3a20501
[ "MIT" ]
2,034
2019-05-18T22:28:54.000Z
2022-03-31T22:24:21.000Z
src/widgets/settingspages/CommandPage.hpp
agenttud/chatterino7
b40763c5f847c017106115f92b864b40b3a20501
[ "MIT" ]
397
2019-05-18T22:45:51.000Z
2022-03-31T22:12:39.000Z
#pragma once #include <QTextEdit> #include <QTimer> #include "widgets/settingspages/SettingsPage.hpp" namespace chatterino { class CommandPage : public SettingsPage { public: CommandPage(); private: QTimer commandsEditTimer_; }; } // namespace chatterino
13.5
49
0.744444
agenttud
ab96996c768e015fb5aa467b3007b691dde42bbd
2,565
hpp
C++
include/Move_strategy.hpp
mjcaisse/CDT-plusplus
fa11dd19c806a96afbb48e406234e82cae62029a
[ "BSD-3-Clause" ]
null
null
null
include/Move_strategy.hpp
mjcaisse/CDT-plusplus
fa11dd19c806a96afbb48e406234e82cae62029a
[ "BSD-3-Clause" ]
null
null
null
include/Move_strategy.hpp
mjcaisse/CDT-plusplus
fa11dd19c806a96afbb48e406234e82cae62029a
[ "BSD-3-Clause" ]
null
null
null
/// Causal Dynamical Triangulations in C++ using CGAL /// /// Copyright © 2017-2020 Adam Getchell /// /// Template class for all move algorithms, e.g. Metropolis, MoveAlways /// /// @file Move_strategy.hpp /// @brief Base class for move algorithms on Delaunay Triangulations /// @author Adam Getchell #ifndef INCLUDE_MOVE_ALGORITHM_HPP_ #define INCLUDE_MOVE_ALGORITHM_HPP_ #include "Move_command.hpp" #include <memory> static Int_precision constexpr NUMBER_OF_3D_MOVES = 5; static Int_precision constexpr NUMBER_OF_4D_MOVES = 7; /// @brief Determine ergodic moves for a given dimension at compile-time /// @param dim Dimensionality of the triangulation /// @return The number of ergodic moves for that dimensionality constexpr auto moves_per_dimension(Int_precision dim) -> std::size_t { if (dim == 3) { return NUMBER_OF_3D_MOVES; } if (dim == 4) { return NUMBER_OF_4D_MOVES; } return 0; // Error condition } /// @brief The data and methods to track ergodic moves /// @tparam dimension The dimensionality of the ergodic moves template <size_t dimension> class Move_tracker { std::array<Int_precision, moves_per_dimension(dimension)> moves = {0}; public: auto operator[](std::size_t index) { Ensures(moves.size() == 5 || moves.size() == 7); return moves[index]; } // 3D Ergodic moves template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0> auto two_three_moves() { return moves[0]; } template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0> auto three_two_moves() { return moves[1]; } template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0> auto two_six_moves() { return moves[2]; } template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0> auto six_two_moves() { return moves[3]; } template <std::size_t dim, std::enable_if_t<dim == 3, int> = 0> auto four_four_moves() { return moves[4]; } // 4D Ergodic moves template <std::size_t dim, std::enable_if_t<dim == 4, int> = 0> auto two_four_moves() { return moves[0]; } }; using Move_tracker_3 = Move_tracker<3>; using Move_tracker_4 = Move_tracker<4>; /// @brief The algorithms available to make ergodic moves enum Strategies { MOVE_ALWAYS, METROPOLIS }; /// @brief Select an algorithm to make ergodic moves upon triangulations /// @tparam strategies The algorithm that chooses ergodic moves /// @tparam dimension The dimensionality of the triangulation template <Strategies strategies, size_t dimension> class MoveStrategy { }; #endif // INCLUDE_MOVE_ALGORITHM_HPP_
25.147059
72
0.707212
mjcaisse
ab994df8acf4f2622f8289a48e4d877338e6e14d
5,336
cpp
C++
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp
jacadcaps/webkitty
9aebd2081349f9a7b5d168673c6f676a1450a66d
[ "BSD-2-Clause" ]
6
2021-07-05T16:09:39.000Z
2022-03-06T22:44:42.000Z
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp
jacadcaps/webkitty
9aebd2081349f9a7b5d168673c6f676a1450a66d
[ "BSD-2-Clause" ]
7
2022-03-15T13:25:39.000Z
2022-03-15T13:25:44.000Z
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp
jacadcaps/webkitty
9aebd2081349f9a7b5d168673c6f676a1450a66d
[ "BSD-2-Clause" ]
null
null
null
/* * Copyright (C) 2020 Igalia S.L * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "WebKitWebsiteDataAccessPermissionRequest.h" #include "WebKitPermissionRequest.h" #include "WebKitWebsiteDataAccessPermissionRequestPrivate.h" #include <wtf/CompletionHandler.h> #include <wtf/glib/WTFGType.h> /** * SECTION: WebKitWebsiteDataAccessPermissionRequest * @Short_description: A permission request for accessing website data from third-party domains * @Title: WebKitWebsiteDataAccessPermissionRequest * @See_also: #WebKitPermissionRequest, #WebKitWebView * * WebKitWebsiteDataAccessPermissionRequest represents a request for * permission to allow a third-party domain access its cookies. * * When a WebKitWebsiteDataAccessPermissionRequest is not handled by the user, * it is denied by default. * * Since: 2.30 */ static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*); struct _WebKitWebsiteDataAccessPermissionRequestPrivate { CString requestingDomain; CString currentDomain; CompletionHandler<void(bool)> completionHandler; }; WEBKIT_DEFINE_TYPE_WITH_CODE( WebKitWebsiteDataAccessPermissionRequest, webkit_website_data_access_permission_request, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init)) static void webkitWebsiteDataAccessPermissionRequestAllow(WebKitPermissionRequest* request) { ASSERT(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)); auto* priv = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)->priv; if (priv->completionHandler) priv->completionHandler(true); } static void webkitWebsiteDataAccessPermissionRequestDeny(WebKitPermissionRequest* request) { ASSERT(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)); auto* priv = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request)->priv; if (priv->completionHandler) priv->completionHandler(false); } static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface) { iface->allow = webkitWebsiteDataAccessPermissionRequestAllow; iface->deny = webkitWebsiteDataAccessPermissionRequestDeny; } static void webkitWebsiteDataAccessPermissionRequestDispose(GObject* object) { // Default behaviour when no decision has been made is denying the request. webkitWebsiteDataAccessPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object)); G_OBJECT_CLASS(webkit_website_data_access_permission_request_parent_class)->dispose(object); } static void webkit_website_data_access_permission_request_class_init(WebKitWebsiteDataAccessPermissionRequestClass* klass) { GObjectClass* objectClass = G_OBJECT_CLASS(klass); objectClass->dispose = webkitWebsiteDataAccessPermissionRequestDispose; } WebKitWebsiteDataAccessPermissionRequest* webkitWebsiteDataAccessPermissionRequestCreate(const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { auto* websiteDataPermissionRequest = WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, nullptr)); websiteDataPermissionRequest->priv->requestingDomain = requestingDomain.string().utf8(); websiteDataPermissionRequest->priv->currentDomain = currentDomain.string().utf8(); websiteDataPermissionRequest->priv->completionHandler = WTFMove(completionHandler); return websiteDataPermissionRequest; } /** * webkit_website_data_access_permission_request_get_requesting_domain: * @request: a #WebKitWebsiteDataAccessPermissionRequest * * Get the domain requesting permission to access its cookies while browsing the current domain. * * Returns: the requesting domain name * * Since: 2.30 */ const char* webkit_website_data_access_permission_request_get_requesting_domain(WebKitWebsiteDataAccessPermissionRequest* request) { g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request), nullptr); return request->priv->requestingDomain.data(); } /** * webkit_website_data_access_permission_request_get_current_domain: * @request: a #WebKitWebsiteDataAccessPermissionRequest * * Get the current domain being browsed. * * Returns: the current domain name * * Since: 2.30 */ const char* webkit_website_data_access_permission_request_get_current_domain(WebKitWebsiteDataAccessPermissionRequest* request) { g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(request), nullptr); return request->priv->currentDomain.data(); }
40.120301
240
0.81578
jacadcaps
ab9b927cd5e5a73439f7cb524192815962d71820
7,712
cc
C++
components/suggestions/webui/suggestions_source.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/suggestions/webui/suggestions_source.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/suggestions/webui/suggestions_source.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2017 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/suggestions/webui/suggestions_source.h" #include "base/barrier_closure.h" #include "base/base64.h" #include "base/bind.h" #include "base/strings/string16.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "components/suggestions/proto/suggestions.pb.h" #include "net/base/escape.h" #include "ui/base/l10n/time_format.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image_skia.h" namespace suggestions { namespace { const char kHtmlHeader[] = "<!DOCTYPE html>\n<html>\n<head>\n<title>Suggestions</title>\n" "<meta charset=\"utf-8\">\n" "<style type=\"text/css\">\nli {white-space: nowrap;}\n</style>\n"; const char kHtmlBody[] = "</head>\n<body>\n"; const char kHtmlFooter[] = "</body>\n</html>\n"; const char kRefreshPath[] = "refresh"; std::string GetRefreshHtml(const std::string& base_url, bool is_refresh) { if (is_refresh) return "<p>Refreshing in the background, reload to see new data.</p>\n"; return std::string("<p><a href=\"") + base_url + kRefreshPath + "\">Refresh</a></p>\n"; } // Returns the HTML needed to display the suggestions. std::string RenderOutputHtml( const std::string& base_url, bool is_refresh, const SuggestionsProfile& profile, const std::map<GURL, std::string>& base64_encoded_pngs) { std::vector<std::string> out; out.push_back(kHtmlHeader); out.push_back(kHtmlBody); out.push_back("<h1>Suggestions</h1>\n"); out.push_back(GetRefreshHtml(base_url, is_refresh)); out.push_back("<ul>"); int64_t now = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch()) .ToInternalValue(); size_t size = profile.suggestions_size(); for (size_t i = 0; i < size; ++i) { const ChromeSuggestion& suggestion = profile.suggestions(i); base::TimeDelta remaining_time = base::TimeDelta::FromMicroseconds(suggestion.expiry_ts() - now); base::string16 remaining_time_formatted = ui::TimeFormat::Detailed( ui::TimeFormat::Format::FORMAT_DURATION, ui::TimeFormat::Length::LENGTH_LONG, -1, remaining_time); std::string line; line += "<li><a href=\""; line += net::EscapeForHTML(suggestion.url()); line += "\" target=\"_blank\">"; line += net::EscapeForHTML(suggestion.title()); std::map<GURL, std::string>::const_iterator it = base64_encoded_pngs.find(GURL(suggestion.url())); if (it != base64_encoded_pngs.end()) { line += "<br><img src='"; line += it->second; line += "'>"; } line += "</a> Expires in "; line += base::UTF16ToUTF8(remaining_time_formatted); std::vector<std::string> providers; for (int p = 0; p < suggestion.providers_size(); ++p) providers.push_back(base::IntToString(suggestion.providers(p))); line += ". Provider IDs: " + base::JoinString(providers, ", "); line += "</li>\n"; out.push_back(line); } out.push_back("</ul>"); out.push_back(kHtmlFooter); return base::JoinString(out, base::StringPiece()); } // Returns the HTML needed to display that no suggestions are available. std::string RenderOutputHtmlNoSuggestions(const std::string& base_url, bool is_refresh) { std::vector<std::string> out; out.push_back(kHtmlHeader); out.push_back(kHtmlBody); out.push_back("<h1>Suggestions</h1>\n"); out.push_back("<p>You have no suggestions.</p>\n"); out.push_back(GetRefreshHtml(base_url, is_refresh)); out.push_back(kHtmlFooter); return base::JoinString(out, base::StringPiece()); } } // namespace SuggestionsSource::SuggestionsSource(SuggestionsService* suggestions_service, const std::string& base_url) : suggestions_service_(suggestions_service), base_url_(base_url), weak_ptr_factory_(this) {} SuggestionsSource::~SuggestionsSource() {} SuggestionsSource::RequestContext::RequestContext( bool is_refresh_in, const SuggestionsProfile& suggestions_profile_in, const GotDataCallback& callback_in) : is_refresh(is_refresh_in), suggestions_profile(suggestions_profile_in), // Copy. callback(callback_in) // Copy. {} SuggestionsSource::RequestContext::~RequestContext() {} void SuggestionsSource::StartDataRequest(const std::string& path, const GotDataCallback& callback) { // If this was called as "chrome://suggestions/refresh", we also trigger an // async update of the suggestions. bool is_refresh = (path == kRefreshPath); // |suggestions_service| is null for guest profiles. if (!suggestions_service_) { std::string output = RenderOutputHtmlNoSuggestions(base_url_, is_refresh); callback.Run(base::RefCountedString::TakeString(&output)); return; } if (is_refresh) suggestions_service_->FetchSuggestionsData(); SuggestionsProfile suggestions_profile = suggestions_service_->GetSuggestionsDataFromCache().value_or( SuggestionsProfile()); size_t size = suggestions_profile.suggestions_size(); if (!size) { std::string output = RenderOutputHtmlNoSuggestions(base_url_, is_refresh); callback.Run(base::RefCountedString::TakeString(&output)); } else { RequestContext* context = new RequestContext(is_refresh, suggestions_profile, callback); base::Closure barrier = BarrierClosure( size, base::BindOnce(&SuggestionsSource::OnThumbnailsFetched, weak_ptr_factory_.GetWeakPtr(), context)); for (size_t i = 0; i < size; ++i) { const ChromeSuggestion& suggestion = suggestions_profile.suggestions(i); // Fetch the thumbnail for this URL (exercising the fetcher). After all // fetches are done, including NULL callbacks for unavailable thumbnails, // SuggestionsSource::OnThumbnailsFetched will be called. suggestions_service_->GetPageThumbnail( GURL(suggestion.url()), base::Bind(&SuggestionsSource::OnThumbnailAvailable, weak_ptr_factory_.GetWeakPtr(), context, barrier)); } } } std::string SuggestionsSource::GetMimeType(const std::string& path) const { return "text/html"; } void SuggestionsSource::OnThumbnailsFetched(RequestContext* context) { std::unique_ptr<RequestContext> context_deleter(context); std::string output = RenderOutputHtml(base_url_, context->is_refresh, context->suggestions_profile, context->base64_encoded_pngs); context->callback.Run(base::RefCountedString::TakeString(&output)); } void SuggestionsSource::OnThumbnailAvailable(RequestContext* context, const base::Closure& barrier, const GURL& url, const gfx::Image& image) { if (!image.IsEmpty()) { std::vector<unsigned char> output; gfx::PNGCodec::EncodeBGRASkBitmap(*image.ToSkBitmap(), false, &output); std::string encoded_output; base::Base64Encode( base::StringPiece(reinterpret_cast<const char*>(output.data()), output.size()), &encoded_output); context->base64_encoded_pngs[url] = "data:image/png;base64,"; context->base64_encoded_pngs[url] += encoded_output; } barrier.Run(); } } // namespace suggestions
38.949495
79
0.669476
metux
ab9d0df4b91d7eed887be585aa4dde53d50eb971
2,133
hpp
C++
GLFramework/stdafx.hpp
Illation/GLFramework
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
[ "MIT" ]
39
2016-03-23T00:39:46.000Z
2022-02-07T21:26:05.000Z
GLFramework/stdafx.hpp
Illation/GLFramework
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
[ "MIT" ]
1
2016-03-24T14:39:45.000Z
2016-03-24T17:34:39.000Z
GLFramework/stdafx.hpp
Illation/GLFramework
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
[ "MIT" ]
3
2016-08-15T01:27:13.000Z
2021-12-29T01:37:51.000Z
#pragma once #pragma region //C RunTime Header Files #include <wchar.h> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <vector> #include <memory> using namespace std; #pragma endregion stl #pragma region //SDL and opengl Header files #include "staticDependancies/glad/glad.h" #include <SDL.h> #include <SDL_opengl.h> #pragma endregion sdl-opengl #pragma region #ifndef GLM_FORCE_LEFT_HANDED #define GLM_FORCE_LEFT_HANDED #endif #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> using namespace glm; #pragma endregion glm #pragma region //***************************************************************************** //Declare templates for releasing interfaces and deleting objects //***************************************************************************** template<class Interface> inline void SafeRelease(Interface &pInterfaceToRelease) { if (pInterfaceToRelease != 0) { pInterfaceToRelease->Release(); pInterfaceToRelease = 0; } } template<class T> inline void SafeDelete(T &pObjectToDelete) { if (pObjectToDelete != 0) { delete(pObjectToDelete); pObjectToDelete = 0; } } template<typename T> inline void Clamp(T& value, T hi, T lo) { if (value > hi) value = hi; if (value < lo) value = lo; } #pragma endregion Templates #pragma region #include "Components/TransformComponent.hpp" #include "Content/ContentManager.hpp" #include "Base\Context.hpp" #include "Base\Settings.hpp" #include "Base\InputManager.hpp" #include "Helper/Logger.hpp" #include "Helper/MathHelper.hpp" #include "Helper/PerformanceInfo.hpp" //Working singleton Set #define TIME Context::GetInstance()->pTime #define CAMERA Context::GetInstance()->pCamera #define SCENE Context::GetInstance()->pScene #define SETTINGS Settings::GetInstance() #define INPUT InputManager::GetInstance() #define LOGGER Logger #define CONTENT ContentManager #define TRANSFORM GetTransform() #define WINDOW Settings::GetInstance()->Window #define GRAPHICS Settings::GetInstance()->Graphics #define PERFORMANCE PerformanceInfo::GetInstance() #pragma endregion Macros
23.7
79
0.711205
Illation
ab9e78b628e2acadb080ef547e1f368d591a8f03
2,700
cpp
C++
src/ohm.cpp
rohanl/ESP8266_WiFi_v2.x
6ce604a64effa9c6a56ff078529f616de8f82835
[ "Unlicense" ]
72
2017-03-08T22:31:33.000Z
2022-01-28T05:41:39.000Z
src/ohm.cpp
rohanl/ESP8266_WiFi_v2.x
6ce604a64effa9c6a56ff078529f616de8f82835
[ "Unlicense" ]
228
2017-03-05T13:21:16.000Z
2021-10-09T23:06:26.000Z
src/ohm.cpp
rohanl/ESP8266_WiFi_v2.x
6ce604a64effa9c6a56ff078529f616de8f82835
[ "Unlicense" ]
53
2017-03-06T10:59:13.000Z
2022-02-06T23:08:25.000Z
#include "emonesp.h" #include "input.h" #include "wifi.h" #include "app_config.h" #include "RapiSender.h" #include <WiFiClientSecure.h> #include <ESP8266HTTPClient.h> #include <Arduino.h> #define ACTIVE_TAG_START "<active>" #define ACTIVE_TAG_END "</active>" //Server strings for Ohm Connect const char *ohm_host = "login.ohmconnect.com"; const char *ohm_url = "/verify-ohm-hour/"; const int ohm_httpsPort = 443; const char *ohm_fingerprint = "0C 53 16 B1 DE 52 CD 3E 57 C5 6C A9 45 A2 DD 0A 04 1A AD C6"; String ohm_hour = "NotConnected"; int evse_sleep = 0; extern RapiSender rapiSender; // ------------------------------------------------------------------- // Ohm Connect "Ohm Hour" // // Call every once every 60 seconds if connected to the WiFi and // Ohm Key is set // ------------------------------------------------------------------- void ohm_loop() { Profile_Start(ohm_loop); if (ohm != 0) { WiFiClientSecure client; if (!client.connect(ohm_host, ohm_httpsPort)) { DBUGLN(F("ERROR Ohm Connect - connection failed")); return; } if (client.verify(ohm_fingerprint, ohm_host)) { client.print(String("GET ") + ohm_url + ohm + " HTTP/1.1\r\n" + "Host: " + ohm_host + "\r\n" + "User-Agent: OpenEVSE\r\n" + "Connection: close\r\n\r\n"); String line = client.readString(); DBUGVAR(line); int active_start = line.indexOf(ACTIVE_TAG_START); int active_end = line.indexOf(ACTIVE_TAG_END); if(active_start > 0 && active_end > 0) { active_start += sizeof(ACTIVE_TAG_START) - 1; String new_ohm_hour = line.substring(active_start, active_end); DBUGVAR(new_ohm_hour); if(new_ohm_hour != ohm_hour) { ohm_hour = new_ohm_hour; if(ohm_hour == "True") { DBUGLN(F("Ohm Hour")); if (evse_sleep == 0) { evse_sleep = 1; rapiSender.sendCmd(F("$FS"), [](int ret) { if(RAPI_RESPONSE_OK == ret) { DBUGLN(F("Charge Stopped")); } }); } } else { DBUGLN(F("It is not an Ohm Hour")); if (evse_sleep == 1) { evse_sleep = 0; rapiSender.sendCmd(F("$FE"), [](int ret) { if(RAPI_RESPONSE_OK == ret) { DBUGLN(F("Charging enabled")); } }); } } } } } else { DBUGLN(F("ERROR Ohm Connect - Certificate Invalid")); } } Profile_End(ohm_loop, 5); }
26.213592
77
0.510741
rohanl
aba579bd8df72707a495c46c1914a111dc0a4013
2,480
cpp
C++
dbms/src/Core/FieldVisitors.cpp
rudneff/ClickHouse
3cb59b92bccbeb888d136f7c6e14b622382c0434
[ "Apache-2.0" ]
3
2016-12-30T14:19:47.000Z
2021-11-13T06:58:32.000Z
dbms/src/Core/FieldVisitors.cpp
rudneff/ClickHouse
3cb59b92bccbeb888d136f7c6e14b622382c0434
[ "Apache-2.0" ]
null
null
null
dbms/src/Core/FieldVisitors.cpp
rudneff/ClickHouse
3cb59b92bccbeb888d136f7c6e14b622382c0434
[ "Apache-2.0" ]
1
2021-02-07T16:00:54.000Z
2021-02-07T16:00:54.000Z
#include <DB/Core/FieldVisitors.h> namespace DB { String FieldVisitorDump::operator() (const String & x) const { String res; WriteBufferFromString wb(res); writeQuoted(x, wb); return res; } String FieldVisitorDump::operator() (const Array & x) const { String res; WriteBufferFromString wb(res); FieldVisitorDump visitor; wb.write("Array_[", 7); for (Array::const_iterator it = x.begin(); it != x.end(); ++it) { if (it != x.begin()) wb.write(", ", 2); writeString(apply_visitor(visitor, *it), wb); } writeChar(']', wb); return res; } String FieldVisitorDump::operator() (const Tuple & x_def) const { auto & x = x_def.t; String res; WriteBufferFromString wb(res); FieldVisitorDump visitor; wb.write("Tuple_[", 7); for (auto it = x.begin(); it != x.end(); ++it) { if (it != x.begin()) wb.write(", ", 2); writeString(apply_visitor(visitor, *it), wb); } writeChar(']', wb); return res; } String FieldVisitorToString::formatFloat(const Float64 x) { DoubleConverter<true>::BufferType buffer; double_conversion::StringBuilder builder{buffer, sizeof(buffer)}; const auto result = DoubleConverter<true>::instance().ToShortest(x, &builder); if (!result) throw Exception("Cannot print float or double number", ErrorCodes::CANNOT_PRINT_FLOAT_OR_DOUBLE_NUMBER); return { buffer, buffer + builder.position() }; } String FieldVisitorToString::operator() (const Array & x) const { String res; WriteBufferFromString wb(res); FieldVisitorToString visitor; writeChar('[', wb); for (Array::const_iterator it = x.begin(); it != x.end(); ++it) { if (it != x.begin()) wb.write(", ", 2); writeString(apply_visitor(visitor, *it), wb); } writeChar(']', wb); return res; } String FieldVisitorToString::operator() (const Tuple & x_def) const { auto & x = x_def.t; String res; WriteBufferFromString wb(res); FieldVisitorToString visitor; writeChar('(', wb); for (auto it = x.begin(); it != x.end(); ++it) { if (it != x.begin()) wb.write(", ", 2); writeString(apply_visitor(visitor, *it), wb); } writeChar(')', wb); return res; } UInt64 stringToDateOrDateTime(const String & s) { ReadBufferFromString in(s); if (s.size() == strlen("YYYY-MM-DD")) { DayNum_t date{}; readDateText(date, in); return UInt64(date); } else { time_t date_time{}; readDateTimeText(date_time, in); if (!in.eof()) throw Exception("String is too long for DateTime: " + s); return UInt64(date_time); } } }
19.527559
106
0.662903
rudneff
aba597a776c11ed7cc96e272a450ffeaa32db935
1,113
cpp
C++
src/common/file_utils.cpp
subject721/flow-orchestrator
cadc646db5eece510c1dc1edf7bacf5060a7915c
[ "BSD-3-Clause" ]
3
2021-10-05T08:13:56.000Z
2022-02-07T22:41:03.000Z
src/common/file_utils.cpp
subject721/flow-orchestrator
cadc646db5eece510c1dc1edf7bacf5060a7915c
[ "BSD-3-Clause" ]
null
null
null
src/common/file_utils.cpp
subject721/flow-orchestrator
cadc646db5eece510c1dc1edf7bacf5060a7915c
[ "BSD-3-Clause" ]
1
2022-02-07T22:41:05.000Z
2022-02-07T22:41:05.000Z
/* * SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2021, Stefan Seitz * */ #include <common/file_utils.hpp> #include <fstream> std::string load_file_as_string(const std::filesystem::path& file_path) { if ( exists(file_path) ) { std::ifstream file_stream(file_path.c_str()); if ( !file_stream.is_open() ) { throw std::runtime_error("could not open file for reading"); } size_t file_size; file_stream.seekg(0, std::ios::end); file_size = file_stream.tellg(); file_stream.seekg(0); std::string out; out.resize(file_size); file_stream.read(&out.front(), file_size); return out; } else { throw std::runtime_error("file does not exist"); } } struct filesystem_watcher::private_data { }; filesystem_watcher::filesystem_watcher() { } filesystem_watcher::~filesystem_watcher() { } fdescriptor::fdtype filesystem_watcher::get_fd() const { return fdescriptor::INVALID_FD; } bool filesystem_watcher::wait(uint32_t fd_op_flags, uint32_t timeout_ms) { return false; }
19.526316
74
0.651393
subject721
aba99ad1cea6bb5e10c4f5aaeb0a4836ae07bd03
3,622
cc
C++
components/ukm/ukm_reporting_service.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/ukm/ukm_reporting_service.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/ukm/ukm_reporting_service.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2017 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. // ReportingService specialized to report UKM metrics. #include "components/ukm/ukm_reporting_service.h" #include "base/memory/ptr_util.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "components/prefs/pref_registry_simple.h" #include "components/ukm/persisted_logs_metrics_impl.h" #include "components/ukm/ukm_pref_names.h" #include "components/ukm/ukm_service.h" namespace ukm { namespace { // The UKM server's URL. constexpr char kMimeType[] = "application/vnd.chrome.ukm"; // The number of UKM logs that will be stored in PersistedLogs before logs // start being dropped. constexpr int kMinPersistedLogs = 8; // The number of bytes UKM logs that will be stored in PersistedLogs before // logs start being dropped. // This ensures that a reasonable amount of history will be stored even if there // is a long series of very small logs. constexpr int kMinPersistedBytes = 300000; // If an upload fails, and the transmission was over this byte count, then we // will discard the log, and not try to retransmit it. We also don't persist // the log to the prefs for transmission during the next chrome session if this // limit is exceeded. constexpr size_t kMaxLogRetransmitSize = 100 * 1024; std::string GetServerUrl() { constexpr char kDefaultServerUrl[] = "https://clients4.google.com/ukm"; std::string server_url = base::GetFieldTrialParamValueByFeature(kUkmFeature, "ServerUrl"); if (!server_url.empty()) return server_url; return kDefaultServerUrl; } } // namespace // static void UkmReportingService::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterListPref(prefs::kUkmPersistedLogs); // Base class already registered by MetricsReportingService::RegisterPrefs // ReportingService::RegisterPrefs(registry); } UkmReportingService::UkmReportingService(metrics::MetricsServiceClient* client, PrefService* local_state) : ReportingService(client, local_state, kMaxLogRetransmitSize), persisted_logs_(base::MakeUnique<ukm::PersistedLogsMetricsImpl>(), local_state, prefs::kUkmPersistedLogs, kMinPersistedLogs, kMinPersistedBytes, kMaxLogRetransmitSize) {} UkmReportingService::~UkmReportingService() {} metrics::LogStore* UkmReportingService::log_store() { return &persisted_logs_; } std::string UkmReportingService::GetUploadUrl() const { return GetServerUrl(); } base::StringPiece UkmReportingService::upload_mime_type() const { return kMimeType; } metrics::MetricsLogUploader::MetricServiceType UkmReportingService::service_type() const { return metrics::MetricsLogUploader::UKM; } void UkmReportingService::LogCellularConstraint(bool upload_canceled) { UMA_HISTOGRAM_BOOLEAN("UKM.LogUpload.Canceled.CellularConstraint", upload_canceled); } void UkmReportingService::LogResponseOrErrorCode(int response_code, int error_code) { UMA_HISTOGRAM_SPARSE_SLOWLY("UKM.LogUpload.ResponseOrErrorCode", response_code >= 0 ? response_code : error_code); } void UkmReportingService::LogSuccess(size_t log_size) { UMA_HISTOGRAM_COUNTS_10000("UKM.LogSize.OnSuccess", log_size / 1024); } void UkmReportingService::LogLargeRejection(size_t log_size) {} } // namespace metrics
34.495238
80
0.732192
metux
aba9cf1f2951343060df04a5d5c07031ce858464
46,210
cc
C++
call/adaptation/video_stream_adapter_unittest.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
344
2016-07-03T11:45:20.000Z
2022-03-19T16:54:10.000Z
call/adaptation/video_stream_adapter_unittest.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
59
2020-08-24T09:17:42.000Z
2022-02-27T23:33:37.000Z
call/adaptation/video_stream_adapter_unittest.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
278
2016-04-26T07:37:12.000Z
2022-01-24T10:09:44.000Z
/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "call/adaptation/video_stream_adapter.h" #include <string> #include <utility> #include "absl/types/optional.h" #include "api/scoped_refptr.h" #include "api/video/video_adaptation_reason.h" #include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/video_encoder_config.h" #include "call/adaptation/adaptation_constraint.h" #include "call/adaptation/encoder_settings.h" #include "call/adaptation/test/fake_frame_rate_provider.h" #include "call/adaptation/test/fake_resource.h" #include "call/adaptation/test/fake_video_stream_input_state_provider.h" #include "call/adaptation/video_source_restrictions.h" #include "call/adaptation/video_stream_input_state.h" #include "rtc_base/string_encode.h" #include "test/field_trial.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/testsupport/rtc_expect_death.h" namespace webrtc { using ::testing::_; using ::testing::DoAll; using ::testing::Return; using ::testing::SaveArg; namespace { const int kBalancedHighResolutionPixels = 1280 * 720; const int kBalancedHighFrameRateFps = 30; const int kBalancedMediumResolutionPixels = 640 * 480; const int kBalancedMediumFrameRateFps = 20; const int kBalancedLowResolutionPixels = 320 * 240; const int kBalancedLowFrameRateFps = 10; std::string BalancedFieldTrialConfig() { return "WebRTC-Video-BalancedDegradationSettings/pixels:" + rtc::ToString(kBalancedLowResolutionPixels) + "|" + rtc::ToString(kBalancedMediumResolutionPixels) + "|" + rtc::ToString(kBalancedHighResolutionPixels) + ",fps:" + rtc::ToString(kBalancedLowFrameRateFps) + "|" + rtc::ToString(kBalancedMediumFrameRateFps) + "|" + rtc::ToString(kBalancedHighFrameRateFps) + "/"; } // Responsible for adjusting the inputs to VideoStreamAdapter (SetInput), such // as pixels and frame rate, according to the most recent source restrictions. // This helps tests that apply adaptations multiple times: if the input is not // adjusted between adaptations, the subsequent adaptations fail with // kAwaitingPreviousAdaptation. class FakeVideoStream { public: FakeVideoStream(VideoStreamAdapter* adapter, FakeVideoStreamInputStateProvider* provider, int input_pixels, int input_fps, int min_pixels_per_frame) : adapter_(adapter), provider_(provider), input_pixels_(input_pixels), input_fps_(input_fps), min_pixels_per_frame_(min_pixels_per_frame) { provider_->SetInputState(input_pixels_, input_fps_, min_pixels_per_frame_); } int input_pixels() const { return input_pixels_; } int input_fps() const { return input_fps_; } // Performs ApplyAdaptation() followed by SetInput() with input pixels and // frame rate adjusted according to the resulting restrictions. void ApplyAdaptation(Adaptation adaptation) { adapter_->ApplyAdaptation(adaptation, nullptr); // Update input pixels and fps according to the resulting restrictions. auto restrictions = adapter_->source_restrictions(); if (restrictions.target_pixels_per_frame().has_value()) { RTC_DCHECK(!restrictions.max_pixels_per_frame().has_value() || restrictions.max_pixels_per_frame().value() >= restrictions.target_pixels_per_frame().value()); input_pixels_ = restrictions.target_pixels_per_frame().value(); } else if (restrictions.max_pixels_per_frame().has_value()) { input_pixels_ = restrictions.max_pixels_per_frame().value(); } if (restrictions.max_frame_rate().has_value()) { input_fps_ = restrictions.max_frame_rate().value(); } provider_->SetInputState(input_pixels_, input_fps_, min_pixels_per_frame_); } private: VideoStreamAdapter* adapter_; FakeVideoStreamInputStateProvider* provider_; int input_pixels_; int input_fps_; int min_pixels_per_frame_; }; class FakeVideoStreamAdapterListner : public VideoSourceRestrictionsListener { public: void OnVideoSourceRestrictionsUpdated( VideoSourceRestrictions restrictions, const VideoAdaptationCounters& adaptation_counters, rtc::scoped_refptr<Resource> reason, const VideoSourceRestrictions& unfiltered_restrictions) override { calls_++; last_restrictions_ = unfiltered_restrictions; } int calls() const { return calls_; } VideoSourceRestrictions last_restrictions() const { return last_restrictions_; } private: int calls_ = 0; VideoSourceRestrictions last_restrictions_; }; class MockAdaptationConstraint : public AdaptationConstraint { public: MOCK_METHOD(bool, IsAdaptationUpAllowed, (const VideoStreamInputState& input_state, const VideoSourceRestrictions& restrictions_before, const VideoSourceRestrictions& restrictions_after), (const, override)); // MOCK_METHOD(std::string, Name, (), (const, override)); std::string Name() const override { return "MockAdaptationConstraint"; } }; } // namespace class VideoStreamAdapterTest : public ::testing::Test { public: VideoStreamAdapterTest() : field_trials_(BalancedFieldTrialConfig()), resource_(FakeResource::Create("FakeResource")), adapter_(&input_state_provider_, &encoder_stats_observer_) {} protected: webrtc::test::ScopedFieldTrials field_trials_; FakeVideoStreamInputStateProvider input_state_provider_; rtc::scoped_refptr<Resource> resource_; testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_; VideoStreamAdapter adapter_; }; TEST_F(VideoStreamAdapterTest, NoRestrictionsByDefault) { EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_DecreasesPixelsToThreeFifths) { const int kInputPixels = 1280 * 720; adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider_.SetInputState(kInputPixels, 30, kDefaultMinPixelsPerFrame); Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); adapter_.ApplyAdaptation(adaptation, nullptr); EXPECT_EQ(static_cast<size_t>((kInputPixels * 3) / 5), adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_DecreasesPixelsToLimitReached) { const int kMinPixelsPerFrame = 640 * 480; adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider_.SetInputState(kMinPixelsPerFrame + 1, 30, kMinPixelsPerFrame); EXPECT_CALL(encoder_stats_observer_, OnMinPixelLimitReached()); // Even though we are above kMinPixelsPerFrame, because adapting down would // have exceeded the limit, we are said to have reached the limit already. // This differs from the frame rate adaptation logic, which would have clamped // to the limit in the first step and reported kLimitReached in the second // step. Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kLimitReached, adaptation.status()); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_IncreasePixelsToFiveThirds) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Go down twice, ensuring going back up is still a restricted resolution. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations); int input_pixels = fake_stream.input_pixels(); // Go up once. The target is 5/3 and the max is 12/5 of the target. const int target = (input_pixels * 5) / 3; fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(static_cast<size_t>((target * 12) / 5), adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(static_cast<size_t>(target), adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_IncreasePixelsToUnrestricted) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // We are unrestricted by default and should not be able to adapt up. EXPECT_EQ(Adaptation::Status::kLimitReached, adapter_.GetAdaptationUp().status()); // If we go down once and then back up we should not have any restrictions. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); } TEST_F(VideoStreamAdapterTest, MaintainResolution_DecreasesFpsToTwoThirds) { const int kInputFps = 30; adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); input_state_provider_.SetInputState(1280 * 720, kInputFps, kDefaultMinPixelsPerFrame); Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); adapter_.ApplyAdaptation(adaptation, nullptr); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>((kInputFps * 2) / 3), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainResolution_DecreasesFpsToLimitReached) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, kMinFrameRateFps + 1, kDefaultMinPixelsPerFrame); // If we are not yet at the limit and the next step would exceed it, the step // is clamped such that we end up exactly on the limit. Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(static_cast<double>(kMinFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); // Having reached the limit, the next adaptation down is not valid. EXPECT_EQ(Adaptation::Status::kLimitReached, adapter_.GetAdaptationDown().status()); } TEST_F(VideoStreamAdapterTest, MaintainResolution_IncreaseFpsToThreeHalves) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Go down twice, ensuring going back up is still a restricted frame rate. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(2, adapter_.adaptation_counters().fps_adaptations); int input_fps = fake_stream.input_fps(); // Go up once. The target is 3/2 of the input. Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>((input_fps * 3) / 2), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainResolution_IncreaseFpsToUnrestricted) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // We are unrestricted by default and should not be able to adapt up. EXPECT_EQ(Adaptation::Status::kLimitReached, adapter_.GetAdaptationUp().status()); // If we go down once and then back up we should not have any restrictions. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); } TEST_F(VideoStreamAdapterTest, Balanced_DecreaseFrameRate) { adapter_.SetDegradationPreference(DegradationPreference::BALANCED); input_state_provider_.SetInputState(kBalancedMediumResolutionPixels, kBalancedHighFrameRateFps, kDefaultMinPixelsPerFrame); // If our frame rate is higher than the frame rate associated with our // resolution we should try to adapt to the frame rate associated with our // resolution: kBalancedMediumFrameRateFps. Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); adapter_.ApplyAdaptation(adaptation, nullptr); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>(kBalancedMediumFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, Balanced_DecreaseResolution) { adapter_.SetDegradationPreference(DegradationPreference::BALANCED); FakeVideoStream fake_stream( &adapter_, &input_state_provider_, kBalancedHighResolutionPixels, kBalancedHighFrameRateFps, kDefaultMinPixelsPerFrame); // If we are not below the current resolution's frame rate limit, we should // adapt resolution according to "maintain-framerate" logic (three fifths). // // However, since we are unlimited at the start and input frame rate is not // below kBalancedHighFrameRateFps, we first restrict the frame rate to // kBalancedHighFrameRateFps even though that is our current frame rate. This // does prevent the source from going higher, though, so it's technically not // a NO-OP. { Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); } EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); // Verify "maintain-framerate" logic the second time we adapt: Frame rate // restrictions remains the same and resolution goes down. { Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); } constexpr size_t kReducedPixelsFirstStep = static_cast<size_t>((kBalancedHighResolutionPixels * 3) / 5); EXPECT_EQ(kReducedPixelsFirstStep, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); // If we adapt again, because the balanced settings' proposed frame rate is // still kBalancedHighFrameRateFps, "maintain-framerate" will trigger again. static_assert(kReducedPixelsFirstStep > kBalancedMediumResolutionPixels, "The reduced resolution is still greater than the next lower " "balanced setting resolution"); constexpr size_t kReducedPixelsSecondStep = (kReducedPixelsFirstStep * 3) / 5; { Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); } EXPECT_EQ(kReducedPixelsSecondStep, adapter_.source_restrictions().max_pixels_per_frame()); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } // Testing when to adapt frame rate and when to adapt resolution is quite // entangled, so this test covers both cases. // // There is an asymmetry: When we adapt down we do it in one order, but when we // adapt up we don't do it in the reverse order. Instead we always try to adapt // frame rate first according to balanced settings' configs and only when the // frame rate is already achieved do we adjust the resolution. TEST_F(VideoStreamAdapterTest, Balanced_IncreaseFrameRateAndResolution) { adapter_.SetDegradationPreference(DegradationPreference::BALANCED); FakeVideoStream fake_stream( &adapter_, &input_state_provider_, kBalancedHighResolutionPixels, kBalancedHighFrameRateFps, kDefaultMinPixelsPerFrame); // The desired starting point of this test is having adapted frame rate twice. // This requires performing a number of adaptations. constexpr size_t kReducedPixelsFirstStep = static_cast<size_t>((kBalancedHighResolutionPixels * 3) / 5); constexpr size_t kReducedPixelsSecondStep = (kReducedPixelsFirstStep * 3) / 5; constexpr size_t kReducedPixelsThirdStep = (kReducedPixelsSecondStep * 3) / 5; static_assert(kReducedPixelsFirstStep > kBalancedMediumResolutionPixels, "The first pixel reduction is greater than the balanced " "settings' medium pixel configuration"); static_assert(kReducedPixelsSecondStep > kBalancedMediumResolutionPixels, "The second pixel reduction is greater than the balanced " "settings' medium pixel configuration"); static_assert(kReducedPixelsThirdStep <= kBalancedMediumResolutionPixels, "The third pixel reduction is NOT greater than the balanced " "settings' medium pixel configuration"); // The first adaptation should affect the frame rate: See // Balanced_DecreaseResolution for explanation why. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps), adapter_.source_restrictions().max_frame_rate()); // The next three adaptations affects the resolution, because we have to reach // kBalancedMediumResolutionPixels before a lower frame rate is considered by // BalancedDegradationSettings. The number three is derived from the // static_asserts above. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(kReducedPixelsFirstStep, adapter_.source_restrictions().max_pixels_per_frame()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(kReducedPixelsSecondStep, adapter_.source_restrictions().max_pixels_per_frame()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(kReducedPixelsThirdStep, adapter_.source_restrictions().max_pixels_per_frame()); // Thus, the next adaptation will reduce frame rate to // kBalancedMediumFrameRateFps. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(static_cast<double>(kBalancedMediumFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(3, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(2, adapter_.adaptation_counters().fps_adaptations); // Adapt up! // While our resolution is in the medium-range, the frame rate associated with // the next resolution configuration up ("high") is kBalancedHighFrameRateFps // and "balanced" prefers adapting frame rate if not already applied. { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(static_cast<double>(kBalancedHighFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(3, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } // Now that we have already achieved the next frame rate up, we act according // to "maintain-framerate". We go back up in resolution. Due to rounding // errors we don't end up back at kReducedPixelsSecondStep. Rather we get to // kReducedPixelsSecondStepUp, which is off by one compared to // kReducedPixelsSecondStep. constexpr size_t kReducedPixelsSecondStepUp = (kReducedPixelsThirdStep * 5) / 3; { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(kReducedPixelsSecondStepUp, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } // Now that our resolution is back in the high-range, the next frame rate to // try out is "unlimited". { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(absl::nullopt, adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations); } // Now only adapting resolution remains. constexpr size_t kReducedPixelsFirstStepUp = (kReducedPixelsSecondStepUp * 5) / 3; { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(kReducedPixelsFirstStepUp, adapter_.source_restrictions().target_pixels_per_frame()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations); } // The last step up should make us entirely unrestricted. { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); } } TEST_F(VideoStreamAdapterTest, Balanced_LimitReached) { adapter_.SetDegradationPreference(DegradationPreference::BALANCED); FakeVideoStream fake_stream( &adapter_, &input_state_provider_, kBalancedLowResolutionPixels, kBalancedLowFrameRateFps, kDefaultMinPixelsPerFrame); // Attempting to adapt up while unrestricted should result in kLimitReached. EXPECT_EQ(Adaptation::Status::kLimitReached, adapter_.GetAdaptationUp().status()); // Adapting down once result in restricted frame rate, in this case we reach // the lowest possible frame rate immediately: kBalancedLowFrameRateFps. EXPECT_CALL(encoder_stats_observer_, OnMinPixelLimitReached()).Times(2); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(static_cast<double>(kBalancedLowFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); // Any further adaptation must follow "maintain-framerate" rules (these are // covered in more depth by the MaintainFramerate tests). This test does not // assert exactly how resolution is adjusted, only that resolution always // decreases and that we eventually reach kLimitReached. size_t previous_resolution = kBalancedLowResolutionPixels; bool did_reach_limit = false; // If we have not reached the limit within 5 adaptations something is wrong... for (int i = 0; i < 5; i++) { Adaptation adaptation = adapter_.GetAdaptationDown(); if (adaptation.status() == Adaptation::Status::kLimitReached) { did_reach_limit = true; break; } EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_LT(adapter_.source_restrictions().max_pixels_per_frame().value(), previous_resolution); previous_resolution = adapter_.source_restrictions().max_pixels_per_frame().value(); } EXPECT_TRUE(did_reach_limit); // Frame rate restrictions are the same as before. EXPECT_EQ(static_cast<double>(kBalancedLowFrameRateFps), adapter_.source_restrictions().max_frame_rate()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); } // kAwaitingPreviousAdaptation is only supported in "maintain-framerate". TEST_F(VideoStreamAdapterTest, MaintainFramerate_AwaitingPreviousAdaptationDown) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down once, but don't update the input. adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); { // Having performed the adaptation, but not updated the input based on the // new restrictions, adapting again in the same direction will not work. Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation, adaptation.status()); } } // kAwaitingPreviousAdaptation is only supported in "maintain-framerate". TEST_F(VideoStreamAdapterTest, MaintainFramerate_AwaitingPreviousAdaptationUp) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Perform two adaptation down so that adapting up twice is possible. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(2, adapter_.adaptation_counters().resolution_adaptations); // Adapt up once, but don't update the input. adapter_.ApplyAdaptation(adapter_.GetAdaptationUp(), nullptr); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); { // Having performed the adaptation, but not updated the input based on the // new restrictions, adapting again in the same direction will not work. Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation, adaptation.status()); } } TEST_F(VideoStreamAdapterTest, MaintainResolution_AdaptsUpAfterSwitchingDegradationPreference) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down in fps for later. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations); // We should be able to adapt in framerate one last time after the change of // degradation preference. adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_AdaptsUpAfterSwitchingDegradationPreference) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down in resolution for later. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); EXPECT_EQ(0, adapter_.adaptation_counters().fps_adaptations); // We should be able to adapt in framerate one last time after the change of // degradation preference. adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adapter_.GetAdaptationUp()); EXPECT_EQ(0, adapter_.adaptation_counters().resolution_adaptations); } TEST_F(VideoStreamAdapterTest, PendingResolutionIncreaseAllowsAdaptUpAfterSwitchToMaintainResolution) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt fps down so we can adapt up later in the test. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); // Apply adaptation up but don't update input. adapter_.ApplyAdaptation(adapter_.GetAdaptationUp(), nullptr); EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation, adapter_.GetAdaptationUp().status()); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); } TEST_F(VideoStreamAdapterTest, MaintainFramerate_AdaptsDownAfterSwitchingDegradationPreference) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down once, should change FPS. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); // Adaptation down should apply after the degradation prefs change. Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); } TEST_F(VideoStreamAdapterTest, MaintainResolution_AdaptsDownAfterSwitchingDegradationPreference) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down once, should change FPS. fake_stream.ApplyAdaptation(adapter_.GetAdaptationDown()); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(1, adapter_.adaptation_counters().fps_adaptations); EXPECT_EQ(1, adapter_.adaptation_counters().resolution_adaptations); } TEST_F( VideoStreamAdapterTest, PendingResolutionDecreaseAllowsAdaptDownAfterSwitchToMaintainResolution) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Apply adaptation but don't update the input. adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr); EXPECT_EQ(Adaptation::Status::kAwaitingPreviousAdaptation, adapter_.GetAdaptationDown().status()); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); } TEST_F(VideoStreamAdapterTest, RestrictionBroadcasted) { FakeVideoStreamAdapterListner listener; adapter_.AddRestrictionsListener(&listener); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Not broadcast on invalid ApplyAdaptation. { Adaptation adaptation = adapter_.GetAdaptationUp(); adapter_.ApplyAdaptation(adaptation, nullptr); EXPECT_EQ(0, listener.calls()); } // Broadcast on ApplyAdaptation. { Adaptation adaptation = adapter_.GetAdaptationDown(); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(1, listener.calls()); EXPECT_EQ(adaptation.restrictions(), listener.last_restrictions()); } // Broadcast on ClearRestrictions(). adapter_.ClearRestrictions(); EXPECT_EQ(2, listener.calls()); EXPECT_EQ(VideoSourceRestrictions(), listener.last_restrictions()); } TEST_F(VideoStreamAdapterTest, AdaptationHasNextRestrcitions) { // Any non-disabled DegradationPreference will do. adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // When adaptation is not possible. { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kLimitReached, adaptation.status()); EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adaptation.counters().Total()); } // When we adapt down. { Adaptation adaptation = adapter_.GetAdaptationDown(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions()); EXPECT_EQ(adaptation.counters(), adapter_.adaptation_counters()); } // When we adapt up. { Adaptation adaptation = adapter_.GetAdaptationUp(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); fake_stream.ApplyAdaptation(adaptation); EXPECT_EQ(adaptation.restrictions(), adapter_.source_restrictions()); EXPECT_EQ(adaptation.counters(), adapter_.adaptation_counters()); } } TEST_F(VideoStreamAdapterTest, SetDegradationPreferenceToOrFromBalancedClearsRestrictions) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr); EXPECT_NE(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_NE(0, adapter_.adaptation_counters().Total()); // Changing from non-balanced to balanced clears the restrictions. adapter_.SetDegradationPreference(DegradationPreference::BALANCED); EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); // Apply adaptation again. adapter_.ApplyAdaptation(adapter_.GetAdaptationDown(), nullptr); EXPECT_NE(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_NE(0, adapter_.adaptation_counters().Total()); // Changing from balanced to non-balanced clears the restrictions. adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); EXPECT_EQ(VideoSourceRestrictions(), adapter_.source_restrictions()); EXPECT_EQ(0, adapter_.adaptation_counters().Total()); } TEST_F(VideoStreamAdapterTest, GetAdaptDownResolutionAdaptsResolutionInMaintainFramerate) { adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); auto adaptation = adapter_.GetAdaptDownResolution(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); EXPECT_EQ(1, adaptation.counters().resolution_adaptations); EXPECT_EQ(0, adaptation.counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, GetAdaptDownResolutionReturnsWithStatusInDisabledAndMaintainResolution) { adapter_.SetDegradationPreference(DegradationPreference::DISABLED); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); EXPECT_EQ(Adaptation::Status::kAdaptationDisabled, adapter_.GetAdaptDownResolution().status()); adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); EXPECT_EQ(Adaptation::Status::kLimitReached, adapter_.GetAdaptDownResolution().status()); } TEST_F(VideoStreamAdapterTest, GetAdaptDownResolutionAdaptsFpsAndResolutionInBalanced) { // Note: This test depends on BALANCED implementation, but with current // implementation and input state settings, BALANCED will adapt resolution and // frame rate once. adapter_.SetDegradationPreference(DegradationPreference::BALANCED); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); auto adaptation = adapter_.GetAdaptDownResolution(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); EXPECT_EQ(1, adaptation.counters().resolution_adaptations); EXPECT_EQ(1, adaptation.counters().fps_adaptations); } TEST_F( VideoStreamAdapterTest, GetAdaptDownResolutionAdaptsOnlyResolutionIfFpsAlreadyAdapterInBalanced) { // Note: This test depends on BALANCED implementation, but with current // implementation and input state settings, BALANCED will adapt resolution // only. adapter_.SetDegradationPreference(DegradationPreference::BALANCED); input_state_provider_.SetInputState(1280 * 720, 5, kDefaultMinPixelsPerFrame); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); auto first_adaptation = adapter_.GetAdaptationDown(); fake_stream.ApplyAdaptation(first_adaptation); auto adaptation = adapter_.GetAdaptDownResolution(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); EXPECT_EQ(1, adaptation.counters().resolution_adaptations); EXPECT_EQ(first_adaptation.counters().fps_adaptations, adaptation.counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, GetAdaptDownResolutionAdaptsOnlyFpsIfResolutionLowInBalanced) { // Note: This test depends on BALANCED implementation, but with current // implementation and input state settings, BALANCED will adapt resolution // only. adapter_.SetDegradationPreference(DegradationPreference::BALANCED); input_state_provider_.SetInputState(kDefaultMinPixelsPerFrame, 30, kDefaultMinPixelsPerFrame); auto adaptation = adapter_.GetAdaptDownResolution(); EXPECT_EQ(Adaptation::Status::kValid, adaptation.status()); EXPECT_EQ(0, adaptation.counters().resolution_adaptations); EXPECT_EQ(1, adaptation.counters().fps_adaptations); } TEST_F(VideoStreamAdapterTest, AdaptationDisabledStatusAlwaysWhenDegradationPreferenceDisabled) { adapter_.SetDegradationPreference(DegradationPreference::DISABLED); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); EXPECT_EQ(Adaptation::Status::kAdaptationDisabled, adapter_.GetAdaptationDown().status()); EXPECT_EQ(Adaptation::Status::kAdaptationDisabled, adapter_.GetAdaptationUp().status()); EXPECT_EQ(Adaptation::Status::kAdaptationDisabled, adapter_.GetAdaptDownResolution().status()); } TEST_F(VideoStreamAdapterTest, AdaptationConstraintAllowsAdaptationsUp) { testing::StrictMock<MockAdaptationConstraint> adaptation_constraint; adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); adapter_.AddAdaptationConstraint(&adaptation_constraint); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down once so we can adapt up later. auto first_adaptation = adapter_.GetAdaptationDown(); fake_stream.ApplyAdaptation(first_adaptation); EXPECT_CALL(adaptation_constraint, IsAdaptationUpAllowed(_, first_adaptation.restrictions(), _)) .WillOnce(Return(true)); EXPECT_EQ(Adaptation::Status::kValid, adapter_.GetAdaptationUp().status()); adapter_.RemoveAdaptationConstraint(&adaptation_constraint); } TEST_F(VideoStreamAdapterTest, AdaptationConstraintDisallowsAdaptationsUp) { testing::StrictMock<MockAdaptationConstraint> adaptation_constraint; adapter_.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); adapter_.AddAdaptationConstraint(&adaptation_constraint); input_state_provider_.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); FakeVideoStream fake_stream(&adapter_, &input_state_provider_, 1280 * 720, 30, kDefaultMinPixelsPerFrame); // Adapt down once so we can adapt up later. auto first_adaptation = adapter_.GetAdaptationDown(); fake_stream.ApplyAdaptation(first_adaptation); EXPECT_CALL(adaptation_constraint, IsAdaptationUpAllowed(_, first_adaptation.restrictions(), _)) .WillOnce(Return(false)); EXPECT_EQ(Adaptation::Status::kRejectedByConstraint, adapter_.GetAdaptationUp().status()); adapter_.RemoveAdaptationConstraint(&adaptation_constraint); } // Death tests. // Disabled on Android because death tests misbehave on Android, see // base/test/gtest_util.h. #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) TEST(VideoStreamAdapterDeathTest, SetDegradationPreferenceInvalidatesAdaptations) { FakeVideoStreamInputStateProvider input_state_provider; testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_; VideoStreamAdapter adapter(&input_state_provider, &encoder_stats_observer_); adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_FRAMERATE); input_state_provider.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); Adaptation adaptation = adapter.GetAdaptationDown(); adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); EXPECT_DEATH(adapter.ApplyAdaptation(adaptation, nullptr), ""); } TEST(VideoStreamAdapterDeathTest, AdaptDownInvalidatesAdaptations) { FakeVideoStreamInputStateProvider input_state_provider; testing::StrictMock<MockVideoStreamEncoderObserver> encoder_stats_observer_; VideoStreamAdapter adapter(&input_state_provider, &encoder_stats_observer_); adapter.SetDegradationPreference(DegradationPreference::MAINTAIN_RESOLUTION); input_state_provider.SetInputState(1280 * 720, 30, kDefaultMinPixelsPerFrame); Adaptation adaptation = adapter.GetAdaptationDown(); adapter.GetAdaptationDown(); EXPECT_DEATH(adapter.ApplyAdaptation(adaptation, nullptr), ""); } #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) } // namespace webrtc
48.84778
80
0.764423
wnpllrzodiac
abb17457625a833fd82e6260759d766f4e78964a
4,085
cpp
C++
03_Tutorial/T07_XMOgre3D/Source/Sample/SkyBox.cpp
mcodegeeks/OpenKODE-Framework
d4382d781da7f488a0e7667362a89e8e389468dd
[ "MIT" ]
2
2017-08-03T07:15:00.000Z
2018-06-18T10:32:53.000Z
03_Tutorial/T07_XMOgre3D/Source/Sample/SkyBox.cpp
mcodegeeks/OpenKODE-Framework
d4382d781da7f488a0e7667362a89e8e389468dd
[ "MIT" ]
null
null
null
03_Tutorial/T07_XMOgre3D/Source/Sample/SkyBox.cpp
mcodegeeks/OpenKODE-Framework
d4382d781da7f488a0e7667362a89e8e389468dd
[ "MIT" ]
2
2019-03-04T22:57:42.000Z
2020-03-06T01:32:26.000Z
/* ------------------------------------------------------------------------------------ * * File SkyBox.cpp * Description This source file is part of OGRE * (Object-oriented Graphics Rendering Engine) * Author Y.H Mun * * ------------------------------------------------------------------------------------ * * Copyright (c) 2010-2013 XMSoft. All rights reserved. * * Contact Email: xmsoft77@gmail.com * * ------------------------------------------------------------------------------------ * * Copyright (c) 2010-2012 Torus Knot Software Ltd. * * For the latest info, see http://www.ogre3d.org/ * * ------------------------------------------------------------------------------------ * * 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 "SkyBox.h" Sample_SkyBox::Sample_SkyBox ( KDvoid ) { m_aInfo [ "Title" ] = "Sky Box"; m_aInfo [ "Description" ] = "Shows how to use skyboxes (fixed-distance cubes used for backgrounds)."; m_aInfo [ "Thumbnail" ] = "thumb_skybox.png"; m_aInfo [ "Category" ] = "Environment"; } KDvoid Sample_SkyBox::setupContent ( KDvoid ) { // setup some basic lighting for our scene m_pSceneMgr->setAmbientLight ( ColourValue ( 0.3, 0.3, 0.3 ) ); m_pSceneMgr->createLight ( )->setPosition ( 20, 80, 50 ); m_pSceneMgr->setSkyBox ( true, "Examples/SpaceSkyBox", 5000 ); // set our skybox // create a spaceship model, and place it at the origin m_pSceneMgr->getRootSceneNode ( )->attachObject ( m_pSceneMgr->createEntity ( "Razor", "razor.mesh" ) ); // create a particle system with 200 quota, then set its material and dimensions ParticleSystem* pThrusters = m_pSceneMgr->createParticleSystem ( 25 ); pThrusters->setMaterialName ( "Examples/Flare" ); pThrusters->setDefaultDimensions ( 25, 25 ); // create two emitters for our thruster particle system for ( KDuint i = 0; i < 2; i++ ) { ParticleEmitter* pEmitter = pThrusters->addEmitter ( "Point" ); // add a point emitter // set the emitter properties pEmitter->setAngle ( Degree ( 3 ) ); pEmitter->setTimeToLive ( 0.5 ); pEmitter->setEmissionRate ( 25 ); pEmitter->setParticleVelocity ( 25 ); pEmitter->setDirection ( Vector3::NEGATIVE_UNIT_Z); pEmitter->setColour ( ColourValue::White, ColourValue::Red ); pEmitter->setPosition ( Vector3 ( i == 0 ? 5.7 : -18, 0, 0 ) ); } // attach our thruster particles to the rear of the ship m_pSceneMgr->getRootSceneNode ( )->createChildSceneNode ( Vector3 ( 0, 6.5, -67 ) )->attachObject ( pThrusters ); // set the camera's initial position and orientation m_pCamera->setPosition ( 0, 0, 150 ); m_pCamera->yaw ( Degree ( 5 ) ); }
44.402174
117
0.583354
mcodegeeks
abb2e1af112da0d2e340cf43e24338c277ab56b5
4,006
cpp
C++
src/pair_wise_intersect.cpp
fanhualta/dint
d5b4b9ef1998119b2f06b9143153f7e82f12cb56
[ "Apache-2.0" ]
16
2019-01-27T20:41:07.000Z
2021-05-03T05:21:50.000Z
src/pair_wise_intersect.cpp
fanhualta/dint
d5b4b9ef1998119b2f06b9143153f7e82f12cb56
[ "Apache-2.0" ]
3
2020-06-25T03:28:28.000Z
2021-04-26T07:15:24.000Z
src/pair_wise_intersect.cpp
fanhualta/dint
d5b4b9ef1998119b2f06b9143153f7e82f12cb56
[ "Apache-2.0" ]
6
2019-08-20T02:34:16.000Z
2022-02-22T00:01:11.000Z
#include <iostream> #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/split.hpp> #include <succinct/mapper.hpp> #include "index_types.hpp" #include "util.hpp" typedef uint32_t term_id_type; typedef std::vector<term_id_type> term_id_vec; bool read_query(term_id_vec& ret, std::istream& is = std::cin) { ret.clear(); std::string line; if (!std::getline(is, line)) return false; std::istringstream iline(line); term_id_type term_id; while (iline >> term_id) { ret.push_back(term_id); } return true; } template <typename Enum> static uint64_t intersect(uint64_t num_docs, std::vector<Enum>& enums, std::vector<uint32_t>& out) { // increasing frequency if (enums[0].size() > enums[1].size()) { std::swap(enums[0], enums[1]); } uint64_t results = 0; uint64_t candidate = enums[0].docid(); size_t i = 1; while (candidate < num_docs) { for (; i < 2; ++i) { enums[i].next_geq(candidate); if (enums[i].docid() != candidate) { candidate = enums[i].docid(); i = 0; break; } } if (i == 2) { out[results] = candidate; ++results; enums[0].next(); candidate = enums[0].docid(); i = 1; } } return results; } template <typename Index> void perftest(const char* index_filename) { using namespace ds2i; Index index; logger() << "Loading index from " << index_filename << std::endl; boost::iostreams::mapped_file_source m(index_filename); succinct::mapper::map(index, m); std::vector<term_id_vec> queries; term_id_vec q; while (read_query(q)) { assert(q.size() == 2); queries.push_back(q); } uint32_t num_queries = queries.size(); logger() << "Executing " << num_queries << " pair-wise intersections..." << std::endl; uint64_t num_docs = index.num_docs(); std::vector<uint32_t> out(num_docs); double total_usecs = 0.0; // first run if for warming up static const int runs = 10 + 1; size_t total = 0; typedef typename Index::document_enumerator enum_type; std::vector<enum_type> qq; qq.reserve(2); for (int run = 0; run != runs; ++run) { double start = get_time_usecs(); for (uint32_t i = 0; i != num_queries; ++i) { qq.clear(); for (auto term : queries[i]) { qq.push_back(index[term]); } uint64_t size = intersect(num_docs, qq, out); total += size; } double end = get_time_usecs(); double elapsed = end - start; if (run) { total_usecs += elapsed; } } // for debug std::cout << total << std::endl; printf( "\t %d intersections took %lf [musecs] (avg. among %d " "runs)\n", num_queries, total_usecs / (runs - 1), runs - 1); printf( "\t %lf [musecs] per intersection (avg. among %d " "queries)\n", total_usecs / (runs - 1) / num_queries, num_queries); } int main(int argc, const char** argv) { using namespace ds2i; int mandatory = 3; if (argc < mandatory) { std::cerr << argv[0] << " <index_type> <index_filename> < query_log" << std::endl; return 1; } std::string index_type = argv[1]; const char* index_filename = argv[2]; if (false) { #define LOOP_BODY(R, DATA, T) \ } \ else if (index_type == BOOST_PP_STRINGIZE(T)) { \ perftest<BOOST_PP_CAT(T, _index)>(index_filename); \ /**/ BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, DS2I_INDEX_TYPES); #undef LOOP_BODY } else { logger() << "ERROR: Unknown index type " << index_type << std::endl; } return 0; }
26.706667
76
0.545432
fanhualta
abb4af9ca0f37e64e893acb3d381b4a8ece93033
887
hpp
C++
libs/core/include/fcppt/math/clamp.hpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
13
2015-02-21T18:35:14.000Z
2019-12-29T14:08:29.000Z
libs/core/include/fcppt/math/clamp.hpp
cpreh/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
5
2016-08-27T07:35:47.000Z
2019-04-21T10:55:34.000Z
libs/core/include/fcppt/math/clamp.hpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
8
2015-01-10T09:22:37.000Z
2019-12-01T08:31:12.000Z
// Copyright Carl Philipp Reh 2009 - 2017. // Copyright Philipp Middendorf 2009 - 2017. // 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 FCPPT_MATH_CLAMP_HPP_INCLUDED #define FCPPT_MATH_CLAMP_HPP_INCLUDED #include <fcppt/optional/make_if.hpp> #include <fcppt/optional/object_impl.hpp> #include <fcppt/config/external_begin.hpp> #include <algorithm> #include <fcppt/config/external_end.hpp> namespace fcppt::math { /** \brief Clamps a value into a range. \ingroup fcpptmath */ template <typename T> fcppt::optional::object<T> clamp(T const &_value, T const &_vmin, T const &_vmax) { return fcppt::optional::make_if( _vmin <= _vmax, [&_value, &_vmin, &_vmax] { return std::max(std::min(_value, _vmax), _vmin); }); } } #endif
26.878788
86
0.709132
freundlich
abb634cee0a3ae2fe099476f69c2cac061dc19d2
136
cpp
C++
tutorials/learncpp.com#1.0#1/variables_part_i/boolean_values/source6.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
tutorials/learncpp.com#1.0#1/variables_part_i/boolean_values/source6.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
tutorials/learncpp.com#1.0#1/variables_part_i/boolean_values/source6.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
bool bValue = true; if (!bValue) cout << "The if statement was true" << endl; else cout << "The if statement was false" << endl;
27.2
49
0.625
officialrafsan
abb665fee6e513631c6c6b5cd487fd41b08d95a2
1,343
cpp
C++
building_teams.cpp
ShinAKS/cses_solutions
e4ebcf80c010785f1b73df7aa8052da07ad549e0
[ "MIT" ]
null
null
null
building_teams.cpp
ShinAKS/cses_solutions
e4ebcf80c010785f1b73df7aa8052da07ad549e0
[ "MIT" ]
null
null
null
building_teams.cpp
ShinAKS/cses_solutions
e4ebcf80c010785f1b73df7aa8052da07ad549e0
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> #define ll long long #define int long long #define pb push_back #define pii pair<int,int> #define vi vector<int> #define vii vector<pii> #define mi map<int,int> #define mii map<pii,int> #define all(a) (a).begin(),(a).end() #define ff first #define ss second #define sz(x) (int)x.size() #define endl '\n' #define hell 1000000007 #define rep(i,a,b) for(int i=a;i<b;i++) using namespace std; bool dfs(int s,vector<vi>&adj,vector<bool>&vis,vi &color,int par){ if (par == -1)color[s] = 0; else color[s] = 1 - color[par]; vis[s] = true; rep(i,0,sz(adj[s])){ if (adj[s][i] == par)continue; if (vis[adj[s][i]]){ if (color[adj[s][i]] == color[s])return false; else continue; } else{ if (!dfs(adj[s][i],adj,vis,color,s))return false; } } //write here return true; } int32_t main(){ cin.tie(NULL); ios::sync_with_stdio(false); //insert code int n,m; cin>>n>>m; vector<vector<int>>adj(n); vector<bool>vis(n,false); vector<int>color(n,-1); int u,v; rep(i,0,m){ cin>>u>>v; u--;v--; adj[u].pb(v); adj[v].pb(u); } rep(i,0,n){ if (!vis[i]){ if (!dfs(i,adj,vis,color,-1)){ cout<<"IMPOSSIBLE"<<endl; return 0; } } } rep(i,0,n)cout<<color[i]+1<<" "; return 0; }
21.31746
66
0.553239
ShinAKS
abbf7479b6b322f55b3894d922be846eac47c4ea
36,711
cpp
C++
upo_navigation/src/trajectory_planner.cpp
robotics-upo/upo_robot_navigation
6e0b7668683b68037051b2dda0419bda38a51e01
[ "BSD-3-Clause" ]
50
2016-11-29T09:46:39.000Z
2021-05-27T10:44:07.000Z
upo_navigation/src/trajectory_planner.cpp
kayleckq/upo_robot_navigation
6e0b7668683b68037051b2dda0419bda38a51e01
[ "BSD-3-Clause" ]
5
2017-05-04T12:39:13.000Z
2021-03-30T07:44:38.000Z
upo_navigation/src/trajectory_planner.cpp
kayleckq/upo_robot_navigation
6e0b7668683b68037051b2dda0419bda38a51e01
[ "BSD-3-Clause" ]
22
2017-01-17T07:38:24.000Z
2021-02-18T13:17:29.000Z
/********************************************************************* * * Software License Agreement (BSD License) * * Copyright (c) 2008, Willow Garage, Inc. * 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. * * Neither the name of the Willow Garage 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. * * Author: Eitan Marder-Eppstein *********************************************************************/ #include <upo_navigation/trajectory_planner.h> #include <costmap_2d/footprint.h> #include <string> #include <sstream> #include <math.h> #include <angles/angles.h> #include <boost/algorithm/string.hpp> #include <ros/console.h> //for computing path distance #include <queue> using namespace std; using namespace costmap_2d; namespace upo_nav{ void TrajectoryPlanner::reconfigure(BaseLocalPlannerConfig &cfg) { BaseLocalPlannerConfig config(cfg); boost::mutex::scoped_lock l(configuration_mutex_); acc_lim_x_ = config.acc_lim_x; acc_lim_y_ = config.acc_lim_y; acc_lim_theta_ = config.acc_lim_theta; max_vel_x_ = config.max_vel_x; min_vel_x_ = config.min_vel_x; max_vel_th_ = config.max_vel_theta; min_vel_th_ = config.min_vel_theta; min_in_place_vel_th_ = config.min_in_place_vel_theta; sim_time_ = config.sim_time; sim_granularity_ = config.sim_granularity; angular_sim_granularity_ = config.angular_sim_granularity; pdist_scale_ = config.pdist_scale; gdist_scale_ = config.gdist_scale; occdist_scale_ = config.occdist_scale; if (meter_scoring_) { //if we use meter scoring, then we want to multiply the biases by the resolution of the costmap double resolution = costmap_.getResolution(); gdist_scale_ *= resolution; pdist_scale_ *= resolution; occdist_scale_ *= resolution; } oscillation_reset_dist_ = config.oscillation_reset_dist; escape_reset_dist_ = config.escape_reset_dist; escape_reset_theta_ = config.escape_reset_theta; vx_samples_ = config.vx_samples; vtheta_samples_ = config.vtheta_samples; if (vx_samples_ <= 0) { config.vx_samples = 1; vx_samples_ = config.vx_samples; ROS_WARN("You've specified that you don't want any samples in the x dimension. We'll at least assume that you want to sample one value... so we're going to set vx_samples to 1 instead"); } if(vtheta_samples_ <= 0) { config.vtheta_samples = 1; vtheta_samples_ = config.vtheta_samples; ROS_WARN("You've specified that you don't want any samples in the theta dimension. We'll at least assume that you want to sample one value... so we're going to set vtheta_samples to 1 instead"); } heading_lookahead_ = config.heading_lookahead; holonomic_robot_ = config.holonomic_robot; backup_vel_ = config.escape_vel; dwa_ = config.dwa; heading_scoring_ = config.heading_scoring; heading_scoring_timestep_ = config.heading_scoring_timestep; simple_attractor_ = config.simple_attractor; //y-vels string y_string = config.y_vels; vector<string> y_strs; boost::split(y_strs, y_string, boost::is_any_of(", "), boost::token_compress_on); vector<double>y_vels; for(vector<string>::iterator it=y_strs.begin(); it != y_strs.end(); ++it) { istringstream iss(*it); double temp; iss >> temp; y_vels.push_back(temp); //ROS_INFO("Adding y_vel: %e", temp); } y_vels_ = y_vels; } TrajectoryPlanner::TrajectoryPlanner(WorldModel& world_model, const Costmap2D& costmap, std::vector<geometry_msgs::Point> footprint_spec, double acc_lim_x, double acc_lim_y, double acc_lim_theta, double sim_time, double sim_granularity, int vx_samples, int vtheta_samples, double pdist_scale, double gdist_scale, double occdist_scale, double heading_lookahead, double oscillation_reset_dist, double escape_reset_dist, double escape_reset_theta, bool holonomic_robot, double max_vel_x, double min_vel_x, double max_vel_th, double min_vel_th, double min_in_place_vel_th, double backup_vel, bool dwa, bool heading_scoring, double heading_scoring_timestep, bool meter_scoring, bool simple_attractor, vector<double> y_vels, double stop_time_buffer, double sim_period, double angular_sim_granularity) : path_map_(costmap.getSizeInCellsX(), costmap.getSizeInCellsY()), goal_map_(costmap.getSizeInCellsX(), costmap.getSizeInCellsY()), costmap_(costmap), world_model_(world_model), footprint_spec_(footprint_spec), sim_time_(sim_time), sim_granularity_(sim_granularity), angular_sim_granularity_(angular_sim_granularity), vx_samples_(vx_samples), vtheta_samples_(vtheta_samples), pdist_scale_(pdist_scale), gdist_scale_(gdist_scale), occdist_scale_(occdist_scale), acc_lim_x_(acc_lim_x), acc_lim_y_(acc_lim_y), acc_lim_theta_(acc_lim_theta), prev_x_(0), prev_y_(0), escape_x_(0), escape_y_(0), escape_theta_(0), heading_lookahead_(heading_lookahead), oscillation_reset_dist_(oscillation_reset_dist), escape_reset_dist_(escape_reset_dist), escape_reset_theta_(escape_reset_theta), holonomic_robot_(holonomic_robot), max_vel_x_(max_vel_x), min_vel_x_(min_vel_x), max_vel_th_(max_vel_th), min_vel_th_(min_vel_th), min_in_place_vel_th_(min_in_place_vel_th), backup_vel_(backup_vel), dwa_(dwa), heading_scoring_(heading_scoring), heading_scoring_timestep_(heading_scoring_timestep), simple_attractor_(simple_attractor), y_vels_(y_vels), stop_time_buffer_(stop_time_buffer), sim_period_(sim_period) { //the robot is not stuck to begin with stuck_left = false; stuck_right = false; stuck_left_strafe = false; stuck_right_strafe = false; rotating_left = false; rotating_right = false; strafe_left = false; strafe_right = false; escaping_ = false; final_goal_position_valid_ = false; costmap_2d::calculateMinAndMaxDistances(footprint_spec_, inscribed_radius_, circumscribed_radius_); } TrajectoryPlanner::~TrajectoryPlanner(){} bool TrajectoryPlanner::getCellCosts(int cx, int cy, float &path_cost, float &goal_cost, float &occ_cost, float &total_cost) { MapCell cell = path_map_(cx, cy); MapCell goal_cell = goal_map_(cx, cy); if (cell.within_robot) { return false; } occ_cost = costmap_.getCost(cx, cy); if (cell.target_dist == path_map_.obstacleCosts() || cell.target_dist == path_map_.unreachableCellCosts() || occ_cost >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE) { return false; } path_cost = cell.target_dist; goal_cost = goal_cell.target_dist; total_cost = pdist_scale_ * path_cost + gdist_scale_ * goal_cost + occdist_scale_ * occ_cost; return true; } /** * create and score a trajectory given the current pose of the robot and selected velocities */ void TrajectoryPlanner::generateTrajectory( double x, double y, double theta, double vx, double vy, double vtheta, double vx_samp, double vy_samp, double vtheta_samp, double acc_x, double acc_y, double acc_theta, double impossible_cost, Trajectory& traj) { // make sure the configuration doesn't change mid run boost::mutex::scoped_lock l(configuration_mutex_); double x_i = x; double y_i = y; double theta_i = theta; double vx_i, vy_i, vtheta_i; vx_i = vx; vy_i = vy; vtheta_i = vtheta; //compute the magnitude of the velocities double vmag = hypot(vx_samp, vy_samp); //compute the number of steps we must take along this trajectory to be "safe" int num_steps; if(!heading_scoring_) { num_steps = int(max((vmag * sim_time_) / sim_granularity_, fabs(vtheta_samp) / angular_sim_granularity_) + 0.5); } else { num_steps = int(sim_time_ / sim_granularity_ + 0.5); } //we at least want to take one step... even if we won't move, we want to score our current position if(num_steps == 0) { num_steps = 1; } double dt = sim_time_ / num_steps; double time = 0.0; //create a potential trajectory traj.resetPoints(); traj.xv_ = vx_samp; traj.yv_ = vy_samp; traj.thetav_ = vtheta_samp; traj.cost_ = -1.0; //initialize the costs for the trajectory double path_dist = 0.0; double goal_dist = 0.0; double occ_cost = 0.0; double heading_diff = 0.0; for(int i = 0; i < num_steps; ++i){ //get map coordinates of a point unsigned int cell_x, cell_y; //we don't want a path that goes off the know map if(!costmap_.worldToMap(x_i, y_i, cell_x, cell_y)){ traj.cost_ = -1.0; return; } //check the point on the trajectory for legality double footprint_cost = footprintCost(x_i, y_i, theta_i); //if the footprint hits an obstacle this trajectory is invalid if(footprint_cost < 0){ traj.cost_ = -1.0; return; //TODO: Really look at getMaxSpeedToStopInTime... dues to discretization errors and high acceleration limits, //it can actually cause the robot to hit obstacles. There may be something to be done to fix, but I'll have to //come back to it when I have time. Right now, pulling it out as it'll just make the robot a bit more conservative, //but safe. /* double max_vel_x, max_vel_y, max_vel_th; //we want to compute the max allowable speeds to be able to stop //to be safe... we'll make sure we can stop some time before we actually hit getMaxSpeedToStopInTime(time - stop_time_buffer_ - dt, max_vel_x, max_vel_y, max_vel_th); //check if we can stop in time if(fabs(vx_samp) < max_vel_x && fabs(vy_samp) < max_vel_y && fabs(vtheta_samp) < max_vel_th){ ROS_ERROR("v: (%.2f, %.2f, %.2f), m: (%.2f, %.2f, %.2f) t:%.2f, st: %.2f, dt: %.2f", vx_samp, vy_samp, vtheta_samp, max_vel_x, max_vel_y, max_vel_th, time, stop_time_buffer_, dt); //if we can stop... we'll just break out of the loop here.. no point in checking future points break; } else{ traj.cost_ = -1.0; return; } */ } occ_cost = std::max(std::max(occ_cost, footprint_cost), double(costmap_.getCost(cell_x, cell_y))); //do we want to follow blindly if (simple_attractor_) { goal_dist = (x_i - global_plan_[global_plan_.size() -1].pose.position.x) * (x_i - global_plan_[global_plan_.size() -1].pose.position.x) + (y_i - global_plan_[global_plan_.size() -1].pose.position.y) * (y_i - global_plan_[global_plan_.size() -1].pose.position.y); } else { bool update_path_and_goal_distances = true; // with heading scoring, we take into account heading diff, and also only score // path and goal distance for one point of the trajectory if (heading_scoring_) { if (time >= heading_scoring_timestep_ && time < heading_scoring_timestep_ + dt) { heading_diff = headingDiff(cell_x, cell_y, x_i, y_i, theta_i); } else { update_path_and_goal_distances = false; } } if (update_path_and_goal_distances) { //update path and goal distances path_dist = path_map_(cell_x, cell_y).target_dist; goal_dist = goal_map_(cell_x, cell_y).target_dist; //if a point on this trajectory has no clear path to goal it is invalid if(impossible_cost <= goal_dist || impossible_cost <= path_dist){ // ROS_DEBUG("No path to goal with goal distance = %f, path_distance = %f and max cost = %f", // goal_dist, path_dist, impossible_cost); traj.cost_ = -2.0; return; } } } //the point is legal... add it to the trajectory traj.addPoint(x_i, y_i, theta_i); //calculate velocities vx_i = computeNewVelocity(vx_samp, vx_i, acc_x, dt); vy_i = computeNewVelocity(vy_samp, vy_i, acc_y, dt); vtheta_i = computeNewVelocity(vtheta_samp, vtheta_i, acc_theta, dt); //calculate positions x_i = computeNewXPosition(x_i, vx_i, vy_i, theta_i, dt); y_i = computeNewYPosition(y_i, vx_i, vy_i, theta_i, dt); theta_i = computeNewThetaPosition(theta_i, vtheta_i, dt); //increment time time += dt; } // end for i < numsteps //ROS_INFO("OccCost: %f, vx: %.2f, vy: %.2f, vtheta: %.2f", occ_cost, vx_samp, vy_samp, vtheta_samp); double cost = -1.0; if (!heading_scoring_) { cost = pdist_scale_ * path_dist + goal_dist * gdist_scale_ + occdist_scale_ * occ_cost; } else { cost = occdist_scale_ * occ_cost + pdist_scale_ * path_dist + 0.3 * heading_diff + goal_dist * gdist_scale_; } traj.cost_ = cost; } double TrajectoryPlanner::headingDiff(int cell_x, int cell_y, double x, double y, double heading){ double heading_diff = DBL_MAX; unsigned int goal_cell_x, goal_cell_y; const double v2_x = cos(heading); const double v2_y = sin(heading); //find a clear line of sight from the robot's cell to a point on the path for (int i = global_plan_.size() - 1; i >=0; --i) { if (costmap_.worldToMap(global_plan_[i].pose.position.x, global_plan_[i].pose.position.y, goal_cell_x, goal_cell_y)) { if (lineCost(cell_x, goal_cell_x, cell_y, goal_cell_y) >= 0) { double gx, gy; costmap_.mapToWorld(goal_cell_x, goal_cell_y, gx, gy); double v1_x = gx - x; double v1_y = gy - y; double perp_dot = v1_x * v2_y - v1_y * v2_x; double dot = v1_x * v2_x + v1_y * v2_y; //get the signed angle double vector_angle = atan2(perp_dot, dot); heading_diff = fabs(vector_angle); return heading_diff; } } } return heading_diff; } //calculate the cost of a ray-traced line double TrajectoryPlanner::lineCost(int x0, int x1, int y0, int y1){ //Bresenham Ray-Tracing int deltax = abs(x1 - x0); // The difference between the x's int deltay = abs(y1 - y0); // The difference between the y's int x = x0; // Start x off at the first pixel int y = y0; // Start y off at the first pixel int xinc1, xinc2, yinc1, yinc2; int den, num, numadd, numpixels; double line_cost = 0.0; double point_cost = -1.0; if (x1 >= x0) // The x-values are increasing { xinc1 = 1; xinc2 = 1; } else // The x-values are decreasing { xinc1 = -1; xinc2 = -1; } if (y1 >= y0) // The y-values are increasing { yinc1 = 1; yinc2 = 1; } else // The y-values are decreasing { yinc1 = -1; yinc2 = -1; } if (deltax >= deltay) // There is at least one x-value for every y-value { xinc1 = 0; // Don't change the x when numerator >= denominator yinc2 = 0; // Don't change the y for every iteration den = deltax; num = deltax / 2; numadd = deltay; numpixels = deltax; // There are more x-values than y-values } else { // There is at least one y-value for every x-value xinc2 = 0; // Don't change the x for every iteration yinc1 = 0; // Don't change the y when numerator >= denominator den = deltay; num = deltay / 2; numadd = deltax; numpixels = deltay; // There are more y-values than x-values } for (int curpixel = 0; curpixel <= numpixels; curpixel++) { point_cost = pointCost(x, y); //Score the current point if (point_cost < 0) { return -1; } if (line_cost < point_cost) { line_cost = point_cost; } num += numadd; // Increase the numerator by the top of the fraction if (num >= den) { // Check if numerator >= denominator num -= den; // Calculate the new numerator value x += xinc1; // Change the x as appropriate y += yinc1; // Change the y as appropriate } x += xinc2; // Change the x as appropriate y += yinc2; // Change the y as appropriate } return line_cost; } double TrajectoryPlanner::pointCost(int x, int y){ unsigned char cost = costmap_.getCost(x, y); //if the cell is in an obstacle the path is invalid if(cost == LETHAL_OBSTACLE || cost == INSCRIBED_INFLATED_OBSTACLE || cost == NO_INFORMATION){ return -1; } return cost; } void TrajectoryPlanner::updatePlan(const vector<geometry_msgs::PoseStamped>& new_plan, bool compute_dists){ global_plan_.resize(new_plan.size()); for(unsigned int i = 0; i < new_plan.size(); ++i){ global_plan_[i] = new_plan[i]; } if( global_plan_.size() > 0 ){ geometry_msgs::PoseStamped& final_goal_pose = global_plan_[ global_plan_.size() - 1 ]; final_goal_x_ = final_goal_pose.pose.position.x; final_goal_y_ = final_goal_pose.pose.position.y; final_goal_position_valid_ = true; } else { final_goal_position_valid_ = false; } if (compute_dists) { //reset the map for new operations path_map_.resetPathDist(); goal_map_.resetPathDist(); //make sure that we update our path based on the global plan and compute costs path_map_.setTargetCells(costmap_, global_plan_); goal_map_.setLocalGoal(costmap_, global_plan_); ROS_DEBUG("Path/Goal distance computed"); } } bool TrajectoryPlanner::checkTrajectory(double x, double y, double theta, double vx, double vy, double vtheta, double vx_samp, double vy_samp, double vtheta_samp){ Trajectory t; double cost = scoreTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp); //if the trajectory is a legal one... the check passes if(cost >= 0) { return true; } ROS_WARN("Invalid Trajectory %f, %f, %f, cost: %f", vx_samp, vy_samp, vtheta_samp, cost); //otherwise the check fails return false; } double TrajectoryPlanner::scoreTrajectory(double x, double y, double theta, double vx, double vy, double vtheta, double vx_samp, double vy_samp, double vtheta_samp) { Trajectory t; double impossible_cost = path_map_.obstacleCosts(); generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_lim_x_, acc_lim_y_, acc_lim_theta_, impossible_cost, t); // return the cost. return double( t.cost_ ); } /* * create the trajectories we wish to score */ Trajectory TrajectoryPlanner::createTrajectories(double x, double y, double theta, double vx, double vy, double vtheta, double acc_x, double acc_y, double acc_theta) { //compute feasible velocity limits in robot space double max_vel_x = max_vel_x_, max_vel_theta; double min_vel_x, min_vel_theta; if( final_goal_position_valid_ ){ double final_goal_dist = hypot( final_goal_x_ - x, final_goal_y_ - y ); max_vel_x = min( max_vel_x, final_goal_dist / sim_time_ ); } //should we use the dynamic window approach? if (dwa_) { max_vel_x = max(min(max_vel_x, vx + acc_x * sim_period_), min_vel_x_); min_vel_x = max(min_vel_x_, vx - acc_x * sim_period_); max_vel_theta = min(max_vel_th_, vtheta + acc_theta * sim_period_); min_vel_theta = max(min_vel_th_, vtheta - acc_theta * sim_period_); } else { max_vel_x = max(min(max_vel_x, vx + acc_x * sim_time_), min_vel_x_); min_vel_x = max(min_vel_x_, vx - acc_x * sim_time_); max_vel_theta = min(max_vel_th_, vtheta + acc_theta * sim_time_); min_vel_theta = max(min_vel_th_, vtheta - acc_theta * sim_time_); } //we want to sample the velocity space regularly double dvx = (max_vel_x - min_vel_x) / (vx_samples_ - 1); double dvtheta = (max_vel_theta - min_vel_theta) / (vtheta_samples_ - 1); double vx_samp = min_vel_x; double vtheta_samp = min_vel_theta; double vy_samp = 0.0; //keep track of the best trajectory seen so far Trajectory* best_traj = &traj_one; best_traj->cost_ = -1.0; Trajectory* comp_traj = &traj_two; comp_traj->cost_ = -1.0; Trajectory* swap = NULL; //any cell with a cost greater than the size of the map is impossible double impossible_cost = path_map_.obstacleCosts(); //if we're performing an escape we won't allow moving forward if (!escaping_) { //loop through all x velocities for(int i = 0; i < vx_samples_; ++i) { vtheta_samp = 0; //first sample the straight trajectory generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){ swap = best_traj; best_traj = comp_traj; comp_traj = swap; } vtheta_samp = min_vel_theta; //next sample all theta trajectories for(int j = 0; j < vtheta_samples_ - 1; ++j){ generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){ swap = best_traj; best_traj = comp_traj; comp_traj = swap; } vtheta_samp += dvtheta; } vx_samp += dvx; } //only explore y velocities with holonomic robots if (holonomic_robot_) { //explore trajectories that move forward but also strafe slightly vx_samp = 0.1; vy_samp = 0.1; vtheta_samp = 0.0; generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){ swap = best_traj; best_traj = comp_traj; comp_traj = swap; } vx_samp = 0.1; vy_samp = -0.1; vtheta_samp = 0.0; generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){ swap = best_traj; best_traj = comp_traj; comp_traj = swap; } } } // end if not escaping //next we want to generate trajectories for rotating in place vtheta_samp = min_vel_theta; vx_samp = 0.0; vy_samp = 0.0; //let's try to rotate toward open space double heading_dist = DBL_MAX; for(int i = 0; i < vtheta_samples_; ++i) { //enforce a minimum rotational velocity because the base can't handle small in-place rotations double vtheta_samp_limited = vtheta_samp > 0 ? max(vtheta_samp, min_in_place_vel_th_) : min(vtheta_samp, -1.0 * min_in_place_vel_th_); generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp_limited, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it... //note if we can legally rotate in place we prefer to do that rather than move with y velocity if(comp_traj->cost_ >= 0 && (comp_traj->cost_ <= best_traj->cost_ || best_traj->cost_ < 0 || best_traj->yv_ != 0.0) && (vtheta_samp > dvtheta || vtheta_samp < -1 * dvtheta)){ double x_r, y_r, th_r; comp_traj->getEndpoint(x_r, y_r, th_r); x_r += heading_lookahead_ * cos(th_r); y_r += heading_lookahead_ * sin(th_r); unsigned int cell_x, cell_y; //make sure that we'll be looking at a legal cell if (costmap_.worldToMap(x_r, y_r, cell_x, cell_y)) { double ahead_gdist = goal_map_(cell_x, cell_y).target_dist; if (ahead_gdist < heading_dist) { //if we haven't already tried rotating left since we've moved forward if (vtheta_samp < 0 && !stuck_left) { swap = best_traj; best_traj = comp_traj; comp_traj = swap; heading_dist = ahead_gdist; } //if we haven't already tried rotating right since we've moved forward else if(vtheta_samp > 0 && !stuck_right) { swap = best_traj; best_traj = comp_traj; comp_traj = swap; heading_dist = ahead_gdist; } } } } vtheta_samp += dvtheta; } //do we have a legal trajectory if (best_traj->cost_ >= 0) { // avoid oscillations of in place rotation and in place strafing if ( ! (best_traj->xv_ > 0)) { if (best_traj->thetav_ < 0) { if (rotating_right) { stuck_right = true; } rotating_left = true; } else if (best_traj->thetav_ > 0) { if (rotating_left){ stuck_left = true; } rotating_right = true; } else if(best_traj->yv_ > 0) { if (strafe_right) { stuck_right_strafe = true; } strafe_left = true; } else if(best_traj->yv_ < 0){ if (strafe_left) { stuck_left_strafe = true; } strafe_right = true; } //set the position we must move a certain distance away from prev_x_ = x; prev_y_ = y; } double dist = hypot(x - prev_x_, y - prev_y_); if (dist > oscillation_reset_dist_) { rotating_left = false; rotating_right = false; strafe_left = false; strafe_right = false; stuck_left = false; stuck_right = false; stuck_left_strafe = false; stuck_right_strafe = false; } dist = hypot(x - escape_x_, y - escape_y_); if(dist > escape_reset_dist_ || fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_){ escaping_ = false; } return *best_traj; } //only explore y velocities with holonomic robots if (holonomic_robot_) { //if we can't rotate in place or move forward... maybe we can move sideways and rotate vtheta_samp = min_vel_theta; vx_samp = 0.0; //loop through all y velocities for(unsigned int i = 0; i < y_vels_.size(); ++i){ vtheta_samp = 0; vy_samp = y_vels_[i]; //sample completely horizontal trajectories generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it if(comp_traj->cost_ >= 0 && (comp_traj->cost_ <= best_traj->cost_ || best_traj->cost_ < 0)){ double x_r, y_r, th_r; comp_traj->getEndpoint(x_r, y_r, th_r); x_r += heading_lookahead_ * cos(th_r); y_r += heading_lookahead_ * sin(th_r); unsigned int cell_x, cell_y; //make sure that we'll be looking at a legal cell if(costmap_.worldToMap(x_r, y_r, cell_x, cell_y)) { double ahead_gdist = goal_map_(cell_x, cell_y).target_dist; if (ahead_gdist < heading_dist) { //if we haven't already tried strafing left since we've moved forward if (vy_samp > 0 && !stuck_left_strafe) { swap = best_traj; best_traj = comp_traj; comp_traj = swap; heading_dist = ahead_gdist; } //if we haven't already tried rotating right since we've moved forward else if(vy_samp < 0 && !stuck_right_strafe) { swap = best_traj; best_traj = comp_traj; comp_traj = swap; heading_dist = ahead_gdist; } } } } } } //do we have a legal trajectory if (best_traj->cost_ >= 0) { if (!(best_traj->xv_ > 0)) { if (best_traj->thetav_ < 0) { if (rotating_right){ stuck_right = true; } rotating_left = true; } else if(best_traj->thetav_ > 0) { if(rotating_left){ stuck_left = true; } rotating_right = true; } else if(best_traj->yv_ > 0) { if(strafe_right){ stuck_right_strafe = true; } strafe_left = true; } else if(best_traj->yv_ < 0) { if(strafe_left){ stuck_left_strafe = true; } strafe_right = true; } //set the position we must move a certain distance away from prev_x_ = x; prev_y_ = y; } double dist = hypot(x - prev_x_, y - prev_y_); if(dist > oscillation_reset_dist_) { rotating_left = false; rotating_right = false; strafe_left = false; strafe_right = false; stuck_left = false; stuck_right = false; stuck_left_strafe = false; stuck_right_strafe = false; } dist = hypot(x - escape_x_, y - escape_y_); if(dist > escape_reset_dist_ || fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) { escaping_ = false; } return *best_traj; } //and finally, if we can't do anything else, we want to generate trajectories that move backwards slowly vtheta_samp = 0.0; vx_samp = backup_vel_; vy_samp = 0.0; generateTrajectory(x, y, theta, vx, vy, vtheta, vx_samp, vy_samp, vtheta_samp, acc_x, acc_y, acc_theta, impossible_cost, *comp_traj); //if the new trajectory is better... let's take it /* if(comp_traj->cost_ >= 0 && (comp_traj->cost_ < best_traj->cost_ || best_traj->cost_ < 0)){ swap = best_traj; best_traj = comp_traj; comp_traj = swap; } */ //we'll allow moving backwards slowly even when the static map shows it as blocked swap = best_traj; best_traj = comp_traj; comp_traj = swap; double dist = hypot(x - prev_x_, y - prev_y_); if (dist > oscillation_reset_dist_) { rotating_left = false; rotating_right = false; strafe_left = false; strafe_right = false; stuck_left = false; stuck_right = false; stuck_left_strafe = false; stuck_right_strafe = false; } //only enter escape mode when the planner has given a valid goal point if (!escaping_ && best_traj->cost_ > -2.0) { escape_x_ = x; escape_y_ = y; escape_theta_ = theta; escaping_ = true; } dist = hypot(x - escape_x_, y - escape_y_); if (dist > escape_reset_dist_ || fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) { escaping_ = false; } //---Comented by Noé --------------------------------- //if the trajectory failed because the footprint hits something, we're still going to back up //if(best_traj->cost_ == -1.0) // best_traj->cost_ = 1.0; //--Noé-- Add to remove the scaping behavior------------ //escaping_ = false; //------------------------------------------------------ return *best_traj; } //given the current state of the robot, find a good trajectory Trajectory TrajectoryPlanner::findBestPath(tf::Stamped<tf::Pose> global_pose, tf::Stamped<tf::Pose> global_vel, tf::Stamped<tf::Pose>& drive_velocities){ Eigen::Vector3f pos(global_pose.getOrigin().getX(), global_pose.getOrigin().getY(), tf::getYaw(global_pose.getRotation())); Eigen::Vector3f vel(global_vel.getOrigin().getX(), global_vel.getOrigin().getY(), tf::getYaw(global_vel.getRotation())); //reset the map for new operations path_map_.resetPathDist(); goal_map_.resetPathDist(); //temporarily remove obstacles that are within the footprint of the robot std::vector<upo_navigation::Position2DInt> footprint_list = footprint_helper_.getFootprintCells( pos, footprint_spec_, costmap_, true); //mark cells within the initial footprint of the robot for (unsigned int i = 0; i < footprint_list.size(); ++i) { path_map_(footprint_list[i].x, footprint_list[i].y).within_robot = true; } //make sure that we update our path based on the global plan and compute costs path_map_.setTargetCells(costmap_, global_plan_); goal_map_.setLocalGoal(costmap_, global_plan_); ROS_DEBUG("Path/Goal distance computed"); //rollout trajectories and find the minimum cost one Trajectory best = createTrajectories(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2], acc_lim_x_, acc_lim_y_, acc_lim_theta_); ROS_DEBUG("Trajectories created"); /* //If we want to print a ppm file to draw goal dist char buf[4096]; sprintf(buf, "base_local_planner.ppm"); FILE *fp = fopen(buf, "w"); if(fp){ fprintf(fp, "P3\n"); fprintf(fp, "%d %d\n", map_.size_x_, map_.size_y_); fprintf(fp, "255\n"); for(int j = map_.size_y_ - 1; j >= 0; --j){ for(unsigned int i = 0; i < map_.size_x_; ++i){ int g_dist = 255 - int(map_(i, j).goal_dist); int p_dist = 255 - int(map_(i, j).path_dist); if(g_dist < 0) g_dist = 0; if(p_dist < 0) p_dist = 0; fprintf(fp, "%d 0 %d ", g_dist, 0); } fprintf(fp, "\n"); } fclose(fp); } */ if(best.cost_ < 0){ drive_velocities.setIdentity(); } else{ tf::Vector3 start(best.xv_, best.yv_, 0); drive_velocities.setOrigin(start); tf::Matrix3x3 matrix; matrix.setRotation(tf::createQuaternionFromYaw(best.thetav_)); drive_velocities.setBasis(matrix); } return best; } //we need to take the footprint of the robot into account when we calculate cost to obstacles double TrajectoryPlanner::footprintCost(double x_i, double y_i, double theta_i){ //check if the footprint is legal return world_model_.footprintCost(x_i, y_i, theta_i, footprint_spec_, inscribed_radius_, circumscribed_radius_); } void TrajectoryPlanner::getLocalGoal(double& x, double& y){ x = path_map_.goal_x_; y = path_map_.goal_y_; } };
36.204142
204
0.62627
robotics-upo