blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2008fa7ef2fc573ac6d2a06ac985e440ad024b2f | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2652486_1/C++/Junkbot/luck.cpp | c29402d74356d94dc0011dbe3292955c048e7400 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 2,535 | cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#ifdef DEBUG
#define D(x...) fprintf(stderr,x)
#else
#define D(x...)
#endif
typedef long long ll;
// <sum, nummasks>
typedef pair<ll,ll> pll;
const int NUM_CONFIG = 19000;
int R, N, M, K;
ll fact[15];
int depth[15];
int C;
vector<int> configs[NUM_CONFIG];
ll configWays[NUM_CONFIG];
vector<ll> prods[NUM_CONFIG];
int target[15];
void gen(int ply, int upto) {
if(ply == N) {
for(int i=0;i<N;i++) {
configs[C].push_back(depth[i]);
}
C++;
} else {
for(int i=upto;i<=M;i++) {
depth[ply] = i;
gen(ply+1, i);
}
}
}
void getWays(int num) {
ll tot = fact[N];
int cur = 1;
for(int i=1;i<N;i++) {
if(configs[num][i] == configs[num][i-1]) {
cur++;
} else {
tot /= fact[cur];
cur = 1;
}
}
tot /= fact[cur];
configWays[num] = tot;
}
ll totWays(int num) {
ll tot = 1ll;
for(int i=0;i<K && tot > 0ll;i++) {
vector<ll>::iterator lo = lower_bound(prods[num].begin(), prods[num].end(), target[i]);
vector<ll>::iterator hi = upper_bound(prods[num].begin(), prods[num].end(), target[i]);
tot *= ((ll)(hi - lo) * configWays[num]);
}
return tot;
}
int main() {
// factorial
fact[0] = 1ll;
for(ll i=1ll;i<15ll;i++) {
fact[i] = fact[i-1] * i;
}
// input and precomp
int T;
scanf("%d",&T);
printf("Case #1:\n");
scanf("%d %d %d %d",&R,&N,&M,&K);
// generate
gen(0, 2);
D("* C = %d\n",C);
// find num ways to get each config
for(int i=0;i<C;i++) {
getWays(i);
// find all the sums
for(int m=0;m<(1<<N);m++) {
ll tot = 1ll;
for(int j=0;j<N;j++) {
if(m & (1 << j)) {
tot *= configs[i][j];
}
}
prods[i].push_back(tot);
}
sort(prods[i].begin(), prods[i].end());
}
for(int i=0;i<R;i++) {
for(int j=0;j<K;j++) {
scanf("%d",&target[j]);
}
int best = 0;
ll bestWays = 0ll;
for(int j=0;j<C;j++) {
ll t = totWays(j);
if(t > bestWays) {
bestWays = t;
best = j;
}
}
for(int j=0;j<N;j++) {
printf("%d",configs[best][j]);
}
printf("\n");
}
return 0;
}
| [
"[email protected]"
] | |
65b102f7a7d3a0f0a7e5f4750dcaf8cb45d0314d | 59179e4f655a40b421fa9aeda9c90736b8c11b1b | /compiler/.history/lab1/lexical_20210414200219.cpp | 5b15aa9e3a1b1beca2ffccb7cdbc653ae2612ce9 | [] | no_license | wjw136/course_designing_project | ccd39da420f0de22b39fa2fea032054f4cbe8bfd | 2614928bd779bc0d996857b123e2862836d81333 | refs/heads/master | 2023-06-04T12:52:40.501335 | 2021-06-17T13:19:23 | 2021-06-17T13:19:23 | 374,384,252 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,113 | cpp | #include <iostream>
#include <windows.h>
#include <string.h>
#include <queue>
#include <math.h>
#include "stdio.h"
#include <fstream>
#define ll long long
#define inf 100000
#define clr1(a) memset(a, -1, sizeof(a))
#define clr(a) memset(a, 0, sizeof(a))
using namespace std;
//reserved word
static char reserveword[35][20] = {
"and", "array", "begin", "bool", "call", "case",
"char", "constant", "dim", "do", "else", "end",
"false", "for", "if", "input", "integer", "not",
"of", "or", "output", "procedure", "program", "read",
"real", "repeat", "set", "stop", "then", "to", "true",
"until", "var", "while", "write"};
//operator
static char myoperator[22][10] = {
"(", ")", "*", "*/", "+", ",", "-",
"..", "/", "/*", ":", ":=", ";", "<",
"<=", "<>", "=", ">", ">=", "[", "]"};
bool isDigit(char ch)
{
if (ch >= '0' && ch <= '9')
return true;
else
{
return false;
}
}
bool isLetter(char ch)
{
if ((ch >= 'a' && ch <= 'z') || (ch <= 'Z' && ch >= 'A') || ch == '_')
return true;
else
{
return false;
}
}
int isReserve(char *s)
{
for (int i = 0; i < 35; ++i)
{
if (strcmp(reserveword[i], s) == 0)
{
return i + 1;
}
}
return -1;
}
//filter
void filter(char *s, int len)
{
char tmp[10000];
int p = 0;
for (int i = 0; i < len; ++i)
{
//注释
if (s[i] == '/' && s[i + 1] == '*')
{
i += 2;
while (s[i] != '*' || s[i + 1] != '/')
{
if (s[i] == '\0' || s[i] == '\n')
{
cout << "Annotation error!" << endl;
exit(0);
}
i++;
}
i += 2;
}
//检查字符串
if (s[i] == '\'')
{
tmp[p++] = s[i++];
while (s[i] != '\'')
{
if (s[i] == '\n' || s[i] == '\0')
{
cout << "const string error!" << endl;
exit(0);
}
tmp[p++] = s[i++];
}
}
//去除换行等
if (s[i] != '\n' && s[i] != '\t' && s[i] != '\v' && s[i] != '\r')
{
tmp[p] = s[i];
p++;
//i++;
}else{
tmp[p++]=' ';
}
}
tmp[p] = '\0';
strcpy(s, tmp);
}
//scanner
void scannner(int &syn, char *project, char *token, int &p)
{
int count = 0;
char ch;
ch = project[p];
while (ch == ' ')
{ //white space
++p;
ch = project[p];
}
for (int i = 0; i < 20; i++)
{
token[i] = '\0';
}
if (isLetter(project[p]))
{
token[count++] = project[p++];
while (isLetter(project[p] || isDigit(project[p])))
{
token[count++] = project[p++];
}
token[count] = '\0';
syn = isReserve(token);
if (syn == -1)
{
syn = 36;
}
return;
}
else if (isDigit(project[p]))
{
token[count++] = project[p++];
while (isDigit(project[p]))
{
token[count++] = project[p++];
}
if(isletter(project[p++]))
token[count] = '\0';
syn = 37;
return;
}
}
int main()
{
cout << "the program name: ";
string s; //cin>>s;
while (cin >> s)
{
ifstream fin(s + ".txt");
if (!fin)
{
cout << "The program not exists!" << endl;
}
else
{
char project[10000];
int p = 0;
//fin.get(project[p++]);
while (fin.peek() != EOF)
{
fin.get(project[p++]);
//cout<<project[p-1]<<endl;
}
//cout << project << endl;
project[p++] = '\0';
fin.close();
//cout << project << endl;
filter(project, p-1);
//cout << project << endl;
}
cout << "the program name: ";
}
return 0;
}
| [
"[email protected]"
] | |
b661cc96cbce6d9ca2725ba432802d570618c12c | f1d1c35f1d1938e626ccab6893cd88ac13c8dd14 | /ConcurrentRenderMock/stdafx.h | 0fad97a272620b5ff28c6286cebf42fa0147782c | [] | no_license | viktorisaev/FreeTypeChat | 75dd4d40cd07e919ee572e439c30626de721ece3 | 7a11d73cc664103d0d34a4191d6b103931ee4f85 | refs/heads/master | 2021-05-06T19:57:19.222397 | 2018-01-07T23:28:46 | 2018-01-07T23:28:46 | 112,236,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 370 | h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include <conio.h>
#include <memory>
#include <mutex>
#include <queue>
#include <deque>
#include <ppltasks.h>
| [
"[email protected]"
] | |
d78bf884d99b4c1d466760d590b0ad96d5fcae50 | 02b6a68a13b091143b9eeea11d2105245d44da3e | /plugins/core/filter_frame_process.cxx | abbb99fd6d1556fccb36566235f33e428b53bf0f | [
"BSD-3-Clause"
] | permissive | xkortex/VIAME | 7087eea21bcd562184a0a8a22d7cd2f346bc692e | 1dce09362e62e519e9e24528b2491da853719f64 | refs/heads/master | 2020-05-15T19:45:52.240607 | 2019-12-11T18:02:07 | 2019-12-11T18:02:07 | 182,464,505 | 0 | 0 | NOASSERTION | 2019-12-11T18:02:09 | 2019-04-20T23:39:53 | C++ | UTF-8 | C++ | false | false | 5,081 | cxx | /*ckwg +29
* Copyright 2019 by Kitware, 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 name of Kitware, Inc. nor the names of any 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 AUTHORS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file
* \brief Selectively filter input frames
*/
#include "filter_frame_process.h"
#include <sprokit/processes/kwiver_type_traits.h>
#include <vital/vital_types.h>
#include <vital/types/timestamp.h>
#include <vital/types/timestamp_config.h>
#include <vital/types/image_container.h>
#include <vital/types/detected_object_set.h>
#include <sstream>
#include <iostream>
#include <list>
#include <limits>
#include <cmath>
namespace viame
{
namespace core
{
create_config_trait( detection_threshold, double, "0.0",
"Require having a detection with at least this confidence to pass frame" );
//------------------------------------------------------------------------------
// Private implementation class
class filter_frame_process::priv
{
public:
priv();
~priv();
// Configuration values
double m_detection_threshold;
};
// =============================================================================
filter_frame_process
::filter_frame_process( kwiver::vital::config_block_sptr const& config )
: process( config ),
d( new filter_frame_process::priv() )
{
make_ports();
make_config();
}
filter_frame_process
::~filter_frame_process()
{
}
// -----------------------------------------------------------------------------
void
filter_frame_process
::_configure()
{
d->m_detection_threshold = config_value_using_trait( detection_threshold );
}
// -----------------------------------------------------------------------------
void
filter_frame_process
::_step()
{
kwiver::vital::image_container_sptr image;
kwiver::vital::detected_object_set_sptr detections;
image = grab_from_port_using_trait( image );
if( has_input_port_edge_using_trait( detected_object_set ) )
{
detections = grab_from_port_using_trait( detected_object_set );
}
bool criteria_met = false;
if( detections )
{
for( auto detection : *detections )
{
if( detection->confidence() >= d->m_detection_threshold )
{
criteria_met = true;
break;
}
else if( detection->type() )
{
try
{
double score;
std::string unused;
detection->type()->get_most_likely( unused, score );
if( score >= d->m_detection_threshold )
{
criteria_met = true;
break;
}
}
catch( ... )
{
continue;
}
}
}
}
if( criteria_met )
{
push_to_port_using_trait( image, image );
}
else
{
push_to_port_using_trait( image, kwiver::vital::image_container_sptr() );
}
}
// -----------------------------------------------------------------------------
void
filter_frame_process
::make_ports()
{
// Set up for required ports
sprokit::process::port_flags_t required;
sprokit::process::port_flags_t optional;
required.insert( flag_required );
// -- input --
declare_input_port_using_trait( image, required );
declare_input_port_using_trait( detected_object_set, optional );
// -- output --
declare_output_port_using_trait( image, optional );
}
// -----------------------------------------------------------------------------
void
filter_frame_process
::make_config()
{
declare_config_using_trait( detection_threshold );
}
// =============================================================================
filter_frame_process::priv
::priv()
: m_detection_threshold( 0.0 )
{
}
filter_frame_process::priv
::~priv()
{
}
} // end namespace core
} // end namespace viame
| [
"[email protected]"
] | |
2118aae761ea6239af7178856d8ebc9c303f281c | 470ead263331db009fac603e3adee32d030efcb6 | /src/MatrixAccountSession.cpp | a392db0d6a1ede7e78e8ab21e263e570c37c9609 | [
"MIT"
] | permissive | polysoft1/legacy-polytrix | 5f6a026eb9c85d6cacca2a9aecf99f0a9ed6e46a | b8b4b626592462f8c5bb6402806d6da7d29e81d2 | refs/heads/master | 2023-07-20T02:54:40.755572 | 2021-08-20T21:01:12 | 2021-08-20T21:01:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,302 | cpp | #include "MatrixAccountSession.h"
#include "include/ITeam.h"
#include "PolyTrix.h"
#include "include/Message.h"
#include <chrono>
#include <memory>
#include <functional>
#include "include/ICore.h"
#include "include/IAccount.h"
#include "include/IAccountManager.h"
#include <mtx.hpp>
#include <mtxclient/http/errors.hpp>
#include <mtx/events/collections.hpp>
using namespace PolyTrixPlugin;
using RoomNameStateEvent = mtx::events::StateEvent<mtx::events::state::Name>;
using RoomMessageEvent = mtx::events::RoomEvent<mtx::events::msg::Text>;
MatrixAccountSession::MatrixAccountSession(PolyTrix& plugin, Polychat::IAccount& coreAccount,
Polychat::ICore& core, std::string serverAddr, std::string name, std::string password)
: plugin(plugin), coreAccount(coreAccount), core(core)
{
client = std::make_shared<mtx::http::Client>(serverAddr);
client->login(name, password, [this](const mtx::responses::Login& res, mtx::http::RequestErr err)
{
if (err) {
std::cerr << "Error logging in!\n";
return;
}
client->set_access_token(res.access_token);
mtx::http::SyncOpts opts;
client->sync(opts, [this](const mtx::responses::Sync sync, mtx::http::RequestErr err) {
onSync(sync, err);
});
return;
}
);
}
std::string findRoomName(const mtx::responses::JoinedRoom& room) {
const auto& events = room.state.events;
for (auto i = events.rbegin(); i != events.rend(); ++i) {
if (auto nameEvent = std::get_if<RoomNameStateEvent>(&(*i))) {
return nameEvent->content.name;
}
}
return "Unknown Room Name";
}
void MatrixAccountSession::onSync(const mtx::responses::Sync sync, mtx::http::RequestErr err) {
if (err) {
std::cout << "Error syncing state\n";
return;
}
const std::map<std::string, std::shared_ptr<IConversation>>& conversations
= coreAccount.getConversations();
for (auto joinedRoom : sync.rooms.join) {
// Determine if the conversation even exists in PolyChat
auto itr = conversations.find(joinedRoom.first);
std::shared_ptr<IConversation> polychatConv;
if (itr == conversations.end()) {
// TODO: Differentiate channel types
polychatConv = coreAccount.loadConversation(joinedRoom.first,
Polychat::CONVERSATION_TYPE::PUBLIC_CHANNEL, findRoomName(joinedRoom.second));
} else {
polychatConv = itr->second;
}
for (auto event : joinedRoom.second.timeline.events) {
if (auto msgEvent = std::get_if<RoomMessageEvent>(&(event))) {
std::shared_ptr<Polychat::Message> polychatMessage = std::make_shared<Polychat::Message>();
polychatMessage->id = msgEvent->event_id;
polychatMessage->sendStatus = Polychat::SendStatus::SENT;
polychatMessage->channelId = msgEvent->room_id;
polychatMessage->msgContent = msgEvent->content.body; // Note, there is more content than the body
polychatMessage->uid = msgEvent->sender;
polychatMessage->createdAt = msgEvent->origin_server_ts;
polychatConv->processMessage(polychatMessage);
}
}
}
mtx::http::SyncOpts opts;
opts.since = sync.next_batch;
client->set_next_batch_token(sync.next_batch);
if (plugin.connectionsActive()) {
client->sync(opts, [this](const mtx::responses::Sync sync, mtx::http::RequestErr err) {
onSync(sync, err);
});
}
}
void MatrixAccountSession::doSync() {
}
void MatrixAccountSession::refresh(std::shared_ptr<IConversation> currentlyViewedConversation) {
// TODO: Now is when the rooms are loaded
if (!isSyncing) {
doSync();
}
}
void MatrixAccountSession::updatePosts(IConversation& conversation, int limit) {
// TODO
}
bool MatrixAccountSession::isValid() {
return true;
}
void MatrixAccountSession::sendMessageAction(std::shared_ptr<Message> message, MessageAction action) {
switch (action) {
case MessageAction::EDIT_MESSAGE:
// TODO
break;
case MessageAction::PIN_MESSAGE:
case MessageAction::UNPIN_MESSAGE:
// TODO: Unsupported
break;
case MessageAction::REMOVE_MESSAGE:
// TODO
break;
case MessageAction::SEND_NEW_MESSAGE:
mtx::events::msg::Text payload;
payload.body = message->msgContent;
client->send_room_message(message->channelId, payload, [message, this](const mtx::responses::EventId& res, mtx::http::RequestErr err) {
if (err) {
message->sendStatus = SendStatus::FAILED;
} else {
message->sendStatus = SendStatus::SENT;
}
});
break;
}
}
| [
"[email protected]"
] | |
b3abc456509e5c107676ffd25554624c142e1d07 | 46f2e7a10fca9f7e7b80b342240302c311c31914 | /opposing_lid_driven_flow/cavity/0.0358/p | 05cbe6b944a102765906eb3a9885d470aafdc646 | [] | no_license | patricksinclair/openfoam_warmups | 696cb1950d40b967b8b455164134bde03e9179a1 | 03c982f7d46b4858e3b6bfdde7b8e8c3c4275df9 | refs/heads/master | 2020-12-26T12:50:00.615357 | 2020-02-04T20:22:35 | 2020-02-04T20:22:35 | 237,510,814 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,271 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.0358";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
2500
(
-1.28937e-05
-6.51169
-9.29626
-10.4913
-11.1558
-11.5611
-11.8237
-12.0074
-12.1442
-12.2503
-12.3351
-12.4044
-12.4619
-12.5102
-12.551
-12.5859
-12.6157
-12.6413
-12.6635
-12.6826
-12.6991
-12.7135
-12.726
-12.737
-12.7468
-12.7556
-12.7638
-12.7716
-12.7793
-12.7872
-12.7958
-12.8053
-12.8163
-12.8293
-12.8448
-12.8638
-12.8872
-12.9162
-12.9526
-12.9987
-13.0581
-13.1359
-13.2411
-13.3891
-13.6109
-13.9677
-14.5666
-15.6667
-18.3335
-24.7184
-4.95583
-7.67551
-9.18184
-10.1414
-10.8086
-11.2678
-11.5886
-11.8212
-11.9958
-12.1307
-12.2376
-12.3241
-12.3953
-12.4546
-12.5046
-12.5471
-12.5835
-12.6148
-12.642
-12.6656
-12.6863
-12.7046
-12.7208
-12.7354
-12.7487
-12.761
-12.7727
-12.7842
-12.7957
-12.8077
-12.8206
-12.8349
-12.8513
-12.8702
-12.8927
-12.9197
-12.9526
-12.9931
-13.0437
-13.1077
-13.1899
-13.2976
-13.4418
-13.64
-13.9215
-14.3342
-14.9432
-15.8308
-17.2505
-19.8497
-7.92591
-8.75791
-9.55849
-10.2391
-10.7788
-11.1883
-11.4973
-11.7334
-11.9168
-12.0617
-12.1781
-12.2731
-12.3517
-12.4175
-12.4732
-12.5206
-12.5614
-12.5966
-12.6274
-12.6543
-12.678
-12.6991
-12.7181
-12.7353
-12.7512
-12.7661
-12.7804
-12.7946
-12.8089
-12.8239
-12.84
-12.8578
-12.8779
-12.901
-12.9281
-12.9604
-12.9993
-13.0467
-13.1053
-13.1783
-13.2708
-13.3894
-13.5438
-13.7477
-14.0204
-14.3883
-14.88
-15.5073
-16.2526
-17.016
-9.43606
-9.64881
-10.0674
-10.512
-10.9046
-11.2313
-11.4973
-11.7125
-11.8869
-12.0291
-12.1461
-12.2433
-12.3247
-12.3936
-12.4523
-12.5027
-12.5462
-12.5842
-12.6174
-12.6467
-12.6726
-12.6959
-12.717
-12.7363
-12.7542
-12.7712
-12.7876
-12.8039
-12.8204
-12.8377
-12.8562
-12.8765
-12.8992
-12.9252
-12.9554
-12.991
-13.0334
-13.0844
-13.1463
-13.2224
-13.3164
-13.4337
-13.581
-13.7668
-14.0006
-14.2921
-14.6468
-15.0522
-15.434
-15.6118
-10.3223
-10.3209
-10.5242
-10.8006
-11.0749
-11.3246
-11.5429
-11.7295
-11.8872
-12.0202
-12.1326
-12.2279
-12.3091
-12.3786
-12.4386
-12.4905
-12.5358
-12.5755
-12.6104
-12.6415
-12.6692
-12.6942
-12.717
-12.7379
-12.7576
-12.7762
-12.7943
-12.8123
-12.8307
-12.8497
-12.8701
-12.8923
-12.917
-12.9451
-12.9773
-13.0147
-13.0588
-13.1111
-13.1735
-13.2486
-13.3392
-13.449
-13.5819
-13.742
-13.9324
-14.1531
-14.398
-14.6463
-14.8256
-14.8069
-10.8895
-10.8142
-10.9022
-11.0692
-11.2567
-11.4427
-11.6164
-11.7727
-11.9105
-12.0307
-12.135
-12.2254
-12.3039
-12.3722
-12.4318
-12.4839
-12.5298
-12.5704
-12.6064
-12.6386
-12.6675
-12.6937
-12.7177
-12.74
-12.7609
-12.7809
-12.8003
-12.8196
-12.8393
-12.8597
-12.8814
-12.9049
-12.9308
-12.96
-12.9931
-13.0312
-13.0754
-13.127
-13.1875
-13.2588
-13.3427
-13.4414
-13.5567
-13.6897
-13.8396
-14.0019
-14.1668
-14.3138
-14.3869
-14.3047
-11.272
-11.1797
-11.2091
-11.3075
-11.4336
-11.5696
-11.7048
-11.8327
-11.95
-12.0558
-12.1501
-12.2338
-12.3078
-12.3733
-12.4311
-12.4824
-12.528
-12.5686
-12.6049
-12.6376
-12.6672
-12.6942
-12.719
-12.7421
-12.7639
-12.7848
-12.8052
-12.8254
-12.8459
-12.8672
-12.8896
-12.9138
-12.9403
-12.9698
-13.0029
-13.0405
-13.0835
-13.1329
-13.1899
-13.2555
-13.331
-13.4171
-13.5143
-13.6218
-13.737
-13.8539
-13.9628
-14.0471
-14.0675
-13.9743
-11.5453
-11.4567
-11.4569
-11.5129
-11.5965
-11.6947
-11.7985
-11.9014
-11.9995
-12.0909
-12.1746
-12.2505
-12.3189
-12.3804
-12.4356
-12.4851
-12.5295
-12.5695
-12.6055
-12.6382
-12.668
-12.6953
-12.7205
-12.7441
-12.7664
-12.7878
-12.8087
-12.8295
-12.8504
-12.8721
-12.8949
-12.9192
-12.9456
-12.9747
-13.0071
-13.0434
-13.0843
-13.1306
-13.1829
-13.242
-13.3083
-13.3818
-13.4621
-13.5475
-13.6346
-13.7176
-13.7883
-13.8345
-13.8298
-13.7434
-11.7512
-11.6718
-11.6578
-11.6876
-11.7422
-11.8125
-11.8915
-11.9734
-12.0544
-12.1322
-12.2053
-12.2732
-12.3355
-12.3924
-12.4442
-12.4912
-12.5339
-12.5726
-12.6079
-12.64
-12.6695
-12.6967
-12.722
-12.7457
-12.7681
-12.7897
-12.8108
-12.8317
-12.8528
-12.8744
-12.8971
-12.9211
-12.947
-12.9752
-13.0063
-13.0406
-13.0788
-13.1214
-13.1687
-13.2209
-13.2782
-13.3401
-13.4055
-13.4725
-13.5377
-13.5961
-13.6411
-13.6643
-13.6482
-13.5729
-11.9125
-11.8429
-11.8222
-11.836
-11.8708
-11.9208
-11.9804
-12.0451
-12.1114
-12.1769
-12.2401
-12.2999
-12.3559
-12.4079
-12.4559
-12.5
-12.5404
-12.5775
-12.6115
-12.6427
-12.6716
-12.6983
-12.7232
-12.7467
-12.769
-12.7905
-12.8114
-12.8321
-12.853
-12.8743
-12.8965
-12.9198
-12.9448
-12.9717
-13.0011
-13.0331
-13.0683
-13.1068
-13.1489
-13.1946
-13.2435
-13.2951
-13.3479
-13.4001
-13.4486
-13.4892
-13.5171
-13.5267
-13.506
-13.4417
-12.0426
-11.9817
-11.9585
-11.9623
-11.9838
-12.0189
-12.0636
-12.1144
-12.1683
-12.223
-12.2771
-12.3293
-12.3791
-12.426
-12.4699
-12.5108
-12.5486
-12.5837
-12.6161
-12.6461
-12.6739
-12.6998
-12.7241
-12.7471
-12.7689
-12.79
-12.8105
-12.8308
-12.8511
-12.8718
-12.8932
-12.9157
-12.9394
-12.9648
-12.9921
-13.0217
-13.0537
-13.0882
-13.1254
-13.1649
-13.2063
-13.2489
-13.2914
-13.3318
-13.3677
-13.3957
-13.4123
-13.4139
-13.392
-13.3372
-12.15
-12.0965
-12.0728
-12.0705
-12.0828
-12.1071
-12.1405
-12.1801
-12.2236
-12.269
-12.3149
-12.3601
-12.404
-12.4459
-12.4857
-12.5231
-12.5581
-12.5909
-12.6214
-12.6498
-12.6764
-12.7013
-12.7247
-12.7468
-12.7679
-12.7883
-12.8082
-12.8278
-12.8474
-12.8673
-12.8877
-12.909
-12.9313
-12.955
-12.9802
-13.0072
-13.036
-13.0667
-13.0992
-13.1332
-13.1681
-13.2031
-13.2371
-13.2684
-13.2948
-13.3139
-13.3232
-13.3201
-13.2987
-13.252
-12.2399
-12.1929
-12.1697
-12.1638
-12.1699
-12.1863
-12.2109
-12.2417
-12.2766
-12.3141
-12.3527
-12.3915
-12.4298
-12.4669
-12.5026
-12.5365
-12.5686
-12.5988
-12.6273
-12.6539
-12.679
-12.7026
-12.7248
-12.7459
-12.7662
-12.7856
-12.8046
-12.8233
-12.842
-12.8609
-12.8802
-12.9001
-12.9209
-12.9427
-12.9658
-12.9902
-13.016
-13.0432
-13.0714
-13.1005
-13.1298
-13.1586
-13.1858
-13.21
-13.2294
-13.2423
-13.2467
-13.2411
-13.221
-13.181
-12.3164
-12.2748
-12.2527
-12.2447
-12.2466
-12.2573
-12.2753
-12.299
-12.3269
-12.3575
-12.3898
-12.4229
-12.456
-12.4886
-12.5202
-12.5507
-12.5798
-12.6074
-12.6336
-12.6583
-12.6816
-12.7037
-12.7246
-12.7446
-12.7637
-12.7821
-12.8
-12.8177
-12.8353
-12.853
-12.871
-12.8895
-12.9087
-12.9287
-12.9496
-12.9716
-12.9945
-13.0183
-13.0428
-13.0677
-13.0922
-13.1159
-13.1376
-13.1563
-13.1706
-13.1791
-13.1804
-13.1736
-13.1552
-13.1209
-12.3821
-12.3453
-12.3246
-12.3155
-12.3146
-12.3211
-12.334
-12.3522
-12.3742
-12.3991
-12.426
-12.4539
-12.4822
-12.5105
-12.5383
-12.5654
-12.5914
-12.6164
-12.6402
-12.6629
-12.6844
-12.7048
-12.7243
-12.7428
-12.7606
-12.7778
-12.7946
-12.8111
-12.8274
-12.8439
-12.8605
-12.8775
-12.895
-12.9132
-12.9321
-12.9517
-12.972
-12.9928
-13.014
-13.0351
-13.0557
-13.0752
-13.0926
-13.1071
-13.1176
-13.1231
-13.1225
-13.1153
-13.0987
-13.0693
-12.439
-12.4065
-12.3874
-12.3779
-12.3751
-12.3786
-12.3877
-12.4014
-12.4187
-12.4388
-12.4609
-12.4842
-12.5083
-12.5326
-12.5567
-12.5805
-12.6036
-12.6259
-12.6473
-12.6678
-12.6873
-12.706
-12.7238
-12.7408
-12.7572
-12.7731
-12.7886
-12.8037
-12.8188
-12.8338
-12.849
-12.8645
-12.8804
-12.8967
-12.9136
-12.931
-12.9488
-12.967
-12.9852
-13.0032
-13.0205
-13.0365
-13.0505
-13.0619
-13.0696
-13.073
-13.0713
-13.0642
-13.0496
-13.0245
-12.4888
-12.4601
-12.4427
-12.4332
-12.4293
-12.4307
-12.4369
-12.447
-12.4605
-12.4765
-12.4944
-12.5138
-12.5339
-12.5546
-12.5753
-12.5959
-12.616
-12.6357
-12.6546
-12.6729
-12.6904
-12.7072
-12.7233
-12.7388
-12.7537
-12.7681
-12.7821
-12.7959
-12.8096
-12.8232
-12.8369
-12.8508
-12.865
-12.8796
-12.8946
-12.9099
-12.9255
-12.9412
-12.9569
-12.9721
-12.9866
-12.9998
-13.0112
-13.0201
-13.0259
-13.0279
-13.0257
-13.0191
-13.0063
-12.985
-12.5327
-12.5075
-12.4918
-12.4827
-12.4782
-12.4781
-12.4821
-12.4894
-12.4997
-12.5123
-12.5267
-12.5424
-12.5591
-12.5764
-12.5939
-12.6115
-12.6288
-12.6458
-12.6624
-12.6784
-12.6939
-12.7088
-12.7231
-12.7368
-12.7501
-12.763
-12.7755
-12.7879
-12.8
-12.8122
-12.8244
-12.8367
-12.8493
-12.8621
-12.8752
-12.8886
-12.9021
-12.9157
-12.929
-12.942
-12.9541
-12.965
-12.9743
-12.9813
-12.9857
-12.9868
-12.9845
-12.9786
-12.9677
-12.9499
-12.5716
-12.5497
-12.5358
-12.5274
-12.5226
-12.5216
-12.5238
-12.529
-12.5366
-12.5464
-12.5577
-12.5703
-12.5839
-12.598
-12.6126
-12.6272
-12.6419
-12.6564
-12.6705
-12.6843
-12.6977
-12.7106
-12.7231
-12.7351
-12.7467
-12.758
-12.769
-12.7798
-12.7904
-12.801
-12.8117
-12.8224
-12.8333
-12.8445
-12.8558
-12.8673
-12.8789
-12.8905
-12.9018
-12.9127
-12.9228
-12.9319
-12.9394
-12.9451
-12.9484
-12.9491
-12.947
-12.9419
-12.9329
-12.9183
-12.6066
-12.5878
-12.5756
-12.5679
-12.5633
-12.5616
-12.5626
-12.5661
-12.5716
-12.5788
-12.5875
-12.5974
-12.6081
-12.6195
-12.6312
-12.6432
-12.6553
-12.6673
-12.6791
-12.6907
-12.702
-12.7129
-12.7235
-12.7338
-12.7437
-12.7533
-12.7627
-12.7719
-12.7809
-12.79
-12.799
-12.8082
-12.8174
-12.8269
-12.8365
-12.8462
-12.856
-12.8657
-12.8752
-12.8843
-12.8927
-12.9002
-12.9063
-12.9109
-12.9136
-12.9141
-12.9123
-12.9082
-12.901
-12.8894
-12.6383
-12.6224
-12.612
-12.6052
-12.6008
-12.5988
-12.5989
-12.601
-12.6048
-12.61
-12.6164
-12.6238
-12.6319
-12.6407
-12.6499
-12.6594
-12.669
-12.6786
-12.6882
-12.6976
-12.7068
-12.7158
-12.7245
-12.7329
-12.7411
-12.749
-12.7567
-12.7643
-12.7717
-12.7791
-12.7866
-12.7941
-12.8017
-12.8094
-12.8173
-12.8253
-12.8334
-12.8414
-12.8492
-12.8566
-12.8635
-12.8696
-12.8747
-12.8784
-12.8806
-12.8811
-12.8798
-12.8768
-12.8714
-12.8627
-12.6672
-12.6542
-12.6456
-12.6398
-12.6358
-12.6337
-12.6332
-12.6342
-12.6365
-12.6399
-12.6443
-12.6495
-12.6554
-12.6618
-12.6687
-12.6758
-12.683
-12.6904
-12.6978
-12.7051
-12.7123
-12.7193
-12.7261
-12.7327
-12.739
-12.7452
-12.7512
-12.7571
-12.7629
-12.7687
-12.7745
-12.7803
-12.7862
-12.7923
-12.7985
-12.8048
-12.8111
-12.8174
-12.8236
-12.8296
-12.8351
-12.84
-12.8441
-12.8472
-12.8491
-12.8498
-12.8491
-12.8471
-12.8434
-12.8375
-12.6941
-12.6839
-12.677
-12.6722
-12.6688
-12.6667
-12.6658
-12.6659
-12.667
-12.6689
-12.6716
-12.6748
-12.6786
-12.6829
-12.6875
-12.6924
-12.6975
-12.7027
-12.7079
-12.7132
-12.7183
-12.7234
-12.7283
-12.7331
-12.7377
-12.7421
-12.7464
-12.7506
-12.7547
-12.7587
-12.7628
-12.7669
-12.7712
-12.7755
-12.7799
-12.7845
-12.7892
-12.7939
-12.7985
-12.803
-12.8073
-12.8111
-12.8143
-12.8168
-12.8186
-12.8195
-12.8194
-12.8186
-12.8167
-12.8135
-12.7193
-12.7118
-12.7067
-12.703
-12.7002
-12.6983
-12.6971
-12.6965
-12.6966
-12.6972
-12.6983
-12.6998
-12.7017
-12.7039
-12.7065
-12.7093
-12.7122
-12.7154
-12.7186
-12.7218
-12.7251
-12.7282
-12.7313
-12.7342
-12.737
-12.7397
-12.7422
-12.7446
-12.747
-12.7493
-12.7517
-12.754
-12.7565
-12.7591
-12.7618
-12.7646
-12.7676
-12.7706
-12.7737
-12.7768
-12.7798
-12.7825
-12.785
-12.787
-12.7886
-12.7898
-12.7905
-12.7907
-12.7906
-12.7901
-12.7435
-12.7386
-12.7353
-12.7327
-12.7306
-12.7289
-12.7275
-12.7264
-12.7255
-12.7249
-12.7246
-12.7245
-12.7246
-12.725
-12.7256
-12.7264
-12.7274
-12.7286
-12.7298
-12.7312
-12.7325
-12.7338
-12.735
-12.7361
-12.7371
-12.738
-12.7388
-12.7394
-12.74
-12.7406
-12.7411
-12.7417
-12.7423
-12.743
-12.7439
-12.745
-12.7462
-12.7476
-12.7491
-12.7507
-12.7524
-12.7541
-12.7558
-12.7574
-12.7589
-12.7603
-12.7617
-12.7631
-12.7648
-12.7669
-12.7669
-12.7647
-12.7631
-12.7617
-12.7603
-12.7589
-12.7573
-12.7557
-12.7541
-12.7524
-12.7507
-12.7491
-12.7475
-12.7462
-12.745
-12.7439
-12.743
-12.7423
-12.7417
-12.7411
-12.7406
-12.74
-12.7394
-12.7388
-12.738
-12.7371
-12.7361
-12.735
-12.7338
-12.7325
-12.7312
-12.7299
-12.7286
-12.7274
-12.7264
-12.7256
-12.725
-12.7246
-12.7245
-12.7246
-12.7249
-12.7256
-12.7264
-12.7275
-12.7289
-12.7306
-12.7327
-12.7353
-12.7387
-12.7435
-12.7901
-12.7906
-12.7907
-12.7905
-12.7898
-12.7886
-12.787
-12.7849
-12.7825
-12.7797
-12.7768
-12.7737
-12.7706
-12.7675
-12.7646
-12.7617
-12.759
-12.7565
-12.754
-12.7517
-12.7493
-12.747
-12.7446
-12.7422
-12.7397
-12.737
-12.7342
-12.7313
-12.7282
-12.7251
-12.7218
-12.7186
-12.7154
-12.7123
-12.7093
-12.7065
-12.7039
-12.7017
-12.6998
-12.6983
-12.6972
-12.6966
-12.6966
-12.6971
-12.6983
-12.7003
-12.7031
-12.7067
-12.7119
-12.7194
-12.8135
-12.8167
-12.8186
-12.8194
-12.8194
-12.8186
-12.8168
-12.8143
-12.811
-12.8072
-12.803
-12.7985
-12.7939
-12.7892
-12.7845
-12.7799
-12.7755
-12.7711
-12.7669
-12.7628
-12.7587
-12.7547
-12.7506
-12.7464
-12.7421
-12.7377
-12.7331
-12.7283
-12.7234
-12.7183
-12.7132
-12.7079
-12.7027
-12.6975
-12.6924
-12.6875
-12.6829
-12.6786
-12.6748
-12.6716
-12.6689
-12.667
-12.6659
-12.6658
-12.6667
-12.6688
-12.6722
-12.677
-12.6839
-12.6941
-12.8375
-12.8434
-12.8471
-12.8491
-12.8497
-12.8491
-12.8472
-12.8441
-12.84
-12.8351
-12.8296
-12.8236
-12.8174
-12.8111
-12.8047
-12.7985
-12.7923
-12.7862
-12.7803
-12.7745
-12.7687
-12.7629
-12.7571
-12.7512
-12.7452
-12.739
-12.7327
-12.7261
-12.7193
-12.7123
-12.7051
-12.6978
-12.6904
-12.6831
-12.6758
-12.6687
-12.6619
-12.6554
-12.6496
-12.6443
-12.6399
-12.6365
-12.6342
-12.6332
-12.6337
-12.6358
-12.6398
-12.6456
-12.6543
-12.6673
-12.8626
-12.8713
-12.8768
-12.8798
-12.8811
-12.8806
-12.8784
-12.8746
-12.8696
-12.8635
-12.8566
-12.8492
-12.8413
-12.8333
-12.8253
-12.8173
-12.8094
-12.8017
-12.7941
-12.7866
-12.7791
-12.7717
-12.7643
-12.7567
-12.749
-12.7411
-12.7329
-12.7245
-12.7158
-12.7068
-12.6976
-12.6882
-12.6787
-12.669
-12.6594
-12.6499
-12.6407
-12.632
-12.6238
-12.6164
-12.61
-12.6048
-12.601
-12.599
-12.5988
-12.6009
-12.6052
-12.612
-12.6224
-12.6383
-12.8894
-12.901
-12.9082
-12.9123
-12.9141
-12.9136
-12.9109
-12.9063
-12.9001
-12.8927
-12.8843
-12.8752
-12.8657
-12.856
-12.8462
-12.8365
-12.8269
-12.8174
-12.8082
-12.799
-12.79
-12.7809
-12.7719
-12.7627
-12.7533
-12.7437
-12.7338
-12.7235
-12.713
-12.702
-12.6907
-12.6791
-12.6673
-12.6553
-12.6432
-12.6312
-12.6195
-12.6081
-12.5974
-12.5876
-12.5789
-12.5716
-12.5661
-12.5626
-12.5616
-12.5633
-12.568
-12.5757
-12.5878
-12.6066
-12.9183
-12.9329
-12.9419
-12.947
-12.9491
-12.9484
-12.945
-12.9394
-12.9319
-12.9228
-12.9127
-12.9018
-12.8905
-12.8789
-12.8673
-12.8558
-12.8445
-12.8333
-12.8224
-12.8117
-12.801
-12.7904
-12.7798
-12.769
-12.758
-12.7467
-12.7351
-12.7231
-12.7106
-12.6977
-12.6844
-12.6706
-12.6564
-12.6419
-12.6273
-12.6126
-12.598
-12.5839
-12.5703
-12.5577
-12.5464
-12.5367
-12.529
-12.5238
-12.5216
-12.5227
-12.5274
-12.5358
-12.5498
-12.5717
-12.9499
-12.9677
-12.9786
-12.9845
-12.9868
-12.9856
-12.9813
-12.9743
-12.965
-12.9541
-12.942
-12.929
-12.9156
-12.9021
-12.8886
-12.8752
-12.8621
-12.8493
-12.8367
-12.8244
-12.8122
-12.8
-12.7879
-12.7755
-12.763
-12.7501
-12.7368
-12.7231
-12.7088
-12.6939
-12.6784
-12.6624
-12.6458
-12.6288
-12.6115
-12.5939
-12.5764
-12.5592
-12.5425
-12.5267
-12.5123
-12.4997
-12.4895
-12.4821
-12.4782
-12.4783
-12.4827
-12.4918
-12.5075
-12.5327
-12.985
-13.0063
-13.0191
-13.0257
-13.0279
-13.0259
-13.0201
-13.0112
-12.9998
-12.9866
-12.9721
-12.9569
-12.9412
-12.9255
-12.9099
-12.8946
-12.8796
-12.865
-12.8508
-12.8369
-12.8232
-12.8096
-12.7959
-12.7821
-12.7681
-12.7537
-12.7388
-12.7234
-12.7073
-12.6905
-12.6729
-12.6547
-12.6357
-12.616
-12.5959
-12.5753
-12.5546
-12.534
-12.5138
-12.4945
-12.4765
-12.4605
-12.4471
-12.4369
-12.4308
-12.4294
-12.4332
-12.4427
-12.4601
-12.4888
-13.0245
-13.0496
-13.0642
-13.0713
-13.073
-13.0696
-13.0619
-13.0505
-13.0365
-13.0205
-13.0032
-12.9852
-12.967
-12.9488
-12.931
-12.9136
-12.8967
-12.8804
-12.8645
-12.849
-12.8338
-12.8188
-12.8037
-12.7886
-12.7731
-12.7573
-12.7409
-12.7238
-12.706
-12.6873
-12.6678
-12.6473
-12.6259
-12.6036
-12.5805
-12.5568
-12.5326
-12.5083
-12.4842
-12.4609
-12.4388
-12.4187
-12.4014
-12.3877
-12.3787
-12.3751
-12.3779
-12.3874
-12.4065
-12.439
-13.0693
-13.0987
-13.1153
-13.1225
-13.1231
-13.1176
-13.1071
-13.0926
-13.0752
-13.0557
-13.0351
-13.014
-12.9928
-12.972
-12.9517
-12.9321
-12.9132
-12.895
-12.8775
-12.8605
-12.8439
-12.8274
-12.8111
-12.7946
-12.7778
-12.7606
-12.7428
-12.7243
-12.7048
-12.6844
-12.6629
-12.6403
-12.6164
-12.5915
-12.5654
-12.5384
-12.5106
-12.4823
-12.4539
-12.426
-12.3992
-12.3743
-12.3522
-12.3341
-12.3211
-12.3146
-12.3155
-12.3246
-12.3453
-12.3821
-13.1209
-13.1552
-13.1736
-13.1804
-13.1791
-13.1706
-13.1563
-13.1376
-13.1159
-13.0922
-13.0677
-13.0428
-13.0183
-12.9945
-12.9716
-12.9496
-12.9287
-12.9087
-12.8895
-12.871
-12.853
-12.8353
-12.8177
-12.8
-12.7821
-12.7637
-12.7446
-12.7247
-12.7037
-12.6817
-12.6583
-12.6336
-12.6074
-12.5798
-12.5507
-12.5202
-12.4886
-12.456
-12.4229
-12.3899
-12.3576
-12.3269
-12.2991
-12.2753
-12.2573
-12.2466
-12.2448
-12.2528
-12.2749
-12.3164
-13.181
-13.221
-13.2411
-13.2466
-13.2423
-13.2294
-13.21
-13.1858
-13.1586
-13.1298
-13.1005
-13.0714
-13.0432
-13.016
-12.9902
-12.9658
-12.9427
-12.9209
-12.9001
-12.8802
-12.8609
-12.842
-12.8234
-12.8046
-12.7857
-12.7662
-12.746
-12.7248
-12.7026
-12.679
-12.654
-12.6273
-12.5989
-12.5686
-12.5365
-12.5026
-12.4669
-12.4298
-12.3916
-12.3527
-12.3141
-12.2767
-12.2417
-12.211
-12.1863
-12.1699
-12.1638
-12.1697
-12.193
-12.24
-13.252
-13.2987
-13.3201
-13.3232
-13.3139
-13.2948
-13.2684
-13.2371
-13.2031
-13.1681
-13.1332
-13.0992
-13.0667
-13.036
-13.0072
-12.9802
-12.955
-12.9313
-12.909
-12.8877
-12.8673
-12.8474
-12.8278
-12.8082
-12.7883
-12.768
-12.7468
-12.7247
-12.7013
-12.6764
-12.6499
-12.6214
-12.5909
-12.5582
-12.5231
-12.4857
-12.4459
-12.404
-12.3602
-12.3149
-12.2691
-12.2237
-12.1802
-12.1405
-12.1071
-12.0829
-12.0705
-12.0728
-12.0966
-12.15
-13.3372
-13.392
-13.4139
-13.4123
-13.3957
-13.3677
-13.3318
-13.2914
-13.2489
-13.2063
-13.1649
-13.1254
-13.0882
-13.0537
-13.0217
-12.9921
-12.9648
-12.9394
-12.9157
-12.8933
-12.8718
-12.8511
-12.8308
-12.8105
-12.79
-12.7689
-12.7471
-12.7242
-12.6999
-12.6739
-12.6461
-12.6161
-12.5837
-12.5487
-12.5108
-12.47
-12.4261
-12.3791
-12.3293
-12.2771
-12.2231
-12.1683
-12.1145
-12.0637
-12.0189
-11.9838
-11.9624
-11.9585
-11.9818
-12.0427
-13.4417
-13.506
-13.5267
-13.5171
-13.4892
-13.4486
-13.4001
-13.3479
-13.2951
-13.2435
-13.1946
-13.1489
-13.1068
-13.0683
-13.0331
-13.0011
-12.9717
-12.9448
-12.9199
-12.8965
-12.8743
-12.853
-12.8321
-12.8114
-12.7905
-12.769
-12.7467
-12.7233
-12.6983
-12.6716
-12.6428
-12.6115
-12.5775
-12.5404
-12.5
-12.4559
-12.408
-12.356
-12.3
-12.2401
-12.177
-12.1115
-12.0452
-11.9805
-11.9208
-11.8709
-11.836
-11.8223
-11.8429
-11.9125
-13.5729
-13.6482
-13.6643
-13.6411
-13.5961
-13.5377
-13.4725
-13.4055
-13.3401
-13.2782
-13.2209
-13.1687
-13.1214
-13.0788
-13.0406
-13.0063
-12.9752
-12.947
-12.9211
-12.8971
-12.8745
-12.8528
-12.8317
-12.8108
-12.7898
-12.7682
-12.7457
-12.722
-12.6967
-12.6696
-12.6401
-12.6079
-12.5726
-12.5339
-12.4912
-12.4442
-12.3924
-12.3355
-12.2732
-12.2054
-12.1322
-12.0545
-11.9734
-11.8915
-11.8126
-11.7422
-11.6877
-11.6578
-11.6719
-11.7512
-13.7434
-13.8297
-13.8345
-13.7883
-13.7176
-13.6346
-13.5475
-13.4621
-13.3818
-13.3083
-13.242
-13.1829
-13.1306
-13.0843
-13.0434
-13.0071
-12.9747
-12.9456
-12.9192
-12.8949
-12.8721
-12.8505
-12.8295
-12.8087
-12.7878
-12.7664
-12.7441
-12.7205
-12.6953
-12.668
-12.6382
-12.6056
-12.5695
-12.5295
-12.4851
-12.4356
-12.3805
-12.319
-12.2505
-12.1746
-12.0909
-11.9996
-11.9015
-11.7986
-11.6947
-11.5965
-11.513
-11.4569
-11.4568
-11.5454
-13.9743
-14.0675
-14.0471
-13.9628
-13.8539
-13.737
-13.6218
-13.5143
-13.4171
-13.331
-13.2555
-13.1899
-13.1329
-13.0835
-13.0405
-13.0029
-12.9698
-12.9403
-12.9138
-12.8896
-12.8672
-12.8459
-12.8254
-12.8052
-12.7848
-12.764
-12.7422
-12.719
-12.6942
-12.6672
-12.6376
-12.6049
-12.5686
-12.528
-12.4824
-12.4312
-12.3733
-12.3079
-12.2338
-12.1502
-12.0558
-11.95
-11.8327
-11.7049
-11.5696
-11.4336
-11.3076
-11.2091
-11.1798
-11.272
-14.3047
-14.3869
-14.3138
-14.1668
-14.0019
-13.8396
-13.6897
-13.5567
-13.4414
-13.3427
-13.2588
-13.1875
-13.127
-13.0754
-13.0312
-12.9931
-12.96
-12.9308
-12.9049
-12.8814
-12.8597
-12.8393
-12.8196
-12.8003
-12.7809
-12.7609
-12.74
-12.7178
-12.6937
-12.6675
-12.6386
-12.6064
-12.5704
-12.5299
-12.484
-12.4318
-12.3722
-12.3039
-12.2255
-12.135
-12.0307
-11.9105
-11.7727
-11.6164
-11.4427
-11.2567
-11.0692
-10.9022
-10.8142
-10.8895
-14.8069
-14.8256
-14.6463
-14.398
-14.1531
-13.9324
-13.742
-13.5819
-13.449
-13.3392
-13.2486
-13.1735
-13.1111
-13.0588
-13.0147
-12.9773
-12.9451
-12.9171
-12.8923
-12.8701
-12.8497
-12.8307
-12.8124
-12.7944
-12.7762
-12.7576
-12.738
-12.717
-12.6942
-12.6692
-12.6415
-12.6105
-12.5755
-12.5358
-12.4905
-12.4386
-12.3787
-12.3091
-12.2279
-12.1326
-12.0203
-11.8872
-11.7295
-11.543
-11.3247
-11.075
-10.8006
-10.5242
-10.3209
-10.3223
-15.6118
-15.434
-15.0522
-14.6468
-14.2921
-14.0006
-13.7668
-13.581
-13.4337
-13.3164
-13.2224
-13.1463
-13.0844
-13.0334
-12.991
-12.9555
-12.9252
-12.8992
-12.8765
-12.8562
-12.8377
-12.8204
-12.8039
-12.7876
-12.7712
-12.7542
-12.7363
-12.717
-12.696
-12.6727
-12.6467
-12.6174
-12.5842
-12.5463
-12.5027
-12.4523
-12.3936
-12.3248
-12.2433
-12.1462
-12.0292
-11.8869
-11.7125
-11.4973
-11.2313
-10.9046
-10.512
-10.0675
-9.64888
-9.43613
-17.016
-16.2526
-15.5073
-14.88
-14.3883
-14.0204
-13.7477
-13.5438
-13.3894
-13.2708
-13.1783
-13.1053
-13.0467
-12.9993
-12.9604
-12.9281
-12.901
-12.8779
-12.8578
-12.84
-12.8239
-12.809
-12.7946
-12.7805
-12.7661
-12.7512
-12.7353
-12.7181
-12.6991
-12.678
-12.6543
-12.6274
-12.5967
-12.5614
-12.5206
-12.4732
-12.4176
-12.3518
-12.2732
-12.1782
-12.0617
-11.9168
-11.7334
-11.4973
-11.1883
-10.7789
-10.2391
-9.55856
-8.75798
-7.92598
-19.8497
-17.2505
-15.8308
-14.9432
-14.3342
-13.9215
-13.64
-13.4418
-13.2976
-13.1899
-13.1077
-13.0437
-12.9931
-12.9526
-12.9197
-12.8927
-12.8702
-12.8513
-12.835
-12.8206
-12.8077
-12.7957
-12.7842
-12.7727
-12.761
-12.7487
-12.7354
-12.7209
-12.7046
-12.6864
-12.6657
-12.642
-12.6148
-12.5835
-12.5471
-12.5046
-12.4546
-12.3953
-12.3242
-12.2377
-12.1308
-11.9958
-11.8212
-11.5887
-11.2679
-10.8086
-10.1415
-9.18191
-7.67559
-4.95592
-24.7184
-18.3335
-15.6667
-14.5666
-13.9677
-13.6109
-13.3891
-13.2411
-13.1359
-13.0581
-12.9987
-12.9526
-12.9162
-12.8872
-12.8638
-12.8448
-12.8293
-12.8163
-12.8053
-12.7958
-12.7873
-12.7793
-12.7716
-12.7638
-12.7557
-12.7468
-12.737
-12.726
-12.7135
-12.6991
-12.6826
-12.6635
-12.6414
-12.6157
-12.5859
-12.5511
-12.5102
-12.462
-12.4045
-12.3352
-12.2503
-12.1442
-12.0075
-11.8238
-11.5612
-11.1559
-10.4914
-9.29633
-6.51177
-0.000113676
)
;
boundaryField
{
movingWallTop
{
type zeroGradient;
}
movingWallBottom
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
f60828c1d93b4993d2a2017adde229ae95e7d173 | e38284c7578f084dd726e5522b3eab29b305385b | /Wml/Source/Approximation/WmlApprLineFit2.h | 931e496e4498396bb803a1455ead243faa20aced | [
"MIT"
] | permissive | changjiayi6322/deform2d | 99d73136b493833fa4d6788120f6bfb71035bc4d | 1a350dd20f153e72de1ea9cffb873eb67bf3d668 | refs/heads/master | 2020-06-02T19:38:45.240018 | 2018-07-04T20:26:35 | 2018-07-04T20:26:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,651 | h | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2004. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclosed except in accordance with the terms of
// that agreement.
#ifndef WMLAPPR2DLINEFIT_H
#define WMLAPPR2DLINEFIT_H
#include "WmlVector2.h"
namespace Wml
{
// Least-squares fit of a line to (x,f(x)) data by using distance
// measurements in the y-direction. The resulting line is represented by
// y = A*x + B. The return value is 'false' if the 2x2 coefficient matrix
// in the linear system that defines A and B is nearly singular.
template <class Real>
WML_ITEM bool HeightLineFit (int iQuantity, const Vector2<Real>* akPoint,
Real& rfA, Real& rfB);
// Least-squares fit of a line to (x,y) data by using distance measurements
// orthogonal to the proposed line. The resulting line is represented by
// Offset + t*Direction where the returned direction is a unit-length vector.
template <class Real>
WML_ITEM void OrthogonalLineFit (int iQuantity, const Vector2<Real>* akPoint,
Vector2<Real>& rkOffset, Vector2<Real>& rkDirection);
// This function allows for selection of vertices from a pool. The return
// value is 'true' if and only if at least one vertex is valid.
template <class Real>
WML_ITEM bool OrthogonalLineFit (int iQuantity, const Vector2<Real>* akPoint,
const bool* abValid, Vector2<Real>& rkOffset, Vector2<Real>& rkDirection);
}
#endif
| [
"[email protected]"
] | |
3c3fd60062f52b08af9b6a990ac24773f80076a5 | fd8fdf41880f3f67f8e6413c297b5144097b50ad | /trunk/src/server/feeds_server/db_collect.cpp | 23e3359c2b128a872ac892f9ed55b04b01791e7f | [] | no_license | liuxuanhai/CGI_Web | c67d4db6a3a4de3714babbd31f095d2285545aac | 273343bb06a170ac3086d633435e7bcaaa81e8c5 | refs/heads/master | 2020-03-18T12:27:40.035442 | 2016-09-28T11:18:26 | 2016-09-28T11:18:26 | 134,727,689 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,793 | cpp | #include "db_collect.h"
int CollectInfo::SelectFromDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
std::ostringstream ossSql;
ossSql.str("");
ossSql << "select * from " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5% 256)
<<" where pa_appid_md5 = " << m_pa_appid_md5
<<" and feed_id = " << m_feed_id
<<" and openid_md5 = " << m_openid_md5;
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
if(!mysql.GetRowCount())
{
return DB_RET_NOT_EXIST;
}
if(mysql.GetRowCount() && mysql.Next())
{
m_create_ts = strtoul(mysql.GetRow(3), NULL, 10);
}
return DB_RET_OK;
}
int CollectInfo::InsertToDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
std::ostringstream ossSql;
ossSql.str("");
ossSql<<"insert into " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5 % 256)
<<" set feed_id=" << m_feed_id
<<", pa_appid_md5=" << m_pa_appid_md5
<<", openid_md5=" << m_openid_md5
<<", create_ts=" << m_create_ts
;
strErrMsg = ossSql.str();
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
return DB_RET_OK;
}
int CollectInfo::UpdateToDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
std::ostringstream ossSql;
ossSql.str("");
ossSql<<"insert into " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5 % 256)
<<" set feed_id=" << m_feed_id
<<", pa_appid_md5=" << m_pa_appid_md5
<<", openid_md5=" << m_openid_md5
<<", create_ts=" << m_create_ts
<<" on duplicate key"
<<" update create_ts=" << m_create_ts;
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
return DB_RET_OK;
}
int CollectInfo::DeleteFromDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
std::ostringstream ossSql;
ossSql.str("");
ossSql << "delete from " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5 % 256)
<<" where feed_id=" << m_feed_id
<<" and pa_appid_md5=" << m_pa_appid_md5
<<" and openid_md5=" << m_openid_md5;
strErrMsg = ossSql.str();
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
if(!mysql.GetAffectedRows())
{
return DB_RET_NOT_EXIST;
}
return DB_RET_OK;
}
std::string CollectInfo::ToString() const
{
std::ostringstream oss;
oss.str("");
oss << "{"
<< "feed_id = " << m_feed_id
<< ", pa_appid_md5 = " << m_pa_appid_md5
<< ", openid_md5 = " << m_openid_md5
<< ", create_ts = " << m_create_ts
<< "}";
return oss.str();
}
int CollectList::SelectFromDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
m_feed_id_list.clear();
m_create_ts_list.clear();
std::ostringstream ossSql;
ossSql.str("");
ossSql << "select * from " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5 % 256)
<<" where pa_appid_md5=" << m_pa_appid_md5
<<" and openid_md5=" << m_openid_md5;
if(m_begin_create_ts)
{
ossSql << " and create_ts < " << m_begin_create_ts;
}
ossSql << " order by create_ts desc limit " << m_limit;
strErrMsg = ossSql.str();
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
if(!mysql.GetRowCount())
{
return DB_RET_NOT_EXIST;
}
while(mysql.GetRowCount() && mysql.Next())
{
m_feed_id = strtoul(mysql.GetRow(1), NULL, 10);
m_create_ts = strtoul(mysql.GetRow(3), NULL, 10);
m_feed_id_list.push_back(m_feed_id);
m_create_ts_list.push_back(m_create_ts);
}
return DB_RET_OK;
}
std::string CollectList::ToString() const
{
std::ostringstream oss;
oss.str("");
oss << "{"
<< "openid_md5 = " << m_openid_md5
<< ", pa_appid = " << m_pa_appid_md5
<< ", (feedid, create_ts) = [ ";
for(size_t i = 0; i < m_feed_id_list.size(); i++)
{
oss << " (" << m_openid_md5
<< ", " << m_create_ts << ") ";
}
oss << "] "
<< "}";
return oss.str();
}
int FeedListCollect::SelectFromDB(const std::string& strTableNamePrefix, lce::cgi::CMysql& mysql, std::string& strErrMsg)
{
m_collect_list.clear();
std::ostringstream ossSql;
for(size_t i = 0; i < m_feed_id_list.size(); i++)
{
ossSql.str("");
ossSql << "select * from " << strTableNamePrefix
<< IntToHexStr(m_pa_appid_md5 % 256)
<< " where feed_id=" << m_feed_id_list[i]
<< " and openid_md5 = " << m_openid_md5
<< " and pa_appid_md5 = " << m_pa_appid_md5;
if(!mysql.Query(ossSql.str()))
{
strErrMsg = "mysql query error, sql=" + ossSql.str() + ", msg=" + mysql.GetErrMsg();
return DB_RET_FAIL;
}
if(!mysql.GetRowCount())
{
m_collect_list.push_back(0);
}
else
{
m_collect_list.push_back(1);
}
}
return DB_RET_OK;
}
std::string FeedListCollect::ToString() const
{
std::ostringstream oss;
oss.str("");
oss << "{"
<< " openid_md5 = " << m_openid_md5
<< ", pa_appid = " << m_pa_appid_md5;
for(size_t i = 0; i < m_feed_id_list.size(); i++)
{
oss << "(feed_id = " << m_feed_id_list[i]
<< " : " << m_collect_list[i] << ")";
}
oss << "}";
return oss.str();
}
| [
"[email protected]"
] | |
4b20db4fbca56fa82e82c01eadaff33f3808b488 | bb7a6a5eaf2ef0ebd3aa1686a904af8836ffd5d0 | /expt 8/expt 8/main.cpp | 1c10ec17032086691b2dc0682d72fe782a185316 | [] | no_license | parth-verma/OOPS-ICT | 261bec9053cad6e7b4a050e2dd9400515990c1ca | 98c71f2ffea29a01582d60521db4942976448662 | refs/heads/master | 2021-07-25T21:05:01.041166 | 2017-11-07T14:12:05 | 2017-11-07T14:12:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,815 | cpp | //
// main.cpp
// expt 8
//
// Created by Parth Verma on 01/11/17.
// Copyright © 2017 Parth Verma. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class departments {
protected:
string name,head_name;
int num_employees;
public:
virtual void get_data()=0;
virtual void put_data()=0;
};
class examination:public departments{
public:
examination(){
name = "Examination";
num_employees = 0;
head_name = "";
}
examination(int no_employee,string head_name){
name = "Examination";
num_employees = no_employee;
head_name = head_name;
}
void get_data(){
cout<<"Enter the name of head: ";
cin>>head_name;
cout<<"Enter no. of employees: ";
cin>>num_employees;
}
void put_data(){
;
}
};
class library:public departments{
public:
library(){
name = "Library";
num_employees = 0;
head_name = "";
}
library(int no_employee,string head_name){
name = "Library";
num_employees = no_employee;
head_name = head_name;
}
void get_data(){
cout<<"Enter the name of head: ";
cin>>head_name;
cout<<"Enter no. of employees: ";
cin>>num_employees;
}
void put_data(){
;
}
};
class accounts:public departments{
public:
accounts(){
name = "Accounts";
num_employees = 0;
head_name = "";
}
accounts(int no_employee,string head_name){
name = "Accounts";
num_employees = no_employee;
head_name = head_name;
}
void get_data(){
cout<<"Enter the name of head: ";
cin>>head_name;
cout<<"Enter no. of employees: ";
cin>>num_employees;
}
void put_data(){
cout<<"Department: "<<name<<endl;
cout<<"Head Name: "<<head_name<<endl;
cout<<"No. of Employees: "<<num_employees<<endl;
}
};
class university{
vector<departments*> a;
string name;
public:
university(string name){
this->name=name;
}
university(string name,departments *list,int size){
this->name=name;
for(int i=0;i<size;i++){
a.push_back((list+i));
}
}
void put_data(){
cout<<"Name: "<<name<<endl;
cout<<"Number of departments: "<<a.size()<<endl;
cout<<"Departments:\n";
for (int i=0;i<a.size();i++){
a[i]->put_data();
cout<<endl;
}
}
void add_department(){
cout<<"Choose department type:\n1)Accounts\n2)Library\n3)Examination\nEnter your choice: ";
int ch;
cin>>ch;
departments * n;
if (ch==1){
accounts *t = new accounts();
n=t;
}
else if (ch==2){
library *t = new library();
n=t;
}
else{
examination *t = new examination();
n=t;
}
n->get_data();
a.push_back(n);
}
};
int main(int argc, const char * argv[]) {
// insert code here...
cout<<"Enter name of university: ";
string * name = new string;
getline(cin, *name);
university uni(*name);
delete name;
int ch = 0;
while(ch !=3){
cout<<"\nChoose Operation:\n1) Add department\n2) Display information\n3) Exit\nEnter your choice:";
cin>>ch;
cout<<"\n\n";
switch (ch) {
case 1:
uni.add_department();
break;
case 2:
uni.put_data();
break;
case 3:
break;
default:
cout<<"\nInvalid option. Retry"<<endl;
}
}
return 0;
}
| [
"[email protected]"
] | |
d5d0387f600c58724178b422f7a503a579448512 | b28305dab0be0e03765c62b97bcd7f49a4f8073d | /content/renderer/gpu/layer_tree_view.h | 8de87e03628e47e450fb074455238dbdd4e6f257 | [
"BSD-3-Clause"
] | permissive | svarvel/browser-android-tabs | 9e5e27e0a6e302a12fe784ca06123e5ce090ced5 | bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f | refs/heads/base-72.0.3626.105 | 2020-04-24T12:16:31.442851 | 2019-08-02T19:15:36 | 2019-08-02T19:15:36 | 171,950,555 | 1 | 2 | NOASSERTION | 2019-08-02T19:15:37 | 2019-02-21T21:47:44 | null | UTF-8 | C++ | false | false | 11,187 | h | // Copyright (c) 2013 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.
#ifndef CONTENT_RENDERER_GPU_LAYER_TREE_VIEW_H_
#define CONTENT_RENDERER_GPU_LAYER_TREE_VIEW_H_
#include <stdint.h>
#include "base/callback.h"
#include "base/containers/circular_deque.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/values.h"
#include "cc/input/browser_controls_state.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_single_thread_client.h"
#include "cc/trees/swap_promise.h"
#include "cc/trees/swap_promise_monitor.h"
#include "content/common/content_export.h"
#include "third_party/blink/public/platform/web_layer_tree_view.h"
#include "ui/gfx/geometry/rect.h"
class GURL;
namespace blink {
namespace scheduler {
class WebThreadScheduler;
}
} // namespace blink
namespace cc {
class AnimationHost;
class InputHandler;
class Layer;
class LayerTreeFrameSink;
class LayerTreeHost;
class LayerTreeSettings;
class RenderFrameMetadataObserver;
class TaskGraphRunner;
class UkmRecorderFactory;
class ScopedDeferMainFrameUpdate;
} // namespace cc
namespace gfx {
class ColorSpace;
class Size;
}
namespace ui {
class LatencyInfo;
}
namespace content {
class LayerTreeViewDelegate;
class CONTENT_EXPORT LayerTreeView
: public blink::WebLayerTreeView,
public cc::LayerTreeHostClient,
public cc::LayerTreeHostSingleThreadClient {
public:
// The |main_thread| is the task runner that the compositor will use for the
// main thread (where it is constructed). The |compositor_thread| is the task
// runner for the compositor thread, but is null if the compositor will run in
// single-threaded mode (in tests only).
LayerTreeView(LayerTreeViewDelegate* delegate,
scoped_refptr<base::SingleThreadTaskRunner> main_thread,
scoped_refptr<base::SingleThreadTaskRunner> compositor_thread,
cc::TaskGraphRunner* task_graph_runner,
blink::scheduler::WebThreadScheduler* scheduler);
~LayerTreeView() override;
// The |ukm_recorder_factory| may be null to disable recording (in tests
// only).
void Initialize(const cc::LayerTreeSettings& settings,
std::unique_ptr<cc::UkmRecorderFactory> ukm_recorder_factory);
void SetNeverVisible();
void SetVisible(bool visible);
const base::WeakPtr<cc::InputHandler>& GetInputHandler();
void SetNeedsDisplayOnAllLayers();
void SetRasterizeOnlyVisibleContent();
void SetNeedsRedrawRect(gfx::Rect damage_rect);
bool IsSurfaceSynchronizationEnabled() const;
// Like setNeedsRedraw but forces the frame to be drawn, without early-outs.
// Redraw will be forced after the next commit
void SetNeedsForcedRedraw();
// Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped
// LatencyInfoSwapPromiseMonitor. During the life time of the
// LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or
// SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency
// info will be turned into a LatencyInfoSwapPromise.
std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
ui::LatencyInfo* latency);
// Calling QueueSwapPromise() to directly queue a SwapPromise into
// LayerTreeHost.
void QueueSwapPromise(std::unique_ptr<cc::SwapPromise> swap_promise);
int GetSourceFrameNumber() const;
void NotifyInputThrottledUntilCommit();
const cc::Layer* GetRootLayer() const;
int ScheduleMicroBenchmark(
const std::string& name,
std::unique_ptr<base::Value> value,
base::OnceCallback<void(std::unique_ptr<base::Value>)> callback);
bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value);
void SetFrameSinkId(const viz::FrameSinkId& frame_sink_id);
void SetRasterColorSpace(const gfx::ColorSpace& color_space);
void SetExternalPageScaleFactor(float page_scale_factor);
void ClearCachesOnNextCommit();
void SetContentSourceId(uint32_t source_id);
void SetViewportSizeAndScale(
const gfx::Size& device_viewport_size,
float device_scale_factor,
const viz::LocalSurfaceIdAllocation& local_surface_id_allocation);
void RequestNewLocalSurfaceId();
void RequestForceSendMetadata();
void SetViewportVisibleRect(const gfx::Rect& visible_rect);
void SetURLForUkm(const GURL& url);
// Call this if the compositor is becoming non-visible in a way that it won't
// be used any longer. In this case, becoming visible is longer but this
// releases more resources (such as its use of the GpuChannel).
// TODO(crbug.com/419087): This is to support a swapped out RenderWidget which
// should just be destroyed instead.
void ReleaseLayerTreeFrameSink();
// blink::WebLayerTreeView implementation.
viz::FrameSinkId GetFrameSinkId() override;
void SetRootLayer(scoped_refptr<cc::Layer> layer) override;
void ClearRootLayer() override;
cc::AnimationHost* CompositorAnimationHost() override;
gfx::Size GetViewportSize() const override;
void SetBackgroundColor(SkColor color) override;
void SetPageScaleFactorAndLimits(float page_scale_factor,
float minimum,
float maximum) override;
void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
bool use_anchor,
float new_page_scale,
double duration_sec) override;
bool HasPendingPageScaleAnimation() const override;
void HeuristicsForGpuRasterizationUpdated(bool matches_heuristics) override;
void SetNeedsBeginFrame() override;
void LayoutAndPaintAsync(base::OnceClosure callback) override;
void CompositeAndReadbackAsync(
base::OnceCallback<void(const SkBitmap&)> callback) override;
// Synchronously performs the complete set of document lifecycle phases,
// including updates to the compositor state, optionally including
// rasterization.
void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) override;
std::unique_ptr<cc::ScopedDeferMainFrameUpdate> DeferMainFrameUpdate()
override;
void RegisterViewportLayers(const ViewportLayers& viewport_layers) override;
void ClearViewportLayers() override;
void RegisterSelection(const cc::LayerSelection& selection) override;
void ClearSelection() override;
void SetMutatorClient(std::unique_ptr<cc::LayerTreeMutator>) override;
void ForceRecalculateRasterScales() override;
void SetEventListenerProperties(
cc::EventListenerClass eventClass,
cc::EventListenerProperties properties) override;
cc::EventListenerProperties EventListenerProperties(
cc::EventListenerClass eventClass) const override;
void SetHaveScrollEventHandlers(bool) override;
bool HaveScrollEventHandlers() const override;
int LayerTreeId() const override;
void SetShowFPSCounter(bool show) override;
void SetShowPaintRects(bool show) override;
void SetShowDebugBorders(bool show) override;
void SetShowScrollBottleneckRects(bool show) override;
void SetShowHitTestBorders(bool show) override;
void NotifySwapTime(ReportTimeCallback callback) override;
void UpdateBrowserControlsState(cc::BrowserControlsState constraints,
cc::BrowserControlsState current,
bool animate) override;
void SetBrowserControlsHeight(float top_height,
float bottom_height,
bool shrink) override;
void SetBrowserControlsShownRatio(float) override;
void RequestDecode(const cc::PaintImage& image,
base::OnceCallback<void(bool)> callback) override;
void RequestPresentationCallback(base::OnceClosure callback) override;
void SetOverscrollBehavior(const cc::OverscrollBehavior&) override;
// cc::LayerTreeHostClient implementation.
void WillBeginMainFrame() override;
void DidBeginMainFrame() override;
void BeginMainFrame(const viz::BeginFrameArgs& args) override;
void BeginMainFrameNotExpectedSoon() override;
void BeginMainFrameNotExpectedUntil(base::TimeTicks time) override;
void UpdateLayerTreeHost(bool record_main_frame_metrics) override;
void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) override;
void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel,
bool has_scrolled_by_touch) override;
void RequestNewLayerTreeFrameSink() override;
void DidInitializeLayerTreeFrameSink() override;
void DidFailToInitializeLayerTreeFrameSink() override;
void WillCommit() override;
void DidCommit() override;
void DidCommitAndDrawFrame() override;
void DidReceiveCompositorFrameAck() override {}
void DidCompletePageScaleAnimation() override;
void DidPresentCompositorFrame(
uint32_t frame_token,
const gfx::PresentationFeedback& feedback) override;
void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override;
// cc::LayerTreeHostSingleThreadClient implementation.
void RequestScheduleAnimation() override;
void DidSubmitCompositorFrame() override;
void DidLoseLayerTreeFrameSink() override;
void RequestBeginMainFrameNotExpected(bool new_state) override;
const cc::LayerTreeSettings& GetLayerTreeSettings() const;
// Sets the RenderFrameMetadataObserver, which is sent to the compositor
// thread for binding.
void SetRenderFrameObserver(
std::unique_ptr<cc::RenderFrameMetadataObserver> observer);
void AddPresentationCallback(
uint32_t frame_token,
base::OnceCallback<void(base::TimeTicks)> callback);
cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); }
protected:
friend class RenderViewImplScaleFactorTest;
private:
void SetLayerTreeFrameSink(
std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink);
void InvokeLayoutAndPaintCallback();
bool CompositeIsSynchronous() const;
void SynchronouslyComposite(bool raster,
std::unique_ptr<cc::SwapPromise> swap_promise);
LayerTreeViewDelegate* const delegate_;
const scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
const scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_;
cc::TaskGraphRunner* const task_graph_runner_;
blink::scheduler::WebThreadScheduler* const web_main_thread_scheduler_;
const std::unique_ptr<cc::AnimationHost> animation_host_;
std::unique_ptr<cc::LayerTreeHost> layer_tree_host_;
bool never_visible_ = false;
bool layer_tree_frame_sink_request_failed_while_invisible_ = false;
bool in_synchronous_compositor_update_ = false;
base::OnceClosure layout_and_paint_async_callback_;
viz::FrameSinkId frame_sink_id_;
base::circular_deque<
std::pair<uint32_t,
std::vector<base::OnceCallback<void(base::TimeTicks)>>>>
presentation_callbacks_;
base::WeakPtrFactory<LayerTreeView> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(LayerTreeView);
};
} // namespace content
#endif // CONTENT_RENDERER_GPU_LAYER_TREE_VIEW_H_
| [
"[email protected]"
] | |
886a4aaae5be4d36994e254c92ff5a1338616908 | e5a37a543ca382ed3eaab28c37d267b04ad667c0 | /probrems/AOJ1005.cpp | 0769d26fee0ab3b9dd656e1ad944d034a0aba7e8 | [] | no_license | akawashiro/competitiveProgramming | 6dfbe626c2e2433d5e702e9431ee9de2c41337ed | ee8a582c80dbd5716ae900a02e8ea67ff8daae4b | refs/heads/master | 2018-09-02T19:49:22.460865 | 2018-06-30T05:45:51 | 2018-06-30T05:45:51 | 71,694,415 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 810 | cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int cl[100][100];
int l[100][100];
int r[100][100];
int main(){
int n;
while(1){
scanf("%d",&n);
if(!n)
break;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
scanf("%d",&cl[i][j]);
memset(l,0,sizeof(l));
memset(r,0,sizeof(r));
for(int i=0;i<n;i++){
int m=100000000;
for(int j=0;j<n;j++)
m=min(m,cl[i][j]);
for(int j=0;j<n;j++)
if(cl[i][j]==m)
l[i][j]=1;
}
for(int i=0;i<n;i++){
int m=-1;
for(int j=0;j<n;j++)
m=max(m,cl[j][i]);
for(int j=0;j<n;j++)
if(cl[j][i]==m)
r[j][i]=1;
}
int b=0;
for(int i=0;i<n&&!b;i++)
for(int j=0;j<n&&!b;j++)
if(r[i][j]&&l[i][j]){
printf("%d\n",cl[i][j]);
b=1;
}
if(!b)
printf("0\n");
}
return 0;
}
| [
"[email protected]"
] | |
3cdb9e6798fc556ead999ea5ecc42cf0a1989a2f | c2c39ac977a177872cac74159fdb5ef442871bd7 | /db/dberror.h | a03d6c393caf3d37111ccecb423c60a44037ec47 | [] | no_license | ArmanHunanyan/aimcore | 1b99ea08785f574053d21ca32836af08e44077ad | b9e567d8e6caaddada38d0df09926930056f568c | refs/heads/master | 2023-04-01T19:37:49.230620 | 2021-04-13T18:52:26 | 2021-04-13T18:52:26 | 357,658,058 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 189 | h | #ifndef DB_ERROR_H
#define DB_ERROR_H
namespace db {
class Error
: public std::runtime_error
{
using std::runtime_error::runtime_error;
};
} // namespace db
#endif // DB_ERROR_H | [
"[email protected]"
] | |
4fcc2fb9ec8af543869f5137df0886aa741036a2 | bb8a2e03a863dfdf42912becac2dc61dafda44bd | /something about C++/thread2_2.cpp | d57077ba689e8f7126e8e16fcb3568cd429719bb | [
"MIT"
] | permissive | aspineon/Algorithms-in-Java-Swift-CPP | ce58058bc6a6735c2c4b1b7f78081e8c46f94ef8 | da3e776db08c386cc6b593e8a6f9c28519fa6181 | refs/heads/master | 2021-06-12T07:40:58.725251 | 2017-03-08T05:50:19 | 2017-03-08T05:50:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,666 | cpp | //
// thread2_2.cpp
//
//
// Created by 诸葛俊伟 on 1/19/16.
//
//
//Write a multi threaded C code with one thread printing all even numbers and the other all odd numbers. The output should always be in sequence
//ie. 0,1,2,3,4....etc
#include <stdio.h>
#include "stdafx.h"
#include <iostream>
#include <thread>
#include <Windows.h>
#include <WinBase.h>
using namespace std;
static int i=0;
CRITICAL_SECTION CritSection;
CONDITION_VARIABLE ConditionVarodd;
CONDITION_VARIABLE ConditionVareven;
void printodd()
{
while (i<;150)
{
EnterCriticalSection(&CritSection);
if(i%2 == 0)
{
SleepConditionVariableCS(&ConditionVarodd, &CritSection, INFINITE);
}
printf("\n odd %d",i);
i++;
LeaveCriticalSection(&CritSection);
WakeConditionVariable(&ConditionVareven);
}
}
void printeven()
{
while(i<;150)
{
EnterCriticalSection(&CritSection);
if(i%2 == 1)
{
SleepConditionVariableCS(&ConditionVareven, &CritSection, INFINITE);
}
printf("\n even %d",i);
i++;
LeaveCriticalSection(&CritSection);
WakeConditionVariable(&ConditionVarodd);
}
}
int main()
{
InitializeCriticalSection(&CritSection);
InitializeConditionVariable(&ConditionVarodd);
InitializeConditionVariable(&ConditionVareven);
thread t1(printodd);
thread t2(printeven);
t1.join();
t2.join();
DeleteCriticalSection(&CritSection);
WakeAllConditionVariable(&ConditionVarodd);
WakeAllConditionVariable(&ConditionVareven);
return 0;
} | [
"[email protected]"
] | |
6c64ae702aa0905f7bff95fcf0b28b73a13c627c | f25be073fafeec04c76b997a68be506d1ec03717 | /choosereaction.cpp | 05400375c033ceb00c7ad28b7714704b90ab3fa5 | [] | no_license | phthalimid/Xmarcus | 328ba477a770dfed0abf8d08e6816c71648c27fa | d573088b9656a06b74a28deb706477158f0c0ff4 | refs/heads/master | 2023-01-11T02:04:16.118846 | 2020-10-25T05:22:57 | 2020-10-25T05:22:57 | 307,029,528 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,233 | cpp | #include "choosereaction.h"
#include "ui_choosereaction.h"
ChooseReaction::ChooseReaction(QWidget *parent) :
QDialog(parent),
ui(new Ui::ChooseReaction) {
ui->setupUi(this);
ui->label->setStyleSheet("QLabel{color : red;}");
QObject::connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this, SLOT(chooseType(int)));
model = new QStringListModel();
chooseType(ui->comboBox_type->currentIndex());
}
ChooseReaction::~ChooseReaction()
{
delete ui;
}
int ChooseReaction::getType(void) {
switch(ui->comboBox_type->currentIndex()) {
case 0:
return RCTFLAG_E;
case 1:
return RCTFLAG_C;
case 2:
return RCTFLAG_C2;
case 3:
return RCTFLAG_CD;
case 4:
return RCTFLAG_CC;
default:
return -1;
}
}
QString ChooseReaction::getStrReaction(void) {
QString strReaction;
switch(ui->comboBox_type->currentIndex()) {
case 0:
strReaction = ui->comboBox_A->currentText() + " + e ⇄ " + ui->comboBox_C->currentText();
break;
case 1:
strReaction = ui->comboBox_B->currentText() + " ⇄ " + ui->comboBox_C->currentText();
break;
case 2:
strReaction = ui->comboBox_A->currentText() + " + " + ui->comboBox_B->currentText() + " ⇄ " + ui->comboBox_C->currentText() + " + " + ui->comboBox_D->currentText();
break;
case 3:
strReaction = ui->comboBox_B->currentText() + " ⇄ " + ui->comboBox_C->currentText() + " + " + ui->comboBox_D->currentText();
break;
case 4:
strReaction = ui->comboBox_A->currentText() + " + " + ui->comboBox_B->currentText() + " ⇄ " + ui->comboBox_C->currentText();
break;
default:
strReaction = "Error!";
}
return strReaction;
}
/*
* Shows and hides the choices for different reaction types.
*/
void ChooseReaction::chooseType(int idx) {
ui->comboBox_A->setModel(model);
ui->comboBox_B->setModel(model);
ui->comboBox_C->setModel(model);
ui->comboBox_D->setModel(model);
switch(idx) {
case 0:
ui->comboBox_A->show(); ui->label_p1->show(); ui->label_electron->show(); ui->comboBox_C->show();
ui->comboBox_B->hide(); ui->label_p2->hide(); ui->comboBox_D->hide();
break;
case 1:
ui->comboBox_B->show(); ui->comboBox_C->show();
ui->comboBox_A->hide(); ui->label_p1->hide(); ui->label_electron->hide(); ui->label_p2->hide(); ui->comboBox_D->hide();
break;
case 2:
ui->comboBox_A->show(); ui->label_p1->show(); ui->comboBox_B->show(); ui->comboBox_C->show(); ui->label_p2->show(); ui->comboBox_D->show();
ui->label_electron->hide();
break;
case 3:
ui->comboBox_B->show(); ui->comboBox_C->show(); ui->label_p2->show(); ui->comboBox_D->show();
ui->comboBox_A->hide(); ui->label_p1->hide(); ui->label_electron->hide();
break;
case 4:
ui->comboBox_A->show(); ui->label_p1->show(); ui->comboBox_B->show(); ui->comboBox_C->show();
ui->label_electron->hide(); ui->label_p2->hide(); ui->comboBox_D->hide();
break;
default:
std::cout << "This should never happen!\n";
}
// qDebug() << "index = " << idx;
}
| [
"[email protected]"
] | |
df0003a7a19ea7c4e96d6127073392452d8e4736 | 7ab8c9a56051e8f7eded0e843c18ec2fa858d476 | /new/src/drobot/device/vestibular/channel/vestibularmagneticfieldchannel.h | c4e23712fe18a1de56da402ed98b3dc8483aca03 | [] | no_license | imanoid/drobot | ee031d0464e01d59604fabb2112dba01805b2722 | e8822555714f45fe5f8288320ccc8bea6f5c5b33 | refs/heads/master | 2020-04-09T07:34:56.942403 | 2013-12-02T13:37:57 | 2013-12-02T13:37:57 | 10,108,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 933 | h | #ifndef DROBOT_DEVICE_VESTIBULAR_CHANNEL_VESTIBULARMAGNETICFIELDCHANNEL_H
#define DROBOT_DEVICE_VESTIBULAR_CHANNEL_VESTIBULARMAGNETICFIELDCHANNEL_H
#include "../../channel/channel.h"
#include "../../device.h"
namespace drobot {
namespace device {
namespace vestibular {
namespace channel {
class VestibularMagneticFieldChannel : public device::channel::Channel
{
private:
int _dimension;
protected:
virtual void setValue(double value);
virtual double getValue();
public:
VestibularMagneticFieldChannel(std::string name, device::channel::ChannelType type, int dimension);
VestibularMagneticFieldChannel(std::string name, device::channel::ChannelType type, int dimension, device::channel::Normalizer* normalizer, device::Device* device);
};
} // namespace channel
} // namespace vestibular
} // namespace device
} // namespace drobot
#endif // DROBOT_DEVICE_VESTIBULAR_CHANNEL_VESTIBULARMAGNETICFIELDCHANNEL_H
| [
"[email protected]"
] | |
c1fbf88df28689ff2c5ffa7b83d79ca92af16aef | ad69e717bf4dab637482b52e1241cab076e4b422 | /designs/rtl/sigma_tile/hw/riscv/coregen/riscv_6stage/vivado_cpp/riscv_6stage.cpp | 870c7d4d2fb7afd449a29cd5a1587f7282284b4f | [] | no_license | VladislavProzhirko/activecore_cpu_log | 8303936a7a11fc90ed705dd6eb5605366a83d538 | 0d3d16cfa76a2d1f5b300e63afaeb6d5bf2bd601 | refs/heads/master | 2023-02-11T09:00:09.012813 | 2021-01-02T11:51:53 | 2021-01-02T11:51:53 | 325,613,251 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142,735 | cpp | // ===========================================================
// HLS sources generated by ActiveCore framework
// Date: 2020-10-25
// Copyright Alexander Antonov <[email protected]>
// ===========================================================
#include "riscv_6stage.hpp"
#include <ap_int.h>
#include <hls_stream.h>
ap_uint<32> genpsticky_glbl_pc;
ap_uint<32> genpsticky_glbl_regfile [32];
ap_uint<1> genpsticky_glbl_jump_req_cmd;
ap_uint<32> genpsticky_glbl_jump_vector_cmd;
ap_uint<8> genpsticky_glbl_CSR_MCAUSE;
ap_uint<1> genpsticky_glbl_MIRQEN;
ap_uint<32> genpsticky_glbl_MRETADDR;
ap_uint<1> genmcopipe_instr_mem_wr_done;
ap_uint<1> genmcopipe_instr_mem_rd_done;
ap_uint<1> genmcopipe_instr_mem_full_flag;
ap_uint<1> genmcopipe_instr_mem_empty_flag;
ap_uint<1> genmcopipe_instr_mem_wr_ptr;
ap_uint<1> genmcopipe_instr_mem_rd_ptr;
ap_uint<1> genmcopipe_data_mem_wr_done;
ap_uint<1> genmcopipe_data_mem_rd_done;
ap_uint<1> genmcopipe_data_mem_full_flag;
ap_uint<1> genmcopipe_data_mem_empty_flag;
ap_uint<1> genmcopipe_data_mem_wr_ptr;
ap_uint<1> genmcopipe_data_mem_rd_ptr;
ap_uint<1> genpstage_IADDR_genpctrl_active_glbl;
ap_uint<1> genpstage_IADDR_genpctrl_stalled_glbl;
ap_uint<1> genpstage_IADDR_genpctrl_killed_glbl;
ap_uint<1> genpstage_IFETCH_genpctrl_active_glbl;
ap_uint<1> genpstage_IFETCH_genpctrl_stalled_glbl;
ap_uint<1> genpstage_IFETCH_genpctrl_killed_glbl;
ap_uint<1> genpstage_IDECODE_genpctrl_active_glbl;
ap_uint<1> genpstage_IDECODE_genpctrl_stalled_glbl;
ap_uint<1> genpstage_IDECODE_genpctrl_killed_glbl;
ap_uint<1> genpstage_EXEC_genpctrl_active_glbl;
ap_uint<1> genpstage_EXEC_genpctrl_stalled_glbl;
ap_uint<1> genpstage_EXEC_genpctrl_killed_glbl;
ap_uint<1> genpstage_MEM_genpctrl_active_glbl;
ap_uint<1> genpstage_MEM_genpctrl_stalled_glbl;
ap_uint<1> genpstage_MEM_genpctrl_killed_glbl;
ap_uint<1> genpstage_WB_genpctrl_active_glbl;
ap_uint<1> genpstage_WB_genpctrl_stalled_glbl;
ap_uint<1> genpstage_WB_genpctrl_killed_glbl;
ap_uint<1> genpstage_IFETCH_instr_req_done;
ap_uint<1> genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id;
ap_uint<1> genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
ap_uint<1> genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid;
ap_uint<1> genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done;
ap_uint<32> genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdata;
ap_uint<32> genpstage_IFETCH_curinstr_addr_genglbl;
ap_uint<32> genpstage_IFETCH_nextinstr_addr_genglbl;
ap_uint<32> genpstage_IDECODE_rs1_rdata;
ap_uint<32> genpstage_IDECODE_rs2_rdata;
ap_uint<1> genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_if_id;
ap_uint<1> genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
ap_uint<1> genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_tid;
ap_uint<1> genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done;
ap_uint<32> genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdata;
ap_uint<32> genpstage_IDECODE_curinstr_addr_genglbl;
ap_uint<32> genpstage_IDECODE_nextinstr_addr_genglbl;
ap_uint<8> genpstage_EXEC_irq_mcause;
ap_uint<1> genpstage_EXEC_irq_recv;
ap_uint<32> genpstage_EXEC_rs2_rdata;
ap_uint<1> genpstage_EXEC_rd_req_genglbl;
ap_uint<5> genpstage_EXEC_rd_addr_genglbl;
ap_uint<32> genpstage_EXEC_curinstr_addr_genglbl;
ap_uint<1> genpstage_EXEC_mret_req_genglbl;
ap_uint<33> genpstage_EXEC_alu_op1_wide_genglbl;
ap_uint<1> genpstage_EXEC_alu_req_genglbl;
ap_uint<4> genpstage_EXEC_alu_opcode_genglbl;
ap_uint<33> genpstage_EXEC_alu_op2_wide_genglbl;
ap_uint<32> genpstage_EXEC_alu_op1_genglbl;
ap_uint<32> genpstage_EXEC_alu_op2_genglbl;
ap_uint<1> genpstage_EXEC_alu_unsigned_genglbl;
ap_uint<3> genpstage_EXEC_rd_source_genglbl;
ap_uint<32> genpstage_EXEC_immediate_genglbl;
ap_uint<32> genpstage_EXEC_nextinstr_addr_genglbl;
ap_uint<32> genpstage_EXEC_csr_rdata_genglbl;
ap_uint<1> genpstage_EXEC_jump_src_genglbl;
ap_uint<1> genpstage_EXEC_jump_req_cond_genglbl;
ap_uint<3> genpstage_EXEC_funct3_genglbl;
ap_uint<1> genpstage_EXEC_jump_req_genglbl;
ap_uint<1> genpstage_EXEC_mem_req_genglbl;
ap_uint<1> genpstage_EXEC_mem_cmd_genglbl;
ap_uint<1> genpstage_MEM_data_req_done;
ap_uint<1> genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id;
ap_uint<1> genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending;
ap_uint<1> genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid;
ap_uint<1> genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done;
ap_uint<32> genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdata;
ap_uint<32> genpstage_MEM_rs2_rdata;
ap_uint<1> genpstage_MEM_rd_req_genglbl;
ap_uint<5> genpstage_MEM_rd_addr_genglbl;
ap_uint<1> genpstage_MEM_rd_rdy_genglbl;
ap_uint<32> genpstage_MEM_rd_wdata_genglbl;
ap_uint<32> genpstage_MEM_curinstr_addr_genglbl;
ap_uint<32> genpstage_MEM_immediate_genglbl;
ap_uint<1> genpstage_MEM_jump_src_genglbl;
ap_uint<32> genpstage_MEM_alu_result_genglbl;
ap_uint<1> genpstage_MEM_jump_req_cond_genglbl;
ap_uint<3> genpstage_MEM_funct3_genglbl;
ap_uint<1> genpstage_MEM_alu_ZF_genglbl;
ap_uint<1> genpstage_MEM_alu_CF_genglbl;
ap_uint<1> genpstage_MEM_jump_req_genglbl;
ap_uint<1> genpstage_MEM_mem_req_genglbl;
ap_uint<1> genpstage_MEM_mem_cmd_genglbl;
ap_uint<3> genpstage_MEM_rd_source_genglbl;
ap_uint<1> genpstage_WB_genmcopipe_handle_data_mem_genvar_if_id;
ap_uint<1> genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending;
ap_uint<1> genpstage_WB_genmcopipe_handle_data_mem_genvar_tid;
ap_uint<1> genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done;
ap_uint<32> genpstage_WB_genmcopipe_handle_data_mem_genvar_rdata;
ap_uint<1> genpstage_WB_rd_req_genglbl;
ap_uint<5> genpstage_WB_rd_addr_genglbl;
ap_uint<1> genpstage_WB_rd_rdy_genglbl;
ap_uint<32> genpstage_WB_rd_wdata_genglbl;
ap_uint<1> genpstage_WB_mem_req_genglbl;
ap_uint<1> genpstage_WB_mem_cmd_genglbl;
ap_uint<3> genpstage_WB_rd_source_genglbl;
void riscv_6stage(ap_uint<1> geninit, hls::stream<ap_uint<8> >& irq_fifo, hls::stream<ap_uint<32> >& genmcopipe_instr_mem_resp, hls::stream<ap_uint<32> >& genmcopipe_data_mem_resp, hls::stream<genpmodule_riscv_6stage_genmcopipe_instr_mem_genstruct_fifo_wdata>& genmcopipe_instr_mem_req, hls::stream<genpmodule_riscv_6stage_genmcopipe_data_mem_genstruct_fifo_wdata>& genmcopipe_data_mem_req) {
ap_uint<32> genpsticky_glbl_pc_buf;
ap_uint<32> genpsticky_glbl_regfile_buf [32];
ap_uint<1> genpsticky_glbl_jump_req_cmd_buf;
ap_uint<32> genpsticky_glbl_jump_vector_cmd_buf;
ap_uint<8> genpsticky_glbl_CSR_MCAUSE_buf;
ap_uint<1> genpsticky_glbl_MIRQEN_buf;
ap_uint<32> genpsticky_glbl_MRETADDR_buf;
ap_uint<1> genmcopipe_instr_mem_wr_ptr_next;
ap_uint<1> genmcopipe_instr_mem_rd_ptr_next;
ap_uint<1> genmcopipe_data_mem_wr_ptr_next;
ap_uint<1> genmcopipe_data_mem_rd_ptr_next;
ap_uint<1> genpstage_IADDR_genpctrl_new;
ap_uint<1> genpstage_IADDR_genpctrl_working;
ap_uint<1> genpstage_IADDR_genpctrl_succ;
ap_uint<1> genpstage_IADDR_genpctrl_occupied;
ap_uint<1> genpstage_IADDR_genpctrl_finish;
ap_uint<1> genpstage_IADDR_genpctrl_flushreq;
ap_uint<1> genpstage_IADDR_genpctrl_nevictable;
ap_uint<1> genpstage_IADDR_genpctrl_rdy;
ap_uint<1> gen222_pipex_syncreq;
ap_uint<1> gen223_pipex_syncbuf;
ap_uint<1> gen224_pipex_syncreq;
ap_uint<32> gen225_pipex_syncbuf;
ap_uint<1> genpstage_IFETCH_genpctrl_new;
ap_uint<1> genpstage_IFETCH_genpctrl_working;
ap_uint<1> genpstage_IFETCH_genpctrl_succ;
ap_uint<1> genpstage_IFETCH_genpctrl_occupied;
ap_uint<1> genpstage_IFETCH_genpctrl_finish;
ap_uint<1> genpstage_IFETCH_genpctrl_flushreq;
ap_uint<1> genpstage_IFETCH_genpctrl_nevictable;
ap_uint<1> genpstage_IFETCH_genpctrl_rdy;
ap_uint<1> genpstage_IDECODE_genpctrl_new;
ap_uint<1> genpstage_IDECODE_genpctrl_working;
ap_uint<1> genpstage_IDECODE_genpctrl_succ;
ap_uint<1> genpstage_IDECODE_genpctrl_occupied;
ap_uint<1> genpstage_IDECODE_genpctrl_finish;
ap_uint<1> genpstage_IDECODE_genpctrl_flushreq;
ap_uint<1> genpstage_IDECODE_genpctrl_nevictable;
ap_uint<1> genpstage_IDECODE_genpctrl_rdy;
ap_uint<1> genpstage_EXEC_genpctrl_new;
ap_uint<1> genpstage_EXEC_genpctrl_working;
ap_uint<1> genpstage_EXEC_genpctrl_succ;
ap_uint<1> genpstage_EXEC_genpctrl_occupied;
ap_uint<1> genpstage_EXEC_genpctrl_finish;
ap_uint<1> genpstage_EXEC_genpctrl_flushreq;
ap_uint<1> genpstage_EXEC_genpctrl_nevictable;
ap_uint<1> genpstage_EXEC_genpctrl_rdy;
ap_uint<1> genpstage_MEM_genpctrl_new;
ap_uint<1> genpstage_MEM_genpctrl_working;
ap_uint<1> genpstage_MEM_genpctrl_succ;
ap_uint<1> genpstage_MEM_genpctrl_occupied;
ap_uint<1> genpstage_MEM_genpctrl_finish;
ap_uint<1> genpstage_MEM_genpctrl_flushreq;
ap_uint<1> genpstage_MEM_genpctrl_nevictable;
ap_uint<1> genpstage_MEM_genpctrl_rdy;
ap_uint<1> gen226_pipex_syncreq;
ap_uint<1> gen227_pipex_syncbuf;
ap_uint<1> gen228_pipex_syncreq;
ap_uint<32> gen229_pipex_syncbuf;
ap_uint<1> genpstage_WB_genpctrl_new;
ap_uint<1> genpstage_WB_genpctrl_working;
ap_uint<1> genpstage_WB_genpctrl_succ;
ap_uint<1> genpstage_WB_genpctrl_occupied;
ap_uint<1> genpstage_WB_genpctrl_finish;
ap_uint<1> genpstage_WB_genpctrl_flushreq;
ap_uint<1> genpstage_WB_genpctrl_nevictable;
ap_uint<1> genpstage_WB_genpctrl_rdy;
ap_uint<1> gen230_pipex_syncreq;
ap_uint<32> gen231_pipex_syncbuf [32];
ap_uint<1> gen232_pipex_var;
ap_uint<33> gen233_pipex_var;
ap_uint<1> gen234_pipex_var;
ap_uint<1> gen235_pipex_var;
ap_uint<1> gen236_pipex_var;
ap_uint<1> gen237_pipex_var;
ap_uint<1> gen238_pipex_var;
ap_uint<1> gen239_pipex_var;
ap_uint<1> gen240_pipex_var;
ap_uint<1> gen241_pipex_var;
ap_uint<7> gen242_pipex_var;
ap_uint<20> gen243_pipex_var;
ap_uint<25> gen244_pipex_var;
ap_uint<12> gen245_pipex_var;
ap_uint<15> gen246_pipex_var;
ap_uint<32> gen247_pipex_var;
ap_uint<25> gen248_pipex_var;
ap_uint<28> gen249_pipex_var;
ap_uint<24> gen250_pipex_var;
ap_uint<32> gen251_pipex_var;
ap_uint<20> gen252_pipex_var;
ap_uint<32> gen253_pipex_var;
ap_uint<1> gen254_pipex_var;
ap_uint<32> gen255_pipex_var;
ap_uint<32> gen256_pipex_var;
ap_uint<12> gen257_pipex_var;
ap_uint<12> gen258_pipex_var;
ap_uint<1> gen259_pipex_var;
ap_uint<32> gen260_pipex_var;
ap_uint<1> gen261_pipex_var;
ap_uint<1> gen262_pipex_var;
ap_uint<31> gen263_pipex_var;
ap_uint<12> gen264_pipex_var;
ap_uint<13> gen265_pipex_var;
ap_uint<1> gen266_pipex_var;
ap_uint<32> gen267_pipex_var;
ap_uint<32> gen268_pipex_var;
ap_uint<32> gen269_pipex_var;
ap_uint<1> gen270_pipex_var;
ap_uint<20> gen271_pipex_var;
ap_uint<1> gen272_pipex_var;
ap_uint<31> gen273_pipex_var;
ap_uint<21> gen274_pipex_var;
ap_uint<1> gen275_pipex_var;
ap_uint<32> gen276_pipex_var;
ap_uint<1> gen277_pipex_var;
ap_uint<1> gen278_pipex_var;
ap_uint<1> gen279_pipex_var;
ap_uint<1> gen280_pipex_var;
ap_uint<25> gen281_pipex_var;
ap_uint<32> gen282_pipex_var;
ap_uint<1> gen283_pipex_var;
ap_uint<1> gen284_pipex_var;
ap_uint<1> gen285_pipex_var;
ap_uint<25> gen286_pipex_var;
ap_uint<32> gen287_pipex_var;
ap_uint<1> gen288_pipex_var;
ap_uint<1> gen289_pipex_var;
ap_uint<1> gen290_pipex_var;
ap_uint<1> gen291_pipex_var;
ap_uint<1> gen292_pipex_var;
ap_uint<1> gen293_pipex_var;
ap_uint<1> gen294_pipex_var;
ap_uint<1> gen295_pipex_var;
ap_uint<1> gen296_pipex_var;
ap_uint<32> gen297_pipex_var;
ap_uint<32> gen298_pipex_var;
ap_uint<32> gen299_pipex_var;
ap_uint<1> gen300_pipex_var;
ap_uint<1> gen301_pipex_var;
ap_uint<1> gen302_pipex_var;
ap_uint<1> gen303_pipex_var;
ap_uint<1> gen304_pipex_var;
ap_uint<32> gen305_pipex_var [32];
ap_uint<32> gen306_pipex_var;
ap_uint<32> gen307_pipex_var [32];
ap_uint<32> gen308_pipex_var;
ap_uint<1> gen309_pipex_var;
ap_uint<1> gen310_pipex_var;
ap_uint<1> gen311_pipex_var;
ap_uint<1> gen312_pipex_var;
ap_uint<1> gen313_pipex_var;
ap_uint<1> gen314_pipex_var;
ap_uint<1> gen315_pipex_var;
ap_uint<1> gen316_pipex_var;
ap_uint<1> gen317_pipex_var;
ap_uint<1> gen318_pipex_var;
ap_uint<5> gen319_pipex_var;
ap_uint<1> gen320_pipex_var;
ap_uint<1> gen321_pipex_var;
ap_uint<1> gen322_pipex_var;
ap_uint<1> gen323_pipex_var;
ap_uint<32> gen324_pipex_var;
ap_uint<1> gen325_pipex_var;
ap_uint<1> gen326_pipex_var;
ap_uint<5> gen327_pipex_var;
ap_uint<1> gen328_pipex_var;
ap_uint<1> gen329_pipex_var;
ap_uint<1> gen330_pipex_var;
ap_uint<1> gen331_pipex_var;
ap_uint<32> gen332_pipex_var;
ap_uint<1> gen333_pipex_var;
ap_uint<1> gen334_pipex_var;
ap_uint<1> gen335_pipex_var;
ap_uint<1> gen336_pipex_var;
ap_uint<1> gen337_pipex_var;
ap_uint<1> gen338_pipex_var;
ap_uint<5> gen339_pipex_var;
ap_uint<1> gen340_pipex_var;
ap_uint<1> gen341_pipex_var;
ap_uint<1> gen342_pipex_var;
ap_uint<1> gen343_pipex_var;
ap_uint<32> gen344_pipex_var;
ap_uint<1> gen345_pipex_var;
ap_uint<1> gen346_pipex_var;
ap_uint<5> gen347_pipex_var;
ap_uint<1> gen348_pipex_var;
ap_uint<1> gen349_pipex_var;
ap_uint<1> gen350_pipex_var;
ap_uint<1> gen351_pipex_var;
ap_uint<32> gen352_pipex_var;
ap_uint<1> gen353_pipex_var;
ap_uint<1> gen354_pipex_var;
ap_uint<1> gen355_pipex_var;
ap_uint<1> gen356_pipex_var;
ap_uint<1> gen357_pipex_var;
ap_uint<1> gen358_pipex_var;
ap_uint<5> gen359_pipex_var;
ap_uint<1> gen360_pipex_var;
ap_uint<1> gen361_pipex_var;
ap_uint<1> gen362_pipex_var;
ap_uint<1> gen363_pipex_var;
ap_uint<32> gen364_pipex_var;
ap_uint<1> gen365_pipex_var;
ap_uint<1> gen366_pipex_var;
ap_uint<5> gen367_pipex_var;
ap_uint<1> gen368_pipex_var;
ap_uint<1> gen369_pipex_var;
ap_uint<1> gen370_pipex_var;
ap_uint<1> gen371_pipex_var;
ap_uint<32> gen372_pipex_var;
ap_uint<1> gen373_pipex_var;
ap_uint<1> gen374_pipex_var;
ap_uint<33> gen375_pipex_var;
ap_uint<33> gen376_pipex_var;
ap_uint<1> gen377_pipex_var;
ap_uint<1> gen378_pipex_var;
ap_uint<33> gen379_pipex_var;
ap_uint<1> gen380_pipex_var;
ap_uint<33> gen381_pipex_var;
ap_uint<1> gen382_pipex_var;
ap_uint<1> gen383_pipex_var;
ap_uint<1> gen384_pipex_var;
ap_uint<1> gen385_pipex_var;
ap_uint<1> gen386_pipex_var;
ap_uint<1> gen387_pipex_var;
ap_uint<1> gen388_pipex_var;
ap_uint<34> gen389_pipex_var;
ap_uint<34> gen390_pipex_var;
ap_uint<33> gen391_pipex_var;
ap_uint<33> gen392_pipex_var;
ap_uint<33> gen393_pipex_var;
ap_uint<32> gen394_pipex_var;
ap_uint<64> gen395_pipex_var;
ap_uint<5> gen396_pipex_var;
ap_uint<64> gen397_pipex_var;
ap_uint<32> gen398_pipex_var;
ap_uint<1> gen399_pipex_var;
ap_uint<64> gen400_pipex_var;
ap_uint<5> gen401_pipex_var;
ap_uint<64> gen402_pipex_var;
ap_uint<33> gen403_pipex_var;
ap_uint<33> gen404_pipex_var;
ap_uint<33> gen405_pipex_var;
ap_uint<32> gen406_pipex_var;
ap_uint<1> gen407_pipex_var;
ap_uint<1> gen408_pipex_var;
ap_uint<1> gen409_pipex_var;
ap_uint<1> gen410_pipex_var;
ap_uint<1> gen411_pipex_var;
ap_uint<1> gen412_pipex_var;
ap_uint<1> gen413_pipex_var;
ap_uint<1> gen414_pipex_var;
ap_uint<1> gen415_pipex_var;
ap_uint<1> gen416_pipex_var;
ap_uint<1> gen417_pipex_var;
ap_uint<1> gen418_pipex_var;
ap_uint<1> gen419_pipex_var;
ap_uint<1> gen420_pipex_var;
ap_uint<1> gen421_pipex_var;
ap_uint<1> gen422_pipex_var;
ap_uint<1> gen423_pipex_var;
ap_uint<1> gen424_pipex_var;
ap_uint<1> gen425_pipex_var;
ap_uint<1> gen426_pipex_var;
ap_uint<33> gen427_pipex_var;
ap_uint<1> gen428_pipex_var;
ap_uint<1> gen429_pipex_var;
ap_uint<1> gen430_pipex_var;
ap_uint<1> gen431_pipex_var;
ap_uint<1> gen432_pipex_var;
ap_uint<1> gen433_pipex_var;
ap_uint<1> gen434_pipex_var;
ap_uint<1> gen435_pipex_var;
ap_uint<1> gen436_pipex_var;
ap_uint<1> gen437_pipex_var;
ap_uint<1> gen438_pipex_var;
ap_uint<1> gen439_pipex_var;
ap_uint<1> gen440_pipex_var;
ap_uint<1> gen441_pipex_var;
ap_uint<1> gen442_pipex_var;
ap_uint<1> gen443_pipex_var;
ap_uint<1> gen444_pipex_var;
ap_uint<1> gen445_pipex_var;
ap_uint<1> gen446_pipex_var;
ap_uint<1> gen447_pipex_var;
ap_uint<1> gen448_pipex_var;
ap_uint<1> gen449_pipex_var;
ap_uint<1> gen450_pipex_var;
ap_uint<1> gen451_pipex_var;
ap_uint<1> gen452_pipex_var;
ap_uint<1> gen453_pipex_var;
ap_uint<32> genpstage_IADDR_curinstr_addr;
ap_uint<32> genpstage_IADDR_nextinstr_addr;
riscv_6stage_busreq_mem_struct genpstage_IFETCH_instr_busreq;
ap_uint<32> genpstage_IFETCH_curinstr_addr;
ap_uint<32> genpstage_IFETCH_nextinstr_addr;
ap_uint<32> genpstage_IDECODE_instr_code;
ap_uint<7> genpstage_IDECODE_opcode;
ap_uint<1> genpstage_IDECODE_alu_unsigned;
ap_uint<5> genpstage_IDECODE_rs1_addr;
ap_uint<5> genpstage_IDECODE_rs2_addr;
ap_uint<5> genpstage_IDECODE_rd_addr;
ap_uint<3> genpstage_IDECODE_funct3;
ap_uint<7> genpstage_IDECODE_funct7;
ap_uint<5> genpstage_IDECODE_shamt;
ap_uint<4> genpstage_IDECODE_pred;
ap_uint<4> genpstage_IDECODE_succ;
ap_uint<12> genpstage_IDECODE_csrnum;
ap_uint<5> genpstage_IDECODE_zimm;
ap_uint<32> genpstage_IDECODE_immediate_I;
ap_uint<32> genpstage_IDECODE_immediate_S;
ap_uint<32> genpstage_IDECODE_immediate_B;
ap_uint<32> genpstage_IDECODE_immediate_U;
ap_uint<32> genpstage_IDECODE_immediate_J;
ap_uint<2> genpstage_IDECODE_op1_source;
ap_uint<1> genpstage_IDECODE_rd_req;
ap_uint<3> genpstage_IDECODE_rd_source;
ap_uint<32> genpstage_IDECODE_immediate;
ap_uint<2> genpstage_IDECODE_op2_source;
ap_uint<1> genpstage_IDECODE_alu_req;
ap_uint<4> genpstage_IDECODE_alu_opcode;
ap_uint<1> genpstage_IDECODE_jump_req;
ap_uint<1> genpstage_IDECODE_jump_src;
ap_uint<1> genpstage_IDECODE_rs1_req;
ap_uint<1> genpstage_IDECODE_rs2_req;
ap_uint<1> genpstage_IDECODE_jump_req_cond;
ap_uint<1> genpstage_IDECODE_mem_req;
ap_uint<1> genpstage_IDECODE_mem_cmd;
ap_uint<1> genpstage_IDECODE_fencereq;
ap_uint<1> genpstage_IDECODE_ebreakreq;
ap_uint<1> genpstage_IDECODE_ecallreq;
ap_uint<1> genpstage_IDECODE_csrreq;
ap_uint<4> genpstage_IDECODE_mem_be;
ap_uint<1> genpstage_IDECODE_mret_req;
ap_uint<32> genpstage_IDECODE_csr_rdata;
ap_uint<32> genpstage_IDECODE_alu_op1;
ap_uint<32> genpstage_IDECODE_alu_op2;
ap_uint<33> genpstage_IDECODE_alu_op1_wide;
ap_uint<33> genpstage_IDECODE_alu_op2_wide;
ap_uint<32> genpstage_IDECODE_curinstr_addr;
ap_uint<32> genpstage_IDECODE_nextinstr_addr;
ap_uint<1> genpstage_EXEC_jump_req;
ap_uint<1> genpstage_EXEC_jump_req_cond;
ap_uint<1> genpstage_EXEC_jump_src;
ap_uint<1> genpstage_EXEC_rs1_req;
ap_uint<1> genpstage_EXEC_rs2_req;
ap_uint<1> genpstage_EXEC_rd_req;
ap_uint<32> genpstage_EXEC_immediate;
ap_uint<1> genpstage_EXEC_fencereq;
ap_uint<1> genpstage_EXEC_ecallreq;
ap_uint<1> genpstage_EXEC_ebreakreq;
ap_uint<1> genpstage_EXEC_csrreq;
ap_uint<1> genpstage_EXEC_alu_req;
ap_uint<1> genpstage_EXEC_mem_req;
ap_uint<33> genpstage_EXEC_alu_result_wide;
ap_uint<32> genpstage_EXEC_alu_result;
ap_uint<1> genpstage_EXEC_alu_CF;
ap_uint<1> genpstage_EXEC_alu_SF;
ap_uint<1> genpstage_EXEC_alu_ZF;
ap_uint<1> genpstage_EXEC_alu_OF;
ap_uint<1> genpstage_EXEC_alu_overflow;
ap_uint<32> genpstage_EXEC_rd_wdata;
ap_uint<1> genpstage_EXEC_rd_rdy;
ap_uint<5> genpstage_EXEC_rd_addr;
ap_uint<32> genpstage_EXEC_curinstr_addr;
ap_uint<1> genpstage_EXEC_mret_req;
ap_uint<33> genpstage_EXEC_alu_op1_wide;
ap_uint<4> genpstage_EXEC_alu_opcode;
ap_uint<33> genpstage_EXEC_alu_op2_wide;
ap_uint<32> genpstage_EXEC_alu_op1;
ap_uint<32> genpstage_EXEC_alu_op2;
ap_uint<1> genpstage_EXEC_alu_unsigned;
ap_uint<3> genpstage_EXEC_rd_source;
ap_uint<32> genpstage_EXEC_nextinstr_addr;
ap_uint<32> genpstage_EXEC_csr_rdata;
ap_uint<3> genpstage_EXEC_funct3;
ap_uint<1> genpstage_EXEC_mem_cmd;
ap_uint<32> genpstage_MEM_curinstraddr_imm;
ap_uint<32> genpstage_MEM_jump_vector;
ap_uint<1> genpstage_MEM_jump_req;
ap_uint<32> genpstage_MEM_mem_addr;
ap_uint<32> genpstage_MEM_mem_wdata;
riscv_6stage_busreq_mem_struct genpstage_MEM_data_busreq;
ap_uint<1> genpstage_MEM_rd_req;
ap_uint<5> genpstage_MEM_rd_addr;
ap_uint<1> genpstage_MEM_rd_rdy;
ap_uint<32> genpstage_MEM_rd_wdata;
ap_uint<32> genpstage_MEM_curinstr_addr;
ap_uint<32> genpstage_MEM_immediate;
ap_uint<1> genpstage_MEM_jump_src;
ap_uint<32> genpstage_MEM_alu_result;
ap_uint<1> genpstage_MEM_jump_req_cond;
ap_uint<3> genpstage_MEM_funct3;
ap_uint<1> genpstage_MEM_alu_ZF;
ap_uint<1> genpstage_MEM_alu_CF;
ap_uint<1> genpstage_MEM_mem_req;
ap_uint<1> genpstage_MEM_mem_cmd;
ap_uint<3> genpstage_MEM_rd_source;
ap_uint<32> genpstage_WB_mem_rdata;
ap_uint<1> genpstage_WB_rd_rdy;
ap_uint<32> genpstage_WB_rd_wdata;
ap_uint<1> genpstage_WB_rd_req;
ap_uint<5> genpstage_WB_rd_addr;
ap_uint<1> genpstage_WB_mem_req;
ap_uint<1> genpstage_WB_mem_cmd;
ap_uint<3> genpstage_WB_rd_source;
ap_uint<32> gen454_pipex_mcopipe_rdata;
ap_uint<1> gen455_pipex_genpstage_WB_mcopipe_rdreq_inprogress;
ap_uint<32> gen456_pipex_mcopipe_rdata;
ap_uint<1> gen457_pipex_genpstage_MEM_mcopipe_rdreq_inprogress;
genpmodule_riscv_6stage_genmcopipe_data_mem_genstruct_fifo_wdata gen458_pipex_req_struct;
ap_uint<1> gen459_pipex_genpstage_EXEC_mcopipe_rdreq_inprogress;
ap_uint<32> gen460_pipex_mcopipe_rdata;
ap_uint<1> gen461_pipex_genpstage_IDECODE_mcopipe_rdreq_inprogress;
ap_uint<32> gen462_pipex_mcopipe_rdata;
ap_uint<1> gen463_pipex_genpstage_IFETCH_mcopipe_rdreq_inprogress;
genpmodule_riscv_6stage_genmcopipe_instr_mem_genstruct_fifo_wdata gen464_pipex_req_struct;
ap_uint<1> gen465_pipex_genpstage_IADDR_mcopipe_rdreq_inprogress;
ap_uint<32> gen408_cyclix_var;
ap_uint<32> gen409_cyclix_var;
ap_uint<32> gen410_cyclix_var;
ap_uint<32> gen411_cyclix_var;
ap_uint<32> gen412_cyclix_var;
ap_uint<32> gen413_cyclix_var;
ap_uint<32> gen414_cyclix_var;
ap_uint<32> gen415_cyclix_var;
ap_uint<32> gen416_cyclix_var;
ap_uint<32> gen417_cyclix_var;
ap_uint<32> gen418_cyclix_var;
ap_uint<32> gen419_cyclix_var;
ap_uint<32> gen420_cyclix_var;
ap_uint<32> gen421_cyclix_var;
ap_uint<32> gen422_cyclix_var;
ap_uint<32> gen423_cyclix_var;
ap_uint<32> gen424_cyclix_var;
ap_uint<32> gen425_cyclix_var;
ap_uint<32> gen426_cyclix_var;
ap_uint<32> gen427_cyclix_var;
ap_uint<32> gen428_cyclix_var;
ap_uint<32> gen429_cyclix_var;
ap_uint<32> gen430_cyclix_var;
ap_uint<32> gen431_cyclix_var;
ap_uint<32> gen432_cyclix_var;
ap_uint<32> gen433_cyclix_var;
ap_uint<32> gen434_cyclix_var;
ap_uint<32> gen435_cyclix_var;
ap_uint<32> gen436_cyclix_var;
ap_uint<32> gen437_cyclix_var;
ap_uint<32> gen438_cyclix_var;
ap_uint<1> gen439_cyclix_var;
ap_uint<1> gen440_cyclix_var;
ap_uint<1> gen441_cyclix_var;
ap_uint<1> gen442_cyclix_var;
ap_uint<1> gen443_cyclix_var;
ap_uint<1> gen444_cyclix_var;
ap_uint<1> gen445_cyclix_var;
ap_uint<1> gen446_cyclix_var;
ap_uint<1> gen447_cyclix_var;
ap_uint<1> gen448_cyclix_var;
ap_uint<1> gen449_cyclix_var;
ap_uint<1> gen450_cyclix_var;
ap_uint<1> gen451_cyclix_var;
ap_uint<1> gen452_cyclix_var;
ap_uint<32> gen453_cyclix_var;
ap_uint<32> gen454_cyclix_var;
ap_uint<32> gen455_cyclix_var;
ap_uint<32> gen456_cyclix_var;
ap_uint<32> gen457_cyclix_var;
ap_uint<32> gen458_cyclix_var;
ap_uint<32> gen459_cyclix_var;
ap_uint<32> gen460_cyclix_var;
ap_uint<32> gen461_cyclix_var;
ap_uint<32> gen462_cyclix_var;
ap_uint<32> gen463_cyclix_var;
ap_uint<32> gen464_cyclix_var;
ap_uint<32> gen465_cyclix_var;
ap_uint<32> gen466_cyclix_var;
ap_uint<32> gen467_cyclix_var;
ap_uint<32> gen468_cyclix_var;
ap_uint<32> gen469_cyclix_var;
ap_uint<32> gen470_cyclix_var;
ap_uint<32> gen471_cyclix_var;
ap_uint<32> gen472_cyclix_var;
ap_uint<32> gen473_cyclix_var;
ap_uint<32> gen474_cyclix_var;
ap_uint<32> gen475_cyclix_var;
ap_uint<32> gen476_cyclix_var;
ap_uint<32> gen477_cyclix_var;
ap_uint<32> gen478_cyclix_var;
ap_uint<32> gen479_cyclix_var;
ap_uint<32> gen480_cyclix_var;
ap_uint<32> gen481_cyclix_var;
ap_uint<32> gen482_cyclix_var;
ap_uint<32> gen483_cyclix_var;
ap_uint<1> gen484_cyclix_var;
ap_uint<1> gen485_cyclix_var;
ap_uint<1> gen486_cyclix_var;
ap_uint<1> gen487_cyclix_var;
ap_uint<1> gen488_cyclix_var;
ap_uint<1> gen489_cyclix_var;
ap_uint<1> gen490_cyclix_var;
ap_uint<1> gen491_cyclix_var;
ap_uint<1> gen492_cyclix_var;
ap_uint<1> gen493_cyclix_var;
ap_uint<1> gen494_cyclix_var;
ap_uint<32> gen495_cyclix_var;
ap_uint<32> gen496_cyclix_var;
ap_uint<32> gen497_cyclix_var;
ap_uint<32> gen498_cyclix_var;
ap_uint<32> gen499_cyclix_var;
ap_uint<32> gen500_cyclix_var;
ap_uint<32> gen501_cyclix_var;
ap_uint<32> gen502_cyclix_var;
ap_uint<32> gen503_cyclix_var;
ap_uint<32> gen504_cyclix_var;
ap_uint<32> gen505_cyclix_var;
ap_uint<32> gen506_cyclix_var;
ap_uint<32> gen507_cyclix_var;
ap_uint<32> gen508_cyclix_var;
ap_uint<32> gen509_cyclix_var;
ap_uint<32> gen510_cyclix_var;
ap_uint<32> gen511_cyclix_var;
ap_uint<32> gen512_cyclix_var;
ap_uint<32> gen513_cyclix_var;
ap_uint<32> gen514_cyclix_var;
ap_uint<32> gen515_cyclix_var;
ap_uint<32> gen516_cyclix_var;
ap_uint<32> gen517_cyclix_var;
ap_uint<32> gen518_cyclix_var;
ap_uint<32> gen519_cyclix_var;
ap_uint<32> gen520_cyclix_var;
ap_uint<32> gen521_cyclix_var;
ap_uint<32> gen522_cyclix_var;
ap_uint<32> gen523_cyclix_var;
ap_uint<32> gen524_cyclix_var;
ap_uint<32> gen525_cyclix_var;
ap_uint<1> gen526_cyclix_var;
ap_uint<1> gen527_cyclix_var;
ap_uint<1> gen528_cyclix_var;
ap_uint<1> gen529_cyclix_var;
ap_uint<1> gen530_cyclix_var;
ap_uint<1> gen531_cyclix_var;
ap_uint<1> gen532_cyclix_var;
ap_uint<1> gen533_cyclix_var;
ap_uint<1> gen534_cyclix_var;
ap_uint<1> gen535_cyclix_var;
ap_uint<1> gen536_cyclix_var;
ap_uint<1> gen537_cyclix_var;
ap_uint<1> gen538_cyclix_var;
ap_uint<1> gen539_cyclix_var;
ap_uint<1> gen540_cyclix_var;
ap_uint<1> gen541_cyclix_var;
ap_uint<1> gen542_cyclix_var;
ap_uint<1> gen543_cyclix_var;
ap_uint<1> gen544_cyclix_var;
ap_uint<1> gen545_cyclix_var;
ap_uint<1> gen546_cyclix_var;
ap_uint<1> gen547_cyclix_var;
ap_uint<1> gen548_cyclix_var;
ap_uint<1> gen549_cyclix_var;
ap_uint<1> gen550_cyclix_var;
ap_uint<1> gen551_cyclix_var;
ap_uint<1> gen552_cyclix_var;
ap_uint<1> gen553_cyclix_var;
ap_uint<1> gen554_cyclix_var;
ap_uint<1> gen555_cyclix_var;
ap_uint<1> gen556_cyclix_var;
ap_uint<1> gen557_cyclix_var;
ap_uint<1> gen558_cyclix_var;
ap_uint<1> gen559_cyclix_var;
ap_uint<1> gen560_cyclix_var;
ap_uint<1> gen561_cyclix_var;
ap_uint<1> gen562_cyclix_var;
ap_uint<1> gen563_cyclix_var;
ap_uint<1> gen564_cyclix_var;
ap_uint<1> gen565_cyclix_var;
ap_uint<1> gen566_cyclix_var;
ap_uint<1> gen567_cyclix_var;
ap_uint<1> gen568_cyclix_var;
ap_uint<1> gen569_cyclix_var;
ap_uint<1> gen570_cyclix_var;
ap_uint<1> gen571_cyclix_var;
ap_uint<1> gen572_cyclix_var;
ap_uint<1> gen573_cyclix_var;
ap_uint<1> gen574_cyclix_var;
ap_uint<1> gen575_cyclix_var;
ap_uint<1> gen576_cyclix_var;
ap_uint<1> gen577_cyclix_var;
ap_uint<1> gen578_cyclix_var;
ap_uint<1> gen579_cyclix_var;
ap_uint<1> gen580_cyclix_var;
ap_uint<1> gen581_cyclix_var;
ap_uint<1> gen582_cyclix_var;
ap_uint<1> gen583_cyclix_var;
ap_uint<1> gen584_cyclix_var;
ap_uint<1> gen585_cyclix_var;
ap_uint<1> gen586_cyclix_var;
ap_uint<1> gen587_cyclix_var;
ap_uint<1> gen588_cyclix_var;
ap_uint<1> gen589_cyclix_var;
ap_uint<1> gen590_cyclix_var;
ap_uint<1> gen591_cyclix_var;
ap_uint<1> gen592_cyclix_var;
ap_uint<1> gen593_cyclix_var;
ap_uint<1> gen594_cyclix_var;
ap_uint<1> gen595_cyclix_var;
ap_uint<1> gen596_cyclix_var;
ap_uint<1> gen597_cyclix_var;
ap_uint<1> gen598_cyclix_var;
ap_uint<1> gen599_cyclix_var;
ap_uint<1> gen600_cyclix_var;
ap_uint<1> gen601_cyclix_var;
ap_uint<1> gen602_cyclix_var;
ap_uint<1> gen603_cyclix_var;
ap_uint<1> gen604_cyclix_var;
ap_uint<1> gen605_cyclix_var;
ap_uint<1> gen606_cyclix_var;
ap_uint<1> gen607_cyclix_var;
ap_uint<1> gen608_cyclix_var;
ap_uint<1> gen609_cyclix_var;
ap_uint<1> gen610_cyclix_var;
ap_uint<1> gen611_cyclix_var;
ap_uint<1> gen612_cyclix_var;
ap_uint<1> gen613_cyclix_var;
ap_uint<1> gen614_cyclix_var;
ap_uint<1> gen615_cyclix_var;
ap_uint<1> gen616_cyclix_var;
ap_uint<1> gen617_cyclix_var;
ap_uint<1> gen618_cyclix_var;
ap_uint<1> gen619_cyclix_var;
ap_uint<1> gen620_cyclix_var;
ap_uint<1> gen621_cyclix_var;
ap_uint<1> gen622_cyclix_var;
ap_uint<1> gen623_cyclix_var;
ap_uint<1> gen624_cyclix_var;
ap_uint<1> gen625_cyclix_var;
ap_uint<1> gen626_cyclix_var;
ap_uint<1> gen627_cyclix_var;
ap_uint<1> gen628_cyclix_var;
ap_uint<1> gen629_cyclix_var;
ap_uint<1> gen630_cyclix_var;
ap_uint<1> gen631_cyclix_var;
ap_uint<1> gen632_cyclix_var;
ap_uint<1> gen633_cyclix_var;
ap_uint<1> gen634_cyclix_var;
ap_uint<1> gen635_cyclix_var;
ap_uint<1> gen636_cyclix_var;
ap_uint<1> gen637_cyclix_var;
ap_uint<1> gen638_cyclix_var;
ap_uint<1> gen639_cyclix_var;
ap_uint<1> gen640_cyclix_var;
ap_uint<1> gen641_cyclix_var;
ap_uint<32> gen642_cyclix_var;
ap_uint<32> gen643_cyclix_var;
ap_uint<32> gen644_cyclix_var;
ap_uint<32> gen645_cyclix_var;
ap_uint<32> gen646_cyclix_var;
ap_uint<32> gen647_cyclix_var;
ap_uint<32> gen648_cyclix_var;
ap_uint<32> gen649_cyclix_var;
ap_uint<32> gen650_cyclix_var;
ap_uint<32> gen651_cyclix_var;
ap_uint<32> gen652_cyclix_var;
ap_uint<32> gen653_cyclix_var;
ap_uint<32> gen654_cyclix_var;
ap_uint<32> gen655_cyclix_var;
ap_uint<32> gen656_cyclix_var;
ap_uint<32> gen657_cyclix_var;
ap_uint<32> gen658_cyclix_var;
ap_uint<32> gen659_cyclix_var;
ap_uint<32> gen660_cyclix_var;
ap_uint<32> gen661_cyclix_var;
ap_uint<32> gen662_cyclix_var;
ap_uint<32> gen663_cyclix_var;
ap_uint<32> gen664_cyclix_var;
ap_uint<32> gen665_cyclix_var;
ap_uint<32> gen666_cyclix_var;
ap_uint<32> gen667_cyclix_var;
ap_uint<32> gen668_cyclix_var;
ap_uint<32> gen669_cyclix_var;
ap_uint<32> gen670_cyclix_var;
ap_uint<32> gen671_cyclix_var;
ap_uint<32> gen672_cyclix_var;
ap_uint<32> gen673_cyclix_var;
ap_uint<32> gen674_cyclix_var;
ap_uint<32> gen675_cyclix_var;
ap_uint<32> gen676_cyclix_var;
ap_uint<32> gen677_cyclix_var;
ap_uint<32> gen678_cyclix_var;
ap_uint<32> gen679_cyclix_var;
ap_uint<32> gen680_cyclix_var;
ap_uint<32> gen681_cyclix_var;
ap_uint<32> gen682_cyclix_var;
ap_uint<32> gen683_cyclix_var;
ap_uint<32> gen684_cyclix_var;
ap_uint<32> gen685_cyclix_var;
ap_uint<32> gen686_cyclix_var;
ap_uint<32> gen687_cyclix_var;
ap_uint<32> gen688_cyclix_var;
ap_uint<32> gen689_cyclix_var;
ap_uint<32> gen690_cyclix_var;
ap_uint<32> gen691_cyclix_var;
ap_uint<32> gen692_cyclix_var;
ap_uint<32> gen693_cyclix_var;
ap_uint<32> gen694_cyclix_var;
ap_uint<32> gen695_cyclix_var;
ap_uint<32> gen696_cyclix_var;
ap_uint<32> gen697_cyclix_var;
ap_uint<32> gen698_cyclix_var;
ap_uint<32> gen699_cyclix_var;
ap_uint<32> gen700_cyclix_var;
ap_uint<32> gen701_cyclix_var;
ap_uint<32> gen702_cyclix_var;
ap_uint<32> gen703_cyclix_var;
ap_uint<1> gen704_cyclix_var;
ap_uint<1> gen705_cyclix_var;
ap_uint<1> gen706_cyclix_var;
ap_uint<1> gen707_cyclix_var;
ap_uint<1> gen708_cyclix_var;
ap_uint<1> gen709_cyclix_var;
ap_uint<1> gen710_cyclix_var;
ap_uint<1> gen711_cyclix_var;
ap_uint<1> gen712_cyclix_var;
ap_uint<1> gen713_cyclix_var;
ap_uint<1> gen714_cyclix_var;
ap_uint<1> gen715_cyclix_var;
ap_uint<1> gen716_cyclix_var;
ap_uint<1> gen717_cyclix_var;
ap_uint<1> gen718_cyclix_var;
ap_uint<1> gen719_cyclix_var;
ap_uint<1> gen720_cyclix_var;
ap_uint<1> gen721_cyclix_var;
ap_uint<1> gen722_cyclix_var;
ap_uint<1> gen723_cyclix_var;
ap_uint<1> gen724_cyclix_var;
ap_uint<1> gen725_cyclix_var;
ap_uint<1> gen726_cyclix_var;
ap_uint<1> gen727_cyclix_var;
ap_uint<1> gen728_cyclix_var;
ap_uint<1> gen729_cyclix_var;
ap_uint<1> gen730_cyclix_var;
ap_uint<1> gen731_cyclix_var;
ap_uint<1> gen732_cyclix_var;
ap_uint<1> gen733_cyclix_var;
ap_uint<1> gen734_cyclix_var;
ap_uint<1> gen735_cyclix_var;
ap_uint<1> gen736_cyclix_var;
ap_uint<1> gen737_cyclix_var;
ap_uint<1> gen738_cyclix_var;
ap_uint<1> gen739_cyclix_var;
ap_uint<1> gen740_cyclix_var;
ap_uint<1> gen741_cyclix_var;
ap_uint<1> gen742_cyclix_var;
ap_uint<1> gen743_cyclix_var;
ap_uint<1> gen744_cyclix_var;
ap_uint<1> gen745_cyclix_var;
ap_uint<1> gen746_cyclix_var;
ap_uint<1> gen747_cyclix_var;
ap_uint<1> gen748_cyclix_var;
ap_uint<1> gen749_cyclix_var;
ap_uint<1> gen750_cyclix_var;
ap_uint<1> gen751_cyclix_var;
ap_uint<1> gen752_cyclix_var;
ap_uint<1> gen753_cyclix_var;
ap_uint<1> gen754_cyclix_var;
ap_uint<1> gen755_cyclix_var;
ap_uint<1> gen756_cyclix_var;
ap_uint<1> gen757_cyclix_var;
ap_uint<1> gen758_cyclix_var;
ap_uint<1> gen759_cyclix_var;
ap_uint<1> gen760_cyclix_var;
ap_uint<1> gen761_cyclix_var;
ap_uint<1> gen762_cyclix_var;
ap_uint<1> gen763_cyclix_var;
ap_uint<1> gen764_cyclix_var;
ap_uint<1> gen765_cyclix_var;
ap_uint<1> gen766_cyclix_var;
ap_uint<1> gen767_cyclix_var;
ap_uint<1> gen768_cyclix_var;
ap_uint<1> gen769_cyclix_var;
ap_uint<1> gen770_cyclix_var;
ap_uint<1> gen771_cyclix_var;
ap_uint<1> gen772_cyclix_var;
ap_uint<1> gen773_cyclix_var;
ap_uint<1> gen774_cyclix_var;
ap_uint<1> gen775_cyclix_var;
ap_uint<1> gen776_cyclix_var;
ap_uint<1> gen777_cyclix_var;
ap_uint<1> gen778_cyclix_var;
ap_uint<1> gen779_cyclix_var;
ap_uint<1> gen780_cyclix_var;
ap_uint<1> gen781_cyclix_var;
ap_uint<1> gen782_cyclix_var;
ap_uint<1> gen783_cyclix_var;
ap_uint<1> gen784_cyclix_var;
ap_uint<1> gen785_cyclix_var;
ap_uint<1> gen786_cyclix_var;
ap_uint<1> gen787_cyclix_var;
ap_uint<1> gen788_cyclix_var;
ap_uint<1> gen789_cyclix_var;
ap_uint<1> gen790_cyclix_var;
ap_uint<1> gen791_cyclix_var;
ap_uint<1> gen792_cyclix_var;
ap_uint<1> gen793_cyclix_var;
ap_uint<1> gen794_cyclix_var;
ap_uint<1> gen795_cyclix_var;
ap_uint<1> gen796_cyclix_var;
ap_uint<1> gen797_cyclix_var;
ap_uint<1> gen798_cyclix_var;
ap_uint<1> gen799_cyclix_var;
ap_uint<1> gen800_cyclix_var;
ap_uint<1> gen801_cyclix_var;
ap_uint<1> gen802_cyclix_var;
ap_uint<1> gen803_cyclix_var;
ap_uint<1> gen804_cyclix_var;
ap_uint<1> gen805_cyclix_var;
ap_uint<1> gen806_cyclix_var;
ap_uint<1> gen807_cyclix_var;
ap_uint<1> gen808_cyclix_var;
ap_uint<1> gen809_cyclix_var;
ap_uint<1> gen810_cyclix_var;
ap_uint<1> gen811_cyclix_var;
ap_uint<1> gen812_cyclix_var;
ap_uint<1> gen813_cyclix_var;
ap_uint<1> gen814_cyclix_var;
ap_uint<1> gen815_cyclix_var;
if (geninit) {
genpsticky_glbl_pc = 512;
genpsticky_glbl_regfile[1] = 0;
genpsticky_glbl_regfile[2] = 0;
genpsticky_glbl_regfile[3] = 0;
genpsticky_glbl_regfile[4] = 0;
genpsticky_glbl_regfile[5] = 0;
genpsticky_glbl_regfile[6] = 0;
genpsticky_glbl_regfile[7] = 0;
genpsticky_glbl_regfile[8] = 0;
genpsticky_glbl_regfile[9] = 0;
genpsticky_glbl_regfile[10] = 0;
genpsticky_glbl_regfile[11] = 0;
genpsticky_glbl_regfile[12] = 0;
genpsticky_glbl_regfile[13] = 0;
genpsticky_glbl_regfile[14] = 0;
genpsticky_glbl_regfile[15] = 0;
genpsticky_glbl_regfile[16] = 0;
genpsticky_glbl_regfile[17] = 0;
genpsticky_glbl_regfile[18] = 0;
genpsticky_glbl_regfile[19] = 0;
genpsticky_glbl_regfile[20] = 0;
genpsticky_glbl_regfile[21] = 0;
genpsticky_glbl_regfile[22] = 0;
genpsticky_glbl_regfile[23] = 0;
genpsticky_glbl_regfile[24] = 0;
genpsticky_glbl_regfile[25] = 0;
genpsticky_glbl_regfile[26] = 0;
genpsticky_glbl_regfile[27] = 0;
genpsticky_glbl_regfile[28] = 0;
genpsticky_glbl_regfile[29] = 0;
genpsticky_glbl_regfile[30] = 0;
genpsticky_glbl_regfile[31] = 0;
genpsticky_glbl_jump_req_cmd = 0;
genpsticky_glbl_jump_vector_cmd = 0;
genpsticky_glbl_CSR_MCAUSE = 0;
genpsticky_glbl_MIRQEN = 1;
genpsticky_glbl_MRETADDR = 0;
genmcopipe_instr_mem_wr_done = 0;
genmcopipe_instr_mem_rd_done = 0;
genmcopipe_instr_mem_full_flag = 0;
genmcopipe_instr_mem_empty_flag = 1;
genmcopipe_instr_mem_wr_ptr = 0;
genmcopipe_instr_mem_rd_ptr = 0;
genmcopipe_data_mem_wr_done = 0;
genmcopipe_data_mem_rd_done = 0;
genmcopipe_data_mem_full_flag = 0;
genmcopipe_data_mem_empty_flag = 1;
genmcopipe_data_mem_wr_ptr = 0;
genmcopipe_data_mem_rd_ptr = 0;
genpstage_IADDR_genpctrl_active_glbl = 0;
genpstage_IADDR_genpctrl_stalled_glbl = 0;
genpstage_IADDR_genpctrl_killed_glbl = 0;
genpstage_IFETCH_genpctrl_active_glbl = 0;
genpstage_IFETCH_genpctrl_stalled_glbl = 0;
genpstage_IFETCH_genpctrl_killed_glbl = 0;
genpstage_IDECODE_genpctrl_active_glbl = 0;
genpstage_IDECODE_genpctrl_stalled_glbl = 0;
genpstage_IDECODE_genpctrl_killed_glbl = 0;
genpstage_EXEC_genpctrl_active_glbl = 0;
genpstage_EXEC_genpctrl_stalled_glbl = 0;
genpstage_EXEC_genpctrl_killed_glbl = 0;
genpstage_MEM_genpctrl_active_glbl = 0;
genpstage_MEM_genpctrl_stalled_glbl = 0;
genpstage_MEM_genpctrl_killed_glbl = 0;
genpstage_WB_genpctrl_active_glbl = 0;
genpstage_WB_genpctrl_stalled_glbl = 0;
genpstage_WB_genpctrl_killed_glbl = 0;
genpstage_IFETCH_instr_req_done = 0;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id = 0;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending = 0;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid = 0;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done = 0;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdata = 0;
genpstage_IFETCH_curinstr_addr_genglbl = 0;
genpstage_IFETCH_nextinstr_addr_genglbl = 0;
genpstage_IDECODE_rs1_rdata = 0;
genpstage_IDECODE_rs2_rdata = 0;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_if_id = 0;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending = 0;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_tid = 0;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done = 0;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdata = 0;
genpstage_IDECODE_curinstr_addr_genglbl = 0;
genpstage_IDECODE_nextinstr_addr_genglbl = 0;
genpstage_EXEC_irq_mcause = 0;
genpstage_EXEC_irq_recv = 0;
genpstage_EXEC_rs2_rdata = 0;
genpstage_EXEC_rd_req_genglbl = 0;
genpstage_EXEC_rd_addr_genglbl = 0;
genpstage_EXEC_curinstr_addr_genglbl = 0;
genpstage_EXEC_mret_req_genglbl = 0;
genpstage_EXEC_alu_op1_wide_genglbl = 0;
genpstage_EXEC_alu_req_genglbl = 0;
genpstage_EXEC_alu_opcode_genglbl = 0;
genpstage_EXEC_alu_op2_wide_genglbl = 0;
genpstage_EXEC_alu_op1_genglbl = 0;
genpstage_EXEC_alu_op2_genglbl = 0;
genpstage_EXEC_alu_unsigned_genglbl = 0;
genpstage_EXEC_rd_source_genglbl = 1;
genpstage_EXEC_immediate_genglbl = 0;
genpstage_EXEC_nextinstr_addr_genglbl = 0;
genpstage_EXEC_csr_rdata_genglbl = 0;
genpstage_EXEC_jump_src_genglbl = 0;
genpstage_EXEC_jump_req_cond_genglbl = 0;
genpstage_EXEC_funct3_genglbl = 0;
genpstage_EXEC_jump_req_genglbl = 0;
genpstage_EXEC_mem_req_genglbl = 0;
genpstage_EXEC_mem_cmd_genglbl = 0;
genpstage_MEM_data_req_done = 0;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id = 0;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending = 0;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid = 0;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done = 0;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdata = 0;
genpstage_MEM_rs2_rdata = 0;
genpstage_MEM_rd_req_genglbl = 0;
genpstage_MEM_rd_addr_genglbl = 0;
genpstage_MEM_rd_rdy_genglbl = 0;
genpstage_MEM_rd_wdata_genglbl = 0;
genpstage_MEM_curinstr_addr_genglbl = 0;
genpstage_MEM_immediate_genglbl = 0;
genpstage_MEM_jump_src_genglbl = 0;
genpstage_MEM_alu_result_genglbl = 0;
genpstage_MEM_jump_req_cond_genglbl = 0;
genpstage_MEM_funct3_genglbl = 0;
genpstage_MEM_alu_ZF_genglbl = 0;
genpstage_MEM_alu_CF_genglbl = 0;
genpstage_MEM_jump_req_genglbl = 0;
genpstage_MEM_mem_req_genglbl = 0;
genpstage_MEM_mem_cmd_genglbl = 0;
genpstage_MEM_rd_source_genglbl = 1;
genpstage_WB_genmcopipe_handle_data_mem_genvar_if_id = 0;
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending = 0;
genpstage_WB_genmcopipe_handle_data_mem_genvar_tid = 0;
genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done = 0;
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdata = 0;
genpstage_WB_rd_req_genglbl = 0;
genpstage_WB_rd_addr_genglbl = 0;
genpstage_WB_rd_rdy_genglbl = 0;
genpstage_WB_rd_wdata_genglbl = 0;
genpstage_WB_mem_req_genglbl = 0;
genpstage_WB_mem_cmd_genglbl = 0;
genpstage_WB_rd_source_genglbl = 1;
} else {
genmcopipe_instr_mem_wr_done = ap_uint<32>(0);
genmcopipe_instr_mem_rd_done = ap_uint<32>(0);
genmcopipe_instr_mem_wr_ptr_next = (genmcopipe_instr_mem_wr_ptr + ap_uint<32>(1));
genmcopipe_instr_mem_rd_ptr_next = (genmcopipe_instr_mem_rd_ptr + ap_uint<32>(1));
genmcopipe_data_mem_wr_done = ap_uint<32>(0);
genmcopipe_data_mem_rd_done = ap_uint<32>(0);
genmcopipe_data_mem_wr_ptr_next = (genmcopipe_data_mem_wr_ptr + ap_uint<32>(1));
genmcopipe_data_mem_rd_ptr_next = (genmcopipe_data_mem_rd_ptr + ap_uint<32>(1));
genpsticky_glbl_pc_buf = genpsticky_glbl_pc;
gen408_cyclix_var = genpsticky_glbl_regfile[1];
genpsticky_glbl_regfile_buf[1] = gen408_cyclix_var;
gen409_cyclix_var = genpsticky_glbl_regfile[2];
genpsticky_glbl_regfile_buf[2] = gen409_cyclix_var;
gen410_cyclix_var = genpsticky_glbl_regfile[3];
genpsticky_glbl_regfile_buf[3] = gen410_cyclix_var;
gen411_cyclix_var = genpsticky_glbl_regfile[4];
genpsticky_glbl_regfile_buf[4] = gen411_cyclix_var;
gen412_cyclix_var = genpsticky_glbl_regfile[5];
genpsticky_glbl_regfile_buf[5] = gen412_cyclix_var;
gen413_cyclix_var = genpsticky_glbl_regfile[6];
genpsticky_glbl_regfile_buf[6] = gen413_cyclix_var;
gen414_cyclix_var = genpsticky_glbl_regfile[7];
genpsticky_glbl_regfile_buf[7] = gen414_cyclix_var;
gen415_cyclix_var = genpsticky_glbl_regfile[8];
genpsticky_glbl_regfile_buf[8] = gen415_cyclix_var;
gen416_cyclix_var = genpsticky_glbl_regfile[9];
genpsticky_glbl_regfile_buf[9] = gen416_cyclix_var;
gen417_cyclix_var = genpsticky_glbl_regfile[10];
genpsticky_glbl_regfile_buf[10] = gen417_cyclix_var;
gen418_cyclix_var = genpsticky_glbl_regfile[11];
genpsticky_glbl_regfile_buf[11] = gen418_cyclix_var;
gen419_cyclix_var = genpsticky_glbl_regfile[12];
genpsticky_glbl_regfile_buf[12] = gen419_cyclix_var;
gen420_cyclix_var = genpsticky_glbl_regfile[13];
genpsticky_glbl_regfile_buf[13] = gen420_cyclix_var;
gen421_cyclix_var = genpsticky_glbl_regfile[14];
genpsticky_glbl_regfile_buf[14] = gen421_cyclix_var;
gen422_cyclix_var = genpsticky_glbl_regfile[15];
genpsticky_glbl_regfile_buf[15] = gen422_cyclix_var;
gen423_cyclix_var = genpsticky_glbl_regfile[16];
genpsticky_glbl_regfile_buf[16] = gen423_cyclix_var;
gen424_cyclix_var = genpsticky_glbl_regfile[17];
genpsticky_glbl_regfile_buf[17] = gen424_cyclix_var;
gen425_cyclix_var = genpsticky_glbl_regfile[18];
genpsticky_glbl_regfile_buf[18] = gen425_cyclix_var;
gen426_cyclix_var = genpsticky_glbl_regfile[19];
genpsticky_glbl_regfile_buf[19] = gen426_cyclix_var;
gen427_cyclix_var = genpsticky_glbl_regfile[20];
genpsticky_glbl_regfile_buf[20] = gen427_cyclix_var;
gen428_cyclix_var = genpsticky_glbl_regfile[21];
genpsticky_glbl_regfile_buf[21] = gen428_cyclix_var;
gen429_cyclix_var = genpsticky_glbl_regfile[22];
genpsticky_glbl_regfile_buf[22] = gen429_cyclix_var;
gen430_cyclix_var = genpsticky_glbl_regfile[23];
genpsticky_glbl_regfile_buf[23] = gen430_cyclix_var;
gen431_cyclix_var = genpsticky_glbl_regfile[24];
genpsticky_glbl_regfile_buf[24] = gen431_cyclix_var;
gen432_cyclix_var = genpsticky_glbl_regfile[25];
genpsticky_glbl_regfile_buf[25] = gen432_cyclix_var;
gen433_cyclix_var = genpsticky_glbl_regfile[26];
genpsticky_glbl_regfile_buf[26] = gen433_cyclix_var;
gen434_cyclix_var = genpsticky_glbl_regfile[27];
genpsticky_glbl_regfile_buf[27] = gen434_cyclix_var;
gen435_cyclix_var = genpsticky_glbl_regfile[28];
genpsticky_glbl_regfile_buf[28] = gen435_cyclix_var;
gen436_cyclix_var = genpsticky_glbl_regfile[29];
genpsticky_glbl_regfile_buf[29] = gen436_cyclix_var;
gen437_cyclix_var = genpsticky_glbl_regfile[30];
genpsticky_glbl_regfile_buf[30] = gen437_cyclix_var;
gen438_cyclix_var = genpsticky_glbl_regfile[31];
genpsticky_glbl_regfile_buf[31] = gen438_cyclix_var;
genpsticky_glbl_jump_req_cmd_buf = genpsticky_glbl_jump_req_cmd;
genpsticky_glbl_jump_vector_cmd_buf = genpsticky_glbl_jump_vector_cmd;
genpsticky_glbl_CSR_MCAUSE_buf = genpsticky_glbl_CSR_MCAUSE;
genpsticky_glbl_MIRQEN_buf = genpsticky_glbl_MIRQEN;
genpsticky_glbl_MRETADDR_buf = genpsticky_glbl_MRETADDR;
genpstage_WB_genpctrl_succ = ap_uint<32>(0);
genpstage_WB_genpctrl_working = ap_uint<32>(0);
gen439_cyclix_var = genpstage_WB_genpctrl_stalled_glbl;
if (gen439_cyclix_var) {
genpstage_WB_genpctrl_new = ap_uint<32>(0);
genpstage_WB_genpctrl_stalled_glbl = ap_uint<32>(0);
gen440_cyclix_var = !genpstage_WB_genpctrl_killed_glbl;
genpstage_WB_genpctrl_active_glbl = gen440_cyclix_var;
}
gen441_cyclix_var = ap_uint<1>(0);
gen441_cyclix_var = (gen441_cyclix_var || gen439_cyclix_var);
gen441_cyclix_var = !gen441_cyclix_var;
if (gen441_cyclix_var) {
genpstage_WB_genpctrl_new = (genpstage_WB_genpctrl_active_glbl || genpstage_WB_genpctrl_killed_glbl);
}
genpstage_WB_genpctrl_finish = ap_uint<32>(0);
genpstage_WB_genpctrl_flushreq = ap_uint<32>(0);
genpstage_WB_genpctrl_nevictable = ap_uint<32>(0);
genpstage_WB_genpctrl_occupied = (genpstage_WB_genpctrl_active_glbl | genpstage_WB_genpctrl_killed_glbl);
genpstage_WB_rd_req = genpstage_WB_rd_req_genglbl;
genpstage_WB_rd_addr = genpstage_WB_rd_addr_genglbl;
genpstage_WB_rd_rdy = genpstage_WB_rd_rdy_genglbl;
genpstage_WB_rd_wdata = genpstage_WB_rd_wdata_genglbl;
genpstage_WB_mem_req = genpstage_WB_mem_req_genglbl;
genpstage_WB_mem_cmd = genpstage_WB_mem_cmd_genglbl;
genpstage_WB_rd_source = genpstage_WB_rd_source_genglbl;
gen442_cyclix_var = genpstage_WB_genpctrl_occupied;
if (gen442_cyclix_var) {
gen443_cyclix_var = genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending;
if (gen443_cyclix_var) {
gen444_cyclix_var = (genpstage_WB_genmcopipe_handle_data_mem_genvar_if_id == ap_uint<1>(0));
gen445_cyclix_var = gen444_cyclix_var;
if (gen445_cyclix_var) {
gen446_cyclix_var = (genpstage_WB_genmcopipe_handle_data_mem_genvar_tid == genmcopipe_data_mem_rd_ptr);
gen447_cyclix_var = gen446_cyclix_var;
if (gen447_cyclix_var) {
gen448_cyclix_var = genmcopipe_data_mem_resp.read_nb(gen454_pipex_mcopipe_rdata);
gen449_cyclix_var = gen448_cyclix_var;
if (gen449_cyclix_var) {
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done = ap_uint<32>(1);
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdata = gen454_pipex_mcopipe_rdata;
genmcopipe_data_mem_rd_done = ap_uint<32>(1);
}
}
}
}
gen455_pipex_genpstage_WB_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen455_pipex_genpstage_WB_mcopipe_rdreq_inprogress = (gen455_pipex_genpstage_WB_mcopipe_rdreq_inprogress || genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending);
gen450_cyclix_var = genpstage_WB_genpctrl_flushreq;
if (gen450_cyclix_var) {
gen451_cyclix_var = genpstage_WB_genpctrl_active_glbl;
if (gen451_cyclix_var) {
genpstage_WB_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_WB_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
}
gen452_cyclix_var = ap_uint<1>(0);
gen452_cyclix_var = (gen452_cyclix_var || gen442_cyclix_var);
gen452_cyclix_var = !gen452_cyclix_var;
if (gen452_cyclix_var) {
genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending = ap_uint<32>(0);
}
gen453_cyclix_var = genpsticky_glbl_regfile[1];
gen231_pipex_syncbuf[1] = gen453_cyclix_var;
gen454_cyclix_var = genpsticky_glbl_regfile[2];
gen231_pipex_syncbuf[2] = gen454_cyclix_var;
gen455_cyclix_var = genpsticky_glbl_regfile[3];
gen231_pipex_syncbuf[3] = gen455_cyclix_var;
gen456_cyclix_var = genpsticky_glbl_regfile[4];
gen231_pipex_syncbuf[4] = gen456_cyclix_var;
gen457_cyclix_var = genpsticky_glbl_regfile[5];
gen231_pipex_syncbuf[5] = gen457_cyclix_var;
gen458_cyclix_var = genpsticky_glbl_regfile[6];
gen231_pipex_syncbuf[6] = gen458_cyclix_var;
gen459_cyclix_var = genpsticky_glbl_regfile[7];
gen231_pipex_syncbuf[7] = gen459_cyclix_var;
gen460_cyclix_var = genpsticky_glbl_regfile[8];
gen231_pipex_syncbuf[8] = gen460_cyclix_var;
gen461_cyclix_var = genpsticky_glbl_regfile[9];
gen231_pipex_syncbuf[9] = gen461_cyclix_var;
gen462_cyclix_var = genpsticky_glbl_regfile[10];
gen231_pipex_syncbuf[10] = gen462_cyclix_var;
gen463_cyclix_var = genpsticky_glbl_regfile[11];
gen231_pipex_syncbuf[11] = gen463_cyclix_var;
gen464_cyclix_var = genpsticky_glbl_regfile[12];
gen231_pipex_syncbuf[12] = gen464_cyclix_var;
gen465_cyclix_var = genpsticky_glbl_regfile[13];
gen231_pipex_syncbuf[13] = gen465_cyclix_var;
gen466_cyclix_var = genpsticky_glbl_regfile[14];
gen231_pipex_syncbuf[14] = gen466_cyclix_var;
gen467_cyclix_var = genpsticky_glbl_regfile[15];
gen231_pipex_syncbuf[15] = gen467_cyclix_var;
gen468_cyclix_var = genpsticky_glbl_regfile[16];
gen231_pipex_syncbuf[16] = gen468_cyclix_var;
gen469_cyclix_var = genpsticky_glbl_regfile[17];
gen231_pipex_syncbuf[17] = gen469_cyclix_var;
gen470_cyclix_var = genpsticky_glbl_regfile[18];
gen231_pipex_syncbuf[18] = gen470_cyclix_var;
gen471_cyclix_var = genpsticky_glbl_regfile[19];
gen231_pipex_syncbuf[19] = gen471_cyclix_var;
gen472_cyclix_var = genpsticky_glbl_regfile[20];
gen231_pipex_syncbuf[20] = gen472_cyclix_var;
gen473_cyclix_var = genpsticky_glbl_regfile[21];
gen231_pipex_syncbuf[21] = gen473_cyclix_var;
gen474_cyclix_var = genpsticky_glbl_regfile[22];
gen231_pipex_syncbuf[22] = gen474_cyclix_var;
gen475_cyclix_var = genpsticky_glbl_regfile[23];
gen231_pipex_syncbuf[23] = gen475_cyclix_var;
gen476_cyclix_var = genpsticky_glbl_regfile[24];
gen231_pipex_syncbuf[24] = gen476_cyclix_var;
gen477_cyclix_var = genpsticky_glbl_regfile[25];
gen231_pipex_syncbuf[25] = gen477_cyclix_var;
gen478_cyclix_var = genpsticky_glbl_regfile[26];
gen231_pipex_syncbuf[26] = gen478_cyclix_var;
gen479_cyclix_var = genpsticky_glbl_regfile[27];
gen231_pipex_syncbuf[27] = gen479_cyclix_var;
gen480_cyclix_var = genpsticky_glbl_regfile[28];
gen231_pipex_syncbuf[28] = gen480_cyclix_var;
gen481_cyclix_var = genpsticky_glbl_regfile[29];
gen231_pipex_syncbuf[29] = gen481_cyclix_var;
gen482_cyclix_var = genpsticky_glbl_regfile[30];
gen231_pipex_syncbuf[30] = gen482_cyclix_var;
gen483_cyclix_var = genpsticky_glbl_regfile[31];
gen231_pipex_syncbuf[31] = gen483_cyclix_var;
gen445_pipex_var = genpstage_WB_mem_req;
gen484_cyclix_var = gen445_pipex_var;
if (gen484_cyclix_var) {
gen446_pipex_var = ~genpstage_WB_mem_cmd;
gen447_pipex_var = gen446_pipex_var;
gen485_cyclix_var = gen447_pipex_var;
if (gen485_cyclix_var) {
gen486_cyclix_var = genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done;
if (gen486_cyclix_var) {
genpstage_WB_mem_rdata = genpstage_WB_genmcopipe_handle_data_mem_genvar_rdata;
}
gen448_pipex_var = genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done;
gen449_pipex_var = gen448_pipex_var;
gen487_cyclix_var = gen449_pipex_var;
if (gen487_cyclix_var) {
genpstage_WB_rd_rdy = ap_uint<32>(1);
}
gen450_pipex_var = ap_uint<1>(0);
gen450_pipex_var = (gen450_pipex_var || gen449_pipex_var);
gen450_pipex_var = !gen450_pipex_var;
gen488_cyclix_var = gen450_pipex_var;
if (gen488_cyclix_var) {
genpstage_WB_genpctrl_stalled_glbl = (genpstage_WB_genpctrl_stalled_glbl | genpstage_WB_genpctrl_active_glbl);
genpstage_WB_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
gen451_pipex_var = (genpstage_WB_rd_source == ap_uint<32>(5));
gen452_pipex_var = gen451_pipex_var;
gen489_cyclix_var = gen452_pipex_var;
if (gen489_cyclix_var) {
genpstage_WB_rd_wdata = genpstage_WB_mem_rdata;
}
gen453_pipex_var = genpstage_WB_rd_req;
gen490_cyclix_var = gen453_pipex_var;
if (gen490_cyclix_var) {
gen230_pipex_syncreq = ap_uint<32>(1);
gen231_pipex_syncbuf[genpstage_WB_rd_addr] = genpstage_WB_rd_wdata;
}
genpstage_WB_genpctrl_nevictable = (genpstage_WB_genpctrl_nevictable || genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending);
gen491_cyclix_var = genpstage_WB_genpctrl_stalled_glbl;
if (gen491_cyclix_var) {
genpstage_WB_genpctrl_finish = ap_uint<32>(0);
genpstage_WB_genpctrl_succ = ap_uint<32>(0);
}
gen492_cyclix_var = ap_uint<1>(0);
gen492_cyclix_var = (gen492_cyclix_var || gen491_cyclix_var);
gen492_cyclix_var = !gen492_cyclix_var;
if (gen492_cyclix_var) {
genpstage_WB_genpctrl_finish = genpstage_WB_genpctrl_occupied;
genpstage_WB_genpctrl_succ = genpstage_WB_genpctrl_active_glbl;
}
gen493_cyclix_var = genpstage_WB_genpctrl_succ;
if (gen493_cyclix_var) {
gen494_cyclix_var = gen230_pipex_syncreq;
if (gen494_cyclix_var) {
gen495_cyclix_var = gen231_pipex_syncbuf[1];
genpsticky_glbl_regfile[1] = gen495_cyclix_var;
gen496_cyclix_var = gen231_pipex_syncbuf[2];
genpsticky_glbl_regfile[2] = gen496_cyclix_var;
gen497_cyclix_var = gen231_pipex_syncbuf[3];
genpsticky_glbl_regfile[3] = gen497_cyclix_var;
gen498_cyclix_var = gen231_pipex_syncbuf[4];
genpsticky_glbl_regfile[4] = gen498_cyclix_var;
gen499_cyclix_var = gen231_pipex_syncbuf[5];
genpsticky_glbl_regfile[5] = gen499_cyclix_var;
gen500_cyclix_var = gen231_pipex_syncbuf[6];
genpsticky_glbl_regfile[6] = gen500_cyclix_var;
gen501_cyclix_var = gen231_pipex_syncbuf[7];
genpsticky_glbl_regfile[7] = gen501_cyclix_var;
gen502_cyclix_var = gen231_pipex_syncbuf[8];
genpsticky_glbl_regfile[8] = gen502_cyclix_var;
gen503_cyclix_var = gen231_pipex_syncbuf[9];
genpsticky_glbl_regfile[9] = gen503_cyclix_var;
gen504_cyclix_var = gen231_pipex_syncbuf[10];
genpsticky_glbl_regfile[10] = gen504_cyclix_var;
gen505_cyclix_var = gen231_pipex_syncbuf[11];
genpsticky_glbl_regfile[11] = gen505_cyclix_var;
gen506_cyclix_var = gen231_pipex_syncbuf[12];
genpsticky_glbl_regfile[12] = gen506_cyclix_var;
gen507_cyclix_var = gen231_pipex_syncbuf[13];
genpsticky_glbl_regfile[13] = gen507_cyclix_var;
gen508_cyclix_var = gen231_pipex_syncbuf[14];
genpsticky_glbl_regfile[14] = gen508_cyclix_var;
gen509_cyclix_var = gen231_pipex_syncbuf[15];
genpsticky_glbl_regfile[15] = gen509_cyclix_var;
gen510_cyclix_var = gen231_pipex_syncbuf[16];
genpsticky_glbl_regfile[16] = gen510_cyclix_var;
gen511_cyclix_var = gen231_pipex_syncbuf[17];
genpsticky_glbl_regfile[17] = gen511_cyclix_var;
gen512_cyclix_var = gen231_pipex_syncbuf[18];
genpsticky_glbl_regfile[18] = gen512_cyclix_var;
gen513_cyclix_var = gen231_pipex_syncbuf[19];
genpsticky_glbl_regfile[19] = gen513_cyclix_var;
gen514_cyclix_var = gen231_pipex_syncbuf[20];
genpsticky_glbl_regfile[20] = gen514_cyclix_var;
gen515_cyclix_var = gen231_pipex_syncbuf[21];
genpsticky_glbl_regfile[21] = gen515_cyclix_var;
gen516_cyclix_var = gen231_pipex_syncbuf[22];
genpsticky_glbl_regfile[22] = gen516_cyclix_var;
gen517_cyclix_var = gen231_pipex_syncbuf[23];
genpsticky_glbl_regfile[23] = gen517_cyclix_var;
gen518_cyclix_var = gen231_pipex_syncbuf[24];
genpsticky_glbl_regfile[24] = gen518_cyclix_var;
gen519_cyclix_var = gen231_pipex_syncbuf[25];
genpsticky_glbl_regfile[25] = gen519_cyclix_var;
gen520_cyclix_var = gen231_pipex_syncbuf[26];
genpsticky_glbl_regfile[26] = gen520_cyclix_var;
gen521_cyclix_var = gen231_pipex_syncbuf[27];
genpsticky_glbl_regfile[27] = gen521_cyclix_var;
gen522_cyclix_var = gen231_pipex_syncbuf[28];
genpsticky_glbl_regfile[28] = gen522_cyclix_var;
gen523_cyclix_var = gen231_pipex_syncbuf[29];
genpsticky_glbl_regfile[29] = gen523_cyclix_var;
gen524_cyclix_var = gen231_pipex_syncbuf[30];
genpsticky_glbl_regfile[30] = gen524_cyclix_var;
gen525_cyclix_var = gen231_pipex_syncbuf[31];
genpsticky_glbl_regfile[31] = gen525_cyclix_var;
}
}
gen526_cyclix_var = genpstage_WB_genpctrl_finish;
if (gen526_cyclix_var) {
genpstage_WB_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_WB_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_WB_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen527_cyclix_var = ~genpstage_WB_genpctrl_stalled_glbl;
genpstage_WB_genpctrl_rdy = gen527_cyclix_var;
genpstage_WB_genpctrl_working = (genpstage_WB_genpctrl_succ | genpstage_WB_genpctrl_stalled_glbl);
genpstage_MEM_genpctrl_succ = ap_uint<32>(0);
genpstage_MEM_genpctrl_working = ap_uint<32>(0);
gen528_cyclix_var = genpstage_MEM_genpctrl_stalled_glbl;
if (gen528_cyclix_var) {
genpstage_MEM_genpctrl_new = ap_uint<32>(0);
genpstage_MEM_genpctrl_stalled_glbl = ap_uint<32>(0);
gen529_cyclix_var = !genpstage_MEM_genpctrl_killed_glbl;
genpstage_MEM_genpctrl_active_glbl = gen529_cyclix_var;
}
gen530_cyclix_var = ap_uint<1>(0);
gen530_cyclix_var = (gen530_cyclix_var || gen528_cyclix_var);
gen530_cyclix_var = !gen530_cyclix_var;
if (gen530_cyclix_var) {
genpstage_MEM_genpctrl_new = (genpstage_MEM_genpctrl_active_glbl || genpstage_MEM_genpctrl_killed_glbl);
}
genpstage_MEM_genpctrl_finish = ap_uint<32>(0);
genpstage_MEM_genpctrl_flushreq = ap_uint<32>(0);
genpstage_MEM_genpctrl_nevictable = ap_uint<32>(0);
genpstage_MEM_genpctrl_occupied = (genpstage_MEM_genpctrl_active_glbl | genpstage_MEM_genpctrl_killed_glbl);
genpstage_MEM_rd_req = genpstage_MEM_rd_req_genglbl;
genpstage_MEM_rd_addr = genpstage_MEM_rd_addr_genglbl;
genpstage_MEM_rd_rdy = genpstage_MEM_rd_rdy_genglbl;
genpstage_MEM_rd_wdata = genpstage_MEM_rd_wdata_genglbl;
genpstage_MEM_curinstr_addr = genpstage_MEM_curinstr_addr_genglbl;
genpstage_MEM_immediate = genpstage_MEM_immediate_genglbl;
genpstage_MEM_jump_src = genpstage_MEM_jump_src_genglbl;
genpstage_MEM_alu_result = genpstage_MEM_alu_result_genglbl;
genpstage_MEM_jump_req_cond = genpstage_MEM_jump_req_cond_genglbl;
genpstage_MEM_funct3 = genpstage_MEM_funct3_genglbl;
genpstage_MEM_alu_ZF = genpstage_MEM_alu_ZF_genglbl;
genpstage_MEM_alu_CF = genpstage_MEM_alu_CF_genglbl;
genpstage_MEM_jump_req = genpstage_MEM_jump_req_genglbl;
genpstage_MEM_mem_req = genpstage_MEM_mem_req_genglbl;
genpstage_MEM_mem_cmd = genpstage_MEM_mem_cmd_genglbl;
genpstage_MEM_rd_source = genpstage_MEM_rd_source_genglbl;
genpstage_MEM_genpctrl_flushreq = (genpstage_MEM_genpctrl_flushreq | genpstage_WB_genpctrl_flushreq);
gen531_cyclix_var = genpstage_MEM_genpctrl_occupied;
if (gen531_cyclix_var) {
gen532_cyclix_var = genpstage_MEM_genpctrl_new;
if (gen532_cyclix_var) {
genpstage_MEM_data_req_done = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdata = ap_uint<32>(0);
}
gen533_cyclix_var = genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending;
if (gen533_cyclix_var) {
gen534_cyclix_var = (genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id == ap_uint<1>(0));
gen535_cyclix_var = gen534_cyclix_var;
if (gen535_cyclix_var) {
gen536_cyclix_var = (genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid == genmcopipe_data_mem_rd_ptr);
gen537_cyclix_var = gen536_cyclix_var;
if (gen537_cyclix_var) {
gen538_cyclix_var = genmcopipe_data_mem_resp.read_nb(gen456_pipex_mcopipe_rdata);
gen539_cyclix_var = gen538_cyclix_var;
if (gen539_cyclix_var) {
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done = ap_uint<32>(1);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdata = gen456_pipex_mcopipe_rdata;
genmcopipe_data_mem_rd_done = ap_uint<32>(1);
}
}
}
}
gen457_pipex_genpstage_MEM_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen457_pipex_genpstage_MEM_mcopipe_rdreq_inprogress = (gen457_pipex_genpstage_MEM_mcopipe_rdreq_inprogress || genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending);
gen540_cyclix_var = genpstage_MEM_genpctrl_flushreq;
if (gen540_cyclix_var) {
gen541_cyclix_var = genpstage_MEM_genpctrl_active_glbl;
if (gen541_cyclix_var) {
genpstage_MEM_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_MEM_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
}
gen542_cyclix_var = ap_uint<1>(0);
gen542_cyclix_var = (gen542_cyclix_var || gen531_cyclix_var);
gen542_cyclix_var = !gen542_cyclix_var;
if (gen542_cyclix_var) {
genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending = ap_uint<32>(0);
}
gen227_pipex_syncbuf = genpsticky_glbl_jump_req_cmd;
gen229_pipex_syncbuf = genpsticky_glbl_jump_vector_cmd;
gen427_pipex_var = (genpstage_MEM_curinstr_addr + genpstage_MEM_immediate);
genpstage_MEM_curinstraddr_imm = gen427_pipex_var;
switch (genpstage_MEM_jump_src) {
case 0:
genpstage_MEM_jump_vector = genpstage_MEM_immediate;
break;
case 1:
genpstage_MEM_jump_vector = genpstage_MEM_alu_result;
break;
}
gen428_pipex_var = genpstage_MEM_jump_req_cond;
gen543_cyclix_var = gen428_pipex_var;
if (gen543_cyclix_var) {
switch (genpstage_MEM_funct3) {
case 0:
gen429_pipex_var = genpstage_MEM_alu_ZF;
gen544_cyclix_var = gen429_pipex_var;
if (gen544_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
case 1:
gen430_pipex_var = ~genpstage_MEM_alu_ZF;
gen431_pipex_var = gen430_pipex_var;
gen545_cyclix_var = gen431_pipex_var;
if (gen545_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
case 4:
gen432_pipex_var = genpstage_MEM_alu_CF;
gen546_cyclix_var = gen432_pipex_var;
if (gen546_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
case 5:
gen433_pipex_var = ~genpstage_MEM_alu_CF;
gen434_pipex_var = gen433_pipex_var;
gen547_cyclix_var = gen434_pipex_var;
if (gen547_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
case 6:
gen435_pipex_var = genpstage_MEM_alu_CF;
gen548_cyclix_var = gen435_pipex_var;
if (gen548_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
case 7:
gen436_pipex_var = ~genpstage_MEM_alu_CF;
gen437_pipex_var = gen436_pipex_var;
gen549_cyclix_var = gen437_pipex_var;
if (gen549_cyclix_var) {
genpstage_MEM_jump_req = ap_uint<32>(1);
genpstage_MEM_jump_vector = genpstage_MEM_curinstraddr_imm;
}
break;
}
}
genpstage_MEM_mem_addr = genpstage_MEM_alu_result;
genpstage_MEM_mem_wdata = genpstage_MEM_rs2_rdata;
gen226_pipex_syncreq = ap_uint<32>(1);
gen227_pipex_syncbuf = genpstage_MEM_jump_req;
gen228_pipex_syncreq = ap_uint<32>(1);
gen229_pipex_syncbuf = genpstage_MEM_jump_vector;
gen438_pipex_var = genpstage_MEM_jump_req;
gen550_cyclix_var = gen438_pipex_var;
if (gen550_cyclix_var) {
genpstage_MEM_genpctrl_flushreq = (genpstage_MEM_genpctrl_flushreq | genpstage_MEM_genpctrl_active_glbl);
}
gen439_pipex_var = genpstage_MEM_mem_req;
gen551_cyclix_var = gen439_pipex_var;
if (gen551_cyclix_var) {
gen440_pipex_var = ~genpstage_MEM_data_req_done;
gen441_pipex_var = gen440_pipex_var;
gen552_cyclix_var = gen441_pipex_var;
if (gen552_cyclix_var) {
genpstage_MEM_data_busreq.addr = genpstage_MEM_mem_addr;
genpstage_MEM_data_busreq.be = ap_uint<32>(15);
genpstage_MEM_data_busreq.wdata = genpstage_MEM_mem_wdata;
gen553_cyclix_var = genpstage_MEM_genpctrl_active_glbl;
if (gen553_cyclix_var) {
gen554_cyclix_var = ~genmcopipe_data_mem_full_flag;
gen555_cyclix_var = gen554_cyclix_var;
if (gen555_cyclix_var) {
gen458_pipex_req_struct.we = genpstage_MEM_mem_cmd;
gen458_pipex_req_struct.wdata = genpstage_MEM_data_busreq;
gen556_cyclix_var = genmcopipe_data_mem_req.write_nb(gen458_pipex_req_struct);
gen557_cyclix_var = gen556_cyclix_var;
if (gen557_cyclix_var) {
gen442_pipex_var = ap_uint<32>(1);
gen558_cyclix_var = !genpstage_MEM_mem_cmd;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending = gen558_cyclix_var;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid = genmcopipe_data_mem_wr_ptr;
genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id = ap_uint<1>(0);
gen559_cyclix_var = genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending;
if (gen559_cyclix_var) {
genmcopipe_data_mem_wr_done = ap_uint<32>(1);
}
}
}
}
genpstage_MEM_data_req_done = gen442_pipex_var;
}
gen443_pipex_var = ~genpstage_MEM_data_req_done;
gen444_pipex_var = gen443_pipex_var;
gen560_cyclix_var = gen444_pipex_var;
if (gen560_cyclix_var) {
genpstage_MEM_genpctrl_stalled_glbl = (genpstage_MEM_genpctrl_stalled_glbl | genpstage_MEM_genpctrl_active_glbl);
genpstage_MEM_genpctrl_active_glbl = ap_uint<32>(0);
}
}
genpstage_MEM_genpctrl_nevictable = (genpstage_MEM_genpctrl_nevictable || genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending);
gen561_cyclix_var = ~genpstage_WB_genpctrl_rdy;
gen562_cyclix_var = gen561_cyclix_var;
if (gen562_cyclix_var) {
genpstage_MEM_genpctrl_stalled_glbl = (genpstage_MEM_genpctrl_stalled_glbl | genpstage_MEM_genpctrl_active_glbl);
genpstage_MEM_genpctrl_active_glbl = ap_uint<32>(0);
gen563_cyclix_var = genpstage_MEM_genpctrl_nevictable;
if (gen563_cyclix_var) {
genpstage_MEM_genpctrl_occupied = (genpstage_MEM_genpctrl_active_glbl | genpstage_MEM_genpctrl_killed_glbl);
gen564_cyclix_var = genpstage_MEM_genpctrl_occupied;
if (gen564_cyclix_var) {
genpstage_MEM_genpctrl_stalled_glbl = (genpstage_MEM_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
}
gen565_cyclix_var = genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending;
if (gen565_cyclix_var) {
genpstage_MEM_genpctrl_occupied = (genpstage_MEM_genpctrl_active_glbl | genpstage_MEM_genpctrl_killed_glbl);
gen566_cyclix_var = genpstage_MEM_genpctrl_occupied;
if (gen566_cyclix_var) {
genpstage_MEM_genpctrl_stalled_glbl = (genpstage_MEM_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
gen567_cyclix_var = genpstage_MEM_genpctrl_stalled_glbl;
if (gen567_cyclix_var) {
genpstage_MEM_genpctrl_finish = ap_uint<32>(0);
genpstage_MEM_genpctrl_succ = ap_uint<32>(0);
}
gen568_cyclix_var = ap_uint<1>(0);
gen568_cyclix_var = (gen568_cyclix_var || gen567_cyclix_var);
gen568_cyclix_var = !gen568_cyclix_var;
if (gen568_cyclix_var) {
genpstage_MEM_genpctrl_finish = genpstage_MEM_genpctrl_occupied;
genpstage_MEM_genpctrl_succ = genpstage_MEM_genpctrl_active_glbl;
}
gen569_cyclix_var = genpstage_MEM_genpctrl_succ;
if (gen569_cyclix_var) {
gen570_cyclix_var = gen226_pipex_syncreq;
if (gen570_cyclix_var) {
genpsticky_glbl_jump_req_cmd = gen227_pipex_syncbuf;
}
gen571_cyclix_var = gen228_pipex_syncreq;
if (gen571_cyclix_var) {
genpsticky_glbl_jump_vector_cmd = gen229_pipex_syncbuf;
}
}
gen572_cyclix_var = genpstage_MEM_genpctrl_finish;
if (gen572_cyclix_var) {
gen573_cyclix_var = genpstage_WB_genpctrl_rdy;
if (gen573_cyclix_var) {
genpstage_WB_rd_rdy_genglbl = genpstage_MEM_rd_rdy;
genpstage_WB_rd_wdata_genglbl = genpstage_MEM_rd_wdata;
genpstage_WB_genmcopipe_handle_data_mem_genvar_if_id = genpstage_MEM_genmcopipe_handle_data_mem_genvar_if_id;
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdreq_pending = genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdreq_pending;
genpstage_WB_genmcopipe_handle_data_mem_genvar_tid = genpstage_MEM_genmcopipe_handle_data_mem_genvar_tid;
genpstage_WB_genmcopipe_handle_data_mem_genvar_resp_done = genpstage_MEM_genmcopipe_handle_data_mem_genvar_resp_done;
genpstage_WB_genmcopipe_handle_data_mem_genvar_rdata = genpstage_MEM_genmcopipe_handle_data_mem_genvar_rdata;
genpstage_WB_rd_req_genglbl = genpstage_MEM_rd_req;
genpstage_WB_rd_addr_genglbl = genpstage_MEM_rd_addr;
genpstage_WB_mem_req_genglbl = genpstage_MEM_mem_req;
genpstage_WB_mem_cmd_genglbl = genpstage_MEM_mem_cmd;
genpstage_WB_rd_source_genglbl = genpstage_MEM_rd_source;
genpstage_WB_genpctrl_active_glbl = genpstage_MEM_genpctrl_active_glbl;
genpstage_WB_genpctrl_killed_glbl = genpstage_MEM_genpctrl_killed_glbl;
genpstage_WB_genpctrl_stalled_glbl = ap_uint<32>(0);
}
genpstage_MEM_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_MEM_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_MEM_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen574_cyclix_var = ~genpstage_MEM_genpctrl_stalled_glbl;
genpstage_MEM_genpctrl_rdy = gen574_cyclix_var;
genpstage_MEM_genpctrl_working = (genpstage_MEM_genpctrl_succ | genpstage_MEM_genpctrl_stalled_glbl);
genpstage_EXEC_genpctrl_succ = ap_uint<32>(0);
genpstage_EXEC_genpctrl_working = ap_uint<32>(0);
gen575_cyclix_var = genpstage_EXEC_genpctrl_stalled_glbl;
if (gen575_cyclix_var) {
genpstage_EXEC_genpctrl_new = ap_uint<32>(0);
genpstage_EXEC_genpctrl_stalled_glbl = ap_uint<32>(0);
gen576_cyclix_var = !genpstage_EXEC_genpctrl_killed_glbl;
genpstage_EXEC_genpctrl_active_glbl = gen576_cyclix_var;
}
gen577_cyclix_var = ap_uint<1>(0);
gen577_cyclix_var = (gen577_cyclix_var || gen575_cyclix_var);
gen577_cyclix_var = !gen577_cyclix_var;
if (gen577_cyclix_var) {
genpstage_EXEC_genpctrl_new = (genpstage_EXEC_genpctrl_active_glbl || genpstage_EXEC_genpctrl_killed_glbl);
}
genpstage_EXEC_genpctrl_finish = ap_uint<32>(0);
genpstage_EXEC_genpctrl_flushreq = ap_uint<32>(0);
genpstage_EXEC_genpctrl_nevictable = ap_uint<32>(0);
genpstage_EXEC_genpctrl_occupied = (genpstage_EXEC_genpctrl_active_glbl | genpstage_EXEC_genpctrl_killed_glbl);
genpstage_EXEC_rd_req = genpstage_EXEC_rd_req_genglbl;
genpstage_EXEC_rd_addr = genpstage_EXEC_rd_addr_genglbl;
genpstage_EXEC_curinstr_addr = genpstage_EXEC_curinstr_addr_genglbl;
genpstage_EXEC_mret_req = genpstage_EXEC_mret_req_genglbl;
genpstage_EXEC_alu_op1_wide = genpstage_EXEC_alu_op1_wide_genglbl;
genpstage_EXEC_alu_req = genpstage_EXEC_alu_req_genglbl;
genpstage_EXEC_alu_opcode = genpstage_EXEC_alu_opcode_genglbl;
genpstage_EXEC_alu_op2_wide = genpstage_EXEC_alu_op2_wide_genglbl;
genpstage_EXEC_alu_op1 = genpstage_EXEC_alu_op1_genglbl;
genpstage_EXEC_alu_op2 = genpstage_EXEC_alu_op2_genglbl;
genpstage_EXEC_alu_unsigned = genpstage_EXEC_alu_unsigned_genglbl;
genpstage_EXEC_rd_source = genpstage_EXEC_rd_source_genglbl;
genpstage_EXEC_immediate = genpstage_EXEC_immediate_genglbl;
genpstage_EXEC_nextinstr_addr = genpstage_EXEC_nextinstr_addr_genglbl;
genpstage_EXEC_csr_rdata = genpstage_EXEC_csr_rdata_genglbl;
genpstage_EXEC_jump_src = genpstage_EXEC_jump_src_genglbl;
genpstage_EXEC_jump_req_cond = genpstage_EXEC_jump_req_cond_genglbl;
genpstage_EXEC_funct3 = genpstage_EXEC_funct3_genglbl;
genpstage_EXEC_jump_req = genpstage_EXEC_jump_req_genglbl;
genpstage_EXEC_mem_req = genpstage_EXEC_mem_req_genglbl;
genpstage_EXEC_mem_cmd = genpstage_EXEC_mem_cmd_genglbl;
genpstage_EXEC_genpctrl_flushreq = (genpstage_EXEC_genpctrl_flushreq | genpstage_MEM_genpctrl_flushreq);
gen578_cyclix_var = genpstage_EXEC_genpctrl_occupied;
if (gen578_cyclix_var) {
gen579_cyclix_var = genpstage_EXEC_genpctrl_new;
if (gen579_cyclix_var) {
genpstage_EXEC_irq_mcause = ap_uint<32>(0);
genpstage_EXEC_irq_recv = ap_uint<32>(0);
}
gen459_pipex_genpstage_EXEC_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen580_cyclix_var = genpstage_EXEC_genpctrl_flushreq;
if (gen580_cyclix_var) {
gen581_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen581_cyclix_var) {
genpstage_EXEC_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_EXEC_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
}
gen582_cyclix_var = ap_uint<1>(0);
gen582_cyclix_var = (gen582_cyclix_var || gen578_cyclix_var);
gen582_cyclix_var = !gen582_cyclix_var;
if (gen582_cyclix_var) {
}
gen382_pipex_var = genpsticky_glbl_MIRQEN;
gen583_cyclix_var = gen382_pipex_var;
if (gen583_cyclix_var) {
gen383_pipex_var = ~genpstage_EXEC_irq_recv;
gen384_pipex_var = gen383_pipex_var;
gen584_cyclix_var = gen384_pipex_var;
if (gen584_cyclix_var) {
gen585_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen585_cyclix_var) {
gen586_cyclix_var = irq_fifo.read_nb(genpstage_EXEC_irq_mcause);
gen385_pipex_var = gen586_cyclix_var;
}
genpstage_EXEC_irq_recv = gen385_pipex_var;
}
gen386_pipex_var = genpstage_EXEC_irq_recv;
gen587_cyclix_var = gen386_pipex_var;
if (gen587_cyclix_var) {
genpstage_EXEC_jump_req = ap_uint<32>(1);
genpstage_EXEC_jump_req_cond = ap_uint<32>(0);
genpstage_EXEC_jump_src = ap_uint<32>(0);
genpstage_EXEC_rs1_req = ap_uint<32>(0);
genpstage_EXEC_rs2_req = ap_uint<32>(0);
genpstage_EXEC_rd_req = ap_uint<32>(0);
genpstage_EXEC_immediate = ap_uint<32>(128);
genpstage_EXEC_fencereq = ap_uint<32>(0);
genpstage_EXEC_ecallreq = ap_uint<32>(0);
genpstage_EXEC_ebreakreq = ap_uint<32>(0);
genpstage_EXEC_csrreq = ap_uint<32>(0);
genpstage_EXEC_alu_req = ap_uint<32>(0);
genpstage_EXEC_mem_req = ap_uint<32>(0);
gen588_cyclix_var = ~genpstage_EXEC_genpctrl_stalled_glbl;
gen589_cyclix_var = gen588_cyclix_var;
if (gen589_cyclix_var) {
gen590_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen590_cyclix_var) {
genpsticky_glbl_MIRQEN = ap_uint<32>(0);
}
}
gen591_cyclix_var = ~genpstage_EXEC_genpctrl_stalled_glbl;
gen592_cyclix_var = gen591_cyclix_var;
if (gen592_cyclix_var) {
gen593_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen593_cyclix_var) {
genpsticky_glbl_CSR_MCAUSE = genpstage_EXEC_irq_mcause;
}
}
gen594_cyclix_var = ~genpstage_EXEC_genpctrl_stalled_glbl;
gen595_cyclix_var = gen594_cyclix_var;
if (gen595_cyclix_var) {
gen596_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen596_cyclix_var) {
genpsticky_glbl_MRETADDR = genpstage_EXEC_curinstr_addr;
}
}
}
}
gen387_pipex_var = genpstage_EXEC_mret_req;
gen597_cyclix_var = gen387_pipex_var;
if (gen597_cyclix_var) {
gen598_cyclix_var = ~genpstage_EXEC_genpctrl_stalled_glbl;
gen599_cyclix_var = gen598_cyclix_var;
if (gen599_cyclix_var) {
gen600_cyclix_var = genpstage_EXEC_genpctrl_active_glbl;
if (gen600_cyclix_var) {
genpsticky_glbl_MIRQEN = ap_uint<32>(1);
}
}
}
genpstage_EXEC_alu_result_wide = genpstage_EXEC_alu_op1_wide;
gen388_pipex_var = genpstage_EXEC_alu_req;
gen601_cyclix_var = gen388_pipex_var;
if (gen601_cyclix_var) {
switch (genpstage_EXEC_alu_opcode) {
case 0:
gen389_pipex_var = (genpstage_EXEC_alu_op1_wide + genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen389_pipex_var;
break;
case 1:
gen390_pipex_var = (genpstage_EXEC_alu_op1_wide - genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen390_pipex_var;
break;
case 2:
gen391_pipex_var = (genpstage_EXEC_alu_op1_wide & genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen391_pipex_var;
break;
case 3:
gen392_pipex_var = (genpstage_EXEC_alu_op1_wide | genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen392_pipex_var;
break;
case 4:
gen393_pipex_var = (genpstage_EXEC_alu_op1_wide << genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen393_pipex_var;
break;
case 5:
gen394_pipex_var = genpstage_EXEC_alu_op1_wide.range(31, 0);
gen395_pipex_var = ap_uint<32>(0).concat((ap_uint<32>)gen394_pipex_var);
gen396_pipex_var = genpstage_EXEC_alu_op2_wide.range(4, 0);
gen397_pipex_var = (gen395_pipex_var >> gen396_pipex_var);
genpstage_EXEC_alu_result_wide = gen397_pipex_var;
break;
case 6:
gen398_pipex_var = genpstage_EXEC_alu_op1_wide.range(31, 0);
gen399_pipex_var = gen398_pipex_var[31];
gen400_pipex_var = gen399_pipex_var.concat((ap_uint<63>)gen399_pipex_var.concat((ap_uint<62>)gen399_pipex_var.concat((ap_uint<61>)gen399_pipex_var.concat((ap_uint<60>)gen399_pipex_var.concat((ap_uint<59>)gen399_pipex_var.concat((ap_uint<58>)gen399_pipex_var.concat((ap_uint<57>)gen399_pipex_var.concat((ap_uint<56>)gen399_pipex_var.concat((ap_uint<55>)gen399_pipex_var.concat((ap_uint<54>)gen399_pipex_var.concat((ap_uint<53>)gen399_pipex_var.concat((ap_uint<52>)gen399_pipex_var.concat((ap_uint<51>)gen399_pipex_var.concat((ap_uint<50>)gen399_pipex_var.concat((ap_uint<49>)gen399_pipex_var.concat((ap_uint<48>)gen399_pipex_var.concat((ap_uint<47>)gen399_pipex_var.concat((ap_uint<46>)gen399_pipex_var.concat((ap_uint<45>)gen399_pipex_var.concat((ap_uint<44>)gen399_pipex_var.concat((ap_uint<43>)gen399_pipex_var.concat((ap_uint<42>)gen399_pipex_var.concat((ap_uint<41>)gen399_pipex_var.concat((ap_uint<40>)gen399_pipex_var.concat((ap_uint<39>)gen399_pipex_var.concat((ap_uint<38>)gen399_pipex_var.concat((ap_uint<37>)gen399_pipex_var.concat((ap_uint<36>)gen399_pipex_var.concat((ap_uint<35>)gen399_pipex_var.concat((ap_uint<34>)gen399_pipex_var.concat((ap_uint<33>)gen399_pipex_var.concat((ap_uint<32>)gen398_pipex_var))))))))))))))))))))))))))))))));
gen401_pipex_var = genpstage_EXEC_alu_op2_wide.range(4, 0);
gen402_pipex_var = (gen400_pipex_var >> gen401_pipex_var);
genpstage_EXEC_alu_result_wide = gen402_pipex_var;
break;
case 7:
gen403_pipex_var = (genpstage_EXEC_alu_op1_wide ^ genpstage_EXEC_alu_op2_wide);
genpstage_EXEC_alu_result_wide = gen403_pipex_var;
break;
case 8:
gen404_pipex_var = ~genpstage_EXEC_alu_op2_wide;
gen405_pipex_var = (genpstage_EXEC_alu_op1_wide & gen404_pipex_var);
genpstage_EXEC_alu_result_wide = gen405_pipex_var;
break;
}
gen406_pipex_var = genpstage_EXEC_alu_result_wide.range(31, 0);
genpstage_EXEC_alu_result = gen406_pipex_var;
gen407_pipex_var = genpstage_EXEC_alu_result_wide[32];
genpstage_EXEC_alu_CF = gen407_pipex_var;
gen408_pipex_var = genpstage_EXEC_alu_result_wide[31];
genpstage_EXEC_alu_SF = gen408_pipex_var;
gen409_pipex_var = |genpstage_EXEC_alu_result;
gen410_pipex_var = ~gen409_pipex_var;
genpstage_EXEC_alu_ZF = gen410_pipex_var;
gen411_pipex_var = genpstage_EXEC_alu_op1[31];
gen412_pipex_var = ~gen411_pipex_var;
gen413_pipex_var = genpstage_EXEC_alu_op2[31];
gen414_pipex_var = ~gen413_pipex_var;
gen415_pipex_var = genpstage_EXEC_alu_result[31];
gen416_pipex_var = (gen414_pipex_var & gen415_pipex_var);
gen417_pipex_var = (gen412_pipex_var & gen416_pipex_var);
gen418_pipex_var = genpstage_EXEC_alu_op1[31];
gen419_pipex_var = genpstage_EXEC_alu_op2[31];
gen420_pipex_var = genpstage_EXEC_alu_result[31];
gen421_pipex_var = ~gen420_pipex_var;
gen422_pipex_var = (gen419_pipex_var & gen421_pipex_var);
gen423_pipex_var = (gen418_pipex_var & gen422_pipex_var);
gen424_pipex_var = (gen417_pipex_var | gen423_pipex_var);
genpstage_EXEC_alu_OF = gen424_pipex_var;
gen425_pipex_var = genpstage_EXEC_alu_unsigned;
gen602_cyclix_var = gen425_pipex_var;
if (gen602_cyclix_var) {
genpstage_EXEC_alu_overflow = genpstage_EXEC_alu_CF;
}
gen426_pipex_var = ap_uint<1>(0);
gen426_pipex_var = (gen426_pipex_var || gen425_pipex_var);
gen426_pipex_var = !gen426_pipex_var;
gen603_cyclix_var = gen426_pipex_var;
if (gen603_cyclix_var) {
genpstage_EXEC_alu_overflow = genpstage_EXEC_alu_OF;
}
}
switch (genpstage_EXEC_rd_source) {
case 0:
genpstage_EXEC_rd_wdata = genpstage_EXEC_immediate;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
case 1:
genpstage_EXEC_rd_wdata = genpstage_EXEC_alu_result;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
case 2:
genpstage_EXEC_rd_wdata = genpstage_EXEC_alu_CF;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
case 3:
genpstage_EXEC_rd_wdata = genpstage_EXEC_alu_OF;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
case 4:
genpstage_EXEC_rd_wdata = genpstage_EXEC_nextinstr_addr;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
case 6:
genpstage_EXEC_rd_wdata = genpstage_EXEC_csr_rdata;
genpstage_EXEC_rd_rdy = ap_uint<32>(1);
break;
}
gen604_cyclix_var = ~genpstage_MEM_genpctrl_rdy;
gen605_cyclix_var = gen604_cyclix_var;
if (gen605_cyclix_var) {
genpstage_EXEC_genpctrl_stalled_glbl = (genpstage_EXEC_genpctrl_stalled_glbl | genpstage_EXEC_genpctrl_active_glbl);
genpstage_EXEC_genpctrl_active_glbl = ap_uint<32>(0);
gen606_cyclix_var = genpstage_EXEC_genpctrl_nevictable;
if (gen606_cyclix_var) {
genpstage_EXEC_genpctrl_occupied = (genpstage_EXEC_genpctrl_active_glbl | genpstage_EXEC_genpctrl_killed_glbl);
gen607_cyclix_var = genpstage_EXEC_genpctrl_occupied;
if (gen607_cyclix_var) {
genpstage_EXEC_genpctrl_stalled_glbl = (genpstage_EXEC_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
}
gen608_cyclix_var = genpstage_EXEC_genpctrl_stalled_glbl;
if (gen608_cyclix_var) {
genpstage_EXEC_genpctrl_finish = ap_uint<32>(0);
genpstage_EXEC_genpctrl_succ = ap_uint<32>(0);
}
gen609_cyclix_var = ap_uint<1>(0);
gen609_cyclix_var = (gen609_cyclix_var || gen608_cyclix_var);
gen609_cyclix_var = !gen609_cyclix_var;
if (gen609_cyclix_var) {
genpstage_EXEC_genpctrl_finish = genpstage_EXEC_genpctrl_occupied;
genpstage_EXEC_genpctrl_succ = genpstage_EXEC_genpctrl_active_glbl;
}
gen610_cyclix_var = genpstage_EXEC_genpctrl_finish;
if (gen610_cyclix_var) {
gen611_cyclix_var = genpstage_MEM_genpctrl_rdy;
if (gen611_cyclix_var) {
genpstage_MEM_jump_req_genglbl = genpstage_EXEC_jump_req;
genpstage_MEM_rd_req_genglbl = genpstage_EXEC_rd_req;
genpstage_MEM_rd_addr_genglbl = genpstage_EXEC_rd_addr;
genpstage_MEM_rd_rdy_genglbl = genpstage_EXEC_rd_rdy;
genpstage_MEM_rd_wdata_genglbl = genpstage_EXEC_rd_wdata;
genpstage_MEM_curinstr_addr_genglbl = genpstage_EXEC_curinstr_addr;
genpstage_MEM_immediate_genglbl = genpstage_EXEC_immediate;
genpstage_MEM_jump_src_genglbl = genpstage_EXEC_jump_src;
genpstage_MEM_alu_result_genglbl = genpstage_EXEC_alu_result;
genpstage_MEM_jump_req_cond_genglbl = genpstage_EXEC_jump_req_cond;
genpstage_MEM_funct3_genglbl = genpstage_EXEC_funct3;
genpstage_MEM_alu_ZF_genglbl = genpstage_EXEC_alu_ZF;
genpstage_MEM_alu_CF_genglbl = genpstage_EXEC_alu_CF;
genpstage_MEM_rs2_rdata = genpstage_EXEC_rs2_rdata;
genpstage_MEM_mem_req_genglbl = genpstage_EXEC_mem_req;
genpstage_MEM_mem_cmd_genglbl = genpstage_EXEC_mem_cmd;
genpstage_MEM_rd_source_genglbl = genpstage_EXEC_rd_source;
genpstage_MEM_genpctrl_active_glbl = genpstage_EXEC_genpctrl_active_glbl;
genpstage_MEM_genpctrl_killed_glbl = genpstage_EXEC_genpctrl_killed_glbl;
genpstage_MEM_genpctrl_stalled_glbl = ap_uint<32>(0);
}
genpstage_EXEC_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_EXEC_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_EXEC_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen612_cyclix_var = ~genpstage_EXEC_genpctrl_stalled_glbl;
genpstage_EXEC_genpctrl_rdy = gen612_cyclix_var;
genpstage_EXEC_genpctrl_working = (genpstage_EXEC_genpctrl_succ | genpstage_EXEC_genpctrl_stalled_glbl);
genpstage_IDECODE_genpctrl_succ = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_working = ap_uint<32>(0);
gen613_cyclix_var = genpstage_IDECODE_genpctrl_stalled_glbl;
if (gen613_cyclix_var) {
genpstage_IDECODE_genpctrl_new = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_stalled_glbl = ap_uint<32>(0);
gen614_cyclix_var = !genpstage_IDECODE_genpctrl_killed_glbl;
genpstage_IDECODE_genpctrl_active_glbl = gen614_cyclix_var;
}
gen615_cyclix_var = ap_uint<1>(0);
gen615_cyclix_var = (gen615_cyclix_var || gen613_cyclix_var);
gen615_cyclix_var = !gen615_cyclix_var;
if (gen615_cyclix_var) {
genpstage_IDECODE_genpctrl_new = (genpstage_IDECODE_genpctrl_active_glbl || genpstage_IDECODE_genpctrl_killed_glbl);
}
genpstage_IDECODE_genpctrl_finish = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_flushreq = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_nevictable = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_occupied = (genpstage_IDECODE_genpctrl_active_glbl | genpstage_IDECODE_genpctrl_killed_glbl);
genpstage_IDECODE_curinstr_addr = genpstage_IDECODE_curinstr_addr_genglbl;
genpstage_IDECODE_nextinstr_addr = genpstage_IDECODE_nextinstr_addr_genglbl;
genpstage_IDECODE_genpctrl_flushreq = (genpstage_IDECODE_genpctrl_flushreq | genpstage_EXEC_genpctrl_flushreq);
gen616_cyclix_var = genpstage_IDECODE_genpctrl_occupied;
if (gen616_cyclix_var) {
gen617_cyclix_var = genpstage_IDECODE_genpctrl_new;
if (gen617_cyclix_var) {
genpstage_IDECODE_rs1_rdata = ap_uint<32>(0);
genpstage_IDECODE_rs2_rdata = ap_uint<32>(0);
}
gen618_cyclix_var = genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
if (gen618_cyclix_var) {
gen619_cyclix_var = (genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_if_id == ap_uint<1>(0));
gen620_cyclix_var = gen619_cyclix_var;
if (gen620_cyclix_var) {
gen621_cyclix_var = (genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_tid == genmcopipe_instr_mem_rd_ptr);
gen622_cyclix_var = gen621_cyclix_var;
if (gen622_cyclix_var) {
gen623_cyclix_var = genmcopipe_instr_mem_resp.read_nb(gen460_pipex_mcopipe_rdata);
gen624_cyclix_var = gen623_cyclix_var;
if (gen624_cyclix_var) {
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done = ap_uint<32>(1);
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdata = gen460_pipex_mcopipe_rdata;
genmcopipe_instr_mem_rd_done = ap_uint<32>(1);
}
}
}
}
gen461_pipex_genpstage_IDECODE_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen461_pipex_genpstage_IDECODE_mcopipe_rdreq_inprogress = (gen461_pipex_genpstage_IDECODE_mcopipe_rdreq_inprogress || genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending);
gen625_cyclix_var = genpstage_IDECODE_genpctrl_flushreq;
if (gen625_cyclix_var) {
gen626_cyclix_var = genpstage_IDECODE_genpctrl_active_glbl;
if (gen626_cyclix_var) {
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
}
gen627_cyclix_var = ap_uint<1>(0);
gen627_cyclix_var = (gen627_cyclix_var || gen616_cyclix_var);
gen627_cyclix_var = !gen627_cyclix_var;
if (gen627_cyclix_var) {
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending = ap_uint<32>(0);
}
gen628_cyclix_var = genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done;
if (gen628_cyclix_var) {
genpstage_IDECODE_instr_code = genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdata;
}
gen239_pipex_var = genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done;
gen240_pipex_var = ~gen239_pipex_var;
gen241_pipex_var = gen240_pipex_var;
gen629_cyclix_var = gen241_pipex_var;
if (gen629_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
gen242_pipex_var = genpstage_IDECODE_instr_code.range(6, 0);
genpstage_IDECODE_opcode = gen242_pipex_var;
genpstage_IDECODE_alu_unsigned = ap_uint<32>(0);
gen243_pipex_var = genpstage_IDECODE_instr_code.range(19, 15);
genpstage_IDECODE_rs1_addr = gen243_pipex_var;
gen244_pipex_var = genpstage_IDECODE_instr_code.range(24, 20);
genpstage_IDECODE_rs2_addr = gen244_pipex_var;
gen245_pipex_var = genpstage_IDECODE_instr_code.range(11, 7);
genpstage_IDECODE_rd_addr = gen245_pipex_var;
gen246_pipex_var = genpstage_IDECODE_instr_code.range(14, 12);
genpstage_IDECODE_funct3 = gen246_pipex_var;
gen247_pipex_var = genpstage_IDECODE_instr_code.range(31, 25);
genpstage_IDECODE_funct7 = gen247_pipex_var;
gen248_pipex_var = genpstage_IDECODE_instr_code.range(24, 20);
genpstage_IDECODE_shamt = gen248_pipex_var;
gen249_pipex_var = genpstage_IDECODE_instr_code.range(27, 24);
genpstage_IDECODE_pred = gen249_pipex_var;
gen250_pipex_var = genpstage_IDECODE_instr_code.range(23, 20);
genpstage_IDECODE_succ = gen250_pipex_var;
gen251_pipex_var = genpstage_IDECODE_instr_code.range(31, 20);
genpstage_IDECODE_csrnum = gen251_pipex_var;
gen252_pipex_var = genpstage_IDECODE_instr_code.range(19, 15);
genpstage_IDECODE_zimm = gen252_pipex_var;
gen253_pipex_var = genpstage_IDECODE_instr_code.range(31, 20);
gen254_pipex_var = gen253_pipex_var[31];
gen255_pipex_var = gen254_pipex_var.concat((ap_uint<31>)gen254_pipex_var.concat((ap_uint<30>)gen254_pipex_var.concat((ap_uint<29>)gen254_pipex_var.concat((ap_uint<28>)gen254_pipex_var.concat((ap_uint<27>)gen254_pipex_var.concat((ap_uint<26>)gen254_pipex_var.concat((ap_uint<25>)gen254_pipex_var.concat((ap_uint<24>)gen254_pipex_var.concat((ap_uint<23>)gen254_pipex_var.concat((ap_uint<22>)gen254_pipex_var.concat((ap_uint<21>)gen254_pipex_var.concat((ap_uint<20>)gen254_pipex_var.concat((ap_uint<19>)gen254_pipex_var.concat((ap_uint<18>)gen254_pipex_var.concat((ap_uint<17>)gen254_pipex_var.concat((ap_uint<16>)gen254_pipex_var.concat((ap_uint<15>)gen254_pipex_var.concat((ap_uint<14>)gen254_pipex_var.concat((ap_uint<13>)gen254_pipex_var.concat((ap_uint<12>)gen253_pipex_var))))))))))))))))))));
genpstage_IDECODE_immediate_I = gen255_pipex_var;
gen256_pipex_var = genpstage_IDECODE_instr_code.range(31, 25);
gen257_pipex_var = genpstage_IDECODE_instr_code.range(11, 7);
gen258_pipex_var = gen256_pipex_var.concat((ap_uint<5>)gen257_pipex_var);
gen259_pipex_var = gen258_pipex_var[11];
gen260_pipex_var = gen259_pipex_var.concat((ap_uint<31>)gen259_pipex_var.concat((ap_uint<30>)gen259_pipex_var.concat((ap_uint<29>)gen259_pipex_var.concat((ap_uint<28>)gen259_pipex_var.concat((ap_uint<27>)gen259_pipex_var.concat((ap_uint<26>)gen259_pipex_var.concat((ap_uint<25>)gen259_pipex_var.concat((ap_uint<24>)gen259_pipex_var.concat((ap_uint<23>)gen259_pipex_var.concat((ap_uint<22>)gen259_pipex_var.concat((ap_uint<21>)gen259_pipex_var.concat((ap_uint<20>)gen259_pipex_var.concat((ap_uint<19>)gen259_pipex_var.concat((ap_uint<18>)gen259_pipex_var.concat((ap_uint<17>)gen259_pipex_var.concat((ap_uint<16>)gen259_pipex_var.concat((ap_uint<15>)gen259_pipex_var.concat((ap_uint<14>)gen259_pipex_var.concat((ap_uint<13>)gen259_pipex_var.concat((ap_uint<12>)gen258_pipex_var))))))))))))))))))));
genpstage_IDECODE_immediate_S = gen260_pipex_var;
gen261_pipex_var = genpstage_IDECODE_instr_code[31];
gen262_pipex_var = genpstage_IDECODE_instr_code[7];
gen263_pipex_var = genpstage_IDECODE_instr_code.range(30, 25);
gen264_pipex_var = genpstage_IDECODE_instr_code.range(11, 8);
gen265_pipex_var = gen261_pipex_var.concat((ap_uint<12>)gen262_pipex_var.concat((ap_uint<11>)gen263_pipex_var.concat((ap_uint<5>)gen264_pipex_var.concat((ap_uint<1>)ap_uint<1>(0)))));
gen266_pipex_var = gen265_pipex_var[12];
gen267_pipex_var = gen266_pipex_var.concat((ap_uint<31>)gen266_pipex_var.concat((ap_uint<30>)gen266_pipex_var.concat((ap_uint<29>)gen266_pipex_var.concat((ap_uint<28>)gen266_pipex_var.concat((ap_uint<27>)gen266_pipex_var.concat((ap_uint<26>)gen266_pipex_var.concat((ap_uint<25>)gen266_pipex_var.concat((ap_uint<24>)gen266_pipex_var.concat((ap_uint<23>)gen266_pipex_var.concat((ap_uint<22>)gen266_pipex_var.concat((ap_uint<21>)gen266_pipex_var.concat((ap_uint<20>)gen266_pipex_var.concat((ap_uint<19>)gen266_pipex_var.concat((ap_uint<18>)gen266_pipex_var.concat((ap_uint<17>)gen266_pipex_var.concat((ap_uint<16>)gen266_pipex_var.concat((ap_uint<15>)gen266_pipex_var.concat((ap_uint<14>)gen266_pipex_var.concat((ap_uint<13>)gen265_pipex_var)))))))))))))))))));
genpstage_IDECODE_immediate_B = gen267_pipex_var;
gen268_pipex_var = genpstage_IDECODE_instr_code.range(31, 12);
gen269_pipex_var = gen268_pipex_var.concat((ap_uint<12>)ap_uint<12>(0));
genpstage_IDECODE_immediate_U = gen269_pipex_var;
gen270_pipex_var = genpstage_IDECODE_instr_code[31];
gen271_pipex_var = genpstage_IDECODE_instr_code.range(19, 12);
gen272_pipex_var = genpstage_IDECODE_instr_code[20];
gen273_pipex_var = genpstage_IDECODE_instr_code.range(30, 21);
gen274_pipex_var = gen270_pipex_var.concat((ap_uint<20>)gen271_pipex_var.concat((ap_uint<12>)gen272_pipex_var.concat((ap_uint<11>)gen273_pipex_var.concat((ap_uint<1>)ap_uint<1>(0)))));
gen275_pipex_var = gen274_pipex_var[20];
gen276_pipex_var = gen275_pipex_var.concat((ap_uint<31>)gen275_pipex_var.concat((ap_uint<30>)gen275_pipex_var.concat((ap_uint<29>)gen275_pipex_var.concat((ap_uint<28>)gen275_pipex_var.concat((ap_uint<27>)gen275_pipex_var.concat((ap_uint<26>)gen275_pipex_var.concat((ap_uint<25>)gen275_pipex_var.concat((ap_uint<24>)gen275_pipex_var.concat((ap_uint<23>)gen275_pipex_var.concat((ap_uint<22>)gen275_pipex_var.concat((ap_uint<21>)gen274_pipex_var)))))))))));
genpstage_IDECODE_immediate_J = gen276_pipex_var;
switch (genpstage_IDECODE_opcode) {
case 55:
genpstage_IDECODE_op1_source = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(0);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_U;
break;
case 23:
genpstage_IDECODE_op1_source = ap_uint<32>(2);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(0);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_U;
break;
case 111:
genpstage_IDECODE_op1_source = ap_uint<32>(2);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(0);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(4);
genpstage_IDECODE_jump_req = ap_uint<32>(1);
genpstage_IDECODE_jump_src = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_J;
break;
case 103:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(0);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(4);
genpstage_IDECODE_jump_req = ap_uint<32>(1);
genpstage_IDECODE_jump_src = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_I;
break;
case 99:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rs2_req = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
genpstage_IDECODE_jump_req_cond = ap_uint<32>(1);
genpstage_IDECODE_jump_src = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_B;
gen277_pipex_var = (genpstage_IDECODE_funct3 == ap_uint<32>(6));
gen278_pipex_var = (genpstage_IDECODE_funct3 == ap_uint<32>(7));
gen279_pipex_var = (gen277_pipex_var | gen278_pipex_var);
gen280_pipex_var = gen279_pipex_var;
gen630_cyclix_var = gen280_pipex_var;
if (gen630_cyclix_var) {
genpstage_IDECODE_alu_unsigned = ap_uint<32>(1);
}
break;
case 3:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(5);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_mem_req = ap_uint<32>(1);
genpstage_IDECODE_mem_cmd = ap_uint<32>(0);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_I;
break;
case 35:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rs2_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_mem_req = ap_uint<32>(1);
genpstage_IDECODE_mem_cmd = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_S;
break;
case 19:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_immediate = genpstage_IDECODE_immediate_I;
genpstage_IDECODE_alu_req = ap_uint<32>(1);
switch (genpstage_IDECODE_funct3) {
case 0:
genpstage_IDECODE_alu_opcode = ap_uint<32>(0);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 1:
genpstage_IDECODE_alu_opcode = ap_uint<32>(4);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
gen281_pipex_var = genpstage_IDECODE_instr_code.range(24, 20);
gen282_pipex_var = ap_uint<27>(0).concat((ap_uint<5>)gen281_pipex_var);
genpstage_IDECODE_immediate = gen282_pipex_var;
break;
case 2:
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(2);
break;
case 3:
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
genpstage_IDECODE_alu_unsigned = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(2);
break;
case 4:
genpstage_IDECODE_alu_opcode = ap_uint<32>(7);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 5:
gen283_pipex_var = genpstage_IDECODE_instr_code[30];
gen284_pipex_var = gen283_pipex_var;
gen631_cyclix_var = gen284_pipex_var;
if (gen631_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(6);
}
gen285_pipex_var = ap_uint<1>(0);
gen285_pipex_var = (gen285_pipex_var || gen284_pipex_var);
gen285_pipex_var = !gen285_pipex_var;
gen632_cyclix_var = gen285_pipex_var;
if (gen632_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(5);
}
genpstage_IDECODE_rd_source = ap_uint<32>(1);
gen286_pipex_var = genpstage_IDECODE_instr_code.range(24, 20);
gen287_pipex_var = ap_uint<27>(0).concat((ap_uint<5>)gen286_pipex_var);
genpstage_IDECODE_immediate = gen287_pipex_var;
break;
case 6:
genpstage_IDECODE_alu_opcode = ap_uint<32>(3);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 7:
genpstage_IDECODE_alu_opcode = ap_uint<32>(2);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
}
break;
case 51:
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rs2_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(0);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
switch (genpstage_IDECODE_funct3) {
case 0:
gen288_pipex_var = genpstage_IDECODE_instr_code[30];
gen289_pipex_var = gen288_pipex_var;
gen633_cyclix_var = gen289_pipex_var;
if (gen633_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
}
gen290_pipex_var = ap_uint<1>(0);
gen290_pipex_var = (gen290_pipex_var || gen289_pipex_var);
gen290_pipex_var = !gen290_pipex_var;
gen634_cyclix_var = gen290_pipex_var;
if (gen634_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(0);
}
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 1:
genpstage_IDECODE_alu_opcode = ap_uint<32>(4);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 2:
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(2);
break;
case 3:
genpstage_IDECODE_alu_opcode = ap_uint<32>(1);
genpstage_IDECODE_alu_unsigned = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(2);
break;
case 4:
genpstage_IDECODE_alu_opcode = ap_uint<32>(7);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 5:
gen291_pipex_var = genpstage_IDECODE_instr_code[30];
gen292_pipex_var = gen291_pipex_var;
gen635_cyclix_var = gen292_pipex_var;
if (gen635_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(6);
}
gen293_pipex_var = ap_uint<1>(0);
gen293_pipex_var = (gen293_pipex_var || gen292_pipex_var);
gen293_pipex_var = !gen293_pipex_var;
gen636_cyclix_var = gen293_pipex_var;
if (gen636_cyclix_var) {
genpstage_IDECODE_alu_opcode = ap_uint<32>(5);
}
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 6:
genpstage_IDECODE_alu_opcode = ap_uint<32>(3);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
case 7:
genpstage_IDECODE_alu_opcode = ap_uint<32>(2);
genpstage_IDECODE_rd_source = ap_uint<32>(1);
break;
}
break;
case 15:
genpstage_IDECODE_fencereq = ap_uint<32>(1);
break;
case 115:
switch (genpstage_IDECODE_funct3) {
case 0:
gen294_pipex_var = genpstage_IDECODE_instr_code[20];
gen295_pipex_var = gen294_pipex_var;
gen637_cyclix_var = gen295_pipex_var;
if (gen637_cyclix_var) {
genpstage_IDECODE_ebreakreq = ap_uint<32>(1);
}
gen296_pipex_var = ap_uint<1>(0);
gen296_pipex_var = (gen296_pipex_var || gen295_pipex_var);
gen296_pipex_var = !gen296_pipex_var;
gen638_cyclix_var = gen296_pipex_var;
if (gen638_cyclix_var) {
genpstage_IDECODE_ecallreq = ap_uint<32>(1);
}
break;
case 1:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(6);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
break;
case 2:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(6);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(3);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
break;
case 3:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rs1_req = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(6);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(8);
genpstage_IDECODE_op1_source = ap_uint<32>(0);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
break;
case 5:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_op1_source = ap_uint<32>(1);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
gen297_pipex_var = ap_uint<27>(0).concat((ap_uint<5>)genpstage_IDECODE_zimm);
genpstage_IDECODE_immediate = gen297_pipex_var;
break;
case 6:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(6);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(8);
genpstage_IDECODE_op1_source = ap_uint<32>(1);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
gen298_pipex_var = ap_uint<27>(0).concat((ap_uint<5>)genpstage_IDECODE_zimm);
genpstage_IDECODE_immediate = gen298_pipex_var;
break;
case 7:
genpstage_IDECODE_csrreq = ap_uint<32>(1);
genpstage_IDECODE_rd_req = ap_uint<32>(1);
genpstage_IDECODE_rd_source = ap_uint<32>(6);
genpstage_IDECODE_alu_req = ap_uint<32>(1);
genpstage_IDECODE_alu_opcode = ap_uint<32>(8);
genpstage_IDECODE_op1_source = ap_uint<32>(1);
genpstage_IDECODE_op2_source = ap_uint<32>(2);
gen299_pipex_var = ap_uint<27>(0).concat((ap_uint<5>)genpstage_IDECODE_zimm);
genpstage_IDECODE_immediate = gen299_pipex_var;
break;
}
break;
}
gen300_pipex_var = genpstage_IDECODE_mem_req;
gen639_cyclix_var = gen300_pipex_var;
if (gen639_cyclix_var) {
switch (genpstage_IDECODE_funct3) {
case 0:
genpstage_IDECODE_mem_be = ap_uint<32>(1);
break;
case 1:
genpstage_IDECODE_mem_be = ap_uint<32>(3);
break;
case 2:
genpstage_IDECODE_mem_be = ap_uint<32>(15);
break;
case 4:
genpstage_IDECODE_mem_be = ap_uint<32>(1);
break;
case 5:
genpstage_IDECODE_mem_be = ap_uint<32>(3);
break;
}
}
gen301_pipex_var = (genpstage_IDECODE_instr_code == ap_uint<32>(807403635));
gen302_pipex_var = gen301_pipex_var;
gen640_cyclix_var = gen302_pipex_var;
if (gen640_cyclix_var) {
genpstage_IDECODE_mret_req = ap_uint<32>(1);
genpstage_IDECODE_jump_req = ap_uint<32>(1);
genpstage_IDECODE_jump_req_cond = ap_uint<32>(0);
genpstage_IDECODE_jump_src = ap_uint<32>(0);
genpstage_IDECODE_immediate = genpsticky_glbl_MRETADDR;
}
gen303_pipex_var = (genpstage_IDECODE_rd_addr == ap_uint<32>(0));
gen304_pipex_var = gen303_pipex_var;
gen641_cyclix_var = gen304_pipex_var;
if (gen641_cyclix_var) {
genpstage_IDECODE_rd_req = ap_uint<32>(0);
}
gen642_cyclix_var = genpsticky_glbl_regfile_buf[1];
gen305_pipex_var[1] = gen642_cyclix_var;
gen643_cyclix_var = genpsticky_glbl_regfile_buf[2];
gen305_pipex_var[2] = gen643_cyclix_var;
gen644_cyclix_var = genpsticky_glbl_regfile_buf[3];
gen305_pipex_var[3] = gen644_cyclix_var;
gen645_cyclix_var = genpsticky_glbl_regfile_buf[4];
gen305_pipex_var[4] = gen645_cyclix_var;
gen646_cyclix_var = genpsticky_glbl_regfile_buf[5];
gen305_pipex_var[5] = gen646_cyclix_var;
gen647_cyclix_var = genpsticky_glbl_regfile_buf[6];
gen305_pipex_var[6] = gen647_cyclix_var;
gen648_cyclix_var = genpsticky_glbl_regfile_buf[7];
gen305_pipex_var[7] = gen648_cyclix_var;
gen649_cyclix_var = genpsticky_glbl_regfile_buf[8];
gen305_pipex_var[8] = gen649_cyclix_var;
gen650_cyclix_var = genpsticky_glbl_regfile_buf[9];
gen305_pipex_var[9] = gen650_cyclix_var;
gen651_cyclix_var = genpsticky_glbl_regfile_buf[10];
gen305_pipex_var[10] = gen651_cyclix_var;
gen652_cyclix_var = genpsticky_glbl_regfile_buf[11];
gen305_pipex_var[11] = gen652_cyclix_var;
gen653_cyclix_var = genpsticky_glbl_regfile_buf[12];
gen305_pipex_var[12] = gen653_cyclix_var;
gen654_cyclix_var = genpsticky_glbl_regfile_buf[13];
gen305_pipex_var[13] = gen654_cyclix_var;
gen655_cyclix_var = genpsticky_glbl_regfile_buf[14];
gen305_pipex_var[14] = gen655_cyclix_var;
gen656_cyclix_var = genpsticky_glbl_regfile_buf[15];
gen305_pipex_var[15] = gen656_cyclix_var;
gen657_cyclix_var = genpsticky_glbl_regfile_buf[16];
gen305_pipex_var[16] = gen657_cyclix_var;
gen658_cyclix_var = genpsticky_glbl_regfile_buf[17];
gen305_pipex_var[17] = gen658_cyclix_var;
gen659_cyclix_var = genpsticky_glbl_regfile_buf[18];
gen305_pipex_var[18] = gen659_cyclix_var;
gen660_cyclix_var = genpsticky_glbl_regfile_buf[19];
gen305_pipex_var[19] = gen660_cyclix_var;
gen661_cyclix_var = genpsticky_glbl_regfile_buf[20];
gen305_pipex_var[20] = gen661_cyclix_var;
gen662_cyclix_var = genpsticky_glbl_regfile_buf[21];
gen305_pipex_var[21] = gen662_cyclix_var;
gen663_cyclix_var = genpsticky_glbl_regfile_buf[22];
gen305_pipex_var[22] = gen663_cyclix_var;
gen664_cyclix_var = genpsticky_glbl_regfile_buf[23];
gen305_pipex_var[23] = gen664_cyclix_var;
gen665_cyclix_var = genpsticky_glbl_regfile_buf[24];
gen305_pipex_var[24] = gen665_cyclix_var;
gen666_cyclix_var = genpsticky_glbl_regfile_buf[25];
gen305_pipex_var[25] = gen666_cyclix_var;
gen667_cyclix_var = genpsticky_glbl_regfile_buf[26];
gen305_pipex_var[26] = gen667_cyclix_var;
gen668_cyclix_var = genpsticky_glbl_regfile_buf[27];
gen305_pipex_var[27] = gen668_cyclix_var;
gen669_cyclix_var = genpsticky_glbl_regfile_buf[28];
gen305_pipex_var[28] = gen669_cyclix_var;
gen670_cyclix_var = genpsticky_glbl_regfile_buf[29];
gen305_pipex_var[29] = gen670_cyclix_var;
gen671_cyclix_var = genpsticky_glbl_regfile_buf[30];
gen305_pipex_var[30] = gen671_cyclix_var;
gen672_cyclix_var = genpsticky_glbl_regfile_buf[31];
gen305_pipex_var[31] = gen672_cyclix_var;
gen306_pipex_var = gen305_pipex_var[genpstage_IDECODE_rs1_addr];
genpstage_IDECODE_rs1_rdata = gen306_pipex_var;
gen673_cyclix_var = genpsticky_glbl_regfile_buf[1];
gen307_pipex_var[1] = gen673_cyclix_var;
gen674_cyclix_var = genpsticky_glbl_regfile_buf[2];
gen307_pipex_var[2] = gen674_cyclix_var;
gen675_cyclix_var = genpsticky_glbl_regfile_buf[3];
gen307_pipex_var[3] = gen675_cyclix_var;
gen676_cyclix_var = genpsticky_glbl_regfile_buf[4];
gen307_pipex_var[4] = gen676_cyclix_var;
gen677_cyclix_var = genpsticky_glbl_regfile_buf[5];
gen307_pipex_var[5] = gen677_cyclix_var;
gen678_cyclix_var = genpsticky_glbl_regfile_buf[6];
gen307_pipex_var[6] = gen678_cyclix_var;
gen679_cyclix_var = genpsticky_glbl_regfile_buf[7];
gen307_pipex_var[7] = gen679_cyclix_var;
gen680_cyclix_var = genpsticky_glbl_regfile_buf[8];
gen307_pipex_var[8] = gen680_cyclix_var;
gen681_cyclix_var = genpsticky_glbl_regfile_buf[9];
gen307_pipex_var[9] = gen681_cyclix_var;
gen682_cyclix_var = genpsticky_glbl_regfile_buf[10];
gen307_pipex_var[10] = gen682_cyclix_var;
gen683_cyclix_var = genpsticky_glbl_regfile_buf[11];
gen307_pipex_var[11] = gen683_cyclix_var;
gen684_cyclix_var = genpsticky_glbl_regfile_buf[12];
gen307_pipex_var[12] = gen684_cyclix_var;
gen685_cyclix_var = genpsticky_glbl_regfile_buf[13];
gen307_pipex_var[13] = gen685_cyclix_var;
gen686_cyclix_var = genpsticky_glbl_regfile_buf[14];
gen307_pipex_var[14] = gen686_cyclix_var;
gen687_cyclix_var = genpsticky_glbl_regfile_buf[15];
gen307_pipex_var[15] = gen687_cyclix_var;
gen688_cyclix_var = genpsticky_glbl_regfile_buf[16];
gen307_pipex_var[16] = gen688_cyclix_var;
gen689_cyclix_var = genpsticky_glbl_regfile_buf[17];
gen307_pipex_var[17] = gen689_cyclix_var;
gen690_cyclix_var = genpsticky_glbl_regfile_buf[18];
gen307_pipex_var[18] = gen690_cyclix_var;
gen691_cyclix_var = genpsticky_glbl_regfile_buf[19];
gen307_pipex_var[19] = gen691_cyclix_var;
gen692_cyclix_var = genpsticky_glbl_regfile_buf[20];
gen307_pipex_var[20] = gen692_cyclix_var;
gen693_cyclix_var = genpsticky_glbl_regfile_buf[21];
gen307_pipex_var[21] = gen693_cyclix_var;
gen694_cyclix_var = genpsticky_glbl_regfile_buf[22];
gen307_pipex_var[22] = gen694_cyclix_var;
gen695_cyclix_var = genpsticky_glbl_regfile_buf[23];
gen307_pipex_var[23] = gen695_cyclix_var;
gen696_cyclix_var = genpsticky_glbl_regfile_buf[24];
gen307_pipex_var[24] = gen696_cyclix_var;
gen697_cyclix_var = genpsticky_glbl_regfile_buf[25];
gen307_pipex_var[25] = gen697_cyclix_var;
gen698_cyclix_var = genpsticky_glbl_regfile_buf[26];
gen307_pipex_var[26] = gen698_cyclix_var;
gen699_cyclix_var = genpsticky_glbl_regfile_buf[27];
gen307_pipex_var[27] = gen699_cyclix_var;
gen700_cyclix_var = genpsticky_glbl_regfile_buf[28];
gen307_pipex_var[28] = gen700_cyclix_var;
gen701_cyclix_var = genpsticky_glbl_regfile_buf[29];
gen307_pipex_var[29] = gen701_cyclix_var;
gen702_cyclix_var = genpsticky_glbl_regfile_buf[30];
gen307_pipex_var[30] = gen702_cyclix_var;
gen703_cyclix_var = genpsticky_glbl_regfile_buf[31];
gen307_pipex_var[31] = gen703_cyclix_var;
gen308_pipex_var = gen307_pipex_var[genpstage_IDECODE_rs2_addr];
genpstage_IDECODE_rs2_rdata = gen308_pipex_var;
gen309_pipex_var = (genpstage_IDECODE_rs1_addr == ap_uint<32>(0));
gen310_pipex_var = gen309_pipex_var;
gen704_cyclix_var = gen310_pipex_var;
if (gen704_cyclix_var) {
genpstage_IDECODE_rs1_rdata = ap_uint<32>(0);
}
gen311_pipex_var = (genpstage_IDECODE_rs2_addr == ap_uint<32>(0));
gen312_pipex_var = gen311_pipex_var;
gen705_cyclix_var = gen312_pipex_var;
if (gen705_cyclix_var) {
genpstage_IDECODE_rs2_rdata = ap_uint<32>(0);
}
gen313_pipex_var = genpstage_IDECODE_csrreq;
gen706_cyclix_var = gen313_pipex_var;
if (gen706_cyclix_var) {
genpstage_IDECODE_csr_rdata = genpsticky_glbl_CSR_MCAUSE;
}
gen314_pipex_var = genpstage_WB_genpctrl_working;
gen315_pipex_var = genpstage_WB_rd_req;
gen316_pipex_var = (gen314_pipex_var & gen315_pipex_var);
gen317_pipex_var = gen316_pipex_var;
gen707_cyclix_var = gen317_pipex_var;
if (gen707_cyclix_var) {
gen318_pipex_var = genpstage_IDECODE_rs1_req;
gen708_cyclix_var = gen318_pipex_var;
if (gen708_cyclix_var) {
gen319_pipex_var = genpstage_WB_rd_addr;
gen320_pipex_var = (gen319_pipex_var == genpstage_IDECODE_rs1_addr);
gen321_pipex_var = gen320_pipex_var;
gen709_cyclix_var = gen321_pipex_var;
if (gen709_cyclix_var) {
gen322_pipex_var = genpstage_WB_rd_rdy;
gen323_pipex_var = gen322_pipex_var;
gen710_cyclix_var = gen323_pipex_var;
if (gen710_cyclix_var) {
gen324_pipex_var = genpstage_WB_rd_wdata;
genpstage_IDECODE_rs1_rdata = gen324_pipex_var;
}
gen325_pipex_var = ap_uint<1>(0);
gen325_pipex_var = (gen325_pipex_var || gen323_pipex_var);
gen325_pipex_var = !gen325_pipex_var;
gen711_cyclix_var = gen325_pipex_var;
if (gen711_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
gen326_pipex_var = genpstage_IDECODE_rs2_req;
gen712_cyclix_var = gen326_pipex_var;
if (gen712_cyclix_var) {
gen327_pipex_var = genpstage_WB_rd_addr;
gen328_pipex_var = (gen327_pipex_var == genpstage_IDECODE_rs2_addr);
gen329_pipex_var = gen328_pipex_var;
gen713_cyclix_var = gen329_pipex_var;
if (gen713_cyclix_var) {
gen330_pipex_var = genpstage_WB_rd_rdy;
gen331_pipex_var = gen330_pipex_var;
gen714_cyclix_var = gen331_pipex_var;
if (gen714_cyclix_var) {
gen332_pipex_var = genpstage_WB_rd_wdata;
genpstage_IDECODE_rs2_rdata = gen332_pipex_var;
}
gen333_pipex_var = ap_uint<1>(0);
gen333_pipex_var = (gen333_pipex_var || gen331_pipex_var);
gen333_pipex_var = !gen333_pipex_var;
gen715_cyclix_var = gen333_pipex_var;
if (gen715_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
}
gen334_pipex_var = genpstage_MEM_genpctrl_working;
gen335_pipex_var = genpstage_MEM_rd_req;
gen336_pipex_var = (gen334_pipex_var & gen335_pipex_var);
gen337_pipex_var = gen336_pipex_var;
gen716_cyclix_var = gen337_pipex_var;
if (gen716_cyclix_var) {
gen338_pipex_var = genpstage_IDECODE_rs1_req;
gen717_cyclix_var = gen338_pipex_var;
if (gen717_cyclix_var) {
gen339_pipex_var = genpstage_MEM_rd_addr;
gen340_pipex_var = (gen339_pipex_var == genpstage_IDECODE_rs1_addr);
gen341_pipex_var = gen340_pipex_var;
gen718_cyclix_var = gen341_pipex_var;
if (gen718_cyclix_var) {
gen342_pipex_var = genpstage_MEM_rd_rdy;
gen343_pipex_var = gen342_pipex_var;
gen719_cyclix_var = gen343_pipex_var;
if (gen719_cyclix_var) {
gen344_pipex_var = genpstage_MEM_rd_wdata;
genpstage_IDECODE_rs1_rdata = gen344_pipex_var;
}
gen345_pipex_var = ap_uint<1>(0);
gen345_pipex_var = (gen345_pipex_var || gen343_pipex_var);
gen345_pipex_var = !gen345_pipex_var;
gen720_cyclix_var = gen345_pipex_var;
if (gen720_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
gen346_pipex_var = genpstage_IDECODE_rs2_req;
gen721_cyclix_var = gen346_pipex_var;
if (gen721_cyclix_var) {
gen347_pipex_var = genpstage_MEM_rd_addr;
gen348_pipex_var = (gen347_pipex_var == genpstage_IDECODE_rs2_addr);
gen349_pipex_var = gen348_pipex_var;
gen722_cyclix_var = gen349_pipex_var;
if (gen722_cyclix_var) {
gen350_pipex_var = genpstage_MEM_rd_rdy;
gen351_pipex_var = gen350_pipex_var;
gen723_cyclix_var = gen351_pipex_var;
if (gen723_cyclix_var) {
gen352_pipex_var = genpstage_MEM_rd_wdata;
genpstage_IDECODE_rs2_rdata = gen352_pipex_var;
}
gen353_pipex_var = ap_uint<1>(0);
gen353_pipex_var = (gen353_pipex_var || gen351_pipex_var);
gen353_pipex_var = !gen353_pipex_var;
gen724_cyclix_var = gen353_pipex_var;
if (gen724_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
}
gen354_pipex_var = genpstage_EXEC_genpctrl_working;
gen355_pipex_var = genpstage_EXEC_rd_req;
gen356_pipex_var = (gen354_pipex_var & gen355_pipex_var);
gen357_pipex_var = gen356_pipex_var;
gen725_cyclix_var = gen357_pipex_var;
if (gen725_cyclix_var) {
gen358_pipex_var = genpstage_IDECODE_rs1_req;
gen726_cyclix_var = gen358_pipex_var;
if (gen726_cyclix_var) {
gen359_pipex_var = genpstage_EXEC_rd_addr;
gen360_pipex_var = (gen359_pipex_var == genpstage_IDECODE_rs1_addr);
gen361_pipex_var = gen360_pipex_var;
gen727_cyclix_var = gen361_pipex_var;
if (gen727_cyclix_var) {
gen362_pipex_var = genpstage_EXEC_rd_rdy;
gen363_pipex_var = gen362_pipex_var;
gen728_cyclix_var = gen363_pipex_var;
if (gen728_cyclix_var) {
gen364_pipex_var = genpstage_EXEC_rd_wdata;
genpstage_IDECODE_rs1_rdata = gen364_pipex_var;
}
gen365_pipex_var = ap_uint<1>(0);
gen365_pipex_var = (gen365_pipex_var || gen363_pipex_var);
gen365_pipex_var = !gen365_pipex_var;
gen729_cyclix_var = gen365_pipex_var;
if (gen729_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
gen366_pipex_var = genpstage_IDECODE_rs2_req;
gen730_cyclix_var = gen366_pipex_var;
if (gen730_cyclix_var) {
gen367_pipex_var = genpstage_EXEC_rd_addr;
gen368_pipex_var = (gen367_pipex_var == genpstage_IDECODE_rs2_addr);
gen369_pipex_var = gen368_pipex_var;
gen731_cyclix_var = gen369_pipex_var;
if (gen731_cyclix_var) {
gen370_pipex_var = genpstage_EXEC_rd_rdy;
gen371_pipex_var = gen370_pipex_var;
gen732_cyclix_var = gen371_pipex_var;
if (gen732_cyclix_var) {
gen372_pipex_var = genpstage_EXEC_rd_wdata;
genpstage_IDECODE_rs2_rdata = gen372_pipex_var;
}
gen373_pipex_var = ap_uint<1>(0);
gen373_pipex_var = (gen373_pipex_var || gen371_pipex_var);
gen373_pipex_var = !gen373_pipex_var;
gen733_cyclix_var = gen373_pipex_var;
if (gen733_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
}
}
}
}
genpstage_IDECODE_alu_op1 = genpstage_IDECODE_rs1_rdata;
switch (genpstage_IDECODE_op1_source) {
case 1:
genpstage_IDECODE_alu_op1 = genpstage_IDECODE_immediate;
break;
case 2:
genpstage_IDECODE_alu_op1 = genpstage_IDECODE_curinstr_addr;
break;
}
genpstage_IDECODE_alu_op2 = genpstage_IDECODE_rs2_rdata;
switch (genpstage_IDECODE_op2_source) {
case 1:
genpstage_IDECODE_alu_op2 = genpstage_IDECODE_immediate;
break;
case 2:
genpstage_IDECODE_alu_op2 = genpstage_IDECODE_csr_rdata;
break;
}
gen374_pipex_var = genpstage_IDECODE_alu_unsigned;
gen734_cyclix_var = gen374_pipex_var;
if (gen734_cyclix_var) {
gen375_pipex_var = ap_uint<1>(0).concat((ap_uint<32>)genpstage_IDECODE_alu_op1);
genpstage_IDECODE_alu_op1_wide = gen375_pipex_var;
gen376_pipex_var = ap_uint<1>(0).concat((ap_uint<32>)genpstage_IDECODE_alu_op2);
genpstage_IDECODE_alu_op2_wide = gen376_pipex_var;
}
gen377_pipex_var = ap_uint<1>(0);
gen377_pipex_var = (gen377_pipex_var || gen374_pipex_var);
gen377_pipex_var = !gen377_pipex_var;
gen735_cyclix_var = gen377_pipex_var;
if (gen735_cyclix_var) {
gen378_pipex_var = genpstage_IDECODE_alu_op1[31];
gen379_pipex_var = gen378_pipex_var.concat((ap_uint<32>)genpstage_IDECODE_alu_op1);
genpstage_IDECODE_alu_op1_wide = gen379_pipex_var;
gen380_pipex_var = genpstage_IDECODE_alu_op2[31];
gen381_pipex_var = gen380_pipex_var.concat((ap_uint<32>)genpstage_IDECODE_alu_op2);
genpstage_IDECODE_alu_op2_wide = gen381_pipex_var;
}
genpstage_IDECODE_genpctrl_nevictable = (genpstage_IDECODE_genpctrl_nevictable || genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending);
gen736_cyclix_var = ~genpstage_EXEC_genpctrl_rdy;
gen737_cyclix_var = gen736_cyclix_var;
if (gen737_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | genpstage_IDECODE_genpctrl_active_glbl);
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
gen738_cyclix_var = genpstage_IDECODE_genpctrl_nevictable;
if (gen738_cyclix_var) {
genpstage_IDECODE_genpctrl_occupied = (genpstage_IDECODE_genpctrl_active_glbl | genpstage_IDECODE_genpctrl_killed_glbl);
gen739_cyclix_var = genpstage_IDECODE_genpctrl_occupied;
if (gen739_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
}
gen740_cyclix_var = genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
if (gen740_cyclix_var) {
genpstage_IDECODE_genpctrl_occupied = (genpstage_IDECODE_genpctrl_active_glbl | genpstage_IDECODE_genpctrl_killed_glbl);
gen741_cyclix_var = genpstage_IDECODE_genpctrl_occupied;
if (gen741_cyclix_var) {
genpstage_IDECODE_genpctrl_stalled_glbl = (genpstage_IDECODE_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
gen742_cyclix_var = genpstage_IDECODE_genpctrl_stalled_glbl;
if (gen742_cyclix_var) {
genpstage_IDECODE_genpctrl_finish = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_succ = ap_uint<32>(0);
}
gen743_cyclix_var = ap_uint<1>(0);
gen743_cyclix_var = (gen743_cyclix_var || gen742_cyclix_var);
gen743_cyclix_var = !gen743_cyclix_var;
if (gen743_cyclix_var) {
genpstage_IDECODE_genpctrl_finish = genpstage_IDECODE_genpctrl_occupied;
genpstage_IDECODE_genpctrl_succ = genpstage_IDECODE_genpctrl_active_glbl;
}
gen744_cyclix_var = genpstage_IDECODE_genpctrl_finish;
if (gen744_cyclix_var) {
gen745_cyclix_var = genpstage_EXEC_genpctrl_rdy;
if (gen745_cyclix_var) {
genpstage_EXEC_jump_req_genglbl = genpstage_IDECODE_jump_req;
genpstage_EXEC_jump_req_cond_genglbl = genpstage_IDECODE_jump_req_cond;
genpstage_EXEC_jump_src_genglbl = genpstage_IDECODE_jump_src;
genpstage_EXEC_rd_req_genglbl = genpstage_IDECODE_rd_req;
genpstage_EXEC_immediate_genglbl = genpstage_IDECODE_immediate;
genpstage_EXEC_alu_req_genglbl = genpstage_IDECODE_alu_req;
genpstage_EXEC_mem_req_genglbl = genpstage_IDECODE_mem_req;
genpstage_EXEC_rd_addr_genglbl = genpstage_IDECODE_rd_addr;
genpstage_EXEC_curinstr_addr_genglbl = genpstage_IDECODE_curinstr_addr;
genpstage_EXEC_mret_req_genglbl = genpstage_IDECODE_mret_req;
genpstage_EXEC_alu_op1_wide_genglbl = genpstage_IDECODE_alu_op1_wide;
genpstage_EXEC_alu_opcode_genglbl = genpstage_IDECODE_alu_opcode;
genpstage_EXEC_alu_op2_wide_genglbl = genpstage_IDECODE_alu_op2_wide;
genpstage_EXEC_alu_op1_genglbl = genpstage_IDECODE_alu_op1;
genpstage_EXEC_alu_op2_genglbl = genpstage_IDECODE_alu_op2;
genpstage_EXEC_alu_unsigned_genglbl = genpstage_IDECODE_alu_unsigned;
genpstage_EXEC_rd_source_genglbl = genpstage_IDECODE_rd_source;
genpstage_EXEC_nextinstr_addr_genglbl = genpstage_IDECODE_nextinstr_addr;
genpstage_EXEC_csr_rdata_genglbl = genpstage_IDECODE_csr_rdata;
genpstage_EXEC_funct3_genglbl = genpstage_IDECODE_funct3;
genpstage_EXEC_mem_cmd_genglbl = genpstage_IDECODE_mem_cmd;
genpstage_EXEC_rs2_rdata = genpstage_IDECODE_rs2_rdata;
genpstage_EXEC_genpctrl_active_glbl = genpstage_IDECODE_genpctrl_active_glbl;
genpstage_EXEC_genpctrl_killed_glbl = genpstage_IDECODE_genpctrl_killed_glbl;
genpstage_EXEC_genpctrl_stalled_glbl = ap_uint<32>(0);
}
genpstage_IDECODE_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_IDECODE_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen746_cyclix_var = ~genpstage_IDECODE_genpctrl_stalled_glbl;
genpstage_IDECODE_genpctrl_rdy = gen746_cyclix_var;
genpstage_IDECODE_genpctrl_working = (genpstage_IDECODE_genpctrl_succ | genpstage_IDECODE_genpctrl_stalled_glbl);
genpstage_IFETCH_genpctrl_succ = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_working = ap_uint<32>(0);
gen747_cyclix_var = genpstage_IFETCH_genpctrl_stalled_glbl;
if (gen747_cyclix_var) {
genpstage_IFETCH_genpctrl_new = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_stalled_glbl = ap_uint<32>(0);
gen748_cyclix_var = !genpstage_IFETCH_genpctrl_killed_glbl;
genpstage_IFETCH_genpctrl_active_glbl = gen748_cyclix_var;
}
gen749_cyclix_var = ap_uint<1>(0);
gen749_cyclix_var = (gen749_cyclix_var || gen747_cyclix_var);
gen749_cyclix_var = !gen749_cyclix_var;
if (gen749_cyclix_var) {
genpstage_IFETCH_genpctrl_new = (genpstage_IFETCH_genpctrl_active_glbl || genpstage_IFETCH_genpctrl_killed_glbl);
}
genpstage_IFETCH_genpctrl_finish = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_flushreq = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_nevictable = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_occupied = (genpstage_IFETCH_genpctrl_active_glbl | genpstage_IFETCH_genpctrl_killed_glbl);
genpstage_IFETCH_curinstr_addr = genpstage_IFETCH_curinstr_addr_genglbl;
genpstage_IFETCH_nextinstr_addr = genpstage_IFETCH_nextinstr_addr_genglbl;
genpstage_IFETCH_genpctrl_flushreq = (genpstage_IFETCH_genpctrl_flushreq | genpstage_IDECODE_genpctrl_flushreq);
gen750_cyclix_var = genpstage_IFETCH_genpctrl_occupied;
if (gen750_cyclix_var) {
gen751_cyclix_var = genpstage_IFETCH_genpctrl_new;
if (gen751_cyclix_var) {
genpstage_IFETCH_instr_req_done = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdata = ap_uint<32>(0);
}
gen752_cyclix_var = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
if (gen752_cyclix_var) {
gen753_cyclix_var = (genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id == ap_uint<1>(0));
gen754_cyclix_var = gen753_cyclix_var;
if (gen754_cyclix_var) {
gen755_cyclix_var = (genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid == genmcopipe_instr_mem_rd_ptr);
gen756_cyclix_var = gen755_cyclix_var;
if (gen756_cyclix_var) {
gen757_cyclix_var = genmcopipe_instr_mem_resp.read_nb(gen462_pipex_mcopipe_rdata);
gen758_cyclix_var = gen757_cyclix_var;
if (gen758_cyclix_var) {
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done = ap_uint<32>(1);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdata = gen462_pipex_mcopipe_rdata;
genmcopipe_instr_mem_rd_done = ap_uint<32>(1);
}
}
}
}
gen463_pipex_genpstage_IFETCH_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen463_pipex_genpstage_IFETCH_mcopipe_rdreq_inprogress = (gen463_pipex_genpstage_IFETCH_mcopipe_rdreq_inprogress || genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending);
gen759_cyclix_var = genpstage_IFETCH_genpctrl_flushreq;
if (gen759_cyclix_var) {
gen760_cyclix_var = genpstage_IFETCH_genpctrl_active_glbl;
if (gen760_cyclix_var) {
genpstage_IFETCH_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
}
gen761_cyclix_var = ap_uint<1>(0);
gen761_cyclix_var = (gen761_cyclix_var || gen750_cyclix_var);
gen761_cyclix_var = !gen761_cyclix_var;
if (gen761_cyclix_var) {
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done = ap_uint<32>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending = ap_uint<32>(0);
}
genpstage_IFETCH_instr_busreq.addr = genpstage_IFETCH_curinstr_addr;
genpstage_IFETCH_instr_busreq.be = ap_uint<32>(15);
genpstage_IFETCH_instr_busreq.wdata = ap_uint<32>(0);
gen234_pipex_var = ~genpstage_IFETCH_instr_req_done;
gen235_pipex_var = gen234_pipex_var;
gen762_cyclix_var = gen235_pipex_var;
if (gen762_cyclix_var) {
gen763_cyclix_var = genpstage_IFETCH_genpctrl_active_glbl;
if (gen763_cyclix_var) {
gen764_cyclix_var = ~genmcopipe_instr_mem_full_flag;
gen765_cyclix_var = gen764_cyclix_var;
if (gen765_cyclix_var) {
gen464_pipex_req_struct.we = ap_uint<1>(0);
gen464_pipex_req_struct.wdata = genpstage_IFETCH_instr_busreq;
gen766_cyclix_var = genmcopipe_instr_mem_req.write_nb(gen464_pipex_req_struct);
gen767_cyclix_var = gen766_cyclix_var;
if (gen767_cyclix_var) {
gen236_pipex_var = ap_uint<32>(1);
gen768_cyclix_var = !ap_uint<1>(0);
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending = gen768_cyclix_var;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid = genmcopipe_instr_mem_wr_ptr;
genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id = ap_uint<1>(0);
gen769_cyclix_var = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
if (gen769_cyclix_var) {
genmcopipe_instr_mem_wr_done = ap_uint<32>(1);
}
}
}
}
genpstage_IFETCH_instr_req_done = gen236_pipex_var;
}
gen237_pipex_var = ~genpstage_IFETCH_instr_req_done;
gen238_pipex_var = gen237_pipex_var;
gen770_cyclix_var = gen238_pipex_var;
if (gen770_cyclix_var) {
genpstage_IFETCH_genpctrl_stalled_glbl = (genpstage_IFETCH_genpctrl_stalled_glbl | genpstage_IFETCH_genpctrl_active_glbl);
genpstage_IFETCH_genpctrl_active_glbl = ap_uint<32>(0);
}
genpstage_IFETCH_genpctrl_nevictable = (genpstage_IFETCH_genpctrl_nevictable || genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending);
gen771_cyclix_var = ~genpstage_IDECODE_genpctrl_rdy;
gen772_cyclix_var = gen771_cyclix_var;
if (gen772_cyclix_var) {
genpstage_IFETCH_genpctrl_stalled_glbl = (genpstage_IFETCH_genpctrl_stalled_glbl | genpstage_IFETCH_genpctrl_active_glbl);
genpstage_IFETCH_genpctrl_active_glbl = ap_uint<32>(0);
gen773_cyclix_var = genpstage_IFETCH_genpctrl_nevictable;
if (gen773_cyclix_var) {
genpstage_IFETCH_genpctrl_occupied = (genpstage_IFETCH_genpctrl_active_glbl | genpstage_IFETCH_genpctrl_killed_glbl);
gen774_cyclix_var = genpstage_IFETCH_genpctrl_occupied;
if (gen774_cyclix_var) {
genpstage_IFETCH_genpctrl_stalled_glbl = (genpstage_IFETCH_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
}
gen775_cyclix_var = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
if (gen775_cyclix_var) {
genpstage_IFETCH_genpctrl_occupied = (genpstage_IFETCH_genpctrl_active_glbl | genpstage_IFETCH_genpctrl_killed_glbl);
gen776_cyclix_var = genpstage_IFETCH_genpctrl_occupied;
if (gen776_cyclix_var) {
genpstage_IFETCH_genpctrl_stalled_glbl = (genpstage_IFETCH_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
gen777_cyclix_var = genpstage_IFETCH_genpctrl_stalled_glbl;
if (gen777_cyclix_var) {
genpstage_IFETCH_genpctrl_finish = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_succ = ap_uint<32>(0);
}
gen778_cyclix_var = ap_uint<1>(0);
gen778_cyclix_var = (gen778_cyclix_var || gen777_cyclix_var);
gen778_cyclix_var = !gen778_cyclix_var;
if (gen778_cyclix_var) {
genpstage_IFETCH_genpctrl_finish = genpstage_IFETCH_genpctrl_occupied;
genpstage_IFETCH_genpctrl_succ = genpstage_IFETCH_genpctrl_active_glbl;
}
gen779_cyclix_var = genpstage_IFETCH_genpctrl_finish;
if (gen779_cyclix_var) {
gen780_cyclix_var = genpstage_IDECODE_genpctrl_rdy;
if (gen780_cyclix_var) {
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_if_id = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_if_id;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdreq_pending = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdreq_pending;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_tid = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_tid;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_resp_done = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_resp_done;
genpstage_IDECODE_genmcopipe_handle_instr_mem_genvar_rdata = genpstage_IFETCH_genmcopipe_handle_instr_mem_genvar_rdata;
genpstage_IDECODE_curinstr_addr_genglbl = genpstage_IFETCH_curinstr_addr;
genpstage_IDECODE_nextinstr_addr_genglbl = genpstage_IFETCH_nextinstr_addr;
genpstage_IDECODE_genpctrl_active_glbl = genpstage_IFETCH_genpctrl_active_glbl;
genpstage_IDECODE_genpctrl_killed_glbl = genpstage_IFETCH_genpctrl_killed_glbl;
genpstage_IDECODE_genpctrl_stalled_glbl = ap_uint<32>(0);
}
genpstage_IFETCH_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_IFETCH_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen781_cyclix_var = ~genpstage_IFETCH_genpctrl_stalled_glbl;
genpstage_IFETCH_genpctrl_rdy = gen781_cyclix_var;
genpstage_IFETCH_genpctrl_working = (genpstage_IFETCH_genpctrl_succ | genpstage_IFETCH_genpctrl_stalled_glbl);
genpstage_IADDR_genpctrl_succ = ap_uint<32>(0);
genpstage_IADDR_genpctrl_working = ap_uint<32>(0);
gen782_cyclix_var = genpstage_IADDR_genpctrl_stalled_glbl;
if (gen782_cyclix_var) {
genpstage_IADDR_genpctrl_new = ap_uint<32>(0);
genpstage_IADDR_genpctrl_stalled_glbl = ap_uint<32>(0);
gen783_cyclix_var = !genpstage_IADDR_genpctrl_killed_glbl;
genpstage_IADDR_genpctrl_active_glbl = gen783_cyclix_var;
}
gen784_cyclix_var = ap_uint<1>(0);
gen784_cyclix_var = (gen784_cyclix_var || gen782_cyclix_var);
gen784_cyclix_var = !gen784_cyclix_var;
if (gen784_cyclix_var) {
genpstage_IADDR_genpctrl_active_glbl = ap_uint<32>(1);
genpstage_IADDR_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_IADDR_genpctrl_new = (genpstage_IADDR_genpctrl_active_glbl || genpstage_IADDR_genpctrl_killed_glbl);
}
genpstage_IADDR_genpctrl_finish = ap_uint<32>(0);
genpstage_IADDR_genpctrl_flushreq = ap_uint<32>(0);
genpstage_IADDR_genpctrl_nevictable = ap_uint<32>(0);
genpstage_IADDR_genpctrl_occupied = (genpstage_IADDR_genpctrl_active_glbl | genpstage_IADDR_genpctrl_killed_glbl);
genpstage_IADDR_genpctrl_flushreq = (genpstage_IADDR_genpctrl_flushreq | genpstage_IFETCH_genpctrl_flushreq);
gen785_cyclix_var = genpstage_IADDR_genpctrl_occupied;
if (gen785_cyclix_var) {
gen465_pipex_genpstage_IADDR_mcopipe_rdreq_inprogress = ap_uint<32>(0);
gen786_cyclix_var = genpstage_IADDR_genpctrl_flushreq;
if (gen786_cyclix_var) {
gen787_cyclix_var = gen465_pipex_genpstage_IADDR_mcopipe_rdreq_inprogress;
if (gen787_cyclix_var) {
gen788_cyclix_var = genpstage_IADDR_genpctrl_active_glbl;
if (gen788_cyclix_var) {
genpstage_IADDR_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IADDR_genpctrl_killed_glbl = ap_uint<32>(1);
}
}
gen789_cyclix_var = ap_uint<1>(0);
gen789_cyclix_var = (gen789_cyclix_var || gen787_cyclix_var);
gen789_cyclix_var = !gen789_cyclix_var;
if (gen789_cyclix_var) {
}
}
}
gen790_cyclix_var = ap_uint<1>(0);
gen790_cyclix_var = (gen790_cyclix_var || gen785_cyclix_var);
gen790_cyclix_var = !gen790_cyclix_var;
if (gen790_cyclix_var) {
}
gen223_pipex_syncbuf = genpsticky_glbl_jump_req_cmd;
gen225_pipex_syncbuf = genpsticky_glbl_pc;
genpstage_IADDR_curinstr_addr = genpsticky_glbl_pc;
gen232_pipex_var = genpsticky_glbl_jump_req_cmd;
gen791_cyclix_var = gen232_pipex_var;
if (gen791_cyclix_var) {
genpstage_IADDR_curinstr_addr = genpsticky_glbl_jump_vector_cmd;
}
gen222_pipex_syncreq = ap_uint<32>(1);
gen223_pipex_syncbuf = ap_uint<32>(0);
gen233_pipex_var = (genpstage_IADDR_curinstr_addr + ap_uint<32>(4));
genpstage_IADDR_nextinstr_addr = gen233_pipex_var;
gen224_pipex_syncreq = ap_uint<32>(1);
gen225_pipex_syncbuf = genpstage_IADDR_nextinstr_addr;
gen792_cyclix_var = ~genpstage_IFETCH_genpctrl_rdy;
gen793_cyclix_var = gen792_cyclix_var;
if (gen793_cyclix_var) {
genpstage_IADDR_genpctrl_stalled_glbl = (genpstage_IADDR_genpctrl_stalled_glbl | genpstage_IADDR_genpctrl_active_glbl);
genpstage_IADDR_genpctrl_active_glbl = ap_uint<32>(0);
gen794_cyclix_var = genpstage_IADDR_genpctrl_nevictable;
if (gen794_cyclix_var) {
genpstage_IADDR_genpctrl_occupied = (genpstage_IADDR_genpctrl_active_glbl | genpstage_IADDR_genpctrl_killed_glbl);
gen795_cyclix_var = genpstage_IADDR_genpctrl_occupied;
if (gen795_cyclix_var) {
genpstage_IADDR_genpctrl_stalled_glbl = (genpstage_IADDR_genpctrl_stalled_glbl | ap_uint<32>(1));
}
}
}
gen796_cyclix_var = genpstage_IADDR_genpctrl_stalled_glbl;
if (gen796_cyclix_var) {
genpstage_IADDR_genpctrl_finish = ap_uint<32>(0);
genpstage_IADDR_genpctrl_succ = ap_uint<32>(0);
}
gen797_cyclix_var = ap_uint<1>(0);
gen797_cyclix_var = (gen797_cyclix_var || gen796_cyclix_var);
gen797_cyclix_var = !gen797_cyclix_var;
if (gen797_cyclix_var) {
genpstage_IADDR_genpctrl_finish = genpstage_IADDR_genpctrl_occupied;
genpstage_IADDR_genpctrl_succ = genpstage_IADDR_genpctrl_active_glbl;
}
gen798_cyclix_var = genpstage_IADDR_genpctrl_succ;
if (gen798_cyclix_var) {
gen799_cyclix_var = gen222_pipex_syncreq;
if (gen799_cyclix_var) {
genpsticky_glbl_jump_req_cmd = gen223_pipex_syncbuf;
}
gen800_cyclix_var = gen224_pipex_syncreq;
if (gen800_cyclix_var) {
genpsticky_glbl_pc = gen225_pipex_syncbuf;
}
}
gen801_cyclix_var = genpstage_IADDR_genpctrl_finish;
if (gen801_cyclix_var) {
gen802_cyclix_var = genpstage_IFETCH_genpctrl_rdy;
if (gen802_cyclix_var) {
genpstage_IFETCH_curinstr_addr_genglbl = genpstage_IADDR_curinstr_addr;
genpstage_IFETCH_nextinstr_addr_genglbl = genpstage_IADDR_nextinstr_addr;
genpstage_IFETCH_genpctrl_active_glbl = genpstage_IADDR_genpctrl_active_glbl;
genpstage_IFETCH_genpctrl_killed_glbl = genpstage_IADDR_genpctrl_killed_glbl;
genpstage_IFETCH_genpctrl_stalled_glbl = ap_uint<32>(0);
}
genpstage_IADDR_genpctrl_active_glbl = ap_uint<32>(0);
genpstage_IADDR_genpctrl_killed_glbl = ap_uint<32>(0);
genpstage_IADDR_genpctrl_stalled_glbl = ap_uint<32>(0);
}
gen803_cyclix_var = ~genpstage_IADDR_genpctrl_stalled_glbl;
genpstage_IADDR_genpctrl_rdy = gen803_cyclix_var;
genpstage_IADDR_genpctrl_working = (genpstage_IADDR_genpctrl_succ | genpstage_IADDR_genpctrl_stalled_glbl);
gen804_cyclix_var = genmcopipe_instr_mem_rd_done;
if (gen804_cyclix_var) {
genmcopipe_instr_mem_rd_ptr = genmcopipe_instr_mem_rd_ptr_next;
genmcopipe_instr_mem_full_flag = ap_uint<32>(0);
gen805_cyclix_var = (genmcopipe_instr_mem_rd_ptr == genmcopipe_instr_mem_wr_ptr);
gen806_cyclix_var = gen805_cyclix_var;
if (gen806_cyclix_var) {
genmcopipe_instr_mem_empty_flag = ap_uint<32>(1);
}
}
gen807_cyclix_var = genmcopipe_instr_mem_wr_done;
if (gen807_cyclix_var) {
genmcopipe_instr_mem_wr_ptr = genmcopipe_instr_mem_wr_ptr_next;
genmcopipe_instr_mem_empty_flag = ap_uint<32>(0);
gen808_cyclix_var = (genmcopipe_instr_mem_rd_ptr == genmcopipe_instr_mem_wr_ptr);
gen809_cyclix_var = gen808_cyclix_var;
if (gen809_cyclix_var) {
genmcopipe_instr_mem_full_flag = ap_uint<32>(1);
}
}
gen810_cyclix_var = genmcopipe_data_mem_rd_done;
if (gen810_cyclix_var) {
genmcopipe_data_mem_rd_ptr = genmcopipe_data_mem_rd_ptr_next;
genmcopipe_data_mem_full_flag = ap_uint<32>(0);
gen811_cyclix_var = (genmcopipe_data_mem_rd_ptr == genmcopipe_data_mem_wr_ptr);
gen812_cyclix_var = gen811_cyclix_var;
if (gen812_cyclix_var) {
genmcopipe_data_mem_empty_flag = ap_uint<32>(1);
}
}
gen813_cyclix_var = genmcopipe_data_mem_wr_done;
if (gen813_cyclix_var) {
genmcopipe_data_mem_wr_ptr = genmcopipe_data_mem_wr_ptr_next;
genmcopipe_data_mem_empty_flag = ap_uint<32>(0);
gen814_cyclix_var = (genmcopipe_data_mem_rd_ptr == genmcopipe_data_mem_wr_ptr);
gen815_cyclix_var = gen814_cyclix_var;
if (gen815_cyclix_var) {
genmcopipe_data_mem_full_flag = ap_uint<32>(1);
}
}
}
}
| [
"[email protected]"
] | |
7a710ab0d5ecd3bd62a33089c3150b723d82a68c | 578f1e3e65c67db94b0abc4967e690004247c3b2 | /usaco_guide/silver/sorting/more_operations_on_ordered_sets/room_allocation.cpp | e6ed81aac6cfc7aa39b00010d198b435d0848b59 | [] | no_license | Farrius/cp | 028146987efaf43be8d8e653014b8fb2d616c288 | 341faf32de77e566a12bc68819b4e81ed94c0030 | refs/heads/master | 2023-08-16T15:01:20.678334 | 2021-09-26T17:17:14 | 2021-09-26T17:17:14 | 298,070,687 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 932 | cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp (const pair<int, pair<int, int>>& a, const pair<int, pair<int, int>>& b) {
return a.second.first < b.second.first;
}
int main() {
int n;
cin >> n;
pair<int, pair<int, int>> ar[n];
for (int i = 0; i < n; i++) {
ar[i].first = i;
cin >> ar[i].second.first >> ar[i].second.second;
}
sort(ar, ar + n, cmp);
priority_queue<pair<int, int>> pq;
vector<pair<int, int>> ans;
int maxi = -1;
for (int i = 0; i < n; i++) {
int habita;
if (!pq.empty() && ar[i].second.first > -pq.top().first) {
habita = pq.top().second;
pq.pop();
} else {
habita = (int) pq.size() + 1;
}
pq.push(make_pair(-ar[i].second.second, habita));
maxi = max(maxi, habita);
ans.push_back(make_pair(ar[i].first, habita));
}
sort(ans.begin(), ans.end());
cout << maxi << '\n';
for (int i = 0; i < n; i++) {
cout << ans[i].second << (i == n - 1 ? '\n' : ' ');
}
}
| [
"[email protected]"
] | |
fe9b5b247062e56c0688dfba707bb99ade053902 | 5f128331cdf93fa8160c7b06f28ca713bc0a1e9a | /Source/Battlecat/Public/Pickups/BCAmmoPickup.h | cff86d5c1b5c9f1a098ea75a579410d3ef68f0ba | [] | no_license | Lostinsidemyhead/UE4-Shooter | 0434c14f4f755b9cc32496c9c1ce5b19d19c3678 | 8a30a4283838349a478ffedf5370f0c8ae8fd332 | refs/heads/main | 2023-06-15T02:30:04.896452 | 2021-07-09T06:56:25 | 2021-07-09T06:56:25 | 380,514,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 606 | h | // Battlecat Game. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Pickups/BCBasePickup.h"
#include "BCAmmoPickup.generated.h"
class ABCBaseWeapon;
UCLASS()
class BATTLECAT_API ABCAmmoPickup : public ABCBasePickup
{
GENERATED_BODY()
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pickup", meta = (ClampMin = "1.0", ClampMax = "10.0"))
int32 ClipsAmount = 10;
UPROPERTY(EditAnywhere, BlueprintReadWrite, CAtegory = "Pickup")
TSubclassOf<ABCBaseWeapon> WeaponType;
private:
virtual bool GivePickupTo(APawn* PlayerPawn) override;
};
| [
"[email protected]"
] | |
2ed2a53cf1cc4e40ad9b4be615c2d72c886d5121 | e6f6b378b6f6ea68ee25dfce9b2bc2f916c66edf | /src/sorting/internal/shell_sort.hpp | 6219fce8d4048dc228b8a484608c24eb50931b16 | [] | no_license | tosha-laba/sorting | f0bca6ddb66f57c09136a9b50271786c5e52b794 | dd8e4205d56300608a2706a833f44174456c8627 | refs/heads/master | 2023-04-13T01:26:02.107265 | 2019-09-05T02:27:18 | 2019-09-05T02:27:18 | 358,787,551 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 614 | hpp | #pragma once
#include <math.h>
namespace sorting
{
// TODO: убрать log2 (?)
template <typename T>
void shell_sort(T &a, int length)
{
int step = (2 << (int)log2(length)) - 1;
while (step > 0) {
for (int i = step; i < length; ++i) {
auto value = a[i];
int j = i;
while (j >= step && a[j - step] > value) {
a[j] = a[j - step];
j -= step;
}
a[j] = value;
}
step = (step - 1) / 2;
}
}
} // namespace sorting
| [
"[email protected]"
] | |
0206846ff92c25f92f6309c3432c2a30fd5e1b1d | 7d68c0a057082af303be17e22fdaa4363bcc92e0 | /terra/common/include/lockfree_classpool_workqueue.h | 745c23b48b13cac764f0052f9528533df7894388 | [] | no_license | ssh352/MyATS | 48fbd2909f74ab6818e53bbcd1a459edfe48bba4 | 242ab4e0ab9a5cb377eb84022bbeffe54f2aac88 | refs/heads/master | 2022-02-11T19:45:53.830230 | 2019-05-08T02:33:06 | 2019-05-08T02:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,405 | h | #ifndef _LOCK_FREE_CLASSPOOL_WORKQUEUE_H
#define _LOCK_FREE_CLASSPOOL_WORKQUEUE_H
#include <list>
#include <functional>
#include <atomic>
#ifdef Linux
#include <errno.h>
#include<unistd.h>
#include "terra_logger.h"
#endif
#include "FastMemcpy.h"
#include "tbb/concurrent_queue.h"
namespace terra
{
namespace common
{
//template <typename Data>
//typedef std::function<void()> PushHandler;
template <typename Data>
class lockfree_classpool_workqueue
{
typedef std::function<void(Data*)> ProcessHandler;
public:
lockfree_classpool_workqueue();
virtual ~lockfree_classpool_workqueue();
//bool Push(Data* _pObject);
bool CopyPush(Data* _pObject);
//Data* Pop();
bool Pop_Handle();
void setHandler(ProcessHandler handler);
void clear();
void on_handle(Data*);
int Pops_Handle(int max_pop = 0);
void set_fd(int _fd){ fd = _fd; }
bool read_available(){ return m_queue.empty() == false; }
static const int MAX_QUEUE = 2048;
static const int MAX_POOL_SIZE = 1024;
//
int size()
{
return m_queue.unsafe_size();
}
//
protected:
// boost::lockfree::spsc_queue<Data *, boost::lockfree::capacity<MAX_QUEUE> > m_queue;
// boost::lockfree::spsc_queue<Data *, boost::lockfree::capacity<MAX_POOL_SIZE> > m_class_pool_queue;
tbb::concurrent_queue<Data *> m_queue;
tbb::concurrent_queue<Data *> m_class_pool_queue;
ProcessHandler m_handler;
Data* get_mem();
void frem_mem(Data* ptr);
int fd;
};
template <class Data>
lockfree_classpool_workqueue<Data>::lockfree_classpool_workqueue()
{
//if (len < 16)
// len = 16;
fd = -1;
Data **m_data;
m_data = (Data **)malloc(sizeof(Data *)*MAX_POOL_SIZE);
for (unsigned int i = 0; i < MAX_POOL_SIZE; ++i)
{
m_data[i] = new Data;
m_class_pool_queue.push(m_data[i]);
}
delete m_data;
}
template <class Data>
lockfree_classpool_workqueue<Data>::~lockfree_classpool_workqueue()
{
}
/*template <class Data>
bool lockfree_classpool_workqueue<Data>::Push(Data* ptr)
{
if (ptr != nullptr)
{
while (!m_queue.push(ptr))
;
return true;
}
return false;
}*/
template <typename Data>
bool lockfree_classpool_workqueue<Data>::CopyPush(Data* _pObject)
{
if (_pObject != nullptr)
{
Data* ptr = get_mem();
memcpy_lw(ptr, _pObject, sizeof(Data));
//while (!m_queue.push(ptr))
//{
//}
m_queue.push(ptr);
#ifdef Linux
if (fd != -1)
{
uint64_t buf = 1;
int wlen = 0;
while(1)
{
wlen = write(fd, &buf, sizeof(buf));
if(wlen>0)
return true;
else
{
if (errno == EAGAIN||errno==EINTR)
{
continue;
}
else
{
loggerv2::error("write efd fail");
break;
}
}
}
}
#endif
return true;
}
return false;
}
//template <class Data>
//Data* lockfree_classpool_workqueue<Data>::Pop()
//{
// Data* ptr;
// if (m_queue.pop(ptr))
// return ptr;
// else
// return nullptr;
//}
template <class Data>
bool lockfree_classpool_workqueue<Data>::Pop_Handle()
{
Data* ptr;
if (m_queue.try_pop(ptr))
{
on_handle(ptr);
frem_mem(ptr);
return true;
}
return false;
}
template <class Data>
int lockfree_classpool_workqueue<Data>::Pops_Handle(int max_pop)
{
int i = 0;
Data* ptr;
while (m_queue.try_pop(ptr))
{
on_handle(ptr);
frem_mem(ptr);
++i;
if (max_pop>0 && i>=max_pop)
{
return i;
}
}
return i;
}
template <typename Data>
Data* lockfree_classpool_workqueue<Data>::get_mem()
{
Data* ptr;
if (m_class_pool_queue.try_pop(ptr))
return ptr;
ptr = new Data;
return ptr;
}
template <typename Data>
void lockfree_classpool_workqueue<Data>::frem_mem(Data* ptr)
{
if (ptr != nullptr)
{
//while (!m_class_pool_queue.push(ptr))
// ;
m_class_pool_queue.push(ptr);
}
}
template <class Data>
void lockfree_classpool_workqueue<Data>::setHandler(ProcessHandler handler)
{
m_handler=handler;
}
template <class Data>
void lockfree_classpool_workqueue<Data>::clear()
{
m_handler.clear();
}
template <typename Data>
void lockfree_classpool_workqueue<Data>::on_handle(Data* ptr)
{
if (ptr!=nullptr && m_handler!= nullptr)
m_handler(ptr);
}
}
}
#endif | [
"[email protected]"
] | |
4828ee41ac86d2853d9bf0cc755383e1c4e54586 | 4f173bf5c7267ba37ea1afbf6f305b796dddc559 | /DlgTRC1752_MOD_PROG_STA_TST.h | e4744b7b35312feb216557ab3332fbca1c00cb3a | [] | no_license | antoine83/sicomex | d50d50c96222567a63720db6831901b79782e3f8 | 260f3b835a0050a321f2bf5bbe130a932476f154 | refs/heads/master | 2020-12-24T20:24:45.306792 | 2017-03-26T16:25:16 | 2017-03-26T16:25:16 | 86,247,091 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,261 | h | #if !defined(AFX_DLGTRC1752_MOD_PROG_STA_TST_H__B66CA7F0_9EB1_4DBB_93E5_5F928A84ED45__INCLUDED_)
#define AFX_DLGTRC1752_MOD_PROG_STA_TST_H__B66CA7F0_9EB1_4DBB_93E5_5F928A84ED45__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgTRC1752_MOD_PROG_STA_TST.h : header file
//
#include "Equip\EquipM1752.h"
const int NB_INTTD = 4; // D1..D6
const string INTTD[NB_INTTD] = {
"TEST_D1",
"TEST_D2",
"TEST_D5",
"TEST_D6"
};
/////////////////////////////////////////////////////////////////////////////
// CDlgTRC1752_MOD_PROG_STA_TST dialog
class CDlgTRC1752_MOD_PROG_STA_TST : public CDialog
{
// Construction
public:
CDlgTRC1752_MOD_PROG_STA_TST(CEquipM1752 * equip = NULL, CWnd* pParent = NULL); // standard constructor
void Valide();
void Esc();
void InitVoie(const int voie);
// Dialog Data
//{{AFX_DATA(CDlgTRC1752_MOD_PROG_STA_TST)
enum { IDD = IDD_MOD_PROG_STA_TST };
CComboBox c_TypeRebouclage;
CEdit c_TestInterfaceTc;
CEdit c_TestInterfaceTd;
CEdit c_RebouclageBf;
CEdit c_1800Hz;
CEdit c_TstVoie;
CStatic c_TstMessageDeux;
CStatic c_TstMessageUn;
CString m_TstMessageUn;
CString m_TstMessageDeux;
CString m_TstVoie;
CString m_1800Hz;
CString m_RebouclageBf;
CString m_TestInterfaceTd;
CString m_TestInterfaceTc;
int m_TypeRebouclage;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgTRC1752_MOD_PROG_STA_TST)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CEquipM1752 * eqp;
// Generated message map functions
//{{AFX_MSG(CDlgTRC1752_MOD_PROG_STA_TST)
virtual BOOL OnInitDialog();
afx_msg void OnSetfocus1800Hz();
afx_msg void OnSetfocusRebouclageBf();
afx_msg void OnSetfocusTestDx();
afx_msg void OnSetfocusTestTc();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnSelchangeTypeRebouclage();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void OnSetfocusVoie();
void Tests(int typeTest);
private:
string test_choisi;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGTRC1752_MOD_PROG_STA_TST_H__B66CA7F0_9EB1_4DBB_93E5_5F928A84ED45__INCLUDED_)
| [
"[email protected]"
] | |
0f61d4c638501e66cb7d199a7f9586a41b5548ed | 400a90ee49bf746edf000aac1339d36e80aa6248 | /ConsoleApplication1/Actor.cpp | b40e1a85f5bd2691fb3a0abc366e1ab3e601cf69 | [] | no_license | MyungSub94/LearningToCode | 54b1eda781d3450865f36cfcfee5d1666ae9a856 | 868846e3f893a897e92040f60404db7f3c124094 | refs/heads/master | 2021-08-17T06:52:52.998775 | 2017-11-20T21:47:04 | 2017-11-20T21:47:04 | 111,465,839 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,123 | cpp | #include "stdafx.h"
#include "Actor.h"
#include <string>
Actor::Actor()
{
name = "NULL";
health = 100;
mana = 100;
}
//Constructs a typical character that would be in a battle sequence
Actor::Actor(std::string act_name, int act_hp, int act_mp, actor_stats act_stats, actor_equipment act_equip)
{
name = act_name;
health = act_hp;
max_health = act_hp;
mana = act_mp;
max_mana = act_mp;
stats = act_stats;
temp_stats = stats;
equipment = act_equip;
}
Actor::~Actor()
{
}
int Actor::removeHealth(int damage) //Sets new health equal the amount as passed parameter
{
health = health - damage;
return health;
}
int Actor::recoverHealth(int amount)
{
health = health + amount;
if(health > max_health)
{
health = max_health;
}
return health;
}
int Actor::removeMana(int cost)
{
mana = mana - cost;
return mana;
}
//Function called after a battle ends so that any buffs/debuffs are not accounted for in next batttles
void Actor::resetActorStats()
{
temp_stats = stats;
}
//Function called during a full heal/restoring
void Actor::setActorResourceMax()
{
health = max_health;
mana = max_mana;
} | [
"[email protected]"
] | |
fdbcfecd1281c9a2c54627e1de8b979471822bc0 | 2c148e207664a55a5809a3436cbbd23b447bf7fb | /src/media/renderers/audio_renderer_impl.cc | e2e0962d6288fb1a8158ed1954d89c095ef09bf4 | [
"BSD-3-Clause"
] | permissive | nuzumglobal/Elastos.Trinity.Alpha.Android | 2bae061d281ba764d544990f2e1b2419b8e1e6b2 | 4c6dad6b1f24d43cadb162fb1dbec4798a8c05f3 | refs/heads/master | 2020-05-21T17:30:46.563321 | 2018-09-03T05:16:16 | 2018-09-03T05:16:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 42,129 | cc | // Copyright (c) 2012 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 "media/renderers/audio_renderer_impl.h"
#include <math.h>
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/power_monitor/power_monitor.h"
#include "base/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_buffer_converter.h"
#include "media/base/audio_latency.h"
#include "media/base/audio_parameters.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/channel_mixing_matrix.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_client.h"
#include "media/base/media_log.h"
#include "media/base/renderer_client.h"
#include "media/base/timestamp_constants.h"
#include "media/filters/audio_clock.h"
#include "media/filters/decrypting_demuxer_stream.h"
#if defined(OS_WIN)
#include "media/base/media_switches.h"
#endif // defined(OS_WIN)
namespace media {
AudioRendererImpl::AudioRendererImpl(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
media::AudioRendererSink* sink,
const CreateAudioDecodersCB& create_audio_decoders_cb,
MediaLog* media_log)
: task_runner_(task_runner),
expecting_config_changes_(false),
sink_(sink),
media_log_(media_log),
client_(nullptr),
tick_clock_(base::DefaultTickClock::GetInstance()),
last_audio_memory_usage_(0),
last_decoded_sample_rate_(0),
last_decoded_channel_layout_(CHANNEL_LAYOUT_NONE),
is_encrypted_(false),
last_decoded_channels_(0),
playback_rate_(0.0),
state_(kUninitialized),
create_audio_decoders_cb_(create_audio_decoders_cb),
buffering_state_(BUFFERING_HAVE_NOTHING),
rendering_(false),
sink_playing_(false),
pending_read_(false),
received_end_of_stream_(false),
rendered_end_of_stream_(false),
is_suspending_(false),
is_passthrough_(false),
weak_factory_(this) {
DCHECK(create_audio_decoders_cb_);
// Tests may not have a power monitor.
base::PowerMonitor* monitor = base::PowerMonitor::Get();
if (!monitor)
return;
// PowerObserver's must be added and removed from the same thread, but we
// won't remove the observer until we're destructed on |task_runner_| so we
// must post it here if we're on the wrong thread.
if (task_runner_->BelongsToCurrentThread()) {
monitor->AddObserver(this);
} else {
// Safe to post this without a WeakPtr because this class must be destructed
// on the same thread and construction has not completed yet.
task_runner_->PostTask(FROM_HERE,
base::Bind(&base::PowerMonitor::AddObserver,
base::Unretained(monitor), this));
}
// Do not add anything below this line since the above actions are only safe
// as the last lines of the constructor.
}
AudioRendererImpl::~AudioRendererImpl() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
if (base::PowerMonitor::Get())
base::PowerMonitor::Get()->RemoveObserver(this);
// If Render() is in progress, this call will wait for Render() to finish.
// After this call, the |sink_| will not call back into |this| anymore.
sink_->Stop();
// Trying to track down AudioClock crash, http://crbug.com/674856. If the sink
// hasn't truly stopped above we will fail to acquire the lock. The sink must
// be stopped to avoid destroying the AudioClock while its still being used.
CHECK(lock_.Try());
lock_.Release();
if (!init_cb_.is_null())
base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT);
}
void AudioRendererImpl::StartTicking() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK(!rendering_);
rendering_ = true;
// Wait for an eventual call to SetPlaybackRate() to start rendering.
if (playback_rate_ == 0) {
DCHECK(!sink_playing_);
return;
}
StartRendering_Locked();
}
void AudioRendererImpl::StartRendering_Locked() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kPlaying);
DCHECK(!sink_playing_);
DCHECK_NE(playback_rate_, 0.0);
lock_.AssertAcquired();
sink_playing_ = true;
base::AutoUnlock auto_unlock(lock_);
sink_->Play();
}
void AudioRendererImpl::StopTicking() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK(rendering_);
rendering_ = false;
// Rendering should have already been stopped with a zero playback rate.
if (playback_rate_ == 0) {
DCHECK(!sink_playing_);
return;
}
StopRendering_Locked();
}
void AudioRendererImpl::StopRendering_Locked() {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kPlaying);
DCHECK(sink_playing_);
lock_.AssertAcquired();
sink_playing_ = false;
base::AutoUnlock auto_unlock(lock_);
sink_->Pause();
stop_rendering_time_ = last_render_time_;
}
void AudioRendererImpl::SetMediaTime(base::TimeDelta time) {
DVLOG(1) << __func__ << "(" << time << ")";
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK(!rendering_);
DCHECK_EQ(state_, kFlushed);
start_timestamp_ = time;
ended_timestamp_ = kInfiniteDuration;
last_render_time_ = stop_rendering_time_ = base::TimeTicks();
first_packet_timestamp_ = kNoTimestamp;
audio_clock_.reset(new AudioClock(time, audio_parameters_.sample_rate()));
}
base::TimeDelta AudioRendererImpl::CurrentMediaTime() {
base::AutoLock auto_lock(lock_);
// Return the current time based on the known extents of the rendered audio
// data plus an estimate based on the last time those values were calculated.
base::TimeDelta current_media_time = audio_clock_->front_timestamp();
if (!last_render_time_.is_null()) {
current_media_time +=
(tick_clock_->NowTicks() - last_render_time_) * playback_rate_;
if (current_media_time > audio_clock_->back_timestamp())
current_media_time = audio_clock_->back_timestamp();
}
return current_media_time;
}
bool AudioRendererImpl::GetWallClockTimes(
const std::vector<base::TimeDelta>& media_timestamps,
std::vector<base::TimeTicks>* wall_clock_times) {
base::AutoLock auto_lock(lock_);
DCHECK(wall_clock_times->empty());
// When playback is paused (rate is zero), assume a rate of 1.0.
const double playback_rate = playback_rate_ ? playback_rate_ : 1.0;
const bool is_time_moving = sink_playing_ && playback_rate_ &&
!last_render_time_.is_null() &&
stop_rendering_time_.is_null() && !is_suspending_;
// Pre-compute the time until playback of the audio buffer extents, since
// these values are frequently used below.
const base::TimeDelta time_until_front =
audio_clock_->TimeUntilPlayback(audio_clock_->front_timestamp());
const base::TimeDelta time_until_back =
audio_clock_->TimeUntilPlayback(audio_clock_->back_timestamp());
if (media_timestamps.empty()) {
// Return the current media time as a wall clock time while accounting for
// frames which may be in the process of play out.
wall_clock_times->push_back(std::min(
std::max(tick_clock_->NowTicks(), last_render_time_ + time_until_front),
last_render_time_ + time_until_back));
return is_time_moving;
}
wall_clock_times->reserve(media_timestamps.size());
for (const auto& media_timestamp : media_timestamps) {
// When time was or is moving and the requested media timestamp is within
// range of played out audio, we can provide an exact conversion.
if (!last_render_time_.is_null() &&
media_timestamp >= audio_clock_->front_timestamp() &&
media_timestamp <= audio_clock_->back_timestamp()) {
wall_clock_times->push_back(
last_render_time_ + audio_clock_->TimeUntilPlayback(media_timestamp));
continue;
}
base::TimeDelta base_timestamp, time_until_playback;
if (media_timestamp < audio_clock_->front_timestamp()) {
base_timestamp = audio_clock_->front_timestamp();
time_until_playback = time_until_front;
} else {
base_timestamp = audio_clock_->back_timestamp();
time_until_playback = time_until_back;
}
// In practice, most calls will be estimates given the relatively small
// window in which clients can get the actual time.
wall_clock_times->push_back(last_render_time_ + time_until_playback +
(media_timestamp - base_timestamp) /
playback_rate);
}
return is_time_moving;
}
TimeSource* AudioRendererImpl::GetTimeSource() {
return this;
}
void AudioRendererImpl::Flush(const base::Closure& callback) {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK_EQ(state_, kPlaying);
DCHECK(flush_cb_.is_null());
flush_cb_ = callback;
ChangeState_Locked(kFlushing);
if (pending_read_)
return;
ChangeState_Locked(kFlushed);
DoFlush_Locked();
}
void AudioRendererImpl::DoFlush_Locked() {
DCHECK(task_runner_->BelongsToCurrentThread());
lock_.AssertAcquired();
DCHECK(!pending_read_);
DCHECK_EQ(state_, kFlushed);
ended_timestamp_ = kInfiniteDuration;
audio_buffer_stream_->Reset(base::Bind(&AudioRendererImpl::ResetDecoderDone,
weak_factory_.GetWeakPtr()));
}
void AudioRendererImpl::ResetDecoderDone() {
DCHECK(task_runner_->BelongsToCurrentThread());
{
base::AutoLock auto_lock(lock_);
DCHECK_EQ(state_, kFlushed);
DCHECK(!flush_cb_.is_null());
received_end_of_stream_ = false;
rendered_end_of_stream_ = false;
// Flush() may have been called while underflowed/not fully buffered.
if (buffering_state_ != BUFFERING_HAVE_NOTHING)
SetBufferingState_Locked(BUFFERING_HAVE_NOTHING);
if (buffer_converter_)
buffer_converter_->Reset();
algorithm_->FlushBuffers();
}
// Changes in buffering state are always posted. Flush callback must only be
// run after buffering state has been set back to nothing.
task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&flush_cb_));
}
void AudioRendererImpl::StartPlaying() {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK(!sink_playing_);
DCHECK_EQ(state_, kFlushed);
DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
DCHECK(!pending_read_) << "Pending read must complete before seeking";
ChangeState_Locked(kPlaying);
AttemptRead_Locked();
}
void AudioRendererImpl::Initialize(DemuxerStream* stream,
CdmContext* cdm_context,
RendererClient* client,
const PipelineStatusCB& init_cb) {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(client);
DCHECK(stream);
DCHECK_EQ(stream->type(), DemuxerStream::AUDIO);
DCHECK(!init_cb.is_null());
DCHECK(state_ == kUninitialized || state_ == kFlushed);
DCHECK(sink_.get());
// Trying to track down AudioClock crash, http://crbug.com/674856.
// Initialize should never be called while Rendering is ongoing. This can lead
// to race conditions between media/audio-device threads.
CHECK(!sink_playing_);
// This lock is not required by Initialize, but failing to acquire the lock
// would indicate a race with the rendering thread, which should not be active
// at this time. This is just extra verification on the |sink_playing_| CHECK
// above. We hold |lock_| while setting |sink_playing_|, but release the lock
// when calling sink_->Pause() to avoid deadlocking with the AudioMixer.
CHECK(lock_.Try());
lock_.Release();
// If we are re-initializing playback (e.g. switching media tracks), stop the
// sink first.
if (state_ == kFlushed) {
sink_->Stop();
audio_clock_.reset();
}
state_ = kInitializing;
client_ = client;
current_decoder_config_ = stream->audio_decoder_config();
DCHECK(current_decoder_config_.IsValidConfig());
auto output_device_info = sink_->GetOutputDeviceInfo();
const AudioParameters& hw_params = output_device_info.output_params();
ChannelLayout hw_channel_layout =
hw_params.IsValid() ? hw_params.channel_layout() : CHANNEL_LAYOUT_NONE;
audio_buffer_stream_ = std::make_unique<AudioBufferStream>(
std::make_unique<AudioBufferStream::StreamTraits>(media_log_,
hw_channel_layout),
task_runner_, create_audio_decoders_cb_, media_log_);
audio_buffer_stream_->set_config_change_observer(base::Bind(
&AudioRendererImpl::OnConfigChange, weak_factory_.GetWeakPtr()));
// Always post |init_cb_| because |this| could be destroyed if initialization
// failed.
init_cb_ = BindToCurrentLoop(init_cb);
AudioCodec codec = stream->audio_decoder_config().codec();
if (auto* mc = GetMediaClient())
is_passthrough_ = mc->IsSupportedBitstreamAudioCodec(codec);
else
is_passthrough_ = false;
expecting_config_changes_ = stream->SupportsConfigChanges();
bool use_stream_params = !expecting_config_changes_ || !hw_params.IsValid() ||
hw_params.format() == AudioParameters::AUDIO_FAKE ||
!sink_->IsOptimizedForHardwareParameters();
if (stream->audio_decoder_config().channel_layout() ==
CHANNEL_LAYOUT_DISCRETE &&
sink_->IsOptimizedForHardwareParameters()) {
use_stream_params = false;
}
// Target ~20ms for our buffer size (which is optimal for power efficiency and
// responsiveness to play/pause events), but if the hardware needs something
// even larger (say for Bluetooth devices) prefer that.
//
// Even if |use_stream_params| is true we should choose a value here based on
// hardware parameters since it affects the initial buffer size used by
// AudioRendererAlgorithm. Too small and we will underflow if the hardware
// asks for a buffer larger than the initial algorithm capacity.
const int preferred_buffer_size =
std::max(2 * stream->audio_decoder_config().samples_per_second() / 100,
hw_params.IsValid() ? hw_params.frames_per_buffer() : 0);
if (is_passthrough_) {
AudioParameters::Format format = AudioParameters::AUDIO_FAKE;
if (codec == kCodecAC3) {
format = AudioParameters::AUDIO_BITSTREAM_AC3;
} else if (codec == kCodecEAC3) {
format = AudioParameters::AUDIO_BITSTREAM_EAC3;
} else {
NOTREACHED();
}
// If we want the precise PCM frame count here, we have to somehow peek the
// audio bitstream and parse the header ahead of time. Instead, we ensure
// audio bus being large enough to accommodate
// kMaxFramesPerCompressedAudioBuffer frames. The real data size and frame
// count for bitstream formats will be carried in additional fields of
// AudioBus.
const int buffer_size =
AudioParameters::kMaxFramesPerCompressedAudioBuffer *
stream->audio_decoder_config().bytes_per_frame();
audio_parameters_.Reset(
format, stream->audio_decoder_config().channel_layout(),
stream->audio_decoder_config().samples_per_second(),
stream->audio_decoder_config().bits_per_channel(), buffer_size);
buffer_converter_.reset();
} else if (use_stream_params) {
audio_parameters_.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY,
stream->audio_decoder_config().channel_layout(),
stream->audio_decoder_config().samples_per_second(),
stream->audio_decoder_config().bits_per_channel(),
preferred_buffer_size);
audio_parameters_.set_channels_for_discrete(
stream->audio_decoder_config().channels());
buffer_converter_.reset();
} else {
// To allow for seamless sample rate adaptations (i.e. changes from say
// 16kHz to 48kHz), always resample to the hardware rate.
int sample_rate = hw_params.sample_rate();
// If supported by the OS and the initial sample rate is not too low, let
// the OS level resampler handle resampling for power efficiency.
if (AudioLatency::IsResamplingPassthroughSupported(
AudioLatency::LATENCY_PLAYBACK) &&
stream->audio_decoder_config().samples_per_second() >= 44100) {
sample_rate = stream->audio_decoder_config().samples_per_second();
}
int stream_channel_count = stream->audio_decoder_config().channels();
bool try_supported_channel_layouts = false;
#if defined(OS_WIN)
try_supported_channel_layouts =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kTrySupportedChannelLayouts);
#endif
// We don't know how to up-mix for DISCRETE layouts (fancy multichannel
// hardware with non-standard speaker arrangement). Instead, pretend the
// hardware layout is stereo and let the OS take care of further up-mixing
// to the discrete layout (http://crbug.com/266674). Additionally, pretend
// hardware is stereo whenever kTrySupportedChannelLayouts is set. This flag
// is for savvy users who want stereo content to output in all surround
// speakers. Using the actual layout (likely 5.1 or higher) will mean our
// mixer will attempt to up-mix stereo source streams to just the left/right
// speaker of the 5.1 setup, nulling out the other channels
// (http://crbug.com/177872).
ChannelLayout hw_channel_layout =
hw_params.channel_layout() == CHANNEL_LAYOUT_DISCRETE ||
try_supported_channel_layouts
? CHANNEL_LAYOUT_STEREO
: hw_params.channel_layout();
int hw_channel_count = ChannelLayoutToChannelCount(hw_channel_layout);
// The layout we pass to |audio_parameters_| will be used for the lifetime
// of this audio renderer, regardless of changes to hardware and/or stream
// properties. Below we choose the max of stream layout vs. hardware layout
// to leave room for changes to the hardware and/or stream (i.e. avoid
// premature down-mixing - http://crbug.com/379288).
// If stream_channels < hw_channels:
// Taking max means we up-mix to hardware layout. If stream later changes
// to have more channels, we aren't locked into down-mixing to the
// initial stream layout.
// If stream_channels > hw_channels:
// We choose to output stream's layout, meaning mixing is a no-op for the
// renderer. Browser-side will down-mix to the hardware config. If the
// hardware later changes to equal stream channels, browser-side will stop
// down-mixing and use the data from all stream channels.
ChannelLayout renderer_channel_layout =
hw_channel_count > stream_channel_count
? hw_channel_layout
: stream->audio_decoder_config().channel_layout();
audio_parameters_.Reset(hw_params.format(), renderer_channel_layout,
sample_rate, hw_params.bits_per_sample(),
media::AudioLatency::GetHighLatencyBufferSize(
sample_rate, preferred_buffer_size));
}
audio_parameters_.set_latency_tag(AudioLatency::LATENCY_PLAYBACK);
last_decoded_channel_layout_ =
stream->audio_decoder_config().channel_layout();
is_encrypted_ = stream->audio_decoder_config().is_encrypted();
last_decoded_channels_ = stream->audio_decoder_config().channels();
audio_clock_.reset(
new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate()));
audio_buffer_stream_->Initialize(
stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized,
weak_factory_.GetWeakPtr()),
cdm_context, base::Bind(&AudioRendererImpl::OnStatisticsUpdate,
weak_factory_.GetWeakPtr()),
base::Bind(&AudioRendererImpl::OnWaitingForDecryptionKey,
weak_factory_.GetWeakPtr()));
}
void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) {
DVLOG(1) << __func__ << ": " << success;
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
if (!success) {
state_ = kUninitialized;
base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
return;
}
if (!audio_parameters_.IsValid()) {
DVLOG(1) << __func__ << ": Invalid audio parameters: "
<< audio_parameters_.AsHumanReadableString();
ChangeState_Locked(kUninitialized);
// TODO(flim): If the channel layout is discrete but channel count is 0, a
// possible cause is that the input stream has > 8 channels but there is no
// Web Audio renderer attached and no channel mixing matrices defined for
// hardware renderers. Adding one for previewing content could be useful.
base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED);
return;
}
if (expecting_config_changes_)
buffer_converter_.reset(new AudioBufferConverter(audio_parameters_));
// We're all good! Continue initializing the rest of the audio renderer
// based on the decoder format.
algorithm_.reset(new AudioRendererAlgorithm());
algorithm_->Initialize(audio_parameters_, is_encrypted_);
ConfigureChannelMask();
ChangeState_Locked(kFlushed);
{
base::AutoUnlock auto_unlock(lock_);
sink_->Initialize(audio_parameters_, this);
sink_->Start();
// Some sinks play on start...
sink_->Pause();
}
DCHECK(!sink_playing_);
base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
}
void AudioRendererImpl::OnPlaybackError(PipelineStatus error) {
DCHECK(task_runner_->BelongsToCurrentThread());
client_->OnError(error);
}
void AudioRendererImpl::OnPlaybackEnded() {
DCHECK(task_runner_->BelongsToCurrentThread());
client_->OnEnded();
}
void AudioRendererImpl::OnStatisticsUpdate(const PipelineStatistics& stats) {
DCHECK(task_runner_->BelongsToCurrentThread());
client_->OnStatisticsUpdate(stats);
}
void AudioRendererImpl::OnBufferingStateChange(BufferingState state) {
DCHECK(task_runner_->BelongsToCurrentThread());
media_log_->AddEvent(media_log_->CreateBufferingStateChangedEvent(
"audio_buffering_state", state));
client_->OnBufferingStateChange(state);
}
void AudioRendererImpl::OnWaitingForDecryptionKey() {
DCHECK(task_runner_->BelongsToCurrentThread());
client_->OnWaitingForDecryptionKey();
}
void AudioRendererImpl::SetVolume(float volume) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(sink_.get());
sink_->SetVolume(volume);
}
void AudioRendererImpl::OnSuspend() {
base::AutoLock auto_lock(lock_);
is_suspending_ = true;
}
void AudioRendererImpl::OnResume() {
base::AutoLock auto_lock(lock_);
is_suspending_ = false;
}
void AudioRendererImpl::SetPlayDelayCBForTesting(PlayDelayCBForTesting cb) {
DCHECK_EQ(state_, kUninitialized);
play_delay_cb_for_testing_ = std::move(cb);
}
void AudioRendererImpl::DecodedAudioReady(
AudioBufferStream::Status status,
const scoped_refptr<AudioBuffer>& buffer) {
DVLOG(2) << __func__ << "(" << status << ")";
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK(state_ != kUninitialized);
CHECK(pending_read_);
pending_read_ = false;
if (status == AudioBufferStream::ABORTED ||
status == AudioBufferStream::DEMUXER_READ_ABORTED) {
HandleAbortedReadOrDecodeError(PIPELINE_OK);
return;
}
if (status == AudioBufferStream::DECODE_ERROR) {
HandleAbortedReadOrDecodeError(PIPELINE_ERROR_DECODE);
return;
}
DCHECK_EQ(status, AudioBufferStream::OK);
DCHECK(buffer.get());
if (state_ == kFlushing) {
ChangeState_Locked(kFlushed);
DoFlush_Locked();
return;
}
bool need_another_buffer = true;
if (expecting_config_changes_) {
if (!buffer->end_of_stream()) {
if (last_decoded_sample_rate_ &&
buffer->sample_rate() != last_decoded_sample_rate_) {
DVLOG(1) << __func__ << " Updating audio sample_rate."
<< " ts:" << buffer->timestamp().InMicroseconds()
<< " old:" << last_decoded_sample_rate_
<< " new:" << buffer->sample_rate();
// Send a bogus config to reset timestamp state.
OnConfigChange(AudioDecoderConfig());
}
last_decoded_sample_rate_ = buffer->sample_rate();
if (last_decoded_channel_layout_ != buffer->channel_layout()) {
if (buffer->channel_layout() == CHANNEL_LAYOUT_DISCRETE) {
MEDIA_LOG(ERROR, media_log_)
<< "Unsupported midstream configuration change! Discrete channel"
<< " layout not allowed by sink.";
HandleAbortedReadOrDecodeError(PIPELINE_ERROR_DECODE);
return;
} else {
last_decoded_channel_layout_ = buffer->channel_layout();
last_decoded_channels_ = buffer->channel_count();
ConfigureChannelMask();
}
}
}
DCHECK(buffer_converter_);
buffer_converter_->AddInput(buffer);
while (buffer_converter_->HasNextBuffer()) {
need_another_buffer =
HandleDecodedBuffer_Locked(buffer_converter_->GetNextBuffer());
}
} else {
// TODO(chcunningham, tguilbert): Figure out if we want to support implicit
// config changes during src=. Doing so requires resampling each individual
// stream which is inefficient when there are many tags in a page.
//
// Check if the buffer we received matches the expected configuration.
// Note: We explicitly do not check channel layout here to avoid breaking
// weird behavior with multichannel wav files: http://crbug.com/600538.
if (!buffer->end_of_stream() &&
(buffer->sample_rate() != audio_parameters_.sample_rate() ||
buffer->channel_count() != audio_parameters_.channels())) {
MEDIA_LOG(ERROR, media_log_)
<< "Unsupported midstream configuration change!"
<< " Sample Rate: " << buffer->sample_rate() << " vs "
<< audio_parameters_.sample_rate()
<< ", Channels: " << buffer->channel_count() << " vs "
<< audio_parameters_.channels();
HandleAbortedReadOrDecodeError(PIPELINE_ERROR_DECODE);
return;
}
need_another_buffer = HandleDecodedBuffer_Locked(buffer);
}
if (!need_another_buffer && !CanRead_Locked())
return;
AttemptRead_Locked();
}
bool AudioRendererImpl::HandleDecodedBuffer_Locked(
const scoped_refptr<AudioBuffer>& buffer) {
lock_.AssertAcquired();
if (buffer->end_of_stream()) {
received_end_of_stream_ = true;
} else {
if (buffer->IsBitstreamFormat() && state_ == kPlaying) {
if (IsBeforeStartTime(buffer))
return true;
// Adjust the start time since we are unable to trim a compressed audio
// buffer.
if (buffer->timestamp() < start_timestamp_ &&
(buffer->timestamp() + buffer->duration()) > start_timestamp_) {
start_timestamp_ = buffer->timestamp();
audio_clock_.reset(new AudioClock(buffer->timestamp(),
audio_parameters_.sample_rate()));
}
} else if (state_ == kPlaying) {
if (IsBeforeStartTime(buffer))
return true;
// Trim off any additional time before the start timestamp.
const base::TimeDelta trim_time = start_timestamp_ - buffer->timestamp();
if (trim_time > base::TimeDelta()) {
buffer->TrimStart(buffer->frame_count() *
(static_cast<double>(trim_time.InMicroseconds()) /
buffer->duration().InMicroseconds()));
buffer->set_timestamp(start_timestamp_);
}
// If the entire buffer was trimmed, request a new one.
if (!buffer->frame_count())
return true;
}
if (state_ != kUninitialized)
algorithm_->EnqueueBuffer(buffer);
}
// Store the timestamp of the first packet so we know when to start actual
// audio playback.
if (first_packet_timestamp_ == kNoTimestamp)
first_packet_timestamp_ = buffer->timestamp();
const size_t memory_usage = algorithm_->GetMemoryUsage();
PipelineStatistics stats;
stats.audio_memory_usage = memory_usage - last_audio_memory_usage_;
last_audio_memory_usage_ = memory_usage;
task_runner_->PostTask(FROM_HERE,
base::Bind(&AudioRendererImpl::OnStatisticsUpdate,
weak_factory_.GetWeakPtr(), stats));
switch (state_) {
case kUninitialized:
case kInitializing:
case kFlushing:
NOTREACHED();
return false;
case kFlushed:
DCHECK(!pending_read_);
return false;
case kPlaying:
if (buffer->end_of_stream() || algorithm_->IsQueueFull()) {
if (buffering_state_ == BUFFERING_HAVE_NOTHING)
SetBufferingState_Locked(BUFFERING_HAVE_ENOUGH);
return false;
}
return true;
}
return false;
}
void AudioRendererImpl::AttemptRead() {
base::AutoLock auto_lock(lock_);
AttemptRead_Locked();
}
void AudioRendererImpl::AttemptRead_Locked() {
DCHECK(task_runner_->BelongsToCurrentThread());
lock_.AssertAcquired();
if (!CanRead_Locked())
return;
pending_read_ = true;
audio_buffer_stream_->Read(base::Bind(&AudioRendererImpl::DecodedAudioReady,
weak_factory_.GetWeakPtr()));
}
bool AudioRendererImpl::CanRead_Locked() {
lock_.AssertAcquired();
switch (state_) {
case kUninitialized:
case kInitializing:
case kFlushing:
case kFlushed:
return false;
case kPlaying:
break;
}
return !pending_read_ && !received_end_of_stream_ &&
!algorithm_->IsQueueFull();
}
void AudioRendererImpl::SetPlaybackRate(double playback_rate) {
DVLOG(1) << __func__ << "(" << playback_rate << ")";
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_GE(playback_rate, 0);
DCHECK(sink_.get());
base::AutoLock auto_lock(lock_);
if (is_passthrough_ && playback_rate != 0 && playback_rate != 1) {
MEDIA_LOG(INFO, media_log_) << "Playback rate changes are not supported "
"when output compressed bitstream."
<< " Playback Rate: " << playback_rate;
return;
}
// We have two cases here:
// Play: current_playback_rate == 0 && playback_rate != 0
// Pause: current_playback_rate != 0 && playback_rate == 0
double current_playback_rate = playback_rate_;
playback_rate_ = playback_rate;
if (!rendering_)
return;
if (current_playback_rate == 0 && playback_rate != 0) {
StartRendering_Locked();
return;
}
if (current_playback_rate != 0 && playback_rate == 0) {
StopRendering_Locked();
return;
}
}
bool AudioRendererImpl::IsBeforeStartTime(
const scoped_refptr<AudioBuffer>& buffer) {
DCHECK_EQ(state_, kPlaying);
return buffer.get() && !buffer->end_of_stream() &&
(buffer->timestamp() + buffer->duration()) < start_timestamp_;
}
int AudioRendererImpl::Render(base::TimeDelta delay,
base::TimeTicks delay_timestamp,
int prior_frames_skipped,
AudioBus* audio_bus) {
TRACE_EVENT1("media", "AudioRendererImpl::Render", "id", media_log_->id());
int frames_requested = audio_bus->frames();
DVLOG(4) << __func__ << " delay:" << delay
<< " prior_frames_skipped:" << prior_frames_skipped
<< " frames_requested:" << frames_requested;
int frames_written = 0;
{
base::AutoLock auto_lock(lock_);
last_render_time_ = tick_clock_->NowTicks();
int64_t frames_delayed = AudioTimestampHelper::TimeToFrames(
delay, audio_parameters_.sample_rate());
if (!stop_rendering_time_.is_null()) {
audio_clock_->CompensateForSuspendedWrites(
last_render_time_ - stop_rendering_time_, frames_delayed);
stop_rendering_time_ = base::TimeTicks();
}
// Ensure Stop() hasn't destroyed our |algorithm_| on the pipeline thread.
if (!algorithm_) {
audio_clock_->WroteAudio(0, frames_requested, frames_delayed,
playback_rate_);
return 0;
}
if (playback_rate_ == 0 || is_suspending_) {
audio_clock_->WroteAudio(0, frames_requested, frames_delayed,
playback_rate_);
return 0;
}
// Mute audio by returning 0 when not playing.
if (state_ != kPlaying) {
audio_clock_->WroteAudio(0, frames_requested, frames_delayed,
playback_rate_);
return 0;
}
if (is_passthrough_ && algorithm_->frames_buffered() > 0) {
// TODO(tsunghung): For compressed bitstream formats, play zeroed buffer
// won't generate delay. It could be discarded immediately. Need another
// way to generate audio delay.
const base::TimeDelta play_delay =
first_packet_timestamp_ - audio_clock_->back_timestamp();
if (play_delay > base::TimeDelta()) {
MEDIA_LOG(ERROR, media_log_)
<< "Cannot add delay for compressed audio bitstream foramt."
<< " Requested delay: " << play_delay;
}
frames_written += algorithm_->FillBuffer(audio_bus, 0, frames_requested,
playback_rate_);
// See Initialize(), the |audio_bus| should be bigger than we need in
// bitstream cases. Fix |frames_requested| to avoid incorrent time
// calculation of |audio_clock_| below.
frames_requested = frames_written;
} else if (algorithm_->frames_buffered() > 0) {
// Delay playback by writing silence if we haven't reached the first
// timestamp yet; this can occur if the video starts before the audio.
CHECK_NE(first_packet_timestamp_, kNoTimestamp);
CHECK_GE(first_packet_timestamp_, base::TimeDelta());
const base::TimeDelta play_delay =
first_packet_timestamp_ - audio_clock_->back_timestamp();
if (play_delay > base::TimeDelta()) {
DCHECK_EQ(frames_written, 0);
if (!play_delay_cb_for_testing_.is_null())
play_delay_cb_for_testing_.Run(play_delay);
// Don't multiply |play_delay| out since it can be a huge value on
// poorly encoded media and multiplying by the sample rate could cause
// the value to overflow.
if (play_delay.InSecondsF() > static_cast<double>(frames_requested) /
audio_parameters_.sample_rate()) {
frames_written = frames_requested;
} else {
frames_written =
play_delay.InSecondsF() * audio_parameters_.sample_rate();
}
audio_bus->ZeroFramesPartial(0, frames_written);
}
// If there's any space left, actually render the audio; this is where the
// aural magic happens.
if (frames_written < frames_requested) {
frames_written += algorithm_->FillBuffer(
audio_bus, frames_written, frames_requested - frames_written,
playback_rate_);
}
}
// We use the following conditions to determine end of playback:
// 1) Algorithm can not fill the audio callback buffer
// 2) We received an end of stream buffer
// 3) We haven't already signalled that we've ended
// 4) We've played all known audio data sent to hardware
//
// We use the following conditions to determine underflow:
// 1) Algorithm can not fill the audio callback buffer
// 2) We have NOT received an end of stream buffer
// 3) We are in the kPlaying state
//
// Otherwise the buffer has data we can send to the device.
//
// Per the TimeSource API the media time should always increase even after
// we've rendered all known audio data. Doing so simplifies scenarios where
// we have other sources of media data that need to be scheduled after audio
// data has ended.
//
// That being said, we don't want to advance time when underflowed as we
// know more decoded frames will eventually arrive. If we did, we would
// throw things out of sync when said decoded frames arrive.
int frames_after_end_of_stream = 0;
if (frames_written == 0) {
if (received_end_of_stream_) {
if (ended_timestamp_ == kInfiniteDuration)
ended_timestamp_ = audio_clock_->back_timestamp();
frames_after_end_of_stream = frames_requested;
} else if (state_ == kPlaying &&
buffering_state_ != BUFFERING_HAVE_NOTHING) {
algorithm_->IncreaseQueueCapacity();
SetBufferingState_Locked(BUFFERING_HAVE_NOTHING);
}
} else if (frames_written < frames_requested && !received_end_of_stream_) {
// If we only partially filled the request and should have more data, go
// ahead and increase queue capacity to try and meet the next request.
algorithm_->IncreaseQueueCapacity();
}
audio_clock_->WroteAudio(frames_written + frames_after_end_of_stream,
frames_requested, frames_delayed, playback_rate_);
if (CanRead_Locked()) {
task_runner_->PostTask(FROM_HERE,
base::Bind(&AudioRendererImpl::AttemptRead,
weak_factory_.GetWeakPtr()));
}
if (audio_clock_->front_timestamp() >= ended_timestamp_ &&
!rendered_end_of_stream_) {
rendered_end_of_stream_ = true;
task_runner_->PostTask(FROM_HERE,
base::Bind(&AudioRendererImpl::OnPlaybackEnded,
weak_factory_.GetWeakPtr()));
}
}
DCHECK_LE(frames_written, frames_requested);
return frames_written;
}
void AudioRendererImpl::OnRenderError() {
MEDIA_LOG(ERROR, media_log_) << "audio render error";
// Post to |task_runner_| as this is called on the audio callback thread.
task_runner_->PostTask(
FROM_HERE, base::Bind(&AudioRendererImpl::OnPlaybackError,
weak_factory_.GetWeakPtr(), AUDIO_RENDERER_ERROR));
}
void AudioRendererImpl::HandleAbortedReadOrDecodeError(PipelineStatus status) {
DCHECK(task_runner_->BelongsToCurrentThread());
lock_.AssertAcquired();
switch (state_) {
case kUninitialized:
case kInitializing:
NOTREACHED();
return;
case kFlushing:
ChangeState_Locked(kFlushed);
if (status == PIPELINE_OK) {
DoFlush_Locked();
return;
}
MEDIA_LOG(ERROR, media_log_) << "audio error during flushing, status: "
<< MediaLog::PipelineStatusToString(status);
client_->OnError(status);
base::ResetAndReturn(&flush_cb_).Run();
return;
case kFlushed:
case kPlaying:
if (status != PIPELINE_OK) {
MEDIA_LOG(ERROR, media_log_)
<< "audio error during playing, status: "
<< MediaLog::PipelineStatusToString(status);
client_->OnError(status);
}
return;
}
}
void AudioRendererImpl::ChangeState_Locked(State new_state) {
DVLOG(1) << __func__ << " : " << state_ << " -> " << new_state;
lock_.AssertAcquired();
state_ = new_state;
}
void AudioRendererImpl::OnConfigChange(const AudioDecoderConfig& config) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(expecting_config_changes_);
buffer_converter_->ResetTimestampState();
// An invalid config may be supplied by callers who simply want to reset
// internal state outside of detecting a new config from the demuxer stream.
// RendererClient only cares to know about config changes that differ from
// previous configs.
if (config.IsValidConfig() && !current_decoder_config_.Matches(config)) {
current_decoder_config_ = config;
client_->OnAudioConfigChange(config);
}
}
void AudioRendererImpl::SetBufferingState_Locked(
BufferingState buffering_state) {
DVLOG(1) << __func__ << " : " << buffering_state_ << " -> "
<< buffering_state;
DCHECK_NE(buffering_state_, buffering_state);
lock_.AssertAcquired();
buffering_state_ = buffering_state;
task_runner_->PostTask(
FROM_HERE, base::Bind(&AudioRendererImpl::OnBufferingStateChange,
weak_factory_.GetWeakPtr(), buffering_state_));
}
void AudioRendererImpl::ConfigureChannelMask() {
DCHECK(algorithm_);
DCHECK(audio_parameters_.IsValid());
DCHECK_NE(last_decoded_channel_layout_, CHANNEL_LAYOUT_NONE);
DCHECK_NE(last_decoded_channel_layout_, CHANNEL_LAYOUT_UNSUPPORTED);
// If we're actually downmixing the signal, no mask is necessary, but ensure
// we clear any existing mask if present.
if (last_decoded_channels_ >= audio_parameters_.channels()) {
algorithm_->SetChannelMask(
std::vector<bool>(audio_parameters_.channels(), true));
return;
}
// Determine the matrix used to upmix the channels.
std::vector<std::vector<float>> matrix;
ChannelMixingMatrix(last_decoded_channel_layout_, last_decoded_channels_,
audio_parameters_.channel_layout(),
audio_parameters_.channels())
.CreateTransformationMatrix(&matrix);
// All channels with a zero mix are muted and can be ignored.
std::vector<bool> channel_mask(audio_parameters_.channels(), false);
for (size_t ch = 0; ch < matrix.size(); ++ch) {
channel_mask[ch] = std::any_of(matrix[ch].begin(), matrix[ch].end(),
[](float mix) { return !!mix; });
}
algorithm_->SetChannelMask(std::move(channel_mask));
}
} // namespace media
| [
"[email protected]"
] | |
a71d5f7a39e45d5df503d715ba7ebe234a772c69 | 534e2e3d8d8bebd2366c0fee60886d84597ee0ef | /GJ/b027.cpp | 23e33db8c2f668d0fbc1c885d7050b6d136ddd7a | [] | no_license | coldEr66/online-judge | a8844d3f35755adafd4f43a1f08ce56b6b870601 | e85ec0750d92dd00133c93284085a0f5d8a11d36 | refs/heads/master | 2021-09-07T01:58:10.634492 | 2021-07-28T16:31:13 | 2021-07-28T16:31:13 | 128,494,315 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 497 | cpp | #include <iostream>
#include <algorithm> //min,max要用這個
using namespace std;
typedef long long ll;
ll dp[505][505];
int main(){
ll n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
ll x;
cin>>x;
if(x==0) dp[i][j]=1;
}
}
ll ans=-1;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(!dp[i][j]) continue;
dp[i][j]=min(min(dp[i][j-1],dp[i-1][j]),dp[i-1][j-1])+1;
ans=max(ans,dp[i][j]);
}
}
cout<<ans*ans<<endl;
}
| [
"[email protected]"
] | |
e3987dbb15d395cb5c1030235e5a54fd1098c239 | 5e25ec6fcddb07eb7de490a353e92e14a7d357f2 | /src/Geometry/BoundingBoxTree.cpp | 753c6c272d1a8b155d61a71c84522a6fc8510470 | [] | no_license | retrodump/vapor_engine | 13aaf8e763a2ef775922e11860579e619402baef | 1d462d4cfa33af057f3bea0ec87d07eb91daa168 | refs/heads/master | 2021-09-03T06:57:51.782716 | 2012-06-07T00:53:16 | 2012-06-07T00:53:16 | 116,496,920 | 1 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 27,262 | cpp | /************************************************************************
*
* vapor3D Engine © (2008-2010)
*
* <http://www.vapor3d.org>
*
************************************************************************/
#include "Engine/API.h"
#include "Geometry/BoundingBoxTree.h"
// This code snippet allows you to create an axis aligned bounding volume tree for a triangle mesh so that you can do
// high-speed raycasting.
//
// This code snippet was written by John W. Ratcliff on August 18, 2011 and released under the MIT. license.
NAMESPACE_ENGINE_BEGIN
//-----------------------------------//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* A method to compute a ray-AABB intersection.
* Original code by Andrew Woo, from "Graphics Gems", Academic Press, 1990
* Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500)
* Epsilon value added by Klaus Hartmann. (discarding it saves a few cycles only)
*
* Hence this version is faster as well as more robust than the original one.
*
* Should work provided:
* 1) the integer representation of 0.0f is 0x00000000
* 2) the sign bit of the float is the most significant one
*
* Report bugs: [email protected]
*
* \param aabb [in] the axis-aligned bounding box
* \param origin [in] ray origin
* \param dir [in] ray direction
* \param coord [out] impact coordinates
* \return true if ray intersects AABB
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define RAYAABB_EPSILON 0.00001f
//! Integer representation of a floating-point value.
#define IR(x) ((uint32&)x)
bool intersectRayAABB(const float MinB[3],const float MaxB[3],const float origin[3],const float dir[3],float coord[3])
{
bool Inside = true;
float MaxT[3];
MaxT[0]=MaxT[1]=MaxT[2]=-1.0f;
// Find candidate planes.
for(uint32 i=0;i<3;i++)
{
if(origin[i] < MinB[i])
{
coord[i] = MinB[i];
Inside = false;
// Calculate T distances to candidate planes
if(IR(dir[i])) MaxT[i] = (MinB[i] - origin[i]) / dir[i];
}
else if(origin[i] > MaxB[i])
{
coord[i] = MaxB[i];
Inside = false;
// Calculate T distances to candidate planes
if(IR(dir[i])) MaxT[i] = (MaxB[i] - origin[i]) / dir[i];
}
}
// Ray origin inside bounding box
if(Inside)
{
coord[0] = origin[0];
coord[1] = origin[1];
coord[2] = origin[2];
return true;
}
// Get largest of the maxT's for final choice of intersection
uint32 WhichPlane = 0;
if(MaxT[1] > MaxT[WhichPlane]) WhichPlane = 1;
if(MaxT[2] > MaxT[WhichPlane]) WhichPlane = 2;
// Check final candidate actually inside box
if(IR(MaxT[WhichPlane])&0x80000000) return false;
for(uint32 i=0;i<3;i++)
{
if(i!=WhichPlane)
{
coord[i] = origin[i] + MaxT[WhichPlane] * dir[i];
#ifdef RAYAABB_EPSILON
if(coord[i] < MinB[i] - RAYAABB_EPSILON || coord[i] > MaxB[i] + RAYAABB_EPSILON) return false;
#else
if(coord[i] < MinB[i] || coord[i] > MaxB[i]) return false;
#endif
}
}
return true; // ray hits box
}
//-----------------------------------//
bool intersectLineSegmentAABB(const float bmin[3],const float bmax[3],const float p1[3],const float dir[3],float &dist,float intersect[3])
{
bool ret = false;
if ( dist > RAYAABB_EPSILON )
{
ret = intersectRayAABB(bmin,bmax,p1,dir,intersect);
if ( ret )
{
float dx = p1[0]-intersect[0];
float dy = p1[1]-intersect[1];
float dz = p1[2]-intersect[2];
float d = dx*dx+dy*dy+dz*dz;
if ( d < dist*dist )
{
dist = sqrtf(d);
}
else
{
ret = false;
}
}
}
return ret;
}
/* a = b - c */
#define vector(a,b,c) \
(a)[0] = (b)[0] - (c)[0]; \
(a)[1] = (b)[1] - (c)[1]; \
(a)[2] = (b)[2] - (c)[2];
#define innerProduct(v,q) \
((v)[0] * (q)[0] + \
(v)[1] * (q)[1] + \
(v)[2] * (q)[2])
#define crossProduct(a,b,c) \
(a)[0] = (b)[1] * (c)[2] - (c)[1] * (b)[2]; \
(a)[1] = (b)[2] * (c)[0] - (c)[2] * (b)[0]; \
(a)[2] = (b)[0] * (c)[1] - (c)[0] * (b)[1];
static inline bool rayIntersectsTriangle(const float *p,const float *d,const float *v0,const float *v1,const float *v2,float &t)
{
float e1[3],e2[3],h[3],s[3],q[3];
float a,f,u,v;
vector(e1,v1,v0);
vector(e2,v2,v0);
crossProduct(h,d,e2);
a = innerProduct(e1,h);
if (a > -0.00001 && a < 0.00001)
return(false);
f = 1/a;
vector(s,p,v0);
u = f * (innerProduct(s,h));
if (u < 0.0 || u > 1.0)
return(false);
crossProduct(q,s,e1);
v = f * innerProduct(d,q);
if (v < 0.0 || u + v > 1.0)
return(false);
// at this stage we can compute t to find out where
// the intersection point is on the line
t = f * innerProduct(e2,q);
if (t > 0) // ray intersection
return(true);
else // this means that there is a line intersection
// but not a ray intersection
return (false);
}
static float computePlane(const float *A,const float *B,const float *C,float *n) // returns D
{
float vx = (B[0] - C[0]);
float vy = (B[1] - C[1]);
float vz = (B[2] - C[2]);
float wx = (A[0] - B[0]);
float wy = (A[1] - B[1]);
float wz = (A[2] - B[2]);
float vw_x = vy * wz - vz * wy;
float vw_y = vz * wx - vx * wz;
float vw_z = vx * wy - vy * wx;
float mag = sqrt((vw_x * vw_x) + (vw_y * vw_y) + (vw_z * vw_z));
if ( mag < 0.000001f )
{
mag = 0;
}
else
{
mag = 1.0f/mag;
}
float x = vw_x * mag;
float y = vw_y * mag;
float z = vw_z * mag;
float D = 0.0f - ((x*A[0])+(y*A[1])+(z*A[2]));
n[0] = x;
n[1] = y;
n[2] = z;
return D;
}
//-----------------------------------//
/********************************************************/
/* AABB-triangle overlap test code */
/* by Tomas Akenine-Möller */
/* Function: int triBoxOverlap(float boxcenter[3], */
/* float boxhalfsize[3],float triverts[3][3]); */
/* History: */
/* 2001-03-05: released the code in its first version */
/* 2001-06-18: changed the order of the tests, faster */
/* */
/* Acknowledgement: Many thanks to Pierre Terdiman for */
/* suggestions and discussions on how to optimize code. */
/* Thanks to David Hunt for finding a ">="-bug! */
/********************************************************/
#define X 0
#define Y 1
#define Z 2
#define CROSS(dest,v1,v2) \
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
dest[2]=v1[0]*v2[1]-v1[1]*v2[0];
#define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
#define SUB(dest,v1,v2) \
dest[0]=v1[0]-v2[0]; \
dest[1]=v1[1]-v2[1]; \
dest[2]=v1[2]-v2[2];
#define FINDMINMAX(x0,x1,x2,min,max) \
min = max = x0; \
if(x1<min) min=x1;\
if(x1>max) max=x1;\
if(x2<min) min=x2;\
if(x2>max) max=x2;
int planeBoxOverlap(float normal[3],float d, float maxbox[3])
{
int q;
float vmin[3],vmax[3];
for(q=X;q<=Z;q++)
{
if(normal[q]>0.0f)
{
vmin[q]=-maxbox[q];
vmax[q]=maxbox[q];
}
else
{
vmin[q]=maxbox[q];
vmax[q]=-maxbox[q];
}
}
if(DOT(normal,vmin)+d>0.0f) return 0;
if(DOT(normal,vmax)+d>=0.0f) return 1;
return 0;
}
/*======================== X-tests ========================*/
#define AXISTEST_X01(a, b, fa, fb) \
p0 = a*v0[Y] - b*v0[Z]; \
p2 = a*v2[Y] - b*v2[Z]; \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if(min>rad || max<-rad) return 0;
#define AXISTEST_X2(a, b, fa, fb) \
p0 = a*v0[Y] - b*v0[Z]; \
p1 = a*v1[Y] - b*v1[Z]; \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if(min>rad || max<-rad) return 0;
/*======================== Y-tests ========================*/
#define AXISTEST_Y02(a, b, fa, fb) \
p0 = -a*v0[X] + b*v0[Z]; \
p2 = -a*v2[X] + b*v2[Z]; \
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if(min>rad || max<-rad) return 0;
#define AXISTEST_Y1(a, b, fa, fb) \
p0 = -a*v0[X] + b*v0[Z]; \
p1 = -a*v1[X] + b*v1[Z]; \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if(min>rad || max<-rad) return 0;
/*======================== Z-tests ========================*/
#define AXISTEST_Z12(a, b, fa, fb) \
p1 = a*v1[X] - b*v1[Y]; \
p2 = a*v2[X] - b*v2[Y]; \
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if(min>rad || max<-rad) return 0;
#define AXISTEST_Z0(a, b, fa, fb) \
p0 = a*v0[X] - b*v0[Y]; \
p1 = a*v1[X] - b*v1[Y]; \
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if(min>rad || max<-rad) return 0;
int triBoxOverlap(float boxcenter[3],float boxhalfsize[3],float triverts[3][3])
{
/* use separating axis theorem to test overlap between triangle and box */
/* need to test for overlap in these directions: */
/* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */
/* we do not even need to test these) */
/* 2) normal of the triangle */
/* 3) crossproduct(edge from tri, {x,y,z}-directin) */
/* this gives 3x3=9 more tests */
float v0[3],v1[3],v2[3];
float min,max,d,p0,p1,p2,rad,fex,fey,fez;
float normal[3],e0[3],e1[3],e2[3];
/* This is the fastest branch on Sun */
/* move everything so that the boxcenter is in (0,0,0) */
SUB(v0,triverts[0],boxcenter);
SUB(v1,triverts[1],boxcenter);
SUB(v2,triverts[2],boxcenter);
/* compute triangle edges */
SUB(e0,v1,v0); /* tri edge 0 */
SUB(e1,v2,v1); /* tri edge 1 */
SUB(e2,v0,v2); /* tri edge 2 */
/* Bullet 3: */
/* test the 9 tests first (this was faster) */
fex = fabs(e0[X]);
fey = fabs(e0[Y]);
fez = fabs(e0[Z]);
AXISTEST_X01(e0[Z], e0[Y], fez, fey);
AXISTEST_Y02(e0[Z], e0[X], fez, fex);
AXISTEST_Z12(e0[Y], e0[X], fey, fex);
fex = fabs(e1[X]);
fey = fabs(e1[Y]);
fez = fabs(e1[Z]);
AXISTEST_X01(e1[Z], e1[Y], fez, fey);
AXISTEST_Y02(e1[Z], e1[X], fez, fex);
AXISTEST_Z0(e1[Y], e1[X], fey, fex);
fex = fabs(e2[X]);
fey = fabs(e2[Y]);
fez = fabs(e2[Z]);
AXISTEST_X2(e2[Z], e2[Y], fez, fey);
AXISTEST_Y1(e2[Z], e2[X], fez, fex);
AXISTEST_Z12(e2[Y], e2[X], fey, fex);
/* Bullet 1: */
/* first test overlap in the {x,y,z}-directions */
/* find min, max of the triangle each direction, and test for overlap in */
/* that direction -- this is equivalent to testing a minimal AABB around */
/* the triangle against the AABB */
/* test in X-direction */
FINDMINMAX(v0[X],v1[X],v2[X],min,max);
if(min>boxhalfsize[X] || max<-boxhalfsize[X]) return 0;
/* test in Y-direction */
FINDMINMAX(v0[Y],v1[Y],v2[Y],min,max);
if(min>boxhalfsize[Y] || max<-boxhalfsize[Y]) return 0;
/* test in Z-direction */
FINDMINMAX(v0[Z],v1[Z],v2[Z],min,max);
if(min>boxhalfsize[Z] || max<-boxhalfsize[Z]) return 0;
/* Bullet 2: */
/* test if the box intersects the plane of the triangle */
/* compute plane equation of triangle: normal*x+d=0 */
CROSS(normal,e0,e1);
d=-DOT(normal,v0); /* plane eq: normal.x+d=0 */
if(!planeBoxOverlap(normal,d,boxhalfsize)) return 0;
return 1; /* box and triangle overlaps */
}
//-----------------------------------//
enum AxisAABB
{
AABB_XAXIS,
AABB_YAXIS,
AABB_ZAXIS
};
enum ClipCode
{
OLEFT = (1<<0),
ORIGHT = (1<<1),
OTOP = (1<<2),
OBOTTOM = (1<<3),
OFRONT = (1<<4),
OBACK = (1<<5),
};
//-----------------------------------//
class BoundsAABB
{
public:
void setMin(const float *v)
{
mMin[0] = v[0];
mMin[1] = v[1];
mMin[2] = v[2];
}
void setMax(const float *v)
{
mMax[0] = v[0];
mMax[1] = v[1];
mMax[2] = v[2];
}
void setMin(float x,float y,float z)
{
mMin[0] = x;
mMin[1] = y;
mMin[2] = z;
}
void setMax(float x,float y,float z)
{
mMax[0] = x;
mMax[1] = y;
mMax[2] = z;
}
void include(const float *v)
{
if ( v[0] < mMin[0] ) mMin[0] = v[0];
if ( v[1] < mMin[1] ) mMin[1] = v[1];
if ( v[2] < mMin[2] ) mMin[2] = v[2];
if ( v[0] > mMax[0] ) mMax[0] = v[0];
if ( v[1] > mMax[1] ) mMax[1] = v[1];
if ( v[2] > mMax[2] ) mMax[2] = v[2];
}
void getCenter(float *center) const
{
center[0] = (mMin[0]+mMax[0])*0.5f;
center[1] = (mMin[1]+mMax[1])*0.5f;
center[2] = (mMin[2]+mMax[2])*0.5f;
}
bool containsTriangle(const float *p1,const float *p2,const float *p3) const
{
float boxCenter[3];
float boxHalfSize[3];
float triVerts[3][3];
boxCenter[0] = (mMin[0]+mMax[0])*0.5f;
boxCenter[1] = (mMin[1]+mMax[1])*0.5f;
boxCenter[2] = (mMin[2]+mMax[2])*0.5f;
boxHalfSize[0] = (mMax[0]-mMin[0])*0.5f;
boxHalfSize[1] = (mMax[1]-mMin[1])*0.5f;
boxHalfSize[2] = (mMax[2]-mMin[2])*0.5f;
triVerts[0][0] = p1[0];
triVerts[0][1] = p1[1];
triVerts[0][2] = p1[2];
triVerts[1][0] = p2[0];
triVerts[1][1] = p2[1];
triVerts[1][2] = p2[2];
triVerts[2][0] = p3[0];
triVerts[2][1] = p3[1];
triVerts[2][2] = p3[2];
int ret = triBoxOverlap(boxCenter,boxHalfSize,triVerts);
return ret == 1 ? true : false;
}
void clamp(const BoundsAABB &aabb)
{
if ( mMin[0] < aabb.mMin[0] ) mMin[0] = aabb.mMin[0];
if ( mMin[1] < aabb.mMin[1] ) mMin[1] = aabb.mMin[1];
if ( mMin[2] < aabb.mMin[2] ) mMin[2] = aabb.mMin[2];
if ( mMax[0] > aabb.mMax[0] ) mMax[0] = aabb.mMax[0];
if ( mMax[1] > aabb.mMax[1] ) mMax[1] = aabb.mMax[1];
if ( mMax[2] > aabb.mMax[2] ) mMax[2] = aabb.mMax[2];
}
float mMin[3];
float mMax[3];
};
#define TRI_EOF 0xFFFFFFFF
typedef std::vector< uint32 > TriVector;
class NodeAABB
{
public:
NodeAABB(void)
{
mLeft = NULL;
mRight = NULL;
mLeafTriangleIndex= TRI_EOF;
}
NodeAABB(uint32 vcount,const float *vertices,uint32 tcount,uint32 *indices,
uint32 maxDepth, // Maximum recursion depth for the triangle mesh.
uint32 minLeafSize, // minimum triangles to treat as a 'leaf' node.
float minAxisSize,// once a particular axis is less than this size, stop sub-dividing.
NodeInterface *callback,
TriVector &leafTriangles)
{
mLeft = NULL;
mRight = NULL;
mLeafTriangleIndex = TRI_EOF;
TriVector triangles;
triangles.reserve(tcount);
for (uint32 i=0; i<tcount; i++)
{
triangles.push_back(i);
}
mBounds.setMin( vertices );
mBounds.setMax( vertices );
const float *vtx = vertices+3;
for (uint32 i=1; i<vcount; i++)
{
mBounds.include( vtx );
vtx+=3;
}
split(triangles,vcount,vertices,tcount,indices,0,maxDepth,minLeafSize,minAxisSize,callback,leafTriangles);
}
NodeAABB(const BoundsAABB &aabb)
{
mBounds = aabb;
mLeft = NULL;
mRight = NULL;
mLeafTriangleIndex = TRI_EOF;
}
~NodeAABB(void)
{
}
// here is where we split the mesh..
void split(const TriVector &triangles,
uint32 vcount,
const float *vertices,
uint32 tcount,
const uint32 *indices,
uint32 depth,
uint32 maxDepth, // Maximum recursion depth for the triangle mesh.
uint32 minLeafSize, // minimum triangles to treat as a 'leaf' node.
float minAxisSize,
NodeInterface *callback,
TriVector &leafTriangles) // once a particular axis is less than this size, stop sub-dividing.
{
// Find the longest axis of the bounding volume of this node
float dx = mBounds.mMax[0] - mBounds.mMin[0];
float dy = mBounds.mMax[1] - mBounds.mMin[1];
float dz = mBounds.mMax[2] - mBounds.mMin[2];
AxisAABB axis = AABB_XAXIS;
float laxis = dx;
if ( dy > dx )
{
axis = AABB_YAXIS;
laxis = dy;
}
if ( dz > dx && dz > dy )
{
axis = AABB_ZAXIS;
laxis = dz;
}
uint32 count = triangles.size();
// if the number of triangles is less than the minimum allowed for a leaf node or...
// we have reached the maximum recursion depth or..
// the width of the longest axis is less than the minimum axis size then...
// we create the leaf node and copy the triangles into the leaf node triangle array.
if ( count < minLeafSize || depth >= maxDepth || laxis < minAxisSize )
{
// Copy the triangle indices into the leaf triangles array
mLeafTriangleIndex = leafTriangles.size(); // assign the array start location for these leaf triangles.
leafTriangles.push_back(count);
for (TriVector::const_iterator i=triangles.begin(); i!=triangles.end(); ++i)
{
leafTriangles.push_back( *i );
}
}
else
{
float center[3];
mBounds.getCenter(center);
BoundsAABB b1,b2;
splitRect(axis,mBounds,b1,b2,center);
// Compute two bounding boxes based upon the split of the longest axis
BoundsAABB leftBounds,rightBounds;
TriVector leftTriangles;
TriVector rightTriangles;
// Create two arrays; one of all triangles which intersect the 'left' half of the bounding volume node
// and another array that includes all triangles which intersect the 'right' half of the bounding volume node.
for (TriVector::const_iterator i=triangles.begin(); i!=triangles.end(); ++i)
{
uint32 tri = (*i);
{
uint32 i1 = indices[tri*3+0];
uint32 i2 = indices[tri*3+1];
uint32 i3 = indices[tri*3+2];
const float *p1 = &vertices[i1*3];
const float *p2 = &vertices[i2*3];
const float *p3 = &vertices[i3*3];
if ( b1.containsTriangle(p1,p2,p3))
{
if ( leftTriangles.empty() )
{
leftBounds.setMin(p1);
leftBounds.setMax(p1);
}
leftBounds.include(p1);
leftBounds.include(p2);
leftBounds.include(p3);
leftTriangles.push_back(tri); // Add this triangle to the 'left triangles' array and revise the left triangles bounding volume
}
if ( b2.containsTriangle(p1,p2,p3))
{
if ( rightTriangles.empty() )
{
rightBounds.setMin(p1);
rightBounds.setMax(p1);
}
rightBounds.include(p1);
rightBounds.include(p2);
rightBounds.include(p3);
rightTriangles.push_back(tri); // Add this triangle to the 'right triangles' array and revise the right triangles bounding volume.
}
}
}
if ( !leftTriangles.empty() ) // If there are triangles in the left half then...
{
leftBounds.clamp(b1); // we have to clamp the bounding volume so it stays inside the parent volume.
mLeft = callback->getNode(); // get a new AABB node
new ( mLeft ) NodeAABB(leftBounds); // initialize it to default constructor values.
// Then recursively split this node.
mLeft->split(leftTriangles,vcount,vertices,tcount,indices,depth+1,maxDepth,minLeafSize,minAxisSize,callback,leafTriangles);
}
if ( !rightTriangles.empty() ) // If there are triangles in the right half then..
{
rightBounds.clamp(b2); // clamps the bounding volume so it stays restricted to the size of the parent volume.
mRight = callback->getNode(); // allocate and default initialize a new node
new ( mRight ) NodeAABB(rightBounds);
// Recursively split this node.
mRight->split(rightTriangles,vcount,vertices,tcount,indices,depth+1,maxDepth,minLeafSize,minAxisSize,callback,leafTriangles);
}
}
}
void splitRect(AxisAABB axis,const BoundsAABB &source,BoundsAABB &b1,BoundsAABB &b2,const float *midpoint)
{
switch ( axis )
{
case AABB_XAXIS:
{
b1.setMin( source.mMin );
b1.setMax( midpoint[0], source.mMax[1], source.mMax[2] );
b2.setMin( midpoint[0], source.mMin[1], source.mMin[2] );
b2.setMax(source.mMax);
}
break;
case AABB_YAXIS:
{
b1.setMin(source.mMin);
b1.setMax(source.mMax[0], midpoint[1], source.mMax[2]);
b2.setMin(source.mMin[0], midpoint[1], source.mMin[2]);
b2.setMax(source.mMax);
}
break;
case AABB_ZAXIS:
{
b1.setMin(source.mMin);
b1.setMax(source.mMax[0], source.mMax[1], midpoint[2]);
b2.setMin(source.mMin[0], source.mMin[1], midpoint[2]);
b2.setMax(source.mMax);
}
break;
}
}
virtual void raycast(bool &hit,
const float *from,
const float *dir,
float *hitLocation,
float *hitNormal,
float *hitDistance,
const float *vertices,
const uint32 *indices,
float &nearestDistance,
NodeInterface *callback,
unsigned char *raycastTriangles,
unsigned char raycastFrame,
const TriVector &leafTriangles)
{
float sect[3];
float nd = nearestDistance;
if ( !intersectLineSegmentAABB(mBounds.mMin,mBounds.mMax,from,dir,nd,sect) )
{
return;
}
if ( mLeafTriangleIndex != TRI_EOF )
{
const uint32 *scan = &leafTriangles[mLeafTriangleIndex];
uint32 count = *scan++;
for (uint32 i=0; i<count; i++)
{
uint32 tri = *scan++;
if ( raycastTriangles[tri] != raycastFrame )
{
raycastTriangles[tri] = raycastFrame;
uint32 i1 = indices[tri*3+0];
uint32 i2 = indices[tri*3+1];
uint32 i3 = indices[tri*3+2];
const float *p1 = &vertices[i1*3];
const float *p2 = &vertices[i2*3];
const float *p3 = &vertices[i3*3];
float t;
if ( rayIntersectsTriangle(from,dir,p1,p2,p3,t))
{
if ( t < nearestDistance )
{
nearestDistance = t;
if ( hitLocation )
{
hitLocation[0] = from[0]+dir[0]*t;
hitLocation[1] = from[1]+dir[1]*t;
hitLocation[2] = from[2]+dir[2]*t;
}
if ( hitNormal )
{
callback->getFaceNormal(tri,hitNormal);
}
if ( hitDistance )
{
*hitDistance = t;
}
hit = true;
}
}
}
}
}
else
{
if ( mLeft )
{
mLeft->raycast(hit,from,dir,hitLocation,hitNormal,hitDistance,vertices,indices,nearestDistance,callback,raycastTriangles,raycastFrame,leafTriangles);
}
if ( mRight )
{
mRight->raycast(hit,from,dir,hitLocation,hitNormal,hitDistance,vertices,indices,nearestDistance,callback,raycastTriangles,raycastFrame,leafTriangles);
}
}
}
NodeAABB *mLeft; // left node
NodeAABB *mRight; // right node
BoundsAABB mBounds; // bounding volume of node
uint32 mLeafTriangleIndex; // if it is a leaf node; then these are the triangle indices.
};
class MyRaycastMesh : public BoundingBoxTree, public NodeInterface
{
public:
MyRaycastMesh(uint32 vcount,const float *vertices,uint32 tcount,const uint32 *indices,uint32 maxDepth,uint32 minLeafSize,float minAxisSize)
{
mRaycastFrame = 0;
if ( maxDepth < 2 )
{
maxDepth = 2;
}
if ( maxDepth > 15 )
{
maxDepth = 15;
}
uint32 pow2Table[16] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 65536 };
mMaxNodeCount = 0;
for (uint32 i=0; i<=maxDepth; i++)
{
mMaxNodeCount+=pow2Table[i];
}
mNodes = new NodeAABB[mMaxNodeCount];
mNodeCount = 0;
mVcount = vcount;
mVertices = (float *)::malloc(sizeof(float)*3*vcount);
memcpy(mVertices,vertices,sizeof(float)*3*vcount);
mTcount = tcount;
mIndices = (uint32 *)::malloc(sizeof(uint32)*tcount*3);
memcpy(mIndices,indices,sizeof(uint32)*tcount*3);
mRaycastTriangles = (unsigned char *)::malloc(tcount);
memset(mRaycastTriangles,0,tcount);
mRoot = getNode();
mFaceNormals = NULL;
new ( mRoot ) NodeAABB(mVcount,mVertices,mTcount,mIndices,maxDepth,minLeafSize,minAxisSize,this,mLeafTriangles);
}
~MyRaycastMesh(void)
{
delete[] mNodes;
::free(mVertices);
::free(mIndices);
::free(mFaceNormals);
::free(mRaycastTriangles);
}
virtual bool raycast(const Ray& ray,float *hitLocation,float *hitNormal,float *hitDistance)
{
bool ret = false;
float distance = ray.direction.length();
if ( distance < 0.0000000001f ) return false;
mRaycastFrame++;
mRoot->raycast(ret, &ray.origin.x, &ray.direction.x ,hitLocation,hitNormal,hitDistance,mVertices,mIndices,distance,this,mRaycastTriangles,mRaycastFrame,mLeafTriangles);
return ret;
}
virtual void release(void)
{
delete this;
}
virtual const float * getBoundMin(void) const // return the minimum bounding box
{
return mRoot->mBounds.mMin;
}
virtual const float * getBoundMax(void) const // return the maximum bounding box.
{
return mRoot->mBounds.mMax;
}
virtual NodeAABB * getNode(void)
{
assert( mNodeCount < mMaxNodeCount );
NodeAABB *ret = &mNodes[mNodeCount];
mNodeCount++;
return ret;
}
virtual void getFaceNormal(uint32 tri,float *faceNormal)
{
if ( mFaceNormals == NULL )
{
mFaceNormals = (float *)::malloc(sizeof(float)*3*mTcount);
for (uint32 i=0; i<mTcount; i++)
{
uint32 i1 = mIndices[i*3+0];
uint32 i2 = mIndices[i*3+1];
uint32 i3 = mIndices[i*3+2];
const float*p1 = &mVertices[i1*3];
const float*p2 = &mVertices[i2*3];
const float*p3 = &mVertices[i3*3];
float *dest = &mFaceNormals[i*3];
computePlane(p3,p2,p1,dest);
}
}
const float *src = &mFaceNormals[tri*3];
faceNormal[0] = src[0];
faceNormal[1] = src[1];
faceNormal[2] = src[2];
}
uint8 mRaycastFrame;
uint8* mRaycastTriangles;
uint32 mVcount;
float* mVertices;
float* mFaceNormals;
uint32 mTcount;
uint32* mIndices;
TriVector mLeafTriangles;
NodeAABB* mRoot;
NodeAABB* mNodes;
uint32 mNodeCount;
uint32 mMaxNodeCount;
};
#if 0
RaycastMesh * createRaycastMesh(uint32 vcount, // The number of vertices in the source triangle mesh
const float *vertices, // The array of vertex positions in the format x1,y1,z1..x2,y2,z2.. etc.
uint32 tcount, // The number of triangles in the source triangle mesh
const uint32 *indices, // The triangle indices in the format of i1,i2,i3 ... i4,i5,i6, ...
uint32 maxDepth, // Maximum recursion depth for the triangle mesh.
uint32 minLeafSize, // minimum triangles to treat as a 'leaf' node.
float minAxisSize // once a particular axis is less than this size, stop sub-dividing.
)
{
MyRaycastMesh *m = new MyRaycastMesh(vcount,vertices,tcount,indices,maxDepth,minLeafSize,minAxisSize);
return static_cast< RaycastMesh * >(m);
}
#endif
//-----------------------------------//
NAMESPACE_ENGINE_END | [
"triton@e0e46c49-be69-4f5a-ad62-21024a331aea"
] | triton@e0e46c49-be69-4f5a-ad62-21024a331aea |
6f0a42509f9f2b562f2afdf712c7b01a4e58101b | fdec31c01570d224531b780221a9a8ae86cf9742 | /aising2020/D.cpp | 40679f45f75d3a439e95f19398e6426ec9c5c285 | [] | no_license | TYakumo/AtCoder | 83c7959a9547c8c6ee8eae84fcb6db77b315fcc9 | 63f8d390108117cb734cdbd5a6fad4c77c384d0e | refs/heads/master | 2021-11-07T03:36:01.432919 | 2021-10-24T01:26:11 | 2021-10-24T01:26:11 | 247,380,851 | 0 | 0 | null | 2021-10-24T01:26:12 | 2020-03-15T01:24:34 | C++ | UTF-8 | C++ | false | false | 1,653 | cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int calc(int n, vector <int>& ans) {
if (ans[n] >= 0) {
return ans[n];
}
int pc = __builtin_popcount(n);
ans[n] = calc(n%pc, ans) + 1;
return ans[n];
}
int main() {
int N;
string X;
cin >> N >> X;
vector <int> ans(N+2, -1);
ans[0] = 0;
for (int i = N+1; i >= 1; --i) {
calc(i, ans);
}
vector <int> pc(2);
for (int i = 0; i < N; ++i) {
pc[0] += (X[i] == '1');
}
pc[1] = pc[0]+1;
--pc[0];
vector <long long> res(2);
for (int i = 0; i < N; ++i) {
if (pc[0] > 0) {
res[0] = (res[0]*2 + (X[i]-'0')) % pc[0];
}
res[1] = (res[1]*2 + (X[i]-'0')) % pc[1];
}
vector <long long> mul(2, 1);
vector <int> finalRes(N);
for (int i = N-1; i >= 0; --i) {
if (X[i] == '0') { // to be pc[1]
long long newres = (res[1] + mul[1]) % pc[1];
finalRes[i] = calc(newres, ans) + 1;
} else { // pc[0]
if (pc[0] == 0) {
finalRes[i] = 0;
} else {
long long newres = ((res[0] - mul[0])%pc[0] + pc[0]) % pc[0];
finalRes[i] = calc(newres, ans) + 1;
}
}
if (pc[0] > 0) {
mul[0] = mul[0]*2%pc[0];
}
mul[1] = mul[1]*2%pc[1];
}
for (int i = 0; i < finalRes.size(); ++i) {
cout << finalRes[i] << endl;
}
return 0;
} | [
"[email protected]"
] | |
01b3f855f6816a76b9cecb2adf2528b87b76a2ae | 575731c1155e321e7b22d8373ad5876b292b0b2f | /examples/native/ios/Pods/boost-for-react-native/boost/date_time/gregorian/greg_day_of_year.hpp | 800a060a530eae65389ca164b4b593d41f408e3d | [
"BSL-1.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Nozbe/zacs | 802a84ffd47413a1687a573edda519156ca317c7 | c3d455426bc7dfb83e09fdf20781c2632a205c04 | refs/heads/master | 2023-06-12T20:53:31.482746 | 2023-06-07T07:06:49 | 2023-06-07T07:06:49 | 201,777,469 | 432 | 10 | MIT | 2023-01-24T13:29:34 | 2019-08-11T14:47:50 | JavaScript | UTF-8 | C++ | false | false | 1,064 | hpp | #ifndef GREG_DAY_OF_YEAR_HPP___
#define GREG_DAY_OF_YEAR_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include <stdexcept>
#include <string>
namespace boost {
namespace gregorian {
//! Exception type for day of year (1..366)
struct bad_day_of_year : public std::out_of_range
{
bad_day_of_year() :
std::out_of_range(std::string("Day of year value is out of range 1..366"))
{}
};
//! A day of the year range (1..366)
typedef CV::simple_exception_policy<unsigned short,1,366,bad_day_of_year> greg_day_of_year_policies;
//! Define a range representation type for the day of the year 1..366
typedef CV::constrained_value<greg_day_of_year_policies> greg_day_of_year_rep;
} } //namespace gregorian
#endif
| [
"[email protected]"
] | |
ba688cd07454c6a544623dcd495c0cdd7a189bbc | 347c284a27c0492963a0c4b592e8e2d22b293b06 | /dsp/L1/tests/aie/inc/fir_resampler_ref.hpp | 9b3576b07a1a45972b13fca28f25c410c0011415 | [
"OFL-1.1",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | permissive | phlight4fork/Vitis_Libraries | be14d1ac9e97d85ac823b3170c744242fc5001b3 | a60e1df95fa43e715cc9223f470587456463be8b | refs/heads/master | 2022-11-27T11:34:16.901157 | 2022-10-24T01:53:55 | 2022-10-24T01:53:55 | 269,535,014 | 0 | 0 | Apache-2.0 | 2020-06-05T05:01:40 | 2020-06-05T05:01:39 | null | UTF-8 | C++ | false | false | 2,758 | hpp | /*
* Copyright 2022 Xilinx, 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.
*/
#ifndef _DSPLIB_FIR_RESAMPLER_REF_HPP_
#define _DSPLIB_FIR_RESAMPLER_REF_HPP_
/*
fir_interpolate_fract asym filter reference model
*/
#include <adf.h>
#include <limits>
#include "fir_ref_utils.hpp"
namespace xf {
namespace dsp {
namespace aie {
namespace fir {
namespace resampler {
//-----------------------------------------------------------------------------------------------------
// Interpolate Fract Asym Reference Model Class - static coefficients
template <typename TT_DATA, // type of data input and output
typename TT_COEFF, // type of coefficients (e.g. int16, cint32)
unsigned int TP_FIR_LEN,
unsigned int TP_INTERPOLATE_FACTOR,
unsigned int TP_DECIMATE_FACTOR,
unsigned int TP_SHIFT,
unsigned int TP_RND,
unsigned int TP_INPUT_WINDOW_VSIZE,
unsigned int TP_USE_COEFF_RELOAD = 0, // 1 = use coeff reload, 0 = don't use coeff reload
unsigned int TP_NUM_OUTPUTS = 1>
class fir_resampler_ref {
public:
// Constructor
fir_resampler_ref(const TT_COEFF (&coefficients)[TP_FIR_LEN]) {
// This reference model uses taps directly. It does not need to pad the taps array
// to the column width because the concept of columns does not apply to the ref model.
for (int i = 0; i < FIR_LEN; ++i) {
// We don't need any reversal in this constructor -
m_internalTaps[i] = coefficients[i];
}
}
// Constructor
fir_resampler_ref() {}
// Register Kernel Class
static void registerKernelClass() {
if
constexpr(TP_USE_COEFF_RELOAD == 1) { REGISTER_FUNCTION(fir_resampler_ref::filterRtp); }
else {
REGISTER_FUNCTION(fir_resampler_ref::filter);
}
}
// FIR
void filter(input_window<TT_DATA>* inWindow, output_window<TT_DATA>* outWindow);
void filterRtp(input_window<TT_DATA>* inWindow,
output_window<TT_DATA>* outWindow,
const TT_COEFF (&inTaps)[TP_FIR_LEN]);
private:
alignas(32) TT_COEFF m_internalTaps[TP_FIR_LEN];
};
}
}
}
}
}
#endif // _DSPLIB_FIR_RESAMPLER_REF_HPP_
| [
"[email protected]"
] | |
22fdadfef926cf70c49213c05926adfbb15f5911 | 8d4a60ed541430f408da5181f381cb5aa11a4d74 | /SimplePython/engine.cpp | 9b1f3676e8ccd78521732e221d080582dd8ca127 | [
"Apache-2.0"
] | permissive | Zheaoli/simple_python | 2bd1ab4fb9ef14f6279f10cc9640eb1dc487ffb2 | 1e17d96679cd31397b1523b82f6fd7e4a09b66d2 | refs/heads/master | 2021-05-11T01:39:05.132074 | 2018-01-21T13:26:39 | 2018-01-21T13:26:39 | 118,336,038 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,526 | cpp | #include"simplepython.h"
char* info = "********** Python Research **********\nInput 'exit' to exit\n";
char* prompt = ">>> ";
void ExcuteEngine::Excute() {
cout << info;
cout << prompt;
while (getline(cin, m_Command))
{
if (m_Command.size() == 0)
{
cout << prompt;
continue;
}
else if (m_Command == "exit")
{
return;
}
else
{
ExecuteCommand(m_Command);
}
cout << prompt;
}
}
void ExcuteEngine::ExecuteCommand(string& command) {
string::size_type pos = 0;
if ((pos = command.find("print ")) != string::npos) {
ExcutePrint(command.substr(6));
}
else if ((pos = command.find(" = ")) != string::npos) {
string target = command.substr(0, pos);
string source = command.substr(pos + 3);
ExcuteAdd(target, source);
}
}
void ExcuteEngine::ExcuteAdd(string& target, string& source) {
string::size_type pos;
PyObject* strValue = NULL;
PyObject* resultValue = NULL;
if (IsSourceAllDigit(source)) {
PyObject* intValue = PyInt_Create(atoi(source.c_str()));
PyObject* key = PyStr_Create(target.c_str());
PyDict_SetItem(m_LocalEnvironment, key, intValue);
}
else if (source.find("\"") != string::npos) {
strValue = PyStr_Create(source.substr(1, source.size() - 2).c_str());
PyObject* key = PyStr_Create(target.c_str());
PyDict_SetItem(m_LocalEnvironment, key, strValue);
}
else if ((pos = source.find("+")) != string::npos) {
PyObject* leftObject = GetObjectFromSymbol(source.substr(0, pos));
PyObject* rightObject = GetObjectFromSymbol(source.substr(pos + 1));
if (leftObject != NULL&&right != NULL&&leftObject->type == rightObject->type) {
resultValue = (leftObject->type)->add(leftObject, rightObject);
PyObject* key = PyStr_Create(target.c_str());
PyDict_SetItem(m_LocalEnvironment, key, resultValue);
}
(m_LocalEnvironment->type)->print(m_LocalEnvironment);
}
}
bool ExcuteEngine::IsSourceAllDigit(string& source)
{
string::size_type len = source.size();
for (string::size_type i = 0; i < len; ++i)
{
if (!isdigit(source[i]))
{
return false;
}
}
return true;
}
PyObject* ExcuteEngine::GetObjectFromSymbol(string& symbol) {
PyObject* key = PyStr_Create(symbol.c_str());
PyObject* value = PyDict_GetItem(m_LocalEnvironment, key);
if (value == NULL) {
cout << "[Error] : " << symbol << "is not defined" << endl;
return NULL;
}
return value;
}
void ExcuteEngine::ExcutePrint(string symbol) {
PyObject* object = GetObjectFromSymbol(symbol);
if (object != NULL) {
PyTypeObject* type = object->type;
type->print(object);
}
} | [
"[email protected]"
] | |
d7a900b5e71dbc54fffd6ccd8ba4863b4fcbac26 | 932884c5b5a345a6b3948b194f71e1217749b0ce | /APPART/esp8266_projo_v2/esp8266_projo_v2.ino | 21fd24e9d83c92ff0794122de27bac2db5bef080 | [
"Unlicense"
] | permissive | leahpar/ArduinoProjects | 514152c4ee5fc83e5ebdb0f1e51e8b59d16bee0a | 5bc2031f6f036155b8e87210a2727255797d2699 | refs/heads/master | 2022-11-06T02:40:04.016460 | 2022-10-29T09:06:59 | 2022-10-29T09:06:59 | 134,262,831 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,371 | ino | #include <constants.h>
// --- WIFI --------------------------------------------------------------------
#include <ESP8266WiFi.h>
const char* wifi_ssid = WIFI_SSID;
const char* wifi_pass = WIFI_PASSWD;
// --- MQTT --------------------------------------------------------------------
#include <PubSubClient.h>
const char* mqtt_host = MQTT_SERVER;
const int mqtt_port = MQTT_PORT;
const char* mqtt_user = MQTT_USER;
const char* mqtt_pwd = MQTT_PWD;
const char* mqtt_client_id = "ArduinoProjo";
const char* mqtt_topic_video = "salon/videoproj";
const char* mqtt_topic_hours = "sensor/videoproj/salon";
const char* mqtt_topic_status = "status/videoproj";
WiFiClient wifiClient;
PubSubClient client(wifiClient);
// --- RS232 -------------------------------------------------------------------
#include <SoftwareSerial.h>
#define rxPin D5
#define txPin D6
SoftwareSerial rs232 = SoftwareSerial(rxPin, txPin);
// --- TIMERS ------------------------------------------------------------------
int delayCommand = 3000;
int delayToggle = 20000;
int timeoutCommand = 15000;
int delayCheckStatus = 60000;
unsigned long chrono;
unsigned long chronoTimeout;
unsigned long chronoToggle;
unsigned long chronoCheckStatus;
// --- DIVERS ------------------------------------------------------------------
int lampHours = 0;
// --- MACHINE STATE -----------------------------------------------------------
enum MachineStates {START, CONNECT_WIFI, CONNECT_MQTT, UNKNOWN,
COMMAND_ON, PROJECTOR_ON, COMMAND_OFF, PROJECTOR_OFF,
LAMP_HOURS};
MachineStates machineState = START;
MachineStates machineStateNext = UNKNOWN;
enum MQTTCommands {MQTT_NONE, MQTT_ON, MQTT_OFF, MQTT_TOGGLE, MQTT_STATE, MQTT_HOURS};
MQTTCommands mqttCommand = MQTT_NONE;
enum ProjectorCommands {PROJO_NONE, PROJO_ON, PROJO_OFF, PROJO_STATE, PROJO_HOURS};
ProjectorCommands projectorCommand = PROJO_NONE;
//==============================================================================
// THE MACHINE STATE
//==============================================================================
void videoMachine() {
switch (machineState) {
case START: // Init variables and goto CONNECT_WIFI
chrono = millis();
chronoTimeout = millis();
chronoToggle = millis();
chronoCheckStatus = millis();
setMachineState(CONNECT_WIFI, __LINE__);
break;
case CONNECT_WIFI: // connect wifi and goto CONNECT_MQTT
if (connectWifi()) {
setMachineState(CONNECT_MQTT, __LINE__);
}
break;
case CONNECT_MQTT: // connect mqtt and goto UNKNOWN
if (connectMqtt()) {
setMachineState(UNKNOWN, __LINE__);
}
break;
case UNKNOWN: // Check videoproj status
chronoCheckStatus = millis(); // update last check
if (readProjectorStatus()) {
setMachineState(PROJECTOR_ON, __LINE__);
}
else {
setMachineState(PROJECTOR_OFF, __LINE__);
}
sendProjectorStatus();
break;
case LAMP_HOURS: // Send lamp hours and goto next state
readLampHours();
sendLampHours();
setMachineState(machineStateNext, __LINE__);
break;
case PROJECTOR_ON: // Check if mqtt command to shut down
switch (mqttCommand) {
case MQTT_OFF:
case MQTT_TOGGLE:
machineStateNext = COMMAND_OFF;
setMachineState(LAMP_HOURS, __LINE__);
chrono = 0;
chronoTimeout = millis();
break;
case MQTT_ON:
mqttCommand = MQTT_NONE;
break;
default: // Sometimes, check for status
if (millis() - chronoCheckStatus > delayCheckStatus) {
setMachineState(UNKNOWN, __LINE__);
}
break;
}
break;
case PROJECTOR_OFF: // Check if mqtt command to turn on
switch (mqttCommand) {
case MQTT_ON:
case MQTT_TOGGLE:
setMachineState(COMMAND_ON, __LINE__);
chrono = 0;
chronoTimeout = millis();
break;
case MQTT_OFF:
mqttCommand = MQTT_NONE;
break;
default: // Sometimes, check for status
if (millis() - chronoCheckStatus > delayCheckStatus) {
setMachineState(UNKNOWN, __LINE__);
}
break;
}
break;
case COMMAND_ON:
mqttCommand = MQTT_NONE;
if (millis() - chrono > delayCommand) {
chrono = millis();
if (readProjectorStatus()) {
sendProjectorStatus();
projectorCommand = PROJO_NONE;
machineStateNext = PROJECTOR_ON;
setMachineState(LAMP_HOURS, __LINE__);
}
else {
projectorCommand = PROJO_ON;
callProjectorCommand();
}
}
else if (millis() - chronoTimeout > timeoutCommand) {
projectorCommand = PROJO_NONE;
setMachineState(UNKNOWN, __LINE__);
}
break;
case COMMAND_OFF:
mqttCommand = MQTT_NONE;
if (millis() - chrono > delayCommand) {
chrono = millis();
if (!readProjectorStatus()) {
sendProjectorStatus();
projectorCommand = PROJO_NONE;
setMachineState(PROJECTOR_OFF, __LINE__);
}
else {
projectorCommand = PROJO_OFF;
callProjectorCommand();
}
}
else if (millis() - chronoTimeout > timeoutCommand) {
projectorCommand = PROJO_NONE;
setMachineState(UNKNOWN, __LINE__);
}
break;
}
}
//==============================================================================
// SET NEW MACHINE STATE
//==============================================================================
void setMachineState(MachineStates state, int line) {
Serial.println(
String("[")
+ String((int)(millis()/1000))
+ "s;l." + String(line)
+ "] "
+ getMachineStateString(machineState)
+ " => "
+ getMachineStateString(state)
);
machineState = state;
}
//==============================================================================
// GET MACHINE STATE IN STRING
//==============================================================================
String getMachineStateString(MachineStates state) {
switch (state) {
case START: return String("START");
case CONNECT_WIFI: return String("CONNECT_WIFI");
case CONNECT_MQTT: return String("CONNECT_MQTT");
case UNKNOWN: return String("UNKNOWN");
case LAMP_HOURS: return String("LAMP_HOURS");
case PROJECTOR_ON: return String("PROJECTOR_ON");
case PROJECTOR_OFF: return String("PROJECTOR_OFF");
case COMMAND_ON: return String("COMMAND_ON");
case COMMAND_OFF: return String("COMMAND_OFF");
}
}
//==============================================================================
// MQTT CALLBACK
//==============================================================================
void mqttCallback(char* topic, byte* payload, unsigned int length) {
payload[length] = '\0';
String action = String((char*)payload);
Serial.println("MQTT[" + String(topic) + "]: " + action);
blink(30, 0);
if (action == "on") {
mqttCommand = MQTT_ON;
chronoToggle = millis();
}
else if (action == "off") {
mqttCommand = MQTT_OFF;
chronoToggle = millis();
}
else if (action == "toggle") {
mqttCommand = MQTT_TOGGLE;
chronoToggle = millis();
}
}
//==============================================================================
// READ STATE FROM PROJECTOR
//==============================================================================
bool readProjectorStatus() {
Serial.println("readProjectorStatus()");
projectorCommand = PROJO_STATE;
int state = callProjectorCommand();
projectorCommand = PROJO_NONE;
return (state == 1);
}
//==============================================================================
// SEND VIDEOPROJECTOR STATUS TO MQTT
//==============================================================================
void sendProjectorStatus() {
client.publish(
mqtt_topic_status, machineState == PROJECTOR_ON ? "on" : "off",
true
);
}
//==============================================================================
// READ LAMP HOURS FROM PROJECTOR
//==============================================================================
void readLampHours() {
Serial.println("readLampHours()");
projectorCommand = PROJO_HOURS;
lampHours = callProjectorCommand();
projectorCommand = PROJO_NONE;
}
//==============================================================================
// SEND LAMP HOURS TO MQTT
//==============================================================================
void sendLampHours() {
if (lampHours > 0) {
client.publish(mqtt_topic_hours, String(lampHours).c_str());
}
}
//==============================================================================
// CALL COMMAND ON PROJECTOR
//==============================================================================
int callProjectorCommand() {
String response;
switch (projectorCommand) {
case PROJO_ON:
response = command("* 0 IR 001\r");
if (response.substring(0, 4) == "*001")
return -1; // TODO: error
break;
case PROJO_OFF:
response = command("* 0 IR 002\r");
if (response.substring(0, 4) == "*001")
return -1; // TODO: error
break;
case PROJO_STATE:
response = command("* 0 Lamp ?\r");
if (response.substring(0, 4) == "*001")
return -1; // TODO: error
else if (response.indexOf("Lamp 1") >= 0)
return 1;
else
return 0;
break;
case PROJO_HOURS:
response = command("* 0 Lamp\r");
String response = command("* 0 Lamp\r");
if (response.substring(0, 4) == "*001")
return -1; // TODO: error
else
return response.substring(response.indexOf(' ')+1).toInt(); // 0 if error
break;
}
return 0;
}
//==============================================================================
// SEND RS232 COMMAND
//==============================================================================
String command(char* c) {
String res = "";
char inByte;
// empty rs232 data
while (rs232.available()) rs232.read();
// Send comamnd
rs232.write(c);
// Wait for response
delay(200);
// Read response
while (rs232.available()) {
inByte = rs232.read();
if (inByte == '\r') inByte = ' ';
res = res + inByte;
}
delay(200);
Serial.println(String("Command: ") + c + String(" => ") + res);
return res;
}
//==============================================================================
// CONNECT WIFI
//==============================================================================
bool connectWifi() {
Serial.println("connectWifi()");
WiFi.begin(wifi_ssid, wifi_pass);
int i = 0;
while (WiFi.status() != WL_CONNECTED) {
blink(20, 50 + 5*i++);
}
return true;
}
//==============================================================================
// CONNECT MQTT
//==============================================================================
bool connectMqtt() {
Serial.println("connectMqtt()");
int i = 0;
while (!client.connect(mqtt_client_id, mqtt_user, mqtt_pwd)) {
blink(20, 50 + 5*i++);
}
client.subscribe(mqtt_topic_video);
client.publish("hello/world", mqtt_client_id);
return true;
}
//==============================================================================
// BLINK BUILTIN LED
//==============================================================================
void blink(int up, int down) {
digitalWrite(BUILTIN_LED, LOW);
delay(up);
digitalWrite(BUILTIN_LED, HIGH);
delay(down);
}
//==============================================================================
// SETUP
// - WiFi config
// - MQTT config & callback
// - Init RS232
//==============================================================================
void setup() {
Serial.begin(74880);
while (!Serial);
Serial.println("Start");
pinMode(BUILTIN_LED, OUTPUT);
digitalWrite(BUILTIN_LED, HIGH); // led off
// --- WIFI ------------------------------------------------------------------
WiFi.mode(WIFI_STA); // mode standard
WiFi.begin(wifi_ssid, wifi_pass);
//connectWifi();
// --- MQTT ------------------------------------------------------------------
client.setServer(mqtt_host, mqtt_port);
client.setCallback(mqttCallback);
//connectMqtt();
// --- RS232 -----------------------------------------------------------------
//Serial.println("RS232 serial...");
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
rs232.begin(9600);
while(!rs232);
Serial.println("Setup done");
setMachineState(START, __LINE__);
}
//==============================================================================
// LOOP
// - Check WiFi connection
// - Check MQTT connection
// - Check subscribed mqtt channels
// - Run the state machine
//==============================================================================
void loop() {
// Check subscribed mqtt channels
client.loop();
// run the machine
videoMachine();
// Check WiFi
if (WiFi.status() != WL_CONNECTED) {
setMachineState(CONNECT_WIFI, __LINE__);
}
// Check MQTT
else if (!client.connected()) {
setMachineState(CONNECT_MQTT, __LINE__);
}
delay(100);
}
| [
"[email protected]"
] | |
c4809e4d8160cbec43f4c34c22f34a3315541eab | cc85402b9475ebfb06008eb43aa41212f25acd76 | /am7020_max30102/am7020_max30102.ino | ab29949bb360419a1bf17319469d51941a6da2ba | [
"MIT"
] | permissive | ccwu0918/am7020_max30102 | cd9cbe6d5ef7efd6c9940b7025a667dc8b83d0fc | 620f97336b86ebf6e43ec98f9c6ad8ac358c8cd7 | refs/heads/main | 2023-02-11T20:01:08.236522 | 2021-01-12T06:27:52 | 2021-01-12T06:27:52 | 397,846,776 | 1 | 0 | MIT | 2021-08-19T06:55:07 | 2021-08-19T06:55:07 | null | UTF-8 | C++ | false | false | 5,533 | ino |
#include "config.h"
#include <Arduino.h>
#include <PubSubClient.h>
#include <TinyGsmClient.h>
#include "MAX30105.h"
#include <Wire.h>
#include "heartRate.h"
MAX30105 particleSensor;
const byte RATE_SIZE = 4; // Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; // Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; // Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;
#ifdef DEBUG_DUMP_AT_COMMAND
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger, AM7020_RESET);
#else
// 建立 AM7020 modem(設定 Serial 及 EN Pin)
TinyGsm modem(SerialAT, AM7020_RESET);
#endif
// 在 modem 架構上建立 Tcp Client
TinyGsmClient tcpClient(modem);
// 在 Tcp Client 架構上建立 MQTT Client
PubSubClient mqttClient(MQTT_BROKER, MQTT_PORT, tcpClient);
void mqttConnect(void);
void nbConnect(void);
void bubbleSort(int arr[], int n);
void setup()
{
Serial.begin(115200); // initialize serial communication at 115200 bits per second:
SerialAT.begin(BAUDRATE_115200);
while (!Serial)
;
// Initialize sensor
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) // Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1)
;
}
Serial.println("Place your index finger on the sensor with steady pressure.");
particleSensor.setup(); // Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0x0A); // Turn Red LED to low to indicate sensor is running
particleSensor.setPulseAmplitudeGreen(0); // Turn off Green LED
particleSensor.enableDIETEMPRDY(); // Enable the temp ready interrupt. This is required.
randomSeed(analogRead(A0));
// AM7020 NBIOT 連線基地台
nbConnect();
// 設定 MQTT KeepAlive time 為 270 秒
mqttClient.setKeepAlive(270);
}
void loop()
{
static unsigned long timer_0 = 0, timer_1 = 0, timer_2 = 0;
static int data[10];
static unsigned int idx = 0;
float temp;
long irValue = particleSensor.getIR();
if (checkForBeat(irValue) == true) {
// We sensed a beat!
long delta = millis() - lastBeat;
lastBeat = millis();
beatsPerMinute = 60 / (delta / 1000.0);
if (beatsPerMinute < 255 && beatsPerMinute > 20) {
rates[rateSpot++] = (byte)beatsPerMinute; // Store this reading in the array
rateSpot %= RATE_SIZE; // Wrap variable
// Take average of readings
beatAvg = 0;
for (byte x = 0; x < RATE_SIZE; x++)
beatAvg += rates[x];
beatAvg /= RATE_SIZE;
}
}
if (millis() >= timer_2) {
temp = particleSensor.readTemperature();
timer_2 = millis() + 50;
Serial.print("IR=");
Serial.print(irValue);
Serial.print(", BPM=");
Serial.print(beatsPerMinute);
Serial.print(", Avg BPM=");
Serial.print(beatAvg);
Serial.print(", Temp=");
Serial.print(temp);
if (irValue < 50000)
Serial.print(" No finger?");
Serial.println();
}
if (millis() >= timer_0 && irValue >= 50000 && beatAvg > 10) {
timer_0 = millis() + UPLOAD_INTERVAL;
data[idx++] = beatAvg;
}
// 檢查 MQTT Client 連線狀態
if (millis() >= timer_1) {
timer_1 = millis() + 5000;
if (!mqttClient.connected()) {
// 檢查 NBIOT 連線狀態
if (!modem.isNetworkConnected()) {
nbConnect();
}
SerialMon.println(F("=== MQTT NOT CONNECTED ==="));
mqttConnect();
}
}
if (idx > 9) {
idx = 0;
bubbleSort(data, 10);
mqttClient.publish(MAX30102_MAX_HR_TOPIC, String(data[9]).c_str());
mqttClient.publish(MAX30102_MID_HR_TOPIC, String((data[4] + data[5]) / 2).c_str());
mqttClient.publish(MAX30102_MIN_HR_TOPIC, String(data[0]).c_str());
mqttClient.publish(MAX30102_TEMP_TOPIC, String(temp).c_str());
}
// MQTT Client polling
mqttClient.loop();
}
/**
* AM7020 NBIOT 連線基地台
*/
void nbConnect(void)
{
debugSerial.println(F("Initializing modem..."));
// 初始化 & 連線基地台
while (!modem.init() || !modem.nbiotConnect(APN, BAND)) {
debugSerial.print(F("."));
};
debugSerial.print(F("Waiting for network..."));
// 等待網路連線
while (!modem.waitForNetwork()) {
debugSerial.print(F("."));
}
debugSerial.println(F(" success"));
}
/**
* MQTT Client 連線
*/
void mqttConnect(void)
{
SerialMon.print(F("Connecting to "));
SerialMon.print(MQTT_BROKER);
SerialMon.print(F("..."));
/* Connect to MQTT Broker */
// 亂數產生 MQTTID
String mqttid = ("MQTTID_" + String(random(65536)));
// MQTT Client 連線
while (!mqttClient.connect(mqttid.c_str(), MQTT_USERNAME, MQTT_PASSWORD)) {
SerialMon.println(F(" fail"));
}
SerialMon.println(F(" success"));
}
/**
* 排序(小到大)
*/
void bubbleSort(int arr[], int n)
{
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if (arr[j] > arr[i]) {
int temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
}
}
| [
"[email protected]"
] | |
df27f4b59ed9d6b49653725263f3d377666f035d | 78fe244100577275cebc2aa9237a4a684b40f51e | /src/prfrm/src/PrfrmApp.hpp | ed2a103ea1dfdf65998605c8cebc5f558d6ee05e | [
"Zlib"
] | permissive | Mezozoysky/cic | 7acaf548191b1163c206fe5756dfa29a438ab634 | 103a623db2b9d14c212867bd3319fb577cbcae1d | refs/heads/master | 2021-03-24T13:38:37.632267 | 2018-01-26T10:16:11 | 2018-01-26T10:16:11 | 113,984,418 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,305 | hpp | // cic
//
// cic - Copyright (C) 2017-2018 Stanislav Demyanovich <[email protected]>
//
// This software is provided 'as-is', without any express or
// implied warranty. In no event will the authors 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.
/// \file
/// \brief Provides PrfrmApp, the application class for prfrm tool
/// \author Stanislav Demyanovich <[email protected]>
/// \date 2017
/// \copyright cic is released under the terms of zlib/png license
#ifndef CIC_PRFRM__PRFRM_APP_HPP
#define CIC_PRFRM__PRFRM_APP_HPP
#include <Poco/Util/Application.h>
#include <Poco/AutoPtr.h>
#include <Poco/DOM/DOMParser.h>
#include <cic/industry/Industry.hpp>
#include <map>
namespace cic
{
namespace prfrm
{
class PrfrmApp : public Poco::Util::Application
{
public:
using Ptr = Poco::AutoPtr< PrfrmApp >;
public:
PrfrmApp() noexcept;
virtual ~PrfrmApp() noexcept = default;
void optionCallback( const std::string& name, const std::string& value );
protected:
virtual void initialize( Poco::Util::Application& self ) override;
virtual void uninitialize() override;
virtual void defineOptions( Poco::Util::OptionSet& options ) override;
virtual int main( const std::vector< std::string >& args ) override;
virtual std::string formatHelpText() const noexcept;
void printConfig( const std::string& rootKey ) const;
private:
bool mIsStopRequestedByOption;
Poco::XML::DOMParser mParser;
industry::Industry mIndustry;
};
} // namespace prfrm
} // namespace cic
#endif // CIC_PRFRM__PRFRM_APP_HPP
| [
"[email protected]"
] | |
0f5e57d63c212b3af3c0e3d2d96a9b6c3b03753b | 3ff1fe3888e34cd3576d91319bf0f08ca955940f | /dlc/include/tencentcloud/dlc/v20210125/model/ReportHeartbeatMetaDataRequest.h | b586d0d915c473d399591d00afc291e7e851333d | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp | 9f5df8220eaaf72f7eaee07b2ede94f89313651f | 42a76b812b81d1b52ec6a217fafc8faa135e06ca | refs/heads/master | 2023-08-30T03:22:45.269556 | 2023-08-30T00:45:39 | 2023-08-30T00:45:39 | 188,991,963 | 55 | 37 | Apache-2.0 | 2023-08-17T03:13:20 | 2019-05-28T08:56:08 | C++ | UTF-8 | C++ | false | false | 4,252 | h | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TENCENTCLOUD_DLC_V20210125_MODEL_REPORTHEARTBEATMETADATAREQUEST_H_
#define TENCENTCLOUD_DLC_V20210125_MODEL_REPORTHEARTBEATMETADATAREQUEST_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/AbstractModel.h>
namespace TencentCloud
{
namespace Dlc
{
namespace V20210125
{
namespace Model
{
/**
* ReportHeartbeatMetaData请求参数结构体
*/
class ReportHeartbeatMetaDataRequest : public AbstractModel
{
public:
ReportHeartbeatMetaDataRequest();
~ReportHeartbeatMetaDataRequest() = default;
std::string ToJsonString() const;
/**
* 获取数据源名称
* @return DatasourceConnectionName 数据源名称
*
*/
std::string GetDatasourceConnectionName() const;
/**
* 设置数据源名称
* @param _datasourceConnectionName 数据源名称
*
*/
void SetDatasourceConnectionName(const std::string& _datasourceConnectionName);
/**
* 判断参数 DatasourceConnectionName 是否已赋值
* @return DatasourceConnectionName 是否已赋值
*
*/
bool DatasourceConnectionNameHasBeenSet() const;
/**
* 获取锁ID
* @return LockId 锁ID
*
*/
int64_t GetLockId() const;
/**
* 设置锁ID
* @param _lockId 锁ID
*
*/
void SetLockId(const int64_t& _lockId);
/**
* 判断参数 LockId 是否已赋值
* @return LockId 是否已赋值
*
*/
bool LockIdHasBeenSet() const;
/**
* 获取事务ID
* @return TxnId 事务ID
*
*/
int64_t GetTxnId() const;
/**
* 设置事务ID
* @param _txnId 事务ID
*
*/
void SetTxnId(const int64_t& _txnId);
/**
* 判断参数 TxnId 是否已赋值
* @return TxnId 是否已赋值
*
*/
bool TxnIdHasBeenSet() const;
private:
/**
* 数据源名称
*/
std::string m_datasourceConnectionName;
bool m_datasourceConnectionNameHasBeenSet;
/**
* 锁ID
*/
int64_t m_lockId;
bool m_lockIdHasBeenSet;
/**
* 事务ID
*/
int64_t m_txnId;
bool m_txnIdHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_DLC_V20210125_MODEL_REPORTHEARTBEATMETADATAREQUEST_H_
| [
"[email protected]"
] | |
675e1e7b674304983799f0972f85bfe8b83e2b7e | dde01ccac927db186a920847b8b01e09e3ca5041 | /Framework/ConnInfo.h | 5c074e6dce8405f4aeb97022fde82fd5849756eb | [] | no_license | wuhua988/MyProject | 74abb524e87de2be8b4f90d56391936b7bef8df6 | 8a7ca09db8568f9947b5f22e03d2dc1d91b94432 | refs/heads/master | 2021-01-10T21:55:51.540129 | 2015-12-19T09:56:33 | 2015-12-19T09:56:33 | 41,141,316 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,642 | h | #ifndef __ConnInfo_h__
#define __ConnInfo_h__
#include <string>
#include "OSHeaders.h"
class WatcherConnection;
class ConnInfo
{
public:
///连接状态定义
enum ConnStatus
{
STATUS_NONE = 0,
STATUS_CONNECTING,
STATUS_CONNECTED,
STATUS_DISCONNECT
};
public:
ConnInfo();
~ConnInfo();
public:
UInt32 GetConnID() const;
UInt32 GetServerID() const;
void SetConnID(UInt32 uiConnId);
void SetServerID(UInt32 uiConnId);
UInt32 GetListenId() const;
void SetListenId(UInt32 uiListenId);
UInt16 GetState() const;
void SetState(UInt16 unState);
time_t GetCreateTime() const;
void SetCreateTime(time_t ttTime);
bool IsActive() const;
void SetActive(bool bActive);
void* GetUserData() const;
void SetUserData(void* userData);
std::string GetRemoteAddr();
void SetRemoteAddr(std::string strIP);
UInt16 GetRemotePort();
void SetRemotePort(UInt16 port);
void SetInterval(UInt32 iInterval);
void SetExpire(UInt32 iExpire);
void SetConnIdent(const std::string& strIdent);
std::string& GetConnIdent();
WatcherConnection* GetHandler();
void SetHandler(WatcherConnection*);
private:
UInt32 m_uiListenId;
UInt32 m_uiConnId;
UInt16 m_ConnState;
time_t m_CreateTime;
bool m_bActiveConn;
void* m_pUserData;
std::string m_active_conn_ip;
std::string m_strIdent;
UInt16 m_conn_port;
WatcherConnection* m_pHandler;
};
inline void ConnInfo::SetConnID(UInt32 uiConnId)
{
m_uiConnId = uiConnId;
}
inline UInt32 ConnInfo::GetListenId() const
{
return m_uiListenId;
}
inline void ConnInfo::SetListenId(UInt32 uiListenId)
{
m_uiListenId = uiListenId;
}
inline UInt16 ConnInfo::GetState() const
{
return m_ConnState;
}
inline void ConnInfo::SetState(UInt16 unState)
{
m_ConnState = unState;
}
inline time_t ConnInfo::GetCreateTime() const
{
return m_CreateTime;
}
inline void ConnInfo::SetCreateTime(time_t ttTime)
{
m_CreateTime = ttTime;
}
inline bool ConnInfo::IsActive() const
{
return m_bActiveConn;
}
inline void ConnInfo::SetActive(bool bActive)
{
m_bActiveConn = bActive;
}
inline void* ConnInfo::GetUserData() const
{
return m_pUserData;
}
inline void ConnInfo::SetUserData(void* userData)
{
m_pUserData = userData;
}
inline WatcherConnection* ConnInfo::GetHandler()
{
return m_pHandler;
}
inline void ConnInfo::SetHandler(WatcherConnection* pHandler)
{
m_pHandler = pHandler;
}
inline void ConnInfo::SetRemoteAddr(std::string strIP)
{
m_active_conn_ip = strIP;
}
inline void ConnInfo::SetRemotePort(UInt16 port)
{
m_conn_port = port;
}
inline void ConnInfo::SetConnIdent(const std::string& strIdent)
{
m_strIdent = strIdent;
}
inline std::string& ConnInfo::GetConnIdent()
{
return m_strIdent;
}
#endif//__ConnInfo_h__ | [
"[email protected]"
] | |
31c2cb17f301f9aeb0689b97049db398f9e45095 | da8916b1e8d859bbd3806354db61a1a39c3fa327 | /acm/source/tmplate.cpp | 2422992812a287796b96030170b6f24e37531c9d | [] | no_license | tiankonguse/lab | b71d2250e71058ea6ef5aad0d193da7f0005839d | c0e401d5425e9b0810cd3138e88b4d43411692cc | refs/heads/master | 2021-01-17T15:11:14.787707 | 2017-03-05T16:22:04 | 2017-03-05T16:22:04 | 11,841,044 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | cpp | /*************************************************************************
> File Name: tmplate.cpp
> Author: tiankonguse
> Mail: [email protected]
> Created Time: Tue 27 May 2014 04:19:56 PM CST
***********************************************************************/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<cmath>
#include<stack>
#include<algorithm>
#include<functional>
#include<stdarg.h>
using namespace std;
#ifdef __int64
typedef __int64 LL;
#else
typedef long long LL;
#endif
int main() {
return 0;
}
| [
"[email protected]"
] | |
0bd6de76128c3a33223d3e005e34d4d2a40aed3b | bb22ee3a4eed8276b4dc876706ff74fa1ce2bd57 | /OpenGL-Core/src/Platform/Linux/LinuxWindow.cpp | 8c1dad1dea8dffc28c137284073d3bf0e69c2cec | [
"Apache-2.0"
] | permissive | 9Y0/OpenGL | 01c2ba3af06f55e60cef6aa110c4b40fe52e1968 | 31bea36b702b8ee930759ad1bc9172e0fcef1e1c | refs/heads/master | 2020-12-10T10:31:21.687429 | 2020-01-13T11:11:06 | 2020-01-13T11:11:06 | 233,567,807 | 0 | 0 | null | 2020-01-13T10:17:41 | 2020-01-13T10:17:40 | null | UTF-8 | C++ | false | false | 4,268 | cpp | #include "glpch.h"
#include "LinuxWindow.h"
#include "GLCore/Events/ApplicationEvent.h"
#include "GLCore/Events/MouseEvent.h"
#include "GLCore/Events/KeyEvent.h"
#include <GLFW/glfw3.h>
#include <glad/glad.h>
namespace GLCore {
static bool s_GLFWInitialized = false;
static void GLFWErrorCallback(int error, const char* description)
{
LOG_ERROR("GLFW Error ({0}): {1}", error, description);
}
Window* Window::Create(const WindowProps& props)
{
return new LinuxWindow(props);
}
LinuxWindow::LinuxWindow(const WindowProps& props)
{
Init(props);
}
LinuxWindow::~LinuxWindow()
{
Shutdown();
}
void LinuxWindow::Init(const WindowProps& props)
{
m_Data.Title = props.Title;
m_Data.Width = props.Width;
m_Data.Height = props.Height;
if (!s_GLFWInitialized)
{
int success = glfwInit();
GLCORE_ASSERT(success, "Could not intialize GLFW!");
glfwSetErrorCallback(GLFWErrorCallback);
s_GLFWInitialized = true;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
m_Window = glfwCreateWindow((int)props.Width, (int)props.Height, m_Data.Title.c_str(), nullptr, nullptr);
glfwMakeContextCurrent(m_Window);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
GLCORE_ASSERT(status, "Failed to initialize Glad!");
LOG_INFO("OpenGL Info:");
LOG_INFO(" Vendor: {0}", glGetString(GL_VENDOR));
LOG_INFO(" Renderer: {0}", glGetString(GL_RENDERER));
LOG_INFO(" Version: {0}", glGetString(GL_VERSION));
glfwSetWindowUserPointer(m_Window, &m_Data);
SetVSync(true);
// Set GLFW callbacks
glfwSetWindowSizeCallback(m_Window, [](GLFWwindow* window, int width, int height)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
data.Width = width;
data.Height = height;
WindowResizeEvent event(width, height);
data.EventCallback(event);
});
glfwSetWindowCloseCallback(m_Window, [](GLFWwindow* window)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
WindowCloseEvent event;
data.EventCallback(event);
});
glfwSetKeyCallback(m_Window, [](GLFWwindow* window, int key, int scancode, int action, int mods)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
switch (action)
{
case GLFW_PRESS:
{
KeyPressedEvent event(key, 0);
data.EventCallback(event);
break;
}
case GLFW_RELEASE:
{
KeyReleasedEvent event(key);
data.EventCallback(event);
break;
}
case GLFW_REPEAT:
{
KeyPressedEvent event(key, 1);
data.EventCallback(event);
break;
}
}
});
glfwSetCharCallback(m_Window, [](GLFWwindow* window, unsigned int keycode)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
KeyTypedEvent event(keycode);
data.EventCallback(event);
});
glfwSetMouseButtonCallback(m_Window, [](GLFWwindow* window, int button, int action, int mods)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
switch (action)
{
case GLFW_PRESS:
{
MouseButtonPressedEvent event(button);
data.EventCallback(event);
break;
}
case GLFW_RELEASE:
{
MouseButtonReleasedEvent event(button);
data.EventCallback(event);
break;
}
}
});
glfwSetScrollCallback(m_Window, [](GLFWwindow* window, double xOffset, double yOffset)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
MouseScrolledEvent event((float)xOffset, (float)yOffset);
data.EventCallback(event);
});
glfwSetCursorPosCallback(m_Window, [](GLFWwindow* window, double xPos, double yPos)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
MouseMovedEvent event((float)xPos, (float)yPos);
data.EventCallback(event);
});
}
void LinuxWindow::Shutdown()
{
glfwDestroyWindow(m_Window);
}
void LinuxWindow::OnUpdate()
{
glfwPollEvents();
glfwSwapBuffers(m_Window);
}
void LinuxWindow::SetVSync(bool enabled)
{
if (enabled)
glfwSwapInterval(1);
else
glfwSwapInterval(0);
m_Data.VSync = enabled;
}
bool LinuxWindow::IsVSync() const
{
return m_Data.VSync;
}
}
| [
"[email protected]"
] | |
bef7b1f23e13af5329af2e74dc0cc2be4631d333 | ce74f7ba3e7fecd177158b96ca78d7ab92b9ba43 | /src/Commands/SqueezyLifter/TakeABreak.cpp | 3133b135d3ccb657a16d2c3c9d8417f327f9e755 | [] | no_license | FRCTeam1987/Robot2015 | dbea6b608c3aabf05b645db37178ad8ec2d164ae | 0144a97e4ee1867c802b7bd7683b84d279b36c99 | refs/heads/master | 2021-01-20T10:46:48.008095 | 2015-04-04T17:34:10 | 2015-04-04T17:34:10 | 29,799,540 | 0 | 2 | null | 2015-04-04T17:31:27 | 2015-01-25T02:15:20 | C++ | UTF-8 | C++ | false | false | 728 | cpp | #include "TakeABreak.h"
TakeABreak::TakeABreak()
{
Requires(squeezyLifter);
}
// Called just before this Command runs the first time
void TakeABreak::Initialize()
{
}
// Called repeatedly when this Command is scheduled to run
void TakeABreak::Execute()
{
SmartDashboard::PutString("Squeezy Lifter Status", squeezyLifter->isPaused() ? "Disabled": "Enabled");
}
// Make this return true when this Command no longer needs to run execute()
bool TakeABreak::IsFinished()
{
return !squeezyLifter->isPaused();
}
// Called once after isFinished returns true
void TakeABreak::End()
{
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void TakeABreak::Interrupted()
{
}
| [
"[email protected]"
] | |
064b4e0f7e75de77885a972482fc55e46462ab41 | 54b8fa244ff0dae2018efedcb81e1bb03376e5e2 | /src/qt/castle/settings/settingswidget.h | 045f817690a4bfb7c94ab906727feda2febb0a11 | [
"MIT"
] | permissive | afghany/castletmp | e15677a88f9a1878486b6becf93d26c0ee9dbeaf | 9d0daed2a6abaf7d93f9308f5c602db6eeb42c8b | refs/heads/master | 2022-11-27T14:58:47.802781 | 2020-08-08T21:26:12 | 2020-08-08T21:26:12 | 284,464,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,285 | h | // Copyright (c) 2019-2020 The CASTLE developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef SETTINGSWIDGET_H
#define SETTINGSWIDGET_H
#include <QWidget>
#include "qt/castle/pwidget.h"
#include "qt/castle/settings/settingsbackupwallet.h"
#include "qt/castle/settings/settingsexportcsv.h"
#include "qt/castle/settings/settingsbittoolwidget.h"
#include "qt/castle/settings/settingssignmessagewidgets.h"
#include "qt/castle/settings/settingswalletrepairwidget.h"
#include "qt/castle/settings/settingswalletoptionswidget.h"
#include "qt/castle/settings/settingsmainoptionswidget.h"
#include "qt/castle/settings/settingsdisplayoptionswidget.h"
#include "qt/castle/settings/settingsmultisendwidget.h"
#include "qt/castle/settings/settingsinformationwidget.h"
#include "qt/castle/settings/settingsconsolewidget.h"
class CASTLEGUI;
QT_BEGIN_NAMESPACE
class QDataWidgetMapper;
QT_END_NAMESPACE
namespace Ui {
class SettingsWidget;
}
class SettingsWidget : public PWidget
{
Q_OBJECT
public:
explicit SettingsWidget(CASTLEGUI* parent);
~SettingsWidget();
void loadClientModel() override;
void loadWalletModel() override;
void setMapper();
void showDebugConsole();
void showInformation();
void openNetworkMonitor();
Q_SIGNALS:
/** Get restart command-line parameters and handle restart */
void handleRestart(QStringList args);
private Q_SLOTS:
// File
void onFileClicked();
void onBackupWalletClicked();
void onSignMessageClicked();
// Wallet Configuration
void onConfigurationClicked();
void onBipToolClicked();
void onMultisendClicked();
void onExportCSVClicked();
// Options
void onOptionsClicked();
void onMainOptionsClicked();
void onWalletOptionsClicked();
void onDisplayOptionsClicked();
void onDiscardChanges();
// Tools
void onToolsClicked();
void onInformationClicked();
void onDebugConsoleClicked();
void onWalletRepairClicked();
// Help
void onHelpClicked();
void onAboutClicked();
void onResetAction();
void onSaveOptionsClicked();
private:
Ui::SettingsWidget *ui;
int navAreaBaseHeight{0};
SettingsBackupWallet *settingsBackupWallet;
SettingsExportCSV *settingsExportCsvWidget;
SettingsBitToolWidget *settingsBitToolWidget;
SettingsSignMessageWidgets *settingsSingMessageWidgets;
SettingsWalletRepairWidget *settingsWalletRepairWidget;
SettingsWalletOptionsWidget *settingsWalletOptionsWidget;
SettingsMainOptionsWidget *settingsMainOptionsWidget;
SettingsDisplayOptionsWidget *settingsDisplayOptionsWidget;
SettingsMultisendWidget *settingsMultisendWidget;
SettingsInformationWidget *settingsInformationWidget;
SettingsConsoleWidget *settingsConsoleWidget;
QDataWidgetMapper* mapper;
QList<QPushButton*> options;
// Map of: menu button -> sub menu items
QMap <QPushButton*, QWidget*> menus;
void selectOption(QPushButton* option);
bool openStandardDialog(const QString& title = "", const QString& body = "", const QString& okBtn = "OK", const QString& cancelBtn = "");
void selectMenu(QPushButton* btn);
};
#endif // SETTINGSWIDGET_H
| [
"[email protected]"
] | |
d4b57d4572be3a90dfe8480d2707cc7c902bd2f0 | 794df2a660e679a7119dd5f7fd4e480908412f12 | /LoadCases.cpp | 5a73e17c539b265c40d25b55a40d6cb9c5f4294b | [] | no_license | shchupko/TO | 0f24a50c1395359c3d0555881ef9495ed5c77949 | 57ef5ae01252a46b6386f7256413212837b3cb71 | refs/heads/master | 2021-01-22T06:06:15.159676 | 2017-07-10T14:31:13 | 2017-07-10T14:31:13 | 92,521,977 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,821 | cpp | /*
* LoadCases.cpp
*
* Created on: May 24, 2017
* Author: user
*/
#include "LoadCases.h"
#include <sys/types.h>
#include <dirent.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include "string.h"
std::vector<std::string> split(const std::string& str, const std::string& delim){
std::vector<std::string> tokens;
size_t prev = 0, pos = 0;
do {
pos = str.find(delim, prev);
if (pos == std::string::npos) pos = str.length();
std::string token = str.substr(prev, pos-prev);
if (!token.empty()) tokens.push_back(token);
prev = pos + delim.length();
}
while (pos < str.length() && prev < str.length());
return tokens;
}
static int RHSfilter(const struct dirent* dir_ent){
if (!strcmp(dir_ent->d_name, ".") || !strcmp(dir_ent->d_name, "..")) return 0;
std::string fname = dir_ent->d_name;
if (fname.find("RHS") == std::string::npos) return 0;
return 1;
}
LoadCases::LoadCases(const char* inputPath) {
Init(inputPath);
}
LoadCases::~LoadCases() {
}
PetscErrorCode LoadCases::Init(const char* inputPath){
std::string inputFilesPath = inputPath;
inputFilesPath.append("/optimization_data.txt");
Debug("%s", inputFilesPath.c_str());
std::string tmpstr;
std::fstream instr;
instr.open(inputFilesPath.c_str(),std::ios::in);
while (std::getline(instr, tmpstr)){
instr>>tmpstr;
std::transform(tmpstr.begin(), tmpstr.end(), tmpstr.begin(), ::tolower);
if(tmpstr=="nbc"){
instr>>nbc;
}
else if (tmpstr=="nlc"){
tnlc = 0;
for (int i=0; i<nbc; i++){
instr>>nlc[i];
tnlc = tnlc + nlc[i];
}
}
else {
continue;
}
}
instr.close();
{
int bcnum;
int rhsnum;
// Find all RHS*.bin files in input, organize i_j_k indices
struct dirent **namelist;
int nfiles = scandir(inputPath, &namelist, *RHSfilter, alphasort);
if (nfiles < 0)
perror("scandir");
else {
while (nfiles--) {
std::string filestr(namelist[nfiles]->d_name);
std::string delim="_";
std::vector<std::string> rez = split(filestr,delim);
bcnum = atoi(rez[1].c_str());
rhsnum = atoi(rez[2].c_str());
ijkmat[bcnum-1][rhsnum-1] = atoi(rez[3].c_str());
Debug("Found BC %i and RHS %i and LC %i", bcnum, rhsnum, ijkmat[bcnum-1][rhsnum-1]);
free(namelist[nfiles]);
}
free(namelist);
}
}
/*
// Read in RHS one by one
Vec inputvec;
PetscViewer viewer1;
MPI_Comm comm = PETSC_COMM_WORLD;
ierr = DMDACreateNaturalVector(pMesh->GetNDMDA(),&inputvec); CHKERRQ(ierr); // Read in natural ordering
for (int i=0; i<pBC->nbc; i++){
for (int j=0; j<nlc[i]; j++){
int lcnum = ijkmat[i][j];
// Read RHS one by one for this BC
ierr = PetscViewerBinaryOpen(comm, TOData::GetInputFilePath("RHS_%i_%i_%i.bin", i+1, j+1, lcnum). c_str(),
FILE_MODE_READ,&viewer1); CHKERRQ(ierr); // Read binary file with RHS data
ierr = VecLoad(inputvec,viewer1); CHKERRQ(ierr); // Keep RHS data in new natural vector
ierr = DMDANaturalToGlobalBegin(pMesh->GetNDMDA(),inputvec,INSERT_VALUES,RHS[lcnum-1]); CHKERRQ(ierr); // Transfer vector to global ordering - start
ierr = DMDANaturalToGlobalEnd(pMesh->GetNDMDA(),inputvec,INSERT_VALUES,RHS[lcnum-1]); CHKERRQ(ierr); // Transfer vector to global ordering - end
VecSet(inputvec,0.0);
}
}
ierr = PetscViewerDestroy(&viewer1); CHKERRQ(ierr); // Destroy viewer
*/
return 0;
}
| [
"[email protected]"
] | |
5da114268135ab08d7ec45f904967e211f5aad27 | c776476e9d06b3779d744641e758ac3a2c15cddc | /examples/litmus/c/run-scripts/tmp_5/2+2W+dmb.sy+rfi-addr-ctrl-addr.c.cbmc_out.cpp | 3dd01e1fd46ff7d671e42f615618d8ac8f159e43 | [] | no_license | ashutosh0gupta/llvm_bmc | aaac7961c723ba6f7ffd77a39559e0e52432eade | 0287c4fb180244e6b3c599a9902507f05c8a7234 | refs/heads/master | 2023-08-02T17:14:06.178723 | 2023-07-31T10:46:53 | 2023-07-31T10:46:53 | 143,100,825 | 3 | 4 | null | 2023-05-25T05:50:55 | 2018-08-01T03:47:00 | C++ | UTF-8 | C++ | false | false | 39,661 | cpp | // Global variabls:
// 0:vars:4
// 4:atom_1_X2_2:1
// Local global variabls:
// 0:thr0:1
// 1:thr1:1
#define ADDRSIZE 5
#define LOCALADDRSIZE 2
#define NTHREAD 3
#define NCONTEXT 5
#define ASSUME(stmt) __CPROVER_assume(stmt)
#define ASSERT(stmt) __CPROVER_assert(stmt, "error")
#define max(a,b) (a>b?a:b)
char __get_rng();
char get_rng( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
char get_rng_th( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
int main(int argc, char **argv) {
// Declare arrays for intial value version in contexts
int local_mem[LOCALADDRSIZE];
// Dumping initializations
local_mem[0+0] = 0;
local_mem[1+0] = 0;
int cstart[NTHREAD];
int creturn[NTHREAD];
// declare arrays for contexts activity
int active[NCONTEXT];
int ctx_used[NCONTEXT];
// declare arrays for intial value version in contexts
int meminit_[ADDRSIZE*NCONTEXT];
#define meminit(x,k) meminit_[(x)*NCONTEXT+k]
int coinit_[ADDRSIZE*NCONTEXT];
#define coinit(x,k) coinit_[(x)*NCONTEXT+k]
int deltainit_[ADDRSIZE*NCONTEXT];
#define deltainit(x,k) deltainit_[(x)*NCONTEXT+k]
// declare arrays for running value version in contexts
int mem_[ADDRSIZE*NCONTEXT];
#define mem(x,k) mem_[(x)*NCONTEXT+k]
int co_[ADDRSIZE*NCONTEXT];
#define co(x,k) co_[(x)*NCONTEXT+k]
int delta_[ADDRSIZE*NCONTEXT];
#define delta(x,k) delta_[(x)*NCONTEXT+k]
// declare arrays for local buffer and observed writes
int buff_[NTHREAD*ADDRSIZE];
#define buff(x,k) buff_[(x)*ADDRSIZE+k]
int pw_[NTHREAD*ADDRSIZE];
#define pw(x,k) pw_[(x)*ADDRSIZE+k]
// declare arrays for context stamps
char cr_[NTHREAD*ADDRSIZE];
#define cr(x,k) cr_[(x)*ADDRSIZE+k]
char iw_[NTHREAD*ADDRSIZE];
#define iw(x,k) iw_[(x)*ADDRSIZE+k]
char cw_[NTHREAD*ADDRSIZE];
#define cw(x,k) cw_[(x)*ADDRSIZE+k]
char cx_[NTHREAD*ADDRSIZE];
#define cx(x,k) cx_[(x)*ADDRSIZE+k]
char is_[NTHREAD*ADDRSIZE];
#define is(x,k) is_[(x)*ADDRSIZE+k]
char cs_[NTHREAD*ADDRSIZE];
#define cs(x,k) cs_[(x)*ADDRSIZE+k]
char crmax_[NTHREAD*ADDRSIZE];
#define crmax(x,k) crmax_[(x)*ADDRSIZE+k]
char sforbid_[ADDRSIZE*NCONTEXT];
#define sforbid(x,k) sforbid_[(x)*NCONTEXT+k]
// declare arrays for synchronizations
int cl[NTHREAD];
int cdy[NTHREAD];
int cds[NTHREAD];
int cdl[NTHREAD];
int cisb[NTHREAD];
int caddr[NTHREAD];
int cctrl[NTHREAD];
int r0= 0;
char creg_r0;
int r1= 0;
char creg_r1;
int r2= 0;
char creg_r2;
int r3= 0;
char creg_r3;
int r4= 0;
char creg_r4;
char creg__r4__0_;
int r5= 0;
char creg_r5;
int r6= 0;
char creg_r6;
int r7= 0;
char creg_r7;
int r8= 0;
char creg_r8;
char creg__r0__2_;
int r9= 0;
char creg_r9;
int r10= 0;
char creg_r10;
int r11= 0;
char creg_r11;
int r12= 0;
char creg_r12;
char creg__r12__2_;
int r13= 0;
char creg_r13;
char creg__r13__2_;
int r14= 0;
char creg_r14;
int r15= 0;
char creg_r15;
int r16= 0;
char creg_r16;
char creg__r16__1_;
int r17= 0;
char creg_r17;
char old_cctrl= 0;
char old_cr= 0;
char old_cdy= 0;
char old_cw= 0;
char new_creg= 0;
buff(0,0) = 0;
pw(0,0) = 0;
cr(0,0) = 0;
iw(0,0) = 0;
cw(0,0) = 0;
cx(0,0) = 0;
is(0,0) = 0;
cs(0,0) = 0;
crmax(0,0) = 0;
buff(0,1) = 0;
pw(0,1) = 0;
cr(0,1) = 0;
iw(0,1) = 0;
cw(0,1) = 0;
cx(0,1) = 0;
is(0,1) = 0;
cs(0,1) = 0;
crmax(0,1) = 0;
buff(0,2) = 0;
pw(0,2) = 0;
cr(0,2) = 0;
iw(0,2) = 0;
cw(0,2) = 0;
cx(0,2) = 0;
is(0,2) = 0;
cs(0,2) = 0;
crmax(0,2) = 0;
buff(0,3) = 0;
pw(0,3) = 0;
cr(0,3) = 0;
iw(0,3) = 0;
cw(0,3) = 0;
cx(0,3) = 0;
is(0,3) = 0;
cs(0,3) = 0;
crmax(0,3) = 0;
buff(0,4) = 0;
pw(0,4) = 0;
cr(0,4) = 0;
iw(0,4) = 0;
cw(0,4) = 0;
cx(0,4) = 0;
is(0,4) = 0;
cs(0,4) = 0;
crmax(0,4) = 0;
cl[0] = 0;
cdy[0] = 0;
cds[0] = 0;
cdl[0] = 0;
cisb[0] = 0;
caddr[0] = 0;
cctrl[0] = 0;
cstart[0] = get_rng(0,NCONTEXT-1);
creturn[0] = get_rng(0,NCONTEXT-1);
buff(1,0) = 0;
pw(1,0) = 0;
cr(1,0) = 0;
iw(1,0) = 0;
cw(1,0) = 0;
cx(1,0) = 0;
is(1,0) = 0;
cs(1,0) = 0;
crmax(1,0) = 0;
buff(1,1) = 0;
pw(1,1) = 0;
cr(1,1) = 0;
iw(1,1) = 0;
cw(1,1) = 0;
cx(1,1) = 0;
is(1,1) = 0;
cs(1,1) = 0;
crmax(1,1) = 0;
buff(1,2) = 0;
pw(1,2) = 0;
cr(1,2) = 0;
iw(1,2) = 0;
cw(1,2) = 0;
cx(1,2) = 0;
is(1,2) = 0;
cs(1,2) = 0;
crmax(1,2) = 0;
buff(1,3) = 0;
pw(1,3) = 0;
cr(1,3) = 0;
iw(1,3) = 0;
cw(1,3) = 0;
cx(1,3) = 0;
is(1,3) = 0;
cs(1,3) = 0;
crmax(1,3) = 0;
buff(1,4) = 0;
pw(1,4) = 0;
cr(1,4) = 0;
iw(1,4) = 0;
cw(1,4) = 0;
cx(1,4) = 0;
is(1,4) = 0;
cs(1,4) = 0;
crmax(1,4) = 0;
cl[1] = 0;
cdy[1] = 0;
cds[1] = 0;
cdl[1] = 0;
cisb[1] = 0;
caddr[1] = 0;
cctrl[1] = 0;
cstart[1] = get_rng(0,NCONTEXT-1);
creturn[1] = get_rng(0,NCONTEXT-1);
buff(2,0) = 0;
pw(2,0) = 0;
cr(2,0) = 0;
iw(2,0) = 0;
cw(2,0) = 0;
cx(2,0) = 0;
is(2,0) = 0;
cs(2,0) = 0;
crmax(2,0) = 0;
buff(2,1) = 0;
pw(2,1) = 0;
cr(2,1) = 0;
iw(2,1) = 0;
cw(2,1) = 0;
cx(2,1) = 0;
is(2,1) = 0;
cs(2,1) = 0;
crmax(2,1) = 0;
buff(2,2) = 0;
pw(2,2) = 0;
cr(2,2) = 0;
iw(2,2) = 0;
cw(2,2) = 0;
cx(2,2) = 0;
is(2,2) = 0;
cs(2,2) = 0;
crmax(2,2) = 0;
buff(2,3) = 0;
pw(2,3) = 0;
cr(2,3) = 0;
iw(2,3) = 0;
cw(2,3) = 0;
cx(2,3) = 0;
is(2,3) = 0;
cs(2,3) = 0;
crmax(2,3) = 0;
buff(2,4) = 0;
pw(2,4) = 0;
cr(2,4) = 0;
iw(2,4) = 0;
cw(2,4) = 0;
cx(2,4) = 0;
is(2,4) = 0;
cs(2,4) = 0;
crmax(2,4) = 0;
cl[2] = 0;
cdy[2] = 0;
cds[2] = 0;
cdl[2] = 0;
cisb[2] = 0;
caddr[2] = 0;
cctrl[2] = 0;
cstart[2] = get_rng(0,NCONTEXT-1);
creturn[2] = get_rng(0,NCONTEXT-1);
// Dumping initializations
mem(0+0,0) = 0;
mem(0+1,0) = 0;
mem(0+2,0) = 0;
mem(0+3,0) = 0;
mem(4+0,0) = 0;
// Dumping context matching equalities
co(0,0) = 0;
delta(0,0) = -1;
mem(0,1) = meminit(0,1);
co(0,1) = coinit(0,1);
delta(0,1) = deltainit(0,1);
mem(0,2) = meminit(0,2);
co(0,2) = coinit(0,2);
delta(0,2) = deltainit(0,2);
mem(0,3) = meminit(0,3);
co(0,3) = coinit(0,3);
delta(0,3) = deltainit(0,3);
mem(0,4) = meminit(0,4);
co(0,4) = coinit(0,4);
delta(0,4) = deltainit(0,4);
co(1,0) = 0;
delta(1,0) = -1;
mem(1,1) = meminit(1,1);
co(1,1) = coinit(1,1);
delta(1,1) = deltainit(1,1);
mem(1,2) = meminit(1,2);
co(1,2) = coinit(1,2);
delta(1,2) = deltainit(1,2);
mem(1,3) = meminit(1,3);
co(1,3) = coinit(1,3);
delta(1,3) = deltainit(1,3);
mem(1,4) = meminit(1,4);
co(1,4) = coinit(1,4);
delta(1,4) = deltainit(1,4);
co(2,0) = 0;
delta(2,0) = -1;
mem(2,1) = meminit(2,1);
co(2,1) = coinit(2,1);
delta(2,1) = deltainit(2,1);
mem(2,2) = meminit(2,2);
co(2,2) = coinit(2,2);
delta(2,2) = deltainit(2,2);
mem(2,3) = meminit(2,3);
co(2,3) = coinit(2,3);
delta(2,3) = deltainit(2,3);
mem(2,4) = meminit(2,4);
co(2,4) = coinit(2,4);
delta(2,4) = deltainit(2,4);
co(3,0) = 0;
delta(3,0) = -1;
mem(3,1) = meminit(3,1);
co(3,1) = coinit(3,1);
delta(3,1) = deltainit(3,1);
mem(3,2) = meminit(3,2);
co(3,2) = coinit(3,2);
delta(3,2) = deltainit(3,2);
mem(3,3) = meminit(3,3);
co(3,3) = coinit(3,3);
delta(3,3) = deltainit(3,3);
mem(3,4) = meminit(3,4);
co(3,4) = coinit(3,4);
delta(3,4) = deltainit(3,4);
co(4,0) = 0;
delta(4,0) = -1;
mem(4,1) = meminit(4,1);
co(4,1) = coinit(4,1);
delta(4,1) = deltainit(4,1);
mem(4,2) = meminit(4,2);
co(4,2) = coinit(4,2);
delta(4,2) = deltainit(4,2);
mem(4,3) = meminit(4,3);
co(4,3) = coinit(4,3);
delta(4,3) = deltainit(4,3);
mem(4,4) = meminit(4,4);
co(4,4) = coinit(4,4);
delta(4,4) = deltainit(4,4);
// Dumping thread 1
int ret_thread_1 = 0;
cdy[1] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[1] >= cstart[1]);
T1BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !34, metadata !DIExpression()), !dbg !43
// br label %label_1, !dbg !44
goto T1BLOCK1;
T1BLOCK1:
// call void @llvm.dbg.label(metadata !42), !dbg !45
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !35, metadata !DIExpression()), !dbg !46
// call void @llvm.dbg.value(metadata i64 2, metadata !38, metadata !DIExpression()), !dbg !46
// store atomic i64 2, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !47
// ST: Guess
iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l19_c3
old_cw = cw(1,0);
cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l19_c3
// Check
ASSUME(active[iw(1,0)] == 1);
ASSUME(active[cw(1,0)] == 1);
ASSUME(sforbid(0,cw(1,0))== 0);
ASSUME(iw(1,0) >= 0);
ASSUME(iw(1,0) >= 0);
ASSUME(cw(1,0) >= iw(1,0));
ASSUME(cw(1,0) >= old_cw);
ASSUME(cw(1,0) >= cr(1,0));
ASSUME(cw(1,0) >= cl[1]);
ASSUME(cw(1,0) >= cisb[1]);
ASSUME(cw(1,0) >= cdy[1]);
ASSUME(cw(1,0) >= cdl[1]);
ASSUME(cw(1,0) >= cds[1]);
ASSUME(cw(1,0) >= cctrl[1]);
ASSUME(cw(1,0) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0) = 2;
mem(0,cw(1,0)) = 2;
co(0,cw(1,0))+=1;
delta(0,cw(1,0)) = -1;
ASSUME(creturn[1] >= cw(1,0));
// call void (...) @dmbsy(), !dbg !48
// dumbsy: Guess
old_cdy = cdy[1];
cdy[1] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[1] >= old_cdy);
ASSUME(cdy[1] >= cisb[1]);
ASSUME(cdy[1] >= cdl[1]);
ASSUME(cdy[1] >= cds[1]);
ASSUME(cdy[1] >= cctrl[1]);
ASSUME(cdy[1] >= cw(1,0+0));
ASSUME(cdy[1] >= cw(1,0+1));
ASSUME(cdy[1] >= cw(1,0+2));
ASSUME(cdy[1] >= cw(1,0+3));
ASSUME(cdy[1] >= cw(1,4+0));
ASSUME(cdy[1] >= cr(1,0+0));
ASSUME(cdy[1] >= cr(1,0+1));
ASSUME(cdy[1] >= cr(1,0+2));
ASSUME(cdy[1] >= cr(1,0+3));
ASSUME(cdy[1] >= cr(1,4+0));
ASSUME(creturn[1] >= cdy[1]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !39, metadata !DIExpression()), !dbg !49
// call void @llvm.dbg.value(metadata i64 1, metadata !41, metadata !DIExpression()), !dbg !49
// store atomic i64 1, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !50
// ST: Guess
iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l21_c3
old_cw = cw(1,0+1*1);
cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l21_c3
// Check
ASSUME(active[iw(1,0+1*1)] == 1);
ASSUME(active[cw(1,0+1*1)] == 1);
ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(cw(1,0+1*1) >= iw(1,0+1*1));
ASSUME(cw(1,0+1*1) >= old_cw);
ASSUME(cw(1,0+1*1) >= cr(1,0+1*1));
ASSUME(cw(1,0+1*1) >= cl[1]);
ASSUME(cw(1,0+1*1) >= cisb[1]);
ASSUME(cw(1,0+1*1) >= cdy[1]);
ASSUME(cw(1,0+1*1) >= cdl[1]);
ASSUME(cw(1,0+1*1) >= cds[1]);
ASSUME(cw(1,0+1*1) >= cctrl[1]);
ASSUME(cw(1,0+1*1) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0+1*1) = 1;
mem(0+1*1,cw(1,0+1*1)) = 1;
co(0+1*1,cw(1,0+1*1))+=1;
delta(0+1*1,cw(1,0+1*1)) = -1;
ASSUME(creturn[1] >= cw(1,0+1*1));
// ret i8* null, !dbg !51
ret_thread_1 = (- 1);
goto T1BLOCK_END;
T1BLOCK_END:
// Dumping thread 2
int ret_thread_2 = 0;
cdy[2] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[2] >= cstart[2]);
T2BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !54, metadata !DIExpression()), !dbg !78
// br label %label_2, !dbg !60
goto T2BLOCK1;
T2BLOCK1:
// call void @llvm.dbg.label(metadata !76), !dbg !80
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !55, metadata !DIExpression()), !dbg !81
// call void @llvm.dbg.value(metadata i64 2, metadata !57, metadata !DIExpression()), !dbg !81
// store atomic i64 2, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !63
// ST: Guess
iw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l27_c3
old_cw = cw(2,0+1*1);
cw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l27_c3
// Check
ASSUME(active[iw(2,0+1*1)] == 2);
ASSUME(active[cw(2,0+1*1)] == 2);
ASSUME(sforbid(0+1*1,cw(2,0+1*1))== 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(cw(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cw(2,0+1*1) >= old_cw);
ASSUME(cw(2,0+1*1) >= cr(2,0+1*1));
ASSUME(cw(2,0+1*1) >= cl[2]);
ASSUME(cw(2,0+1*1) >= cisb[2]);
ASSUME(cw(2,0+1*1) >= cdy[2]);
ASSUME(cw(2,0+1*1) >= cdl[2]);
ASSUME(cw(2,0+1*1) >= cds[2]);
ASSUME(cw(2,0+1*1) >= cctrl[2]);
ASSUME(cw(2,0+1*1) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0+1*1) = 2;
mem(0+1*1,cw(2,0+1*1)) = 2;
co(0+1*1,cw(2,0+1*1))+=1;
delta(0+1*1,cw(2,0+1*1)) = -1;
ASSUME(creturn[2] >= cw(2,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !59, metadata !DIExpression()), !dbg !83
// %0 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !65
// LD: Guess
old_cr = cr(2,0+1*1);
cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l28_c15
// Check
ASSUME(active[cr(2,0+1*1)] == 2);
ASSUME(cr(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cr(2,0+1*1) >= 0);
ASSUME(cr(2,0+1*1) >= cdy[2]);
ASSUME(cr(2,0+1*1) >= cisb[2]);
ASSUME(cr(2,0+1*1) >= cdl[2]);
ASSUME(cr(2,0+1*1) >= cl[2]);
// Update
creg_r0 = cr(2,0+1*1);
crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+1*1) < cw(2,0+1*1)) {
r0 = buff(2,0+1*1);
ASSUME((!(( (cw(2,0+1*1) < 1) && (1 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(2,0+1*1) < 2) && (2 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(2,0+1*1) < 3) && (3 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(2,0+1*1) < 4) && (4 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) {
ASSUME(cr(2,0+1*1) >= old_cr);
}
pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1));
r0 = mem(0+1*1,cr(2,0+1*1));
}
ASSUME(creturn[2] >= cr(2,0+1*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !61, metadata !DIExpression()), !dbg !83
// %conv = trunc i64 %0 to i32, !dbg !66
// call void @llvm.dbg.value(metadata i32 %conv, metadata !58, metadata !DIExpression()), !dbg !78
// %xor = xor i32 %conv, %conv, !dbg !67
creg_r1 = creg_r0;
r1 = r0 ^ r0;
// call void @llvm.dbg.value(metadata i32 %xor, metadata !62, metadata !DIExpression()), !dbg !78
// %add = add nsw i32 2, %xor, !dbg !68
creg_r2 = max(0,creg_r1);
r2 = 2 + r1;
// %idxprom = sext i32 %add to i64, !dbg !68
// %arrayidx = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom, !dbg !68
r3 = 0+r2*1;
creg_r3 = creg_r2;
// call void @llvm.dbg.value(metadata i64* %arrayidx, metadata !64, metadata !DIExpression()), !dbg !88
// %1 = load atomic i64, i64* %arrayidx monotonic, align 8, !dbg !68
// LD: Guess
old_cr = cr(2,r3);
cr(2,r3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l30_c15
// Check
ASSUME(active[cr(2,r3)] == 2);
ASSUME(cr(2,r3) >= iw(2,r3));
ASSUME(cr(2,r3) >= creg_r3);
ASSUME(cr(2,r3) >= cdy[2]);
ASSUME(cr(2,r3) >= cisb[2]);
ASSUME(cr(2,r3) >= cdl[2]);
ASSUME(cr(2,r3) >= cl[2]);
// Update
creg_r4 = cr(2,r3);
crmax(2,r3) = max(crmax(2,r3),cr(2,r3));
caddr[2] = max(caddr[2],creg_r3);
if(cr(2,r3) < cw(2,r3)) {
r4 = buff(2,r3);
ASSUME((!(( (cw(2,r3) < 1) && (1 < crmax(2,r3)) )))||(sforbid(r3,1)> 0));
ASSUME((!(( (cw(2,r3) < 2) && (2 < crmax(2,r3)) )))||(sforbid(r3,2)> 0));
ASSUME((!(( (cw(2,r3) < 3) && (3 < crmax(2,r3)) )))||(sforbid(r3,3)> 0));
ASSUME((!(( (cw(2,r3) < 4) && (4 < crmax(2,r3)) )))||(sforbid(r3,4)> 0));
} else {
if(pw(2,r3) != co(r3,cr(2,r3))) {
ASSUME(cr(2,r3) >= old_cr);
}
pw(2,r3) = co(r3,cr(2,r3));
r4 = mem(r3,cr(2,r3));
}
ASSUME(creturn[2] >= cr(2,r3));
// call void @llvm.dbg.value(metadata i64 %1, metadata !66, metadata !DIExpression()), !dbg !88
// %conv4 = trunc i64 %1 to i32, !dbg !70
// call void @llvm.dbg.value(metadata i32 %conv4, metadata !63, metadata !DIExpression()), !dbg !78
// %tobool = icmp ne i32 %conv4, 0, !dbg !71
creg__r4__0_ = max(0,creg_r4);
// br i1 %tobool, label %if.then, label %if.else, !dbg !73
old_cctrl = cctrl[2];
cctrl[2] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[2] >= old_cctrl);
ASSUME(cctrl[2] >= creg__r4__0_);
if((r4!=0)) {
goto T2BLOCK2;
} else {
goto T2BLOCK3;
}
T2BLOCK2:
// br label %lbl_LC00, !dbg !74
goto T2BLOCK4;
T2BLOCK3:
// br label %lbl_LC00, !dbg !75
goto T2BLOCK4;
T2BLOCK4:
// call void @llvm.dbg.label(metadata !77), !dbg !95
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !68, metadata !DIExpression()), !dbg !96
// %2 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !78
// LD: Guess
old_cr = cr(2,0+3*1);
cr(2,0+3*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l33_c16
// Check
ASSUME(active[cr(2,0+3*1)] == 2);
ASSUME(cr(2,0+3*1) >= iw(2,0+3*1));
ASSUME(cr(2,0+3*1) >= 0);
ASSUME(cr(2,0+3*1) >= cdy[2]);
ASSUME(cr(2,0+3*1) >= cisb[2]);
ASSUME(cr(2,0+3*1) >= cdl[2]);
ASSUME(cr(2,0+3*1) >= cl[2]);
// Update
creg_r5 = cr(2,0+3*1);
crmax(2,0+3*1) = max(crmax(2,0+3*1),cr(2,0+3*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+3*1) < cw(2,0+3*1)) {
r5 = buff(2,0+3*1);
ASSUME((!(( (cw(2,0+3*1) < 1) && (1 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,1)> 0));
ASSUME((!(( (cw(2,0+3*1) < 2) && (2 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,2)> 0));
ASSUME((!(( (cw(2,0+3*1) < 3) && (3 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,3)> 0));
ASSUME((!(( (cw(2,0+3*1) < 4) && (4 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,4)> 0));
} else {
if(pw(2,0+3*1) != co(0+3*1,cr(2,0+3*1))) {
ASSUME(cr(2,0+3*1) >= old_cr);
}
pw(2,0+3*1) = co(0+3*1,cr(2,0+3*1));
r5 = mem(0+3*1,cr(2,0+3*1));
}
ASSUME(creturn[2] >= cr(2,0+3*1));
// call void @llvm.dbg.value(metadata i64 %2, metadata !70, metadata !DIExpression()), !dbg !96
// %conv8 = trunc i64 %2 to i32, !dbg !79
// call void @llvm.dbg.value(metadata i32 %conv8, metadata !67, metadata !DIExpression()), !dbg !78
// %xor9 = xor i32 %conv8, %conv8, !dbg !80
creg_r6 = creg_r5;
r6 = r5 ^ r5;
// call void @llvm.dbg.value(metadata i32 %xor9, metadata !71, metadata !DIExpression()), !dbg !78
// %add11 = add nsw i32 0, %xor9, !dbg !81
creg_r7 = max(0,creg_r6);
r7 = 0 + r6;
// %idxprom12 = sext i32 %add11 to i64, !dbg !81
// %arrayidx13 = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom12, !dbg !81
r8 = 0+r7*1;
creg_r8 = creg_r7;
// call void @llvm.dbg.value(metadata i64* %arrayidx13, metadata !72, metadata !DIExpression()), !dbg !101
// call void @llvm.dbg.value(metadata i64 1, metadata !74, metadata !DIExpression()), !dbg !101
// store atomic i64 1, i64* %arrayidx13 monotonic, align 8, !dbg !81
// ST: Guess
iw(2,r8) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l35_c3
old_cw = cw(2,r8);
cw(2,r8) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l35_c3
// Check
ASSUME(active[iw(2,r8)] == 2);
ASSUME(active[cw(2,r8)] == 2);
ASSUME(sforbid(r8,cw(2,r8))== 0);
ASSUME(iw(2,r8) >= 0);
ASSUME(iw(2,r8) >= creg_r8);
ASSUME(cw(2,r8) >= iw(2,r8));
ASSUME(cw(2,r8) >= old_cw);
ASSUME(cw(2,r8) >= cr(2,r8));
ASSUME(cw(2,r8) >= cl[2]);
ASSUME(cw(2,r8) >= cisb[2]);
ASSUME(cw(2,r8) >= cdy[2]);
ASSUME(cw(2,r8) >= cdl[2]);
ASSUME(cw(2,r8) >= cds[2]);
ASSUME(cw(2,r8) >= cctrl[2]);
ASSUME(cw(2,r8) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],creg_r8);
buff(2,r8) = 1;
mem(r8,cw(2,r8)) = 1;
co(r8,cw(2,r8))+=1;
delta(r8,cw(2,r8)) = -1;
ASSUME(creturn[2] >= cw(2,r8));
// %cmp = icmp eq i32 %conv, 2, !dbg !83
creg__r0__2_ = max(0,creg_r0);
// %conv15 = zext i1 %cmp to i32, !dbg !83
// call void @llvm.dbg.value(metadata i32 %conv15, metadata !75, metadata !DIExpression()), !dbg !78
// store i32 %conv15, i32* @atom_1_X2_2, align 4, !dbg !84, !tbaa !85
// ST: Guess
iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l37_c15
old_cw = cw(2,4);
cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l37_c15
// Check
ASSUME(active[iw(2,4)] == 2);
ASSUME(active[cw(2,4)] == 2);
ASSUME(sforbid(4,cw(2,4))== 0);
ASSUME(iw(2,4) >= creg__r0__2_);
ASSUME(iw(2,4) >= 0);
ASSUME(cw(2,4) >= iw(2,4));
ASSUME(cw(2,4) >= old_cw);
ASSUME(cw(2,4) >= cr(2,4));
ASSUME(cw(2,4) >= cl[2]);
ASSUME(cw(2,4) >= cisb[2]);
ASSUME(cw(2,4) >= cdy[2]);
ASSUME(cw(2,4) >= cdl[2]);
ASSUME(cw(2,4) >= cds[2]);
ASSUME(cw(2,4) >= cctrl[2]);
ASSUME(cw(2,4) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,4) = (r0==2);
mem(4,cw(2,4)) = (r0==2);
co(4,cw(2,4))+=1;
delta(4,cw(2,4)) = -1;
ASSUME(creturn[2] >= cw(2,4));
// ret i8* null, !dbg !89
ret_thread_2 = (- 1);
goto T2BLOCK_END;
T2BLOCK_END:
// Dumping thread 0
int ret_thread_0 = 0;
cdy[0] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[0] >= cstart[0]);
T0BLOCK0:
// %thr0 = alloca i64, align 8
// %thr1 = alloca i64, align 8
// call void @llvm.dbg.value(metadata i32 %argc, metadata !116, metadata !DIExpression()), !dbg !148
// call void @llvm.dbg.value(metadata i8** %argv, metadata !117, metadata !DIExpression()), !dbg !148
// %0 = bitcast i64* %thr0 to i8*, !dbg !71
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !71
// call void @llvm.dbg.declare(metadata i64* %thr0, metadata !118, metadata !DIExpression()), !dbg !150
// %1 = bitcast i64* %thr1 to i8*, !dbg !73
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !73
// call void @llvm.dbg.declare(metadata i64* %thr1, metadata !122, metadata !DIExpression()), !dbg !152
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !123, metadata !DIExpression()), !dbg !153
// call void @llvm.dbg.value(metadata i64 0, metadata !125, metadata !DIExpression()), !dbg !153
// store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !76
// ST: Guess
iw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l45_c3
old_cw = cw(0,0+3*1);
cw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l45_c3
// Check
ASSUME(active[iw(0,0+3*1)] == 0);
ASSUME(active[cw(0,0+3*1)] == 0);
ASSUME(sforbid(0+3*1,cw(0,0+3*1))== 0);
ASSUME(iw(0,0+3*1) >= 0);
ASSUME(iw(0,0+3*1) >= 0);
ASSUME(cw(0,0+3*1) >= iw(0,0+3*1));
ASSUME(cw(0,0+3*1) >= old_cw);
ASSUME(cw(0,0+3*1) >= cr(0,0+3*1));
ASSUME(cw(0,0+3*1) >= cl[0]);
ASSUME(cw(0,0+3*1) >= cisb[0]);
ASSUME(cw(0,0+3*1) >= cdy[0]);
ASSUME(cw(0,0+3*1) >= cdl[0]);
ASSUME(cw(0,0+3*1) >= cds[0]);
ASSUME(cw(0,0+3*1) >= cctrl[0]);
ASSUME(cw(0,0+3*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+3*1) = 0;
mem(0+3*1,cw(0,0+3*1)) = 0;
co(0+3*1,cw(0,0+3*1))+=1;
delta(0+3*1,cw(0,0+3*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+3*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !126, metadata !DIExpression()), !dbg !155
// call void @llvm.dbg.value(metadata i64 0, metadata !128, metadata !DIExpression()), !dbg !155
// store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !78
// ST: Guess
iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l46_c3
old_cw = cw(0,0+2*1);
cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l46_c3
// Check
ASSUME(active[iw(0,0+2*1)] == 0);
ASSUME(active[cw(0,0+2*1)] == 0);
ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(cw(0,0+2*1) >= iw(0,0+2*1));
ASSUME(cw(0,0+2*1) >= old_cw);
ASSUME(cw(0,0+2*1) >= cr(0,0+2*1));
ASSUME(cw(0,0+2*1) >= cl[0]);
ASSUME(cw(0,0+2*1) >= cisb[0]);
ASSUME(cw(0,0+2*1) >= cdy[0]);
ASSUME(cw(0,0+2*1) >= cdl[0]);
ASSUME(cw(0,0+2*1) >= cds[0]);
ASSUME(cw(0,0+2*1) >= cctrl[0]);
ASSUME(cw(0,0+2*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+2*1) = 0;
mem(0+2*1,cw(0,0+2*1)) = 0;
co(0+2*1,cw(0,0+2*1))+=1;
delta(0+2*1,cw(0,0+2*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+2*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !129, metadata !DIExpression()), !dbg !157
// call void @llvm.dbg.value(metadata i64 0, metadata !131, metadata !DIExpression()), !dbg !157
// store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !80
// ST: Guess
iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l47_c3
old_cw = cw(0,0+1*1);
cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l47_c3
// Check
ASSUME(active[iw(0,0+1*1)] == 0);
ASSUME(active[cw(0,0+1*1)] == 0);
ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(cw(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cw(0,0+1*1) >= old_cw);
ASSUME(cw(0,0+1*1) >= cr(0,0+1*1));
ASSUME(cw(0,0+1*1) >= cl[0]);
ASSUME(cw(0,0+1*1) >= cisb[0]);
ASSUME(cw(0,0+1*1) >= cdy[0]);
ASSUME(cw(0,0+1*1) >= cdl[0]);
ASSUME(cw(0,0+1*1) >= cds[0]);
ASSUME(cw(0,0+1*1) >= cctrl[0]);
ASSUME(cw(0,0+1*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+1*1) = 0;
mem(0+1*1,cw(0,0+1*1)) = 0;
co(0+1*1,cw(0,0+1*1))+=1;
delta(0+1*1,cw(0,0+1*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !132, metadata !DIExpression()), !dbg !159
// call void @llvm.dbg.value(metadata i64 0, metadata !134, metadata !DIExpression()), !dbg !159
// store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !82
// ST: Guess
iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l48_c3
old_cw = cw(0,0);
cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l48_c3
// Check
ASSUME(active[iw(0,0)] == 0);
ASSUME(active[cw(0,0)] == 0);
ASSUME(sforbid(0,cw(0,0))== 0);
ASSUME(iw(0,0) >= 0);
ASSUME(iw(0,0) >= 0);
ASSUME(cw(0,0) >= iw(0,0));
ASSUME(cw(0,0) >= old_cw);
ASSUME(cw(0,0) >= cr(0,0));
ASSUME(cw(0,0) >= cl[0]);
ASSUME(cw(0,0) >= cisb[0]);
ASSUME(cw(0,0) >= cdy[0]);
ASSUME(cw(0,0) >= cdl[0]);
ASSUME(cw(0,0) >= cds[0]);
ASSUME(cw(0,0) >= cctrl[0]);
ASSUME(cw(0,0) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0) = 0;
mem(0,cw(0,0)) = 0;
co(0,cw(0,0))+=1;
delta(0,cw(0,0)) = -1;
ASSUME(creturn[0] >= cw(0,0));
// store i32 0, i32* @atom_1_X2_2, align 4, !dbg !83, !tbaa !84
// ST: Guess
iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l49_c15
old_cw = cw(0,4);
cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l49_c15
// Check
ASSUME(active[iw(0,4)] == 0);
ASSUME(active[cw(0,4)] == 0);
ASSUME(sforbid(4,cw(0,4))== 0);
ASSUME(iw(0,4) >= 0);
ASSUME(iw(0,4) >= 0);
ASSUME(cw(0,4) >= iw(0,4));
ASSUME(cw(0,4) >= old_cw);
ASSUME(cw(0,4) >= cr(0,4));
ASSUME(cw(0,4) >= cl[0]);
ASSUME(cw(0,4) >= cisb[0]);
ASSUME(cw(0,4) >= cdy[0]);
ASSUME(cw(0,4) >= cdl[0]);
ASSUME(cw(0,4) >= cds[0]);
ASSUME(cw(0,4) >= cctrl[0]);
ASSUME(cw(0,4) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,4) = 0;
mem(4,cw(0,4)) = 0;
co(4,cw(0,4))+=1;
delta(4,cw(0,4)) = -1;
ASSUME(creturn[0] >= cw(0,4));
// %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !88
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,0+3));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,0+3));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[1] >= cdy[0]);
// %call7 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !89
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,0+3));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,0+3));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[2] >= cdy[0]);
// %2 = load i64, i64* %thr0, align 8, !dbg !90, !tbaa !91
r10 = local_mem[0];
// %call8 = call i32 @pthread_join(i64 noundef %2, i8** noundef null), !dbg !93
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,0+3));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,0+3));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[1]);
// %3 = load i64, i64* %thr1, align 8, !dbg !94, !tbaa !91
r11 = local_mem[1];
// %call9 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !95
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,0+3));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,0+3));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[2]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !136, metadata !DIExpression()), !dbg !170
// %4 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !97
// LD: Guess
old_cr = cr(0,0);
cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l57_c13
// Check
ASSUME(active[cr(0,0)] == 0);
ASSUME(cr(0,0) >= iw(0,0));
ASSUME(cr(0,0) >= 0);
ASSUME(cr(0,0) >= cdy[0]);
ASSUME(cr(0,0) >= cisb[0]);
ASSUME(cr(0,0) >= cdl[0]);
ASSUME(cr(0,0) >= cl[0]);
// Update
creg_r12 = cr(0,0);
crmax(0,0) = max(crmax(0,0),cr(0,0));
caddr[0] = max(caddr[0],0);
if(cr(0,0) < cw(0,0)) {
r12 = buff(0,0);
ASSUME((!(( (cw(0,0) < 1) && (1 < crmax(0,0)) )))||(sforbid(0,1)> 0));
ASSUME((!(( (cw(0,0) < 2) && (2 < crmax(0,0)) )))||(sforbid(0,2)> 0));
ASSUME((!(( (cw(0,0) < 3) && (3 < crmax(0,0)) )))||(sforbid(0,3)> 0));
ASSUME((!(( (cw(0,0) < 4) && (4 < crmax(0,0)) )))||(sforbid(0,4)> 0));
} else {
if(pw(0,0) != co(0,cr(0,0))) {
ASSUME(cr(0,0) >= old_cr);
}
pw(0,0) = co(0,cr(0,0));
r12 = mem(0,cr(0,0));
}
ASSUME(creturn[0] >= cr(0,0));
// call void @llvm.dbg.value(metadata i64 %4, metadata !138, metadata !DIExpression()), !dbg !170
// %conv = trunc i64 %4 to i32, !dbg !98
// call void @llvm.dbg.value(metadata i32 %conv, metadata !135, metadata !DIExpression()), !dbg !148
// %cmp = icmp eq i32 %conv, 2, !dbg !99
creg__r12__2_ = max(0,creg_r12);
// %conv10 = zext i1 %cmp to i32, !dbg !99
// call void @llvm.dbg.value(metadata i32 %conv10, metadata !139, metadata !DIExpression()), !dbg !148
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !141, metadata !DIExpression()), !dbg !174
// %5 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !101
// LD: Guess
old_cr = cr(0,0+1*1);
cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l59_c13
// Check
ASSUME(active[cr(0,0+1*1)] == 0);
ASSUME(cr(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cr(0,0+1*1) >= 0);
ASSUME(cr(0,0+1*1) >= cdy[0]);
ASSUME(cr(0,0+1*1) >= cisb[0]);
ASSUME(cr(0,0+1*1) >= cdl[0]);
ASSUME(cr(0,0+1*1) >= cl[0]);
// Update
creg_r13 = cr(0,0+1*1);
crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1));
caddr[0] = max(caddr[0],0);
if(cr(0,0+1*1) < cw(0,0+1*1)) {
r13 = buff(0,0+1*1);
ASSUME((!(( (cw(0,0+1*1) < 1) && (1 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(0,0+1*1) < 2) && (2 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(0,0+1*1) < 3) && (3 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(0,0+1*1) < 4) && (4 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) {
ASSUME(cr(0,0+1*1) >= old_cr);
}
pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1));
r13 = mem(0+1*1,cr(0,0+1*1));
}
ASSUME(creturn[0] >= cr(0,0+1*1));
// call void @llvm.dbg.value(metadata i64 %5, metadata !143, metadata !DIExpression()), !dbg !174
// %conv14 = trunc i64 %5 to i32, !dbg !102
// call void @llvm.dbg.value(metadata i32 %conv14, metadata !140, metadata !DIExpression()), !dbg !148
// %cmp15 = icmp eq i32 %conv14, 2, !dbg !103
creg__r13__2_ = max(0,creg_r13);
// %conv16 = zext i1 %cmp15 to i32, !dbg !103
// call void @llvm.dbg.value(metadata i32 %conv16, metadata !144, metadata !DIExpression()), !dbg !148
// %6 = load i32, i32* @atom_1_X2_2, align 4, !dbg !104, !tbaa !84
// LD: Guess
old_cr = cr(0,4);
cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l61_c13
// Check
ASSUME(active[cr(0,4)] == 0);
ASSUME(cr(0,4) >= iw(0,4));
ASSUME(cr(0,4) >= 0);
ASSUME(cr(0,4) >= cdy[0]);
ASSUME(cr(0,4) >= cisb[0]);
ASSUME(cr(0,4) >= cdl[0]);
ASSUME(cr(0,4) >= cl[0]);
// Update
creg_r14 = cr(0,4);
crmax(0,4) = max(crmax(0,4),cr(0,4));
caddr[0] = max(caddr[0],0);
if(cr(0,4) < cw(0,4)) {
r14 = buff(0,4);
ASSUME((!(( (cw(0,4) < 1) && (1 < crmax(0,4)) )))||(sforbid(4,1)> 0));
ASSUME((!(( (cw(0,4) < 2) && (2 < crmax(0,4)) )))||(sforbid(4,2)> 0));
ASSUME((!(( (cw(0,4) < 3) && (3 < crmax(0,4)) )))||(sforbid(4,3)> 0));
ASSUME((!(( (cw(0,4) < 4) && (4 < crmax(0,4)) )))||(sforbid(4,4)> 0));
} else {
if(pw(0,4) != co(4,cr(0,4))) {
ASSUME(cr(0,4) >= old_cr);
}
pw(0,4) = co(4,cr(0,4));
r14 = mem(4,cr(0,4));
}
ASSUME(creturn[0] >= cr(0,4));
// call void @llvm.dbg.value(metadata i32 %6, metadata !145, metadata !DIExpression()), !dbg !148
// %and = and i32 %conv16, %6, !dbg !105
creg_r15 = max(creg__r13__2_,creg_r14);
r15 = (r13==2) & r14;
// call void @llvm.dbg.value(metadata i32 %and, metadata !146, metadata !DIExpression()), !dbg !148
// %and17 = and i32 %conv10, %and, !dbg !106
creg_r16 = max(creg__r12__2_,creg_r15);
r16 = (r12==2) & r15;
// call void @llvm.dbg.value(metadata i32 %and17, metadata !147, metadata !DIExpression()), !dbg !148
// %cmp18 = icmp eq i32 %and17, 1, !dbg !107
creg__r16__1_ = max(0,creg_r16);
// br i1 %cmp18, label %if.then, label %if.end, !dbg !109
old_cctrl = cctrl[0];
cctrl[0] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[0] >= old_cctrl);
ASSUME(cctrl[0] >= creg__r16__1_);
if((r16==1)) {
goto T0BLOCK1;
} else {
goto T0BLOCK2;
}
T0BLOCK1:
// call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i32 noundef 64, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !110
// unreachable, !dbg !110
r17 = 1;
goto T0BLOCK_END;
T0BLOCK2:
// %7 = bitcast i64* %thr1 to i8*, !dbg !113
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %7) #7, !dbg !113
// %8 = bitcast i64* %thr0 to i8*, !dbg !113
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %8) #7, !dbg !113
// ret i32 0, !dbg !114
ret_thread_0 = 0;
goto T0BLOCK_END;
T0BLOCK_END:
ASSUME(meminit(0,1) == mem(0,0));
ASSUME(coinit(0,1) == co(0,0));
ASSUME(deltainit(0,1) == delta(0,0));
ASSUME(meminit(0,2) == mem(0,1));
ASSUME(coinit(0,2) == co(0,1));
ASSUME(deltainit(0,2) == delta(0,1));
ASSUME(meminit(0,3) == mem(0,2));
ASSUME(coinit(0,3) == co(0,2));
ASSUME(deltainit(0,3) == delta(0,2));
ASSUME(meminit(0,4) == mem(0,3));
ASSUME(coinit(0,4) == co(0,3));
ASSUME(deltainit(0,4) == delta(0,3));
ASSUME(meminit(1,1) == mem(1,0));
ASSUME(coinit(1,1) == co(1,0));
ASSUME(deltainit(1,1) == delta(1,0));
ASSUME(meminit(1,2) == mem(1,1));
ASSUME(coinit(1,2) == co(1,1));
ASSUME(deltainit(1,2) == delta(1,1));
ASSUME(meminit(1,3) == mem(1,2));
ASSUME(coinit(1,3) == co(1,2));
ASSUME(deltainit(1,3) == delta(1,2));
ASSUME(meminit(1,4) == mem(1,3));
ASSUME(coinit(1,4) == co(1,3));
ASSUME(deltainit(1,4) == delta(1,3));
ASSUME(meminit(2,1) == mem(2,0));
ASSUME(coinit(2,1) == co(2,0));
ASSUME(deltainit(2,1) == delta(2,0));
ASSUME(meminit(2,2) == mem(2,1));
ASSUME(coinit(2,2) == co(2,1));
ASSUME(deltainit(2,2) == delta(2,1));
ASSUME(meminit(2,3) == mem(2,2));
ASSUME(coinit(2,3) == co(2,2));
ASSUME(deltainit(2,3) == delta(2,2));
ASSUME(meminit(2,4) == mem(2,3));
ASSUME(coinit(2,4) == co(2,3));
ASSUME(deltainit(2,4) == delta(2,3));
ASSUME(meminit(3,1) == mem(3,0));
ASSUME(coinit(3,1) == co(3,0));
ASSUME(deltainit(3,1) == delta(3,0));
ASSUME(meminit(3,2) == mem(3,1));
ASSUME(coinit(3,2) == co(3,1));
ASSUME(deltainit(3,2) == delta(3,1));
ASSUME(meminit(3,3) == mem(3,2));
ASSUME(coinit(3,3) == co(3,2));
ASSUME(deltainit(3,3) == delta(3,2));
ASSUME(meminit(3,4) == mem(3,3));
ASSUME(coinit(3,4) == co(3,3));
ASSUME(deltainit(3,4) == delta(3,3));
ASSUME(meminit(4,1) == mem(4,0));
ASSUME(coinit(4,1) == co(4,0));
ASSUME(deltainit(4,1) == delta(4,0));
ASSUME(meminit(4,2) == mem(4,1));
ASSUME(coinit(4,2) == co(4,1));
ASSUME(deltainit(4,2) == delta(4,1));
ASSUME(meminit(4,3) == mem(4,2));
ASSUME(coinit(4,3) == co(4,2));
ASSUME(deltainit(4,3) == delta(4,2));
ASSUME(meminit(4,4) == mem(4,3));
ASSUME(coinit(4,4) == co(4,3));
ASSUME(deltainit(4,4) == delta(4,3));
ASSERT(r17== 0);
}
| [
"[email protected]"
] | |
ffe4ea8bcc5f0b59dffba9ccafebd729e5d169d7 | 83a182df1c412bb85873bf041b0eebeceee8eaaf | /Problem Solving/Algorithms/Bon Appétit.cpp | 1934fed345a0256ff59a459b5d48b81902ce067e | [] | no_license | ankurgupta255/HackerRank-Solutions | 958898777c8366728f85bf08423d8bece6d30965 | 91d50a84f32308ecddfd91022c20f51cf3995b78 | refs/heads/master | 2020-04-16T13:57:28.905862 | 2019-05-21T15:11:13 | 2019-05-21T15:11:13 | 165,649,297 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 364 | cpp | #include<iostream>
using namespace std;
int main(){
int n=0;
int k=0;
int bill[100000];
int anna=0;
int i=0;
int sum=0;
cin>>n;
cin>>k;
for(i=0;i<n;i++){
cin>>bill[i];
}
cin>>anna;
for(i=0;i<n;i++){
sum+=bill[i];
}
sum/=2;
sum=sum-(bill[k]/2);
if(anna==sum){
cout<<"Bon Appetit";
}
else{
cout<<anna-sum;
}
}
| [
"[email protected]"
] | |
77dc6b8c08a1746693ed2a98f8d37f814259671a | bbd41d19ae73fdedb09e351207df81b614cf9f93 | /Tarea 10/7840.cpp | 88ee72bce4124e8b3e5b8ec65915238f3c22967b | [] | no_license | Rome1317/Programacion-Basica | c5ad2b30fb070acd16b9011c23d4e80428af9076 | 3d7fb3d12333391bb530726ff7ff06edda940d8a | refs/heads/master | 2020-03-26T10:17:15.595516 | 2018-11-16T17:24:33 | 2018-11-16T17:24:33 | 144,790,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | cpp | #include <iostream>
using namespace std;
int b;
int a;
int main() {
cout << "Base: ";
cin >> b;
cout << "Altura: ";
cin >> a;
cout << endl;
for (int i = 0; i < a; i++) {
for (int j = 0; j < b; j++) {
if ((i == 0) || (j == 0) || (i == a - 1) || (j == b - 1)) {
cout << "* " ;
}
else {
cout << " ";
}
}
cout << endl;
}
system("pause > nul");
return 0;
}
| [
"[email protected]"
] | |
48292821673d1ce0fbd5355a1777507182644558 | 3c829f3fdb2567b1b9ad15526bf40013ab645557 | /old/jan17/reservior.cpp | f259aa279852cfe16495430af52408db81c4c630 | [] | no_license | hrushikesht/CompetitiveProgramming | 47f68154485dd9e81bff78347537a543f4f5fae7 | 9c7ef76bbafbdc013965ce5fd630107e4923ac15 | refs/heads/master | 2021-01-22T19:48:24.478396 | 2017-04-20T13:33:20 | 2017-04-20T13:33:20 | 85,237,833 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,128 | cpp | #include <bits/stdc++.h>
#include <unordered_map>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define i64 long long int
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void setBit(int & n, int b) { n |= two(b); }
inline void unsetBit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool sortDown(int x,int y){return x>y;}
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
using namespace std;
/////////////////////////////////////////////////////////////////////
string s[1010];
int main()
{
std::ios::sync_with_stdio(false);
int t; cin>>t;
while(t--)
{
int n,m; cin>>n>>m;
bool flag=true;
FOR(i,1,n)
{
cin>>s[i];
}
FOR(i,0,m-1)
{
if(s[n][i]=='W')
{
cout<<"no"<<endl;
flag=false;
break;
}
}
FOR(i,1,n)
{
if(flag)
{
if(s[i][0]=='W' or s[i][m-1]=='W')
{
cout<<"no"<<endl;
flag=false;
break;
}
FOR(j,0,m-1)
{
if(j!=m-1)
{
// char x[2]={s[i][j] + s[i][j+1]};
char curr=s[i][j],right=s[i][j+1];
if((curr=='W' and right=='A') or (curr=='A' and right=='W'))
{
cout<<"no"<<endl;
flag=false;
break;
}
}
char curr=s[i][j],down;
if(i!=n) down=s[i+1][j];
// DEBUG(curr);
// DEBUG(down);
// DEBUG(t);
// DEBUG(i);
// DEBUG(j);
if(i!=n)
{
if((curr=='B' and (down=='A' or down=='W')) or (curr=='W' and down=='A'))
{
cout<<"no"<<endl;
flag=false;
break;
}
}
}
}
}
if(flag)
{
cout<<"yes"<<endl;
}
}
} | [
"[email protected]"
] | |
d9788f61909b38a34b18d5a360c6ed32eac32b49 | 91719805a27882be3acd432904dcb4ba8c4d971f | /src/webgroup/WebSlideGroup.h | 2bd18aaeab026f25e17bffb935948f95c7c406be | [] | no_license | svn2github/divz | 1af8366135434ea82f4c1a0aa9ca5d6f7e75c11a | 3c937a3dbccee49ee5cba9aae22f8f9a5e4356da | refs/heads/master | 2020-05-29T12:51:48.333902 | 2013-04-21T23:00:02 | 2013-04-21T23:00:02 | 25,669,105 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,195 | h | #ifndef WebSlideGroup_H
#define WebSlideGroup_H
#include "model/SlideGroup.h"
class NativeViewerWebKit;
#include <QHash>
#include <QPixmap>
#include <QUrl>
/// \brief: VideolideGroup represents a Video file in DViz.
class WebSlideGroup : public SlideGroup
{
private:
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl);
public:
WebSlideGroup();
typedef enum { GroupType = 6 };
int groupType() const { return GroupType; }
QUrl url() { return m_url; }
void setUrl(const QUrl &);
QString cacheFile();
// SlideGroup::
virtual bool fromXml(QDomElement & parentElement);
virtual void toXml(QDomElement & parentElement) const;
void changeBackground(AbstractVisualItem::FillType, QVariant, Slide *);
NativeViewerWebKit * nativeViewer() { return m_native; }
void setNativeViewer(NativeViewerWebKit*);
protected:
void createSnapshot();
void removeAllSlides();
// SlideGroup::
void fromVariantMap(QVariantMap &);
void toVariantMap(QVariantMap &) const;
protected slots:
void aspectRatioChanged(double x);
private:
QUrl m_url;
int m_mtime;
QHash<int,QPixmap> m_slidePixmapCache;
NativeViewerWebKit * m_native;
};
Q_DECLARE_METATYPE(WebSlideGroup*);
#endif
| [
"josiahbryan@5ee4d49e-9b41-11de-8595-bbd473b9459f"
] | josiahbryan@5ee4d49e-9b41-11de-8595-bbd473b9459f |
9562cda148743cd26c3a72347e63ed8435c873a0 | 30f82e51074087bef157d2e2a878123f3b3c2040 | /Assignment5/Strings-MaxFrequencyCharacter.cpp | 5610c5c0de9df172c8a7bb2cd9599f1463425223 | [] | no_license | mayank712jindal/cb_PA_assignments | 8746c8a95f19b1fd80e1b77e6fcbb29fafe57163 | 9fce7e71f6275e2f9010d5093983b0fec6dab400 | refs/heads/main | 2023-07-09T04:08:47.014310 | 2021-08-16T07:49:04 | 2021-08-16T07:49:04 | 391,706,629 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 606 | cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
cin >> str;
int count = 0, max = -1;
char ch, temp;
for (int i = 0; i < str.length(); i++)
{
if (str[i] == '.')
continue;
temp = str[i];
count = 1;
for (int j = 0; j < str.length(); j++)
{
if (temp == str[j])
{
count++;
str[j] = '.';
}
}
if (count > max)
{
max = count;
ch = temp;
}
}
cout << ch;
return 0;
} | [
"[email protected]"
] | |
8dd034189c74e87673930907a567b8674dc06c3f | ec68c973b7cd3821dd70ed6787497a0f808e18e1 | /Cpp/SDK/Mod_HuntersMark_Action_classes.h | e3bef346897f5cccd2be857289ab54c2709909c8 | [] | no_license | Hengle/zRemnant-SDK | 05be5801567a8cf67e8b03c50010f590d4e2599d | be2d99fb54f44a09ca52abc5f898e665964a24cb | refs/heads/main | 2023-07-16T04:44:43.113226 | 2021-08-27T14:26:40 | 2021-08-27T14:26:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 739 | h | #pragma once
// Name: Remnant, Version: 1.0
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass Mod_HuntersMark_Action.Mod_HuntersMark_Action_C
// 0x0000
class UMod_HuntersMark_Action_C : public UAction_Buff_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass Mod_HuntersMark_Action.Mod_HuntersMark_Action_C");
return ptr;
}
void FilterIncomingDamage();
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"[email protected]"
] | |
70f76c7afc54c4952c482c8688a9579e85826497 | aa9c1ae0b1a377712a3864feda236be2d9583cd8 | /file_manager.cpp | bccc1cd6ac91c46e923ecccb6753ca6023296805 | [] | no_license | hatifsattar/bit-torrent | b1f4bf06e9c27c2689397c5b1a1cea259566d634 | 40cba15d3972b96103f99d4932918faa20110192 | refs/heads/master | 2020-12-29T00:25:56.058247 | 2016-03-13T18:19:37 | 2016-03-13T18:19:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,232 | cpp | /*
* BIT-TORRENT PROJECT - ECE1747H (PARALLEL PROGRAMMING)
* ZOHAIB ALAM (997093318)
* HATIF SATTAR (997063387)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <iostream>
#include <assert.h>
#include "file_manager.h"
using namespace std;
FileManager::FileManager()
{
//constructor
cacheFilesList();
}
FileManager::~FileManager()
{
//destroy all mutex
pthread_mutex_destroy (&fileMutex);
for (int i = 0; i < mNumFiles; i++){
pthread_mutex_destroy (&mFileInfo[i].fMutex);
if (mFileInfo[i].fp != NULL) {
fclose(mFileInfo[i].fp);
}
}
//destructor
if (mFileInfo != NULL){
free (mFileInfo);
}
}
bool FileManager::cacheFilesList()
{
bool success = false;
//check if files_list.txt exists
//Read info file
ifstream file (FILES_INFO_PATH);
if (!file.good()) {
printf ("[FileManager] file %s doesnt exist - Num of Files "
"= 0.\nCreating file... \n", FILES_INFO_PATH);
ofstream outfile (FILES_INFO_PATH);
mNumFiles = 0;
success = true;
}
else {
string str;
if (getline (file, str)){
mNumFiles = atoi(str.c_str());
printf ("[FileManager] Num of files:%d\n", mNumFiles);
}
//allocate memory based on # of Files
mFileInfo = (FileInfo*)calloc(mNumFiles, sizeof (FileInfo));
//Parse the rest of the file and store file names to mFileInfo
int i = 0;
string::size_type pos = 0;
string::size_type l_pos =0;
char tmp[20];
while (getline(file, str)) {
assert (i < mNumFiles);
pos = str.find_first_of(',', l_pos);
strncpy(tmp, str.c_str(), pos);
tmp[pos] = '\0';
//Initialize mutex
pthread_mutex_init( &mFileInfo[i].fMutex, NULL);
//Store file ID
mFileInfo[i].fileId = atoi(tmp);
printf("[FileManager] File Id:%d,", mFileInfo[i].fileId);
strncpy(tmp, str.c_str()+pos+1, str.length()-pos-1);
tmp[str.length()-pos-1] = '\0';
//Store file Name
strncpy(mFileInfo[i].fileName, str.c_str()+pos+1, str.length()-pos-1);
mFileInfo[i].fileName[str.length()-pos-1] = '\0';
printf(" Name:%s,", mFileInfo[i].fileName);
//File is complete
mFileInfo[i].complete = true;
//Open file and determine # of chunks
FILE *infile;
infile = fopen(mFileInfo[i].fileName, "r");
if (infile == NULL){
printf ("\n\n[FileManager] ERROR Could not open file %s.\n\n",
mFileInfo[i].fileName);
continue;
}
fseek(infile, 0, SEEK_END);
int file_size = ftell(infile);
printf(" Size:%d,", file_size);
mFileInfo[i].file_size = file_size;
mFileInfo[i].fp = NULL;
mFileInfo[i].totChunksPerFile = (file_size / CHUNK_SIZE) +
(((file_size % CHUNK_SIZE) == 0) ? 0 : 1);
printf(" Num. Chunks:%d\n", mFileInfo[i].totChunksPerFile);
//Since file is complete total existing chunks equal total chunks per file
mFileInfo[i].totChunksExisting = mFileInfo[i].totChunksPerFile;
fclose(infile);
i++;
}
file.close();
success = true;
}
return success;
}
bool FileManager::fileExists(int fileId)
{
int i = 0;
int local_mNumFiles;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
while (i < local_mNumFiles){
pthread_mutex_lock( &mFileInfo[i].fMutex );
if (fileId == mFileInfo[i].fileId){
pthread_mutex_unlock( &mFileInfo[i].fMutex );
printf("[FileManager] File Id %d exists!\n", fileId);
return true;
}
pthread_mutex_unlock( &mFileInfo[i].fMutex );
i++;
}
printf("[FileManager::%s] File Id %d does NOT exist\n",__func__, fileId);
return false;
}
// overload
int FileManager::fileExists(char* fileName)
{
int i = 0;
//check strlen of both strings
int local_mNumFiles;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
while (i < local_mNumFiles) {
pthread_mutex_lock( &mFileInfo[i].fMutex );
if ( strcmp(fileName, mFileInfo[i].fileName) == 0 ) {
pthread_mutex_unlock( &mFileInfo[i].fMutex );
printf("[FileManager] File %s exists!\n", fileName);
return i;
}
pthread_mutex_unlock( &mFileInfo[i].fMutex );
i++;
}
printf("[FileManager::%s] File %s does NOT exist\n",__func__ ,fileName);
return -1;
}
bool FileManager::addFileToDisk(int idx)
{
FileInfo* file = &mFileInfo[idx];
//set complete to true
pthread_mutex_lock( &file->fMutex );
file->complete = true;
pthread_mutex_unlock( &file->fMutex );
pthread_mutex_lock( &fileMutex );
FILE* fp = fopen(FILES_INFO_PATH, "r+");
char tmp[30];
sprintf(tmp, "%d", mNumFiles);
fwrite(tmp, sizeof(char), strlen(tmp), fp); // write
fseek(fp, 0, SEEK_END);
sprintf(tmp, "%d,%s", file->fileId, file->fileName);
fwrite(tmp, sizeof(char), strlen(tmp), fp); // write
pthread_mutex_unlock( &fileMutex );
return true;
}
int FileManager::addFileToCache(char* file_name, int file_size)
{
int _nFiles = 0;
pthread_mutex_lock( &fileMutex );
FileInfo* tmp = (FileInfo*)calloc((mNumFiles+1), sizeof (FileInfo));
FileInfo* tmp2 = &mFileInfo[0];
cout << "[FileManager] Size of Cache = " <<
(sizeof(FileInfo)*mNumFiles) << " Num files = " << mNumFiles << endl;
memcpy (tmp, mFileInfo, sizeof(FileInfo)*mNumFiles);
tmp[mNumFiles].fileId = mNumFiles;
strncpy (tmp[mNumFiles].fileName, file_name, strlen(file_name));
tmp[mNumFiles].complete = false;
tmp[mNumFiles].file_size = file_size;
pthread_mutex_init( &tmp[mNumFiles].fMutex, NULL);
FILE* fp = fopen(file_name, "w");
fclose(fp);
mNumFiles++;
_nFiles = mNumFiles;
free(mFileInfo);
mFileInfo = NULL;
mFileInfo = &tmp[0];
pthread_mutex_unlock( &fileMutex );
return (_nFiles-1);
}
bool FileManager::fileWrite(int idx, int start, int size, void* buf) {
int local_mNumFiles;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
if (idx >= local_mNumFiles) {
printf ("[FileManager::%s] ERROR index %d is invalid. "
"Total Num. of files = %d",__func__, idx, local_mNumFiles);
return false;
}
else{
pthread_mutex_lock( &mFileInfo[idx].fMutex );
//If file ptr is NULL open the file
if (mFileInfo[idx].fp == NULL){
mFileInfo[idx].fp = fopen(mFileInfo[idx].fileName, "r+");
}
fseek(mFileInfo[idx].fp, start, SEEK_SET); // seek to 'start'
fwrite(buf, sizeof(char), size, mFileInfo[idx].fp); // write
fseek(mFileInfo[idx].fp, 0, SEEK_SET); // seek back to beginning
pthread_mutex_unlock( &mFileInfo[idx].fMutex );
return true;
}
}
bool FileManager::fileRead(int idx, int start, int size, void* buf) {
int local_mNumFiles;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
if (idx >= local_mNumFiles) {
printf ("[FileManager::%s] ERROR index %d is invalid."
"Total Num. of files = %d",__func__, idx, local_mNumFiles);
return false;
}
else{
pthread_mutex_lock( &mFileInfo[idx].fMutex );
//If file ptr is NULL open the file
if (mFileInfo[idx].fp == NULL){
mFileInfo[idx].fp = fopen(mFileInfo[idx].fileName, "r+");
}
fseek(mFileInfo[idx].fp, start, SEEK_SET); // seek to 'start'
fread(buf, sizeof(char), size, mFileInfo[idx].fp); // read
fseek(mFileInfo[idx].fp, 0, SEEK_SET); // seek back to beginning
pthread_mutex_unlock( &mFileInfo[idx].fMutex );
return true;
}
}
// updates and returns next..
int FileManager::updateChunks(int idx){
int local_mNumFiles;
int nextIdx = -1;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
if (idx >= local_mNumFiles) {
printf ("[FileManager::%s] ERROR index %d is invalid. "
"Total Num. of files = %d",__func__, idx, local_mNumFiles);
return -1;
}
else{
pthread_mutex_lock( &mFileInfo[idx].fMutex );
nextIdx = mFileInfo[idx].totChunksExisting;
mFileInfo[idx].totChunksExisting += 1;
pthread_mutex_unlock( &mFileInfo[idx].fMutex );
return nextIdx;
}
}
void FileManager::printFilesList()
{
pthread_mutex_lock( &fileMutex );
if (mNumFiles == 0){
printf("[FileManager] There are no existing files for the Peer!\n");
}
else {
printf("[FileManager] Printing list of existing files for the Peer:\n");
for (int i = 0; i < mNumFiles; i++){
printf("File Id = %d, Name = %s\n", mFileInfo[i].fileId,mFileInfo[i].fileName);
}
printf("\n\n");
}
pthread_mutex_unlock( &fileMutex );
}
int FileManager::getFileSize(int fileId)
{
int local_mNumFiles;
int _fileSize = 0;
pthread_mutex_lock( &fileMutex );
local_mNumFiles = mNumFiles;
pthread_mutex_unlock( &fileMutex );
if (fileId >= local_mNumFiles) {
printf ("[FileManager::%s] ERROR index %d is invalid."
"Total Num. of files = %d",__func__, fileId, local_mNumFiles);
return -1;
}
else{
pthread_mutex_lock( &mFileInfo[fileId].fMutex );
_fileSize = mFileInfo[fileId].file_size;
pthread_mutex_unlock( &mFileInfo[fileId].fMutex );
return _fileSize;
}
}
| [
"[email protected]"
] | |
3d4f8adc69e646969cf12fff6d615c92f0a77657 | 6c5c042afb12030979ff8f5831a15fbf9c0cff63 | /FireDetection/FireDetection/GUI.cpp | a26ddcb56ec7e8de61a0585b1208ad771c79ced8 | [] | no_license | mchudz97/OpenCV-Fire-Detection | 5c029e43c02699e840e35b494cf9fbe8925cf350 | da2d5ad7962122c9ee734ca25acb99d2d20ac383 | refs/heads/master | 2022-11-13T10:59:56.246684 | 2020-06-24T07:43:08 | 2020-06-24T07:43:08 | 272,925,372 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,536 | cpp | #include "Gui.h"
using namespace cvui;
Gui::Gui(String winName) {
this->queue = { "1.mp4", "2.mp4", "3.mp4", "4.mp4", "5.mp4" };
this->winName = winName;
this->vidChoice = 0;
this->withSmoke = false;
this->area = 0.0f;
this->grayMin = 50.0f;
this->grayMax = 220.0f;
this->history = 10;
this->mixtures = 10;
this->smokeError = 5.0f;
init(winName);
}
void Gui::show() {
settingsWindow = Mat(620, 300, CV_8UC3);
settingsWindow = Scalar(49, 52, 49);
text(settingsWindow, 60, 20, "Currently playing: " + queue[vidChoice]);
if (button(settingsWindow, 100, 40, "Play Next")) {
vidChoice++;
vidChoice = vidChoice % queue.size();
}
checkbox(settingsWindow, 40, 100, "With smoke", &withSmoke);
text(settingsWindow, 40, 140, "Min area:");
text(settingsWindow, 40, 220, "History:");
text(settingsWindow, 40, 300, "Mixtures:");
text(settingsWindow, 40, 380, "Smoke error:");
text(settingsWindow, 40, 460, "Smoke gray min:");
text(settingsWindow, 40, 540, "Smoke gray max:");
trackbar(settingsWindow, 40, 160, 220, &area, 0.0f, 200.0f);
trackbar(settingsWindow, 40, 240, 220, &history, 1, 100);
trackbar(settingsWindow, 40, 320, 220, &mixtures, 1, 100);
trackbar(settingsWindow, 40, 400, 220, &smokeError, 0.0f, 25.0f);
trackbar(settingsWindow, 40, 480, 220, &grayMin, 0.0f, grayMax);
trackbar(settingsWindow, 40, 560, 220, &grayMax, grayMin, 255.0f);
cvui::imshow(this->winName, settingsWindow);
}
| [
"[email protected]"
] | |
c6633385fdedbe437634e73f2fead4c998a57feb | 30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a | /scrape/data/Tokitsukaze and Discard Items/woodline23xx_TLE.cpp | 7f21105de78f9cde4697c64f3c95cb884f423e13 | [] | no_license | thegamer1907/Code_Analysis | 0a2bb97a9fb5faf01d983c223d9715eb419b7519 | 48079e399321b585efc8a2c6a84c25e2e7a22a61 | refs/heads/master | 2020-05-27T01:20:55.921937 | 2019-11-20T11:15:11 | 2019-11-20T11:15:11 | 188,403,594 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 714 | cpp | #include <bits/stdc++.h>
#define Int int64_t
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
Int N, M, K;
cin >> N >> M >> K;
vector<Int> p(M);
for (int i = 0; i < M; ++i) { cin >> p[i]; }
p.push_back(1e10);
int res = 0;
int L = 1, R = K;
while (L <= p[M-1]) {
int l = lower_bound(p.begin(), p.end(), L) - p.begin();
int r = upper_bound(p.begin(), p.end(), R) - p.begin();
if (l == r) {
while (true) {
if (L <= p[r] && p[r] <= R) {
break;
} else {
L = R + 1;
R = L + K - 1;
}
}
continue;
}
++res;
int cnt = r - l;
L = R + 1;
R = L + cnt - 1;
}
cout << res << endl;
return 0;
} | [
"[email protected]"
] | |
acbf3ebbb76bff085c027e2357309689c27b69a2 | 341f268cd7061eae5de77c1a6de0736ac6d94206 | /C++/统计出现最多次的字母.cpp | 7067ec69f981895710cb14b8a518af4aa70d81b8 | [] | no_license | jianjiachenghub/CLanguageProgramming | d25467a1fc48cdbe9a0a053fe3091e86dc9c9205 | 415b13bfa0888b2c61b36d68a407b39cde3ab662 | refs/heads/master | 2020-08-07T22:56:23.793406 | 2019-10-08T11:00:54 | 2019-10-08T11:00:54 | 213,611,543 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 250 | cpp | #include<stdio.h>
int main()
{
int ch[26]={0},n,max=0;
char cs;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%c",&cs);
ch[cs-'a']++;
}
for(int i=1;i<n;i++)
{
if(ch[i]>ch[max])
{
max=i;
}
}
printf("%c\n",max+'a');
return 0;
}
| [
"[email protected]"
] | |
006cf3922445a4b1b2d7a4a23fea182c49c211ad | 99b00127443a4dcfebc209cff0a37e8ef8d84573 | /third_party/mlir/lib/Pass/PassDetail.h | aa60cfb23ea73456d51ddad0753e5aa25d14c4b8 | [
"Apache-2.0"
] | permissive | mgyong/tensorflow | 732097f0712a457b708bf49f4bf17c1ba81a1f40 | 7d4060879a15bcfa806eef4152e0b905239e783c | refs/heads/master | 2020-07-15T01:14:04.347011 | 2019-08-30T18:27:17 | 2019-08-30T18:48:45 | 205,443,511 | 1 | 0 | Apache-2.0 | 2019-08-30T19:18:44 | 2019-08-30T19:18:44 | null | UTF-8 | C++ | false | false | 6,023 | h | //===- PassDetail.h - MLIR Pass details -------------------------*- C++ -*-===//
//
// Copyright 2019 The MLIR 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.
// =============================================================================
#ifndef MLIR_PASS_PASSDETAIL_H_
#define MLIR_PASS_PASSDETAIL_H_
#include "mlir/Pass/Pass.h"
namespace mlir {
namespace detail {
//===----------------------------------------------------------------------===//
// Verifier Passes
//===----------------------------------------------------------------------===//
/// Pass to verify a function and signal failure if necessary.
class FunctionVerifierPass : public FunctionPass<FunctionVerifierPass> {
void runOnFunction() override;
};
/// Pass to verify a module and signal failure if necessary.
class ModuleVerifierPass : public ModulePass<ModuleVerifierPass> {
void runOnModule() override;
};
//===----------------------------------------------------------------------===//
// PassExecutor
//===----------------------------------------------------------------------===//
/// The abstract base pass executor class.
class PassExecutor {
public:
enum Kind { FunctionExecutor, ModuleExecutor };
explicit PassExecutor(Kind kind) : kind(kind) {}
/// Get the kind of this executor.
Kind getKind() const { return kind; }
private:
/// The kind of executor this object is.
Kind kind;
};
/// A pass executor that contains a list of passes over a function.
class FunctionPassExecutor : public PassExecutor {
public:
FunctionPassExecutor() : PassExecutor(Kind::FunctionExecutor) {}
FunctionPassExecutor(FunctionPassExecutor &&) = default;
FunctionPassExecutor(const FunctionPassExecutor &rhs);
/// Run the executor on the given function.
LogicalResult run(FuncOp function, AnalysisManager am);
/// Add a pass to the current executor. This takes ownership over the provided
/// pass pointer.
void addPass(std::unique_ptr<FunctionPassBase> pass) {
passes.push_back(std::move(pass));
}
/// Returns the number of passes held by this executor.
size_t size() const { return passes.size(); }
static bool classof(const PassExecutor *pe) {
return pe->getKind() == Kind::FunctionExecutor;
}
private:
std::vector<std::unique_ptr<FunctionPassBase>> passes;
};
/// A pass executor that contains a list of passes over a module unit.
class ModulePassExecutor : public PassExecutor {
public:
ModulePassExecutor() : PassExecutor(Kind::ModuleExecutor) {}
ModulePassExecutor(ModulePassExecutor &&) = default;
// Don't allow copying.
ModulePassExecutor(const ModulePassExecutor &) = delete;
ModulePassExecutor &operator=(const ModulePassExecutor &) = delete;
/// Run the executor on the given module.
LogicalResult run(ModuleOp module, AnalysisManager am);
/// Add a pass to the current executor. This takes ownership over the provided
/// pass pointer.
void addPass(std::unique_ptr<ModulePassBase> pass) {
passes.push_back(std::move(pass));
}
static bool classof(const PassExecutor *pe) {
return pe->getKind() == Kind::ModuleExecutor;
}
private:
/// Set of passes to run on the given module.
std::vector<std::unique_ptr<ModulePassBase>> passes;
};
//===----------------------------------------------------------------------===//
// ModuleToFunctionPassAdaptor
//===----------------------------------------------------------------------===//
/// An adaptor module pass used to run function passes over all of the
/// non-external functions of a module synchronously on a single thread.
class ModuleToFunctionPassAdaptor
: public ModulePass<ModuleToFunctionPassAdaptor> {
public:
/// Run the held function pipeline over all non-external functions within the
/// module.
void runOnModule() override;
/// Returns the function pass executor for this adaptor.
FunctionPassExecutor &getFunctionExecutor() { return fpe; }
private:
FunctionPassExecutor fpe;
};
/// An adaptor module pass used to run function passes over all of the
/// non-external functions of a module asynchronously across multiple threads.
class ModuleToFunctionPassAdaptorParallel
: public ModulePass<ModuleToFunctionPassAdaptorParallel> {
public:
/// Run the held function pipeline over all non-external functions within the
/// module.
void runOnModule() override;
/// Returns the function pass executor for this adaptor.
FunctionPassExecutor &getFunctionExecutor() { return fpe; }
private:
// The main function pass executor for this adaptor.
FunctionPassExecutor fpe;
// A set of executors, cloned from the main executor, that run asynchronously
// on different threads.
std::vector<FunctionPassExecutor> asyncExecutors;
};
/// Utility function to return if a pass refers to an
/// ModuleToFunctionPassAdaptor instance.
inline bool isModuleToFunctionAdaptorPass(Pass *pass) {
return isa<ModuleToFunctionPassAdaptorParallel>(pass) ||
isa<ModuleToFunctionPassAdaptor>(pass);
}
/// Utility function to return if a pass refers to an adaptor pass. Adaptor
/// passes are those that internally execute a pipeline, such as the
/// ModuleToFunctionPassAdaptor.
inline bool isAdaptorPass(Pass *pass) {
return isModuleToFunctionAdaptorPass(pass);
}
/// Utility function to return if a pass refers to a verifier pass.
inline bool isVerifierPass(Pass *pass) {
return isa<FunctionVerifierPass>(pass) || isa<ModuleVerifierPass>(pass);
}
} // end namespace detail
} // end namespace mlir
#endif // MLIR_PASS_PASSDETAIL_H_
| [
"[email protected]"
] | |
bc7e705ecc57c721cc836615bac78d7f72cd5ad3 | a8531269704a2e0002471a5b497a82e34a7069da | /src/masternodeconfig.cpp | b91d8016f9e9ba07db9932e4d8f6594a8a68c68e | [
"MIT"
] | permissive | blockchaindevelopers/AXEL-Utility-Token | 7ff96b7be4d0ae20416486a4534c5ef7f812a605 | f9b82c073c9b8a675eef0a2729f6fb0dfee69078 | refs/heads/master | 2020-06-09T05:43:01.893141 | 2019-06-23T18:44:34 | 2019-06-23T18:44:34 | 193,383,343 | 0 | 0 | MIT | 2019-06-23T18:41:04 | 2019-06-23T18:41:04 | null | UTF-8 | C++ | false | false | 4,005 | cpp | // Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// clang-format off
#include "net.h"
#include "masternodeconfig.h"
#include "util.h"
#include "ui_interface.h"
#include <base58.h>
// clang-format on
CMasternodeConfig masternodeConfig;
void CMasternodeConfig::add(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex)
{
CMasternodeEntry cme(alias, ip, privKey, txHash, outputIndex);
entries.push_back(cme);
}
bool CMasternodeConfig::read(std::string& strErr)
{
int linenumber = 1;
boost::filesystem::path pathMasternodeConfigFile = GetMasternodeConfigFile();
boost::filesystem::ifstream streamConfig(pathMasternodeConfigFile);
if (!streamConfig.good()) {
FILE* configFile = fopen(pathMasternodeConfigFile.string().c_str(), "a");
if (configFile != NULL) {
if (Params().NetworkID() == CBaseChainParams::MAIN) {
std::string strHeader = "# Masternode config file\n"
"# Format: alias IP:port masternodeprivkey collateral_output_txid collateral_output_index\n"
"# Example: mn1 127.0.0.2:15319 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0\n";
fwrite(strHeader.c_str(), std::strlen(strHeader.c_str()), 1, configFile);
fclose(configFile);
}
else {
std::string strHeader = "#(testnet) Masternode config file\n"
"# Format: alias IP:port masternodeprivkey collateral_output_txid collateral_output_index\n"
"# Example: mn1 127.0.0.2:25319 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0\n";
fwrite(strHeader.c_str(), std::strlen(strHeader.c_str()), 1, configFile);
fclose(configFile);
}
}
return true; // Nothing to read, so just return
}
for (std::string line; std::getline(streamConfig, line); linenumber++) {
if (line.empty()) continue;
std::istringstream iss(line);
std::string comment, alias, ip, privKey, txHash, outputIndex;
if (iss >> comment) {
if (comment.at(0) == '#') continue;
iss.str(line);
iss.clear();
}
if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) {
iss.str(line);
iss.clear();
if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) {
strErr = _("Could not parse masternode.conf") + "\n" +
strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"";
streamConfig.close();
return false;
}
}
if (Params().NetworkID() == CBaseChainParams::MAIN) {
if (CService(ip).GetPort() != 15319) {
strErr = _("Invalid port detected in masternode.conf") + "\n" +
strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" +
_("(must be 15319 for mainnet)");
streamConfig.close();
return false;
}
} else if (CService(ip).GetPort() == 15319) {
strErr = _("Invalid port detected in masternode.conf") + "\n" +
strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" +
_("(15319 could be used only on mainnet)");
streamConfig.close();
return false;
}
add(alias, ip, privKey, txHash, outputIndex);
}
streamConfig.close();
return true;
}
bool CMasternodeConfig::CMasternodeEntry::castOutputIndex(int &n)
{
try {
n = std::stoi(outputIndex);
} catch (const std::exception e) {
LogPrintf("%s: %s on getOutputIndex\n", __func__, e.what());
return false;
}
return true;
}
| [
"[email protected]"
] | |
a7c85bef8cd9b1610dc509686b4c793391800371 | 1b29dd25f92d5a2cc46079f43a6be22389977d63 | /sources/Game.cpp | 2a989d3054fe8718555dbf3c5c724729dce92f42 | [] | no_license | project345/Project | 5489ac46f3b476ab979adcfabd71db22810d51af | 0620aab5283c65a807d73c6ddc847d705f7e82dd | refs/heads/master | 2022-02-20T16:20:26.812285 | 2019-09-29T03:20:22 | 2019-09-29T03:20:22 | 175,692,148 | 0 | 0 | null | 2019-05-12T05:38:36 | 2019-03-14T20:10:07 | HTML | UTF-8 | C++ | false | false | 1,374 | cpp | #include "Game.hpp"
#include "SplashState.hpp"
namespace Sarang{
Game::Game(int width, int height, std::string title){
_data->window.create(sf::VideoMode(width, height), title, sf::Style::Close | sf::Style::Titlebar);
_data->machine.AddState(StateRef (new SplashState(this->_data)));
this->Run();
}
void Game::Run(){
float newTime, frameTime, interpolation;
float currentTime = this->_clock.getElapsedTime().asSeconds();
float accumulator = 0.0f;
while(this->_data->window.isOpen()){
this->_data->machine.ProcessStateChanges();
newTime = this->_clock.getElapsedTime().asSeconds();
frameTime = newTime - currentTime;
if(frameTime > 0.25f){
frameTime = 0.25f;
}
currentTime = newTime;
accumulator += frameTime;
while(accumulator >= dt){
this->_data->machine.GetActiveState()->HandleInput();
this->_data->machine.GetActiveState()->Update(dt);
accumulator -= dt;
}
interpolation = accumulator/dt;
this->_data->machine.GetActiveState()->Draw(interpolation);
}
}
}
| [
"[email protected]"
] | |
4787ca0f37a4e99a3ec48d4b5261dd38e9313c79 | a2375f3d4f91012dd5bc07cbf8ec930176dae78a | /ObserverPattern.1.After/ObserverPattern.1.After.cpp | 2f84a3aa978332ba4aafe023dff8b22ceeeee746 | [] | no_license | syaifulnizamyahya/DesignPatternInCpp | c5ae7c7f0ff9f29cbde0d805e4addf6727a0d527 | 72c49c9c11c1a8610a9a25c2419601123e4eb290 | refs/heads/master | 2020-04-19T08:15:03.445882 | 2019-01-30T16:29:11 | 2019-01-30T16:29:11 | 168,070,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,750 | cpp | // ObserverPattern.1.After.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <vector>
using namespace std;
class Subject {
// 1. "independent" functionality
vector < class Observer * > views; // 3. Coupled only to "interface"
int value;
public:
void attach(Observer *obs) {
views.push_back(obs);
}
void setVal(int val) {
value = val;
notify();
}
int getVal() {
return value;
}
void notify();
};
class Observer {
// 2. "dependent" functionality
Subject *model;
int denom;
public:
Observer(Subject *mod, int div) {
model = mod;
denom = div;
// 4. Observers register themselves with the Subject
model->attach(this);
}
virtual void update() = 0;
protected:
Subject *getSubject() {
return model;
}
int getDivisor() {
return denom;
}
};
void Subject::notify() {
// 5. Publisher broadcasts
for (int i = 0; i < views.size(); i++)
views[i]->update();
}
class DivObserver : public Observer {
public:
DivObserver(Subject *mod, int div) : Observer(mod, div) {}
void update() {
// 6. "Pull" information of interest
int v = getSubject()->getVal(), d = getDivisor();
cout << v << " div " << d << " is " << v / d << '\n';
}
};
class ModObserver : public Observer {
public:
ModObserver(Subject *mod, int div) : Observer(mod, div) {}
void update() {
int v = getSubject()->getVal(), d = getDivisor();
cout << v << " mod " << d << " is " << v % d << '\n';
}
};
int main() {
Subject subj;
DivObserver divObs1(&subj, 4); // 7. Client configures the number and
DivObserver divObs2(&subj, 3); // type of Observers
ModObserver modObs3(&subj, 3);
subj.setVal(14);
subj.setVal(21);
subj.setVal(30);
cin.get();
} | [
"[email protected]"
] | |
9b102ac978a680443f30e86797cb22e1a067742f | be1ccd9d8a9fbf4e5527256ca5bd93ee2e24c51e | /Sources/Vulkan/erm/ray_tracing/RTPipelineResources.cpp | 23027f181ed805e0b8262f767ec8b1a783dd3cc9 | [
"MIT"
] | permissive | JALB91/ERM | f0f56c6fa99ef3d43bfe5074663fe76a8d7d36d6 | 4e739301b87dfcde3c85d6f52a83f09c4f69565f | refs/heads/master | 2023-01-09T07:49:10.080693 | 2022-07-29T22:15:45 | 2022-07-29T22:15:45 | 171,048,441 | 5 | 1 | MIT | 2021-03-10T20:41:38 | 2019-02-16T20:26:31 | C++ | UTF-8 | C++ | false | false | 10,539 | cpp | #include "erm/ray_tracing/RTPipelineResources.h"
#include "erm/engine/Engine.h"
#include "erm/math/math.h"
#include "erm/ray_tracing/RTRenderData.h"
#include "erm/rendering/Device.h"
#include "erm/rendering/data_structs/DeviceBindingResources.h"
#include "erm/rendering/data_structs/HostBindingResources.h"
#include "erm/rendering/data_structs/PipelineData.h"
#include "erm/rendering/shaders/ShaderProgram.h"
#include "erm/rendering/renderer/Renderer.h"
#include "erm/utils/Profiler.h"
#include "erm/utils/Utils.h"
#include "erm/utils/VkUtils.h"
namespace erm {
RTPipelineResources::RTPipelineResources(
Engine& engine,
const RTRenderData& renderData,
const vk::DescriptorPool& descriptorPool,
const vk::AccelerationStructureKHR* topLevelAS)
: mEngine(engine)
, mDevice(engine.GetDevice())
, mRenderer(engine.GetRenderer())
, mRenderData(renderData)
, mDescriptorPool(descriptorPool)
, mTopLevelAS(topLevelAS)
, mMaxInstancesCount(renderData.mInstancesMap.size())
{
CreatePipeline();
CreateBindingTable();
CreatePipelineData();
}
RTPipelineResources::~RTPipelineResources() = default;
void RTPipelineResources::Refresh()
{
if (mRenderData.mPipelineConfigs.mShaderProgram->NeedsReload())
{
mPipelineData.reset();
mDescriptorSetLayouts.clear();
CreatePipeline();
CreateBindingTable();
CreatePipelineData();
mRenderData.mPipelineConfigs.mShaderProgram->OnReloaded();
}
}
void RTPipelineResources::UpdateCommandBuffer(
vk::CommandBuffer& cmd,
RTRenderData& renderData)
{
ERM_PROFILE_FUNCTION();
mPipelineData->UpdateResources(cmd, renderData);
cmd.bindPipeline(vk::PipelineBindPoint::eRayTracingKHR, mPipeline.get());
auto ds = mPipelineData->GetDescriptorSets(mEmptySet.get());
cmd.bindDescriptorSets(
vk::PipelineBindPoint::eRayTracingKHR,
mPipelineLayout.get(),
0,
static_cast<uint32_t>(ds.size()),
ds.data(),
0,
nullptr);
}
void RTPipelineResources::CreatePipeline()
{
ShaderProgram* shader = static_cast<ShaderProgram*>(mRenderData.mPipelineConfigs.mShaderProgram);
ERM_ASSERT(shader);
/*
LOAD SHADERS
*/
std::vector<vk::UniqueShaderModule> rayGenShaderModules = shader->CreateShaderModules(ShaderType::RT_RAY_GEN);
std::vector<vk::UniqueShaderModule> missShaderModules = shader->CreateShaderModules(ShaderType::RT_MISS);
std::vector<vk::UniqueShaderModule> closestHitShaderModules = shader->CreateShaderModules(ShaderType::RT_CLOSEST_HIT);
ERM_ASSERT(rayGenShaderModules.size() == 1);
ERM_ASSERT(!missShaderModules.empty());
ERM_ASSERT(!closestHitShaderModules.empty());
std::vector<vk::PipelineShaderStageCreateInfo> shaderStages(1 + missShaderModules.size() + closestHitShaderModules.size());
vk::PipelineShaderStageCreateInfo& rayGenShaderStageInfo = shaderStages[0];
rayGenShaderStageInfo.stage = vk::ShaderStageFlagBits::eRaygenKHR;
rayGenShaderStageInfo.module = rayGenShaderModules[0].get();
rayGenShaderStageInfo.pName = "main";
for (size_t i = 0; i < missShaderModules.size(); ++i)
{
vk::PipelineShaderStageCreateInfo& missShaderStageInfo = shaderStages[i + 1];
missShaderStageInfo.stage = vk::ShaderStageFlagBits::eMissKHR;
missShaderStageInfo.module = missShaderModules[i].get();
missShaderStageInfo.pName = "main";
}
for (size_t i = 0; i < closestHitShaderModules.size(); ++i)
{
vk::PipelineShaderStageCreateInfo& closestHitShaderStageInfo = shaderStages[i + 1 + missShaderModules.size()];
closestHitShaderStageInfo.stage = vk::ShaderStageFlagBits::eClosestHitKHR;
closestHitShaderStageInfo.module = closestHitShaderModules[i].get();
closestHitShaderStageInfo.pName = "main";
}
std::vector<vk::RayTracingShaderGroupCreateInfoKHR> shaderGroups(shaderStages.size());
vk::RayTracingShaderGroupCreateInfoKHR& rayGenGroup = shaderGroups[0];
rayGenGroup.type = vk::RayTracingShaderGroupTypeKHR::eGeneral;
rayGenGroup.generalShader = 0;
rayGenGroup.anyHitShader = VK_SHADER_UNUSED_KHR;
rayGenGroup.closestHitShader = VK_SHADER_UNUSED_KHR;
rayGenGroup.intersectionShader = VK_SHADER_UNUSED_KHR;
for (size_t i = 0; i < missShaderModules.size(); ++i)
{
const uint32_t targetIndex = static_cast<uint32_t>(i) + 1;
vk::RayTracingShaderGroupCreateInfoKHR& missGroup = shaderGroups[targetIndex];
missGroup.type = vk::RayTracingShaderGroupTypeKHR::eGeneral;
missGroup.generalShader = targetIndex;
missGroup.anyHitShader = VK_SHADER_UNUSED_KHR;
missGroup.closestHitShader = VK_SHADER_UNUSED_KHR;
missGroup.intersectionShader = VK_SHADER_UNUSED_KHR;
}
for (size_t i = 0; i < closestHitShaderModules.size(); ++i)
{
const uint32_t targetIndex = static_cast<uint32_t>(i) + 1 + static_cast<uint32_t>(missShaderModules.size());
vk::RayTracingShaderGroupCreateInfoKHR& closestHitGroup = shaderGroups[targetIndex];
closestHitGroup.type = vk::RayTracingShaderGroupTypeKHR::eTrianglesHitGroup;
closestHitGroup.generalShader = VK_SHADER_UNUSED_KHR;
closestHitGroup.closestHitShader = targetIndex;
closestHitGroup.anyHitShader = VK_SHADER_UNUSED_KHR;
closestHitGroup.intersectionShader = VK_SHADER_UNUSED_KHR;
}
/*
SETUP DESCRIPTOR SET LAYOUT
*/
const LayoutBindingsMap& bindings = shader->GetLayoutBindingsMap();
uint32_t maxSet = 0;
std::for_each(bindings.begin(), bindings.end(), [&maxSet](const auto& pair) {
maxSet = std::max(maxSet, pair.first);
});
mDescriptorSetLayouts.reserve(maxSet + 1);
uint32_t maxInstanceId = 0;
for (const auto& [id, inst] : mRenderData.mInstancesMap)
maxInstanceId = std::max(maxInstanceId, id);
std::map<SetIdx, std::vector<vk::DescriptorSetLayoutBinding>> layoutBindings;
for (uint32_t i = 0; i <= maxSet; ++i)
{
vk::DescriptorSetLayoutCreateInfo layoutInfo {};
if (bindings.find(i) == bindings.end())
{
layoutInfo.bindingCount = 0;
layoutInfo.pBindings = nullptr;
}
else
{
auto& data = bindings.at(i);
for (auto& layoutBinding : data)
{
auto& binding = layoutBindings[i].emplace_back(layoutBinding);
if (binding.descriptorType == vk::DescriptorType::eStorageBuffer)
binding.descriptorCount = maxInstanceId + 1;
}
layoutInfo.bindingCount = static_cast<uint32_t>(layoutBindings[i].size());
layoutInfo.pBindings = layoutBindings[i].data();
}
mDescriptorSetLayouts.emplace_back(mDevice->createDescriptorSetLayoutUnique(layoutInfo));
}
vk::DescriptorSetLayoutCreateInfo emptyLayoutInfo;
emptyLayoutInfo.bindingCount = 0;
emptyLayoutInfo.pBindings = nullptr;
mEmptySetLayout = mDevice->createDescriptorSetLayoutUnique(emptyLayoutInfo);
vk::DescriptorSetAllocateInfo info {};
info.setDescriptorPool(mDescriptorPool);
info.setDescriptorSetCount(1);
info.setPSetLayouts(&mEmptySetLayout.get());
mEmptySet = std::move(mDevice->allocateDescriptorSetsUnique(info)[0]);
/*
SETUP PIPELINE LAYOUT
*/
std::vector<vk::DescriptorSetLayout> layouts(mDescriptorSetLayouts.size());
for (size_t i = 0; i < mDescriptorSetLayouts.size(); ++i)
layouts[i] = mDescriptorSetLayouts[i].get();
vk::PipelineLayoutCreateInfo pipelineLayoutInfo = {};
pipelineLayoutInfo.setLayoutCount = static_cast<uint32_t>(layouts.size());
pipelineLayoutInfo.pSetLayouts = layouts.data();
pipelineLayoutInfo.pushConstantRangeCount = 0;
pipelineLayoutInfo.pPushConstantRanges = nullptr;
mPipelineLayout = mDevice->createPipelineLayoutUnique(pipelineLayoutInfo);
/*
CREATE PIPELINE
*/
vk::RayTracingPipelineCreateInfoKHR pipelineInfo = {};
pipelineInfo.setPGroups(shaderGroups.data());
pipelineInfo.setGroupCount(static_cast<uint32_t>(shaderGroups.size()));
pipelineInfo.setPStages(shaderStages.data());
pipelineInfo.setStageCount(static_cast<uint32_t>(shaderStages.size()));
pipelineInfo.setLayout(mPipelineLayout.get());
pipelineInfo.setBasePipelineHandle(mPipeline.get());
auto result = mDevice->createRayTracingPipelineKHRUnique(nullptr, mDevice.GetPipelineCache(), pipelineInfo);
ERM_ASSERT(result.result == vk::Result::eSuccess);
mPipeline = std::move(result.value);
}
void RTPipelineResources::CreateBindingTable()
{
const vk::PhysicalDeviceRayTracingPipelinePropertiesKHR& rtProps = mDevice.GetRayTracingProperties();
IShaderProgram& shader = *mRenderData.mPipelineConfigs.mShaderProgram;
uint32_t groupCount = 0;
for (const auto& [type, data] : shader.GetShadersDataMap())
groupCount += static_cast<uint32_t>(data.size());
uint32_t groupHandleSize = rtProps.shaderGroupHandleSize; // Size of a program identifier
// Compute the actual size needed per SBT entry (round-up to alignment needed).
uint32_t groupSizeAligned = math::align_up(groupHandleSize, rtProps.shaderGroupBaseAlignment);
// Bytes needed for the SBT.
uint32_t sbtSize = groupCount * groupSizeAligned;
// Fetch all the shader handles used in the pipeline. This is opaque data,
// so we store it in a vector of bytes.
std::vector<uint8_t> shaderHandleStorage(sbtSize);
ERM_VK_CHECK(mDevice->getRayTracingShaderGroupHandlesKHR(mPipeline.get(), 0, groupCount, sbtSize, shaderHandleStorage.data()));
if (!mSBTBuffer || mSBTBuffer->GetBufferSize() != sbtSize)
{
// Allocate a buffer for storing the SBT.
mSBTBuffer = std::make_unique<HostBuffer>(
mDevice,
sbtSize,
BufferUsage::TRANSFER_SRC | BufferUsage::SHADER_DEVICE_ADDRESS | BufferUsage::SHADER_BINDING_TABLE);
}
// Map the SBT buffer and write in the handles.
void* mapped = nullptr;
ERM_VK_CHECK(mDevice->mapMemory(mSBTBuffer->GetBufferMemory(), 0, mSBTBuffer->GetBufferSize(), {}, &mapped));
uint8_t* pData = reinterpret_cast<uint8_t*>(mapped);
for (uint32_t g = 0; g < groupCount; ++g)
{
memcpy(pData, shaderHandleStorage.data() + g * groupHandleSize, groupHandleSize);
pData += groupSizeAligned;
}
mDevice->unmapMemory(mSBTBuffer->GetBufferMemory());
}
void RTPipelineResources::CreatePipelineData()
{
const PipelineConfigs& configs = mRenderData.mPipelineConfigs;
mPipelineData = std::make_unique<PipelineData>(configs);
const auto& sbm = configs.mShaderProgram->GetShaderBindingsMap();
for (const auto& [set, bindings] : sbm)
{
BindingResources resources;
if (set % 2 == 0)
resources = std::make_unique<DeviceBindingResources>(
mDevice,
mRenderer,
set,
mDescriptorPool,
*configs.mShaderProgram,
configs,
mRenderData,
mDescriptorSetLayouts[set].get(),
mTopLevelAS);
else
resources = std::make_unique<HostBindingResources>(
mDevice,
mRenderer,
set,
mDescriptorPool,
*configs.mShaderProgram,
configs,
mDescriptorSetLayouts[set].get());
mPipelineData->AddResources(set, std::move(resources));
}
}
} // namespace erm
| [
"[email protected]"
] | |
09acdac6b236a3a4bf2e647d97bd13a743cdcc63 | be216eddacb8ff9182ca9cb53594eeae88379cf0 | /Kinematics/src/Kinematics/UI/Window.h | 583c2e76d5a963c94b5cf2d0ef20880c6ffdd240 | [] | no_license | vinijabes/MTE | e2550ba408798b4b66138aae72b5c75a2a2ce245 | 6881a8be0b84808915db7c2b858da59e5282fbde | refs/heads/master | 2022-04-18T18:14:55.899453 | 2020-03-02T16:56:32 | 2020-03-02T16:56:32 | 225,663,578 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,434 | h | #pragma once
#include "TextBox.h"
#include "ScrollPanel.h"
namespace Kinematics {
namespace UI {
class WindowHeader : public Panel
{
public:
WindowHeader();
virtual void Draw(Camera& camera, glm::vec2 pos = glm::vec2(0)) override;
virtual void Update(Timestep ts) override;
void SetTitle(const std::string& title);
Ref<TextBox> GetTitle();
virtual void PushChild(Ref<UIElementInterface> child) { m_Header->PushChild(child); }
void SetTitleFont(const Ref<FontFace>& font);
private:
Ref<Panel> m_Header;
Ref<TextBox> m_Text;
};
class Window : public UIElementInterface
{
public:
Window();
virtual void Draw(Camera& camera, glm::vec2 pos = glm::vec2(0)) override;
virtual void Update(Timestep ts) override;
virtual void PushChild(Ref<UIElementInterface> child) override { m_Body->PushChild(child); }
virtual void ApplyLayout() override ;
void PushHeaderChild(Ref<UIElementInterface> child) { m_Header->PushChild(child); }
void SetBodyLayout(Ref<Layout> layout) { m_Body->SetLayout(layout); }
void SetTitle(const std::string& title);
void SetTitleFont(const Ref<FontFace>& font);
void SetFullSize(bool full) { m_FullSize = full; }
void UpdateFocus(Ref<UIElementInterface> element);
private:
Ref<ScrollPanel> m_Body;
Ref<WindowHeader> m_Header;
std::vector<Ref<UIElementInterface>> m_FocusPath;
bool m_FullSize = false;
};
}
} | [
"[email protected]"
] | |
c65b941c5309eb37d8210762d83f0f27649db081 | 044094157b8270ff590bb9f4b2eeac2ae3fc2349 | /src/aadcUser/VoiceControl/VoiceControlThrift/gen-cpp/voice_control_thrift_constants.cpp | 4c80c2eb6b02a0c595e374176f9f5fff15d9eb93 | [] | no_license | d-raith/frAISers_aadc_2018 | 31e682735d084853487ea9a671d9f156c4194192 | 26169227e5e5c4ddd3d87252452475424e6e8af0 | refs/heads/master | 2020-04-07T04:38:46.337676 | 2018-11-19T16:20:47 | 2018-11-19T16:20:47 | 158,065,598 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 413 | cpp | /**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "voice_control_thrift_constants.h"
namespace control_thrift {
const voice_control_thriftConstants g_voice_control_thrift_constants;
voice_control_thriftConstants::voice_control_thriftConstants() {
car26_id = "car26";
car27_id = "car27";
}
} // namespace
| [
"[email protected]"
] | |
7e835f9d4b28fdb1785eed44b5c9dd96882d2e07 | 535663fe24598c762066242e64f3849389531de0 | /bin/Release/Grent/CPP/Team/TeamModule.cpp | 2182ee1ad2069b9d2a491b08f78beb2b7bf7efc7 | [] | no_license | wanggan768q/RpcCoder_SY | 9fd8c153233b03cadc61a87b3f740d7561fa4907 | 91ce81e852478300ef23344c77966ab22c019ea3 | refs/heads/master | 2022-03-27T16:48:46.629157 | 2022-02-17T11:49:44 | 2022-02-17T11:49:44 | 108,358,956 | 1 | 3 | null | 2020-10-15T02:56:45 | 2017-10-26T03:51:46 | C++ | UTF-8 | C++ | false | false | 6,491 | cpp | /********************************************************************************************
* Copyright (C), 2011-2025, AGAN Tech. Co., Ltd.
* FileName: ModuleTeam.cpp
* Author: 甘业清
* Description: Team类,包含以下内容
* ★模块基本信息函数
* ★初始化结束回调函数
* ★时间相当回调函数
* ★用户创建上下线回调函数
* ★模块数据修改及同步回调函数
* Version: 1.0
* History:
* <author> <time> <version > <desc>
*
********************************************************************************************/
#include "TeamModule.h"
#include "BASE.h"
#include "MsgIdMgr.h"
IMPLEMENT_INSTANCE(ModuleTeam);
//Team实现类构造函数
ModuleTeam::ModuleTeam()
{
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_LEAVETEAM_REQUEST, &ModuleTeam::RpcLeaveTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_LEAVETEAM_REQUEST, new Some_Factory<TeamRpcLeaveTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_APPOINTTEAMLEADER_REQUEST, &ModuleTeam::RpcAppointTeamLeader);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_APPOINTTEAMLEADER_REQUEST, new Some_Factory<TeamRpcAppointTeamLeaderAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_CREATETEAM_REQUEST, &ModuleTeam::RpcCreateTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_CREATETEAM_REQUEST, new Some_Factory<TeamRpcCreateTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_DISSMISSTEAM_REQUEST, &ModuleTeam::RpcDissmissTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_DISSMISSTEAM_REQUEST, new Some_Factory<TeamRpcDissmissTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_KICKMEMBER_REQUEST, &ModuleTeam::RpcKickMember);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_KICKMEMBER_REQUEST, new Some_Factory<TeamRpcKickMemberAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_SURROUNDINGTEAM_REQUEST, &ModuleTeam::RpcSurroundingTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_SURROUNDINGTEAM_REQUEST, new Some_Factory<TeamRpcSurroundingTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_APPLYTEAM_REQUEST, &ModuleTeam::RpcApplyTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_APPLYTEAM_REQUEST, new Some_Factory<TeamRpcApplyTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_AGREEAPPLICANT_REQUEST, &ModuleTeam::RpcAgreeApplicant);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_AGREEAPPLICANT_REQUEST, new Some_Factory<TeamRpcAgreeApplicantAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_FOLLOWTEAMLEADER_REQUEST, &ModuleTeam::RpcFollowTeamLeader);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_FOLLOWTEAMLEADER_REQUEST, new Some_Factory<TeamRpcFollowTeamLeaderAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_SUMMONMEMBER_REQUEST, &ModuleTeam::RpcSummonMember);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_SUMMONMEMBER_REQUEST, new Some_Factory<TeamRpcSummonMemberAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_CHANGETEAMTARGET_REQUEST, &ModuleTeam::RpcChangeTeamTarget);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_CHANGETEAMTARGET_REQUEST, new Some_Factory<TeamRpcChangeTeamTargetAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_CHANGTEAMTYPE_REQUEST, &ModuleTeam::RpcChangTeamType);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_CHANGTEAMTYPE_REQUEST, new Some_Factory<TeamRpcChangTeamTypeAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_INVITETEAMMEMBER_REQUEST, &ModuleTeam::RpcInviteTeamMember);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_INVITETEAMMEMBER_REQUEST, new Some_Factory<TeamRpcInviteTeamMemberAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_AGREEJOINTEAM_REQUEST, &ModuleTeam::RpcAgreeJoinTeam);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_AGREEJOINTEAM_REQUEST, new Some_Factory<TeamRpcAgreeJoinTeamAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_REFUSEMEMBER_REQUEST, &ModuleTeam::RpcRefuseMember);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_REFUSEMEMBER_REQUEST, new Some_Factory<TeamRpcRefuseMemberAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_CLEARAPPLYLIST_REQUEST, &ModuleTeam::RpcClearApplyList);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_CLEARAPPLYLIST_REQUEST, new Some_Factory<TeamRpcClearApplyListAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_NOTEAMINVITE_REQUEST, &ModuleTeam::RpcNoTeamInvite);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_NOTEAMINVITE_REQUEST, new Some_Factory<TeamRpcNoTeamInviteAsk>());
g_pPacketMgr->registerHandle( RPC_CODE_TEAM_REJECTINVITE_REQUEST, &ModuleTeam::RpcRejectInvite);
g_pPacketMgr->registerPacketFacotry( RPC_CODE_TEAM_REJECTINVITE_REQUEST, new Some_Factory<TeamRpcRejectInviteAsk>());
m_mapSyncDataVersionName[1] = "SyncDataTeamV1";
}
//Team实现类析构函数
ModuleTeam::~ModuleTeam()
{
}
//获取模块ID
UINT8 ModuleTeam::GetModuleId()
{
return MODULE_ID_TEAM;
}
//获取模块名字
TStr ModuleTeam::GetModuleName()
{
return "Team";
}
//获取模块同步(保存)数据版本及类名
map<INT32,TStr> ModuleTeam::GetModuleDataVersionName()
{
return m_mapSyncDataVersionName;
}
//模块数据保存类型
SavedDataTypeE ModuleTeam::GetSavedDataType()
{
return SAVE_ITEM_DATA;
}
//获取初始化顺序
int ModuleTeam::GetInitializeOrder()
{
return MODULE_ID_TEAM;
}
//获取结束退出顺序
int ModuleTeam::GetFinalizeOrder()
{
return MODULE_ID_TEAM;
}
//初始化
bool ModuleTeam::Initialize()
{
return true;
}
//结束退出
void ModuleTeam::Finalize()
{
}
//毫秒级Tick回调
void ModuleTeam::OnTick( INT64 currentMiliSecond )
{
}
//秒级Tick回调
void ModuleTeam::OnSecondTick( time_t currentSecond )
{
}
//分钟改变回调
void ModuleTeam::OnMinuteChange( time_t currentSecond)
{
}
//小时改变回调
void ModuleTeam::OnHourChange( time_t currentSecond )
{
}
//天改变回调
void ModuleTeam::OnDayChange( time_t currentSecond )
{
}
//创建用户回调
void ModuleTeam::OnUserCreate( INT64 userId, const TStr& userName )
{
}
//用户上线回调
void ModuleTeam::OnUserOnline( INT64 userId, time_t lastLogoutTime )
{
}
//用户下线回调
void ModuleTeam::OnUserOffline( INT64 userId )
{
}
//是否要同步数据到客户端
bool ModuleTeam::NotSyncToClient( UINT16 usSyncId )
{
return false;
}
//同步数据修改后回调
void ModuleTeam::NotifySyncValueChanged(INT64 Key,UINT16 usSyncId, int nIndex)
{
}
| [
"[email protected]"
] | |
52fc5ef0db4f1d52ce1c8b0f029150e2a6788ef7 | 7d0be48c377429d297c8743be155f8eec408100a | /14.01 - C++/ex1.cpp | 5dedb955380c821f5b186ae75e1579c19a8a4277 | [] | no_license | MatheusBlanco/EDA | 94b0520fd0297d572bf8d181dce3a4912dfe79e5 | 5970f1c28be41cf3dc6e2448ff3fe6635dbaf0eb | refs/heads/master | 2020-04-17T22:07:28.497334 | 2019-02-05T23:19:30 | 2019-02-05T23:19:30 | 166,981,333 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 135 | cpp | #include <iostream>
using namespace std;
int main(){
string a;
cin >> a;
cout << "Hello " << a << endl;
return 0;
} | [
"[email protected]"
] | |
852941049007c8ca69487da109a49db5982b615e | 2125dd7d2069bca4ee7fd232d68888d8da4961c9 | /C++Primer/007class/simpleClass/ScreenAndWindow/Screen.cpp | dee3f2eef38ad28f9083ec60ecbedd4565a9aea5 | [] | no_license | Goessi/CS_Grad_Courses | 0e334a2ccbe716cf6381804a2d7677148548e1b0 | 47c324f364c19cfcc884fb937773462d4920596e | refs/heads/master | 2020-04-07T06:13:35.415669 | 2019-05-24T07:25:32 | 2019-05-24T07:25:32 | 158,126,807 | 0 | 1 | null | 2019-04-07T12:59:07 | 2018-11-18T21:04:27 | Python | UTF-8 | C++ | false | false | 925 | cpp | #include "Screen.h"
#include <iostream>
Screen::Screen(pos ht, pos wd)
:height(ht), width(wd){
}
Screen::Screen(pos ht, pos wd, char c)
:height{ht}, width{wd}, contents{ht*wd, c} {
}
char Screen::get() const {
return contents[cursor];
}
char Screen::get(pos r, pos c) const {
pos row = r * width;
return contents[row + c];
}
Screen &Screen::move (pos r, pos c) {
pos row = r * width;
cursor = row + c;
return *this;
}
void Screen::some_member() const {
++access_ctr;
}
Screen &Screen::set(char c) {
contents[cursor] = c;
return *this;
}
Screen &Screen::set(pos r, pos col, char ch) {
contents[r*width + col] = ch;
return *this;
}
Screen &Screen::display(std::ostream &os) {
std::cout << contents;
return *this;
}
const Screen &Screen::display(std::ostream &os) const {
std::cout << contents;
return *this;
}
| [
"[email protected]"
] | |
cfabd9f66134cd642a2c65dcad9f8955e849db95 | 842a066e585842ab9a2f3503257139f59a8d4e67 | /Tester.h | f227eeda23e6c2bcb212cf91e3897eea82f73444 | [] | no_license | MarkCEWang/Data-Structure | f47ad762bddb70f0a5569d0760b069b9630601fd | a2c62512dd9be3a0cf6099806cf96faa6169d512 | refs/heads/master | 2021-01-20T08:10:39.598283 | 2017-05-06T22:48:53 | 2017-05-06T22:48:53 | 90,111,906 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,875 | h | /*************************************************
* Tester<Class_name>
* The top-level testing class. Each derived
* class inherits the routines:
*
* int run()
*
* For a derived class to function, it must
* override the void process() member function.
* The process function should read in a line from
* the input file and tests the routine based on
* those instructions.
*
* The member variables are:
*
* Class_name *object A pointer to the object
* being tested.
*
* string command The string read in from
* the input file indicating
* the next command to be
* tested.
*
* int count The number of the current
* test being run.
*
* The member functions are:
*
* int run() Start a test run testing until
* the end of the file, one test
* per line.
* void process() Process and run an individual
* test.
*
* Author: Douglas Wilhelm Harder
* Copyright (c) 2006-9 by Douglas Wilhelm Harder. All rights reserved.
*
* DO NOT EDIT THIS FILE
*************************************************/
#ifndef TESTER_H
#define TESTER_H
#include <iostream>
#include <string>
#include <sstream>
#include "ece250.h"
template <class Class_name>
class Tester {
protected:
Class_name *object;
std::string command;
public:
Tester( Class_name *obj = 0 ):
object( obj ) {
// emtpy constructor
}
int run();
virtual void process() = 0;
};
/****************************************************
* int run()
*
* Indefinite run of test cases: continue reading console
* input until the end of the file.
****************************************************/
template <class Class_name>
int Tester<Class_name>::run() {
// read the flag which indicates the command to be test and
// stop if we have reached the end of the file
ece250::allocation_table.stop_recording();
const static std::string prompt = " % ";
int ptr = 3;
while ( true ) {
// terminate if there is an end-of-file or the user types 'exit'
if ( std::cin.eof() ) {
break;
}
++ece250::count;
std::cout << ece250::count << prompt;
std::cin >> command;
// Remove any comments
if ( command.substr( 0, 2 ) == "//" ) {
char comment[1024];
std::cin.getline( comment, 1024 );
std::cout << command << comment << std::endl;
continue;
}
// terminate if there is an end-of-file or the user types 'exit'
if ( std::cin.eof() ) {
std::cout << "Exiting..." << std::endl;
break;
}
// If the user enters !!,
// set the command to be the last command
// If the user enters !n where n is a number, (1 <= n < count)
// set the command ot be the nth command
if ( command == "!!" ) {
if ( ece250::count == 1 ) {
std::cout << "Event not found" << std::endl;
continue;
}
command = ece250::history[ece250::count - 1];
} else if ( command[0] == '!' ) {
int n;
std::istringstream number( command.substr( 1, command.length() - 1 ) );
number >> n;
if ( n <= 0 || n > n || n > 100 ) {
std::cout << "Event not found" << std::endl;
continue;
}
command = ece250::history[n];
}
// only track the last 100 commands
if ( ece250::count <= 100 ) {
ece250::history[ece250::count] = command;
}
// start tracking any memory allocations made
ece250::allocation_table.start_recording();
// There are five key commands
if ( command == "exit" ) {
std::cout << "Okay" << std::endl;
ece250::allocation_table.stop_recording();
break;
} else if ( command == "new" ) {
object = new Class_name();
std::cout << "Okay" << std::endl;
} else if ( command == "new:" ) {
int n;
std::cin >> n;
object = new Class_name( n );
std::cout << "Okay" << std::endl;
} else if ( command == "delete" ) {
delete object;
object = 0;
std::cout << "Okay" << std::endl;
} else if ( command == "summary" ) {
ece250::allocation_table.summary();
} else if ( command == "details" ) {
ece250::allocation_table.details();
} else if ( command == "memory" ) {
int n;
std::cin >> n;
if ( n == ece250::allocation_table.memory_alloc() ) {
std::cout << "Okay" << std::endl;
} else {
std::cout << "Failure in memory allocation: expecting " << n << " bytes to be allocated, but " << ece250::allocation_table.memory_alloc() << " bytes were allocated" << std::endl;
}
} else if ( command == "memory_store" ) {
ece250::allocation_table.memory_store();
std::cout << "Okay" << std::endl;
} else if ( command == "memory_change" ) {
int n;
std::cin >> n;
ece250::allocation_table.memory_change( n );
} else {
process();
}
// stop tracking any memory allocations made
ece250::allocation_table.stop_recording();
}
return 0;
}
#endif | [
"[email protected]"
] | |
52b04d6d3a708e02510e819d0a863a740f68b1ab | 64b35e1a9e8e720d7d0fb31a9e85548bfef330c9 | /Tree/DisjointSets/DisjointSets.cpp | 63457c33d2fc0b71a13639a436955e026e869b45 | [] | no_license | bigJiaLuo/DataStructureStudy | 32395fce5c62f928f0bc145e0ce9b5da6d634dec | 5ed9d2b20605dca8b5532de63f12eaa64c2f4447 | refs/heads/master | 2022-12-13T01:45:48.041509 | 2020-09-17T06:08:13 | 2020-09-17T06:08:13 | 269,287,153 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,903 | cpp | /*
并查集,如亲戚关系
时间:2020年7月4日11:58:17
作者:泽兑ing
*/
#include <stdio.h>
#define N 10
typedef struct node
{
int data;//结点对应人的编号
int rank;//子树高度的正整数,也是该结点高度的上限
int parent;//结点对应的父节点
}UFSTree;//并查集树的结点类型
/*
并查集树的初始化
建立一个存放并查集树的数组t,对于亲戚关系 ,每个结点的data值设置为其所对应的人的编号,rank值为0,parent值设为自己
*/
void MAKE_SET(UFSTree t[]){
int i;
for ( i = 0; i <= N; i++)
{
t[i].data = i;
t[i].rank = 0;
t[i].parent = i;
}
}
/*
查找一个元素所属的集合
在分离集合森林中,每一课分离集合树对应一个集合。要查找 某个元素所属的集合,就是要找这个元素的结点所在的分离树
*/
int FIND_SET(UFSTree t[],int x){
if (x != t[x].parent)//当前结点不为双亲
{
return FIND_SET(t,t[x].parent);//递归双亲中找到x
}else{
return x; //双亲为自己,返回分离树的根节点
}
}
/*
两个元素各自所属的集合的合并
思路:
1.比较两个结点的秩,让较小的秩的根指向较大的秩的根
2.如果两根相等,则让其中一个根指向另一个根,同时秩加一
*/
void UNION(UFSTree t[],int x,int y){//将x和y所在的子树合并
x = FIND_SET(t,x);//查找 x,y对应分离树中的根节点
y = FIND_SET(t,y);
if (t[x].rank > t[y].rank) //y的秩域小于x,则让y称为 x的孩子结点
{
t[y].parent = x;
}else{//y的秩域大于等于x
t[x].parent = y;
if (t[x].rank == t[y].rank)//x 与 y 的秩域是否相等
{
t[y].rank++;
}
}
}
int main(void){
return 0;
} | [
"[email protected]"
] | |
b9c54edc0f0e5d7f1f670dc94cede115f3143f51 | 1d6abe27a802d53f7fbd6eb5e59949044cbb3b98 | /tensorflow/compiler/xla/pjrt/tracked_device_buffer_test.cc | 9373b57e7d103a370b5fd822ee92ad420a63712e | [
"Apache-2.0"
] | permissive | STSjeerasak/tensorflow | 6bc8bf27fb74fd51a71150f25dc1127129f70222 | b57499d4ec0c24adc3a840a8e7e82bd4ce0d09ed | refs/heads/master | 2022-12-20T20:32:15.855563 | 2020-09-29T21:22:35 | 2020-09-29T21:29:31 | 299,743,927 | 5 | 1 | Apache-2.0 | 2020-09-29T21:38:19 | 2020-09-29T21:38:18 | null | UTF-8 | C++ | false | false | 5,022 | cc | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/pjrt/tracked_device_buffer.h"
#include <memory>
#include "tensorflow/compiler/xla/client/client_library.h"
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/test.h"
#include "tensorflow/stream_executor/device_memory_allocator.h"
namespace xla {
namespace {
StatusOr<std::shared_ptr<TrackedDeviceBuffer>> MakeArray(const Shape& shape,
LocalClient* client) {
std::vector<stream_executor::DeviceMemoryBase> device_buffers;
TF_RETURN_IF_ERROR(ShapeUtil::ForEachSubshapeWithStatus(
client->backend().transfer_manager()->HostShapeToDeviceShape(shape),
[&](const Shape& subshape, const ShapeIndex&) -> Status {
TF_ASSIGN_OR_RETURN(
se::OwningDeviceMemory device_memory,
client->backend().memory_allocator()->Allocate(
/*device_ordinal=*/0,
client->backend().transfer_manager()->GetByteSizeRequirement(
subshape)));
device_buffers.push_back(device_memory.Release());
return Status::OK();
}));
return std::make_shared<TrackedDeviceBuffer>(
client->backend().memory_allocator(), /*device_ordinal=*/0,
device_buffers,
absl::Span<const std::shared_ptr<BufferSequencingEvent>>(), nullptr);
}
TEST(TrackedDeviceBufferTest, AsShapedBuffer) {
LocalClient* client = ClientLibrary::LocalClientOrDie();
Shape a_shape = ShapeUtil::MakeShape(F32, {3, 101, 4});
Shape b_shape = ShapeUtil::MakeShape(S8, {77});
Shape c_shape = ShapeUtil::MakeShape(S64, {});
TF_ASSERT_OK_AND_ASSIGN(auto a_buffer, MakeArray(a_shape, client));
TF_ASSERT_OK_AND_ASSIGN(auto b_buffer, MakeArray(b_shape, client));
TF_ASSERT_OK_AND_ASSIGN(auto c_buffer, MakeArray(c_shape, client));
ASSERT_EQ(a_buffer->device_memory().size(), 1);
ASSERT_EQ(b_buffer->device_memory().size(), 1);
ASSERT_EQ(c_buffer->device_memory().size(), 1);
std::vector<se::DeviceMemoryBase> expected_buffer_sequence = {
a_buffer->device_memory()[0], b_buffer->device_memory()[0],
c_buffer->device_memory()[0]};
ShapedBuffer shaped_a = a_buffer->AsShapedBuffer(
a_shape,
client->backend().transfer_manager()->HostShapeToDeviceShape(a_shape),
client->platform());
ShapedBuffer shaped_b = b_buffer->AsShapedBuffer(
b_shape,
client->backend().transfer_manager()->HostShapeToDeviceShape(b_shape),
client->platform());
ShapedBuffer shaped_c = c_buffer->AsShapedBuffer(
c_shape,
client->backend().transfer_manager()->HostShapeToDeviceShape(c_shape),
client->platform());
auto expected_it = expected_buffer_sequence.begin();
for (auto it = shaped_a.buffers().begin(); it != shaped_a.buffers().end();
++it) {
ASSERT_TRUE(expected_it != expected_buffer_sequence.end());
EXPECT_TRUE(expected_it->IsSameAs(it->second));
++expected_it;
}
for (auto it = shaped_b.buffers().begin(); it != shaped_b.buffers().end();
++it) {
ASSERT_TRUE(expected_it != expected_buffer_sequence.end());
EXPECT_TRUE(expected_it->IsSameAs(it->second));
++expected_it;
}
for (auto it = shaped_c.buffers().begin(); it != shaped_c.buffers().end();
++it) {
ASSERT_TRUE(expected_it != expected_buffer_sequence.end());
EXPECT_TRUE(expected_it->IsSameAs(it->second));
++expected_it;
}
EXPECT_TRUE(expected_it == expected_buffer_sequence.end());
}
TEST(TrackedDeviceBufferTest, FromScopedShapedBuffer) {
LocalClient* client = ClientLibrary::LocalClientOrDie();
Literal literal = LiteralUtil::MakeTupleOwned(
LiteralUtil::CreateFullWithDescendingLayout<float>({10, 3, 7}, 33.4f),
LiteralUtil::One(S64));
TF_ASSERT_OK_AND_ASSIGN(
ScopedShapedBuffer shaped_buffer,
client->LiteralToShapedBuffer(literal, /*device_ordinal=*/0));
std::shared_ptr<TrackedDeviceBuffer> device_buffer =
TrackedDeviceBuffer::FromScopedShapedBuffer(&shaped_buffer, {});
EXPECT_EQ(device_buffer->device_memory().size(),
ShapeUtil::SubshapeCount(
client->backend().transfer_manager()->HostShapeToDeviceShape(
literal.shape())));
}
} // namespace
} // namespace xla
| [
"[email protected]"
] | |
0dd854b013aa951707ae62355fccd16822f0f13a | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /third_party/angle/src/tests/preprocessor_tests/number_test.cpp | f512ca108c509edb56879edcebdeb52a115a7944 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | C++ | false | false | 5,406 | cpp | //
// Copyright (c) 2012 The ANGLE 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.
//
#include <tuple>
#include "PreprocessorTest.h"
#include "compiler/preprocessor/Token.h"
namespace angle
{
#define CLOSED_RANGE(x, y) testing::Range(x, static_cast<char>((y) + 1))
class InvalidNumberTest : public SimplePreprocessorTest,
public testing::WithParamInterface<const char *>
{
};
TEST_P(InvalidNumberTest, InvalidNumberIdentified)
{
const char* str = GetParam();
using testing::_;
EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_INVALID_NUMBER, _, str));
preprocess(str);
}
INSTANTIATE_TEST_CASE_P(InvalidIntegers, InvalidNumberTest,
testing::Values("1a", "08", "0xG"));
INSTANTIATE_TEST_CASE_P(InvalidFloats, InvalidNumberTest,
testing::Values("1eg", "0.a", "0.1.2", ".0a", ".0.1"));
typedef std::tuple<const char*, char> IntegerParams;
class IntegerTest : public SimplePreprocessorTest, public testing::WithParamInterface<IntegerParams>
{
};
TEST_P(IntegerTest, Identified)
{
std::string str(std::get<0>(GetParam())); // prefix.
str.push_back(std::get<1>(GetParam())); // digit.
const char* cstr = str.c_str();
pp::Token token;
lexSingleToken(cstr, &token);
EXPECT_EQ(pp::Token::CONST_INT, token.type);
EXPECT_EQ(str, token.text);
}
INSTANTIATE_TEST_CASE_P(DecimalInteger,
IntegerTest,
testing::Combine(testing::Values(""),
CLOSED_RANGE('0', '9')));
INSTANTIATE_TEST_CASE_P(OctalInteger,
IntegerTest,
testing::Combine(testing::Values("0"),
CLOSED_RANGE('0', '7')));
INSTANTIATE_TEST_CASE_P(HexadecimalInteger_0_9,
IntegerTest,
testing::Combine(testing::Values("0x", "0X"),
CLOSED_RANGE('0', '9')));
INSTANTIATE_TEST_CASE_P(HexadecimalInteger_a_f,
IntegerTest,
testing::Combine(testing::Values("0x", "0X"),
CLOSED_RANGE('a', 'f')));
INSTANTIATE_TEST_CASE_P(HexadecimalInteger_A_F,
IntegerTest,
testing::Combine(testing::Values("0x", "0X"),
CLOSED_RANGE('A', 'F')));
class FloatTest : public SimplePreprocessorTest
{
protected:
void expectFloat(const std::string& str)
{
const char* cstr = str.c_str();
pp::Token token;
lexSingleToken(cstr, &token);
EXPECT_EQ(pp::Token::CONST_FLOAT, token.type);
EXPECT_EQ(str, token.text);
}
};
typedef std::tuple<char, char, const char*, char> FloatScientificParams;
class FloatScientificTest :
public FloatTest,
public testing::WithParamInterface<FloatScientificParams>
{
};
// This test covers floating point numbers of form [0-9][eE][+-]?[0-9].
TEST_P(FloatScientificTest, FloatIdentified)
{
std::string str;
str.push_back(std::get<0>(GetParam())); // significand [0-9].
str.push_back(std::get<1>(GetParam())); // separator [eE].
str.append(std::get<2>(GetParam())); // sign [" " "+" "-"].
str.push_back(std::get<3>(GetParam())); // exponent [0-9].
SCOPED_TRACE("FloatScientificTest");
expectFloat(str);
}
INSTANTIATE_TEST_CASE_P(FloatScientific,
FloatScientificTest,
testing::Combine(CLOSED_RANGE('0', '9'),
testing::Values('e', 'E'),
testing::Values("", "+", "-"),
CLOSED_RANGE('0', '9')));
typedef std::tuple<char, char> FloatFractionParams;
class FloatFractionTest :
public FloatTest,
public testing::WithParamInterface<FloatFractionParams>
{
};
// This test covers floating point numbers of form [0-9]"." and [0-9]?"."[0-9].
TEST_P(FloatFractionTest, FloatIdentified)
{
std::string str;
char significand = std::get<0>(GetParam());
if (significand != '\0')
str.push_back(significand);
str.push_back('.');
char fraction = std::get<1>(GetParam());
if (fraction != '\0')
str.push_back(fraction);
SCOPED_TRACE("FloatFractionTest");
expectFloat(str);
}
INSTANTIATE_TEST_CASE_P(FloatFraction_X_X,
FloatFractionTest,
testing::Combine(CLOSED_RANGE('0', '9'),
CLOSED_RANGE('0', '9')));
INSTANTIATE_TEST_CASE_P(FloatFraction_0_X,
FloatFractionTest,
testing::Combine(testing::Values('\0'),
CLOSED_RANGE('0', '9')));
INSTANTIATE_TEST_CASE_P(FloatFraction_X_0,
FloatFractionTest,
testing::Combine(CLOSED_RANGE('0', '9'),
testing::Values('\0')));
// In the tests above we have tested individual parts of a float separately.
// This test has all parts of a float.
TEST_F(FloatTest, FractionScientific)
{
SCOPED_TRACE("FractionScientific");
expectFloat("0.1e+2");
}
} // namespace angle
| [
"[email protected]"
] | |
7642e4277799abfb5b44044add1cf3f29f002082 | 25360b2fccdaf3da4e2373a04c6075ac37ae5c7a | /13.50+/string_class.cpp | 2097feadda999d3061006af43d7730db7cb6067f | [] | no_license | joook/CppPrimerProjects | e0a884113a82bbbd58f61ee4e9008cc3c3fb4d0b | 952d57c867670d9010e1790fa4f0d87e452a6967 | refs/heads/master | 2021-09-18T17:45:18.220942 | 2021-08-23T11:22:29 | 2021-08-23T11:22:29 | 149,216,774 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,994 | cpp | #include "string_class.h"
#include <stdexcept>
#include <iostream>
using namespace std;
allocator<char> Str::m_Allocator;
Str::Str()
: m_First(nullptr)
, m_FirstFree(nullptr)
, m_Last(nullptr)
{
reallocateMemory();
}
Str::Str(const char *StrPtr)
{
/*
char *Ptr = StrPtr;
while((Ptr != nullptr) && (*Ptr != '\0'))
{
pushBack(*Ptr);
}
*/
if(StrPtr != nullptr)
{
char *EndPtr = const_cast<char *>(StrPtr);
while(*EndPtr != '\0')
{
EndPtr++;
}
auto NewMemory = copyMemory(StrPtr, EndPtr);
m_First = NewMemory.first;
m_FirstFree = NewMemory.second;
m_Last = NewMemory.second;
}
else
{
}
}
Str::Str(size_t Length, const char Char)
{
for(size_t i = 0; i != Length; i++)
{
pushBack(Char);
}
}
Str::Str(const Str &OriStr)
: m_First(nullptr)
, m_FirstFree(nullptr)
, m_Last(nullptr)
{
auto Pair = copyMemory(OriStr.m_First, OriStr.m_FirstFree);
m_First = Pair.first;
m_FirstFree = Pair.second;
m_Last = Pair.second;
cout << "Str copied." << endl;
}
Str::Str(Str &&OriStr) noexcept
: m_First(OriStr.m_First)
, m_FirstFree(OriStr.m_FirstFree)
, m_Last(OriStr.m_Last)
{
OriStr.m_First = nullptr;
OriStr.m_FirstFree = nullptr;
OriStr.m_Last = nullptr;
cout << "Str moved." << endl;
}
Str &Str::operator=(const Str &OriStr)
{
auto Pair = copyMemory(OriStr.m_First, OriStr.m_FirstFree);
freeMemory();
m_First = Pair.first;
m_FirstFree = Pair.second;
m_Last = Pair.second;
cout << "Str assigned a value." << endl;
return *this;
}
Str &Str::operator=(Str &&OriStr) noexcept
{
if(this != &OriStr)
{
freeMemory();
m_First = OriStr.m_First;
m_FirstFree = OriStr.m_FirstFree;
m_Last = OriStr.m_Last;
OriStr.m_First = nullptr;
OriStr.m_FirstFree = nullptr;
OriStr.m_Last = nullptr;
}
else
{
}
cout << "Str assigned a value." << endl;
return *this;
}
Str::~Str()
{
freeMemory();
}
void Str::pushBack(const char &NewChar)
{
checkMemory();
m_Allocator.construct(m_FirstFree, NewChar);
m_FirstFree++;
}
char &Str::at(size_t Pos)
{
if(Pos < size())
{
return *(m_First+Pos);
}
else
{
throw range_error("Try to refer to a position beyond range.");
}
}
const char *Str::c_str()
{
auto Pair = copyMemory(m_First, m_FirstFree);
if((Pair.first != nullptr) && (Pair.second != nullptr))
{
if((Pair.first == Pair.second) || (*(Pair.second-1) != '\0'))
{
m_Allocator.construct(Pair.second, '\0');
}
else
{
//do nothing
}
return Pair.first;
}
else
{
throw runtime_error("Refered before initial.");
}
}
void Str::checkMemory()
{
if(size() == capacity())
{
reallocateMemory();
}
else
{
//do nothing
}
}
void Str::reallocateMemory()
{
size_t NewCapacity;
if(capacity() != 0)
{
NewCapacity = 2*capacity();
}
else
{
NewCapacity = 1;
}
reserveMemory(NewCapacity);
}
void Str::reserveMemory(size_t NewCapacity)
{
if(NewCapacity > capacity())
{
char *NewFirst = m_Allocator.allocate(NewCapacity);
char *NewPtr = NewFirst;
char *OriPtr = m_First;
for(size_t i = 0; i != size(); i++)
{
m_Allocator.construct(NewPtr, move(*OriPtr));
NewPtr++;
OriPtr++;
}
freeMemory();
m_First = NewFirst;
m_FirstFree = NewPtr;
m_Last = NewFirst+NewCapacity;
}
else
{
//do nothing
}
}
pair<char *, char *> Str::copyMemory(const char *OriBegin, const char *OriEnd)
{
pair<char *, char *> Pair = { nullptr, nullptr };
if((OriBegin != nullptr) && (OriEnd != nullptr) && (OriBegin <= OriEnd))
{
size_t Size = OriEnd-OriBegin;
char *NewBegin = m_Allocator.allocate(Size);
/*
char *NewPtr = NewBegin;
char *OriPtr = OriBegin;
for(size_t i = 0; i != Size; i++)
{
m_Allocator.construct(NewPtr, *OriPtr);
NewPtr++;
OriPtr++;
}
*/
uninitialized_copy(OriBegin, OriEnd, NewBegin);
Pair.first = NewBegin;
Pair.second = NewBegin+Size;
}
else
{
//do nothing
}
return Pair;
}
void Str::freeMemory()
{
if((m_First != nullptr) && (m_FirstFree != nullptr) && (m_First <= m_FirstFree))
{
for(char *Ptr = m_First; Ptr != m_FirstFree; Ptr++)
{
m_Allocator.destroy(Ptr);
}
m_Allocator.deallocate(m_First, capacity());
m_First = nullptr;
m_FirstFree = nullptr;
m_Last = nullptr;
}
else
{
m_First = nullptr;
m_FirstFree = nullptr;
m_Last = nullptr;
}
}
| [
"[email protected]"
] | |
288f048c8b919f1aad37b4d21531cac24965503b | 2ba94892764a44d9c07f0f549f79f9f9dc272151 | /Engine/Source/ThirdParty/CEF3/cef_binary_3.2272.2077_windows32/cefclient/performance_test.h | 055e171860fb3e8ba44f0c1f4362b13ad258b678 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown",
"BSD-2-Clause",
"LicenseRef-scancode-proprietary-license"
] | permissive | PopCap/GameIdea | 934769eeb91f9637f5bf205d88b13ff1fc9ae8fd | 201e1df50b2bc99afc079ce326aa0a44b178a391 | refs/heads/master | 2021-01-25T00:11:38.709772 | 2018-09-11T03:38:56 | 2018-09-11T03:38:56 | 37,818,708 | 0 | 0 | BSD-2-Clause | 2018-09-11T03:39:05 | 2015-06-21T17:36:44 | null | UTF-8 | C++ | false | false | 627 | h | // Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_
#define CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_
#pragma once
#include "cefclient/client_app.h"
namespace client {
namespace performance_test {
// Render delegate creation. Called from client_app_delegates.cc.
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates);
} // namespace performance_test
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_
| [
"[email protected]"
] | |
d814cf71b0efa71875040a42fe5d5836942bd6b9 | 15afffdeebd4c0b303225d2bddb126767369ecc5 | /Neo1/Neo1.ino | c616bf07d51460eda4a4b0533da86ce5798a8fd9 | [] | no_license | Calebenright/NeoPixel-Arrays | e000752a9f6c09b9d11da0a7b95900617137722d | b0e549576f3fa309056f272e0e2b39476c378116 | refs/heads/main | 2023-03-02T16:17:58.323736 | 2021-02-15T03:55:06 | 2021-02-15T03:55:06 | 338,961,178 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 489 | ino | #include <Adafruit_NeoPixel.h>
#include "frames.h"
Adafruit_NeoPixel strip(64, 6);
int colors [4][3]{
{255, 255, 255},
{0, 0, 255},
{0, 255, 0},
{255, 0, 0},
};
int whichFrame = 0;
void setup() {
strip.begin();
strip.clear();
strip.setBrightness(30);
}
void loop() {
for(int i = 0; i < strip.numPixels(); i++){
int pixAddress = pixelMap[i];
if(pixAddress != -1){
strip.setPixelColor(pixAddress, 255, 255, 255);
}
}
strip.show();
delay(500);
}
| [
"[email protected]"
] | |
7ab18c1bcaf30bbe925687820094553fed2bee96 | 8bb3f30d8aadc826e781ef64560bae0c0b7261cb | /Vector/Vector/main.cpp | 7fd9b9d6e5f2261bd57530c84cd5722813b0b22e | [] | no_license | SplendidSky/C-plus-plus-freshman | dc6aadf1e26f8a8a85da0005a3c546400994aaa0 | cfb24162017c23dff961d8eb00c8e5cde086ebed | refs/heads/master | 2016-09-06T02:18:51.125769 | 2015-07-04T02:58:03 | 2015-07-04T02:58:03 | 37,755,556 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,992 | cpp | #include <iostream>
#include "test.h"
#include "base.h"
#include "vector.h"
int main() {
typedef myVector<int, testAllocator> v;
Base * test = new v;
delete static_cast<v *>(test);
v * p1, *p2;
int t;
std::cout << "Test Constructor1:" << std::endl;
p1 = new v;
std::cout << "Size: " << p1->size() << std::endl;
delete p1;
std::cout << "Test Constructor2 and operator[]:" << std::endl;
p1 = new v(static_cast<std::size_t>(6), 6);
std::cout << "Size: " << p1->size() << std::endl;
std::cout << "Content:";
for (int i = 0; i < 2; ++i)
std::cout << ' ' << (*p1)[i];
std::cout << std::endl;
std::cin >> t;
std::cout << "Content after change:";
(*p1)[0] = t;
const v & r(*p1);
for (int i = 0; i < 2; ++i)
std::cout << ' ' << r[i];
std::cout << std::endl;
std::cout << "Test Constructor3 and iterators, including begin(), end():"
<< std::endl;
p2 = new v(r.begin(), r.end());
delete p1;
std::cout << "Content:";
for (v::iterator it = p2->begin(); it != p2->end(); ++it)
std::cout << ' ' << *it;
std::cout << std::endl;
std::cout << "Test Constructor4:" << std::endl;
*(p2->begin()) = 0;
p1 = new v(*p2);
delete p2;
std::cout << "Content:";
for (std::size_t i = 0; i < p1->size(); ++i)
std::cout << ' ' << (*p1)[i];
std::cout << std::endl;
std::cout << "Test operator=:" << std::endl;
p2 = new v(static_cast<std::size_t>(8), 8);
*p2 = *p1;
*p2 = *p2;
delete p1;
std::cout << "Content:";
for (std::size_t i = 0; i < p2->size(); ++i)
std::cout << ' ' << (*p2)[i];
std::cout << std::endl;
std::cout << "Test resize1:" << std::endl;
p2->resize(2);
std::cout << "Content:";
for (std::size_t i = 0; i < p2->size(); ++i)
std::cout << ' ' << (*p2)[i];
std::cout << std::endl;
std::cout << "Test resize2:" << std::endl;
p2->resize(8, 8);
std::cout << "Content:";
for (std::size_t i = 0; i < p2->size(); ++i)
std::cout << ' ' << (*p2)[i];
std::cout << std::endl;
std::cout << "Test reserve and capacity:" << std::endl;
p2->reserve(33);
std::cout << "Capacity: " << p2->capacity() << std::endl
<< "Size: " << p2->size() << std::endl;
p2->reserve(2);
std::cout << "Capacity: " << p2->capacity() << std::endl
<< "Size: " << p2->size() << std::endl;
std::cout << "Test clear and empty:" << std::endl;
if (p2->empty())
std::cout << "True" << std::endl;
else
std::cout << "False" << std::endl;
p2->clear();
if (p2->empty())
std::cout << "True" << std::endl;
else
std::cout << "False" << std::endl;
std::cout << "Capcaity: " << p2->capacity() << std::endl
<< "Size: " << p2->size() << std::endl;
int * arr = new int[5];
for (int i = 0; i < 5; ++i)
arr[i] = i + 1;
std::cout << "Test assign:" << std::endl;
p2->assign(arr, arr + 5);
std::cout << "Content:";
for (v::const_iterator it = p2->begin(); it != p2->end(); ++it)
std::cout << ' ' << *it;
std::cout << std::endl << "Size: " << p2->size()
<< std::endl << "Capacity: " << p2->capacity()
<< std::endl;
delete[] arr;
delete p2;
return 0;
}
| [
"[email protected]"
] | |
94c6d1d67a5841588da8c95c58dd69a09d018874 | 497c5bc5df53028a9cbb38522350aac3b581f8c3 | /utils/src/Log.cpp | f67e3be80ede82aca1c37be7784e2ad8003a469c | [
"MIT"
] | permissive | Yanick-Salzmann/message-converter-c | 188f6474160badecfd245a4fefa20a7c8ad9ca0c | 6dfdf56e12f19e0f0b63ee0354fda16968f36415 | refs/heads/master | 2020-06-25T11:54:12.874635 | 2019-08-19T19:32:41 | 2019-08-19T19:32:41 | 199,298,618 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,488 | cpp | #include "utils/Log.h"
#include <spdlog/sinks/stdout_color_sinks.h>
#ifdef __GNUG__
#include <cstdlib>
#include <memory>
#include <cxxabi.h>
std::string demangle(const char* name) {
int status = -4; // some arbitrary value to eliminate the compiler warning
// enable c++11 by passing the flag -std=c++11 to g++
std::unique_ptr<char, void(*)(void*)> res {
abi::__cxa_demangle(name, NULL, NULL, &status),
std::free
};
return (status==0) ? res.get() : name ;
}
#else
#include <dbghelp.h>
std::string demangle(const char* name) {
char undecorated_name[5000]{};
if(!UnDecorateSymbolName(name, undecorated_name, sizeof(undecorated_name), UNDNAME_COMPLETE)) {
return name;
}
undecorated_name[4999] = '\0';
return undecorated_name;
}
#endif
namespace message::utils {
void Logger::init_logger (const std::string& name) {
_logger = spdlog::stdout_color_mt (name);
_logger->set_pattern ("[%Y-%m-%d %H:%I:%S.%e] [%P:%t] [%n] %^[%l]%$ %v");
#ifndef NDEBUG
_logger->set_level (spdlog::level::debug);
#else
_logger->set_level (spdlog::level::info);
#endif
}
std::string Logger::sanitize_type_name(const std::string &name) {
auto actual_name = demangle(name.c_str());
const auto idx_space = actual_name.find(' ');
if(idx_space == std::string::npos) {
return actual_name;
}
return actual_name.substr(idx_space + 1);
}
} | [
"[email protected]"
] | |
6d7eed095d38d32e38fa5bc901f6b48628f893e9 | d0d0ae6bb5a300fe15b075b6857834def9435a89 | /Interploation Search/main.cpp | 9ed5e71df64352c67f84231a2ad3bc2cda06870b | [] | no_license | gagan86nagpal/Interview-prep | 4664eaaea3ac3e00215d3d7ac4945c25050785eb | 0548575edf81e9de3b7324fcf16c8b52ccb0ec71 | refs/heads/master | 2021-01-16T18:17:56.974517 | 2017-11-04T02:08:39 | 2017-11-04T02:08:39 | 100,056,019 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 626 | cpp | #include <iostream>
#include <math.h>
using namespace std;
// returns -1 if not found , else returns index
int jumpSearch(int a[],int n,int ele)
{
int i;
int lo=0,hi=n-1;
int pos;
while(lo<=hi&&ele>=a[lo]&&ele<=a[hi])
{
pos =lo+( (ele-a[lo])*(hi-lo) ) /(a[hi]-a[lo]);
if(a[pos]==ele)
return pos;
if(a[pos]<ele)
lo=pos+1;
else
lo=hi-1;
}
return -1;
}
int main()
{
int a[]={0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 163,233, 377, 610};
int n=sizeof(a)/sizeof(a[0]);
cout<<jumpSearch(a,n,89)<<"\n";
return 0;
}
| [
"[email protected]"
] | |
e6157edc9b8e0f1ef6ce33144a49a7885b0ce30f | c90caf85cc8f823a9a098e191baab4fa58109a64 | /API/API_Thread/Implementation/API_Thread_STD/API_Thread_STD.hpp | 7dc697ba0d56b62dabddbc392d95238087870aef | [] | no_license | Lozoute/Rtype | 805d29f50e762888f55dd2e2006a043090a590f9 | 0c241eb0cac90bc4d4c01996fb39233e2f6667b7 | refs/heads/master | 2021-06-16T16:17:18.833846 | 2017-03-13T15:44:41 | 2017-03-13T15:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 950 | hpp | #ifndef API_THREAD_STD_HPP
# define API_THREAD_STD_HPP
# include <iostream>
# include <string>
# include <thread>
# include "API_Thread.hpp"
template <typename Func, typename... Arg>
class Thread : public API_Thread::IThread<Func, Arg...>
{
private:
std::thread *_thread;
Thread(const Thread &) {}
Thread &operator=(const Thread &) { return *this; }
public:
Thread() : _thread(nullptr) {}
virtual ~Thread() {}
virtual bool init(Func f, Arg... arg)
{
if (this->_thread != nullptr)
this->stop();
this->_thread = new std::thread(f, arg...);
return (this->_thread != nullptr);
}
virtual bool stop()
{
if (_thread == nullptr)
return (false);
_thread->detach();
delete (_thread);
_thread = nullptr;
return (true);
}
virtual bool join()
{
if (_thread == nullptr)
return (false);
this->_thread->join();
return (true);
}
};
#endif /* !API_THREAD_STD_HPP */
| [
"[email protected]"
] | |
5688f45c5bd2b7bb1d5b012fd0e6beebfb5b0e42 | f237f823598765af4b714e08f8ba236a213e5567 | /Stack.h | 49c0a3d1b5add889616bee4633fcd48af00add73 | [] | no_license | Hrach097/Vector-Stack | d190fda68b05aee31d7635ec604e8eb4c520971d | b6edcd0b4ac2ff18577eefabf5aeaa5c600c098f | refs/heads/master | 2020-03-23T16:32:41.411908 | 2018-07-21T16:09:00 | 2018-07-21T16:09:00 | 141,816,447 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | h | #ifndef _STACK
#define _STACK
#include "Vector.h"
template <typename T>
class Stack : private Vector<T> {
public:
Stack(const int size = 5);
virtual ~Stack();
virtual void push(T value);
virtual void pop();
virtual T peek();
virtual int get_size() override;
virtual void show_stack();
};
template <typename T>
Stack<T>::Stack(const int size) : Vector<T>(size) { }
template <typename T>
Stack<T>::~Stack(){
Vector<T>::~Vector();
}
template <typename T>
void Stack<T>::push(T value) {
Vector<T>::push_back(value);
}
template <typename T>
void Stack<T>::pop() {
Vector<T>::pop_back();
}
template <typename T>
T Stack<T>::peek() {
return Vector<T>::peek_back();
}
template <typename T>
int Stack<T>::get_size() {
Vector<T>::get_size();
}
template <typename T>
void Stack<T>::show_stack() {
Vector<T>::show_vector();
}
#endif
| [
"[email protected]"
] | |
f6283dba3e0f092c797d9e7eb4924f0624dd9bd7 | 2820315a313ff7fb5d30168cbf12108e72ca579d | /exercises/exercise_4/question_4/simple-canny-interactive/src/capture.cpp | 198c2714bf5efb91a526f0715bef2578886cae1a | [
"MIT"
] | permissive | baquerrj/ECEN5623 | 88904a8ff79703a23a74ef3031cb3de4bc19aaa0 | ae4057ffbff404a69bd779f5ae9695ba1bbd8671 | refs/heads/master | 2020-12-14T17:23:01.719846 | 2020-05-02T21:11:52 | 2020-05-02T21:11:52 | 234,822,424 | 1 | 0 | MIT | 2020-03-08T01:34:54 | 2020-01-19T01:34:22 | C | UTF-8 | C++ | false | false | 2,217 | cpp | /*
*
* Example by Sam Siewert
*
* Updated 10/29/16 for OpenCV 3.1
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
#define HRES 640
#define VRES 480
// Transform display window
char timg_window_name[] = "Edge Detector Transform";
int lowThreshold = 0;
int const max_lowThreshold = 100;
int kernel_size = 3;
int edgeThresh = 1;
int ratio = 3;
Mat canny_frame, cdst, timg_gray, timg_grad;
IplImage* frame;
void CannyThreshold( int, void* )
{
//Mat mat_frame(frame);
Mat mat_frame( cvarrToMat( frame ) );
cvtColor( mat_frame, timg_gray, CV_RGB2GRAY );
/// Reduce noise with a kernel 3x3
blur( timg_gray, canny_frame, Size( 3, 3 ) );
/// Canny detector
Canny( canny_frame, canny_frame, lowThreshold, lowThreshold * ratio, kernel_size );
/// Using Canny's output as a mask, we display our result
timg_grad = Scalar::all( 0 );
mat_frame.copyTo( timg_grad, canny_frame );
imshow( timg_window_name, timg_grad );
}
int main( int argc, char** argv )
{
CvCapture* capture;
int dev = 0;
if ( argc > 1 )
{
sscanf( argv[ 1 ], "%d", &dev );
printf( "using %s\n", argv[ 1 ] );
}
else if ( argc == 1 )
printf( "using default\n" );
else
{
printf( "usage: capture [dev]\n" );
exit( -1 );
}
namedWindow( timg_window_name, CV_WINDOW_AUTOSIZE );
// Create a Trackbar for user to enter threshold
createTrackbar( "Min Threshold:", timg_window_name, &lowThreshold, max_lowThreshold, CannyThreshold );
capture = (CvCapture*)cvCreateCameraCapture( dev );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, HRES );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, VRES );
while ( 1 )
{
frame = cvQueryFrame( capture );
if ( !frame )
break;
CannyThreshold( 0, 0 );
char q = cvWaitKey( 33 );
if ( q == 'q' )
{
printf( "got quit\n" );
break;
}
}
cvReleaseCapture( &capture );
};
| [
"[email protected]"
] | |
55aff34b64fea256dae2e01a7e40d51843be2d1f | 7d8e48a98819c69fc7cdeb4a920c8aba1359b709 | /HDOJ/2018 Multi-University Training Contest 7/1001.cpp | 467a8e77f2e7429289c4ae79263c92a2db928257 | [] | no_license | zxnm19980609/CODE | d5f6531bce9b0846f77b4b1f34c98af6d741a020 | 6e00642f31e13ed07ce715ec576acda712547f57 | refs/heads/master | 2020-03-23T19:52:29.294202 | 2018-11-02T10:34:30 | 2018-11-02T10:34:30 | 142,007,360 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,811 | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MAXM = 400005;
class Edge {
public:
int to, next, type;
}edge[MAXM];
int n, m, cnt, h[MAXN], dis[MAXN];
bool vis[MAXN];
set<int> last[MAXN];
queue<int> q;
void addEdge(int u, int v, int c) {
++cnt;
edge[cnt].to = v;
edge[cnt].type = c;
edge[cnt].next = h[u];
h[u] = cnt;
}
int spfa() {
for (int i = 1; i <= n; ++i)
last[i].clear();
memset(dis, 0x3F, sizeof dis);
memset(vis, 0, sizeof vis);
while (!q.empty()) q.pop();
dis[1] = 0;
vis[1] = true;
q.push(1);
while (!q.empty()) {
int u = q.front();
q.pop();
vis[u] = false;
for (int p = h[u]; p; p = edge[p].next) {
int v = edge[p].to;
int w = last[u].find(edge[p].type) == last[u].end() ? 1 : 0;
if (dis[v] > dis[u] + w) {
dis[v] = dis[u] + w;
last[v].clear();
last[v].insert(edge[p].type);
if (!vis[v]) {
vis[v] = true;
q.push(v);
}
}
else if (dis[v] == dis[u] + w && last[v].find(edge[p].type) == last[v].end()) {
last[v].insert(edge[p].type);
if (!vis[v]) {
vis[v] = true;
q.push(v);
}
}
}
}
return dis[n] == 0x3F3F3F3F ? -1 : dis[n];
}
int main() {
// freopen("in.txt", "r", stdin);
while (~scanf("%d%d", &n, &m)) {
cnt = 0;
memset(h, 0, sizeof h);
for (int u, v, c, i = 1; i <= m; ++i) {
scanf("%d%d%d", &u, &v, &c);
addEdge(u, v, c);
addEdge(v, u, c);
}
printf("%d\n", spfa());
}
return 0;
} | [
"[email protected]"
] | |
176808c3eb335aa364c373285c9163c4285d80d9 | ced255822313a2b0419bf3eb933be848be828f63 | /definition.h | 318e40d5c1ba95137d4dd3f0ca91ac2aaa5227ee | [] | no_license | kaeria/Echecs | 6dcba862214692fb7054fa4dee12aeafe8721739 | aa695d32e64798bc9a47cf407ab4eb74153005bf | refs/heads/master | 2021-01-15T17:36:36.644338 | 2015-03-02T08:03:19 | 2015-03-02T08:03:19 | 31,055,950 | 0 | 0 | null | 2015-02-20T08:09:44 | 2015-02-20T08:09:43 | null | UTF-8 | C++ | false | false | 444 | h | #ifndef DEFINITION_H_INCLUDED
#define DEFINITION_H_INCLUDED
#include <limits>
using namespace std;
const int mini=numeric_limits<int>::min(); //the minimum value of 'int'
const int maxi=numeric_limits<int>::max(); //the maximum value of 'int'
enum case_TTT {croix , rond , vide};
enum Joueur {humain, ordinateur};
enum type {Roi, Dame, Tour, Cavalier, Fou, Pion, Piecevide};
enum couleur {blanc, noir};
#endif // DEFINITION_H_INCLUDED
| [
"[email protected]"
] | |
ef01b955deb673d7bbaa80e6ae0e4b1fe84317cb | 1302a788aa73d8da772c6431b083ddd76eef937f | /WORKING_DIRECTORY/device/google/contexthub/util/common/ring.cpp | 1d23b82c49558e9c8edca7fdef10175cc3ca176f | [
"Apache-2.0"
] | permissive | rockduan/androidN-android-7.1.1_r28 | b3c1bcb734225aa7813ab70639af60c06d658bf6 | 10bab435cd61ffa2e93a20c082624954c757999d | refs/heads/master | 2021-01-23T03:54:32.510867 | 2017-03-30T07:17:08 | 2017-03-30T07:17:08 | 86,135,431 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,513 | cpp | /*
* Copyright (C) 2015 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_DEBUG 1
#define LOG_TAG "ring"
#include <utils/Log.h>
#include "ring.h"
#include <stdlib.h>
#include <string.h>
namespace android {
RingBuffer::RingBuffer(size_t size)
: mSize(size),
mData((sensors_event_t *)malloc(sizeof(sensors_event_t) * mSize)),
mReadPos(0),
mWritePos(0) {
}
RingBuffer::~RingBuffer() {
free(mData);
mData = NULL;
}
ssize_t RingBuffer::write(const sensors_event_t *ev, size_t size) {
Mutex::Autolock autoLock(mLock);
size_t numAvailableToRead = mWritePos - mReadPos;
size_t numAvailableToWrite = mSize - numAvailableToRead;
if (size > numAvailableToWrite) {
size = numAvailableToWrite;
}
size_t writePos = (mWritePos % mSize);
size_t copy = mSize - writePos;
if (copy > size) {
copy = size;
}
memcpy(&mData[writePos], ev, copy * sizeof(sensors_event_t));
if (size > copy) {
memcpy(mData, &ev[copy], (size - copy) * sizeof(sensors_event_t));
}
mWritePos += size;
if (numAvailableToRead == 0 && size > 0) {
mNotEmptyCondition.broadcast();
}
return size;
}
ssize_t RingBuffer::read(sensors_event_t *ev, size_t size) {
Mutex::Autolock autoLock(mLock);
size_t numAvailableToRead;
for (;;) {
numAvailableToRead = mWritePos - mReadPos;
if (numAvailableToRead > 0) {
break;
}
mNotEmptyCondition.wait(mLock);
}
if (size > numAvailableToRead) {
size = numAvailableToRead;
}
size_t readPos = (mReadPos % mSize);
size_t copy = mSize - readPos;
if (copy > size) {
copy = size;
}
memcpy(ev, &mData[readPos], copy * sizeof(sensors_event_t));
if (size > copy) {
memcpy(&ev[copy], mData, (size - copy) * sizeof(sensors_event_t));
}
mReadPos += size;
return size;
}
} // namespace android
| [
"[email protected]"
] | |
fc81a48e349ca408a898faa2313ef0701d602176 | 5885fd1418db54cc4b699c809cd44e625f7e23fc | /neerc-northern-2010-cf100610/f-henry.cpp | 300668f1c5cacca96aac490ebe0d243ed0401c4f | [] | no_license | ehnryx/acm | c5f294a2e287a6d7003c61ee134696b2a11e9f3b | c706120236a3e55ba2aea10fb5c3daa5c1055118 | refs/heads/master | 2023-08-31T13:19:49.707328 | 2023-08-29T01:49:32 | 2023-08-29T01:49:32 | 131,941,068 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 458 | cpp | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
const char nl = '\n';
#define FILE "frames"
int main() {
if (fopen(FILE ".in", "r")) {
freopen(stdin, FILE ".in", "r");
freopen(stdout, FILE ".out", "w");
}
Rectangle in[2], out[2];
for(int i=0; i<2; i++) {
int a, b, x, y, ia, ib, ix, iy
cin >> a >> b >> x >> y >> ia >> ib >> ix >> iy;
out[i] = {a,b,x,y};
in[i] = {ia,ib,ix,iy};
}
return 0;
}
| [
"[email protected]"
] | |
f678423f46b09ea4ab36c95de455c111d4a159c4 | d3cfaa7be41b70205e027d718f5546723f59906d | /hihoCode/[Offer收割]编程练习赛50/题目2-座位问题.cpp | aa57a81b0f43addb4b324e7351bbe9cf04779f91 | [] | no_license | 15757170756/All-Code-I-Have-Done | 8836c11ad1648f06cb815ab76f3378cddc41ac63 | e8985935efa641e68b76c231dddaf6326e3f3f98 | refs/heads/master | 2022-12-12T10:01:26.132458 | 2021-09-02T13:34:00 | 2021-09-02T13:34:09 | 111,758,971 | 9 | 3 | null | 2022-12-07T23:30:17 | 2017-11-23T03:31:03 | Jupyter Notebook | UTF-8 | C++ | false | false | 3,322 | cpp | /*
时间限制:10000ms
单点时限:1000ms
内存限制:256MB
描述
HIHO银行等待区有一排N个座位,从左到右依次编号1~N。现在有M位顾客坐在座位上,其中第i位坐在编号Ai的座位上。
之后又陆续来了K位顾客,(K + M ≤ N) 他们都会选择坐在最"舒适"的空座位上,并且过程中没有顾客离开自己的座位。
最"舒适"的定义是:
1. 对于一个座位,我们将它左边的空座位数目记作X,它右边的空座位数目记作Y。
2. 顾客首先会选择min(X, Y)最大的座位。
3. 如果有多个选择,顾客会选择其中max(X, Y)最大的座位。
4. 如果还是有多个选择,顾客会选择其中编号最小的座位。
请你计算出之后来的K位顾客坐在几号座位上。
输入
第一行包含三个整数N,M和K。
第二行包含M个整数A1, A2, ... AM。
对于50%的数据,1 ≤ N ≤ 1000
对于100%的数据,1 ≤ N ≤ 100000, 1 ≤ Ai ≤ N, K + M ≤ N
输出
输出K行,每行一个整数代表该位顾客座位的编号。
样例输入
10 2 3
1 10
样例输出
5
7
3
*/
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 100010;
struct in
{
int id; int l; int r;
in(){}
in(int x, int y, int z) :id(x), l(y), r(z) {}
friend bool operator < (in a, in b) {
if (a.r - a.l == b.r - b.l)
return a.id>b.id;
return a.r - a.l < b.r - b.l;
}
};
int a[maxn], used[maxn], L[maxn], R[maxn];
priority_queue<in>q;
int main()
{
int N, M, K, i, j;
scanf("%d%d%d", &N, &M, &K);
used[0] = 1; used[N + 1] = 1;
for (i = 1; i <= M; i++)
scanf("%d", &a[i]);
sort(a + 1, a + M + 1);
a[0] = 0; a[M + 1] = N + 1;
for (i = 1; i <= M + 1; i++) {
L[i] = a[i - 1] + 1; R[i] = a[i] - 1;
q.push(in((L[i] + R[i]) / 2, L[i], R[i]));
}
for (i = 1; i <= K; i++){
in tmp = q.top(); q.pop();
printf("%d\n", tmp.id);
q.push(in((tmp.id - 1 + tmp.l) / 2, tmp.l, tmp.id - 1));
q.push(in((tmp.r + tmp.id + 1) / 2, tmp.id + 1, tmp.r));
}
return 0;
}
/*
结果:Accepted
*/
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 0x3f3f3f3f;
int n, m, k, t, a[maxn], l[maxn], r[maxn];
struct node
{
int x, y, id;
bool operator<(const node&p)const
{
if (min(x, y) != min(p.x, p.y))return min(x, y)>min(p.x, p.y);
if (max(x, y) != max(p.x, p.y))return max(x, y) > max(p.x, p.y);
return id < p.id;
}
};
set<node>pq;
int main()
{
int i, j;
scanf("%d%d%d", &n, &m, &k);
for (i = 1; i <= m; i++)scanf("%d", &j), a[j] = 1;
for (i = 1; i <= n; i++)l[i] = (a[i] == 0 ? l[i - 1] + 1 : 0);
for (i = n; i >= 1; i--)r[i] = (a[i] == 0 ? r[i + 1] + 1 : 0);
for (i = 1; i <= n; i++)l[i]--, r[i]--;
for (i = 1; i <= n; i++)if (!a[i])pq.insert(node{ l[i], r[i], i });
for (i = 1; i <= k; i++)
{
auto now = pq.begin();
printf("%d\n", now->id);
for (j = now->id - 1; j >= now->id - now->x; j--)
{
pq.erase(node{ l[j], r[j], j });
r[j] -= now->y + 1;
pq.insert(node{ l[j], r[j], j });
}
for (j = now->id + 1; j <= now->id + now->y; j++)
{
pq.erase(node{ l[j], r[j], j });
l[j] -= now->x + 1;
pq.insert(node{ l[j], r[j], j });
}
pq.erase(now);
//for(j=1;j<=n;j++)printf("***%d %d\n",l[j],r[j]);
}
return 0;
}
| [
"[email protected]"
] | |
358647a3e38094570bfae6ea70a2fa4306fc226d | 689c78fb8fbebcd2a671b56e31d6a28962d43de1 | /include/loki/yasli/random.h | 164c645a738e16e972eafc76c17b5cce97f7f08e | [] | no_license | Sleepingwell/loki | 3f98625f7f0552c624e466dd47b88c6b302b8622 | ffe25f26c270c8029502f670e4ea53f3308ec544 | refs/heads/master | 2023-02-19T16:31:35.724479 | 2018-07-31T14:07:02 | 2018-07-31T14:07:02 | 11,024,701 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,637 | h | #ifndef YASLI_RANDOM_H_
#define YASLI_RANDOM_H_
// $Id: random.h 1022 2009-09-26 21:03:36Z rich_sposato $
#include <ctime>
#include <limits.h>
class Random
{
unsigned int seed_;
public:
Random(unsigned int seed = 0)
: seed_(seed ? seed : static_cast<unsigned int>(std::time(0)))
{
}
unsigned short nextShort()
{
/* Use any number from this list for "a"
18000 18030 18273 18513 18879 19074 19098 19164 19215 19584
19599 19950 20088 20508 20544 20664 20814 20970 21153 21243
21423 21723 21954 22125 22188 22293 22860 22938 22965 22974
23109 23124 23163 23208 23508 23520 23553 23658 23865 24114
24219 24660 24699 24864 24948 25023 25308 25443 26004 26088
26154 26550 26679 26838 27183 27258 27753 27795 27810 27834
27960 28320 28380 28689 28710 28794 28854 28959 28980 29013
29379 29889 30135 30345 30459 30714 30903 30963 31059 31083
*/
static const unsigned int a = 18000;
return static_cast<unsigned short>(seed_ =
a * (seed_ & 65535) +
(seed_ >> 16));
}
unsigned int nextUint()
{
return (unsigned int)nextShort() << (CHAR_BIT * sizeof(unsigned short)) |
nextShort();
}
unsigned int nextUint(unsigned int high)
{
assert(high < ULONG_MAX - 1);
++high;
const unsigned int bucket_size = ULONG_MAX / high;
unsigned int a;
do
{
a = nextUint() / bucket_size;
}
while (a >= high);
return a;
}
};
#endif // RANDOM_H_
| [
"[email protected]"
] | |
47f109be9dd3d1372b09807c9e9224b7c73c614a | 0d942330b6407e7d6109812cd03ee2f88a729161 | /src/Inst/UninitializedData.h | 75719f9bd218d61404a4100d7b7b7873f3197aa0 | [
"Apache-2.0"
] | permissive | hleclerc/Sane | b54bcdf90f5481d8df7136b64dc89ffb68a65ec8 | 55298a84b9a87100e3c264e130e8c15048687c31 | refs/heads/master | 2021-09-06T05:15:35.642679 | 2018-02-02T17:10:46 | 2018-02-02T17:10:46 | 110,580,979 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 150 | h | #pragma once
class Variable;
class KuSI64;
class Type;
Variable make_UninitializedData(TypeInSane *type, const KuSI64 &size, const KuSI64 &alig );
| [
"[email protected]"
] | |
5019015354f5234f8067a15303061ad270ea8213 | 0aeec7479d20f9aa1bb5294c1b0a8585e947fbea | /Sources/coolpropsolver.cpp | 6b13d00e114ad50603ba841c84febbf67caa8e33 | [] | no_license | ORNL-Modelica/MediaLookupTables | 28b9dae5430b0399a795ad1e1d270039febbc03c | a0c8c71cbd10e9759f03c9487d21dc635aba5260 | refs/heads/master | 2023-08-14T22:01:49.574447 | 2021-09-30T16:04:54 | 2021-09-30T16:04:54 | 412,126,641 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,342 | cpp | #include "coolpropsolver.h"
#include "CoolPropTools.h"
#include "CoolPropDLL.h"
#include "CoolProp.h"
#include "CPState.h"
#include <iostream>
#include <string>
#include <stdlib.h>
//double _p_eps ; // relative tolerance margin for subcritical pressure conditions
//double _T_eps ; // relative tolerance margin for supercritical temperature conditions
//double _delta_h ; // delta_h for one-phase/two-phase discrimination
//ExternalSaturationProperties *_satPropsClose2Crit; // saturation properties close to critical conditions
CoolPropSolver::CoolPropSolver(const std::string &mediumName, const std::string &libraryName, const std::string &substanceName)
: BaseSolver(mediumName, libraryName, substanceName){
// Fluid name can be used to pass in other parameters.
// The string can be composed like "Propane|enable_TTSE=1|calc_transport=0"
std::vector<std::string> name_options = strsplit(substanceName,'|');
// Set the defaults
fluidType = -1;
enable_TTSE = false;
enable_BICUBIC = false;
debug_level = 0;
calc_transport = true;
extend_twophase = true;
twophase_derivsmoothing_xend = 0;
rho_smoothing_xend = 0;
h_min = 0;
h_max = 0;
p_min = 0;
p_max = 0;
// Initialise the saturation and near-critical variables
_p_eps = 1e-3; // relative tolerance margin for subcritical pressure conditions
_delta_h = 1e-1; // delta_h for one-phase/two-phase discrimination
if (name_options.size()>1)
{
for (unsigned int i = 1; i<name_options.size(); i++)
{
// Split around the equals sign
std::vector<std::string> param_val = strsplit(name_options[i],'=');
if (param_val.size() != 2)
{
errorMessage((char*)format("Could not parse the option [%s], must be in the form param=value",name_options[i].c_str()).c_str());
}
// Check each of the options in turn
if (!param_val[0].compare("enable_TTSE"))
{
if (!param_val[1].compare("1") || !param_val[1].compare("true"))
{
std::cout << "TTSE is on\n";
enable_TTSE = true;
}
else if (!param_val[1].compare("0") || !param_val[1].compare("false"))
{
std::cout << "TTSE is off\n";
enable_TTSE = false;
}
else
errorMessage((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
//throw NotImplementedError((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
}
else if (!param_val[0].compare("enable_BICUBIC"))
{
if (!param_val[1].compare("1") || !param_val[1].compare("true"))
{
std::cout << "BICUBIC is on\n";
enable_BICUBIC = true;
}
else if (!param_val[1].compare("0") || !param_val[1].compare("false"))
{
std::cout << "BICUBIC is off\n";
enable_BICUBIC = false;
}
else
errorMessage((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
//throw NotImplementedError((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
}
//Added this to prevent regenerating the LUT tables
else if (!param_val[0].compare("h_min"))
{
if (enable_BICUBIC)
{
h_min = strtod(param_val[1].c_str(),NULL);
}
}
else if (!param_val[0].compare("h_max"))
{
if (enable_BICUBIC)
{
h_max = strtod(param_val[1].c_str(),NULL);
}
}
else if (!param_val[0].compare("p_min"))
{
if (enable_BICUBIC)
{
p_min = strtod(param_val[1].c_str(),NULL);
}
}
else if (!param_val[0].compare("p_max"))
{
if (enable_BICUBIC)
{
p_max = strtod(param_val[1].c_str(),NULL);
}
}
// End addition
else if (!param_val[0].compare("calc_transport"))
{
if (!param_val[1].compare("1") || !param_val[1].compare("true"))
calc_transport = true;
else if (!param_val[1].compare("0") || !param_val[1].compare("false"))
calc_transport = false;
else
errorMessage((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
}
else if (!param_val[0].compare("enable_EXTTP"))
{
if (!param_val[1].compare("1") || !param_val[1].compare("true"))
extend_twophase = true;
else if (!param_val[1].compare("0") || !param_val[1].compare("false"))
extend_twophase = false;
else
errorMessage((char*)format("I don't know how to handle this option [%s]",name_options[i].c_str()).c_str());
}
else if (!param_val[0].compare("twophase_derivsmoothing_xend"))
{
twophase_derivsmoothing_xend = strtod(param_val[1].c_str(),NULL);
if (twophase_derivsmoothing_xend<0 || twophase_derivsmoothing_xend > 1)
errorMessage((char*)format("I don't know how to handle this twophase_derivsmoothing_xend value [%d]",param_val[0].c_str()).c_str());
}
else if (!param_val[0].compare("rho_smoothing_xend"))
{
rho_smoothing_xend = strtod(param_val[1].c_str(),NULL);
if (rho_smoothing_xend<0 || rho_smoothing_xend > 1)
errorMessage((char*)format("I don't know how to handle this rho_smoothing_xend value [%d]",param_val[0].c_str()).c_str());
}
else if (!param_val[0].compare("debug"))
{
debug_level = (int)strtol(param_val[1].c_str(),NULL,0);
if (debug_level<0 || debug_level > 1000) {
errorMessage((char*)format("I don't know how to handle this debug level [%s]",param_val[0].c_str()).c_str());
} else {
// TODO: Fix this segmentation fault!
//set_debug_level(debug_level);
}
}
else
{
errorMessage((char*)format("This option [%s] was not understood",name_options[i].c_str()).c_str());
}
// Some options were passed in, lets see what we have
std::cout << param_val[0] << " has the value of " << param_val[1] << std::endl;
}
}
// Handle the name and fill the fluid type
if (debug_level > 5) std::cout << "Checking fluid " << name_options[0] << " against database." << std::endl;
fluidType = getFluidType(name_options[0]); // Throws an error if unknown fluid
if (debug_level > 5) std::cout << "Check passed, reducing " << substanceName << " to " << name_options[0] << std::endl;
this->substanceName = name_options[0];
state = new CoolPropStateClassSI(name_options[0]);
this->setFluidConstants();
}
CoolPropSolver::~CoolPropSolver(){
delete state;
//delete _satPropsClose2Crit;
};
void CoolPropSolver::setFluidConstants(){
if ((fluidType==FLUID_TYPE_PURE)||(fluidType==FLUID_TYPE_PSEUDOPURE)||(fluidType==FLUID_TYPE_REFPROP)){
if (debug_level > 5) std::cout << format("Setting constants for fluid %s \n",substanceName.c_str());
_fluidConstants.pc = PropsSI((char *)"pcrit" ,(char *)"T",0,(char *)"P",0,(char *)substanceName.c_str());
_fluidConstants.Tc = PropsSI((char *)"Tcrit" ,(char *)"T",0,(char *)"P",0,(char *)substanceName.c_str());
_fluidConstants.MM = PropsSI((char *)"molemass",(char *)"T",0,(char *)"P",0,(char *)substanceName.c_str());
/* TODO: Fix this dirty, dirty workaround */
if (_fluidConstants.MM > 1.0) _fluidConstants.MM *= 1e-3;
_fluidConstants.dc = PropsSI((char *)"rhocrit" ,(char *)"T",0,(char *)"P",0,(char *)substanceName.c_str());
// Now we fill the close to crit record
if (debug_level > 5) std::cout << format("Setting near-critical saturation conditions for fluid %s \n",substanceName.c_str());
_satPropsClose2Crit.psat = _fluidConstants.pc*(1.0-_p_eps); // Needs update, setSat_p relies on it
setSat_p(_satPropsClose2Crit.psat, &_satPropsClose2Crit);
}
else if ((fluidType==FLUID_TYPE_INCOMPRESSIBLE_LIQUID)||(fluidType==FLUID_TYPE_INCOMPRESSIBLE_SOLUTION)){
if (debug_level > 5) std::cout << format("Setting constants for incompressible fluid %s \n",substanceName.c_str());
_fluidConstants.pc = NAN;
_fluidConstants.Tc = NAN;
_fluidConstants.MM = NAN;// throws a warning in Modelica
_fluidConstants.dc = NAN;
}
}
void CoolPropSolver::preStateChange(void) {
/// Some common code to avoid pitfalls from incompressibles
if ((fluidType==FLUID_TYPE_PURE)||(fluidType==FLUID_TYPE_PSEUDOPURE)||(fluidType==FLUID_TYPE_REFPROP)){
try {
if (enable_TTSE)
state->enable_TTSE_LUT();
else
state->disable_TTSE_LUT();
if (enable_BICUBIC)
{
//Added this to prevent creating tables based on user input or maybe
//if (h_min != 0 || h_max != 0 || p_min != 0 || p_max != 0)
state->set_TTSESinglePhase_LUT_range(h_min,h_max,p_min,p_max);
//errorMessage((char*)"Billy bob howdy");
// End addition
state->enable_TTSE_LUT();
state->pFluid->TTSESinglePhase.set_mode(TTSE_MODE_BICUBIC);
}
if (extend_twophase)
state->enable_EXTTP();
else
state->disable_EXTTP();
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
std::cout << format("Exception from state object: %s \n",(char*)e.what());
}
}
}
void CoolPropSolver::postStateChange(ExternalThermodynamicState *const properties) {
/// Some common code to avoid pitfalls from incompressibles
switch (fluidType) {
case FLUID_TYPE_PURE:
case FLUID_TYPE_PSEUDOPURE:
case FLUID_TYPE_REFPROP:
try{
// Set the values in the output structure
properties->p = state->p();
properties->T = state->T();
properties->d = state->rho();
properties->h = state->h();
properties->s = state->s();
if (state->TwoPhase){
properties->phase = 2;
}
else{
properties->phase = 1;
}
properties->cp = state->cp();
properties->cv = state->cv();
properties->a = state->speed_sound();
if (state->TwoPhase && state->Q() >= 0 && state->Q() <= twophase_derivsmoothing_xend && twophase_derivsmoothing_xend > 0.0)
{
// Use the smoothed derivatives between a quality of 0 and twophase_derivsmoothing_xend
properties->ddhp = state->drhodh_constp_smoothed(twophase_derivsmoothing_xend); // [1/kPa -- > 1/Pa]
properties->ddph = state->drhodp_consth_smoothed(twophase_derivsmoothing_xend); // [1/(kJ/kg) -- > 1/(J/kg)]
}
else if (state->TwoPhase && state->Q() >= 0 && state->Q() <= rho_smoothing_xend && rho_smoothing_xend > 0.0)
{
// Use the smoothed density between a quality of 0 and rho_smoothing_xend
double rho_spline;
double dsplinedh;
double dsplinedp;
state->rho_smoothed(rho_smoothing_xend, rho_spline, dsplinedh, dsplinedp) ;
properties->ddhp = dsplinedh;
properties->ddph = dsplinedp;
properties->d = rho_spline;
}
else
{
properties->ddhp = state->drhodh_constp();
properties->ddph = state->drhodp_consth();
}
properties->kappa = state->isothermal_compressibility();
properties->beta = state->isobaric_expansion_coefficient();
if (calc_transport)
{
properties->eta = state->viscosity();
properties->lambda = state->conductivity(); //[kW/m/K --> W/m/K]
} else {
properties->eta = NAN;
properties->lambda = NAN;
}
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
break;
case FLUID_TYPE_INCOMPRESSIBLE_LIQUID:
case FLUID_TYPE_INCOMPRESSIBLE_SOLUTION:
try{
// Set the values in the output structure
properties->p = state->p();
properties->T = state->T();
properties->d = state->rho();
properties->h = state->h();
properties->s = state->s();
properties->phase = 1;
properties->cp = state->cp();
properties->cv = state->cv();
properties->a = NAN;
properties->ddhp = state->drhodh_constp();
properties->ddph = 0.0; // TODO: Fix this
properties->kappa = NAN;
properties->beta = NAN;
if (calc_transport)
{
properties->eta = state->viscosity();
properties->lambda = state->conductivity(); //[kW/m/K --> W/m/K]
} else {
properties->eta = NAN;
properties->lambda = NAN;
}
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
break;
default:
errorMessage((char*)"Invalid fluid type!");
break;
}
if (debug_level > 50) std::cout << format("At the end of %s \n","postStateChange");
if (debug_level > 50) std::cout << format("Setting pressure to %f \n",properties->p);
if (debug_level > 50) std::cout << format("Setting temperature to %f \n",properties->T);
if (debug_level > 50) std::cout << format("Setting density to %f \n",properties->d);
if (debug_level > 50) std::cout << format("Setting enthalpy to %f \n",properties->h);
if (debug_level > 50) std::cout << format("Setting entropy to %f \n",properties->s);
}
void CoolPropSolver::setSat_p(double &p, ExternalSaturationProperties *const properties){
if (debug_level > 5)
std::cout << format("setSat_p(%0.16e)\n",p);
if (p > _satPropsClose2Crit.psat) { // supercritical conditions
properties->Tsat = _satPropsClose2Crit.Tsat; // saturation temperature
properties->dTp = _satPropsClose2Crit.dTp; // derivative of Ts by pressure
properties->ddldp = _satPropsClose2Crit.ddldp; // derivative of dls by pressure
properties->ddvdp = _satPropsClose2Crit.ddvdp; // derivative of dvs by pressure
properties->dhldp = _satPropsClose2Crit.dhldp; // derivative of hls by pressure
properties->dhvdp = _satPropsClose2Crit.dhvdp; // derivative of hvs by pressure
properties->dl = _satPropsClose2Crit.dl; // bubble density
properties->dv = _satPropsClose2Crit.dv; // dew density
properties->hl = _satPropsClose2Crit.hl; // bubble specific enthalpy
properties->hv = _satPropsClose2Crit.hv; // dew specific enthalpy
properties->psat = _satPropsClose2Crit.psat; // saturation pressure
properties->sigma = _satPropsClose2Crit.sigma; // Surface tension
properties->sl = _satPropsClose2Crit.sl; // Specific entropy at bubble line (for pressure ps)
properties->sv = _satPropsClose2Crit.sv; // Specific entropy at dew line (for pressure ps)
} else {
this->preStateChange();
try {
state->update(iP,p,iQ,0); // quality only matters for pseudo-pure fluids
//! Saturation temperature
properties->Tsat = state->TL(); // Not correct for pseudo-pure fluids
//! Derivative of Ts wrt pressure
properties->dTp = state->dTdp_along_sat();
//! Derivative of dls wrt pressure
properties->ddldp = state->drhodp_along_sat_liquid();
//! Derivative of dvs wrt pressure
properties->ddvdp = state->drhodp_along_sat_vapor();
//! Derivative of hls wrt pressure
properties->dhldp = state->dhdp_along_sat_liquid();
//! Derivative of hvs wrt pressure
properties->dhvdp = state->dhdp_along_sat_vapor();
//! Density at bubble line (for pressure ps)
properties->dl = state->rhoL();
//! Density at dew line (for pressure ps)
properties->dv = state->rhoV();
//! Specific enthalpy at bubble line (for pressure ps)
properties->hl = state->hL();
//! Specific enthalpy at dew line (for pressure ps)
properties->hv = state->hV();
//! Saturation pressure
properties->psat = p;
//! Surface tension
properties->sigma = state->surface_tension();
//! Specific entropy at bubble line (for pressure ps)
properties->sl = state->sL();
//! Specific entropy at dew line (for pressure ps)
properties->sv = state->sV();
} catch(std::exception &e) {
errorMessage((char*)e.what());
}
}
}
void CoolPropSolver::setSat_T(double &T, ExternalSaturationProperties *const properties){
if (debug_level > 5)
std::cout << format("setSat_T(%0.16e)\n",T);
if (T > _satPropsClose2Crit.Tsat) { // supercritical conditions
properties->Tsat = _satPropsClose2Crit.Tsat; // saturation temperature
properties->dTp = _satPropsClose2Crit.dTp; // derivative of Ts by pressure
properties->ddldp = _satPropsClose2Crit.ddldp; // derivative of dls by pressure
properties->ddvdp = _satPropsClose2Crit.ddvdp; // derivative of dvs by pressure
properties->dhldp = _satPropsClose2Crit.dhldp; // derivative of hls by pressure
properties->dhvdp = _satPropsClose2Crit.dhvdp; // derivative of hvs by pressure
properties->dl = _satPropsClose2Crit.dl; // bubble density
properties->dv = _satPropsClose2Crit.dv; // dew density
properties->hl = _satPropsClose2Crit.hl; // bubble specific enthalpy
properties->hv = _satPropsClose2Crit.hv; // dew specific enthalpy
properties->psat = _satPropsClose2Crit.psat; // saturation pressure
properties->sigma = _satPropsClose2Crit.sigma; // Surface tension
properties->sl = _satPropsClose2Crit.sl; // Specific entropy at bubble line (for pressure ps)
properties->sv = _satPropsClose2Crit.sv; // Specific entropy at dew line (for pressure ps)
} else {
this->preStateChange();
try
{
state->update(iT,T,iQ,0); // Quality only matters for pseudo-pure fluids
properties->Tsat = T;
properties->psat = state->pL();
properties->dl = state->rhoL();
properties->dv = state->rhoV();
properties->hl = state->hL();
properties->hv = state->hV();
properties->dTp = state->dTdp_along_sat();
properties->ddldp = state->drhodp_along_sat_liquid();
properties->ddvdp = state->drhodp_along_sat_vapor();
properties->dhldp = state->dhdp_along_sat_liquid();
properties->dhvdp = state->dhdp_along_sat_vapor();
properties->sigma = state->surface_tension(); // Surface tension
properties->sl = state->sL(); // Specific entropy at bubble line (for pressure ps)
properties->sv = state->sV(); // Specific entropy at dew line (for pressure ps)
} catch(std::exception &e) {
errorMessage((char*)e.what());
}
}
}
/// Set bubble state
void CoolPropSolver::setBubbleState(ExternalSaturationProperties *const properties, int phase, ExternalThermodynamicState *const bubbleProperties){
double hl;
if (phase == 0)
hl = properties->hl;
else if (phase == 1) // liquid phase
hl = properties->hl-_delta_h;
else // two-phase mixture
hl = properties->hl+_delta_h;
setState_ph(properties->psat, hl, phase, bubbleProperties);
}
/// Set dew state
void CoolPropSolver::setDewState(ExternalSaturationProperties *const properties, int phase, ExternalThermodynamicState *const dewProperties){
double hv;
if (phase == 0)
hv = properties->hv;
else if (phase == 1) // gaseous phase
hv = properties->hv+_delta_h;
else // two-phase mixture
hv = properties->hv-_delta_h;
setState_ph(properties->psat, hv, phase, dewProperties);
}
// Note: the phase input is currently not supported
void CoolPropSolver::setState_ph(double &p, double &h, int &phase, ExternalThermodynamicState *const properties){
if (debug_level > 5)
std::cout << format("setState_ph(p=%0.16e,h=%0.16e)\n",p,h);
this->preStateChange();
try{
// Update the internal variables in the state instance
state->update(iP,p,iH,h);
if (!ValidNumber(state->rho()) || !ValidNumber(state->T()))
{
throw ValueError(format("p-h [%g, %g] failed for update",p,h));
}
// Set the values in the output structure
this->postStateChange(properties);
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
}
void CoolPropSolver::setState_pT(double &p, double &T, ExternalThermodynamicState *const properties){
if (debug_level > 5)
std::cout << format("setState_pT(p=%0.16e,T=%0.16e)\n",p,T);
this->preStateChange();
try{
// Update the internal variables in the state instance
state->update(iP,p,iT,T);
// Set the values in the output structure
this->postStateChange(properties);
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
}
// Note: the phase input is currently not supported
void CoolPropSolver::setState_dT(double &d, double &T, int &phase, ExternalThermodynamicState *const properties)
{
if (debug_level > 5)
std::cout << format("setState_dT(d=%0.16e,T=%0.16e)\n",d,T);
this->preStateChange();
try{
// Update the internal variables in the state instance
state->update(iD,d,iT,T);
// Set the values in the output structure
this->postStateChange(properties);
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
}
// Note: the phase input is currently not supported
void CoolPropSolver::setState_ps(double &p, double &s, int &phase, ExternalThermodynamicState *const properties){
if (debug_level > 5)
std::cout << format("setState_ps(p=%0.16e,s=%0.16e)\n",p,s);
this->preStateChange();
try{
// Update the internal variables in the state instance
state->update(iP,p,iS,s);
// Set the values in the output structure
this->postStateChange(properties);
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
}
// Note: the phase input is currently not supported
void CoolPropSolver::setState_hs(double &h, double &s, int &phase, ExternalThermodynamicState *const properties){
if (debug_level > 5)
std::cout << format("setState_hs(h=%0.16e,s=%0.16e)\n",h,s);
this->preStateChange();
try{
// Update the internal variables in the state instance
state->update(iH,h,iS,s);
// Set the values in the output structure
this->postStateChange(properties);
}
catch(std::exception &e)
{
errorMessage((char*)e.what());
}
}
double CoolPropSolver::partialDeriv_state(const string &of, const string &wrt, const string &cst, ExternalThermodynamicState *const properties){
if (debug_level > 5)
std::cout << format("partialDeriv_state(of=%s,wrt=%s,cst=%s,state)\n",of.c_str(),wrt.c_str(),cst.c_str());
long derivTerm = makeDerivString(of,wrt,cst);
double res = NAN;
try{
//res = DerivTerms(derivTerm, properties->d, properties->T, this->substanceName);
state->update(iT,properties->T,iD,properties->d);
// Get the output value
res = state->keyed_output(derivTerm);
} catch(std::exception &e) {
errorMessage((char*)e.what());
}
return res;
}
long CoolPropSolver::makeDerivString(const string &of, const string &wrt, const string &cst){
std::string derivTerm;
if (!of.compare("d")){ derivTerm = "drho"; }
else if (!of.compare("p")){ derivTerm = "dp"; }
else {
errorMessage((char*) format("Internal error: Derivatives of %s are not defined in the Solver object.",of.c_str()).c_str());
}
if (!wrt.compare("p")){ derivTerm.append("dp"); }
else if (!wrt.compare("h")){ derivTerm.append("dh"); }
else if (!wrt.compare("T")){ derivTerm.append("dT"); }
else {
errorMessage((char*) format("Internal error: Derivatives with respect to %s are not defined in the Solver object.",wrt.c_str()).c_str());
}
if (!cst.compare("p")){ derivTerm.append("|p"); }
else if (!cst.compare("h")){ derivTerm.append("|h"); }
else if (!cst.compare("d")){ derivTerm.append("|rho"); }
else {
errorMessage((char*) format("Internal error: Derivatives at constant %s are not defined in the Solver object.",cst.c_str()).c_str());
}
long iOutput = get_param_index(derivTerm);
return iOutput;
}
double CoolPropSolver::Pr(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: Pr() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: Pr() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::T(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: T() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: T() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::a(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: a() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: a() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::beta(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: beta() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: beta() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::cp(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: cp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: cp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::cv(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: cv() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: cv() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::d(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: d() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: d() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::ddhp(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: ddhp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: ddhp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::ddph(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: ddph() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: ddph() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::eta(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: eta() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: eta() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::h(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: h() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: h() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::kappa(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: kappa() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: kappa() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::lambda(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: lambda() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: lambda() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::p(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: p() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: p() not implemented in the Solver object");
return NAN;
}
int CoolPropSolver::phase(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: phase() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: phase() not implemented in the Solver object");
return -1;
}
double CoolPropSolver::s(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: s() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: s() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::d_der(ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: d_der() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: d_der() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::isentropicEnthalpy(double &p, ExternalThermodynamicState *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: isentropicEnthalpy() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: isentropicEnthalpy() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::dTp(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: dTp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: dTp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::ddldp(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: ddldp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: ddldp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::ddvdp(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: ddvdp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: ddvdp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::dhldp(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: dhldp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: dhldp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::dhvdp(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: dhvdp() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: dhvdp() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::dl(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: dl() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: dl() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::dv(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: dv() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: dv() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::hl(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: hl() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: hl() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::hv(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: hv() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: hv() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::sigma(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: sigma() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: sigma() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::sl(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: sl() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: sl() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::sv(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: sv() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: sv() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::psat(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: psat() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: psat() not implemented in the Solver object");
return NAN;
}
double CoolPropSolver::Tsat(ExternalSaturationProperties *const properties){
// Base function returns an error if called - should be redeclared by the solver object
errorMessage((char*)"Internal error: Tsat() not implemented in the Solver object");
//throw NotImplementedError((char*)"Internal error: Tsat() not implemented in the Solver object");
return NAN;
}
| [
"[email protected]"
] | |
48cdfd82c993c8cbac7526caf38c4d2e9e25b47f | 502e52aceef042af9c1a452f450b9263a1b667dc | /1699_c++.cpp | b070e390728bd8e5679377a672ed8912474745e6 | [] | no_license | kokihoon/algorithm | 4794a512f2e3d80ae38ce99da47314d5c78d212d | 6dbeabf07d384aebb1b38c61b699b50a0395c443 | refs/heads/master | 2021-07-22T09:42:18.397174 | 2019-01-22T12:49:56 | 2019-01-22T12:49:56 | 91,547,284 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 366 | cpp | #include <iostream>
using namespace std;
int main() {
int d[100001] = {0,};
int num;
cin >> num;
for(int i = 1; i <= num; i++) {
for(int j = 1; j*j <= i; j++) {
if(d[i] > d[i-j*j] + 1 || d[i] == 0) {
d[i] = d[i-j*j] +1;
}
}
}
cout << d[num] << '\n';
return 0;
} | [
"[email protected]"
] | |
11df95b2e11a35f73d076889dba2774cfed0c42a | 791b0a4c197ed32491d0988ae37c2aca633aa832 | /lab6/Menu.h | 1d5d66925b0c6c4884976316882fb80d006472db | [] | no_license | ShuhengLi/2018 | eab4e1cdbfcbaad60c0e29467e912ad531351d3a | 6c6155e0f44dc28782b14b94534a9e7cbf4e785c | refs/heads/master | 2021-05-02T10:24:39.939546 | 2018-02-20T21:25:36 | 2018-02-20T21:25:36 | 120,795,479 | 0 | 0 | null | 2018-02-20T21:25:37 | 2018-02-08T17:42:24 | C++ | UTF-8 | C++ | false | false | 428 | h | //
// Created by Shuheng Li on 2/12/18.
//
#ifndef LAB6_MENU_H
#define LAB6_MENU_H
#include "DoubleLinkedList.h"
#include <memory>
class Menu {
std::shared_ptr<DoubleLinkedList> list;
int choice;
void addHead();
void addTail();
void deleteHead();
void deleteTail();
void listBackward();
void showInfo();
public:
Menu();
void action();
bool keepPlaying();
};
#endif //LAB6_MENU_H
| [
"[email protected]"
] | |
a8278c94640ee432cdb67e7ef43f3693d1785525 | 73e7c20803be5d8ae467af1feba8a4a7fe219f4b | /Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.h | 321680aeee52cc2e66163f51048255f525693395 | [
"LicenseRef-scancode-other-permissive",
"SMLNJ",
"BSD-3-Clause",
"LicenseRef-scancode-mit-old-style",
"LicenseRef-scancode-free-unknown",
"BSD-4.3TAHOE",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"IJG",
"Zlib",
"Spencer-86",
"libtiff",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-public-domain",
"NTP",
"BSD-2-Clause",
"GPL-1.0-or-later",
"FSFUL",
"Libpng"
] | permissive | CIBC-Internal/itk | deaa8aabe3995f3465ec70a46805bd333967ed5b | 6f7b1014a73857115d6da738583492008bea8205 | refs/heads/master | 2021-01-10T18:48:58.502855 | 2018-01-26T21:25:51 | 2018-01-26T21:25:51 | 31,582,564 | 0 | 2 | Apache-2.0 | 2018-05-21T07:59:53 | 2015-03-03T06:12:12 | C++ | UTF-8 | C++ | false | false | 5,976 | h | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 GDCMCOMPOSITENETWORKFUNCTIONS_H
#define GDCMCOMPOSITENETWORKFUNCTIONS_H
#include "gdcmDirectory.h"
#include "gdcmBaseRootQuery.h" // EQueryLevel / EQueryType
#include <vector>
#include <string>
namespace gdcm
{
/**
* \brief Composite Network Functions
* These functions provide a generic API to the DICOM functions implemented in
* GDCM.
* Advanced users can use this code as a template for building their own
* versions of these functions (for instance, to provide progress bars or some
* other way of handling returned query information), but for most users, these
* functions should be sufficient to interface with a PACS to a local machine.
* Note that these functions are not contained within a static class or some
* other class-style interface, because multiple connections can be
* instantiated in the same program. The DICOM standard is much more function
* oriented rather than class oriented in this instance, so the design of this
* API reflects that functional approach.
* These functions implements the following SCU operations:
* \li C-ECHO SCU
* \li C-FIND SCU
* \li C-STORE SCU
* \li C-MOVE SCU (+internal C-STORE SCP)
*/
class GDCM_EXPORT CompositeNetworkFunctions
{
public:
/// The most basic network function. Use this function to ensure that the
/// remote server is responding on the given IP and port number as expected.
/// \param aetitle when not set will default to 'GDCMSCU'
/// \param call when not set will default to 'ANY-SCP'
/// \warning This is an error to set remote to NULL or portno to 0
/// \return true if it worked.
static bool CEcho( const char *remote, uint16_t portno, const char *aetitle = NULL,
const char *call = NULL );
typedef std::pair<Tag, std::string> KeyValuePairType;
typedef std::vector< KeyValuePairType > KeyValuePairArrayType;
/// This function will take a list of strings and tags and fill in a query that
/// can be used for either CFind or CMove (depending on the input boolean
/// \param inMove).
/// Note that the caller is responsible for deleting the constructed query.
/// This function is used to build both a move and a find query
/// (true for inMove if it's move, false if it's find)
static BaseRootQuery* ConstructQuery(ERootType inRootType, EQueryLevel inQueryLevel,
const DataSet& queryds, EQueryType queryType = eFind );
/// \deprecated
static BaseRootQuery* ConstructQuery(ERootType inRootType, EQueryLevel inQueryLevel,
const KeyValuePairArrayType& keys, EQueryType queryType = eFind );
/// This function will use the provided query to get files from a remote server.
/// NOTE that this functionality is essentially equivalent to C-GET in the
/// DICOM standard; however, C-GET has been deprecated, so this function
/// allows for the user to ask a remote server for files matching a query and
/// return them to the local machine.
/// Files will be written to the given output directory.
/// If the operation succeeds, the function returns true.
/// This function is a prime candidate for being overwritten by expert users;
/// if the datasets should remain in memory, for instance, that behavior can
/// be changed by creating a user-level version of this function.
/// \param aetitle when not set will default to 'GDCMSCU'
/// \param call when not set will default to 'ANY-SCP'
/// This is an error to set remote to NULL or portno to 0
/// when \param outputdir is not set default to current dir ('.')
/// \return true if it worked.
static bool CMove( const char *remote, uint16_t portno, const BaseRootQuery* query,
uint16_t portscp, const char *aetitle = NULL,
const char *call = NULL, const char *outputdir = NULL);
/// This function will use the provided query to determine what files a remote
/// server contains that match the query strings. The return is a vector of
/// datasets that contain tags as reported by the server. If the dataset is
/// empty, then it is possible that an error condition was encountered; in
/// which case, the user should monitor the error and warning streams.
/// \param aetitle when not set will default to 'GDCMSCU'
/// \param call when not set will default to 'ANY-SCP'
/// \warning This is an error to set remote to NULL or portno to 0
/// \return true if it worked.
static bool CFind( const char *remote, uint16_t portno,
const BaseRootQuery* query,
std::vector<DataSet> &retDataSets,
const char *aetitle = NULL,
const char *call = NULL );
/// This function will place the provided files into the remote server.
/// The function returns true if it worked for all files.
/// \warning the server side can refuse an association on a given file
/// \param aetitle when not set will default to 'GDCMSCU'
/// \param call when not set will default to 'ANY-SCP'
/// \warning This is an error to set remote to NULL or portno to 0
/// \return true if it worked for all files
static bool CStore( const char *remote, uint16_t portno,
const Directory::FilenamesType & filenames,
const char *aetitle = NULL, const char *call = NULL);
};
} // end namespace gdcm
#endif // GDCMCOMPOSITENETWORKFUNCTIONS_H
| [
"[email protected]"
] | |
2dbe81fe98ecad3948ec7871cc15556ef26ea171 | 45cabaa649825d533f487bb9074ec2e855571d2b | /sgu/100_A+B.cpp | 242594207795ef76deabe51cda1e4a96b0e9fa4d | [
"MIT"
] | permissive | atupal/oj | 511cd1849e2488c48f1a0028c6a37e0a711f2f43 | 2c85a65c57a504bc47e95d2dd7fae62115442be1 | refs/heads/master | 2021-01-22T06:29:11.702813 | 2019-06-09T08:14:43 | 2019-06-09T08:14:43 | 21,880,941 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 109 | cpp | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", a+b);
return 0;
}
| [
"[email protected]"
] | |
4aa73f72cbacf3e5c12a5a869d2d0b6eb08c2f1e | cb6b7e15efd75a696f5144701e584f734ff1b713 | /chapter 3/3.4.4 大整数的加减乘除.cpp | 220c287e045061a1325481d5175a3349bbd24fd1 | [] | no_license | Zhulinjiuying/C-Plus-homework | 7d9d523eb282c996b7a176f0c8ca7d44997114d2 | 74aaef369e280c028f7bdc86528c6eb30e23c9e3 | refs/heads/master | 2021-08-07T05:02:48.054957 | 2017-11-07T15:58:07 | 2017-11-07T15:58:07 | 109,857,223 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,454 | cpp | #include <iostream>
#include <string.h>
using namespace std;
class Error {
public:
Error(char* r) :reason(r) {}
char* what() { return reason; }
private:
char* reason;
};
const int IntegerLen = 1000;
class Integer {
public:
Integer(int num = 0);
Integer(const Integer& obj);
Integer operator = (const Integer& another);
Integer operator + (const Integer& another) const;
Integer operator - (const Integer& another) const;
Integer operator - () const;
Integer operator * (const Integer& another) const;
Integer operator / (const Integer& another) const;
Integer operator % (const Integer& another) const;
bool operator > (const Integer& another) const;
bool operator < (const Integer& another) const;
bool operator == (const Integer& another) const;
bool operator != (const Integer& another) const;
bool operator >= (const Integer& another) const;
bool operator <= (const Integer& another) const;
friend ostream& operator << (ostream& stream, const Integer& obj);
friend istream& operator >> (istream& stream, Integer& obj);
private:
Integer absolute() const;
int IntegerLength() const;
void augment(int n);
int& operator [] (int index);
const int& operator [] (int index) const;
int NumArray[IntegerLen];
int sign;
};
Integer::Integer(int num)
{
if (num<0) {
sign = -1;
num = -num;
}
else sign = 1;
for (int i = 0; i<IntegerLen; i++) {
(*this)[i] = num % 10;
num /= 10;
}
return;
}
Integer::Integer(const Integer& obj)
{
sign = obj.sign;
for (int i = 0; i<IntegerLen; i++) (*this)[i] = obj[i];
return;
}
Integer Integer::operator = (const Integer& another)
{
int i;
(*this).sign = another.sign;
for (i = 0; i<IntegerLen; i++)
(*this)[i] = another[i];
return *this;
}
Integer Integer::operator + (const Integer& another) const
{
int i;
Integer result;
if (sign == another.sign) {
for (i = 0; i<IntegerLen; i++) {
result[i] = (*this)[i] + another[i] + result[i];
while (result[i] >= 10) {
result[i] -= 10;
result[i + 1]++;
}
}
result.sign = (*this).sign;
}
else result = (*this) - (-another);
return result;
}
Integer Integer::operator - (const Integer& another) const
{
int i;
Integer result;
const Integer *max, *min;
if ((*this) == another) return Integer(0);
if (sign == another.sign) {
if ((*this).absolute()>another.absolute()) {
max = this;
min = &another;
}
else {
max = &another;
min = this;
}
for (i = 0; i<IntegerLen; i++) {
result[i] = (*max)[i] - (*min)[i] + result[i];
while (result[i]<0) {
result[i] += 10;
result[i + 1]--;
}
}
if (max == this) result.sign = (*this).sign;
else result.sign = -(*this).sign;
}
else {
result = (*this) + (-another);
}
return result;
}
Integer Integer::operator - () const
{
Integer result;
result = *this;
if (result != Integer(0))
result.sign = -sign;
return result;
}
Integer Integer::operator * (const Integer& another) const
{
Integer result, temp;
int i, j;
if ((*this) == 0 || another == 0) return result;
for (i = 0; i<IntegerLen; i++) {
temp = Integer(0);
for (j = 0; j<IntegerLen - i; j++) {
temp[i + j] = (*this)[i] * another[j] + temp[i + j];
while (temp[i] >= 10) {
temp[i] -= 10;
temp[i + 1]++;
}
}
result = result + temp;
}
if (sign == another.sign) result.sign = 1;
else result.sign = -1;
return result;
}
Integer Integer::operator / (const Integer& another) const
{
if (another == Integer(0)) throw Error("Divisor can't be zero!");
int i, j, margin;
Integer result, dividend = (*this).absolute(), divisor = another.absolute();
if (divisor>dividend) return Integer(0);
i = IntegerLength();
j = another.IntegerLength();
margin = i - j;
divisor.augment(margin);
while (margin >= 0) {
if (dividend >= divisor) {
dividend = dividend - divisor;
result.NumArray[IntegerLen - margin - 1]++;
}
else {
margin--;
divisor.augment(-1);
}
}
if (sign == another.sign) result.sign = 1;
else result.sign = -1;
return result;
}
Integer Integer::operator % (const Integer& another) const
{
Integer result;
result = (*this) - ((*this) / another)*another;
return result;
}
bool Integer::operator > (const Integer& another) const
{
int i;
if (sign>another.sign) return true;
else if (sign<another.sign) return false;
else if (sign == 1) {
for (i = IntegerLen - 1; i >= 0; i--)
if ((*this)[i]>another[i]) return true;
else if ((*this)[i]<another[i]) return false;
}
else {
for (i = IntegerLen - 1; i >= 0; i--)
if ((*this)[i]>another[i]) return false;
else if ((*this)[i]<another[i]) return true;
}
return false;
}
bool Integer::operator < (const Integer& another) const
{
int i;
if (sign>another.sign) return false;
else if (sign<another.sign) return true;
else if (sign == 1) {
for (i = IntegerLen - 1; i >= 0; i--)
if ((*this)[i]>another[i]) return false;
else if ((*this)[i]<another[i]) return true;
}
else {
for (i = IntegerLen - 1; i >= 0; i--)
if ((*this)[i]>another[i]) return true;
else if ((*this)[i]<another[i]) return false;
}
return false;
}
bool Integer::operator == (const Integer& another) const
{
if (!(*this>another) && !(*this<another)) return true;
else return false;
}
bool Integer::operator != (const Integer& another) const
{
if (*this == another) return false;
else return true;
}
bool Integer::operator >= (const Integer& another) const
{
if (*this<another) return false;
else return true;
}
bool Integer::operator <= (const Integer& another) const
{
if (*this>another) return false;
else return true;
}
ostream& operator << (ostream& stream, const Integer& obj)
{
int i;
if (obj.sign == -1) stream << '-';
for (i = 0; i<IntegerLen&&obj.NumArray[i] == 0; i++);
if (i == IntegerLen) stream << 0;
else for (; i<IntegerLen; i++) stream << obj.NumArray[i];
return stream;
}
istream& operator >> (istream& stream, Integer& obj)
{
int n, i;
char input[IntegerLen];
stream >> input;
n = strlen(input);
for (i = 0; n - i - 1>0; i++) {
if (input[n - i - 1]>'9' || input[n - i - 1]<'0') throw Error("Input Error!");
obj[i] = input[n - i - 1] - '0';
}
if (input[n - i - 1] == '-') obj.sign = -1;
else if (input[n - i - 1]>'9' || input[n - i - 1]<'0') throw Error("Input Error!");
else obj[i] = input[n - 1 - i++] - '0';
for (; i<IntegerLen; i++) obj[i] = 0;
return stream;
}
Integer Integer::absolute() const
{
Integer result;
result = *this;
result.sign = 1;
return result;
}
int Integer::IntegerLength() const
{
int i, result = 0;
for (i = 0; i<IntegerLen&&NumArray[i] == 0; i++);
result = IntegerLen - i;
return result;
}
void Integer::augment(int n)
{
int i;
if (n >= 0) {
for (i = 0; i<IntegerLen; i++)
if (i<IntegerLen - n) NumArray[i] = NumArray[i + n];
else NumArray[i] = 0;
}
else {
for (i = IntegerLen - 1; i >= 0; i--)
if (i >= -n) NumArray[i] = NumArray[i + n];
else NumArray[i] = 0;
}
}
int& Integer::operator [] (int index)
{
if (index<0 || index >= IntegerLen) throw Error("Out of Bounds!");
return NumArray[IntegerLen - index - 1];
}
const int& Integer::operator [] (int index) const
{
if (index<0 || index >= IntegerLen) throw Error("Out of Bounds!");
return NumArray[IntegerLen - index - 1];
}
int main() {
Integer a, b, c;
char op;
cin >> a >> op >> b;
if (op == '+') {
c = a + b;
}
else if (op == '-') {
c = a - b;
}
else if (op == '*') {
c = a * b;
}
else {
c = a / b;
}
cout << c;
return 0;
} | [
"[email protected]"
] | |
031eccb815395cd728694b36bebfa38cc11afbf7 | c9f6cbe1bab8799fde3ce663cb88e6620146b71f | /libraries/chain/include/graphene/chain/protocol/operations.hpp | bc82d05bd48a7707d219ad35584166cf06e25663 | [
"Apache-2.0"
] | permissive | f3chain/fff | e07a0d412e6eafb4ef721e717441ec9c55fc1f7a | 707bb1f0791206fe8f1ed9d610c1b6efa34d8bab | refs/heads/main | 2023-07-14T06:29:16.849163 | 2021-08-24T09:39:43 | 2021-08-24T09:39:43 | 399,410,201 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,602 | hpp | /* (c) 2016, 2021 FFF Services. For details refers to LICENSE.txt */
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* 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.
*/
#pragma once
#include <graphene/chain/protocol/account.hpp>
#include <graphene/chain/protocol/assert.hpp>
#include <graphene/chain/protocol/asset_ops.hpp>
#include <graphene/chain/protocol/custom.hpp>
#include <graphene/chain/protocol/proposal.hpp>
#include <graphene/chain/protocol/transfer.hpp>
#include <graphene/chain/protocol/vesting.hpp>
#include <graphene/chain/protocol/withdraw_permission.hpp>
#include <graphene/chain/protocol/miner.hpp>
#include <graphene/chain/protocol/decent.hpp>
#include <graphene/chain/protocol/subscription.hpp>
#include <graphene/chain/protocol/non_fungible_token.hpp>
namespace graphene { namespace chain {
/**
* @ingroup operations
*
* Defines the set of valid operations as a discriminated union type.
*/
typedef fc::static_variant<
transfer_obsolete_operation,
account_create_operation,
account_update_operation,
asset_create_operation,
asset_issue_operation,
asset_publish_feed_operation, //5
miner_create_operation,
miner_update_operation,
miner_update_global_parameters_operation,
proposal_create_operation,
proposal_update_operation, //10
proposal_delete_operation,
withdraw_permission_create_operation,
withdraw_permission_update_operation,
withdraw_permission_claim_operation,
withdraw_permission_delete_operation, //15
vesting_balance_create_operation,
vesting_balance_withdraw_operation,
custom_operation,
assert_operation,
content_submit_operation, //20
request_to_buy_operation,
leave_rating_and_comment_operation,
ready_to_publish_obsolete_operation,
proof_of_custody_operation,
deliver_keys_operation, //25
subscribe_operation,
subscribe_by_author_operation,
automatic_renewal_of_subscription_operation,
report_stats_operation,
set_publishing_manager_operation, //30
set_publishing_right_operation,
content_cancellation_operation,
asset_fund_pools_operation,
asset_reserve_operation,
asset_claim_fees_operation, //35
update_user_issued_asset_operation,
update_monitored_asset_operation,
ready_to_publish_operation,
transfer_operation,
update_user_issued_asset_advanced_operation, //40
non_fungible_token_create_definition_operation,
non_fungible_token_update_definition_operation,
non_fungible_token_issue_operation,
non_fungible_token_transfer_operation,
non_fungible_token_update_data_operation, //45
disallow_automatic_renewal_of_subscription_operation, // VIRTUAL
return_escrow_submission_operation, // VIRTUAL
return_escrow_buying_operation, // VIRTUAL
pay_seeder_operation, // VIRTUAL
finish_buying_operation, //50 // VIRTUAL
renewal_of_subscription_operation // VIRTUAL
> operation;
/// @} // operations group
/**
* Appends required authorites to the result vector. The authorities appended are not the
* same as those returned by get_required_auth
*
* @return a set of required authorities for \c op
*/
void operation_get_required_authorities( const operation& op,
boost::container::flat_set<account_id_type>& active,
boost::container::flat_set<account_id_type>& owner,
std::vector<authority>& other );
void operation_validate( const operation& op );
/**
* @brief necessary to support nested operations inside the proposal_create_operation
*/
struct op_wrapper
{
public:
op_wrapper(const operation& op = operation()):op(op){}
operation op;
};
} } // graphene::chain
FC_REFLECT_TYPENAME( graphene::chain::operation )
FC_REFLECT( graphene::chain::op_wrapper, (op) )
| [
"[email protected]"
] | |
c0b66728399ef04cc66a19f4a9e714f762953e7f | 67baab02cfda6c54a287d63d0874824cf15f3ba6 | /lib/algo/bucket_set_check.h | 00a5e3dfd37d39ba3e7214735cecc3ef937b851d | [
"MIT"
] | permissive | sogapalag/problems | a14eedd8cfcdb52661479c8c90e08737aaeeb32b | 0ea7d65448e1177f8b3f81124a82d187980d659c | refs/heads/master | 2021-01-12T17:49:52.007234 | 2020-08-18T14:51:40 | 2020-08-18T14:51:40 | 71,629,601 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 756 | h | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
// e.g. csacademy/candles
// problem: n bucket, with some capacity. wanna distribute k-color balls, #i-color = ci,
// s.t. no same color into same bucket.
// ensure cap is sorted-dec.
bool is_distributed(const vector<int>& cap, const vector<int>& c) {
int n = cap.size();
vector<ll> freq(n+2);
ll need = 0;
for (int x: c) {
if (x > n) return false;
need += x;
freq[x]++;
}
for (int i = n-1; i >= 0; i--) {
freq[i] += freq[i+1];
}
ll could = 0;
for (int i = 0; i < n; i++) {
could += min((ll)cap[i], freq[i+1]);
if (freq[i+1] > cap[i]) freq[i+2] += freq[i+1] - cap[i];
}
return could == need;
}
| [
"[email protected]"
] | |
d3bb1483a122f3b4506bc008d14857c9a6ea935f | 6b63c83a0bb53cfb3e9fe346aec74a940bb88c65 | /3rd/PhysX/PhysX_3.4/Include/characterkinematic/PxController.h | e5765ad33d7b208a7c6eb1d6899bf18e5eb76cbf | [] | no_license | StrongerSuperman/pvd_custom | c1723f31bcd89f80f13803e3fc13ec0d3869f54d | 1fbdd9a3612d6329f3a7433f43a44016fb19b8e3 | refs/heads/master | 2023-04-02T07:44:10.268292 | 2021-04-07T04:56:08 | 2021-04-07T04:56:08 | 294,263,633 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,275 | h | //
// 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 NVIDIA 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 ``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.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_CCT_CONTROLLER
#define PX_PHYSICS_CCT_CONTROLLER
/** \addtogroup character
@{
*/
#include "characterkinematic/PxCharacter.h"
#include "characterkinematic/PxExtended.h"
#include "characterkinematic/PxControllerObstacles.h"
#include "PxQueryFiltering.h"
#include "foundation/PxErrorCallback.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
/**
\brief The type of controller, eg box, sphere or capsule.
*/
struct PxControllerShapeType
{
enum Enum
{
/**
\brief A box controller.
@see PxBoxController PxBoxControllerDesc
*/
eBOX,
/**
\brief A capsule controller
@see PxCapsuleController PxCapsuleControllerDesc
*/
eCAPSULE,
eFORCE_DWORD = 0x7fffffff
};
};
class PxShape;
class PxScene;
class PxController;
class PxRigidDynamic;
class PxMaterial;
struct PxFilterData;
class PxQueryFilterCallback;
class PxControllerBehaviorCallback;
class PxObstacleContext;
class PxObstacle;
/**
\brief specifies how a CCT interacts with non-walkable parts.
This is only used when slopeLimit is non zero. It is currently enabled for static actors only, and not supported for spheres or capsules.
*/
struct PxControllerNonWalkableMode
{
enum Enum
{
ePREVENT_CLIMBING, //!< Stops character from climbing up non-walkable slopes, but doesn't move it otherwise
ePREVENT_CLIMBING_AND_FORCE_SLIDING //!< Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes
};
};
/**
\brief specifies which sides a character is colliding with.
*/
struct PxControllerCollisionFlag
{
enum Enum
{
eCOLLISION_SIDES = (1<<0), //!< Character is colliding to the sides.
eCOLLISION_UP = (1<<1), //!< Character has collision above.
eCOLLISION_DOWN = (1<<2) //!< Character has collision below.
};
};
/**
\brief Bitfield that contains a set of raised flags defined in PxControllerCollisionFlag.
@see PxControllerCollisionFlag
*/
typedef PxFlags<PxControllerCollisionFlag::Enum, PxU8> PxControllerCollisionFlags;
PX_FLAGS_OPERATORS(PxControllerCollisionFlag::Enum, PxU8)
/**
\brief Describes a controller's internal state.
*/
struct PxControllerState
{
PxVec3 deltaXP; //!< delta position vector for the object the CCT is standing/riding on. Not always match the CCT delta when variable timesteps are used.
PxShape* touchedShape; //!< Shape on which the CCT is standing
PxRigidActor* touchedActor; //!< Actor owning 'touchedShape'
ObstacleHandle touchedObstacleHandle; // Obstacle on which the CCT is standing
PxU32 collisionFlags; //!< Last known collision flags (PxControllerCollisionFlag)
bool standOnAnotherCCT; //!< Are we standing on another CCT?
bool standOnObstacle; //!< Are we standing on a user-defined obstacle?
bool isMovingUp; //!< is CCT moving up or not? (i.e. explicit jumping)
};
/**
\brief Describes a controller's internal statistics.
*/
struct PxControllerStats
{
PxU16 nbIterations;
PxU16 nbFullUpdates;
PxU16 nbPartialUpdates;
PxU16 nbTessellation;
};
/**
\brief Describes a generic CCT hit.
*/
struct PxControllerHit
{
PxController* controller; //!< Current controller
PxExtendedVec3 worldPos; //!< Contact position in world space
PxVec3 worldNormal; //!< Contact normal in world space
PxVec3 dir; //!< Motion direction
PxF32 length; //!< Motion length
};
/**
\brief Describes a hit between a CCT and a shape. Passed to onShapeHit()
@see PxUserControllerHitReport.onShapeHit()
*/
struct PxControllerShapeHit : public PxControllerHit
{
PxShape* shape; //!< Touched shape
PxRigidActor* actor; //!< Touched actor
PxU32 triangleIndex; //!< touched triangle index (only for meshes/heightfields)
};
/**
\brief Describes a hit between a CCT and another CCT. Passed to onControllerHit().
@see PxUserControllerHitReport.onControllerHit()
*/
struct PxControllersHit : public PxControllerHit
{
PxController* other; //!< Touched controller
};
/**
\brief Describes a hit between a CCT and a user-defined obstacle. Passed to onObstacleHit().
@see PxUserControllerHitReport.onObstacleHit() PxObstacleContext
*/
struct PxControllerObstacleHit : public PxControllerHit
{
const void* userData;
};
/**
\brief User callback class for character controller events.
\note Character controller hit reports are only generated when move is called.
@see PxControllerDesc.callback
*/
class PxUserControllerHitReport
{
public:
/**
\brief Called when current controller hits a shape.
This is called when the CCT moves and hits a shape. This will not be called when a moving shape hits a non-moving CCT.
\param[in] hit Provides information about the hit.
@see PxControllerShapeHit
*/
virtual void onShapeHit(const PxControllerShapeHit& hit) = 0;
/**
\brief Called when current controller hits another controller.
\param[in] hit Provides information about the hit.
@see PxControllersHit
*/
virtual void onControllerHit(const PxControllersHit& hit) = 0;
/**
\brief Called when current controller hits a user-defined obstacle.
\param[in] hit Provides information about the hit.
@see PxControllerObstacleHit PxObstacleContext
*/
virtual void onObstacleHit(const PxControllerObstacleHit& hit) = 0;
protected:
virtual ~PxUserControllerHitReport(){}
};
/**
\brief Dedicated filtering callback for CCT vs CCT.
This controls collisions between CCTs (one CCT vs anoter CCT).
To make each CCT collide against all other CCTs, just return true - or simply avoid defining a callback.
To make each CCT freely go through all other CCTs, just return false.
Otherwise create a custom filtering logic in this callback.
@see PxControllerFilters
*/
class PxControllerFilterCallback
{
public:
virtual ~PxControllerFilterCallback(){}
/**
\brief Filtering method for CCT-vs-CCT.
\param[in] a First CCT
\param[in] b Second CCT
\return true to keep the pair, false to filter it out
*/
virtual bool filter(const PxController& a, const PxController& b) = 0;
};
/**
\brief Filtering data for "move" call.
This class contains all filtering-related parameters for the PxController::move() call.
Collisions between a CCT and the world are filtered using the mFilterData, mFilterCallback and mFilterFlags
members. These parameters are internally passed to PxScene::overlap() to find objects touched by the CCT.
Please refer to the PxScene::overlap() documentation for details.
Collisions between a CCT and another CCT are filtered using the mCCTFilterCallback member. If this filter
callback is not defined, none of the CCT-vs-CCT collisions are filtered, and each CCT will collide against
all other CCTs.
\note PxQueryFlag::eANY_HIT and PxQueryFlag::eNO_BLOCK are ignored in mFilterFlags.
@see PxController.move() PxControllerFilterCallback
*/
class PxControllerFilters
{
public:
PX_INLINE PxControllerFilters(const PxFilterData* filterData=NULL, PxQueryFilterCallback* cb=NULL, PxControllerFilterCallback* cctFilterCb=NULL) :
mFilterData (filterData),
mFilterCallback (cb),
mFilterFlags (PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER),
mCCTFilterCallback (cctFilterCb)
{}
// CCT-vs-shapes:
const PxFilterData* mFilterData; //!< Data for internal PxQueryFilterData structure. Passed to PxScene::overlap() call.
//!< This can be NULL, in which case a default PxFilterData is used.
PxQueryFilterCallback* mFilterCallback; //!< Custom filter logic (can be NULL). Passed to PxScene::overlap() call.
PxQueryFlags mFilterFlags; //!< Flags for internal PxQueryFilterData structure. Passed to PxScene::overlap() call.
// CCT-vs-CCT:
PxControllerFilterCallback* mCCTFilterCallback; //!< CCT-vs-CCT filter callback. If NULL, all CCT-vs-CCT collisions are kept.
};
/**
\brief Descriptor class for a character controller.
@see PxBoxController PxCapsuleController
*/
class PxControllerDesc
{
public:
/**
\brief returns true if the current settings are valid
\return True if the descriptor is valid.
*/
PX_INLINE virtual bool isValid() const;
/**
\brief Returns the character controller type
\return The controllers type.
@see PxControllerType PxCapsuleControllerDesc PxBoxControllerDesc
*/
PX_INLINE PxControllerShapeType::Enum getType() const { return mType; }
/**
\brief The position of the character
\note The character's initial position must be such that it does not overlap the static geometry.
<b>Default:</b> Zero
*/
PxExtendedVec3 position;
/**
\brief Specifies the 'up' direction
In order to provide stepping functionality the SDK must be informed about the up direction.
<b>Default:</b> (0, 1, 0)
*/
PxVec3 upDirection;
/**
\brief The maximum slope which the character can walk up.
In general it is desirable to limit where the character can walk, in particular it is unrealistic
for the character to be able to climb arbitary slopes.
The limit is expressed as the cosine of desired limit angle. A value of 0 disables this feature.
\warning It is currently enabled for static actors only (not for dynamic/kinematic actors), and not supported for spheres or capsules.
<b>Default:</b> 0.707
@see upDirection invisibleWallHeight maxJumpHeight
*/
PxF32 slopeLimit;
/**
\brief Height of invisible walls created around non-walkable triangles
The library can automatically create invisible walls around non-walkable triangles defined
by the 'slopeLimit' parameter. This defines the height of those walls. If it is 0.0, then
no extra triangles are created.
<b>Default:</b> 0.0
@see upDirection slopeLimit maxJumpHeight
*/
PxF32 invisibleWallHeight;
/**
\brief Maximum height a jumping character can reach
This is only used if invisible walls are created ('invisibleWallHeight' is non zero).
When a character jumps, the non-walkable triangles he might fly over are not found
by the collision queries (since the character's bounding volume does not touch them).
Thus those non-walkable triangles do not create invisible walls, and it is possible
for a jumping character to land on a non-walkable triangle, while he wouldn't have
reached that place by just walking.
The 'maxJumpHeight' variable is used to extend the size of the collision volume
downward. This way, all the non-walkable triangles are properly found by the collision
queries and it becomes impossible to 'jump over' invisible walls.
If the character in your game can not jump, it is safe to use 0.0 here. Otherwise it
is best to keep this value as small as possible, since a larger collision volume
means more triangles to process.
<b>Default:</b> 0.0
@see upDirection slopeLimit invisibleWallHeight
*/
PxF32 maxJumpHeight;
/**
\brief The contact offset used by the controller.
Specifies a skin around the object within which contacts will be generated.
Use it to avoid numerical precision issues.
This is dependant on the scale of the users world, but should be a small, positive
non zero value.
<b>Default:</b> 0.1
*/
PxF32 contactOffset;
/**
\brief Defines the maximum height of an obstacle which the character can climb.
A small value will mean that the character gets stuck and cannot walk up stairs etc,
a value which is too large will mean that the character can climb over unrealistically
high obstacles.
<b>Default:</b> 0.5
@see upDirection
*/
PxF32 stepOffset;
/**
\brief Density of underlying kinematic actor
The CCT creates a PhysX's kinematic actor under the hood. This controls its density.
<b>Default:</b> 10.0
*/
PxF32 density;
/**
\brief Scale coefficient for underlying kinematic actor
The CCT creates a PhysX's kinematic actor under the hood. This controls its scale factor.
This should be a number a bit smaller than 1.0.
<b>Default:</b> 0.8
*/
PxF32 scaleCoeff;
/**
\brief Cached volume growth
Amount of space around the controller we cache to improve performance. This is a scale factor
that should be higher than 1.0f but not too big, ideally lower than 2.0f.
<b>Default:</b> 1.5
*/
PxF32 volumeGrowth;
/**
\brief Specifies a user report callback.
This report callback is called when the character collides with shapes and other characters.
Setting this to NULL disables the callback.
<b>Default:</b> NULL
@see PxUserControllerHitReport
*/
PxUserControllerHitReport* reportCallback;
/**
\brief Specifies a user behavior callback.
This behavior callback is called to customize the controller's behavior w.r.t. touched shapes.
Setting this to NULL disables the callback.
<b>Default:</b> NULL
@see PxControllerBehaviorCallback
*/
PxControllerBehaviorCallback* behaviorCallback;
/**
\brief The non-walkable mode controls if a character controller slides or not on a non-walkable part.
This is only used when slopeLimit is non zero.
<b>Default:</b> PxControllerNonWalkableMode::ePREVENT_CLIMBING
@see PxControllerNonWalkableMode
*/
PxControllerNonWalkableMode::Enum nonWalkableMode;
/**
\brief The material for the actor associated with the controller.
The controller internally creates a rigid body actor. This parameter specifies the material of the actor.
<b>Default:</b> NULL
@see PxMaterial
*/
PxMaterial* material;
/**
\brief Use a deletion listener to get informed about released objects and clear internal caches if needed.
If a character controller registers a deletion listener, it will get informed about released objects. That allows the
controller to invalidate cached data that connects to a released object. If a deletion listener is not
registered, PxController::invalidateCache has to be called manually after objects have been released.
@see PxController::invalidateCache
<b>Default:</b> true
*/
bool registerDeletionListener;
/**
\brief User specified data associated with the controller.
<b>Default:</b> NULL
*/
void* userData;
protected:
const PxControllerShapeType::Enum mType; //!< The type of the controller. This gets set by the derived class' ctor, the user should not have to change it.
/**
\brief constructor sets to default.
*/
PX_INLINE PxControllerDesc(PxControllerShapeType::Enum);
PX_INLINE virtual ~PxControllerDesc();
/**
\brief copy constructor.
*/
PX_INLINE PxControllerDesc(const PxControllerDesc&);
/**
\brief assignment operator.
*/
PX_INLINE PxControllerDesc& operator=(const PxControllerDesc&);
PX_INLINE void copy(const PxControllerDesc&);
};
PX_INLINE PxControllerDesc::PxControllerDesc(PxControllerShapeType::Enum t) : mType(t)
{
upDirection = PxVec3(0.0f, 1.0f, 0.0f);
slopeLimit = 0.707f;
contactOffset = 0.1f;
stepOffset = 0.5f;
density = 10.0f;
scaleCoeff = 0.8f;
volumeGrowth = 1.5f;
reportCallback = NULL;
behaviorCallback = NULL;
userData = NULL;
nonWalkableMode = PxControllerNonWalkableMode::ePREVENT_CLIMBING;
position.x = PxExtended(0.0);
position.y = PxExtended(0.0);
position.z = PxExtended(0.0);
material = NULL;
invisibleWallHeight = 0.0f;
maxJumpHeight = 0.0f;
registerDeletionListener = true;
}
PX_INLINE PxControllerDesc::PxControllerDesc(const PxControllerDesc& other) : mType(other.mType)
{
copy(other);
}
PX_INLINE PxControllerDesc& PxControllerDesc::operator=(const PxControllerDesc& other)
{
copy(other);
return *this;
}
PX_INLINE void PxControllerDesc::copy(const PxControllerDesc& other)
{
upDirection = other.upDirection;
slopeLimit = other.slopeLimit;
contactOffset = other.contactOffset;
stepOffset = other.stepOffset;
density = other.density;
scaleCoeff = other.scaleCoeff;
volumeGrowth = other.volumeGrowth;
reportCallback = other.reportCallback;
behaviorCallback = other.behaviorCallback;
userData = other.userData;
nonWalkableMode = other.nonWalkableMode;
position.x = other.position.x;
position.y = other.position.y;
position.z = other.position.z;
material = other.material;
invisibleWallHeight = other.invisibleWallHeight;
maxJumpHeight = other.maxJumpHeight;
registerDeletionListener = other.registerDeletionListener;
}
PX_INLINE PxControllerDesc::~PxControllerDesc()
{
}
PX_INLINE bool PxControllerDesc::isValid() const
{
if( mType!=PxControllerShapeType::eBOX
&& mType!=PxControllerShapeType::eCAPSULE)
return false;
if(scaleCoeff<0.0f) return false;
if(volumeGrowth<1.0f) return false;
if(density<0.0f) return false;
if(slopeLimit<0.0f) return false;
if(stepOffset<0.0f) return false;
if(contactOffset<=0.0f) return false;
if(!material) return false;
return true;
}
/**
\brief Base class for character controllers.
@see PxCapsuleController PxBoxController
*/
class PxController
{
public:
//*********************************************************************
// DEPRECATED FUNCTIONS:
//
// PX_DEPRECATED virtual void setInteraction(PxCCTInteractionMode::Enum flag) = 0;
// PX_DEPRECATED virtual PxCCTInteractionMode::Enum getInteraction() const = 0;
// PX_DEPRECATED virtual void setGroupsBitmask(PxU32 bitmask) = 0;
// PX_DEPRECATED virtual PxU32 getGroupsBitmask() const = 0;
//
// => replaced with:
//
// PxControllerFilters::mCCTFilterCallback. Please define a PxControllerFilterCallback object and emulate the old interaction mode there.
//
//*********************************************************************
/**
\brief Return the type of controller
@see PxControllerType
*/
virtual PxControllerShapeType::Enum getType() const = 0;
/**
\brief Releases the controller.
*/
virtual void release() = 0;
/**
\brief Moves the character using a "collide-and-slide" algorithm.
\param[in] disp Displacement vector
\param[in] minDist The minimum travelled distance to consider. If travelled distance is smaller, the character doesn't move.
This is used to stop the recursive motion algorithm when remaining distance to travel is small.
\param[in] elapsedTime Time elapsed since last call
\param[in] filters User-defined filters for this move
\param[in] obstacles Potential additional obstacles the CCT should collide with.
\return Collision flags, collection of ::PxControllerCollisionFlags
*/
virtual PxControllerCollisionFlags move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles=NULL) = 0;
/**
\brief Sets controller's position.
The position controlled by this function is the center of the collision shape.
\warning This is a 'teleport' function, it doesn't check for collisions.
\warning The character's position must be such that it does not overlap the static geometry.
To move the character under normal conditions use the #move() function.
\param[in] position The new (center) positon for the controller.
\return Currently always returns true.
@see PxControllerDesc.position getPosition() getFootPosition() setFootPosition() move()
*/
virtual bool setPosition(const PxExtendedVec3& position) = 0;
/**
\brief Retrieve the raw position of the controller.
The position retrieved by this function is the center of the collision shape. To retrieve the bottom position of the shape,
a.k.a. the foot position, use the getFootPosition() function.
The position is updated by calls to move(). Calling this method without calling
move() will return the last position or the initial position of the controller.
\return The controller's center position
@see PxControllerDesc.position setPosition() getFootPosition() setFootPosition() move()
*/
virtual const PxExtendedVec3& getPosition() const = 0;
/**
\brief Set controller's foot position.
The position controlled by this function is the bottom of the collision shape, a.k.a. the foot position.
\note The foot position takes the contact offset into account
\warning This is a 'teleport' function, it doesn't check for collisions.
To move the character under normal conditions use the #move() function.
\param[in] position The new (bottom) positon for the controller.
\return Currently always returns true.
@see PxControllerDesc.position setPosition() getPosition() getFootPosition() move()
*/
virtual bool setFootPosition(const PxExtendedVec3& position) = 0;
/**
\brief Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape.
\note The foot position takes the contact offset into account
\return The controller's foot position
@see PxControllerDesc.position setPosition() getPosition() setFootPosition() move()
*/
virtual PxExtendedVec3 getFootPosition() const = 0;
/**
\brief Get the rigid body actor associated with this controller (see PhysX documentation).
The behavior upon manually altering this actor is undefined, you should primarily
use it for reading const properties.
\return the actor associated with the controller.
*/
virtual PxRigidDynamic* getActor() const = 0;
/**
\brief The step height.
\param[in] offset The new step offset for the controller.
@see PxControllerDesc.stepOffset
*/
virtual void setStepOffset(const PxF32 offset) =0;
/**
\brief Retrieve the step height.
\return The step offset for the controller.
@see setStepOffset()
*/
virtual PxF32 getStepOffset() const =0;
/**
\brief Sets the non-walkable mode for the CCT.
\param[in] flag The new value of the non-walkable mode.
\see PxControllerNonWalkableMode
*/
virtual void setNonWalkableMode(PxControllerNonWalkableMode::Enum flag) = 0;
/**
\brief Retrieves the non-walkable mode for the CCT.
\return The current non-walkable mode.
\see PxControllerNonWalkableMode
*/
virtual PxControllerNonWalkableMode::Enum getNonWalkableMode() const = 0;
/**
\brief Retrieve the contact offset.
\return The contact offset for the controller.
@see PxControllerDesc.contactOffset
*/
virtual PxF32 getContactOffset() const =0;
/**
\brief Sets the contact offset.
\param[in] offset The contact offset for the controller.
@see PxControllerDesc.contactOffset
*/
virtual void setContactOffset(PxF32 offset) =0;
/**
\brief Retrieve the 'up' direction.
\return The up direction for the controller.
@see PxControllerDesc.upDirection
*/
virtual PxVec3 getUpDirection() const =0;
/**
\brief Sets the 'up' direction.
\param[in] up The up direction for the controller.
@see PxControllerDesc.upDirection
*/
virtual void setUpDirection(const PxVec3& up) =0;
/**
\brief Retrieve the slope limit.
\return The slope limit for the controller.
@see PxControllerDesc.slopeLimit
*/
virtual PxF32 getSlopeLimit() const =0;
/**
\brief Sets the slope limit.
\note This feature can not be enabled at runtime, i.e. if the slope limit is zero when creating the CCT
(which disables the feature) then changing the slope limit at runtime will not have any effect, and the call
will be ignored.
\param[in] slopeLimit The slope limit for the controller.
@see PxControllerDesc.slopeLimit
*/
virtual void setSlopeLimit(PxF32 slopeLimit) =0;
/**
\brief Flushes internal geometry cache.
The character controller uses caching in order to speed up collision testing. The cache is
automatically flushed when a change to static objects is detected in the scene. For example when a
static shape is added, updated, or removed from the scene, the cache is automatically invalidated.
However there may be situations that cannot be automatically detected, and those require manual
invalidation of the cache. Currently the user must call this when the filtering behavior changes (the
PxControllerFilters parameter of the PxController::move call). While the controller in principle
could detect a change in these parameters, it cannot detect a change in the behavior of the filtering
function.
@see PxController.move
*/
virtual void invalidateCache() = 0;
/**
\brief Retrieve the scene associated with the controller.
\return The physics scene
*/
virtual PxScene* getScene() = 0;
/**
\brief Returns the user data associated with this controller.
\return The user pointer associated with the controller.
@see PxControllerDesc.userData
*/
virtual void* getUserData() const = 0;
/**
\brief Sets the user data associated with this controller.
\param[in] userData The user pointer associated with the controller.
@see PxControllerDesc.userData
*/
virtual void setUserData(void* userData) = 0;
/**
\brief Returns information about the controller's internal state.
\param[out] state The controller's internal state
@see PxControllerState
*/
virtual void getState(PxControllerState& state) const = 0;
/**
\brief Returns the controller's internal statistics.
\param[out] stats The controller's internal statistics
@see PxControllerStats
*/
virtual void getStats(PxControllerStats& stats) const = 0;
/**
\brief Resizes the controller.
This function attempts to resize the controller to a given size, while making sure the bottom
position of the controller remains constant. In other words the function modifies both the
height and the (center) position of the controller. This is a helper function that can be used
to implement a 'crouch' functionality for example.
\param[in] height Desired controller's height
*/
virtual void resize(PxReal height) = 0;
protected:
PX_INLINE PxController() {}
virtual ~PxController() {}
};
#if !PX_DOXYGEN
} // namespace physx
#endif
/** @} */
#endif
| [
"[email protected]"
] | |
2cde0fbe750d93657c1e89e1ea5772e02fedc227 | c2b6bd54bef3c30e53c846e9cf57f1e44f8410df | /Temp/il2cppOutput/il2cppOutput/UnityEngine_UnityEngine_ExitGUIException1618397098.h | d06a3c94e1c181c01d23fab342cde485b2153965 | [] | no_license | PriyeshWani/CrashReproduce-5.4p1 | 549a1f75c848bf9513b2f966f2f500ee6c75ba42 | 03dd84f7f990317fb9026cbcc3873bc110b1051e | refs/heads/master | 2021-01-11T12:04:21.140491 | 2017-01-24T14:01:29 | 2017-01-24T14:01:29 | 79,388,416 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 529 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Exception1927440687.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ExitGUIException
struct ExitGUIException_t1618397098 : public Exception_t1927440687
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"[email protected]"
] | |
15960bf5ab750addbb3a422fe229a47ae748fc57 | f787b9506a693cce8d20aebae119f8449675fe71 | /Practice/arrays/main.cpp | a9191b4789319ff78a4ccd507790c99ec06dc64a | [] | no_license | Snocc007/CodeJr | c2faa1e4fc2baa24f00960ad6f8d4bf12016a4fa | f494311869612756fe20407a7de95065fe5e9115 | refs/heads/master | 2023-01-01T15:35:57.815700 | 2020-10-31T10:03:09 | 2020-10-31T10:03:09 | 271,255,692 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,057 | cpp | #include <iostream>
#include <string>
int main(int argc, char *args[]) {
// - Create an array variable named `numbers`
// with the following content: `[4, 5, 6, 7]`
// - Print the third element of `numbers`
int numbers[] = {4, 5, 6, 7};
int lenghtOfArray = sizeof(numbers) / sizeof(numbers[0]);
for (int i = 0; i < lenghtOfArray; ++i) {
std::cout << numbers[i] << " ";
}
std::cout << std::endl;
// - Create an array variable named `firstArrayOfNumbers`
// with the following content: `[1, 2, 3]`
// - Create an array variable named `secondArrayOfNumbers`
// with the following content: `[4, 5]`
// - Print "secondArrayOfNumbers is longer" if `secondArrayOfNumbers` has
// more elements than `firstArrayOfNumbers`
int firstArrayOfNumbers[] = {1, 2, 3};
int secondArrayOfNumbers[] = {4, 5};
int lenghtOfFirstArray = sizeof(firstArrayOfNumbers) / sizeof(firstArrayOfNumbers[0]);
int lenghtOfSecondArray = sizeof(secondArrayOfNumbers) / sizeof(secondArrayOfNumbers[0]);
if (lenghtOfFirstArray < lenghtOfSecondArray) {
std::cout << "secondArrayOfNumbers is longer" << std::endl;
} else {
std::cout << "firstArrayOfNumbers is longer" << std::endl;
}
// - Create an array variable named `numbers`
// with the following content: `[54, 23, 66, 12]`
// - Print the sum of the second and he third element
int otherNumbers[] = {54, 23, 66, 12};
int lenghtOfOtherNumbers = sizeof(otherNumbers) / sizeof(otherNumbers[0]);
int sumOfOtherNumbers = 0;
for (int i = 0; i < lenghtOfOtherNumbers; ++i) {
sumOfOtherNumbers += otherNumbers[i];
}
std::cout << sumOfOtherNumbers << std::endl;
// - Create an array variable named `numbers`
// with the following content: `[1, 2, 3, 8, 5, 6]`
// - Change the 8 to 4
// - Print the fourth element
int anotherNumbers[] = {1, 2, 3, 8, 5, 6};
anotherNumbers[3] = 4;
std::cout << anotherNumbers[3] << std::endl;
// - Create an array variable named `numbers`
// with the following content: `[1, 2, 3, 4, 5]`
// - Increment the third element
// - Print the third element
int againSomeNumbers[] = {1, 2, 3, 4, 5};
againSomeNumbers[2] += 1;
std::cout << againSomeNumbers[3] << std::endl;
int a;
a = 4;
int matrix[a][a];
for (int i = 0; i < sizeof(matrix) / sizeof(matrix[0]); ++i) {
for (int j = 0; j < sizeof(matrix[0]) / sizeof(matrix[0][0]); ++j) {
if (i == j) {
matrix[i][j] = 1;
} else {
matrix[i][j] = 0;
}
std::cout << matrix[i][j];
}
std::cout << std::endl;
}
std::cout << std::endl;
// - Create an array variable named `animals`
// with the following content: `["koal", "pand", "zebr"]`
// - Add all elements an `"a"` at the end
std::string animals[] = {"koal", "pand", "zebr"};
const char toAdd[] = "a";
for (int i = 0; i < sizeof(animals) / sizeof(animals[0]); ++i) {
animals[i].append(toAdd);
std::cout << animals[i] << std::endl;
}
std::cout << std::endl;
// - Create an array variable named `orders`
// with the following content: `["first", "second", "third"]`
// - Swap the first and the third element of `orders`
std::string orders[] = {"first", "second", "third"};
orders[0].swap(orders[2]);
for (int i = 0; i < sizeof(orders) / sizeof(orders[0]); ++i) {
std::cout << orders[i] << std::endl;
}
std::cout << std::endl;
// - Create an array variable named `numbers`
// with the following content: `[3, 4, 5, 6, 7]`
// - Reverse the order of the elements in `numbers`
// - Print the elements of the reversed `numbers`
int theLastNumbers[] = {3, 4, 5, 6, 7};
for (int i = sizeof(theLastNumbers) / sizeof(theLastNumbers[0]) - 1; i >= 0; i--) {
std::cout << theLastNumbers[i] << " ";
}
std::cout << std::endl;
return 0;
} | [
"[email protected]"
] | |
4411e14ed295dc188e499e05270b3da70679cdd2 | 1472bd2be0bd2f1686d1c211e32b05cae53f0584 | /darkPhoton2/backup/OmniHit.cc | 0c717635e4f294d069ac92fcb7be20508b1af700 | [] | no_license | cesarotti/MMAPS | 16d75c446c9be84e68455c8b5c240fc789c095ba | 7a478882eed1d9d443da42b939147ba7e23723fa | refs/heads/master | 2021-01-17T06:38:15.394020 | 2016-07-08T13:09:04 | 2016-07-08T13:09:04 | 50,456,003 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,619 | cc | /*
* Dark Photon Omni Hit
*
* Detects particle's data most directly
*/
#include "OmniHit.hh"
#include "G4THitsCollection.hh"
#include "G4VHit.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include <iomanip>
G4ThreadLocal G4Allocator<OmniHit>* OmniHitAllocator;
OmniHit::OmniHit()
: G4VHit(),
fTrackID(-1),
fTotalEnergy(0.),
fPos(G4ThreeVector()),
fMomentum(G4ThreeVector()),
fCharge(0.),
fStart(G4ThreeVector())
{}
OmniHit::~OmniHit()
{}
//Create a hit that exactly mirrors another hit
OmniHit::OmniHit(const OmniHit& hit)
: G4VHit()
{
fTrackID = hit.fTrackID;
fTotalEnergy = hit.fTotalEnergy;
fPos = hit.fPos;
fMomentum = hit.fMomentum;
fCharge = hit.fCharge;
fStart = hit.fStart;
}
const OmniHit& OmniHit::operator=(const OmniHit& hit)
{
fTrackID = hit.fTrackID;
fTotalEnergy = hit.fTotalEnergy;
fPos = hit.fPos;
fMomentum = hit.fMomentum;
fCharge = hit.fCharge;
fStart = hit.fStart;
return *this;
}
G4int OmniHit::operator==(const OmniHit& hit) const
{
return (this==&hit) ? 1 : 0;
}
void OmniHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(fPos);
circle.SetScreenSize(4.);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(0.,1.0,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
void OmniHit::Print()
{
}
| [
"[email protected]"
] | |
288c7456e7e585be1e6042ff4187d938917c7bca | 7ff50675c8f0575ba053a78e2d0cd45beb134f05 | /SLPIC_Configuration_Software20171222/SLPIC_Configuration_Software/release/moc_serialport_editer.cpp | 125145644b4ea51e608f6f223d231eeda82eec20 | [] | no_license | yisea123/SPIC_Configuer | b15c073eb2ac297373e725dd05d21ce4bc90cb72 | a5a9210e99ea009c447b328a68f8180e898355eb | refs/heads/master | 2020-06-17T16:59:56.760334 | 2017-12-29T09:05:01 | 2017-12-29T09:05:01 | 195,984,763 | 1 | 1 | null | 2019-07-09T10:13:27 | 2019-07-09T10:13:27 | null | UTF-8 | C++ | false | false | 5,389 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'serialport_editer.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../serialport_editer.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'serialport_editer.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_SerialPort_Editer_t {
QByteArrayData data[12];
char stringdata0[178];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_SerialPort_Editer_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_SerialPort_Editer_t qt_meta_stringdata_SerialPort_Editer = {
{
QT_MOC_LITERAL(0, 0, 17), // "SerialPort_Editer"
QT_MOC_LITERAL(1, 18, 12), // "Edit_Triggle"
QT_MOC_LITERAL(2, 31, 0), // ""
QT_MOC_LITERAL(3, 32, 11), // "EditPageNum"
QT_MOC_LITERAL(4, 44, 7), // "pageNum"
QT_MOC_LITERAL(5, 52, 39), // "On_SerialPort_Table_DoubleCli..."
QT_MOC_LITERAL(6, 92, 5), // "items"
QT_MOC_LITERAL(7, 98, 13), // "EditAttribute"
QT_MOC_LITERAL(8, 112, 9), // "attribute"
QT_MOC_LITERAL(9, 122, 12), // "databasePath"
QT_MOC_LITERAL(10, 135, 21), // "on_ConfirmBtn_clicked"
QT_MOC_LITERAL(11, 157, 20) // "on_CancelBtn_clicked"
},
"SerialPort_Editer\0Edit_Triggle\0\0"
"EditPageNum\0pageNum\0"
"On_SerialPort_Table_DoubleClick_trigger\0"
"items\0EditAttribute\0attribute\0"
"databasePath\0on_ConfirmBtn_clicked\0"
"on_CancelBtn_clicked"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_SerialPort_Editer[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
5, 3, 37, 2, 0x08 /* Private */,
10, 0, 44, 2, 0x08 /* Private */,
11, 0, 45, 2, 0x08 /* Private */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
// slots: parameters
QMetaType::Void, QMetaType::QStringList, 0x80000000 | 7, QMetaType::QString, 6, 8, 9,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void SerialPort_Editer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SerialPort_Editer *_t = static_cast<SerialPort_Editer *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->Edit_Triggle((*reinterpret_cast< EditPageNum(*)>(_a[1]))); break;
case 1: _t->On_SerialPort_Table_DoubleClick_trigger((*reinterpret_cast< QStringList(*)>(_a[1])),(*reinterpret_cast< EditAttribute(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
case 2: _t->on_ConfirmBtn_clicked(); break;
case 3: _t->on_CancelBtn_clicked(); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
typedef void (SerialPort_Editer::*_t)(EditPageNum );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&SerialPort_Editer::Edit_Triggle)) {
*result = 0;
return;
}
}
}
}
const QMetaObject SerialPort_Editer::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_SerialPort_Editer.data,
qt_meta_data_SerialPort_Editer, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *SerialPort_Editer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *SerialPort_Editer::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_SerialPort_Editer.stringdata0))
return static_cast<void*>(this);
return QDialog::qt_metacast(_clname);
}
int SerialPort_Editer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
return _id;
}
// SIGNAL 0
void SerialPort_Editer::Edit_Triggle(EditPageNum _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| [
"[email protected]"
] | |
a108ed995d528688ef81f61e408e5f8e30ef6d3f | 7f88f6ef7fe43cdcfe41984a8952f876dec1cd47 | /2444.cpp | 126c5c40e37b1009cd7059034870b94f196f7b70 | [] | no_license | skleee/boj-ps | 7498ca4b1fc892caafec6a6620bd9968aff0f6f0 | 818e36754d20c2dccfcf641a7d47dd1f0c087fd1 | refs/heads/master | 2020-07-25T22:14:10.971137 | 2020-03-08T17:11:38 | 2020-03-08T17:11:38 | 208,439,076 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 549 | cpp | #include <iostream>
#pragma warning(disable:4996)
/*
2444. 별찍기7
출력
*/
using namespace std;
int N;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
cin >> N;
for (int i = 1; i < N; i++) {
for (int k = 1; k <= N - i; k++) {
cout << " ";
}
for (int j = 1; j <= 2 * i - 1; j++) {
cout << "*";
}
cout << "\n";
}
for (int i = 0; i <= N; i++) {
for (int k = 0; k < i; k++) {
cout << " ";
}
for (int j = 0; j < 2 * (N - i) - 1; j++) {
cout << "*";
}
cout << "\n";
}
return 0;
} | [
"[email protected]"
] | |
cb8026c5075b9a9b638ff9947196e3ecf981781c | c77b7618bc1c4f9ec0355362b7a4bafa8bf1f7dd | /merge_sort.cpp | 0a61bb3afd478c5ced89f003b3787c0177d0149e | [] | no_license | vcntlee/stanford-algorithms-1 | 46d451bf821ab9118f8b60190b4b38a969e9bfed | 84edfe3624a92643f056994b532d02da63ac8d0f | refs/heads/master | 2020-06-12T19:10:33.009421 | 2015-11-30T22:21:32 | 2015-11-30T22:21:32 | 46,522,641 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,507 | cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct number{
int elt;
int idx;
};
vector<number> conquer(vector<number> first, vector<number> second);
vector<number> divide(vector<number> ptr){
if (ptr.size() == 1){
return ptr;
}
else{
int mid = ptr.size() / 2;
vector<number> a;
vector<number> b;
for (int i = 0; i < mid; i++){
a.push_back(ptr.at(i));
}
vector<number> first = divide(a);
for (int i = mid; i < ptr.size(); i++){
b.push_back(ptr.at(i));
}
vector<number> second = divide(b);
return conquer(first, second);
}
}
vector<number> conquer(vector<number> first, vector<number> second){
int f = 0;
int s = 0;
vector<number> conquer;
while (f < first.size() && s < second.size()){
if (first.at(f).elt < second.at(s).elt){
conquer.push_back(first.at(f));
++f;
}
else{
conquer.push_back(second.at(s));
++s;
}
}
while(f < first.size()){
conquer.push_back(first.at(f));
++f;
}
while(s < second.size()){
conquer.push_back(second.at(s));
++s;
}
return conquer;
}
int binary_search(vector<number> sorted, int input){
int lower = 0;
int upper = sorted.size() - 1;
while (lower <= upper){
int mid = (upper + lower) / 2;
if (input > sorted[mid].elt){
lower = mid +1;
}
else if (input < sorted[mid].elt){
upper = mid -1;
}
else{
return sorted[mid];
}
}
return -1789;
}
int* process_answer(vector<number> result, int target){
if (index == -1789){
int *answers = new int[2];
for (int i=result.size()-1; i > 0; --i){
if (result[i].elt + result[i-1].elt == target){
answers[0] = result[i].idx;
answers[1] = result[i-1].idx;
return answers;
}
}
}
else{
int idx = binary_seach(result, target);
if (target <= result.at(idx).elt){
for (int i = 0, j = result.end(); i > j; ++i, --j){
if (i = j){
if (result[i].elt + result[i-1] == target){
answers[0] = result[i].idx;
answers[1] = result[i-1].idx;
return answers;
}
}
else{
if (result[i].elt + result[j].elt == target){
answers[0] = result[i].idx;
answers[1] = result[j].idx;
return answers;
}
}
}
}
}
}
int main(){
vector<number> ptr;
int myArray[] = {3, 6, 7, 9, 1, 2, 5, 4};
int len = sizeof(myArray)/sizeof(int);
for (int i = 0; i < len; i++){
number element;
element.elt = abs(myArray[i]);
element.idx = i+1;
ptr.push_back(element);
}
vector<number> result;
result = divide(ptr);
for (int i = 0; i < result.size(); i++){
cout << result.at(i).elt << "[" << result.at(i).idx << "]" << " ";
}
cout << endl;
int target = 12;
int *answers = process_answer(result, abs(target));
return 0;
}
| [
"[email protected]"
] | |
dfd6589b93c6ea721ce984d247bc0f85afa07393 | f2bc4666af66a29ae4f8a1a2e7029d11c9c4270b | /src/cryptonote_core/difficulty.hpp | bbe9bcd4dea0939ee0f6d0814eb2109c8cd85fe5 | [
"MIT"
] | permissive | ouillepouille/bitnote | cf42795e735abf6d9b100e1c084afd36b9d80f3a | ee1430d4ffad76f97162982e1ab1d07e7c619b90 | refs/heads/master | 2021-01-25T13:35:47.527387 | 2018-03-02T14:11:10 | 2018-03-02T14:11:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,155 | hpp | // Copyright (c) 2018, The Bitnote Developers.
// Portions Copyright (c) 2012-2013, The CryptoNote Developers.
//
// 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.
#pragma once
#include <cstdint>
#include <vector>
#include "crypto/hash.h"
namespace cryptonote
{
typedef std::uint64_t difficulty_type;
bool check_hash(const crypto::hash &hash, difficulty_type difficulty);
difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties);
difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds);
}
| [
"[email protected]"
] | |
340bc29045882f8596b87388357cde5ef33d1308 | 735623cf21880f6abbb9e0b1722cd6a6e1c07fc6 | /tetris_sfml/InputManager.cpp | 38f0a9b41c06ae52736fb72a9850577dcc358b48 | [
"Zlib",
"MIT"
] | permissive | daemon3000/Tetris | 093ac23cf974e48651069a4a81f82100a28bf340 | 05a24c25b4de115212d1b87c2efefcccc4099037 | refs/heads/main | 2022-08-05T11:04:14.715737 | 2019-04-05T07:21:22 | 2019-04-05T07:21:22 | 74,357,848 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,618 | cpp | #include "InputManager.h"
#include "EventManager.h"
using namespace tetris;
InputManager::InputManager()
{
for (int i = 0; i < MOUSE_BUTTON_COUNT; i++)
m_mouseButtonStates[i] = ButtonState::Released;
for (int i = 0; i < sf::Keyboard::KeyCount; i++)
m_keyStates[i] = ButtonState::Released;
}
void InputManager::update(const EventManager &eventManager)
{
for (int i = 0; i < MOUSE_BUTTON_COUNT; i++)
{
if (m_mouseButtonStates[i] == ButtonState::JustPressed)
m_mouseButtonStates[i] = ButtonState::Pressed;
else if (m_mouseButtonStates[i] == ButtonState::JustReleased)
m_mouseButtonStates[i] = ButtonState::Released;
}
for (int i = 0; i < sf::Keyboard::KeyCount; i++)
{
if (m_keyStates[i] == ButtonState::JustPressed)
m_keyStates[i] = ButtonState::Pressed;
else if (m_keyStates[i] == ButtonState::JustReleased)
m_keyStates[i] = ButtonState::Released;
}
eventManager.forEachEvent([this](const sf::Event &evt)
{
if(evt.type == sf::Event::MouseButtonPressed)
{
if(evt.mouseButton.button == sf::Mouse::Button::Left && !getMouseButton(MouseButton::Left))
m_mouseButtonStates[MOUSE_BUTTON_LEFT] = ButtonState::JustPressed;
else if(evt.mouseButton.button == sf::Mouse::Button::Right && !getMouseButton(MouseButton::Right))
m_mouseButtonStates[MOUSE_BUTTON_RIGHT] = ButtonState::JustPressed;
else if(evt.mouseButton.button == sf::Mouse::Button::Middle && !getMouseButton(MouseButton::Middle))
m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] = ButtonState::JustPressed;
}
else if(evt.type == sf::Event::MouseButtonReleased)
{
if(evt.mouseButton.button == sf::Mouse::Button::Left && getMouseButton(MouseButton::Left))
m_mouseButtonStates[MOUSE_BUTTON_LEFT] = ButtonState::JustReleased;
else if(evt.mouseButton.button == sf::Mouse::Button::Right && getMouseButton(MouseButton::Right))
m_mouseButtonStates[MOUSE_BUTTON_RIGHT] = ButtonState::JustReleased;
else if(evt.mouseButton.button == sf::Mouse::Button::Middle && getMouseButton(MouseButton::Middle))
m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] = ButtonState::JustReleased;
}
if(evt.type == sf::Event::KeyPressed)
{
if(evt.key.code >= 0 && evt.key.code < sf::Keyboard::KeyCount && !getKey(evt.key.code))
m_keyStates[evt.key.code] = ButtonState::JustPressed;
}
else if(evt.type == sf::Event::KeyReleased)
{
if(evt.key.code >= 0 && evt.key.code < sf::Keyboard::KeyCount && getKey(evt.key.code))
m_keyStates[evt.key.code] = ButtonState::JustReleased;
}
});
}
sf::Vector2i InputManager::getMousePosition() const
{
return sf::Mouse::getPosition();
}
bool InputManager::getMouseButton(MouseButton mouseButton) const
{
if (mouseButton == MouseButton::Left)
{
return m_mouseButtonStates[MOUSE_BUTTON_LEFT] == ButtonState::Pressed ||
m_mouseButtonStates[MOUSE_BUTTON_LEFT] == ButtonState::JustPressed;
}
else if (mouseButton == MouseButton::Right)
{
return m_mouseButtonStates[MOUSE_BUTTON_RIGHT] == ButtonState::Pressed ||
m_mouseButtonStates[MOUSE_BUTTON_RIGHT] == ButtonState::JustPressed;
}
else
{
return m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] == ButtonState::Pressed ||
m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] == ButtonState::JustPressed;
}
}
bool InputManager::getMouseButtonDown(MouseButton mouseButton) const
{
if (mouseButton == MouseButton::Left)
return m_mouseButtonStates[MOUSE_BUTTON_LEFT] == ButtonState::JustPressed;
else if (mouseButton == MouseButton::Right)
return m_mouseButtonStates[MOUSE_BUTTON_RIGHT] == ButtonState::JustPressed;
else
return m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] == ButtonState::JustPressed;
}
bool InputManager::getMouseButtonUp(MouseButton mouseButton) const
{
if (mouseButton == MouseButton::Left)
return m_mouseButtonStates[MOUSE_BUTTON_LEFT] == ButtonState::JustReleased;
else if (mouseButton == MouseButton::Right)
return m_mouseButtonStates[MOUSE_BUTTON_RIGHT] == ButtonState::JustReleased;
else
return m_mouseButtonStates[MOUSE_BUTTON_MIDDLE] == ButtonState::JustReleased;
}
bool InputManager::getKey(sf::Keyboard::Key key) const
{
if (key >= 0 && key < sf::Keyboard::KeyCount)
return m_keyStates[key] == ButtonState::Pressed || m_keyStates[key] == ButtonState::JustPressed;
else
return false;
}
bool InputManager::getKeyDown(sf::Keyboard::Key key) const
{
if (key >= 0 && key < sf::Keyboard::KeyCount)
return m_keyStates[key] == ButtonState::JustPressed;
else
return false;
}
bool InputManager::getKeyUp(sf::Keyboard::Key key) const
{
if (key >= 0 && key < sf::Keyboard::KeyCount)
return m_keyStates[key] == ButtonState::JustReleased;
else
return false;
}
| [
"[email protected]"
] | |
5bb9c982ac7ffa8bac376dbebfe32b8deab7c318 | d0848bcbdbd7764db256868b989b2e8cdb347cc3 | /src/MiniTTHReader_MarkOwen_All_Classes/MiniTTHReader_MarkOwen_ZDD_all_ttDD_HFOR_COR_ttPTll_ttData.cxx | 0e8249c26af4719be0fdf0ed73137e2016184efa | [] | no_license | ampereira/lipminianalysis | 361625f21e4fbb06955bfd4c9daa96f24a9f633d | 3a1489274aa154e9c954a391da0ec5a5f5281b0c | refs/heads/master | 2020-04-05T23:39:52.035515 | 2014-05-19T14:49:31 | 2014-05-19T14:49:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 30,985 | cxx | // #################################################################################
//
// _ _ __ __ _ _ _ _
// | | (_) | \/ (_) (_) /\ | | (_)
// | | _ _ __ | \ / |_ _ __ _ / \ _ __ __ _| |_ _ ___ _ ___
// | | | | '_ \ | |\/| | | '_ \| | / /\ \ | '_ \ / _` | | | | / __| / __|
// | |____| | |_) | | | | | | | | | | / ____ \| | | | (_| | | |_| \__ \ \__ \
// |______|_| .__/ |_| |_|_|_| |_|_| /_/ \_\_| |_|\__,_|_|\__, |___/_|___/
// | | __/ |
// |_| |___/
//
// #################################################################################
//
// TopD3PDMaker \ | | / | / | | ||
// '-___-+-+' |_/ | | |
// by Antonio Onofre `--___-++--^'| | | /|
// ([email protected]) || | | |' |
// date: 23.Nov.2012 --___ || | | _/| |
// ==---:-++___ | ___--+' | |
// '--_'|'---'+--___ | | |
// '+-_ | '-+__ | |
// ._. ._. ._____
// | | | | | ___ \
// | |_. | | | .___/
// |___| |_| |_|
//
// Note: this code was built from classes developed by
// Nuno Castro ([email protected]) and
// Filipe Veloso ([email protected])
//
//
// #################################################################################
#define MiniTTHReader_cxx
#include "MiniTTHReader.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <cmath>
using std::cout ;
using std::endl ;
// #############################################################################
MiniTTHReader::MiniTTHReader(int i_isData) {
// #############################################################################
//
// Purpose: parameters and tools setting
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// parameters
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FillPhotons = false;
FillElectrons = true;
FillJets = true;
FillMuons = true;
//i_isdata = 1, mc = 0, af2 = -1
if (i_isData == -1) {
isData = 0;
isAF2 = 1;
} else {
isData = i_isData;
isAF2 = 0;
}
// AO 19 Nov 2012 ==== Make sure you are reading the right TChain (in this case a mini ntuple)
tree = new TChain("mini");
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// tool initialisation:
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!!!!!!! No tools are initialized in this class !!!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Init();
}
// #############################################################################
MiniTTHReader::~MiniTTHReader() {
// #############################################################################
//
// Purpose: delete variables and make sure things are properly handled
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
delete tree;
}
// #############################################################################
void MiniTTHReader::Init() {
// #############################################################################
//
// Purpose: The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normaly not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
// Set object pointer
// ========================================
// -- samor 9.Nov.2012 (following lines) --
// -- mini-ntuples leafs and branches --
// ========================================
// #include "Mini_MarkOwen_set_pointers.h"
// #include "Mini_MarkOwen_TRCR12_01_07_set_pointers.h"
#include "Mini_MarkOwen_TRCR14_00_03_set_pointers.h"
// ========================================
// -- samor 9.Nov.2012 (above lines) --
// ========================================
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fCurrent = -1;
fChain->SetMakeClass(1);
// ========================================
// -- samor 9.Nov.2012 (following lines) --
// -- mini-ntuples leafs and branches --
// ========================================
// #include "Mini_MarkOwen_fChains.h"
// #include "Mini_MarkOwen_TRCR12_01_07_fChains.h"
#include "Mini_MarkOwen_TRCR14_00_03_fChains.h"
// ========================================
// -- samor 9.Nov.2012 (above lines) --
// ========================================
Notify();
}
// #############################################################################
void MiniTTHReader::Input(char *file){
// #############################################################################
//
// purpose: open nTuple files
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
tree->Add(file);
}
// #############################################################################
Int_t MiniTTHReader::Isub() {
// #############################################################################
//
// Purpose: return data Run number or MC process number
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
if (isData) return runNumber;
else return channelNumber;
}
// #############################################################################
Int_t MiniTTHReader::LumiBlock() {
// #############################################################################
//
// Purpose: return lumi block
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
int myLumi = -999;
return myLumi;
}
// #############################################################################
Int_t MiniTTHReader::RunNumber() {
// #############################################################################
//
// Purpose: return run number
//
// authors: A.Onofre
// first version: 14.nov.2012
//
// last change: 14.Nov.2012
// by: A.Onofre
//
// #############################################################################
return runNumber;
}
// #############################################################################
Int_t MiniTTHReader::EveNumber() {
// #############################################################################
//
// Purpose: return event number
//
// authors: A.Onofre
// first version: 14.nov.2012
//
// last change: 14.Nov.2012
// by: A.Onofre
//
// #############################################################################
return eventNumber;
}
// #############################################################################
Int_t MiniTTHReader::TruthEleNumber() {
// #############################################################################
//
// Purpose: return number of TRUTH electrons
//
// authors: A.Onofre
// first version: 14.nov.2012
//
// last change: 14.Nov.2012
// by: A.Onofre
//
// #############################################################################
return truE;
}
// #############################################################################
Int_t MiniTTHReader::TruthMuonNumber() {
// #############################################################################
//
// Purpose: return number of TRUTH muons
//
// authors: A.Onofre
// first version: 14.nov.2012
//
// last change: 14.Nov.2012
// by: A.Onofre
//
// #############################################################################
return truM;
}
// #############################################################################
Int_t MiniTTHReader::ElectronTrigger() {
// #############################################################################
//
// Purpose: return electron trigger
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
int myTrigE = 0;
if ( trigE != 0 ) myTrigE = 1;
return myTrigE;
}
// #############################################################################
Int_t MiniTTHReader::MuonTrigger() {
// #############################################################################
//
// Purpose: return muon trigger
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
int myTrigM = 0;
if ( trigM != 0 ) myTrigM = 1;
return myTrigM;
}
// #############################################################################
Int_t MiniTTHReader::Cosmic() {
// #############################################################################
//
// Purpose: verify if event is a cosmic ray
// ( Cosmic = 0, it IS NOT a cosmic event)
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
int isCosmic = 0;
if ( cosmicEvent ) isCosmic = 1;
return isCosmic;
}
// #############################################################################
Int_t MiniTTHReader::HforFlag() {
// #############################################################################
//
// Purpose: veto (special) events in case HF==4
//
// authors: A.Onofre
// first version: 21.Dec.2012
//
// last change: 27.Dec.2012
// by: A.Onofre
//
// #############################################################################
return hfor;
}
// #############################################################################
Double_t MiniTTHReader::Ht_Mini() {
// #############################################################################
//
// Purpose: get Ht from Minintuple
//
// authors: A.Onofre
// first version: 21.Dec.2012
//
// last change: 30.Dec.2012
// by: A.Onofre
//
// #############################################################################
return ht;
}
// #############################################################################
Double_t MiniTTHReader::massInv_LL_Mini() {
// #############################################################################
//
// Purpose: get mLL from Minintuple
//
// authors: A.Onofre
// first version: 21.Dec.2012
//
// last change: 30.Dec.2012
// by: A.Onofre
//
// #############################################################################
return massInv_LL;
}
// #############################################################################
Int_t MiniTTHReader::jet_n_Mini() {
// #############################################################################
//
// Purpose: get number of jets from Minintuple
//
// authors: A.Onofre
// first version: 21.Dec.2012
//
// last change: 30.Dec.2012
// by: A.Onofre
//
// #############################################################################
return jet_n;
}
// #############################################################################
Int_t MiniTTHReader::EleMuoOverlap() {
// #############################################################################
//
// Purpose: check electron-muon overlap
// ( EleMuoOverlap = 0, it is OK, no overlap)
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
int isEleMuoOverlap = 0;
return isEleMuoOverlap;
}
// #############################################################################
Int_t MiniTTHReader::GoodRL() {
// #############################################################################
//
// Purpose: check event passed a goodrunlist
// ( GoodRL = 1, it is OK)
//
// authors: A.Onofre
// first version: 11.Nov.2012
//
// last change: 11.Nov.2012
// by: A.Onofre
//
// #############################################################################
int myPassGRL = 0;
if ( passGRL ) myPassGRL = 1;
return myPassGRL;
}
// #############################################################################
Double_t MiniTTHReader::GeV() {
// #############################################################################
double myGeV = 1000;
return myGeV;
}
// #############################################################################
Double_t MiniTTHReader::MissPx() {
// #############################################################################
//
// Purpose: calculate missing Px
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
return met_et * cos(met_phi) / GeV();
}
// #############################################################################
Double_t MiniTTHReader::MissPy() {
// #############################################################################
//
// Purpose: calculate missing Py
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
return met_et * sin(met_phi) / GeV();
}
// #############################################################################
Double_t MiniTTHReader::MissPt() {
// #############################################################################
//
// Purpose: calculate missing Pt
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
return met_et;
}
// #############################################################################
Double_t MiniTTHReader::Sphericity() {
// #############################################################################
return 0.;
}
// #############################################################################
Double_t MiniTTHReader::Aplanarity() {
// #############################################################################
return 0.;
}
// #############################################################################
Double_t MiniTTHReader::Planarity() {
// #############################################################################
return 0.;
}
// #############################################################################
Double_t MiniTTHReader::Weight() {
// #############################################################################
//
// Purpose: evaluate event weight. Implement here all scale factors
//
// authors: fveloso
// first version: 21.fev.2007
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
// ========================================
// Include Scale Factors Initializations
// ========================================
// Z Scale Factors Applied
#include "HforScale_FDS12GeV_3dist_OS_DD_Zee__Init_Built_Code.C" // Mass Scale Factors for |ll.M()-91|< 12GeV
#include "PtScale_FDS12GeV_3dist_Zdata_fitLINE_OS_CONTROL_DD_Zee__Init_Built_Code.C" // pT Scale Factors for |ll.M()-91|< 12GeV
// ttbar Scale Factors Applied
#include "HforScale_FDS12GeV_OS_ttDD_ee__Init_Built_Code.C" // Rate Scale Factors (Data/Alpgen)
#include "PtScale_ttData_ttPTll_fitLINE_OS_DD_ttee__Init_Built_Code.C" // Pt Scale Factors
double myWeight = 0;
if (isData) {
myWeight = 1.;
} else {
// myWeight = mcWeight; // For MiniData Challenge ONLY
// myWeight = eventWeight_PRETAG; // Use eventWeight_PRETAG if b-tag is NOT applied (assuming you trust b-tag scale factors)
myWeight = eventWeight_BTAG; // Use eventWeight_BTAG if b-tag is applied (trusting b-tag scale factors)
// ====================================================================
// ====================================================================
// Include Scale Factors Corrections
// ====================================================================
// ====================================================================
// ----------------------------------------
// Z Boson Scale Factors
// ----------------------------------------
if ( ( channelNumber >= 107650 && channelNumber <= 107655 ) ||
( channelNumber >= 107660 && channelNumber <= 107665 ) ||
( channelNumber >= 109300 && channelNumber <= 109308 ) ||
( channelNumber >= 126414 && channelNumber <= 126421 ) ){
// Mass scale factors
#include "HforScale_FDS12GeV_3dist_OS_DD_Zee__Fill_Built_Code.C" // Mass Scale Factors for |ll.M()-91|< 12GeV
#include "HforScale_FDS12GeV_3dist_OS_DD_Zmm__Fill_Built_Code.C"
// Pt scale factors
#include "PtScale_FDS12GeV_3dist_Zdata_fitLINE_OS_CONTROL_DD_Zee__Fill_Built_Code.C" // pT Scale Factors for |ll.M()-91|< 12GeV
#include "PtScale_FDS12GeV_3dist_Zdata_fitLINE_OS_CONTROL_DD_Zmm__Fill_Built_Code.C"
}
// ----------------------------------------
// ttbar Scale Factors
// ----------------------------------------
if ( ( channelNumber >= 164440 && channelNumber <= 164443 ) ||
( channelNumber >= 116108 && channelNumber <= 116109 ) ){
// ttbar Rate Scale Factors (Powheg/Alpgen)
#include "HforScale_FDS12GeV_OS_ttDD_ee__Fill_Built_Code.C"
#include "HforScale_FDS12GeV_OS_ttDD_em__Fill_Built_Code.C"
#include "HforScale_FDS12GeV_OS_ttDD_mm__Fill_Built_Code.C"
// ttbar Pt scale factors (Data/Alpgen)
#include "PtScale_ttData_ttPTll_fitLINE_OS_DD_ttee__Fill_Built_Code.C"
#include "PtScale_ttData_ttPTll_fitLINE_OS_DD_ttem__Fill_Built_Code.C"
#include "PtScale_ttData_ttPTll_fitLINE_OS_DD_ttmm__Fill_Built_Code.C"
}
}
return myWeight;
}
// #############################################################################
void MiniTTHReader::FillTruthVec(){
// #############################################################################
//
// purpose: fill vectors of TLorentzVectors-with-index for truth particles
//
// authors: nfcastro, fveloso
// first version: 30.???.??
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
Truth0_El_N = 0;
Truth0_Mu_N = 0;
Truth0_Tau_N = 0;
Truth0_nuEl_N = 0;
Truth0_nuMu_N = 0;
Truth0_nuTau_N = 0;
Truth0_lepTau_N = 0;
Truth0_elTau_N = 0;
Truth0_muTau_N = 0;
Truth0_Nu_El_N = 0;
Truth0_Nu_Mu_N = 0;
Truth0_Nu_Tau_N = 0;
Truth0_El_k=-1;
Truth0_Mu_k=-1;
Truth0_Tau_k=-1;
// ===== AO 8 Oct 2010 ===================== below =========
Int_t IST=0; //...particle status code
//.................t
ITQ=0; //...line for top quark
IQ1=0; //...counter for top quark
t.SetPtEtaPhiM(0., 0., 0., 0.);
//.................tbar
ITB=0; //...line for anti top quark
IQ2=0; //...counter for anti top quark
tb.SetPtEtaPhiM(0., 0., 0., 0.);
//.................W+
IWP=0; //...line for W+
IW1=0; //...counter for W+
Wp.SetPtEtaPhiM(0., 0., 0., 0.);
//.................W-
IWN=0; //...line for W-
IW2=0; //...counter for W-
Wn.SetPtEtaPhiM(0., 0., 0., 0.);
//.................b
IBQ=0; //...line for b
IB1=0; //...counter for bb
b.SetPtEtaPhiM(0., 0., 0., 0.);
//.................bb
IBB=0; //...line for bb
IB2=0; //...counter for bb
bb.SetPtEtaPhiM(0., 0., 0., 0.);
//.................s from t
ISQ=0; //...line for s
IS1=0; //...counter for s
s.SetPtEtaPhiM(0., 0., 0., 0.);
//.................sb from tbar
ISB=0; //...line for sb
IS2=0; //...counter for sb
sb.SetPtEtaPhiM(0., 0., 0., 0.);
//.................dw from t
IDWQ=0; //...line for down
IDW1=0; //...counter for down
dw.SetPtEtaPhiM(0., 0., 0., 0.);
//.................dwb from tbar
IDWB=0; //...line for down bar
IDW2=0; //...counter for down bar
dwb.SetPtEtaPhiM(0., 0., 0., 0.);
//.................W+->f1f2
IWPf1=0; //...line for f1
IWPf2=0; //...line for f2
IWPf1_Coun=0; //...counter for f1
IWPf2_Coun=0; //...counter for f2
IWPtau_Neu=0; //...counter for Tau Neutrinos
IWPtau_elNeu=0; //...counter for ele Neutrinos (from tau decay)
IWPtau_muNeu=0; //...counter for muo Neutrino (from tau decay)
Wpf1.SetPtEtaPhiM(0., 0., 0., 0.);
Wpf2.SetPtEtaPhiM(0., 0., 0., 0.);
pdgID_Wp_dw=0; //...Code of 1st W+ Daughter
pdgID_Wp_up=0; //...Code of 2nd W+ Daughter
//.................W-->f1f2
IWNf1=0; //...line for f1
IWNf2=0; //...line for f2
IWNf1_Coun=0; //...counter for f1
IWNf2_Coun=0; //...counter for f2
IWNtau_Neu=0; //...counter for Tau Neutrinos
IWNtau_elNeu=0; //...counter for ele Neutrinos (from tau decay)
IWNtau_muNeu=0; //...counter for muo Neutrino (from tau decay)
Wnf1.SetPtEtaPhiM(0., 0., 0., 0.);
Wnf2.SetPtEtaPhiM(0., 0., 0., 0.);
pdgID_Wn_dw=0; //...Code of 1st W- Daughter
pdgID_Wn_up=0; //...Code of 2nd W- Daughter
//.................Tau->lep
//
tru_id_leptauWp = 0; //...line of tau(W+)->mu+(e+)
tru_id_leptauWn = 0; //...line of tau(W-)->mu-(e-)
//
// ===== AO 8 Oct 2010 ===================== above =========
TruthVec->clear();
}
// #############################################################################
void MiniTTHReader::FillObjects() {
// #############################################################################
//
// WARNING: READ THE FOLLOWING LINES!!!!!!
// purpose: although formelly this function was used to fill the
// electrons and muons vectors, due to pratical reasons it is the
// only function called: it fills (in this order) the electrons,
// jets and muons vectors
//
// authors: nfcastro, fveloso
// first version: ??.???.??
//
// last change: 10.Nov.2012
// by: A.Onofre
//
// #############################################################################
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// RecoType
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//RecoType = i_RecoType;
PhRecoType = RecoType - RecoType/100*100;
PhIsoCut = RecoType/100 - RecoType/10000*100;
SystID = RecoType/10000 - RecoType/1000000*100;
// reset output
use_Photon_Vec.clear();
use_Electron_Vec.clear();
use_Muon_Vec.clear();
use_Jet_Vec.clear();
LeptonVec->clear();
JetVec->clear();
Vtx->clear();
// usefull variables
jets25inevent=0;
// auxiliar stuff
Int_t kf = 0;
TLorentzVector Good;
Float_t etaCl;
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// photons
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Loop over all photons, if any!!!!
if (FillPhotons) {
// for the moment do nothing!!! minintuples do not have information
}
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// electrons
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//For 2011: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TopCommonObjects2011#Electrons
Double_t elpT, elEta, elPhi, elEne;
Int_t elTruthMatch, elTrigMatch;
//cout << " " << endl;
// Loop over all electrons.
if (FillElectrons) for (Int_t k=0; k<lep_n; ++k){
// ------------------------------check it is an electron
if ( fabs(lep_type[k]) != 11 ) continue;
// ------------------------------accept electron
elpT = lep_pt[k];
elEta = lep_eta[k];
elPhi = lep_phi[k];
elEne = lep_E[k];
Good.SetPtEtaPhiE(elpT, elEta, elPhi, elEne);
if ( lep_charge[k]>0 ) kf = -11; else kf = 11;
// truth and trigger match
elTruthMatch = 0;
if ( lep_truthMatched[k] != 0 ) elTruthMatch = 1 ;
elTrigMatch = 0;
if ( lep_trigMatched[k] != 0 ) elTrigMatch = 1 ;
// creat TLorentzWFlags vector
TLorentzVectorWFlags GoodWFlags(Good, k, kf, 999., elTruthMatch, elTrigMatch);
use_Electron_Vec.push_back(GoodWFlags);
//cout << "%%%%%%% MiniTTHReader_MarkOwen %%%%%%% elTrigMatch " << elTrigMatch << " lep_type[k]: " << lep_type[k] << " lep_pt[k]: " << lep_pt[k] << endl;
} // Fill Electrons done
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// take vertex z information (assumed to be ok)
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if( hasGoodVertex == 1 ){
// ------------------------------accept vertex
TVector3 v( -999., -999., vxp_z);
Vtx->push_back(v);
}
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// jets
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// for jet energy scale and resolution uncertainties:
Double_t jetET, jetpT, jetEta, jetPhi, jetEne;
Int_t jetTruthMatch;
// Loop over all jets
if (FillJets) for (Int_t k=0; k<jet_n; ++k) {
// ------------------------------if jets have MV1>0.795
if ( BTagCut != 999 && jet_MV1[k] > BTagCut ) kf = 5; else kf = 1;
// ------------------------------accept jet
jetpT = jet_pt[k];
jetEta = jet_eta[k];
jetPhi = jet_phi[k];
jetEne = jet_E[k];
Good.SetPtEtaPhiE(jetpT, jetEta, jetPhi, jetEne );
// truth and trigger match
jetTruthMatch = 0;
if ( jet_truthMatched[k] != 0 ) jetTruthMatch = 1 ;
// creat TLorentzWFlags vector
TLorentzVectorWFlags GoodWFlags(Good, k, kf, 999., jetTruthMatch, -1);
use_Jet_Vec.push_back(GoodWFlags);
} // Fill jets done
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// muons
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Double_t mupT, muEta, muPhi, muEne;
Int_t muTruthMatch, muTrigMatch;
// loop over all muons
if (FillMuons) for (Int_t k=0; k<lep_n; ++k){
// ------------------------------check it is an electron
if ( fabs(lep_type[k]) != 13 ) continue;
// ------------------------------accept muon
mupT = lep_pt[k];
muEta = lep_eta[k];
muPhi = lep_phi[k];
muEne = lep_E[k];
if ( lep_charge[k]>0 ) kf = -13; else kf = 13;
Good.SetPtEtaPhiE(mupT, muEta, muPhi, muEne);
// truth and trigger match
muTruthMatch = 0;
if ( lep_truthMatched[k] != 0 ) muTruthMatch = 1 ;
muTrigMatch = 0;
if ( lep_trigMatched[k] != 0 ) muTrigMatch = 1 ;
// creat TLorentzWFlags vector
TLorentzVectorWFlags GoodWFlags(Good, k, kf, 999., muTruthMatch, muTrigMatch);
use_Muon_Vec.push_back(GoodWFlags);
//cout << "%%%%%%% MiniTTHReader_MarkOwen %%%%%%% muTrigMatch " << muTrigMatch << " lep_type[k]: " << lep_type[k] << " lep_pt[k]: " << lep_pt[k] << endl;
} // Fill muons done
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Fill objects
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Fill jets
for (Int_t k=0; k< use_Jet_Vec.size(); ++k) {
JetVec->push_back(use_Jet_Vec[k]);
if ( use_Jet_Vec[k].Pt() > 25*GeV() ) jets25inevent++;
}
// Fill electrons
for (Int_t k=0; k< use_Electron_Vec.size(); ++k) {
LeptonVec->push_back(use_Electron_Vec[k]);
}
// Fill muons
for (Int_t k=0; k< use_Muon_Vec.size(); ++k) {
LeptonVec->push_back(use_Muon_Vec[k]);
}
/*
for (Int_t k=0; k<lep_n; ++k){
cout << "%%%%%%% MiniTTHReader_MarkOwen --- lep_n --- lep_type[k]: " << lep_type[k] << " lep_trigMatched[k] " << lep_trigMatched[k]
<< " lep_pt[k]: " << lep_pt[k] << endl;
}
*/
}
| [
"[email protected]"
] | |
7e3c2a249002d494b926086d66285ebf168e4559 | 3311c9d666d13e0ea13cc5bb6b5fb0a5667de0c1 | /include/INode.h | d605d359ca5dd36665c4690a74559f6782f86501 | [
"LGPL-3.0-only"
] | permissive | tinyrcoin/rcoin | 478163ae5514cd7e7dcf167fa7c82115a88b67bb | 07a45bc7f2b00fb8bd38ca68cbb77076463e21f3 | refs/heads/master | 2021-05-04T13:41:08.996760 | 2018-02-06T17:24:17 | 2018-02-06T17:24:17 | 114,684,062 | 0 | 1 | MIT | 2017-12-27T21:57:51 | 2017-12-18T20:20:47 | Go | UTF-8 | C++ | false | false | 5,102 | h | // Copyright (c) 2012-2017, The CryptoNote developers, The Bytecoin developers
//
// This file is part of Bytecoin.
//
// Bytecoin 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 3 of the License, or
// (at your option) any later version.
//
// Bytecoin 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 Bytecoin. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <cstdint>
#include <functional>
#include <system_error>
#include <vector>
#include "crypto/crypto.h"
#include "CryptoNoteCore/CryptoNoteBasic.h"
#include "CryptoNoteProtocol/CryptoNoteProtocolDefinitions.h"
#include "Rpc/CoreRpcServerCommandsDefinitions.h"
#include "BlockchainExplorerData.h"
#include "ITransaction.h"
namespace CryptoNote {
class INodeObserver {
public:
virtual ~INodeObserver() {}
virtual void peerCountUpdated(size_t count) {}
virtual void localBlockchainUpdated(uint32_t height) {}
virtual void lastKnownBlockHeightUpdated(uint32_t height) {}
virtual void poolChanged() {}
virtual void blockchainSynchronized(uint32_t topHeight) {}
virtual void chainSwitched(uint32_t newTopIndex, uint32_t commonRoot, const std::vector<Crypto::Hash>& hashes) {}
};
struct OutEntry {
uint32_t outGlobalIndex;
Crypto::PublicKey outKey;
};
struct OutsForAmount {
uint64_t amount;
std::vector<OutEntry> outs;
};
struct TransactionShortInfo {
Crypto::Hash txId;
TransactionPrefix txPrefix;
};
struct BlockShortEntry {
Crypto::Hash blockHash;
bool hasBlock;
CryptoNote::BlockTemplate block;
std::vector<TransactionShortInfo> txsShortInfo;
};
struct BlockHeaderInfo {
uint32_t index;
uint8_t majorVersion;
uint8_t minorVersion;
uint64_t timestamp;
Crypto::Hash hash;
Crypto::Hash prevHash;
uint32_t nonce;
bool isAlternative;
uint32_t depth; // last block index = current block index + depth
Difficulty difficulty;
uint64_t reward;
};
class INode {
public:
typedef std::function<void(std::error_code)> Callback;
virtual ~INode() {}
virtual bool addObserver(INodeObserver* observer) = 0;
virtual bool removeObserver(INodeObserver* observer) = 0;
//precondition: must be called in dispatcher's thread
virtual void init(const Callback& callback) = 0;
//precondition: must be called in dispatcher's thread
virtual bool shutdown() = 0;
//precondition: all of following methods must not be invoked in dispatcher's thread
virtual size_t getPeerCount() const = 0;
virtual uint32_t getLastLocalBlockHeight() const = 0;
virtual uint32_t getLastKnownBlockHeight() const = 0;
virtual uint32_t getLocalBlockCount() const = 0;
virtual uint32_t getKnownBlockCount() const = 0;
virtual uint64_t getLastLocalBlockTimestamp() const = 0;
virtual void getBlockHashesByTimestamps(uint64_t timestampBegin, size_t secondsCount, std::vector<Crypto::Hash>& blockHashes, const Callback& callback) = 0;
virtual void getTransactionHashesByPaymentId(const Crypto::Hash& paymentId, std::vector<Crypto::Hash>& transactionHashes, const Callback& callback) = 0;
virtual BlockHeaderInfo getLastLocalBlockHeaderInfo() const = 0;
virtual void relayTransaction(const Transaction& transaction, const Callback& callback) = 0;
virtual void getRandomOutsByAmounts(std::vector<uint64_t>&& amounts, uint16_t outsCount, std::vector<CryptoNote::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount>& result, const Callback& callback) = 0;
virtual void getNewBlocks(std::vector<Crypto::Hash>&& knownBlockIds, std::vector<RawBlock>& newBlocks, uint32_t& startHeight, const Callback& callback) = 0;
virtual void getTransactionOutsGlobalIndices(const Crypto::Hash& transactionHash, std::vector<uint32_t>& outsGlobalIndices, const Callback& callback) = 0;
virtual void queryBlocks(std::vector<Crypto::Hash>&& knownBlockIds, uint64_t timestamp, std::vector<BlockShortEntry>& newBlocks, uint32_t& startHeight, const Callback& callback) = 0;
virtual void getPoolSymmetricDifference(std::vector<Crypto::Hash>&& knownPoolTxIds, Crypto::Hash knownBlockId, bool& isBcActual, std::vector<std::unique_ptr<ITransactionReader>>& newTxs, std::vector<Crypto::Hash>& deletedTxIds, const Callback& callback) = 0;
virtual void getBlocks(const std::vector<uint32_t>& blockHeights, std::vector<std::vector<BlockDetails>>& blocks, const Callback& callback) = 0;
virtual void getBlocks(const std::vector<Crypto::Hash>& blockHashes, std::vector<BlockDetails>& blocks, const Callback& callback) = 0;
virtual void getTransactions(const std::vector<Crypto::Hash>& transactionHashes, std::vector<TransactionDetails>& transactions, const Callback& callback) = 0;
virtual void isSynchronized(bool& syncStatus, const Callback& callback) = 0;
};
}
| [
"[email protected]"
] | |
2612a821c49df74b8019dd60f712c525f1eb363e | 7ffb6afbe554202c77ea30a8fde204c7f8d1bbfa | /16F887_NEC_IR_deocder_MPASMWIN.X/main.inc | f4fa245487dda7e264d1239eb103835bcc898560 | [] | no_license | dsoze1138/16F887_NEC_IR_deocder | 94b99b714154ddd9f93f1e244054c08416b65551 | 3af0094b9c34738555be87d36a9919ed5a3c2797 | refs/heads/master | 2023-06-04T02:10:54.519261 | 2021-06-27T08:26:44 | 2021-06-27T08:26:44 | 267,382,613 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 690 | inc | list n=0, c=250 ; No page breaks, support long lines in list file
list r=dec
errorlevel -302 ; Suppress not in bank zero warning
;
; Include Special Function Register definitions
;
#include "p16f887.inc"
; -------------------------
; Main application
; -------------------------
#ifndef MAIN_INC
#define MAIN_INC
#ifdef MAIN_ASM
#define ExtSymbol global
#else
#define ExtSymbol extern
#endif
;
; Declare the public symbols
;
ExtSymbol main
;
; end of public symbols
#undefine ExtSymbol
;
; Define macros to help with
; bank selection
;
#define BANK0 (h'000')
#define BANK1 (h'080')
#define BANK2 (h'100')
#define BANK3 (h'180')
#endif | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.