hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
108
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e7f614803c22f2011f236925dc43df4b1144dd83
| 2,294
|
cc
|
C++
|
chrome/credential_provider/extension/extension_main.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
chrome/credential_provider/extension/extension_main.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
chrome/credential_provider/extension/extension_main.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2
|
2021-01-05T23:43:46.000Z
|
2021-01-07T23:36:34.000Z
|
// Copyright (c) 2020 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 "windows.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/process/memory.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/win/process_startup_helper.h"
#include "chrome/credential_provider/eventlog/gcp_eventlog_messages.h"
#include "chrome/credential_provider/extension/os_service_manager.h"
#include "chrome/credential_provider/extension/service.h"
#include "chrome/credential_provider/gaiacp/logging.h"
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE /*hPrevInstance*/,
wchar_t* lpCmdLine,
int /*nCmdShow*/) {
base::AtExitManager exit_manager;
base::CommandLine::Init(0, nullptr);
base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
// Initialize logging.
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_NONE;
// See if the log file path was specified on the command line.
base::FilePath log_file_path = cmdline->GetSwitchValuePath("log-file");
if (!log_file_path.empty()) {
settings.logging_dest = logging::LOG_TO_FILE;
settings.log_file_path = log_file_path.value().c_str();
}
logging::InitLogging(settings);
logging::SetLogItems(true, // Enable process id.
true, // Enable thread id.
true, // Enable timestamp.
false); // Enable tickcount.
// Make sure the process exits cleanly on unexpected errors.
base::EnableTerminationOnHeapCorruption();
base::EnableTerminationOnOutOfMemory();
base::win::RegisterInvalidParamHandler();
base::win::SetupCRT(*base::CommandLine::ForCurrentProcess());
// Set the event logging source and category for GCPW Extension.
logging::SetEventSource("GCPW", GCPW_EXTENSION_CATEGORY, MSG_LOG_MESSAGE);
// This initializes and starts ThreadPoolInstance with default params.
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("gcpw_extension");
credential_provider::extension::Service::Get()->Run();
return 0;
}
| 37.606557
| 78
| 0.71796
|
mghgroup
|
e7f789f835be45fa51b41edcbf3a38b3802995b0
| 3,746
|
cpp
|
C++
|
code/silverlib/game_hooks.cpp
|
adm244/f4silver
|
564ecc80991266ae8b3238f553b76d75506f9fbf
|
[
"Unlicense"
] | 6
|
2018-11-07T19:31:30.000Z
|
2021-07-29T02:58:33.000Z
|
code/silverlib/game_hooks.cpp
|
adm244/f4silver
|
564ecc80991266ae8b3238f553b76d75506f9fbf
|
[
"Unlicense"
] | 2
|
2018-06-01T23:27:46.000Z
|
2018-09-11T23:35:58.000Z
|
code/silverlib/game_hooks.cpp
|
adm244/f4silver
|
564ecc80991266ae8b3238f553b76d75506f9fbf
|
[
"Unlicense"
] | 3
|
2019-12-29T14:45:55.000Z
|
2020-05-12T16:34:23.000Z
|
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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 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.
*/
//IMPORTANT(adm244): SCRATCH VERSION JUST TO GET IT UP WORKING
#ifndef _SILVERLIB_GAME_HOOKS_CPP_
#define _SILVERLIB_GAME_HOOKS_CPP_
extern "C" void GameLoop()
{
if( gGameState.IsGameLoaded ) {
if (gGameState.IsPlayerDead != IsActorDead((TESActor *)TES_GetPlayer())) {
gGameState.IsPlayerDead = !gGameState.IsPlayerDead;
if (gGameState.IsPlayerDead) {
//TODO(adm244): place into a separate function call?
INPUT input = {0};
input.type = INPUT_KEYBOARD;
input.ki.wVk = Keys.DeathEvent;
input.ki.dwExtraInfo = GetMessageExtraInfo();
SendInput(1, &input, sizeof(INPUT));
}
}
if (!IsActivationPaused()) {
if( gGameState.IsInterior != IsPlayerInInterior() ) {
gGameState.IsInterior = !gGameState.IsInterior;
if( gGameState.IsInterior ) {
ProcessQueue(&gQueues.InteriorPendingQueue, false);
} else {
ProcessQueue(&gQueues.ExteriorPendingQueue, false);
}
}
ProcessQueue(&gQueues.PrimaryQueue, true);
}
}
}
extern "C" void LoadGameBegin(char *filename)
{
gGameState.IsGameLoaded = false;
}
extern "C" void LoadGameEnd()
{
gGameState.IsGameLoaded = true;
}
extern "C" void HackingPrepare()
{
//TESConsolePrint("Terminal Hacking Entered");
ExtraDataList *extrasList = (*gActiveTerminalREFR)->extraDataList;
assert(extrasList != 0);
ExtraLockData *lockData = ExtraDataList_GetExtraLockData(extrasList);
assert(lockData != 0);
//BSReadWriteLock_Lock(&extrasList->lock);
//NOTE(adm244): unused flag, should be safe
if (lockData->flags & 0x80) {
//NOTE(adm244): using padding here, should be safe
uint8 savedTries = lockData->pad01[0];
if (savedTries == 0) {
lockData->flags &= 0x7F;
} else {
*gTerminalTryCount = (int32)savedTries;
}
}
//BSReadWriteLock_Unlock(&extrasList->lock);
}
extern "C" void HackingQuit()
{
//TESConsolePrint("Terminal Hacking Quitted");
ExtraDataList *extrasList = (*gActiveTerminalREFR)->extraDataList;
assert(extrasList != 0);
ExtraLockData *lockData = ExtraDataList_GetExtraLockData(extrasList);
assert(lockData != 0);
//FIX(adm244): locks game sometimes?
//BSReadWriteLock_Lock(&extrasList->lock);
lockData->flags |= 0x80;
lockData->pad01[0] = (uint8)(*gTerminalTryCount);
//BSReadWriteLock_Unlock(&extrasList->lock);
}
//NOTE(adm244): returns true if VATS is allowed to activate, false otherwise
extern "C" bool VATSActivate()
{
return IsPlayerInCombat();
}
#endif
| 29.730159
| 78
| 0.70929
|
adm244
|
e7fe5c6f89e5e9048437b4d5c476f271f8341ad0
| 1,180
|
cpp
|
C++
|
source/idf/MadCatz.cpp
|
greck2908/IDF
|
0882cc35d88b96b0aea55e112060779654f040a6
|
[
"NASA-1.3"
] | 84
|
2016-06-15T21:26:02.000Z
|
2022-03-12T15:09:57.000Z
|
source/idf/MadCatz.cpp
|
greck2908/IDF
|
0882cc35d88b96b0aea55e112060779654f040a6
|
[
"NASA-1.3"
] | 44
|
2016-10-19T17:35:01.000Z
|
2022-03-11T17:20:51.000Z
|
source/idf/MadCatz.cpp
|
greck2908/IDF
|
0882cc35d88b96b0aea55e112060779654f040a6
|
[
"NASA-1.3"
] | 46
|
2016-06-25T00:18:52.000Z
|
2019-12-19T11:13:15.000Z
|
#include "idf/MadCatz.hh"
namespace idf {
MadCatz::MadCatz() :
forwardBackwardPivot(0, 1023, 511),
leftRightPivot(0, 1023, 511),
twist(0, 255, 127),
leftThrottle(0, 255, 127),
rightThrottle(0, 255, 127),
trigger(0, 1),
button2(0, 1),
button3(0, 1),
button4(0, 1),
button5(0, 1),
button6(0, 1),
button7(0, 1),
button8(0, 1),
button9(0, 1),
button10(0, 1),
button11(0, 1),
buttonX(0, 1),
hatNorth(0, 1),
hatNorthEast(0, 1),
hatEast(0, 1),
hatSouthEast(0, 1),
hatSouth(0, 1),
hatSouthWest(0, 1),
hatWest(0, 1),
hatNorthWest(0, 1),
scrollUp(0, 1),
scrollDown(0, 1) {}
const std::vector<InputLayout::Configurable>& MadCatz::getConfigurables() {
static std::vector<Configurable> inputs;
if (inputs.empty()) {
append(InputLayout::getConfigurables(), inputs);
inputs.push_back(Configurable(forwardBackwardPivot, "Forward/Backward Pivot", "forwardBackwardPivot"));
inputs.push_back(Configurable(leftRightPivot, "Left/Right Pivot", "leftRightPivot"));
inputs.push_back(Configurable(twist, "Twist", "twist"));
}
return inputs;
}
}
| 25.652174
| 111
| 0.616102
|
greck2908
|
e7feb77a0e6a3e4807d2f203b96c6ff3cb432fb3
| 1,002
|
hpp
|
C++
|
coroutine/OverridingList.hpp
|
bxtx999/pmembench
|
9577a15bc7934a681f23b3096f2cd25e09f66874
|
[
"MIT",
"Unlicense"
] | 10
|
2021-02-09T21:07:12.000Z
|
2022-02-10T17:37:06.000Z
|
coroutine/OverridingList.hpp
|
bxtx999/pmembench
|
9577a15bc7934a681f23b3096f2cd25e09f66874
|
[
"MIT",
"Unlicense"
] | null | null | null |
coroutine/OverridingList.hpp
|
bxtx999/pmembench
|
9577a15bc7934a681f23b3096f2cd25e09f66874
|
[
"MIT",
"Unlicense"
] | 4
|
2021-04-12T08:13:09.000Z
|
2022-01-05T02:54:45.000Z
|
#pragma once
// -------------------------------------------------------------------------------------
#include <type_traits>
#include <cassert>
// -------------------------------------------------------------------------------------
template<typename Value>
class OverridingList {
public:
OverridingList()
: head(nullptr) {}
void Push(Value ptr)
{
Entry *entry = reinterpret_cast<Entry *>(ptr);
entry->next = head;
head = ptr;
}
Value Pop()
{
assert(!Empty());
Value result = head;
head = reinterpret_cast<Entry *>(head)->next;
return result;
}
Value Top()
{
assert(!Empty());
return head;
}
bool Empty() const
{
return head == nullptr;
}
private:
static_assert(std::is_pointer<Value>::value, "InPlaceList can not work on values.");
struct Entry {
Value next;
};
Value head;
};
// -------------------------------------------------------------------------------------
| 20.875
| 88
| 0.422156
|
bxtx999
|
e7fecc8db9d079f7a0163210bdc20ae85ebd86fd
| 1,593
|
hpp
|
C++
|
unit_tests/common/test_string_collection.hpp
|
eido5/cubrid
|
f32dbe7cb90f096035c255d7b5f348438bbb5830
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 253
|
2016-03-12T01:03:42.000Z
|
2022-03-14T08:24:39.000Z
|
unit_tests/common/test_string_collection.hpp
|
eido5/cubrid
|
f32dbe7cb90f096035c255d7b5f348438bbb5830
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 1,124
|
2016-03-31T03:48:58.000Z
|
2022-03-31T23:44:04.000Z
|
unit_tests/common/test_string_collection.hpp
|
eido5/cubrid
|
f32dbe7cb90f096035c255d7b5f348438bbb5830
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 268
|
2016-03-02T06:48:44.000Z
|
2022-03-04T05:17:24.000Z
|
/*
* Copyright 2008 Search Solution Corporation
* Copyright 2016 CUBRID Corporation
*
* 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 _TEST_STRING_COLLECTION_HPP_
#define _TEST_STRING_COLLECTION_HPP_
#include <string>
#include <vector>
/*
* string_collection - a class collection of strings
*/
namespace test_common
{
class string_collection
{
public:
template <typename ... Args>
string_collection (Args &... args)
{
register_names (args...);
}
size_t get_count () const;
size_t get_max_length () const;
const char *get_name (size_t name_index) const;
private:
string_collection ();
template <typename FirstArg, typename ... OtherArgs>
void register_names (FirstArg &first, OtherArgs &... other)
{
m_names.push_back (first);
register_names (other...);
}
template <typename OneArg>
void register_names (OneArg &arg)
{
m_names.push_back (arg);
}
std::vector<std::string> m_names;
};
} // namespace test_common
#endif // _TEST_STRING_COLLECTION_HPP_
| 23.776119
| 76
| 0.696798
|
eido5
|
f001aa502b6b916c44ef754284d4953e994763a6
| 2,085
|
hh
|
C++
|
Include/Zion/GameMode.hh
|
ZionMP/Zion
|
7266cc5df81644e54c2744fca7f31b24873b31e7
|
[
"BSD-2-Clause"
] | 1
|
2021-10-14T05:25:47.000Z
|
2021-10-14T05:25:47.000Z
|
Include/Zion/GameMode.hh
|
ZionMP/Zion
|
7266cc5df81644e54c2744fca7f31b24873b31e7
|
[
"BSD-2-Clause"
] | null | null | null |
Include/Zion/GameMode.hh
|
ZionMP/Zion
|
7266cc5df81644e54c2744fca7f31b24873b31e7
|
[
"BSD-2-Clause"
] | null | null | null |
#pragma once
#include "Base.hh"
#include "Player.hh"
#include "Vehicle.hh"
#include "Util.hh"
#include "TextDraw.hh"
#include "Pickup.hh"
namespace Zion {
class GameMode {
public:
virtual void OnPlayerInteriorChange(Player *player, int newInterior, int oldInterior) {}
virtual void OnDialogResponse(Player *player, int dialogId, int buttonId, int listItem, const char *inputText) {}
virtual void OnPlayerClickMap(Player *player, Vector3 position) {}
virtual void OnPlayerCommandText(Player *player, const char *command) {}
virtual void OnClientMessage(Player *player, const char *message) {}
virtual void OnPlayerDeath(Player *player, Player *killer, int reason) {}
virtual void OnPlayerSpawn(Player *player) {}
virtual bool OnPlayerRequestSpawn(Player *player) { return true; }
virtual bool OnPlayerRequestClass(Player *player, int classId) { return true; }
virtual void OnPlayerConnect(Player *player) {}
virtual void OnPlayerDisconnect(Player *player, int reason) {}
virtual void OnPlayerUpdate(Player *player) {}
virtual void OnPlayerEnterCheckpoint(Player *player) {}
virtual void OnPlayerLeaveCheckpoint(Player *player) {}
virtual void OnPlayerEnterRaceCheckpoint(Player *player) {}
virtual void OnPlayerLeaveRaceCheckpoint(Player *player) {}
virtual void OnPlayerStateChange(Player *player, int newState, int oldState) {}
virtual void OnPlayerEnterVehicle(Player *player, Vehicle *vehicle, bool ispassenger) {}
virtual void OnPlayerExitVehicle(Player *player, Vehicle *vehicle) {}
virtual void OnVehicleDamageStatusUpdate(Vehicle *vehicle, Player *player) {}
virtual void OnGameModeInit() {}
virtual void OnGameModeExit() {}
virtual void OnPlayerClickTextDraw(Player *player, TextDraw *textDraw) {}
virtual void OnPlayerPickUpPickup(Player *player, Pickup *pickup) {}
};
};
| 56.351351
| 125
| 0.67482
|
ZionMP
|
f00450a13a46bc0721e45e796715b2a81e3a5215
| 558
|
cpp
|
C++
|
ZenUnitTestUtils/TestingNonDefaults.cpp
|
NeilJustice/ZenUnitAndZenMock
|
bbcb4221d063fa04e4ef3a98143e0f123e3af8d5
|
[
"MIT"
] | 2
|
2019-11-11T17:32:53.000Z
|
2020-04-22T20:42:56.000Z
|
ZenUnitTestUtils/TestingNonDefaults.cpp
|
NeilJustice/ZenUnitAndZenMock
|
bbcb4221d063fa04e4ef3a98143e0f123e3af8d5
|
[
"MIT"
] | 1
|
2018-04-21T07:53:26.000Z
|
2018-05-20T14:50:07.000Z
|
ZenUnitTestUtils/TestingNonDefaults.cpp
|
NeilJustice/ZenUnitAndZenMock
|
bbcb4221d063fa04e4ef3a98143e0f123e3af8d5
|
[
"MIT"
] | null | null | null |
#include "pch.h"
#include "ZenUnitTestUtils/TestingNonDefaults.h"
namespace ZenUnit
{
TestResult TestingNonDefaultTestResult() noexcept
{
const FullTestName fullTestName("Non", "Default", 0);
TestResult constructorFailTestResult = TestResult::ConstructorFail(fullTestName, TestPhaseResult());
return constructorFailTestResult;
}
TestClassResult TestingNonDefaultTestClassResult()
{
TestClassResult testClassResult;
testClassResult._testResults.resize(1);
return testClassResult;
}
}
| 27.9
| 107
| 0.724014
|
NeilJustice
|
f004f4a56457c170fc13c7bf1990d6c17b22871e
| 2,563
|
cpp
|
C++
|
core/runtime/register_trt_op.cpp
|
SrivastavaKshitij/TRTorch
|
cbe186603e21a7e6cb51a4e8182d6e397b33c7ab
|
[
"BSD-3-Clause"
] | 9
|
2020-10-28T14:54:19.000Z
|
2021-12-23T07:23:04.000Z
|
core/runtime/register_trt_op.cpp
|
magnetsrev/TRTorch
|
72bf74b2a2e425e6c83542f99c92b9e551148149
|
[
"BSD-3-Clause"
] | 1
|
2021-07-22T16:58:40.000Z
|
2021-07-22T16:58:40.000Z
|
core/runtime/register_trt_op.cpp
|
magnetsrev/TRTorch
|
72bf74b2a2e425e6c83542f99c92b9e551148149
|
[
"BSD-3-Clause"
] | 2
|
2020-10-12T05:47:33.000Z
|
2020-11-05T09:26:07.000Z
|
#include "c10/cuda/CUDAStream.h"
#include "torch/csrc/jit/runtime/custom_operator.h"
#include "torch/torch.h"
#include "core/runtime/runtime.h"
#include "core/util/prelude.h"
namespace trtorch {
namespace core {
namespace runtime {
std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intrusive_ptr<TRTEngine> compiled_engine) {
LOG_DEBUG("Attempting to run engine (ID: " << compiled_engine->name << ")");
std::vector<void*> gpu_handles;
std::vector<at::Tensor> contig_inputs{};
contig_inputs.reserve(inputs.size());
for (size_t i = 0; i < inputs.size(); i++) {
uint64_t pyt_idx = compiled_engine->in_binding_map[i];
TRTORCH_CHECK(
inputs[pyt_idx].is_cuda(),
"Expected input tensors to have device cuda, found device " << inputs[pyt_idx].device());
auto expected_type = util::toATenDType(compiled_engine->exec_ctx->getEngine().getBindingDataType(i));
TRTORCH_CHECK(
inputs[pyt_idx].dtype() == expected_type,
"Expected input tensors to have type " << expected_type << ", found type " << inputs[pyt_idx].dtype());
auto dims = core::util::toDimsPad(inputs[pyt_idx].sizes(), 1);
auto shape = core::util::toVec(dims);
contig_inputs.push_back(inputs[pyt_idx].view(shape).contiguous());
LOG_DEBUG("Input shape: " << dims);
compiled_engine->exec_ctx->setBindingDimensions(i, dims);
gpu_handles.push_back(contig_inputs.back().data_ptr());
}
TRTORCH_CHECK(
compiled_engine->exec_ctx->allInputDimensionsSpecified(), "Not enough inputs provided (runtime.RunCudaEngine)");
std::vector<at::Tensor> outputs(compiled_engine->num_io.second);
for (size_t o = inputs.size(); o < (compiled_engine->num_io.first + compiled_engine->num_io.second); o++) {
uint64_t pyt_idx = compiled_engine->out_binding_map[o];
auto out_shape = compiled_engine->exec_ctx->getBindingDimensions(o);
LOG_DEBUG("Output shape: " << out_shape);
auto dims = core::util::toVec(out_shape);
auto type = util::toATenDType(compiled_engine->exec_ctx->getEngine().getBindingDataType(o));
outputs[pyt_idx] = std::move(at::empty(dims, {at::kCUDA}).to(type).contiguous());
gpu_handles.push_back(outputs[pyt_idx].data_ptr());
}
c10::cuda::CUDAStream stream = c10::cuda::getCurrentCUDAStream(inputs[0].device().index());
compiled_engine->exec_ctx->enqueueV2(gpu_handles.data(), stream, nullptr);
return outputs;
}
TORCH_LIBRARY(tensorrt, m) {
m.def("execute_engine", execute_engine);
}
} // namespace runtime
} // namespace core
} // namespace trtorch
| 40.046875
| 119
| 0.708935
|
SrivastavaKshitij
|
f005369c1ccf2e02974208beb2f1ab22db4f5cfb
| 2,025
|
hpp
|
C++
|
zen/lexgen/nodes.hpp
|
ZenLibraries/ZenLibraries
|
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
|
[
"Apache-2.0"
] | null | null | null |
zen/lexgen/nodes.hpp
|
ZenLibraries/ZenLibraries
|
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
|
[
"Apache-2.0"
] | 2
|
2020-02-06T17:01:39.000Z
|
2020-02-12T17:50:14.000Z
|
zen/lexgen/nodes.hpp
|
ZenLibraries/ZenLibraries
|
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
|
[
"Apache-2.0"
] | null | null | null |
#ifndef ZEN_LEXGEN_NODES_HPP
#define ZEN_LEXGEN_NODES_HPP
#include <list>
#include <memory>
#include "zen/string.hpp"
#include "zen/dllist.hpp"
namespace zen {
namespace lexgen {
template<typename T>
using SPtr = std::shared_ptr<T>;
enum class NodeType {
rule,
ref_expr,
char_expr,
string_expr,
choice_expr,
seq_expr,
};
class Node {
NodeType type;
public:
inline Node(NodeType type):
type(type) {}
Node* parent_node = nullptr;
inline NodeType get_type() const {
return type;
}
template<typename DerivedT>
inline DerivedT& as() {
return *static_cast<DerivedT*>(this);
}
};
class Expr;
class Rule : public Node {
String name;
SPtr<Expr> expr;
public:
inline Rule(String name):
Node(NodeType::rule), name(name) {}
string_view get_name() const {
return name;
}
};
class Expr : public Node {
public:
inline Expr(NodeType type):
Node(type) {}
};
class CharExpr : public Expr {
Glyph ch;
public:
inline CharExpr(Glyph ch):
Expr(NodeType::char_expr), ch(ch) {}
inline Glyph get_ch() const {
return ch;
}
};
class ChoiceExpr : public Expr {
using Elements = DLList<SPtr<Expr>>;
Elements elements;
public:
template<typename RangeT>
inline ChoiceExpr(RangeT range):
Expr(NodeType::choice_expr), elements(range.begin(), range.end()) {}
Elements::Range get_elements() {
return elements.range();
}
};
class SeqExpr : public Expr {
using Elements = DLList<SPtr<Expr>>;
Elements elements;
public:
inline SeqExpr():
Expr(NodeType::seq_expr) {}
template<typename RangeT>
inline SeqExpr(RangeT range):
Expr(NodeType::seq_expr), elements(range) {}
};
}
}
#endif // of #ifndef ZEN_LEXGEN_NODES_HPP
| 15.944882
| 76
| 0.576296
|
ZenLibraries
|
f00812be6bc41c86a6dcd549186c57d6f57ce8d3
| 2,301
|
hpp
|
C++
|
CookieEngine/include/Gameplay/CGPWorker.hpp
|
qbleuse/Cookie-Engine
|
705d19d9e4c79e935e32244759ab63523dfbe6c4
|
[
"CC-BY-4.0"
] | null | null | null |
CookieEngine/include/Gameplay/CGPWorker.hpp
|
qbleuse/Cookie-Engine
|
705d19d9e4c79e935e32244759ab63523dfbe6c4
|
[
"CC-BY-4.0"
] | null | null | null |
CookieEngine/include/Gameplay/CGPWorker.hpp
|
qbleuse/Cookie-Engine
|
705d19d9e4c79e935e32244759ab63523dfbe6c4
|
[
"CC-BY-4.0"
] | null | null | null |
#ifndef _CGP_WORKER_HPP__
#define _CGP_WORKER_HPP__
#include "ComponentTransform.hpp"
#include "Map.hpp"
#include "Gameplay/CGPResource.hpp"
#include "Gameplay/Income.hpp"
#include <vector>
namespace Cookie
{
namespace ECS
{
class Coordinator;
}
namespace Resources
{
class Prefab;
class Map;
}
namespace Gameplay
{
#define TIME_TO_HARVEST 2
#define PRIMARY_PER_HARVEST 5
#define SECONDARY_PER_HARVEST 4
class CGPWorker
{
public:
//will be replace by the CPGMove with flying later on
float moveSpeed {5};
//Harvest
Income* income {nullptr};
Core::Math::Vec3* posBase {nullptr};
Core::Math::Vec3* posResource {nullptr};
CGPResource* resource {nullptr};
float harvestCountdown {0};
bool isCarryingResource {false};
//Building
std::vector<Resources::Prefab*> possibleBuildings;
std::vector<std::string> possibleBuildingsAtLoad;
Resources::Prefab* BuildingInConstruction {nullptr};
Core::Math::Vec3 posBuilding {0, 0, 0}; // = mousePos when start construction
bool needTostartBuilding {false};
float constructionCountdown {0};
std::vector<Resources::Tile*> occupiedTiles; //get at start of building, then set in building
CGPWorker() {}
~CGPWorker() {}
inline void ToDefault() noexcept
{
income = nullptr;
posBase = nullptr;
posResource = nullptr;
resource = nullptr;
harvestCountdown = 0;
isCarryingResource = false;
possibleBuildings.clear();
possibleBuildingsAtLoad.clear();
BuildingInConstruction = nullptr;
posBuilding = {0, 0, 0};
needTostartBuilding = false;
constructionCountdown = 0;
for (int i = 0; i < occupiedTiles.size(); ++i)
occupiedTiles[i]->isObstacle = false;
occupiedTiles.clear();
}
void Update(Resources::Map& map, ECS::Coordinator& coordinator, int selfId);
void SetResource(Core::Math::Vec3& resourcePos, CGPResource& resourceCGP);
bool StartBuilding(Resources::Map& map, Core::Math::Vec3& _posBuilding, int indexInPossibleBuildings);
};
}
}
#endif // !_CGP_WORKER_HPP__
| 26.755814
| 105
| 0.633638
|
qbleuse
|
f00a35b5915426f9c5ddcecaebf999755c2cc7e7
| 192
|
cpp
|
C++
|
bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandMov.cpp
|
Scorbutics/skalang
|
c8d1869a2f0c7857ee05ef45bd3aa4e537d39558
|
[
"MIT"
] | 3
|
2019-04-08T17:34:19.000Z
|
2020-01-03T04:47:06.000Z
|
bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandMov.cpp
|
Scorbutics/skalang
|
c8d1869a2f0c7857ee05ef45bd3aa4e537d39558
|
[
"MIT"
] | 4
|
2020-04-19T22:09:06.000Z
|
2020-11-06T15:47:08.000Z
|
bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandMov.cpp
|
Scorbutics/skalang
|
c8d1869a2f0c7857ee05ef45bd3aa4e537d39558
|
[
"MIT"
] | null | null | null |
#include "InterpreterCommandMov.h"
SKALANG_BYTECODE_INTERPRETER_COMMAND_DECLARE(MOV)(ExecutionContext& context, const Operand& left, const Operand& right) {
return context.getCell(left);
}
| 32
| 121
| 0.8125
|
Scorbutics
|
f00dbdb3d7bef7604daa1335487649f287667bd0
| 5,221
|
cpp
|
C++
|
libvast/src/system/read_query.cpp
|
rdettai/vast
|
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
|
[
"BSD-3-Clause"
] | 249
|
2019-08-26T01:44:45.000Z
|
2022-03-26T14:12:32.000Z
|
libvast/src/system/read_query.cpp
|
rdettai/vast
|
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
|
[
"BSD-3-Clause"
] | 586
|
2019-08-06T13:10:36.000Z
|
2022-03-31T08:31:00.000Z
|
libvast/src/system/read_query.cpp
|
rdettai/vast
|
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
|
[
"BSD-3-Clause"
] | 37
|
2019-08-16T02:01:14.000Z
|
2022-02-21T16:13:59.000Z
|
// _ _____ __________
// | | / / _ | / __/_ __/ Visibility
// | |/ / __ |_\ \ / / Across
// |___/_/ |_/___/ /_/ Space and Time
//
// SPDX-FileCopyrightText: (c) 2019 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause
#include "vast/system/read_query.hpp"
#include "vast/fwd.hpp"
#include "vast/concept/parseable/to.hpp"
#include "vast/concept/parseable/vast/expression.hpp"
#include "vast/defaults.hpp"
#include "vast/error.hpp"
#include "vast/logger.hpp"
#include "vast/scope_linked.hpp"
#include "vast/system/signal_monitor.hpp"
#include "vast/system/spawn_or_connect_to_node.hpp"
#include <caf/actor.hpp>
#include <caf/event_based_actor.hpp>
#include <caf/scoped_actor.hpp>
#include <caf/settings.hpp>
#include <caf/stateful_actor.hpp>
#include <sys/stat.h>
#include <chrono>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <unistd.h>
using namespace caf;
using namespace std::chrono_literals;
namespace vast::system {
namespace {
caf::expected<std::string>
read_query(const std::vector<std::string>& args, size_t offset) {
if (args.size() > offset + 1)
return caf::make_error(ec::invalid_argument, "spreading a query over "
"multiple arguments is not "
"allowed; please pass it as a "
"single string instead.");
return args[offset];
}
caf::expected<std::string> read_query(std::istream& in) {
auto result = std::string{};
result.assign(std::istreambuf_iterator<char>{in},
std::istreambuf_iterator<char>{});
return result;
}
caf::expected<std::string> read_query(const std::string& path) {
std::ifstream f{path};
if (!f)
return caf::make_error(ec::no_such_file,
fmt::format("unable to read from '{}'", path));
return read_query(f);
}
std::string make_all_query() {
VAST_VERBOSE("not providing a query causes everything to be exported; please "
"be aware that this operation may be very expensive.");
return R"__(#type != "this expression matches everything")__";
}
} // namespace
caf::expected<std::string>
read_query(const invocation& inv, std::string_view file_option,
enum must_provide_query must_provide_query, size_t argument_offset) {
VAST_TRACE_SCOPE("{} {}", inv, file_option);
// The below logic matches the following behavior:
// vast export <format> <query>
// takes the query from the command line
// vast export -r - <format>
// reads the query from stdin.
// echo "query" | vast export <format>
// reads the query from stdin
// vast <query.txt export <format>
// reads the query from `query.txt`
// vast export <format>
// export everything
// Specifying any two conflicting ways of reading the query
// results in an error.
const auto fname = caf::get_if<std::string>(&inv.options, file_option);
const bool has_query_cli = inv.arguments.size() > argument_offset;
bool has_query_stdin = [] {
struct stat stats = {};
if (::fstat(::fileno(stdin), &stats) != 0)
return false;
return S_ISFIFO(stats.st_mode) || S_ISREG(stats.st_mode);
}();
if (fname) {
if (has_query_cli)
return caf::make_error(
ec::invalid_argument,
fmt::format("got query '{}' on the command line and query file"
" '{}' specified via '--read' option",
read_query(inv.arguments, argument_offset), *fname));
if (*fname == "-")
return read_query(std::cin);
if (has_query_stdin)
return caf::make_error(ec::invalid_argument,
fmt::format("stdin is connected to a pipe or "
"regular file and query file '{}'",
" specified via '--read' option",
*fname));
return read_query(*fname);
}
// As a special case we ignore stdin unless we get an actual query
// from it, since empirically this is often connected to the remnants
// of a long-forgotten file descriptor by some distant parent process
// when running in any kind of automated environment like a CI runner.
std::string cin_query;
if (has_query_stdin) {
auto query = read_query(std::cin);
if (!query || query->empty())
has_query_stdin = false;
else
cin_query = *query;
}
if (has_query_stdin && has_query_cli)
return caf::make_error(
ec::invalid_argument,
fmt::format("got query '{}' on the command line and '{}' via stdin",
read_query(inv.arguments, argument_offset), cin_query));
if (has_query_cli)
return read_query(inv.arguments, argument_offset);
if (has_query_stdin)
return cin_query;
if (must_provide_query == must_provide_query::yes)
return caf::make_error(ec::invalid_argument, "no query provided, but "
"command requires a query "
"argument");
// No query provided, make a query that finds everything.
return make_all_query();
}
} // namespace vast::system
| 35.517007
| 80
| 0.622103
|
rdettai
|
f00f829e36cab5051a674b7c0f5f57955c333623
| 4,000
|
hpp
|
C++
|
include/ashespp/RenderPass/RenderPass.hpp
|
DragonJoker/Ashes
|
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
|
[
"MIT"
] | 227
|
2018-09-17T16:03:35.000Z
|
2022-03-19T02:02:45.000Z
|
include/ashespp/RenderPass/RenderPass.hpp
|
DragonJoker/RendererLib
|
0f8ad8edec1b0929ebd10247d3dd0a9ee8f8c91a
|
[
"MIT"
] | 39
|
2018-02-06T22:22:24.000Z
|
2018-08-29T07:11:06.000Z
|
include/ashespp/RenderPass/RenderPass.hpp
|
DragonJoker/Ashes
|
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
|
[
"MIT"
] | 8
|
2019-05-04T10:33:32.000Z
|
2021-04-05T13:19:27.000Z
|
/*
This file belongs to Ashes.
See LICENSE file in root folder.
*/
#ifndef ___AshesPP_RenderPass_HPP___
#define ___AshesPP_RenderPass_HPP___
#pragma once
#include "RenderPassCreateInfo.hpp"
namespace ashes
{
/**
*\brief
* Describes a render pass (which can contain one or more render subpasses).
*/
class RenderPass
: public VkObject
{
public:
/**
*\brief
* Constructor.
*\param[in] device
* The logical device.
*\param[in] createInfo
* The creation informations.
*/
RenderPass( Device const & device
, RenderPassCreateInfo createInfo );
/**
*\brief
* Constructor.
*\param[in] device
* The logical device.
*\param[in] createInfo
* The creation informations.
*/
RenderPass( Device const & device
, std::string const & debugName
, RenderPassCreateInfo createInfo );
/**
*\brief
* Destructor.
*/
~RenderPass();
/**
*\brief
* Creates a frame buffer compatible with this render pass.
*\remarks
* If the compatibility between wanted views and the render pass' formats
* is not possible, a std::runtime_error will be thrown.
*\param[in] dimensions
* The frame buffer's dimensions.
*\param[in] views
* The views for the frame buffer to create.
*\param[in] layers
* The layers count for the frame buffer to create.
*\return
* The created frame buffer.
*/
FrameBufferPtr createFrameBuffer( VkFramebufferCreateInfo info )const;
/**
*\brief
* Creates a frame buffer compatible with this render pass.
*\remarks
* If the compatibility between wanted views and the render pass' formats
* is not possible, a std::runtime_error will be thrown.
*\param[in] dimensions
* The frame buffer's dimensions.
*\param[in] views
* The views for the frame buffer to create.
*\param[in] layers
* The layers count for the frame buffer to create.
*\return
* The created frame buffer.
*/
FrameBufferPtr createFrameBuffer( std::string const & debugName
, VkFramebufferCreateInfo info )const;
/**
*\brief
* Creates a frame buffer compatible with this render pass.
*\remarks
* If the compatibility between wanted views and the render pass' formats
* is not possible, a std::runtime_error will be thrown.
*\param[in] dimensions
* The frame buffer's dimensions.
*\param[in] views
* The views for the frame buffer to create.
*\param[in] layers
* The layers count for the frame buffer to create.
*\return
* The created frame buffer.
*/
FrameBufferPtr createFrameBuffer( VkExtent2D const & dimensions
, ImageViewCRefArray views
, uint32_t layers = 1u )const;
/**
*\brief
* Creates a frame buffer compatible with this render pass.
*\remarks
* If the compatibility between wanted views and the render pass' formats
* is not possible, a std::runtime_error will be thrown.
*\param[in] dimensions
* The frame buffer's dimensions.
*\param[in] views
* The views for the frame buffer to create.
*\param[in] layers
* The layers count for the frame buffer to create.
*\return
* The created frame buffer.
*/
FrameBufferPtr createFrameBuffer( std::string const & debugName
, VkExtent2D const & dimensions
, ImageViewCRefArray views
, uint32_t layers = 1u )const;
/**
*name
* Getters.
*/
/**@{*/
inline size_t getAttachmentCount()const
{
return m_createInfo.attachments.size();
}
inline VkAttachmentDescriptionArray const & getAttachments()const
{
return m_createInfo.attachments;
}
inline Device const & getDevice()const
{
return m_device;
}
inline size_t getSubpassCount()const
{
return m_createInfo.subpasses.size();
}
inline SubpassDescriptionArray const & getSubpasses()const
{
return m_createInfo.subpasses;
}
/**@}*/
/**
*\brief
* VkRenderPass implicit cast operator.
*/
inline operator VkRenderPass const & ()const
{
return m_internal;
}
private:
Device const & m_device;
RenderPassCreateInfo m_createInfo;
VkRenderPass m_internal{};
};
}
#endif
| 24.390244
| 76
| 0.70075
|
DragonJoker
|
f0140c4ac96027b009016a32e66fd6ff5f3e6fc1
| 14,176
|
cpp
|
C++
|
Immortal/Platform/D3D12/RenderContext.cpp
|
QSXW/Immortal
|
32adcc8609b318752dd97f1c14dc7368b47d47d1
|
[
"Apache-2.0"
] | 6
|
2021-09-15T08:56:28.000Z
|
2022-03-29T15:55:02.000Z
|
Immortal/Platform/D3D12/RenderContext.cpp
|
DaShi-Git/Immortal
|
e3345b4ff2a2b9d215c682db2b4530e24cc3b203
|
[
"Apache-2.0"
] | null | null | null |
Immortal/Platform/D3D12/RenderContext.cpp
|
DaShi-Git/Immortal
|
e3345b4ff2a2b9d215c682db2b4530e24cc3b203
|
[
"Apache-2.0"
] | 4
|
2021-12-05T17:28:57.000Z
|
2022-03-29T15:55:05.000Z
|
#include "impch.h"
#include "RenderContext.h"
#include "Framework/Utils.h"
#include "Descriptor.h"
namespace Immortal
{
namespace D3D12
{
Device *RenderContext::UnlimitedDevice = nullptr;
DescriptorAllocator RenderContext::shaderVisibleDescriptorAllocator{
DescriptorPool::Type::ShaderResourceView,
DescriptorPool::Flag::ShaderVisible
};
DescriptorAllocator RenderContext::descriptorAllocators[U32(DescriptorPool::Type::Quantity)] = {
DescriptorPool::Type::ShaderResourceView,
DescriptorPool::Type::Sampler,
DescriptorPool::Type::RenderTargetView,
DescriptorPool::Type::DepthStencilView
};
RenderContext::RenderContext(Description &descrition) :
desc{ descrition }
{
Setup();
}
RenderContext::RenderContext(const void *handle)
{
Setup();
}
RenderContext::~RenderContext()
{
IfNotNullThen<FreeLibrary>(hModule);
}
void RenderContext::Setup()
{
desc.FrameCount = Swapchain::SWAP_CHAIN_BUFFER_COUNT;
uint32_t dxgiFactoryFlags = 0;
#if SLDEBUG
ComPtr<ID3D12Debug> debugController;
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
{
debugController->EnableDebugLayer();
dxgiFactoryFlags |= DXGI_CREATE_FACTORY_DEBUG;
LOG::INFO("Enable Debug Layer: {0}", rcast<void*>(debugController.Get()));
}
#endif
Check(CreateDXGIFactory2(dxgiFactoryFlags, IID_PPV_ARGS(&dxgiFactory)), "Failed to create DXGI Factory");
device = std::make_unique<Device>(dxgiFactory);
UnlimitedDevice = device.get();
for (size_t i = 0; i < SL_ARRAY_LENGTH(descriptorAllocators); i++)
{
descriptorAllocators[i].Init(device.get());
}
shaderVisibleDescriptorAllocator.Init(device.get());
auto adaptorDesc = device->AdaptorDesc();
Super::UpdateMeta(
Utils::ws2s(adaptorDesc.Description).c_str(),
nullptr,
nullptr
);
auto hWnd = rcast<HWND>(desc.WindowHandle->Primitive());
{
Queue::Description queueDesc{};
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
queue = device->CreateQueue(queueDesc);
}
{
Swapchain::Description swapchainDesc{};
CleanUpObject(&swapchainDesc);
swapchainDesc.BufferCount = desc.FrameCount;
swapchainDesc.Width = desc.Width;
swapchainDesc.Height = desc.Height;
swapchainDesc.Format = NORMALIZE(desc.format);
swapchainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapchainDesc.SampleDesc.Count = 1;
swapchainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
// swapchainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
swapchain = std::make_unique<Swapchain>(dxgiFactory, queue->Handle(), hWnd, swapchainDesc);
// swapchain->SetMaximumFrameLatency(desc.FrameCount);
// swapchainWritableObject = swapchain->FrameLatencyWaitableObject();
}
Check(dxgiFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER));
{
CheckDisplayHDRSupport();
color.enableST2084 = color.hdrSupport;
EnsureSwapChainColorSpace(color.bitDepth, color.enableST2084);
/* SetHDRMetaData(
HDRMetaDataPool[color.hdrMetaDataPoolIdx][0],
HDRMetaDataPool[color.hdrMetaDataPoolIdx][1],
HDRMetaDataPool[color.hdrMetaDataPoolIdx][2],
HDRMetaDataPool[color.hdrMetaDataPoolIdx][3]
); */
}
{
DescriptorPool::Description renderTargetViewDesc = {
DescriptorPool::Type::RenderTargetView,
desc.FrameCount,
DescriptorPool::Flag::None,
1
};
renderTargetViewDescriptorHeap = std::make_unique<DescriptorPool>(
device->Handle(),
&renderTargetViewDesc
);
renderTargetViewDescriptorSize = device->DescriptorHandleIncrementSize(
renderTargetViewDesc.Type
);
}
CreateRenderTarget();
for (int i{0}; i < desc.FrameCount; i++)
{
commandAllocator[i] = queue->RequestCommandAllocator();
}
commandList = std::make_unique<CommandList>(
device.get(),
CommandList::Type::Direct,
commandAllocator[0]
);
commandList->Close();
queue->Handle()->ExecuteCommandLists(1, (ID3D12CommandList **)commandList->AddressOf());
// Create synchronization objects and wait until assets have been uploaded to the GPU.
{
frameIndex = swapchain->AcquireCurrentBackBufferIndex();
device->CreateFence(&fence, fenceValues[frameIndex], D3D12_FENCE_FLAG_NONE);
fenceValues[frameIndex]++;
// Create an event handle to use for frame synchronization.
fenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (!fenceEvent)
{
Check(HRESULT_FROM_WIN32(GetLastError()));
return;
}
const uint64_t fenceToWaitFor = fenceValues[frameIndex];
queue->Signal(fence, fenceToWaitFor);
fenceValues[frameIndex]++;
Check(fence->SetEventOnCompletion(fenceToWaitFor, fenceEvent));
WaitForSingleObject(fenceEvent, INFINITE);
}
#ifdef SLDEBUG
device->Set("RenderContext::Device");
#endif
}
void RenderContext::CreateRenderTarget()
{
CPUDescriptor renderTargetViewDescriptor {
renderTargetViewDescriptorHeap->StartOfCPU()
};
for (UINT i = 0; i < desc.FrameCount; i++)
{
swapchain->AccessBackBuffer(i, &renderTargets[i]);
device->CreateView(renderTargets[i], rcast<D3D12_RENDER_TARGET_VIEW_DESC *>(nullptr), renderTargetViewDescriptor);
renderTargetViewDescriptor.Offset(1, renderTargetViewDescriptorSize);
renderTargets[i]->SetName((std::wstring(L"Render Target{") + std::to_wstring(i) + std::wstring(L"}")).c_str());
}
}
inline int ComputeIntersectionArea(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2)
{
// (ax1, ay1) = left-top coordinates of A; (ax2, ay2) = right-bottom coordinates of A
// (bx1, by1) = left-top coordinates of B; (bx2, by2) = right-bottom coordinates of B
return std::max(0, std::min(ax2, bx2) - std::max(ax1, bx1)) * std::max(0, std::min(ay2, by2) - std::max(ay1, by1));
}
void RenderContext::EnsureSwapChainColorSpace(Swapchain::BitDepth bitDepth, bool enableST2084)
{
DXGI_COLOR_SPACE_TYPE colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
switch (bitDepth)
{
case Swapchain::BitDepth::_8:
color.rootConstants[DisplayCurve] = sRGB;
break;
case Swapchain::BitDepth::_10:
colorSpace = enableST2084 ? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
color.rootConstants[DisplayCurve] = enableST2084 ? ST2084 : sRGB;
break;
case Swapchain::BitDepth::_16:
colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
color.rootConstants[DisplayCurve] = None;
break;
default:
break;
}
if (color.currentColorSpace != colorSpace)
{
UINT colorSpaceSupport = 0;
if (swapchain->CheckColorSpaceSupport(colorSpace, &colorSpaceSupport) &&
((colorSpaceSupport & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) == DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT))
{
swapchain->Set(colorSpace);
color.currentColorSpace = colorSpace;
}
}
}
void RenderContext::CheckDisplayHDRSupport()
{
if (dxgiFactory->IsCurrent() == false)
{
Check(CreateDXGIFactory2(0, IID_PPV_ARGS(&dxgiFactory)));
}
ComPtr<IDXGIAdapter1> dxgiAdapter;
Check(dxgiFactory->EnumAdapters1(0, &dxgiAdapter));
UINT i = 0;
ComPtr<IDXGIOutput> currentOutput;
ComPtr<IDXGIOutput> bestOutput;
float bestIntersectArea = -1;
while (dxgiAdapter->EnumOutputs(i, ¤tOutput) != DXGI_ERROR_NOT_FOUND)
{
int ax1 = windowBounds.left;
int ay1 = windowBounds.top;
int ax2 = windowBounds.right;
int ay2 = windowBounds.bottom;
DXGI_OUTPUT_DESC desc{};
Check(currentOutput->GetDesc(&desc));
RECT rect = desc.DesktopCoordinates;
int bx1 = rect.left;
int by1 = rect.top;
int bx2 = rect.right;
int by2 = rect.bottom;
int intersectArea = ComputeIntersectionArea(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2);
if (intersectArea > bestIntersectArea)
{
bestOutput = currentOutput;
bestIntersectArea = ncast<float>(intersectArea);
}
i++;
}
ComPtr<IDXGIOutput6> output6;
Check(bestOutput.As(&output6));
DXGI_OUTPUT_DESC1 desc1;
Check(output6->GetDesc1(&desc1));
color.hdrSupport = (desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020);
}
void RenderContext::SetHDRMetaData(float maxOutputNits, float minOutputNits, float maxCLL, float maxFALL)
{
if (!swapchain)
{
return;
}
if (!color.hdrSupport)
{
swapchain->Set(DXGI_HDR_METADATA_TYPE_NONE, 0, nullptr);
return;
}
static const DisplayChromaticities displayChromaticityList[] = {
{ 0.64000f, 0.33000f, 0.30000f, 0.60000f, 0.15000f, 0.06000f, 0.31270f, 0.32900f }, // Display Gamut Rec709
{ 0.70800f, 0.29200f, 0.17000f, 0.79700f, 0.13100f, 0.04600f, 0.31270f, 0.32900f }, // Display Gamut Rec2020
};
int selectedChroma{ 0 };
if (color.bitDepth == Swapchain::BitDepth::_16 && color.currentColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709)
{
selectedChroma = 0;
}
else if (color.bitDepth == Swapchain::BitDepth::_10 && color.currentColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)
{
selectedChroma = 1;
}
else
{
swapchain->Set(DXGI_HDR_METADATA_TYPE_NONE, 0, nullptr);
}
const DisplayChromaticities &chroma = displayChromaticityList[selectedChroma];
DXGI_HDR_METADATA_HDR10 metaData{};
metaData.RedPrimary[0] = ncast<UINT16>(chroma.RedX * 50000.0f);
metaData.RedPrimary[0] = ncast<UINT16>(chroma.RedX * 50000.0f);
metaData.RedPrimary[1] = ncast<UINT16>(chroma.RedY * 50000.0f);
metaData.GreenPrimary[0] = ncast<UINT16>(chroma.GreenX * 50000.0f);
metaData.GreenPrimary[1] = ncast<UINT16>(chroma.GreenY * 50000.0f);
metaData.BluePrimary[0] = ncast<UINT16>(chroma.BlueX * 50000.0f);
metaData.BluePrimary[1] = ncast<UINT16>(chroma.BlueY * 50000.0f);
metaData.WhitePoint[0] = ncast<UINT16>(chroma.WhiteX * 50000.0f);
metaData.WhitePoint[1] = ncast<UINT16>(chroma.WhiteY * 50000.0f);
metaData.MaxMasteringLuminance = ncast<UINT>(maxOutputNits * 10000.0f);
metaData.MinMasteringLuminance = ncast<UINT>(minOutputNits * 10000.0f);
metaData.MaxContentLightLevel = ncast<UINT16>(maxCLL);
metaData.MaxFrameAverageLightLevel = ncast<UINT16>(maxFALL);
swapchain->Set(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(metaData), &metaData);
}
void RenderContext::CleanUpRenderTarget()
{
for (UINT i = 0; i < desc.FrameCount; i++)
{
if (renderTargets[i])
{
renderTargets[i]->Release();
renderTargets[i] = nullptr;
}
}
}
void RenderContext::WaitForGPU()
{
// Schedule a Signal command in the queue.
queue->Signal(fence, fenceValues[frameIndex]);
// Wait until the fence has been processed.
fence->SetEventOnCompletion(fenceValues[frameIndex], fenceEvent);
WaitForSingleObjectEx(fenceEvent, INFINITE, FALSE);
// Increment the fence value for the current frame.
fenceValues[frameIndex]++;
}
UINT RenderContext::WaitForPreviousFrame()
{
// Schedule a Signal command in the queue.
const UINT64 currentFenceValue = fenceValues[frameIndex];
queue->Signal(fence, currentFenceValue);
// Update the frame index.
frameIndex = swapchain->AcquireCurrentBackBufferIndex();
// If the next frame is not ready to be rendered yet, wait until it is ready.
auto completedValue = fence->GetCompletedValue();
if (completedValue < fenceValues[frameIndex])
{
Check(fence->SetEventOnCompletion(fenceValues[frameIndex], fenceEvent));
WaitForSingleObjectEx(fenceEvent, INFINITE, FALSE);
}
// Set the fence value for the next frame.
fenceValues[frameIndex] = currentFenceValue + 1;
return frameIndex;
}
void RenderContext::UpdateSwapchain(UINT width, UINT height)
{
if (!swapchain)
{
return;
}
WaitForGPU();
CleanUpRenderTarget();
DXGI_SWAP_CHAIN_DESC1 swapchainDesc{};
swapchain->Desc(&swapchainDesc);
swapchain->ResizeBuffers(
width,
height,
DXGI_FORMAT_UNKNOWN,
swapchainDesc.Flags,
desc.FrameCount
);
EnsureSwapChainColorSpace(color.bitDepth, color.enableST2084);
CreateRenderTarget();
}
void RenderContext::WaitForNextFrameResources()
{
frameIndex = swapchain->AcquireCurrentBackBufferIndex();
HANDLE waitableObjects[] = {
swapchainWritableObject,
NULL
};
DWORD numWaitableObjects = 1;
UINT64 fenceValue = fenceValues[frameIndex];
if (fenceValue != 0) // means no fence was signaled
{
fenceValues[frameIndex] = 0;
fence->SetEventOnCompletion(fenceValue, fenceEvent);
waitableObjects[1] = fenceEvent;
numWaitableObjects = 2;
}
WaitForMultipleObjects(numWaitableObjects, waitableObjects, TRUE, INFINITE);
}
void RenderContext::CopyDescriptorHeapToShaderVisible()
{
auto srcDescriptorAllocator = descriptorAllocators[U32(DescriptorPool::Type::ShaderResourceView)];
device->CopyDescriptors(
srcDescriptorAllocator.CountOfDescriptor(),
shaderVisibleDescriptorAllocator.FreeStartOfHeap(),
srcDescriptorAllocator.StartOfHeap(),
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
);
}
}
}
| 31.572383
| 137
| 0.670076
|
QSXW
|
f015cd8f7d4f76500819b27551d6ae929fb9f087
| 11,675
|
cpp
|
C++
|
models/processor/zesto/ZCOMPS-bpred/bpred-tage.cpp
|
Basseuph/manifold
|
99779998911ed7e8b8ff6adacc7f93080409a5fe
|
[
"BSD-3-Clause"
] | 8
|
2016-01-22T18:28:48.000Z
|
2021-05-07T02:27:21.000Z
|
models/processor/zesto/ZCOMPS-bpred/bpred-tage.cpp
|
Basseuph/manifold
|
99779998911ed7e8b8ff6adacc7f93080409a5fe
|
[
"BSD-3-Clause"
] | 3
|
2016-04-15T02:58:58.000Z
|
2017-01-19T17:07:34.000Z
|
models/processor/zesto/ZCOMPS-bpred/bpred-tage.cpp
|
Basseuph/manifold
|
99779998911ed7e8b8ff6adacc7f93080409a5fe
|
[
"BSD-3-Clause"
] | 10
|
2015-12-11T04:16:55.000Z
|
2019-05-25T20:58:13.000Z
|
/* bpred-tage.cpp: TAgged GEometric-history length predictor [Seznec and Michaud, JILP 2006] */
/*
* __COPYRIGHT__ GT
*/
#define COMPONENT_NAME "tage"
#ifdef BPRED_PARSE_ARGS
if(!strcasecmp(COMPONENT_NAME,type))
{
int num_tables;
int bim_size;
int table_size;
int tag_width;
int first_length;
int last_length;
if(sscanf(opt_string,"%*[^:]:%[^:]:%d:%d:%d:%d:%d:%d",name,&num_tables,&bim_size,&table_size,&tag_width,&first_length,&last_length) != 7)
fatal("bad bpred options string %s (should be \"tage:name:num-tables:bim-size:table-size:tag-width:first-hist-length:last-hist-length\")",opt_string);
return new bpred_tage_t(name,num_tables,bim_size,table_size,tag_width,first_length,last_length);
}
#else
#include <math.h>
class bpred_tage_t:public bpred_dir_t
{
#define TAGE_MAX_HIST 512
#define TAGE_MAX_TABLES 16
typedef qword_t bpred_tage_hist_t[8]; /* Max length: 8 * 64 = 512 */
struct bpred_tage_ent_t
{
int tag;
char ctr;
char u;
};
class bpred_tage_sc_t:public bpred_sc_t
{
public:
my2bc_t * current_ctr;
bpred_tage_hist_t lookup_bhr;
int index[TAGE_MAX_TABLES];
int provider;
int provpred;
int alt;
int altpred;
int used_alt;
int provnew;
};
private:
inline void bpred_tage_hist_update(bpred_tage_hist_t H, int outcome)
{
H[7] <<= 1; H[7] |= (H[6]>>63)&1;
H[6] <<= 1; H[6] |= (H[5]>>63)&1;
H[5] <<= 1; H[5] |= (H[4]>>63)&1;
H[4] <<= 1; H[4] |= (H[3]>>63)&1;
H[3] <<= 1; H[3] |= (H[2]>>63)&1;
H[2] <<= 1; H[2] |= (H[1]>>63)&1;
H[1] <<= 1; H[1] |= (H[0]>>63)&1;
H[0] <<= 1; H[0] |= outcome&1;
}
inline void bpred_tage_hist_copy(bpred_tage_hist_t D /*dest*/, bpred_tage_hist_t S /*src*/)
{
D[0] = S[0];
D[1] = S[1];
D[2] = S[2];
D[3] = S[3];
D[4] = S[4];
D[5] = S[5];
D[6] = S[6];
D[7] = S[7];
}
int bpred_tage_hist_hash(bpred_tage_hist_t H, int hist_length, int hash_length)
{
int result = 0;
int i;
int mask = (1<<hash_length)-1;
int row=0;
int pos=0;
for(i=0;i<hist_length/hash_length;i++)
{
result ^= (H[row]>>pos) & mask;
if(pos+hash_length > 64) /* wrap past end of current qword_t */
{
row++;
pos = (pos+hash_length)&63;
result ^= (H[row]<<(hash_length-pos))&mask;
}
else /* includes when pos+HL is exactly 64 */
{
pos = pos+hash_length;
if(pos > 63)
{
pos &=63;
row++;
}
}
}
return result;
}
protected:
int num_tables;
int table_size;
int log_size;
int table_mask;
int tag_width;
int tag_mask;
int bim_size;
int bim_mask;
int alpha;
int * Hlen; /* array of history lengths */
struct bpred_tage_ent_t **T;
int pwin;
zcounter_t * Tuses;
bpred_tage_hist_t bhr;
public:
/* CREATE */
bpred_tage_t(char * const arg_name,
const int arg_num_tables,
const int arg_bim_size,
const int arg_table_size,
const int arg_tag_width,
const int arg_first_length,
const int arg_last_length
)
{
init();
int i;
/* verify arguments are valid */
CHECK_PPOW2(arg_bim_size);
CHECK_PPOW2(arg_table_size);
CHECK_POS(arg_num_tables);
CHECK_POS(arg_tag_width);
CHECK_POS(arg_first_length);
CHECK_POS(arg_last_length);
CHECK_POS_GT(arg_last_length,arg_first_length);
CHECK_POS_LT(arg_num_tables,TAGE_MAX_TABLES);
CHECK_POS_LEQ(arg_last_length,TAGE_MAX_HIST);
for(i=0;i<8;i++)
bhr[i] = 0;
name = strdup(arg_name);
if(!name)
fatal("couldn't malloc tage name (strdup)");
type = strdup(COMPONENT_NAME);
if(!type)
fatal("couldn't malloc tage type (strdup)");
num_tables = arg_num_tables;
table_size = arg_table_size;
table_mask = arg_table_size-1;
log_size = log_base2(arg_table_size);
bim_size = arg_bim_size;
bim_mask = arg_bim_size-1;
double logA = (log(arg_last_length) - log(arg_first_length)) / ((double)arg_num_tables - 2.0);
alpha = (int) exp(logA);
Hlen = (int*) calloc(arg_num_tables,sizeof(*Hlen));
if(!Hlen)
fatal("couldn't calloc Hlen array");
/* Hlen[0] = 0; set by calloc, for 2bc */
for(i=1;i<num_tables-1;i++)
Hlen[i] = (int)floor(arg_first_length * pow(alpha,i-1) + 0.5);
Hlen[i] = arg_last_length;
T = (struct bpred_tage_ent_t**) calloc(num_tables,sizeof(*T));
if(!T)
fatal("couldn't calloc tage T array");
tag_width = arg_tag_width;
tag_mask = (1<<arg_tag_width)-1;
for(i=0;i<num_tables;i++)
{
if(i>0)
{
T[i] = (struct bpred_tage_ent_t*) calloc(table_size,sizeof(**T));
if(!T[i])
fatal("couldn't calloc tage T[%d]",i);
for(int j=0;j<table_size;j++)
{
T[i][j].tag = 0;
T[i][j].ctr = 4; /* weakly taken */
}
}
else /* T0 */
{
T[i] = (struct bpred_tage_ent_t*) calloc(bim_size,sizeof(**T));
if(!T[i])
fatal("couldn't calloc tage T[%d]",i);
for(int j=0;j<bim_size;j++)
T[i][j].ctr = MY2BC_WEAKLY_TAKEN; /* weakly taken */
}
}
Tuses = (zcounter_t*) calloc(num_tables,sizeof(*Tuses));
if(!Tuses)
fatal("failed to calloc Tuses");
pwin = 15;
bits = bim_size*2 /*2bc*/ + (num_tables-1)*(2/*u*/+3/*ctr*/+tag_width)*table_size + arg_last_length + 4/*use altpred?*/;
}
/* DESTROY */
~bpred_tage_t()
{
free(Tuses); Tuses = NULL;
for(int i=0;i<num_tables;i++)
{
free(T[i]); T[i] = NULL;
}
free(T); T = NULL;
free(Hlen); Hlen = NULL;
}
/* LOOKUP */
BPRED_LOOKUP_HEADER
{
class bpred_tage_sc_t * sc = (class bpred_tage_sc_t*) scvp;
for(int i=0;i<num_tables;i++)
{
if(i==0)
sc->index[i] = PC;
else
sc->index[i] = PC^bpred_tage_hist_hash(bhr,Hlen[i],log_size);
}
sc->provider = 0;
sc->provpred = 0;
sc->altpred = 0;
sc->provnew = false;
int hit = false;
int pwin_hit = false;
for(int i=num_tables-1;i>0;i--)
{
struct bpred_tage_ent_t * ent = &T[i][sc->index[i]&table_mask];
if(((unsigned)ent->tag) == (PC&tag_mask))
{
sc->provnew = !ent->u && ((ent->ctr==4) || (ent->ctr==3));
if((pwin < 8) || !sc->provnew)
pwin_hit = true;
sc->provpred = (ent->ctr >= 4);
hit = true;
sc->provider = i;
break;
}
}
sc->alt = -1;
if(hit)
{
for(int i=sc->provider-1;i>0;i--)
{
struct bpred_tage_ent_t * ent = &T[i][sc->index[i]&table_mask];
if((unsigned)ent->tag == (PC&tag_mask))
{
sc->altpred = (ent->ctr >= 4);
sc->alt = i;
break;
}
}
}
if(sc->alt == -1)
{
sc->altpred = MY2BC_DIR(T[0][sc->index[0]&bim_mask].ctr);
sc->alt = 0;
}
sc->updated = false;
BPRED_STAT(lookups++;)
bpred_tage_hist_copy(sc->lookup_bhr,bhr);
if(!pwin_hit)
{
sc->used_alt = true;
return sc->altpred;
}
else
{
sc->used_alt = false;
return sc->provpred;
}
}
/* UPDATE */
BPRED_UPDATE_HEADER
{
class bpred_tage_sc_t * sc = (class bpred_tage_sc_t*) scvp;
if(!sc->updated)
{
BPRED_STAT(updates++;)
BPRED_STAT(num_hits += our_pred == outcome;)
if(sc->used_alt)
Tuses[sc->alt]++;
else
{
assert(sc->provider);
Tuses[sc->provider]++;
}
if(sc->provnew)
{
if(sc->altpred != sc->provpred)
{
if(sc->altpred == outcome)
{
if(pwin < 15)
pwin++;
}
else
{
if(pwin > 0)
pwin--;
}
}
}
/* Allocate new entry if needed */
if(our_pred != outcome) /* mispred */
{
if(sc->provider < (num_tables-1)) /* not already using longest history */
{
int allocated = 0;
int allocated2 = 0;
for(int i=sc->provider+1;i<num_tables;i++)
{
if(T[i][sc->index[i]&table_mask].u == 0)
{
if(!allocated)
allocated = i;
else
{
allocated2 = i;
break;
}
}
}
if(allocated)
{
if(allocated2) /* more than one choice */
{
if((random() & 0xffff) > 21845) /* choose allocated over allocated2 with 2:1 probability */
allocated = allocated2;
}
struct bpred_tage_ent_t * ent = &T[allocated][sc->index[allocated]&table_mask];
ent->u = 0;
ent->ctr = 3+outcome;
ent->tag = PC & tag_mask;
}
else
{
for(int i=sc->provider+1;i<num_tables;i++)
if(T[i][sc->index[i]&table_mask].u > 0)
T[i][sc->index[i]&table_mask].u --;
}
}
}
/* perioidic reset of ubits */
if((updates & ((1<<18)-1)) == 0)
{
int mask = ~1;
if(updates & (1<<18)) /* alternate reset msb and lsb */
mask = ~2;
for(int i=1;i<num_tables;i++)
{
for(int j=0;j<table_size;j++)
T[i][j].u &= mask;
}
}
/* update provider component */
if((sc->provider == 0) || ((sc->alt == 0) && (sc->used_alt)))
MY2BC_UPDATE(T[0][sc->index[0]&bim_mask].ctr,outcome);
else
{
if(outcome)
{
if(T[sc->provider][sc->index[sc->provider]&table_mask].ctr < 7)
T[sc->provider][sc->index[sc->provider]&table_mask].ctr ++;
}
else
{
if(T[sc->provider][sc->index[sc->provider]&table_mask].ctr > 0)
T[sc->provider][sc->index[sc->provider]&table_mask].ctr --;
}
}
/* update u counter: inc if correct and different than altpred */
if(sc->provpred != sc->altpred)
{
if(sc->provpred == outcome)
{
if(T[sc->provider][sc->index[sc->provider]&table_mask].u < 3)
T[sc->provider][sc->index[sc->provider]&table_mask].u ++;
}
else
{
if(T[sc->provider][sc->index[sc->provider]&table_mask].u > 0)
T[sc->provider][sc->index[sc->provider]&table_mask].u --;
}
}
sc->updated = true;
}
}
/* SPEC UPDATE */
BPRED_SPEC_UPDATE_HEADER
{
BPRED_STAT(spec_updates++;)
bpred_tage_hist_update(bhr,our_pred);
}
BPRED_RECOVER_HEADER
{
class bpred_tage_sc_t * sc = (class bpred_tage_sc_t*) scvp;
bpred_tage_hist_copy(bhr,sc->lookup_bhr);
bpred_tage_hist_update(bhr,outcome);
}
BPRED_FLUSH_HEADER
{
class bpred_tage_sc_t * sc = (class bpred_tage_sc_t*) scvp;
bpred_tage_hist_copy(bhr,sc->lookup_bhr);
}
/* REG_STATS */
BPRED_REG_STATS_HEADER
{
bpred_dir_t::reg_stats(sdb,core);
int id = core?core->current_thread->id:0;
for(int i=0;i<num_tables;i++)
{
char buf[256];
char buf2[256];
sprintf(buf,"c%d.%s.uses%d",id,name,i);
sprintf(buf2,"predictions made with %s's T[%d]",name,i);
stat_reg_counter(sdb, true, buf, buf2, &Tuses[i], 0, NULL);
}
}
/* GETCACHE */
BPRED_GET_CACHE_HEADER
{
class bpred_tage_sc_t * sc = new bpred_tage_sc_t();
if(!sc)
fatal("couldn't malloc tage State Cache");
return sc;
}
};
#endif /* BPRED_PARSE_ARGS */
#undef COMPONENT_NAME
| 23.92418
| 154
| 0.53439
|
Basseuph
|
f0185c17361e3baf8c59b31edc45e0b8ac2a6df0
| 6,895
|
cpp
|
C++
|
Apps/APTestApp/MainMac.cpp
|
tom-weatherhead/exeter-asset-processor
|
e19c777427afe66684f308cb7b07448b3481c25e
|
[
"MIT"
] | null | null | null |
Apps/APTestApp/MainMac.cpp
|
tom-weatherhead/exeter-asset-processor
|
e19c777427afe66684f308cb7b07448b3481c25e
|
[
"MIT"
] | null | null | null |
Apps/APTestApp/MainMac.cpp
|
tom-weatherhead/exeter-asset-processor
|
e19c777427afe66684f308cb7b07448b3481c25e
|
[
"MIT"
] | null | null | null |
/* main.c */
#include <Carbon/Carbon.h>
#include "main.h"
#include "ExAPBitmapARGB32.h"
void Initialize(void); /* function prototypes */
void EventLoop(void);
void MakeWindow(void);
void MakeMenu(void);
void DoEvent(EventRecord *event);
void DoMenuCommand(long menuResult);
void DoAboutBox(void);
void DrawWindow(WindowRef window);
void DrawTestImage( WindowRef window );
static OSErr QuitAppleEventHandler(const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon);
Boolean gQuitFlag; /* global */
int main(int argc, char *argv[])
{
Initialize();
MakeWindow();
MakeMenu();
EventLoop();
return 0;
}
void Initialize() /* Initialize the cursor and set up AppleEvent quit handler */
{
OSErr err;
InitCursor();
err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false );
if (err != noErr)
ExitToShell();
}
static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon )
{
gQuitFlag = true;
return noErr;
}
void EventLoop()
{
Boolean gotEvent;
EventRecord event;
gQuitFlag = false;
do
{
gotEvent = WaitNextEvent(everyEvent, &event, kSleepTime, nil);
if (gotEvent)
DoEvent(&event);
} while (!gQuitFlag);
ExitToShell();
}
void MakeWindow() /* Put up a window */
{
Rect wRect;
WindowRef myWindow;
SetRect(&wRect,50,50,600,200); /* left, top, right, bottom */
myWindow = NewCWindow(nil, &wRect, "\pHello", true, zoomNoGrow, (WindowRef) -1, true, 0);
if (myWindow != nil)
SetPortWindowPort(myWindow); /* set port to new window */
else
ExitToShell();
}
void MakeMenu() /* Put up a menu */
{
Handle menuBar;
MenuRef menu;
long response;
OSErr err;
menuBar = GetNewMBar(rMenuBar); /* read menus into menu bar */
if ( menuBar != nil )
{
SetMenuBar(menuBar); /* install menus */
err = Gestalt(gestaltMenuMgrAttr, &response);
if ((err == noErr) && (response & gestaltMenuMgrAquaLayoutMask))
{
menu = GetMenuHandle( mFile );
DeleteMenuItem( menu, iQuit );
DeleteMenuItem( menu, iQuitSeparator );
}
DrawMenuBar();
}
else
ExitToShell();
}
void DoEvent(EventRecord *event)
{
short part;
Boolean hit;
char key;
Rect tempRect;
WindowRef whichWindow;
switch (event->what)
{
case mouseDown:
part = FindWindow(event->where, &whichWindow);
switch (part)
{
case inMenuBar: /* process a moused menu command */
DoMenuCommand(MenuSelect(event->where));
break;
case inSysWindow:
break;
case inContent:
if (whichWindow != FrontWindow())
SelectWindow(whichWindow);
break;
case inDrag: /* pass screenBits.bounds */
GetRegionBounds(GetGrayRgn(), &tempRect);
DragWindow(whichWindow, event->where, &tempRect);
break;
case inGrow:
break;
case inGoAway:
if (TrackGoAway(whichWindow, event->where))
DisposeWindow(whichWindow);
break;
case inZoomIn:
case inZoomOut:
hit = TrackBox(whichWindow, event->where, part);
if (hit)
{
SetPort(GetWindowPort(whichWindow)); // window must be current port
EraseRect(GetWindowPortBounds(whichWindow, &tempRect)); // inval/erase because of ZoomWindow bug
ZoomWindow(whichWindow, part, true);
InvalWindowRect(whichWindow, GetWindowPortBounds(whichWindow, &tempRect));
}
break;
}
break;
case keyDown:
case autoKey:
key = event->message & charCodeMask;
if (event->modifiers & cmdKey)
if (event->what == keyDown)
DoMenuCommand(MenuKey(key));
case activateEvt: /* if you needed to do something special */
break;
case updateEvt:
DrawWindow((WindowRef) event->message);
break;
case kHighLevelEvent:
AEProcessAppleEvent( event );
break;
case diskEvt:
break;
}
}
void DoMenuCommand(long menuResult)
{
short menuID; /* the resource ID of the selected menu */
short menuItem; /* the item number of the selected menu */
menuID = HiWord(menuResult); /* use macros to get item & menu number */
menuItem = LoWord(menuResult);
switch (menuID)
{
case mApple:
switch (menuItem)
{
case iAbout:
DoAboutBox();
break;
case iQuit:
ExitToShell();
break;
default:
break;
}
break;
case mFile:
break;
case mEdit:
break;
}
HiliteMenu(0); /* unhighlight what MenuSelect (or MenuKey) hilited */
}
void DrawWindow( WindowRef window )
{
Rect tempRect;
GrafPtr curPort;
GetPort(&curPort);
SetPort(GetWindowPort(window));
BeginUpdate(window);
EraseRect(GetWindowPortBounds(window, &tempRect));
#if 1
DrawTestImage( window );
#endif
DrawControls(window);
DrawGrowIcon(window);
EndUpdate(window);
SetPort(curPort);
}
void DoAboutBox(void)
{
(void) Alert(kAboutBox, nil); // simple alert dialog box
}
void DrawTestImage( WindowRef window )
{
// Window is 550 pixels wide, 150 pixels high.
ExAPBitmapARGB32 image( 550, 150 );
unsigned char srcPixelArray[4] = { 0xFF, 0x00, 0x00, 0xFF };
const unsigned char * srcPixel = srcPixelArray;
const ExAPRect imageBoundingRect = image.getBoundingRect();
#if 1
image.SolidRectangle( imageBoundingRect, srcPixel );
#endif
image.PixelByteSwap();
image.DrawIntoMacWindow( window );
}
// **** End of File ****
| 26.621622
| 150
| 0.522843
|
tom-weatherhead
|
f01900af12de7167295f7738f8636d6c75b1ce11
| 8,180
|
cc
|
C++
|
src/server/DataBase.cc
|
ryan-rao/LTFS-Data-Management
|
041960282d20aeefb8da20eabf04367a164a5903
|
[
"Apache-2.0"
] | 19
|
2018-06-28T03:53:41.000Z
|
2022-03-15T16:17:33.000Z
|
src/server/DataBase.cc
|
ryan-rao/LTFS-Data-Management
|
041960282d20aeefb8da20eabf04367a164a5903
|
[
"Apache-2.0"
] | 13
|
2018-04-25T15:40:14.000Z
|
2021-01-18T11:03:27.000Z
|
src/server/DataBase.cc
|
ryan-rao/LTFS-Data-Management
|
041960282d20aeefb8da20eabf04367a164a5903
|
[
"Apache-2.0"
] | 8
|
2018-08-08T05:40:31.000Z
|
2022-03-22T16:21:06.000Z
|
/*******************************************************************************
* Copyright 2018 IBM Corp. 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
*
* https://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 "ServerIncludes.h"
DataBase DB;
std::mutex DataBase::trans_mutex;
DataBase::~DataBase()
{
if (dbNeedsClosed)
sqlite3_close(db);
sqlite3_shutdown();
}
void DataBase::cleanup()
{
unlink(Const::DB_FILE.c_str());
unlink((Const::DB_FILE + "-journal").c_str());
}
void DataBase::fits(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
assert(argc == 5);
unsigned long size = sqlite3_value_int64(argv[1]);
unsigned long *free = (unsigned long *) sqlite3_value_int64(argv[2]);
unsigned long *num_found = (unsigned long *) sqlite3_value_int64(argv[3]);
unsigned long *total = (unsigned long *) sqlite3_value_int64(argv[4]);
if (*free >= size) {
*free -= size;
(*total)++;
(*num_found)++;
sqlite3_result_int(ctx, 1);
} else {
(*total)++;
sqlite3_result_int(ctx, 0);
}
}
void DataBase::open(bool dbUseMemory)
{
int rc;
std::string sql;
std::string uri;
if (dbUseMemory)
uri = "file::memory:";
else
uri = std::string("file:") + Const::DB_FILE;
rc = sqlite3_config(SQLITE_CONFIG_URI, 1);
if (rc != SQLITE_OK) {
TRACE(Trace::error, rc);
errno = rc;
THROW(Error::GENERAL_ERROR, uri, rc);
}
rc = sqlite3_initialize();
if (rc != SQLITE_OK) {
TRACE(Trace::error, rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
rc = sqlite3_open_v2(uri.c_str(), &db, SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX |
SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_EXCLUSIVE, NULL);
if (rc != SQLITE_OK) {
TRACE(Trace::error, rc, uri);
errno = rc;
THROW(Error::GENERAL_ERROR, uri, rc);
}
rc = sqlite3_extended_result_codes(db, 1);
if (rc != SQLITE_OK) {
TRACE(Trace::error, rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
dbNeedsClosed = true;
sqlite3_create_function(db, "FITS", 5, SQLITE_UTF8, NULL, &DataBase::fits,
NULL, NULL);
}
void DataBase::createTables()
{
SQLStatement stmt;
stmt(DataBase::CREATE_JOB_QUEUE);
stmt.doall();
stmt(DataBase::CREATE_REQUEST_QUEUE);
stmt.doall();
}
std::string DataBase::opStr(DataBase::operation op)
{
switch (op) {
case MOUNT:
return ltfsdm_messages[LTFSDMX0078I];
case UNMOUNT:
return ltfsdm_messages[LTFSDMX0079I];
case TRARECALL:
return ltfsdm_messages[LTFSDMX0015I];
case SELRECALL:
return ltfsdm_messages[LTFSDMX0014I];
case MIGRATION:
return ltfsdm_messages[LTFSDMX0013I];
case FORMAT:
return ltfsdm_messages[LTFSDMX0081I];
case CHECK:
return ltfsdm_messages[LTFSDMX0082I];
case MOVE:
return ltfsdm_messages[LTFSDMX0087I];
default:
return "";
}
}
std::string DataBase::reqStateStr(DataBase::req_state reqs)
{
switch (reqs) {
case REQ_NEW:
return ltfsdm_messages[LTFSDMX0016I];
case REQ_INPROGRESS:
return ltfsdm_messages[LTFSDMX0017I];
case REQ_COMPLETED:
return ltfsdm_messages[LTFSDMX0018I];
default:
return "";
}
}
int DataBase::lastUpdates()
{
return sqlite3_changes(db);
}
SQLStatement& SQLStatement::operator()(std::string _fmtstr)
{
fmtstr = _fmtstr;
try {
fmt = boost::format(fmtstr);
} catch (const std::exception& e) {
MSG(LTFSDMS0102E);
THROW(Error::GENERAL_ERROR, e.what(), fmtstr);
}
return *this;
}
void SQLStatement::prepare()
{
int rc;
rc = sqlite3_prepare_v2(DB.getDB(), fmt.str().c_str(), -1, &stmt, NULL);
if (rc != SQLITE_OK) {
TRACE(Trace::error, fmt.str(), rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
}
std::string SQLStatement::encode(std::string s)
{
std::string enc;
for (char c : s) {
switch (c) {
case 0047:
enc += "\\0047";
break;
case 0134:
enc += "\\0134";
break;
default:
enc += c;
}
}
return enc;
}
std::string SQLStatement::decode(std::string s)
{
unsigned long pos = s.size();
while ((pos = s.rfind("\\", pos)) != std::string::npos) {
if (s.compare(pos, 5, "\\0047") == 0) {
s.replace(pos, 5, std::string(1, 0047));
} else if (s.compare(pos, 5, "\\0134") == 0) {
s.replace(pos, 5, std::string(1, 0134));
} else {
THROW(Error::GENERAL_ERROR, s);
}
pos--;
}
return s;
}
void SQLStatement::getColumn(int *result, int column)
{
*result = sqlite3_column_int(stmt, column);
}
void SQLStatement::getColumn(unsigned int *result, int column)
{
*result = static_cast<unsigned int>(sqlite3_column_int(stmt, column));
}
void SQLStatement::getColumn(DataBase::operation *result, int column)
{
*result =
static_cast<DataBase::operation>(sqlite3_column_int(stmt, column));
}
void SQLStatement::getColumn(DataBase::req_state *result, int column)
{
*result =
static_cast<DataBase::req_state>(sqlite3_column_int(stmt, column));
}
void SQLStatement::getColumn(FsObj::file_state *result, int column)
{
*result = static_cast<FsObj::file_state>(sqlite3_column_int(stmt, column));
}
void SQLStatement::getColumn(long *result, int column)
{
*result = sqlite3_column_int64(stmt, column);
}
void SQLStatement::getColumn(unsigned long *result, int column)
{
*result = static_cast<unsigned long>(sqlite3_column_int64(stmt, column));
}
void SQLStatement::getColumn(unsigned long long *result, int column)
{
*result =
static_cast<unsigned long long>(sqlite3_column_int64(stmt, column));
}
void SQLStatement::getColumn(std::string *result, int column)
{
const char *column_ctr = reinterpret_cast<const char*>(sqlite3_column_text(
stmt, column));
if (column_ctr != NULL)
*result = decode(std::string(column_ctr));
else
*result = "";
}
std::string SQLStatement::str()
{
std::string str;
try {
str = fmt.str();
} catch (const std::exception& e) {
MSG(LTFSDMS0102E);
THROW(Error::GENERAL_ERROR, e.what(), fmtstr);
}
return str;
}
void SQLStatement::bind(int num, int value)
{
int rc;
if ((rc = sqlite3_bind_int(stmt, num, value)) != SQLITE_OK) {
TRACE(Trace::error, rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
}
void SQLStatement::bind(int num, std::string value)
{
int rc;
if ((rc = sqlite3_bind_text(stmt, num, value.c_str(), value.size(), 0))
!= SQLITE_OK) {
TRACE(Trace::error, rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
}
void SQLStatement::finalize()
{
if (stmt_rc != SQLITE_ROW && stmt_rc != SQLITE_DONE) {
TRACE(Trace::error, fmt.str(), stmt_rc);
errno = stmt_rc;
THROW(Error::GENERAL_ERROR, stmt_rc);
}
int rc = sqlite3_finalize(stmt);
if (rc != SQLITE_OK) {
TRACE(Trace::error, fmt.str(), rc);
errno = rc;
THROW(Error::GENERAL_ERROR, rc);
}
}
void SQLStatement::doall()
{
prepare();
step();
finalize();
}
| 22.349727
| 81
| 0.590098
|
ryan-rao
|
f01a5de4d6d19de7b46c6a567e60cd2d44ae84e6
| 1,786
|
cpp
|
C++
|
bachelor/computer-graphics/Les1/CG1_2DVector.cpp
|
Brent-rb/University
|
caae9c7d8e44bf7589865517f786529b1f171059
|
[
"MIT"
] | null | null | null |
bachelor/computer-graphics/Les1/CG1_2DVector.cpp
|
Brent-rb/University
|
caae9c7d8e44bf7589865517f786529b1f171059
|
[
"MIT"
] | null | null | null |
bachelor/computer-graphics/Les1/CG1_2DVector.cpp
|
Brent-rb/University
|
caae9c7d8e44bf7589865517f786529b1f171059
|
[
"MIT"
] | null | null | null |
// CG1_2DVector.cpp: implementation of the CG1_2DVector class.
//
//////////////////////////////////////////////////////////////////////
#include "CG1_2DVector.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
/********************************************************************/
CG1_2DVector::CG1_2DVector()
{
}
/********************************************************************/
CG1_2DVector::CG1_2DVector(float X, float Y)
{
x = X;
y = Y;
}
/********************************************************************/
CG1_2DVector::~CG1_2DVector()
{
}
/********************************************************************/
float CG1_2DVector::operator*(const CG1_2DVector &v) // DOT-PRODUKT
{
return ((x * v.x) + (y * v.y));
}
/********************************************************************/
CG1_2DVector &CG1_2DVector::operator=(const CG1_2DVector &v) // TOEKENNINGS-OPERATOR
{
x = v.x;
y = v.y;
return *this;
}
/********************************************************************/
CG1_2DVector CG1_2DVector::operator-() // NEGATIE
{
CG1_2DVector Neg;
Neg.SetXY(-x, -y);
return Neg;
}
/********************************************************************/
void CG1_2DVector::SetXY(float NewX, float NewY)
{
x = NewX;
y = NewY;
}
/********************************************************************/
float CG1_2DVector::GetX()
{
return x;
}
/********************************************************************/
float CG1_2DVector::GetY()
{
return y;
}
/********************************************************************/
| 21.518072
| 85
| 0.285554
|
Brent-rb
|
f01cea47e637935b9573a782878720ddcdf1d0fa
| 1,902
|
cpp
|
C++
|
CS208_Lab/huffman_code.cpp
|
zc-BEAR/Course_Repo
|
bbbcc83992f3e837dfb21615bb8e81d86f397f83
|
[
"MIT"
] | null | null | null |
CS208_Lab/huffman_code.cpp
|
zc-BEAR/Course_Repo
|
bbbcc83992f3e837dfb21615bb8e81d86f397f83
|
[
"MIT"
] | null | null | null |
CS208_Lab/huffman_code.cpp
|
zc-BEAR/Course_Repo
|
bbbcc83992f3e837dfb21615bb8e81d86f397f83
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
struct Node{
int c;
int num;
Node* fa;
bool operator < (const Node &x)const{
return x.num < num;
}
}num[100];
int t, str_len, fa_index;
int val[100];
long long ans;
string str;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> t;
for (int i = 1; i <= 99; ++i) num[i].c = i + 96;
while(t--){
cin>>str;
fa_index = 27;
str_len = str.size();
for (int i = 0; i < str_len; ++i) {
num[str[i] - 96].num++;
}
priority_queue<Node> q;
for(int i = 1;i <= 26;i++){
if(num[i].num)q.push(num[i]);
}
if(q.size()==1){
ans = q.top().num;
cout<<ans<<"\n";
ans = 0;
while(!q.empty())q.pop();
for (int i = 1; i <= 99; ++i) {
num[i].num = 0,val[i] = 0,num[i].fa = nullptr;
}
continue;
}
while(!q.empty()){
int tmp1 = q.top().c - 96;q.pop();
if(q.empty())break;
int tmp2 = q.top().c - 96;q.pop();
num[fa_index].num = num[tmp1].num + num[tmp2].num;
num[tmp1].fa = &num[fa_index];
num[tmp2].fa = &num[fa_index];
q.push(num[fa_index]);
fa_index++;
}
for (int i = 1; i <= 26; ++i) {
val[i] = -1;
}
for(int i = 1;i <= 26;i++){
Node* pr = &num[i];
while(pr != nullptr ){
val[i]++;
pr = pr->fa;
}
}
for (int i = 1; i <= 26; ++i) {
ans += num[i].num * val[i];
}
cout<<ans<<"\n";
ans = 0;
while(!q.empty())q.pop();
for (int i = 1; i <= 99; ++i) {
num[i].num = 0,val[i] = 0,num[i].fa = nullptr;
}
}
return 0;
}
| 24.701299
| 62
| 0.388013
|
zc-BEAR
|
f01e5468ec34fc81f5bfb7f0da1d4d62e9107d7c
| 387
|
cpp
|
C++
|
leetcode/two-pointer/11.container-with-most-water.cpp
|
saurabhraj042/dsaPrep
|
0973a03bc565a2850003c7e48d99b97ff83b1d01
|
[
"MIT"
] | 23
|
2021-10-30T04:11:52.000Z
|
2021-11-27T09:16:18.000Z
|
leetcode/two-pointer/11.container-with-most-water.cpp
|
Pawanupadhyay10/placement-prep
|
0449fa7cbc56e7933e6b090936ab7c15ca5f290f
|
[
"MIT"
] | null | null | null |
leetcode/two-pointer/11.container-with-most-water.cpp
|
Pawanupadhyay10/placement-prep
|
0449fa7cbc56e7933e6b090936ab7c15ca5f290f
|
[
"MIT"
] | 4
|
2021-10-30T03:26:05.000Z
|
2021-11-14T12:15:04.000Z
|
// saurabhraj042
class Solution {
public:
int maxArea(vector<int>& A) {
int i = 0,j = A.size()-1;
int mx = j * min( A[i],A[j] );
while( i < j )
{
if( (j-i) * min( A[j],A[i] ) > mx)
mx=(j-i)*min(A[j],A[i]);
if( A[i] < A[j]) i++;
else j--;
}
return mx;
}
};
| 19.35
| 46
| 0.330749
|
saurabhraj042
|
f01ebd1ec67d7007bf3487191f5484056bc66b78
| 5,238
|
cpp
|
C++
|
clang-tools-extra/test/pp-trace/pp-trace-pragma-general.cpp
|
medismailben/llvm-project
|
e334a839032fe500c3bba22bf976ab7af13ce1c1
|
[
"Apache-2.0"
] | 2,338
|
2018-06-19T17:34:51.000Z
|
2022-03-31T11:00:37.000Z
|
clang-tools-extra/test/pp-trace/pp-trace-pragma-general.cpp
|
medismailben/llvm-project
|
e334a839032fe500c3bba22bf976ab7af13ce1c1
|
[
"Apache-2.0"
] | 3,740
|
2019-01-23T15:36:48.000Z
|
2022-03-31T22:01:13.000Z
|
clang-tools-extra/test/pp-trace/pp-trace-pragma-general.cpp
|
medismailben/llvm-project
|
e334a839032fe500c3bba22bf976ab7af13ce1c1
|
[
"Apache-2.0"
] | 500
|
2019-01-23T07:49:22.000Z
|
2022-03-30T02:59:37.000Z
|
// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- | FileCheck --strict-whitespace %s
#pragma clang diagnostic push
#pragma clang diagnostic pop
#pragma clang diagnostic ignored "-Wformat"
#pragma clang diagnostic warning "-Wformat"
#pragma clang diagnostic error "-Wformat"
#pragma clang diagnostic fatal "-Wformat"
#pragma GCC diagnostic push
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wformat"
#pragma GCC diagnostic warning "-Wformat"
#pragma GCC diagnostic error "-Wformat"
#pragma GCC diagnostic fatal "-Wformat"
void foo() {
#pragma clang __debug captured
{ }
}
// CHECK: ---
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:3:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnosticPush
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:3:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:4:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnosticPop
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:4:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:5:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:5:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: Mapping: MAP_IGNORE
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:6:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:6:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: Mapping: MAP_WARNING
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:7:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:7:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: Mapping: MAP_ERROR
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:8:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:8:15"
// CHECK-NEXT: Namespace: clang
// CHECK-NEXT: Mapping: MAP_FATAL
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:10:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnosticPush
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:10:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:11:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnosticPop
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:11:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:12:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:12:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: Mapping: MAP_IGNORE
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:13:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:13:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: Mapping: MAP_WARNING
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:14:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:14:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: Mapping: MAP_ERROR
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:15:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDiagnostic
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:15:13"
// CHECK-NEXT: Namespace: GCC
// CHECK-NEXT: Mapping: MAP_FATAL
// CHECK-NEXT: Str: -Wformat
// CHECK-NEXT: - Callback: PragmaDirective
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:18:1"
// CHECK-NEXT: Introducer: PIK_HashPragma
// CHECK-NEXT: - Callback: PragmaDebug
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-pragma-general.cpp:18:23"
// CHECK-NEXT: DebugType: captured
// CHECK-NEXT: - Callback: EndOfMainFile
// CHECK-NEXT: ...
| 44.016807
| 99
| 0.653685
|
medismailben
|
f01f9b2b18a3d97fdf502b9b2fde13cba6e1418a
| 849
|
cpp
|
C++
|
Source/PluginPostEffects_Core1/Exports.cpp
|
shanefarris/CoreGameEngine
|
5bef275d1cd4e84aa059f2f4f9e97bfa2414d000
|
[
"MIT"
] | 3
|
2019-04-12T15:22:53.000Z
|
2022-01-05T02:59:56.000Z
|
Source/PluginPostEffects_Core1/Exports.cpp
|
shanefarris/CoreGameEngine
|
5bef275d1cd4e84aa059f2f4f9e97bfa2414d000
|
[
"MIT"
] | null | null | null |
Source/PluginPostEffects_Core1/Exports.cpp
|
shanefarris/CoreGameEngine
|
5bef275d1cd4e84aa059f2f4f9e97bfa2414d000
|
[
"MIT"
] | 2
|
2019-04-10T22:46:21.000Z
|
2020-05-27T16:21:37.000Z
|
#define DLL_EXPORT
#include "Exports.h"
#include "Plugins/IPostEffectFactory.h"
#include "Factories.h"
namespace Core
{
namespace Plugin
{
CPostEffectFactory_Bloom* Bloom = nullptr;
CPostEffectFactory_Hdr* Hdr = nullptr;
CPostEffectFactory_MotionBlur* MotionBlur = nullptr;
CPostEffectFactory_SSAO* Ssao = nullptr;
extern "C"
{
DECLDIR void GetFactories(Vector<IPostEffectFactory*>& list)
{
Bloom = new CPostEffectFactory_Bloom();
if(Bloom)
list.push_back(Bloom);
Hdr = new CPostEffectFactory_Hdr();
if(Hdr)
list.push_back(Hdr);
MotionBlur = new CPostEffectFactory_MotionBlur();
if(MotionBlur)
list.push_back(MotionBlur);
Ssao = new CPostEffectFactory_SSAO();
if(Ssao)
list.push_back(Ssao);
}
DECLDIR E_PLUGIN GetPluginType(void)
{
return Core::Plugin::EP_POSTEFFECT;
}
}
}
}
| 19.295455
| 62
| 0.720848
|
shanefarris
|
f020af42a32e14a0c8a88f5f7986e92a282436ca
| 376
|
cpp
|
C++
|
moosh/src/msg_handler.cpp
|
mujido/moove
|
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
|
[
"Apache-2.0"
] | null | null | null |
moosh/src/msg_handler.cpp
|
mujido/moove
|
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
|
[
"Apache-2.0"
] | null | null | null |
moosh/src/msg_handler.cpp
|
mujido/moove
|
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
|
[
"Apache-2.0"
] | null | null | null |
#include "msg_handler.hpp"
#include <iostream>
void MessageHandler::error(const std::string& msg, unsigned lineNum)
{
std::cerr << "Error, line " << lineNum + m_lineOffset << ": " << msg << std::endl;
}
void MessageHandler::warning(const std::string& msg, unsigned lineNum)
{
std::cerr << "Warning, line " << lineNum + m_lineOffset << ": " << msg << std::endl;
}
| 25.066667
| 87
| 0.638298
|
mujido
|
f0226c78fa7c6e4f85aedf840418a5f8df8a9b15
| 10,309
|
cpp
|
C++
|
HaloTAS/TASDLL/tas_hooks.cpp
|
s3anyboy/HaloTAS
|
9584786f19e1475399298fda2d5783d47623cccd
|
[
"MIT"
] | 6
|
2019-09-10T19:47:04.000Z
|
2020-11-26T08:32:36.000Z
|
HaloTAS/TASDLL/tas_hooks.cpp
|
s3anyboy/HaloTAS
|
9584786f19e1475399298fda2d5783d47623cccd
|
[
"MIT"
] | 13
|
2018-11-24T09:37:49.000Z
|
2021-10-22T02:29:11.000Z
|
HaloTAS/TASDLL/tas_hooks.cpp
|
s3anyboy/HaloTAS
|
9584786f19e1475399298fda2d5783d47623cccd
|
[
"MIT"
] | 3
|
2020-07-28T09:19:14.000Z
|
2020-09-02T04:48:49.000Z
|
#include "tas_hooks.h"
#include "tas_logger.h"
#include "tas_input_handler.h"
#include "randomizer.h"
#include "halo_engine.h"
#include "render_d3d9.h"
// Function Defs
typedef HRESULT(__stdcall* GetDeviceState_t)(LPDIRECTINPUTDEVICE*, DWORD, LPVOID*);
typedef HRESULT(__stdcall* GetDeviceData_t)(LPDIRECTINPUTDEVICE*, DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD);
typedef void(__cdecl* SimulateTick_t)(int);
typedef char(__cdecl* AdvanceFrame_t)(float);
typedef int(__cdecl* BeginLoop_t)();
typedef void(__cdecl* GetMouseKeyboardGamepadInput_t)();
typedef void(__cdecl* AdvanceEffectsTimer_t)(float);
typedef HRESULT(__stdcall* D3D9BeginScene_t)(IDirect3DDevice9* pDevice);
typedef HRESULT(__stdcall* D3D9EndScene_t)(IDirect3DDevice9* pDevice);
typedef HRESULT(__stdcall* D3D9Present_t)(IDirect3DDevice9* pDevice, const RECT*, const RECT*, HWND, RGNDATA*);
// Declarations
HRESULT __stdcall hkGetDeviceState(LPDIRECTINPUTDEVICE* pDevice, DWORD cbData, LPVOID* lpvData);
HRESULT __stdcall hkGetDeviceData(LPDIRECTINPUTDEVICE* pDevice, DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags);
void __cdecl hkSimulateTick(int);
char __cdecl hkAdvanceFrame(float);
int __cdecl hkBeginLoop();
void __cdecl hkGetMouseKeyboardGamepadInput();
void __cdecl hkAdvanceEffectsTimer(float);
HRESULT __stdcall hkD3D9EndScene(IDirect3DDevice9* pDevice);
HRESULT __stdcall hkD3D9BeginScene(IDirect3DDevice9* pDevice);
HRESULT __stdcall hkD3D9Present(IDirect3DDevice9* pDevice, const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion);
// Store original pointers to old functions
GetDeviceState_t originalGetDeviceState;
GetDeviceData_t originalGetDeviceData;
SimulateTick_t originalSimulateTick = (SimulateTick_t)(0x45B780);
AdvanceFrame_t originalAdvanceFrame = (AdvanceFrame_t)(0x470BF0);
BeginLoop_t originalBeginLoop = (BeginLoop_t)(0x4C6E80);
AdvanceEffectsTimer_t originalAdvanceEffectsTimer = (AdvanceEffectsTimer_t)(0x45b4f0);
GetMouseKeyboardGamepadInput_t originalGetMouseKeyboardGamepadInput = (GetMouseKeyboardGamepadInput_t)(0x490760);
D3D9EndScene_t originalD3D9EndScene;
D3D9BeginScene_t originalD3D9BeginScene;
D3D9Present_t originalD3D9Present;
void tas_hooks::detours_error(LONG detourResult) {
if (detourResult != NO_ERROR) {
throw;
}
}
void tas_hooks::hook_function(PVOID* originalFunc, PVOID replacementFunc)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
detours_error(DetourAttach(originalFunc, replacementFunc));
detours_error(DetourTransactionCommit());
}
void tas_hooks::unhook_function(PVOID* originalFunc, PVOID replacementFunc)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(originalFunc, replacementFunc);
DetourTransactionCommit();
}
void tas_hooks::hook_dinput8()
{
// DIRECTINPUT8
LPDIRECTINPUT8 pDI8;
DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&pDI8, NULL);
if (!pDI8) {
tas_logger::fatal("Couldn't get dinput8 handle.");
exit(1);
}
LPDIRECTINPUTDEVICE8 pDI8Dev = nullptr;
pDI8->CreateDevice(GUID_SysKeyboard, &pDI8Dev, NULL);
if (!pDI8Dev) {
pDI8->Release();
tas_logger::fatal("Couldn't create dinput8 device.");
exit(1);
}
void** dinputVTable = *reinterpret_cast<void***>(pDI8Dev);
originalGetDeviceState = (GetDeviceState_t)(dinputVTable[9]);
originalGetDeviceData = (GetDeviceData_t)(dinputVTable[10]);
pDI8Dev->Release();
pDI8->Release();
hook_function(&(PVOID&)originalGetDeviceState, hkGetDeviceState);
hook_function(&(PVOID&)originalGetDeviceData, hkGetDeviceData);
}
void tas_hooks::hook_d3d9()
{
IDirect3D9* pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if (!pD3D) {
tas_logger::fatal("Couldn't get d3d9 handle.");
exit(1);
}
int mainMonitorX = GetSystemMetrics(SM_CXSCREEN);
int mainMonitorY = GetSystemMetrics(SM_CYSCREEN);
D3DPRESENT_PARAMETERS d3dpp = { 0 };
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = GetForegroundWindow();
d3dpp.Windowed = TRUE;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = std::clamp(mainMonitorX, 800, 8000);
d3dpp.BackBufferHeight = std::clamp(mainMonitorY, 600, 8000);
IDirect3DDevice9* dummyD3D9Device = nullptr;
pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3dpp.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &dummyD3D9Device);
if (!dummyD3D9Device)
{
pD3D->Release();
tas_logger::fatal("Couldn't create dummy d3d9 device.");
exit(1);
}
void** d3d9VTable = *reinterpret_cast<void***>(dummyD3D9Device);
#if _DEBUG
// Breakpoint to find additional D3D functions if needed
// Make sure symbols are loaded
for (int i = 0; i < 180; i++) {
auto funcPtr = d3d9VTable[i];
}
#endif
originalD3D9BeginScene = (D3D9BeginScene_t)(d3d9VTable[41]);
hook_function(&(PVOID&)originalD3D9BeginScene, hkD3D9BeginScene);
originalD3D9EndScene = (D3D9EndScene_t)(d3d9VTable[42]);
hook_function(&(PVOID&)originalD3D9EndScene, hkD3D9EndScene);
originalD3D9Present = (D3D9Present_t)(d3d9VTable[17]);
hook_function(&(PVOID&)originalD3D9Present, hkD3D9Present);
dummyD3D9Device->Release();
pD3D->Release();
}
void tas_hooks::hook_halo_engine()
{
hook_function(&(PVOID&)originalSimulateTick, hkSimulateTick);
hook_function(&(PVOID&)originalAdvanceFrame, hkAdvanceFrame);
hook_function(&(PVOID&)originalBeginLoop, hkBeginLoop);
hook_function(&(PVOID&)originalGetMouseKeyboardGamepadInput, hkGetMouseKeyboardGamepadInput);
hook_function(&(PVOID&)originalAdvanceEffectsTimer, hkAdvanceEffectsTimer);
}
void tas_hooks::attach_all()
{
hook_dinput8();
hook_d3d9();
hook_halo_engine();
}
void tas_hooks::detach_all()
{
unhook_function(&(PVOID&)originalGetDeviceState, hkGetDeviceState);
unhook_function(&(PVOID&)originalGetDeviceData, hkGetDeviceData);
unhook_function(&(PVOID&)originalSimulateTick, hkSimulateTick);
unhook_function(&(PVOID&)originalAdvanceFrame, hkAdvanceFrame);
unhook_function(&(PVOID&)originalBeginLoop, hkBeginLoop);
unhook_function(&(PVOID&)originalGetMouseKeyboardGamepadInput, hkGetMouseKeyboardGamepadInput);
unhook_function(&(PVOID&)originalAdvanceEffectsTimer, hkAdvanceEffectsTimer);
unhook_function(&(PVOID&)originalD3D9EndScene, hkD3D9EndScene);
unhook_function(&(PVOID&)originalD3D9BeginScene, hkD3D9BeginScene);
unhook_function(&(PVOID&)originalD3D9Present, hkD3D9Present);
}
/* HOOKED FUNCTIONS */
static int32_t pressedMouseTick = 0;
static bool btn_down[3] = { false, false, false };
static bool btn_queued[3] = { false, false, false };
HRESULT __stdcall hkGetDeviceState(LPDIRECTINPUTDEVICE* lpDevice, DWORD cbData, LPVOID* lpvData) // Mouse
{
HRESULT hResult = DI_OK;
hResult = originalGetDeviceState(lpDevice, cbData, lpvData);
return hResult;
}
static bool tab_down = false;
static bool enter_down = false;
static bool g_down = false;
static DWORD lastsequence = 0;
static int32_t pressedTick = 0;
static bool enterPreviousFrame = false;
static int32_t enterPressedFrame = 0;
static bool queuedEnter = false;
static bool queuedTab = false;
static bool queuedG = false;
HRESULT __stdcall hkGetDeviceData(LPDIRECTINPUTDEVICE* pDevice, DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) // Keyboard
{
HRESULT hResult = DI_OK;
auto& inputHandler = tas_input_handler::get();
if (inputHandler.this_tick_enter() && pressedTick != inputHandler.get_current_playback_tick()) {
queuedEnter = true;
}
if (inputHandler.this_tick_tab() && pressedTick != inputHandler.get_current_playback_tick()) {
queuedTab = true;
}
if (inputHandler.this_tick_g() && pressedTick != inputHandler.get_current_playback_tick()) {
queuedG = true;
}
pressedTick = inputHandler.get_current_playback_tick();
if (queuedEnter) {
if (enter_down) {
rgdod->dwData = 0x80;
}
else {
rgdod->dwData = 0x00;
queuedEnter = false;
}
rgdod->dwOfs = DIK_RETURN;
rgdod->dwTimeStamp = GetTickCount();
rgdod->dwSequence = ++lastsequence;
enter_down = !enter_down;
return hResult;
}
if (queuedTab) {
if (tab_down) {
rgdod->dwData = 0x80;
}
else {
rgdod->dwData = 0x00;
queuedTab = false;
}
rgdod->dwOfs = DIK_TAB;
rgdod->dwTimeStamp = GetTickCount();
rgdod->dwSequence = ++lastsequence;
tab_down = !tab_down;
return hResult;
}
if (queuedG) {
if (g_down) {
rgdod->dwData = 0x80;
}
else {
rgdod->dwData = 0x00;
queuedG = false;
}
rgdod->dwOfs = DIK_G;
rgdod->dwTimeStamp = GetTickCount();
rgdod->dwSequence = ++lastsequence;
g_down = !g_down;
return hResult;
}
hResult = originalGetDeviceData(pDevice, cbObjectData, rgdod, pdwInOut, dwFlags);
return hResult;
}
void hkSimulateTick(int ticksAfterThis) {
auto& gInputHandler = tas_input_handler::get();
auto& gRandomizer = randomizer::get();
auto& gEngine = halo_engine::get();
gRandomizer.pre_tick();
gInputHandler.pre_tick();
originalSimulateTick(ticksAfterThis);
gInputHandler.post_tick();
gEngine.post_tick();
}
char hkAdvanceFrame(float deltaTime) {
auto& gInputHandler = tas_input_handler::get();
auto& gEngine = halo_engine::get();
gEngine.pre_frame();
gInputHandler.pre_frame();
char c = originalAdvanceFrame(deltaTime);
gInputHandler.post_frame();
return c;
}
int __cdecl hkBeginLoop() {
auto& gInputHandler = tas_input_handler::get();
auto& gRandomizer = randomizer::get();
auto& gEngine = halo_engine::get();
gRandomizer.pre_loop();
gInputHandler.pre_loop();
auto ret = originalBeginLoop();
gInputHandler.post_loop();
return ret;
}
void __cdecl hkGetMouseKeyboardGamepadInput() {
originalGetMouseKeyboardGamepadInput();
}
void __cdecl hkAdvanceEffectsTimer(float dt) {
originalAdvanceEffectsTimer(dt);
}
HRESULT __stdcall hkD3D9BeginScene(IDirect3DDevice9* pDevice)
{
return originalD3D9BeginScene(pDevice);
}
HRESULT __stdcall hkD3D9Present(IDirect3DDevice9* pDevice, const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion)
{
auto& gEngine = halo_engine::get();
if (gEngine.is_present_enabled()) {
return originalD3D9Present(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}
return D3D_OK;
}
HRESULT __stdcall hkD3D9EndScene(IDirect3DDevice9* pDevice)
{
auto& d3d9 = render_d3d9::get();
d3d9.render(pDevice);
return originalD3D9EndScene(pDevice);
}
| 30.957958
| 156
| 0.776409
|
s3anyboy
|
f02732e925b9bd7a3d1071c0ebc55a73fc0c1d0d
| 418
|
hpp
|
C++
|
pythran/pythonic/include/numpy/isscalar.hpp
|
xmar/pythran
|
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
|
[
"BSD-3-Clause"
] | null | null | null |
pythran/pythonic/include/numpy/isscalar.hpp
|
xmar/pythran
|
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
|
[
"BSD-3-Clause"
] | null | null | null |
pythran/pythonic/include/numpy/isscalar.hpp
|
xmar/pythran
|
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
|
[
"BSD-3-Clause"
] | null | null | null |
#ifndef PYTHONIC_INCLUDE_NUMPY_ISSCALAR_HPP
#define PYTHONIC_INCLUDE_NUMPY_ISSCALAR_HPP
#include "pythonic/include/utils/functor.hpp"
#include "pythonic/include/types/traits.hpp"
#include "pythonic/include/types/str.hpp"
#include <type_traits>
namespace pythonic
{
namespace numpy
{
template <class E>
constexpr bool isscalar(E const &);
DECLARE_FUNCTOR(pythonic::numpy, isscalar);
}
}
#endif
| 17.416667
| 47
| 0.763158
|
xmar
|
f02e4a207cb97f3d4edb73883357be6961ea0058
| 1,583
|
cpp
|
C++
|
src/network/uber-profile-requestor.cpp
|
ghosalmartin/harbour-uber
|
b8d906f4050cfea8817aaebe1ade5c3466662109
|
[
"MIT"
] | 2
|
2018-03-16T10:31:20.000Z
|
2018-10-02T15:50:56.000Z
|
src/network/uber-profile-requestor.cpp
|
ghosalmartin/harbour-uber
|
b8d906f4050cfea8817aaebe1ade5c3466662109
|
[
"MIT"
] | null | null | null |
src/network/uber-profile-requestor.cpp
|
ghosalmartin/harbour-uber
|
b8d906f4050cfea8817aaebe1ade5c3466662109
|
[
"MIT"
] | null | null | null |
#include "uber-profile-requestor.h"
UberProfileRequestor::UberProfileRequestor(QObject *parent)
: UberRequestor(parent){
connect(this, SIGNAL(profileChanged(Profile*)),
this, SLOT(setProfile(Profile*)));
}
void UberProfileRequestor::fetchProfileFromNetwork(){
makeNetworkCall(
UBER_ME_ENDPOINT,
QNetworkAccessManager::Operation::GetOperation);
}
void UberProfileRequestor::setProfile(Profile *profile){
if(this->m_profile != profile){
this->m_profile = profile;
emit profileChanged(profile);
}
}
Profile* UberProfileRequestor::getProfile(){
return this->m_profile;
}
void UberProfileRequestor::deserialize(QByteArray data) {
QString stringReply = (QString) data;
QJsonDocument jsonResponse =
QJsonDocument::fromJson(stringReply.toUtf8());
QJsonObject jsonObject = jsonResponse.object();
Profile *profile = new Profile(jsonObject["picture"].toString(),
jsonObject["first_name"].toString(),
jsonObject["last_name"].toString(),
jsonObject["uuid"].toString(),
jsonObject["rider_id"].toString(),
jsonObject["email"].toString(),
jsonObject["mobile_verified"].toString(),
jsonObject["promo_code"].toString());
setProfile(profile);
}
void UberProfileRequestor::onError(QString errorString){
qDebug() << errorString;
}
| 33.680851
| 76
| 0.602021
|
ghosalmartin
|
f0345cefb360a8d7f49255d1ecb9b909df56d97e
| 244
|
hpp
|
C++
|
include/PrimeGenerator.hpp
|
sigalor/prime-plot
|
53bfa9e5f4d89d717d616620045a7c21c7cfe733
|
[
"Apache-2.0"
] | 9
|
2018-04-10T09:38:16.000Z
|
2021-02-02T22:46:30.000Z
|
include/PrimeGenerator.hpp
|
sigalor/prime-plot
|
53bfa9e5f4d89d717d616620045a7c21c7cfe733
|
[
"Apache-2.0"
] | null | null | null |
include/PrimeGenerator.hpp
|
sigalor/prime-plot
|
53bfa9e5f4d89d717d616620045a7c21c7cfe733
|
[
"Apache-2.0"
] | 2
|
2018-07-31T04:31:10.000Z
|
2019-12-21T22:47:50.000Z
|
#pragma once
#include <iostream>
#include <vector>
//#include <thread>
namespace PrimeGenerator
{
long integerSqrt(long num);
std::vector<long> findPrimes(long start, std::size_t num, long* lastCurrLimit, long end=-1);
}
| 15.25
| 99
| 0.67623
|
sigalor
|
f03624c4db456ba229b7c38e968a48cfa94cb403
| 7,796
|
cpp
|
C++
|
Beon/src/main.cpp
|
Riordan-DC/B-on
|
174390c08eddcdfbd0ae7441fc440a32641bcf28
|
[
"MIT"
] | null | null | null |
Beon/src/main.cpp
|
Riordan-DC/B-on
|
174390c08eddcdfbd0ae7441fc440a32641bcf28
|
[
"MIT"
] | null | null | null |
Beon/src/main.cpp
|
Riordan-DC/B-on
|
174390c08eddcdfbd0ae7441fc440a32641bcf28
|
[
"MIT"
] | null | null | null |
#include "Beon.hpp"
// Window parameters
int windowWidth = 1980;
int windowHeight = 1080;
static bool running = true;
//Get a handle on our light
//GLuint LightID = glGetUniformLocation(mShader.ID, "LightPosition_worldspace");
// Forward declaration of functions
void cleanup();
// Create window manager
WindowManager* Manager = WindowManager::getInstance();
int main(int argc, char* argv[]) {
if (Manager->initWindow("Beon", windowWidth, windowHeight) == -1) {
std::cout << "Window failed to initialize." << std::endl;
return -1;
};
// Get window from window manager
GLFWwindow* window = Manager->getWindow();
// Set GLFW call backs
setBasicGLFWCallbacks(window);
// Initalise camera controls
CameraController controlled_cam(window, glm::vec3(0,10,10));
// Create render view with camera
Renderer MainView(controlled_cam.camera, windowWidth, windowHeight);
// Initalise Gui
GUI::InitGui(window);
// Load shaders
Shader core_shader = Shader("../Beon/shaders/TransformVertexShader.vert", "../Beon/shaders/TextureFragmentShader.frag");
//Shader crysis_shader = Shader("../Beon/shaders/Toon.vert", "../Beon/shaders/Toon.frag");
Shader mCubmap = Shader("../Beon/shaders/CubeMap.vert", "../Beon/shaders/CubeMap.frag" );
// Load models
//Model monkey_model(GetCurrentWorkingDir()+"/../Beon/assets/models/suzanne/suzanne.obj", false);
//Model man_model(GetCurrentWorkingDir() + "/../Beon/assets/models/people/Male_Casual.obj", false);
//Model crysis_model(GetCurrentWorkingDir() + "/../Beon/assets/models/nanosuit/nanosuit.obj", false);
Model cube_model(GetCurrentWorkingDir() + "/../Beon/assets/models/cube/cube.obj", false);
Model skybox;
skybox.LoadSkyBox(GetCurrentWorkingDir()+"/../Beon/assets/skybox");
mCubmap.use();
mCubmap.setInt("skybox", 0);
Object* crysis = new Object(cube_model, 0);
crysis->AddShader("texture", core_shader);
Object* monkey = new Object(cube_model, 1);
monkey->AddShader("basic", core_shader);
Object* man = new Object(cube_model, 562);
man->AddShader("material", core_shader);
Object* floor = new Object(cube_model, 30000);
floor->AddShader("material", core_shader);
//crysis_shader.use();
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
BulletSystem bulletSystem = StartBulletPhysics();
bulletSystem.dynamicsWorld->setGravity(btVector3(0,-5.1,0));
crysis->mass = 1.0;
crysis->InitPhysics(bulletSystem.dynamicsWorld);
crysis->SetPosition(glm::vec3(0.0,40.0,0.0));
man->mass = 1.0;
man->InitPhysics(bulletSystem.dynamicsWorld);
man->SetPosition(glm::vec3(0.0, 70.0,0.0));
monkey->mass = 1.0;
monkey->InitPhysics(bulletSystem.dynamicsWorld);
monkey->SetPosition(glm::vec3(0.f, 90.0, 0.0));
floor->mass = 0.0;
floor->InitPhysics(bulletSystem.dynamicsWorld);
floor->SetPosition(glm::vec3(0.0, 0.0, 0.0));
floor->SetScale(glm::vec3(1,10,10));
double lastTime = glfwGetTime();
// Game Loop //
while (glfwWindowShouldClose(window) == false && running) {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
getDeltaTime();
// UPDATE
bulletSystem.dynamicsWorld->stepSimulation(
deltaTime, // Time since last step
7, // Mas substep count
btScalar(1.) / btScalar(60.)); // Fixed time step
crysis->Update(deltaTime);
man->Update(deltaTime);
monkey->Update(deltaTime);
floor->Update(deltaTime);
// RENDER
GUI::getFrame();
glClearColor(GUI::backgroundColor.x, GUI::backgroundColor.y, GUI::backgroundColor.z, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
MainView.Update();
MainView.UpdateShader(core_shader);
core_shader.setBool("dirLight.On", true);
core_shader.setVec3("dirLight.direction", glm::vec3(GUI::DirLightDirection.x, GUI::DirLightDirection.y, GUI::DirLightDirection.z));
core_shader.setVec3("dirLight.ambient", glm::vec3(GUI::DirLightAmbientColor.x, GUI::DirLightAmbientColor.y, GUI::DirLightAmbientColor.z));
core_shader.setVec3("dirLight.diffuse", glm::vec3(GUI::DirLightDiffuse, GUI::DirLightDiffuse, GUI::DirLightDiffuse));
core_shader.setVec3("dirLight.specular", glm::vec3(GUI::DirLightSpecular, GUI::DirLightSpecular, GUI::DirLightSpecular));
core_shader.setFloat("dirLight.shininess", GUI::DirLightShininess);
core_shader.setBool("pointLights[0].On", false);
core_shader.setVec3("pointLights[0].position", controlled_cam.camera->Position);
core_shader.setVec3("pointLights[0].ambient", glm::vec3(GUI::DirLightAmbientColor.x, GUI::DirLightAmbientColor.y, GUI::DirLightAmbientColor.z));
core_shader.setVec3("pointLights[0].specular", glm::vec3(GUI::DirLightSpecular, GUI::DirLightSpecular, GUI::DirLightSpecular));
core_shader.setVec3("pointLights[0].diffuse", glm::vec3(GUI::DirLightDiffuse, GUI::DirLightDiffuse, GUI::DirLightDiffuse));
core_shader.setFloat("pointLights[0].quadratic", 0.032f);
core_shader.setFloat("pointLights[0].linear", 0.09f);
core_shader.setFloat("pointLights[0].constant", 3.0f);
crysis->RenderObject(MainView);
man->RenderObject(MainView);
monkey->RenderObject(MainView);
floor->RenderObject(MainView);
if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT)) {
glm::vec3 out_origin;
glm::vec3 out_direction;
double xpos, ypos;
if (controlled_cam.trackMouse) {
xpos = windowWidth / 2;
ypos = windowHeight / 2;
}
else {
glfwGetCursorPos(window, &xpos, &ypos);
ypos = windowHeight - ypos;
}
ScreenPosToWorldRay(
(int)xpos, (int)ypos,
windowWidth, windowHeight,
controlled_cam.camera->ViewMatrix,
controlled_cam.camera->ProjectionMatrix,
out_origin,
out_direction
);
glm::vec3 out_end = out_origin + out_direction * 1000.0f;
btCollisionWorld::ClosestRayResultCallback RayCallback(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_end.x, out_end.y, out_end.z));
bulletSystem.dynamicsWorld->rayTest(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_end.x, out_end.y, out_end.z), RayCallback);
if (RayCallback.hasHit()) {
if (GUI::selected_object) {
GUI::selected_object->Selected(false);
}
GUI::selected_object = (Object*)RayCallback.m_collisionObject->getUserPointer();
GUI::selected_object->Selected(true);
//std::cout << "mesh " << GUI::selected_object->entity_tag << std::endl;
}
else {
if (GUI::selected_object) {
GUI::selected_object->Selected(false);
}
//std::cout << "background" << std::endl;;
}
}
if (glfwGetKey(window, GLFW_KEY_TAB) == GLFW_PRESS) {
// Escape camera mode
GUI::fly_camera = false;
}
controlled_cam.Update(deltaTime);
controlled_cam.trackMouse = GUI::fly_camera;
glDepthFunc(GL_LEQUAL);
MainView.UpdateShader(mCubmap);
//skybox.DrawSkyBox(crysis_shader);
skybox.DrawSkyBox(mCubmap);
// Render GUI
GUI::renderGui();
// In time left over, poll events again.
while (glfwGetTime() < lastTime + (1.0 / 60.0)) {
// Do nothing
continue;
}
lastTime += (1.0 / 60.0);
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
glfwSwapBuffers(window);
glfwPollEvents();
}
// de-allocate all resources once they've outlived their purpose:
delete man;
delete monkey;
delete floor;
delete crysis;
GUI::killGui();
DestroyBulletPhysics(&bulletSystem);
cleanup();
return 0;
}
void cleanup() {
// Close OpenGL window and terminate GLFW
glfwTerminate();
delete Manager;
}
| 34.043668
| 156
| 0.685993
|
Riordan-DC
|
f036d2b4c7e72d0bc013732246952863da7336c2
| 1,773
|
cpp
|
C++
|
roo_material_icons/sharp/18/home.cpp
|
dejwk/roo_material_icons
|
f559ce25b6ee2fdf67ed4f8b0bedfce2aaefb885
|
[
"MIT"
] | null | null | null |
roo_material_icons/sharp/18/home.cpp
|
dejwk/roo_material_icons
|
f559ce25b6ee2fdf67ed4f8b0bedfce2aaefb885
|
[
"MIT"
] | null | null | null |
roo_material_icons/sharp/18/home.cpp
|
dejwk/roo_material_icons
|
f559ce25b6ee2fdf67ed4f8b0bedfce2aaefb885
|
[
"MIT"
] | null | null | null |
#include "home.h"
using namespace roo_display;
// Image file ic_sharp_18_home_sensor_door 18x18, 4-bit Alpha, RLE, 60 bytes.
static const uint8_t ic_sharp_18_home_sensor_door_data[] PROGMEM = {
0x80, 0xC3, 0x00, 0x18, 0x06, 0x30, 0x16, 0x06, 0xFB, 0x06, 0x60, 0x6F, 0xB0, 0x66, 0x06, 0xFB,
0x06, 0x60, 0x6F, 0xB0, 0x66, 0x06, 0xFB, 0x06, 0x60, 0x6E, 0x83, 0xE3, 0xAF, 0x66, 0x06, 0xE8,
0x3E, 0x3A, 0xF6, 0x60, 0x6F, 0xB0, 0x66, 0x06, 0xFB, 0x06, 0x60, 0x6F, 0xB0, 0x66, 0x06, 0xFB,
0x06, 0x60, 0x6F, 0xB0, 0x66, 0x01, 0x80, 0x63, 0x01, 0x80, 0xC3, 0x00,
};
const RleImage4bppxBiased<Alpha4, PrgMemResource>& ic_sharp_18_home_sensor_door() {
static RleImage4bppxBiased<Alpha4, PrgMemResource> value(
18, 18, ic_sharp_18_home_sensor_door_data, Alpha4(color::Black));
return value;
}
// Image file ic_sharp_18_home_sensor_window 18x18, 4-bit Alpha, RLE, 94 bytes.
static const uint8_t ic_sharp_18_home_sensor_window_data[] PROGMEM = {
0x80, 0xC3, 0x00, 0x18, 0x06, 0x30, 0x16, 0x06, 0x0C, 0x80, 0x49, 0x0C, 0x06, 0x68, 0x16, 0x74,
0x80, 0x27, 0x81, 0x47, 0x66, 0x81, 0x67, 0x9E, 0x81, 0x97, 0x66, 0x81, 0x67, 0x9E, 0x81, 0x97,
0x66, 0x89, 0x26, 0x79, 0xFB, 0x33, 0xBF, 0x97, 0x66, 0x06, 0x07, 0x0F, 0x12, 0x0F, 0x10, 0x70,
0x66, 0x81, 0x67, 0x9E, 0x81, 0x97, 0x66, 0x81, 0x67, 0x9E, 0x81, 0x97, 0x66, 0x81, 0x67, 0x9E,
0x81, 0x97, 0x66, 0x81, 0x67, 0x9E, 0x81, 0x97, 0x66, 0x81, 0x67, 0x48, 0x02, 0x78, 0x14, 0x76,
0x60, 0x60, 0xC8, 0x04, 0x90, 0xC0, 0x66, 0x01, 0x80, 0x63, 0x01, 0x80, 0xC3, 0x00,
};
const RleImage4bppxBiased<Alpha4, PrgMemResource>& ic_sharp_18_home_sensor_window() {
static RleImage4bppxBiased<Alpha4, PrgMemResource> value(
18, 18, ic_sharp_18_home_sensor_window_data, Alpha4(color::Black));
return value;
}
| 53.727273
| 97
| 0.716864
|
dejwk
|
f0377dc35798653f437c55858a0ab0ae28426d9a
| 4,645
|
cc
|
C++
|
util/fuchsia/koid_utilities.cc
|
rbxeyl/crashpad
|
95b4e6276836283a91e18382fb258598bd77f8aa
|
[
"Apache-2.0"
] | 14,668
|
2015-01-01T01:57:10.000Z
|
2022-03-31T23:33:32.000Z
|
util/fuchsia/koid_utilities.cc
|
rbxeyl/crashpad
|
95b4e6276836283a91e18382fb258598bd77f8aa
|
[
"Apache-2.0"
] | 113
|
2019-12-14T04:28:04.000Z
|
2021-09-26T18:40:27.000Z
|
util/fuchsia/koid_utilities.cc
|
rbxeyl/crashpad
|
95b4e6276836283a91e18382fb258598bd77f8aa
|
[
"Apache-2.0"
] | 5,941
|
2015-01-02T11:32:21.000Z
|
2022-03-31T16:35:46.000Z
|
// Copyright 2018 The Crashpad 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 "util/fuchsia/koid_utilities.h"
#include <lib/fdio/fdio.h>
#include <lib/zx/channel.h>
#include <lib/zx/job.h>
#include <lib/zx/process.h>
#include <vector>
#include "base/files/file_path.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "util/file/file_io.h"
namespace crashpad {
namespace {
// Casts |handle| into a container of type T, returning a null handle if the
// actual handle type does not match that of T.
template <typename T>
T CastHandle(zx::handle handle) {
zx_info_handle_basic_t actual = {};
zx_status_t status = handle.get_info(
ZX_INFO_HANDLE_BASIC, &actual, sizeof(actual), nullptr, nullptr);
if (status != ZX_OK) {
ZX_LOG(ERROR, status) << "zx_object_get_info";
return T();
}
if (actual.type != T::TYPE) {
LOG(ERROR) << "Wrong type: " << actual.type << ", expected " << T::TYPE;
return T();
}
return T(std::move(handle));
}
// Returns null handle if |koid| is not found or an error occurs. If |was_found|
// is non-null then it will be set, to distinguish not-found from other errors.
template <typename T, typename U>
T GetChildHandleByKoid(const U& parent, zx_koid_t child_koid, bool* was_found) {
zx::handle handle;
zx_status_t status =
parent.get_child(child_koid, ZX_RIGHT_SAME_RIGHTS, &handle);
if (was_found)
*was_found = (status != ZX_ERR_NOT_FOUND);
if (status != ZX_OK) {
ZX_LOG(ERROR, status) << "zx_object_get_child";
return T();
}
return CastHandle<T>(std::move(handle));
}
} // namespace
std::vector<zx_koid_t> GetChildKoids(const zx::object_base& parent_object,
zx_object_info_topic_t child_kind) {
size_t actual = 0;
size_t available = 0;
std::vector<zx_koid_t> result(100);
zx::unowned_handle parent(parent_object.get());
// This is inherently racy. Better if the process is suspended, but there's
// still no guarantee that a thread isn't externally created. As a result,
// must be in a retry loop.
for (;;) {
zx_status_t status = parent->get_info(child_kind,
result.data(),
result.size() * sizeof(zx_koid_t),
&actual,
&available);
// If the buffer is too small (even zero), the result is still ZX_OK, not
// ZX_ERR_BUFFER_TOO_SMALL.
if (status != ZX_OK) {
ZX_LOG(ERROR, status) << "zx_object_get_info";
break;
}
if (actual == available) {
break;
}
// Resize to the expected number next time, with a bit of slop to handle the
// race between here and the next request.
result.resize(available + 10);
}
result.resize(actual);
return result;
}
std::vector<zx::thread> GetThreadHandles(const zx::process& parent) {
auto koids = GetChildKoids(parent, ZX_INFO_PROCESS_THREADS);
return GetHandlesForThreadKoids(parent, koids);
}
std::vector<zx::thread> GetHandlesForThreadKoids(
const zx::process& parent,
const std::vector<zx_koid_t>& koids) {
std::vector<zx::thread> result;
result.reserve(koids.size());
for (zx_koid_t koid : koids) {
result.emplace_back(GetThreadHandleByKoid(parent, koid));
}
return result;
}
zx::thread GetThreadHandleByKoid(const zx::process& parent,
zx_koid_t child_koid) {
return GetChildHandleByKoid<zx::thread>(parent, child_koid, nullptr);
}
zx_koid_t GetKoidForHandle(const zx::object_base& object) {
zx_info_handle_basic_t info;
zx_status_t status = zx_object_get_info(object.get(),
ZX_INFO_HANDLE_BASIC,
&info,
sizeof(info),
nullptr,
nullptr);
if (status != ZX_OK) {
ZX_LOG(ERROR, status) << "zx_object_get_info";
return ZX_KOID_INVALID;
}
return info.koid;
}
} // namespace crashpad
| 32.711268
| 80
| 0.639182
|
rbxeyl
|
f039d9bddaa3b8b6064b2f29637a92b5c15b3ba0
| 108
|
cpp
|
C++
|
src/test/sub.cpp
|
ifritJP/lctags
|
dd877c6f6f10b9299c59cfbc05755b7680c7dd80
|
[
"MIT"
] | 17
|
2017-10-24T15:19:49.000Z
|
2021-12-19T00:49:48.000Z
|
src/test/sub.cpp
|
ifritJP/lctags
|
dd877c6f6f10b9299c59cfbc05755b7680c7dd80
|
[
"MIT"
] | 1
|
2021-02-24T15:49:11.000Z
|
2021-02-26T07:45:05.000Z
|
src/test/sub.cpp
|
ifritJP/lctags
|
dd877c6f6f10b9299c59cfbc05755b7680c7dd80
|
[
"MIT"
] | 1
|
2017-11-08T17:39:51.000Z
|
2017-11-08T17:39:51.000Z
|
#define NNNN
#include <./hoge.h>
#ifdef VVVVVVV
int vvvvv;
#endif
namespace jjjjj {
#include <field.h>
}
| 9
| 19
| 0.685185
|
ifritJP
|
f040c8b9ee2c07b5d508dcc6f6c41cd4e4cd3511
| 8,596
|
hpp
|
C++
|
include/codegen/include/Zenject/FactoryFromBinder1Extensions.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 1
|
2021-11-12T09:29:31.000Z
|
2021-11-12T09:29:31.000Z
|
include/codegen/include/Zenject/FactoryFromBinder1Extensions.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | null | null | null |
include/codegen/include/Zenject/FactoryFromBinder1Extensions.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 2
|
2021-10-03T02:14:20.000Z
|
2021-11-12T09:29:36.000Z
|
// Autogenerated from CppHeaderCreator on 7/27/2020 3:10:42 PM
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "utils/typedefs.h"
// Including type: System.Object
#include "System/Object.hpp"
#include "utils/il2cpp-utils.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: Zenject
namespace Zenject {
// Forward declaring type: ArgConditionCopyNonLazyBinder
class ArgConditionCopyNonLazyBinder;
// Forward declaring type: FactoryFromBinder`2<TParam1, TContract>
template<typename TParam1, typename TContract>
class FactoryFromBinder_2;
// Forward declaring type: ConcreteBinderGeneric`1<TContract>
template<typename TContract>
class ConcreteBinderGeneric_1;
// Forward declaring type: IFactory`2<TValue, TParam1>
template<typename TValue, typename TParam1>
class IFactory_2;
// Forward declaring type: IPoolable`2<TParam1, TParam2>
template<typename TParam1, typename TParam2>
class IPoolable_2;
// Forward declaring type: IMemoryPool
class IMemoryPool;
// Forward declaring type: MemoryPoolInitialSizeMaxSizeBinder`1<TContract>
template<typename TContract>
class MemoryPoolInitialSizeMaxSizeBinder_1;
// Forward declaring type: MemoryPool`3<TValue, TParam1, TParam2>
template<typename TValue, typename TParam1, typename TParam2>
class MemoryPool_3;
}
// Forward declaring namespace: System
namespace System {
// Forward declaring type: Action`1<T>
template<typename T>
class Action_1;
// Forward declaring type: Action`1<T>
template<typename T>
class Action_1;
}
// Forward declaring namespace: UnityEngine
namespace UnityEngine {
// Forward declaring type: Component
class Component;
}
// Completed forward declares
// Type namespace: Zenject
namespace Zenject {
// Autogenerated type: Zenject.FactoryFromBinder1Extensions
class FactoryFromBinder1Extensions : public ::Il2CppObject {
public:
// Nested type: Zenject::FactoryFromBinder1Extensions::$$c__DisplayClass0_0_2<TParam1, TContract>
template<typename TParam1, typename TContract>
class $$c__DisplayClass0_0_2;
// Nested type: Zenject::FactoryFromBinder1Extensions::$$c__1_2<TParam1, TContract>
template<typename TParam1, typename TContract>
class $$c__1_2;
// Nested type: Zenject::FactoryFromBinder1Extensions::$$c__3_2<TParam1, TContract>
template<typename TParam1, typename TContract>
class $$c__3_2;
// Nested type: Zenject::FactoryFromBinder1Extensions::$$c__5_3<TParam1, TContract, TMemoryPool>
template<typename TParam1, typename TContract, typename TMemoryPool>
class $$c__5_3;
// Nested type: Zenject::FactoryFromBinder1Extensions::$$c__DisplayClass6_0_3<TParam1, TContract, TMemoryPool>
template<typename TParam1, typename TContract, typename TMemoryPool>
class $$c__DisplayClass6_0_3;
// static public Zenject.ArgConditionCopyNonLazyBinder FromIFactory(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder, System.Action`1<Zenject.ConcreteBinderGeneric`1<Zenject.IFactory`2<TParam1,TContract>>> factoryBindGenerator)
// Offset: 0x13D1270
template<class TParam1, class TContract>
static Zenject::ArgConditionCopyNonLazyBinder* FromIFactory(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder, System::Action_1<Zenject::ConcreteBinderGeneric_1<Zenject::IFactory_2<TParam1, TContract>*>*>* factoryBindGenerator) {
return CRASH_UNLESS(il2cpp_utils::RunGenericMethod<Zenject::ArgConditionCopyNonLazyBinder*>("Zenject", "FactoryFromBinder1Extensions", "FromIFactory", {il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TParam1>::get(), il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TContract>::get()}, fromBinder, factoryBindGenerator));
}
// static public Zenject.ArgConditionCopyNonLazyBinder FromPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder)
// Offset: 0x13D18B4
template<class TParam1, class TContract>
static Zenject::ArgConditionCopyNonLazyBinder* FromPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder) {
static_assert(std::is_convertible_v<TContract, Zenject::IPoolable_2<TParam1, Zenject::IMemoryPool*>*>);
return CRASH_UNLESS(il2cpp_utils::RunGenericMethod<Zenject::ArgConditionCopyNonLazyBinder*>("Zenject", "FactoryFromBinder1Extensions", "FromPoolableMemoryPool", {il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TParam1>::get(), il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TContract>::get()}, fromBinder));
}
// static public Zenject.ArgConditionCopyNonLazyBinder FromPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder, System.Action`1<Zenject.MemoryPoolInitialSizeMaxSizeBinder`1<TContract>> poolBindGenerator)
// Offset: 0x13D1A60
template<class TParam1, class TContract>
static Zenject::ArgConditionCopyNonLazyBinder* FromPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder, System::Action_1<Zenject::MemoryPoolInitialSizeMaxSizeBinder_1<TContract>*>* poolBindGenerator) {
static_assert(std::is_convertible_v<TContract, Zenject::IPoolable_2<TParam1, Zenject::IMemoryPool*>*>);
return CRASH_UNLESS(il2cpp_utils::RunGenericMethod<Zenject::ArgConditionCopyNonLazyBinder*>("Zenject", "FactoryFromBinder1Extensions", "FromPoolableMemoryPool", {il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TParam1>::get(), il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TContract>::get()}, fromBinder, poolBindGenerator));
}
// static public Zenject.ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder)
// Offset: 0x13D139C
template<class TParam1, class TContract>
static Zenject::ArgConditionCopyNonLazyBinder* FromMonoPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder) {
static_assert(std::is_convertible_v<TContract, UnityEngine::Component*> && std::is_convertible_v<TContract, Zenject::IPoolable_2<TParam1, Zenject::IMemoryPool*>*>);
return CRASH_UNLESS(il2cpp_utils::RunGenericMethod<Zenject::ArgConditionCopyNonLazyBinder*>("Zenject", "FactoryFromBinder1Extensions", "FromMonoPoolableMemoryPool", {il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TParam1>::get(), il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TContract>::get()}, fromBinder));
}
// static public Zenject.ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder, System.Action`1<Zenject.MemoryPoolInitialSizeMaxSizeBinder`1<TContract>> poolBindGenerator)
// Offset: 0x13D1548
template<class TParam1, class TContract>
static Zenject::ArgConditionCopyNonLazyBinder* FromMonoPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder, System::Action_1<Zenject::MemoryPoolInitialSizeMaxSizeBinder_1<TContract>*>* poolBindGenerator) {
static_assert(std::is_convertible_v<TContract, UnityEngine::Component*> && std::is_convertible_v<TContract, Zenject::IPoolable_2<TParam1, Zenject::IMemoryPool*>*>);
return CRASH_UNLESS(il2cpp_utils::RunGenericMethod<Zenject::ArgConditionCopyNonLazyBinder*>("Zenject", "FactoryFromBinder1Extensions", "FromMonoPoolableMemoryPool", {il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TParam1>::get(), il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<TContract>::get()}, fromBinder, poolBindGenerator));
}
// static public Zenject.ArgConditionCopyNonLazyBinder FromPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder)
// Offset: 0x13D1558
// ABORTED: conflicts with another method. static Zenject::ArgConditionCopyNonLazyBinder* FromPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder)
// static public Zenject.ArgConditionCopyNonLazyBinder FromPoolableMemoryPool(Zenject.FactoryFromBinder`2<TParam1,TContract> fromBinder, System.Action`1<Zenject.MemoryPoolInitialSizeMaxSizeBinder`1<TContract>> poolBindGenerator)
// Offset: 0x13D1704
// ABORTED: conflicts with another method. static Zenject::ArgConditionCopyNonLazyBinder* FromPoolableMemoryPool(Zenject::FactoryFromBinder_2<TParam1, TContract>* fromBinder, System::Action_1<Zenject::MemoryPoolInitialSizeMaxSizeBinder_1<TContract>*>* poolBindGenerator)
}; // Zenject.FactoryFromBinder1Extensions
}
DEFINE_IL2CPP_ARG_TYPE(Zenject::FactoryFromBinder1Extensions*, "Zenject", "FactoryFromBinder1Extensions");
#pragma pack(pop)
| 73.470085
| 347
| 0.79665
|
Futuremappermydud
|
f04378c7ee5b0e8ee964c93bb89f07a6b122379e
| 680
|
hpp
|
C++
|
include/jln/mp/functional/if.hpp
|
jonathanpoelen/jln.mp
|
e5f05fc4467f14ac0047e3bdc75a04076e689985
|
[
"MIT"
] | 9
|
2020-07-04T16:46:13.000Z
|
2022-01-09T21:59:31.000Z
|
include/jln/mp/functional/if.hpp
|
jonathanpoelen/jln.mp
|
e5f05fc4467f14ac0047e3bdc75a04076e689985
|
[
"MIT"
] | null | null | null |
include/jln/mp/functional/if.hpp
|
jonathanpoelen/jln.mp
|
e5f05fc4467f14ac0047e3bdc75a04076e689985
|
[
"MIT"
] | 1
|
2021-05-23T13:37:40.000Z
|
2021-05-23T13:37:40.000Z
|
#pragma once
#include <jln/mp/utility/conditional.hpp>
#include <jln/mp/utility/always.hpp>
#include <jln/mp/number/number.hpp>
#include <jln/mp/functional/call.hpp>
namespace jln::mp
{
/// \ingroup functional
/// A conditional expression.
/// \treturn \value
template<class Pred, class TC, class FC = always<false_>>
struct if_
{
template<class... xs>
using f = typename mp::conditional_c<bool(call<Pred, xs...>::value)>
::template f<TC, FC>
::template f<xs...>;
};
namespace emp
{
template<class Pred, class TC, class FC, class... xs>
using if_ = typename conditional<call<Pred, xs...>, TC, FC>
::template f<xs...>;
}
}
| 22.666667
| 72
| 0.636765
|
jonathanpoelen
|
f043b2b0fde76b34dd159a94d2ffaa47995915cd
| 7,135
|
cpp
|
C++
|
src/zxing/zxing/oned/rss/expanded/decoders/FieldParser.cpp
|
favoritas37/qzxing
|
6ea2b31e26db9d43db027ba207f5c73dc9d759fc
|
[
"Apache-2.0"
] | 608
|
2015-02-21T22:31:37.000Z
|
2022-03-31T05:05:36.000Z
|
src/zxing/zxing/oned/rss/expanded/decoders/FieldParser.cpp
|
favoritas37/qzxing
|
6ea2b31e26db9d43db027ba207f5c73dc9d759fc
|
[
"Apache-2.0"
] | 512
|
2015-01-06T17:59:31.000Z
|
2022-03-31T13:21:49.000Z
|
src/zxing/zxing/oned/rss/expanded/decoders/FieldParser.cpp
|
favoritas37/qzxing
|
6ea2b31e26db9d43db027ba207f5c73dc9d759fc
|
[
"Apache-2.0"
] | 281
|
2016-09-15T08:42:26.000Z
|
2022-03-21T17:55:00.000Z
|
#include "FieldParser.h"
#include <algorithm>
namespace zxing {
namespace oned {
namespace rss {
static const int VARIABLE_LENGTH = 99999;
struct DigitData {
std::string digit;
int variableLength;
int length;
};
static const DigitData TWO_DIGIT_DATA_LENGTH[] {
// "DIGITS", new Integer(LENGTH)
// or
// "DIGITS", VARIABLE_LENGTH, new Integer(MAX_SIZE)
{ "00", 18, 0},
{ "01", 14, 0},
{ "02", 14, 0},
{ "10", VARIABLE_LENGTH, 20},
{ "11", 6, 0},
{ "12", 6, 0},
{ "13", 6, 0},
{ "15", 6, 0},
{ "17", 6, 0},
{ "20", 2, 0},
{ "21", VARIABLE_LENGTH, 20},
{ "22", VARIABLE_LENGTH, 29},
{ "30", VARIABLE_LENGTH, 8},
{ "37", VARIABLE_LENGTH, 8},
//internal company codes
{ "90", VARIABLE_LENGTH, 30},
{ "91", VARIABLE_LENGTH, 30},
{ "92", VARIABLE_LENGTH, 30},
{ "93", VARIABLE_LENGTH, 30},
{ "94", VARIABLE_LENGTH, 30},
{ "95", VARIABLE_LENGTH, 30},
{ "96", VARIABLE_LENGTH, 30},
{ "97", VARIABLE_LENGTH, 30},
{ "98", VARIABLE_LENGTH, 30},
{ "99", VARIABLE_LENGTH, 30},
};
static const DigitData THREE_DIGIT_DATA_LENGTH[] {
// Same format as above
{ "240", VARIABLE_LENGTH, 30},
{ "241", VARIABLE_LENGTH, 30},
{ "242", VARIABLE_LENGTH, 6},
{ "250", VARIABLE_LENGTH, 30},
{ "251", VARIABLE_LENGTH, 30},
{ "253", VARIABLE_LENGTH, 17},
{ "254", VARIABLE_LENGTH, 20},
{ "400", VARIABLE_LENGTH, 30},
{ "401", VARIABLE_LENGTH, 30},
{ "402", 17, 0},
{ "403", VARIABLE_LENGTH, 30},
{ "410", 13, 0},
{ "411", 13, 0},
{ "412", 13, 0},
{ "413", 13, 0},
{ "414", 13, 0},
{ "420", VARIABLE_LENGTH, 20},
{ "421", VARIABLE_LENGTH, 15},
{ "422", 3, 0},
{ "423", VARIABLE_LENGTH, 15},
{ "424", 3, 0},
{ "425", 3, 0},
{ "426", 3, 0},
};
static const DigitData THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH[] {
// Same format as above
{ "310", 6, 0},
{ "311", 6, 0},
{ "312", 6, 0},
{ "313", 6, 0},
{ "314", 6, 0},
{ "315", 6, 0},
{ "316", 6, 0},
{ "320", 6, 0},
{ "321", 6, 0},
{ "322", 6, 0},
{ "323", 6, 0},
{ "324", 6, 0},
{ "325", 6, 0},
{ "326", 6, 0},
{ "327", 6, 0},
{ "328", 6, 0},
{ "329", 6, 0},
{ "330", 6, 0},
{ "331", 6, 0},
{ "332", 6, 0},
{ "333", 6, 0},
{ "334", 6, 0},
{ "335", 6, 0},
{ "336", 6, 0},
{ "340", 6, 0},
{ "341", 6, 0},
{ "342", 6, 0},
{ "343", 6, 0},
{ "344", 6, 0},
{ "345", 6, 0},
{ "346", 6, 0},
{ "347", 6, 0},
{ "348", 6, 0},
{ "349", 6, 0},
{ "350", 6, 0},
{ "351", 6, 0},
{ "352", 6, 0},
{ "353", 6, 0},
{ "354", 6, 0},
{ "355", 6, 0},
{ "356", 6, 0},
{ "357", 6, 0},
{ "360", 6, 0},
{ "361", 6, 0},
{ "362", 6, 0},
{ "363", 6, 0},
{ "364", 6, 0},
{ "365", 6, 0},
{ "366", 6, 0},
{ "367", 6, 0},
{ "368", 6, 0},
{ "369", 6, 0},
{ "390", VARIABLE_LENGTH, 15},
{ "391", VARIABLE_LENGTH, 18},
{ "392", VARIABLE_LENGTH, 15},
{ "393", VARIABLE_LENGTH, 18},
{ "703", VARIABLE_LENGTH, 30},
};
static const DigitData FOUR_DIGIT_DATA_LENGTH[] {
// Same format as above
{ "7001", 13, 0},
{ "7002", VARIABLE_LENGTH, 30},
{ "7003", 10, 0},
{ "8001", 14, 0},
{ "8002", VARIABLE_LENGTH, 20},
{ "8003", VARIABLE_LENGTH, 30},
{ "8004", VARIABLE_LENGTH, 30},
{ "8005", 6, 0},
{ "8006", 18, 0},
{ "8007", VARIABLE_LENGTH, 30},
{ "8008", VARIABLE_LENGTH, 12},
{ "8018", 18, 0},
{ "8020", VARIABLE_LENGTH, 25},
{ "8100", 6, 0},
{ "8101", 10, 0},
{ "8102", 2, 0},
{ "8110", VARIABLE_LENGTH, 70},
{ "8200", VARIABLE_LENGTH, 70},
};
String FieldParser::parseFieldsInGeneralPurpose(String rawInformation)
{
if (rawInformation.getText().empty()) {
return String("");
}
// Processing 2-digit AIs
if (rawInformation.length() < 2) {
throw NotFoundException();
}
String firstTwoDigits(rawInformation.substring(0, 2)->getText());
for (DigitData dataLength : TWO_DIGIT_DATA_LENGTH) {
if (dataLength.digit == firstTwoDigits.getText()) {
if (dataLength.variableLength == VARIABLE_LENGTH) {
return processVariableAI(2, dataLength.length, rawInformation);
}
return processFixedAI(2, dataLength.variableLength, rawInformation);
}
}
if (rawInformation.length() < 3) {
throw NotFoundException();
}
String firstThreeDigits(rawInformation.substring(0, 3)->getText());
for (DigitData dataLength : THREE_DIGIT_DATA_LENGTH) {
if (dataLength.digit == firstThreeDigits.getText()) {
if (dataLength.variableLength == VARIABLE_LENGTH) {
return processVariableAI(3, dataLength.length, rawInformation);
}
return processFixedAI(3, dataLength.variableLength, rawInformation);
}
}
for (DigitData dataLength : THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH) {
if (dataLength.digit == firstThreeDigits.getText()) {
if (dataLength.variableLength == VARIABLE_LENGTH) {
return processVariableAI(4, dataLength.length, rawInformation);
}
return processFixedAI(4, dataLength.variableLength, rawInformation);
}
}
if (rawInformation.length() < 4) {
throw NotFoundException();
}
String firstFourDigits(rawInformation.substring(0, 4)->getText());
for (DigitData dataLength : FOUR_DIGIT_DATA_LENGTH) {
if (dataLength.digit == firstFourDigits.getText()) {
if (dataLength.variableLength == VARIABLE_LENGTH) {
return processVariableAI(4, dataLength.length, rawInformation);
}
return processFixedAI(4, dataLength.variableLength, rawInformation);
}
}
throw NotFoundException();
}
String FieldParser::processFixedAI(int aiSize, int fieldSize, String rawInformation)
{
if (rawInformation.length() < aiSize) {
throw NotFoundException();
}
String ai(rawInformation.substring(0, aiSize)->getText());
if (rawInformation.length() < aiSize + fieldSize) {
throw NotFoundException();
}
String field(rawInformation.substring(aiSize, /*aiSize +*/ fieldSize)->getText());
String remaining(rawInformation.substring(aiSize + fieldSize)->getText());
String result('(' + ai.getText() + ')' + field.getText());
String parsedAI = parseFieldsInGeneralPurpose(remaining);
if (parsedAI.getText() == "") {
return result;
} else {
result.append(parsedAI.getText());
return result;
}
}
String FieldParser::processVariableAI(int aiSize, int variableFieldSize, String rawInformation)
{
String ai(rawInformation.substring(0, aiSize)->getText());
int maxSize = std::min(rawInformation.length(), aiSize + variableFieldSize);
String field(rawInformation.substring(aiSize, maxSize - aiSize)->getText());
String remaining(rawInformation.substring(maxSize)->getText());
String result('(' + ai.getText() + ')' + field.getText());
String parsedAI = parseFieldsInGeneralPurpose(remaining);
if (parsedAI.getText() == "") {
return result;
} else {
result.append(parsedAI.getText());
return result;
}
}
}
}
}
| 25.758123
| 95
| 0.571829
|
favoritas37
|
f045c323aed5df511f3059cb6ecfa62ee27afcee
| 1,198
|
hh
|
C++
|
GameLogic/Engine/piecefactory.hh
|
saarioka/Saaripeli
|
28145e49b4708e22fb7cb051c1ccddfa4a6a24f9
|
[
"MIT"
] | null | null | null |
GameLogic/Engine/piecefactory.hh
|
saarioka/Saaripeli
|
28145e49b4708e22fb7cb051c1ccddfa4a6a24f9
|
[
"MIT"
] | null | null | null |
GameLogic/Engine/piecefactory.hh
|
saarioka/Saaripeli
|
28145e49b4708e22fb7cb051c1ccddfa4a6a24f9
|
[
"MIT"
] | null | null | null |
#ifndef PIECEFACTORY_HH
#define PIECEFACTORY_HH
#include <QJsonObject>
#include <string>
#include <vector>
/**
* @file
* @brief Singleton class that creates pieces.
*/
namespace Logic {
/**
* @brief Singleton class for creating pieces.
*
* The factory is requested to read JSON file, after which it will requested to
* return a data structure, which containts the read pieces.
*/
class PieceFactory {
public:
/**
* @return A reference to the factory.
*/
static PieceFactory& getInstance();
/**
* @brief readJSON reads pieces a JSON file.
* @exception IOException Could not open the file Assets/pieces.json for reading.
* @exception FormatException Format of the file Assets/pieces.json is invalid.
* @post Exception quarantee: basic
*/
void readJSON();
/**
* @brief Gets the pieces used in the game
* @return The pieces read from the JSON file. If the file is not read, or the actors did not exist, will return an empty vector.
* @post Exception quarantee: basic
*/
std::vector<std::pair<std::string,int>> getGamePieces() const;
private:
PieceFactory();
QJsonObject _json;
};
}
#endif
| 21.392857
| 133
| 0.673623
|
saarioka
|
f04c4f700ec089a967ffa9bfa9b5e02c7dfa42ff
| 1,413
|
hpp
|
C++
|
lib/include/interlinck/Core/Syntax/IWithSimplifiedWidthAndPosition.hpp
|
henrikfroehling/polyglot
|
955fb37c2f54ebbaf933c16bf9e0e4bcca8a4142
|
[
"MIT"
] | null | null | null |
lib/include/interlinck/Core/Syntax/IWithSimplifiedWidthAndPosition.hpp
|
henrikfroehling/polyglot
|
955fb37c2f54ebbaf933c16bf9e0e4bcca8a4142
|
[
"MIT"
] | 50
|
2021-06-30T20:01:50.000Z
|
2021-11-28T16:21:26.000Z
|
lib/include/interlinck/Core/Syntax/IWithSimplifiedWidthAndPosition.hpp
|
henrikfroehling/polyglot
|
955fb37c2f54ebbaf933c16bf9e0e4bcca8a4142
|
[
"MIT"
] | null | null | null |
#ifndef INTERLINCK_CORE_SYNTAX_IWITHSIMPLIFIEDWIDTHANDPOSITION_H
#define INTERLINCK_CORE_SYNTAX_IWITHSIMPLIFIEDWIDTHANDPOSITION_H
#include "interlinck/interlinck_global.hpp"
#include "interlinck/Core/Text/TextSpan.hpp"
#include "interlinck/Core/Types.hpp"
namespace interlinck::Core::Syntax
{
/**
* @brief Interface providing functions regarding positions and widths of syntax elements without trivia.
*/
class INTERLINCK_API IWithSimplifiedWidthAndPosition
{
public:
virtual ~IWithSimplifiedWidthAndPosition() noexcept = default;
/**
* @brief Returns the width of the syntax elements.
* @return The width of the syntax elements.
*/
virtual il_size width() const noexcept = 0;
/**
* @brief Returns the position of the syntax element.
* @return The position of the syntax element.
*/
virtual il_size position() const noexcept = 0;
/**
* @brief Returns the position at which the syntax element ends.
* @return The position at which the syntax element ends.
*/
virtual il_size endPosition() const noexcept = 0;
/**
* @brief Returns the <code>TextSpan</code> for the syntax element.
* @return The <code>TextSpan</code> for the syntax element.
*/
virtual Text::TextSpan span() const noexcept = 0;
};
} // end namespace interlinck::Core::Syntax
#endif // INTERLINCK_CORE_SYNTAX_IWITHSIMPLIFIEDWIDTHANDPOSITION_H
| 30.06383
| 105
| 0.726115
|
henrikfroehling
|
f04dea21f0d983027c7a935bca810fd5ba8b0309
| 8,835
|
hpp
|
C++
|
src/core/imports/blas/Ger.hpp
|
pjt1988/Elemental
|
71d3e2b98829594e9f52980a8b1ef7c1e99c724b
|
[
"Apache-2.0"
] | 473
|
2015-01-11T03:22:11.000Z
|
2022-03-31T05:28:39.000Z
|
src/core/imports/blas/Ger.hpp
|
pjt1988/Elemental
|
71d3e2b98829594e9f52980a8b1ef7c1e99c724b
|
[
"Apache-2.0"
] | 205
|
2015-01-10T20:33:45.000Z
|
2021-07-25T14:53:25.000Z
|
src/core/imports/blas/Ger.hpp
|
pjt1988/Elemental
|
71d3e2b98829594e9f52980a8b1ef7c1e99c724b
|
[
"Apache-2.0"
] | 109
|
2015-02-16T14:06:42.000Z
|
2022-03-23T21:34:26.000Z
|
/*
Copyright (c) 2009-2016, Jack Poulson
All rights reserved.
This file is part of Elemental and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
*/
extern "C" {
void EL_BLAS(sger)
( const BlasInt* m, const BlasInt* n,
const float* alpha, const float* x, const BlasInt* incx,
const float* y, const BlasInt* incy,
float* A, const BlasInt* ALDim );
void EL_BLAS(dger)
( const BlasInt* m, const BlasInt* n,
const double* alpha, const double* x, const BlasInt* incx,
const double* y, const BlasInt* incy,
double* A, const BlasInt* ALDim );
void EL_BLAS(cgerc)
( const BlasInt* m, const BlasInt* n,
const scomplex* alpha,
const scomplex* x, const BlasInt* incx,
const scomplex* y, const BlasInt* incy,
scomplex* A, const BlasInt* ALDim );
void EL_BLAS(zgerc)
( const BlasInt* m, const BlasInt* n,
const dcomplex* alpha,
const dcomplex* x, const BlasInt* incx,
const dcomplex* y, const BlasInt* incy,
dcomplex* A, const BlasInt* ALDim );
void EL_BLAS(cgeru)
( const BlasInt* m, const BlasInt* n,
const scomplex* alpha,
const scomplex* x, const BlasInt* incx,
const scomplex* y, const BlasInt* incy,
scomplex* A, const BlasInt* ALDim );
void EL_BLAS(zgeru)
( const BlasInt* m, const BlasInt* n,
const dcomplex* alpha,
const dcomplex* x, const BlasInt* incx,
const dcomplex* y, const BlasInt* incy,
dcomplex* A, const BlasInt* ALDim );
} // extern "C"
namespace El {
namespace blas {
template<typename T>
void Ger
( BlasInt m, BlasInt n,
const T& alpha,
const T* x, BlasInt incx,
const T* y, BlasInt incy,
T* A, BlasInt ALDim )
{
// NOTE: Temporaries are avoided since constructing a BigInt/BigFloat
// involves a memory allocation
// TODO: Special-case alpha=0?
T gamma, delta;
for( BlasInt j=0; j<n; ++j )
{
Conj( y[j*incy], gamma );
gamma *= alpha;
for( BlasInt i=0; i<m; ++i )
{
// A[i+j*ALDim] += alpha*x[i*incx]*Conj(y[j*incy]);
delta = x[i*incx];
delta *= gamma;
A[i+j*ALDim] += delta;
}
}
}
template void Ger
( BlasInt m, BlasInt n,
const Int& alpha,
const Int* x, BlasInt incx,
const Int* y, BlasInt incy,
Int* A, BlasInt ALDim );
#ifdef EL_HAVE_QD
template void Ger
( BlasInt m, BlasInt n,
const DoubleDouble& alpha,
const DoubleDouble* x, BlasInt incx,
const DoubleDouble* y, BlasInt incy,
DoubleDouble* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const QuadDouble& alpha,
const QuadDouble* x, BlasInt incx,
const QuadDouble* y, BlasInt incy,
QuadDouble* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const Complex<DoubleDouble>& alpha,
const Complex<DoubleDouble>* x, BlasInt incx,
const Complex<DoubleDouble>* y, BlasInt incy,
Complex<DoubleDouble>* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const Complex<QuadDouble>& alpha,
const Complex<QuadDouble>* x, BlasInt incx,
const Complex<QuadDouble>* y, BlasInt incy,
Complex<QuadDouble>* A, BlasInt ALDim );
#endif
#ifdef EL_HAVE_QUAD
template void Ger
( BlasInt m, BlasInt n,
const Quad& alpha,
const Quad* x, BlasInt incx,
const Quad* y, BlasInt incy,
Quad* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const Complex<Quad>& alpha,
const Complex<Quad>* x, BlasInt incx,
const Complex<Quad>* y, BlasInt incy,
Complex<Quad>* A, BlasInt ALDim );
#endif
#ifdef EL_HAVE_MPC
template void Ger
( BlasInt m, BlasInt n,
const BigInt& alpha,
const BigInt* x, BlasInt incx,
const BigInt* y, BlasInt incy,
BigInt* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const BigFloat& alpha,
const BigFloat* x, BlasInt incx,
const BigFloat* y, BlasInt incy,
BigFloat* A, BlasInt ALDim );
template void Ger
( BlasInt m, BlasInt n,
const Complex<BigFloat>& alpha,
const Complex<BigFloat>* x, BlasInt incx,
const Complex<BigFloat>* y, BlasInt incy,
Complex<BigFloat>* A, BlasInt ALDim );
#endif
void Ger
( BlasInt m, BlasInt n,
const float& alpha,
const float* x, BlasInt incx,
const float* y, BlasInt incy,
float* A, BlasInt ALDim )
{ EL_BLAS(sger)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Ger
( BlasInt m, BlasInt n,
const double& alpha,
const double* x, BlasInt incx,
const double* y, BlasInt incy,
double* A, BlasInt ALDim )
{ EL_BLAS(dger)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Ger
( BlasInt m, BlasInt n,
const scomplex& alpha,
const scomplex* x, BlasInt incx,
const scomplex* y, BlasInt incy,
scomplex* A, BlasInt ALDim )
{ EL_BLAS(cgerc)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Ger
( BlasInt m, BlasInt n,
const dcomplex& alpha,
const dcomplex* x, BlasInt incx,
const dcomplex* y, BlasInt incy,
dcomplex* A, BlasInt ALDim )
{ EL_BLAS(zgerc)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
template<typename T>
void Geru
( BlasInt m, BlasInt n,
const T& alpha,
const T* x, BlasInt incx,
const T* y, BlasInt incy,
T* A, BlasInt ALDim )
{
// NOTE: Temporaries are avoided since constructing a BigInt/BigFloat
// involves a memory allocation
// TODO: Special-case alpha=0?
T gamma, delta;
for( BlasInt j=0; j<n; ++j )
{
gamma = y[j*incy];
gamma *= alpha;
for( BlasInt i=0; i<m; ++i )
{
// A[i+j*ALDim] += alpha*x[i*incx]*y[j*incy];
delta = x[i*incx];
delta *= gamma;
A[i+j*ALDim] += delta;
}
}
}
template void Geru
( BlasInt m, BlasInt n,
const Int& alpha,
const Int* x, BlasInt incx,
const Int* y, BlasInt incy,
Int* A, BlasInt ALDim );
#ifdef EL_HAVE_QD
template void Geru
( BlasInt m, BlasInt n,
const DoubleDouble& alpha,
const DoubleDouble* x, BlasInt incx,
const DoubleDouble* y, BlasInt incy,
DoubleDouble* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const QuadDouble& alpha,
const QuadDouble* x, BlasInt incx,
const QuadDouble* y, BlasInt incy,
QuadDouble* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const Complex<DoubleDouble>& alpha,
const Complex<DoubleDouble>* x, BlasInt incx,
const Complex<DoubleDouble>* y, BlasInt incy,
Complex<DoubleDouble>* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const Complex<QuadDouble>& alpha,
const Complex<QuadDouble>* x, BlasInt incx,
const Complex<QuadDouble>* y, BlasInt incy,
Complex<QuadDouble>* A, BlasInt ALDim );
#endif
#ifdef EL_HAVE_QUAD
template void Geru
( BlasInt m, BlasInt n,
const Quad& alpha,
const Quad* x, BlasInt incx,
const Quad* y, BlasInt incy,
Quad* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const Complex<Quad>& alpha,
const Complex<Quad>* x, BlasInt incx,
const Complex<Quad>* y, BlasInt incy,
Complex<Quad>* A, BlasInt ALDim );
#endif
#ifdef EL_HAVE_MPC
template void Geru
( BlasInt m, BlasInt n,
const BigInt& alpha,
const BigInt* x, BlasInt incx,
const BigInt* y, BlasInt incy,
BigInt* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const BigFloat& alpha,
const BigFloat* x, BlasInt incx,
const BigFloat* y, BlasInt incy,
BigFloat* A, BlasInt ALDim );
template void Geru
( BlasInt m, BlasInt n,
const Complex<BigFloat>& alpha,
const Complex<BigFloat>* x, BlasInt incx,
const Complex<BigFloat>* y, BlasInt incy,
Complex<BigFloat>* A, BlasInt ALDim );
#endif
void Geru
( BlasInt m, BlasInt n,
const float& alpha,
const float* x, BlasInt incx,
const float* y, BlasInt incy,
float* A, BlasInt ALDim )
{ EL_BLAS(sger)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Geru
( BlasInt m, BlasInt n,
const double& alpha,
const double* x, BlasInt incx,
const double* y, BlasInt incy,
double* A, BlasInt ALDim )
{ EL_BLAS(dger)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Geru
( BlasInt m, BlasInt n,
const scomplex& alpha,
const scomplex* x, BlasInt incx,
const scomplex* y, BlasInt incy,
scomplex* A, BlasInt ALDim )
{ EL_BLAS(cgeru)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
void Geru
( BlasInt m, BlasInt n,
const dcomplex& alpha,
const dcomplex* x, BlasInt incx,
const dcomplex* y, BlasInt incy,
dcomplex* A, BlasInt ALDim )
{ EL_BLAS(zgeru)( &m, &n, &alpha, x, &incx, y, &incy, A, &ALDim ); }
} // namespace blas
} // namespace El
| 29.158416
| 73
| 0.637917
|
pjt1988
|
f0536743f2f27114eb1aa65d2d52739f363aad92
| 1,111
|
cpp
|
C++
|
UVA/11582/17163602_AC_970ms_0kB.cpp
|
BakaErii/ACM_Collection
|
d368b15c7f1c84472424d5e61e5ebc667f589025
|
[
"WTFPL"
] | null | null | null |
UVA/11582/17163602_AC_970ms_0kB.cpp
|
BakaErii/ACM_Collection
|
d368b15c7f1c84472424d5e61e5ebc667f589025
|
[
"WTFPL"
] | null | null | null |
UVA/11582/17163602_AC_970ms_0kB.cpp
|
BakaErii/ACM_Collection
|
d368b15c7f1c84472424d5e61e5ebc667f589025
|
[
"WTFPL"
] | null | null | null |
/**
* @author Moe_Sakiya sakiya@tun.moe
* @date 2018-11-24 14:58:37
*
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
const int maxN = 10005;
unsigned long long int fac[maxN];
unsigned long long int pm(unsigned long long int a, unsigned long long int b, unsigned long long int c) {
unsigned long long int tmp = 1 % c;
a = a % c;
while (b > 0) {
if (b % 2 == 1)
tmp = (tmp * a) % c;
b /= 2;
a = (a * a) % c;
}
return tmp;
}
int main(void) {
unsigned long long int t, n, mod = 0;
unsigned long long int x, y;
cin >> t;
while (t--) {
cin >> x >> y >> n;
fac[0] = 0;
fac[1] = 1 % n;
for (int i = 2; i < maxN; i++)
fac[i] = (fac[i - 1] + fac[i - 2]) % n;
for (int i = 4; i < maxN - 10; i++)
if (fac[1] == fac[i] && fac[2] == fac[i + 1] && fac[3] == fac[i + 2] && fac[4] == fac[i + 3]){
mod = i;
break;
}
mod--;
cout << fac[pm(x, y, mod)] << endl;
}
return 0;
}
| 19.155172
| 105
| 0.545455
|
BakaErii
|
f0573ae4797675834357ceed30a2b0960325ab6e
| 1,281
|
hpp
|
C++
|
src/memory/Array.hpp
|
LU15W1R7H/lwirth-lib
|
f51cfb56b801790c200cea64d226730449d68f53
|
[
"MIT"
] | 2
|
2018-04-04T17:26:32.000Z
|
2020-06-26T09:22:49.000Z
|
src/memory/Array.hpp
|
LU15W1R7H/lwirth-lib
|
f51cfb56b801790c200cea64d226730449d68f53
|
[
"MIT"
] | 1
|
2018-08-27T14:35:45.000Z
|
2018-08-27T19:00:12.000Z
|
src/memory/Array.hpp
|
LU15W1R7H/lwirth-lib
|
f51cfb56b801790c200cea64d226730449d68f53
|
[
"MIT"
] | null | null | null |
#pragma once
#include "../Standard.hpp"
#include <utility>
#include <initializer_list>
namespace lw
{
template<class T, size_t SIZE>
class Array
{
private:
T m_pData[SIZE];
public:
constexpr Array()
: m_pData{}
{
}
constexpr Array(const std::initializer_list<T>& il)
{
static_assert(il.end() - il.begin() == SIZE, "Wrong length");
size_t i = 0;
for (auto iter = 0; iter != il.end(); iter++)
{
m_pData[i] = *iter;
i++;
}
}
Array(Array<T, SIZE> const& other)
{
std::copy(other.m_pData, other.m_pData + SIZE, m_pData);
}
Array(Array<T, SIZE>&& other)
{
for (size_t i = 0; i < SIZE; i++)
{
m_pData[i] = std::move(other.m_pData[i]);
}
}
Array& operator=(Array<T, SIZE> const& other)
{
std::copy(other.m_pData, other.m_pData + LENGTH, m_pData);
return *this;
}
Array& operator=(Array<T, LENGTH>&& other)
{
for (size_t i = 0; i < LENGTH; i++)
{
m_pData[i] = std::move(other.m_pData[i]);
}
return *this;
}
~Array()
{
}
T& operator[](u32 index)
{
return m_pData[index];
}
T const& operator[](u32 index) const
{
return m_pData[index];
}
constexpr u32 size() const
{
return LENGTH;
}
T* raw() const
{
return m_pData;
}
};
}
| 14.233333
| 64
| 0.569087
|
LU15W1R7H
|
f05afcaf3ed05ba253818a720fa5abcfd082bd35
| 261
|
cc
|
C++
|
test/mocks/grpc/mocks.cc
|
htuch/envoy
|
f466a86e4bba81c18f5b59f0c56ea36aa663e174
|
[
"Apache-2.0"
] | 2
|
2017-07-31T15:03:19.000Z
|
2018-02-20T16:18:49.000Z
|
test/mocks/grpc/mocks.cc
|
htuch/envoy
|
f466a86e4bba81c18f5b59f0c56ea36aa663e174
|
[
"Apache-2.0"
] | null | null | null |
test/mocks/grpc/mocks.cc
|
htuch/envoy
|
f466a86e4bba81c18f5b59f0c56ea36aa663e174
|
[
"Apache-2.0"
] | null | null | null |
#include "mocks.h"
namespace Envoy {
namespace Grpc {
MockRpcChannelCallbacks::MockRpcChannelCallbacks() {}
MockRpcChannelCallbacks::~MockRpcChannelCallbacks() {}
MockRpcChannel::MockRpcChannel() {}
MockRpcChannel::~MockRpcChannel() {}
} // Grpc
} // Envoy
| 18.642857
| 54
| 0.754789
|
htuch
|
f05c0ab5100891ab71ff4d255acf39c1eb3592cd
| 1,426
|
cpp
|
C++
|
Algorithms/lab1/QuickSort_1.0.cpp
|
chaohu/Daily-Learning
|
0e8d14a3497ad319eda20bc4682cec08d5d6fb08
|
[
"MIT"
] | 12
|
2016-04-09T15:43:02.000Z
|
2022-03-22T01:58:25.000Z
|
Algorithms/lab1/QuickSort_1.0.cpp
|
chaohu/Daily-Learning
|
0e8d14a3497ad319eda20bc4682cec08d5d6fb08
|
[
"MIT"
] | null | null | null |
Algorithms/lab1/QuickSort_1.0.cpp
|
chaohu/Daily-Learning
|
0e8d14a3497ad319eda20bc4682cec08d5d6fb08
|
[
"MIT"
] | 2
|
2018-08-23T07:34:59.000Z
|
2019-06-20T10:17:31.000Z
|
#include <iostream>
#include <stack>
using namespace std;
#define MAX 0x7FFFFFFF
int PARTITION(int p,int j);
stack<int> s; //栈s,存储较大的部分的编号
int *A; //待分类的数据(1:n)
int main() {
int n = 0,i = 0,j = 0;
int p = 0,q = 0,x = 0,y = 0;
cout<<"输入待分类数据个数:";
cin>>n;
A = (int *)malloc(sizeof(int) * (n + 2));
A[n+1] = MAX;
cout<<"输入待分类数据:";
for(i = 1;i <= n;i++) cin>>A[i];
cout<<"输入分类区域(1-"<<n<<"):";
cin>>p>>q;
x = p;
y = q;
while(1) {
while(p < q) {
j = q + 1;
j = PARTITION(p,j);
if(j - p < q - j) {
s.push(j + 1);
s.push(q);
q = j - 1;
}
else {
s.push(p);
s.push(j - 1);
p = j + 1;
}
}
if(s.empty()) break;
else {
q = s.top();
s.pop();
p = s.top();
s.pop();
}
}
for(i = x;i <= y;i++) cout<<A[i]<<' ';
cout<<'\n';
return 1;
}
int PARTITION(int m,int p) {
int i = 0,v = 0,temp = 0;
v = A[m];
i = m;
while(1) {
do i = i + 1;
while(A[i] < v);
do p = p - 1;
while(A[p] > v);
if(i < p) {
temp = A[i];
A[i] = A[p];
A[p] = temp;
}
else break;
}
A[m] = A[p];
A[p] = v;
return p;
}
| 19.805556
| 45
| 0.3331
|
chaohu
|
f05d0fb0bad04d57d1e34c6959370d81a322c039
| 3,847
|
cpp
|
C++
|
BlackVision/LibBlackVision/Source/Engine/Types/Values/ValuesFactory.cpp
|
black-vision-engine/bv-engine
|
85089d41bb22afeaa9de070646e12aa1777ecedf
|
[
"MIT"
] | 1
|
2022-01-28T11:43:47.000Z
|
2022-01-28T11:43:47.000Z
|
BlackVision/LibBlackVision/Source/Engine/Types/Values/ValuesFactory.cpp
|
black-vision-engine/bv-engine
|
85089d41bb22afeaa9de070646e12aa1777ecedf
|
[
"MIT"
] | null | null | null |
BlackVision/LibBlackVision/Source/Engine/Types/Values/ValuesFactory.cpp
|
black-vision-engine/bv-engine
|
85089d41bb22afeaa9de070646e12aa1777ecedf
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "ValuesFactory.h"
namespace bv {
// ***********************
//
ValueBoolPtr ValuesFactory::CreateValueBool ( const std::string & name )
{
return std::make_shared< ValueBool >( name );
}
// ***********************
//
ValueBoolPtr ValuesFactory::CreateValueBool ( const std::string & name, bool initVal )
{
auto val = CreateValueBool( name );
val->SetValue( initVal );
return val;
}
// *******************************
//
ValueIntPtr ValuesFactory::CreateValueInt ( const std::string & name )
{
return std::make_shared< ValueInt >( name );
}
// *******************************
//
ValueIntPtr ValuesFactory::CreateValueInt ( const std::string & name, Int32 initVal )
{
auto val = CreateValueInt( name );
val->SetValue( initVal );
return val;
}
// *******************************
//
ValueFloatPtr ValuesFactory::CreateValueFloat ( const std::string & name )
{
return std::make_shared< ValueFloat >( name );
}
// *******************************
//
ValueFloatPtr ValuesFactory::CreateValueFloat ( const std::string & name, Float32 initVal )
{
auto val = CreateValueFloat( name );
val ->SetValue( initVal );
return val;
}
// *******************************
//
ValueDoublePtr ValuesFactory::CreateValueDouble ( const std::string & name )
{
return std::make_shared< ValueDouble >( name );
}
// *******************************
//
ValueDoublePtr ValuesFactory::CreateValueDouble ( const std::string & name, Float64 initVal )
{
auto val = CreateValueDouble( name );
val->SetValue( initVal );
return val;
}
// *******************************
//
ValueVec2Ptr ValuesFactory::CreateValueVec2 ( const std::string & name )
{
return std::make_shared< ValueVec2 >( name );
}
// *******************************
//
ValueVec3Ptr ValuesFactory::CreateValueVec3 ( const std::string & name )
{
return std::make_shared< ValueVec3 >( name );
}
// *******************************
//
ValueVec4Ptr ValuesFactory::CreateValueVec4 ( const std::string & name )
{
return std::make_shared< ValueVec4 >( name );
}
// *******************************
//
ValueVec4Ptr ValuesFactory::CreateValueVec4 ( const std::string & name, const glm::vec4 & initVal )
{
auto val = CreateValueVec4( name );
val->SetValue( initVal );
return val;
}
// *******************************
//
ValueMat2Ptr ValuesFactory::CreateValueMat2 ( const std::string & name )
{
return std::make_shared< ValueMat2 >( name );
}
// *******************************
//
ValueMat4Ptr ValuesFactory::CreateValueMat4 ( const std::string & name )
{
return std::make_shared< ValueMat4 >( name );
}
// *******************************
//
ValueStringPtr ValuesFactory::CreateValueString ( const std::string & name )
{
return std::make_shared< ValueString >( name );
}
// *******************************
//
ValueStringPtr ValuesFactory::CreateValueString ( const std::string & name, const std::string & initVal )
{
auto val = CreateValueString( name );
val->SetValue( initVal );
return val;
}
// *******************************
//
ValueWStringPtr ValuesFactory::CreateValueWString ( const std::string & name )
{
return std::make_shared< ValueWString >( name );
}
// *******************************
//
ValueWStringPtr ValuesFactory::CreateValueWString( const std::string & name, const std::wstring & initVal )
{
auto val = CreateValueWString( name );
val->SetValue( initVal );
return val;
}
} // bv
| 23.601227
| 115
| 0.514947
|
black-vision-engine
|
f05e815d93655bacfc70fe1ce478ee32625984dd
| 881
|
cpp
|
C++
|
src/functions.cpp
|
cbries/tetrisgl
|
a40f22140d05c2cf6116946459a99a0477c1569a
|
[
"MIT"
] | 1
|
2015-02-23T19:06:04.000Z
|
2015-02-23T19:06:04.000Z
|
src/functions.cpp
|
cbries/tetrisgl
|
a40f22140d05c2cf6116946459a99a0477c1569a
|
[
"MIT"
] | null | null | null |
src/functions.cpp
|
cbries/tetrisgl
|
a40f22140d05c2cf6116946459a99a0477c1569a
|
[
"MIT"
] | null | null | null |
/*
* Copyright (c) 2008 Christian Benjamin Ries
* License: MIT
* Website: https://github.com/cbries/tetrisgl
*/
#include "functions.h"
#include <GL/gl.h>
void Enter2DMode( int startx, int starty, int width, int height ) {
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glViewport(startx, starty, width, height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho((GLdouble)startx, (GLdouble)width, (GLdouble)starty, (GLdouble)height, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
void Leave2DMode() {
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPopAttrib();
}
| 21.487805
| 92
| 0.702611
|
cbries
|
f0616ccc3e6e3633664c0f16c8791c09aeb718d5
| 549
|
cpp
|
C++
|
C++/Cracking-the-Coding-Interview/1.3.cpp
|
dvt32/cpp-journey
|
afd7db7a1ad106c41601fb09e963902187ae36e6
|
[
"MIT"
] | 1
|
2018-05-24T11:30:05.000Z
|
2018-05-24T11:30:05.000Z
|
C++/Cracking-the-Coding-Interview/1.3.cpp
|
dvt32/cpp-journey
|
afd7db7a1ad106c41601fb09e963902187ae36e6
|
[
"MIT"
] | null | null | null |
C++/Cracking-the-Coding-Interview/1.3.cpp
|
dvt32/cpp-journey
|
afd7db7a1ad106c41601fb09e963902187ae36e6
|
[
"MIT"
] | 2
|
2017-08-11T06:53:30.000Z
|
2017-08-29T12:07:52.000Z
|
// Design an algorithm and write code to remove the duplicate characters in a string.
#include <iostream>
#include <string>
#include <unordered_map>
int main() {
std::string input = "aabbccd";
std::string output = "";
std::unordered_map<char, int> numberOfInstances;
for (int i = 0; i < input.length(); ++i) {
char currentCharacter = input[i];
numberOfInstances[currentCharacter]++;
if (numberOfInstances[currentCharacter] > 1) {
continue;
}
else {
output += input[i];
}
}
std::cout << output << std::endl;
return 0;
}
| 20.333333
| 85
| 0.666667
|
dvt32
|
f065d57c662e513c19451436adce905eb462d9cb
| 1,056
|
cpp
|
C++
|
C++/1214-Two-Sum-BSTs/soln.cpp
|
wyaadarsh/LeetCode-Solutions
|
3719f5cb059eefd66b83eb8ae990652f4b7fd124
|
[
"MIT"
] | 5
|
2020-07-24T17:48:59.000Z
|
2020-12-21T05:56:00.000Z
|
C++/1214-Two-Sum-BSTs/soln.cpp
|
zhangyaqi1989/LeetCode-Solutions
|
2655a1ffc8678ad1de6c24295071308a18c5dc6e
|
[
"MIT"
] | null | null | null |
C++/1214-Two-Sum-BSTs/soln.cpp
|
zhangyaqi1989/LeetCode-Solutions
|
2655a1ffc8678ad1de6c24295071308a18c5dc6e
|
[
"MIT"
] | 2
|
2020-07-24T17:49:01.000Z
|
2020-08-31T19:57:35.000Z
|
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
bool twoSumBSTs(TreeNode* root1, TreeNode* root2, int target) {
vector<int> vals1, vals2;
Dfs(root1, &vals1);
Dfs(root2, &vals2);
sort(vals2.begin(), vals2.end());
for(int val : vals1) {
auto it = lower_bound(vals2.begin(), vals2.end(), target - val);
if(it != vals2.end() && *it == target - val) {
return true;
}
}
return false;
}
private:
void Dfs(TreeNode * node, vector<int> * vals) {
if(node != nullptr) {
vals->push_back(node->val);
Dfs(node->left, vals);
Dfs(node->right, vals);
}
}
};
| 28.540541
| 93
| 0.517045
|
wyaadarsh
|
f0661040e34c42c182ca269d08eafe3d14b1291c
| 1,350
|
hpp
|
C++
|
include/onepass/trackable.hpp
|
inql/OnePass
|
6e24d6bd6bcb70fdac4de5e4a155fcea68ea85ef
|
[
"Unlicense"
] | 4
|
2021-10-20T17:40:33.000Z
|
2022-02-14T09:39:46.000Z
|
include/onepass/trackable.hpp
|
inql/OnePass
|
6e24d6bd6bcb70fdac4de5e4a155fcea68ea85ef
|
[
"Unlicense"
] | null | null | null |
include/onepass/trackable.hpp
|
inql/OnePass
|
6e24d6bd6bcb70fdac4de5e4a155fcea68ea85ef
|
[
"Unlicense"
] | null | null | null |
#ifndef TRACKABLE_HPP
#define TRACKABLE_HPP
namespace onepass
{
namespace core
{
template<class T>
class Trackable
{
private:
unsigned id_;
time_t created_;
time_t accessed_;
friend class boost::serialization::access;
public:
T val_;
Trackable() : id_(0)
{
}
Trackable(unsigned i) : id_(i)
{
initialize();
}
Trackable(unsigned i, T tracked) : id_(i), val_(tracked)
{
initialize();
}
template<typename Archive>
void serialize(Archive &ar, const unsigned int)
{
ar &id_;
ar &created_;
ar &accessed_;
ar &val_;
}
unsigned getId() const
{
return id_;
}
time_t getCreated() const
{
return created_;
}
time_t getAccessed() const
{
return accessed_;
}
void initialize()
{
created_ = accessed_ = time(0);
}
void seen()
{
accessed_ = time(0);
}
std::string toString(time_t t)
{
char buffer[32];
std::tm *pmt = std::localtime(&t);
std::strftime(buffer, 32, "%Y-%m-%d %H:%M:%S", pmt);
return std::string{ buffer };
}
};
} // namespace core
} // namespace onepass
#endif // TRACKABLE_HPP
| 19.285714
| 62
| 0.508889
|
inql
|
f06c0f25f37e1f31691505bc5a0f838dd83c8a8e
| 48,489
|
cpp
|
C++
|
Temp/il2cppOutput/il2cppOutput/Il2CppCompilerCalculateTypeValues_19Table.cpp
|
408794550/871AR
|
3f903d01ae05522413f7be7abb286d1944d00bbb
|
[
"Apache-2.0"
] | 1
|
2018-08-16T10:43:30.000Z
|
2018-08-16T10:43:30.000Z
|
Temp/il2cppOutput/il2cppOutput/Il2CppCompilerCalculateTypeValues_19Table.cpp
|
408794550/871AR
|
3f903d01ae05522413f7be7abb286d1944d00bbb
|
[
"Apache-2.0"
] | null | null | null |
Temp/il2cppOutput/il2cppOutput/Il2CppCompilerCalculateTypeValues_19Table.cpp
|
408794550/871AR
|
3f903d01ae05522413f7be7abb286d1944d00bbb
|
[
"Apache-2.0"
] | null | null | null |
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "UnityEngine_UI_UnityEngine_UI_PositionAsUV11102546563.h"
#include "UnityEngine_UI_UnityEngine_UI_Shadow4269599528.h"
#include "UnityEngine_UI_U3CPrivateImplementationDetailsU3E1486305137.h"
#include "UnityEngine_UI_U3CPrivateImplementationDetailsU3E_1568637717.h"
#include "DOTween43_U3CModuleU3E3783534214.h"
#include "DOTween43_DG_Tweening_ShortcutExtensions43301896125.h"
#include "DOTween43_DG_Tweening_ShortcutExtensions43_U3CU3Ec_426334720.h"
#include "DOTween43_DG_Tweening_ShortcutExtensions43_U3CU3Ec_426334751.h"
#include "DOTween43_DG_Tweening_ShortcutExtensions43_U3CU3Ec_426334817.h"
#include "DOTween43_DG_Tweening_ShortcutExtensions43_U3CU3Ec_426334918.h"
#include "DOTween46_U3CModuleU3E3783534214.h"
#include "DOTween46_DG_Tweening_DOTweenUtils461550156519.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46705180652.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3371939845.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3371939942.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3371939977.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3017480080.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3582130305.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec_591124924.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec4039117214.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec_308799891.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec3582130274.h"
#include "DOTween46_DG_Tweening_ShortcutExtensions46_U3CU3Ec_591124893.h"
#include "DOTweenPro_U3CModuleU3E3783534214.h"
#include "DOTweenPro_DG_Tweening_DOTweenVisualManager2945673405.h"
#include "DOTweenPro_DG_Tweening_HandlesDrawMode3273484032.h"
#include "DOTweenPro_DG_Tweening_HandlesType3201532857.h"
#include "DOTweenPro_DG_Tweening_DOTweenInspectorMode2739551672.h"
#include "DOTweenPro_DG_Tweening_DOTweenPath1397145371.h"
#include "DOTweenPro_DG_Tweening_Core_ABSAnimationComponent2205594551.h"
#include "DOTweenPro_DG_Tweening_Core_DOTweenAnimationType119935370.h"
#include "DOTweenPro_DG_Tweening_Core_OnDisableBehaviour125315118.h"
#include "DOTweenPro_DG_Tweening_Core_OnEnableBehaviour285142911.h"
#include "DOTweenPro_DG_Tweening_Core_TargetType2706200073.h"
#include "DOTweenPro_DG_Tweening_Core_VisualManagerPreset4087939440.h"
#include "LitJson_U3CModuleU3E3783534214.h"
#include "LitJson_LitJson_JsonType3145703806.h"
#include "LitJson_LitJson_JsonData269267574.h"
#include "LitJson_LitJson_OrderedDictionaryEnumerator3437478891.h"
#include "LitJson_LitJson_JsonException613047007.h"
#include "LitJson_LitJson_PropertyMetadata3693826136.h"
#include "LitJson_LitJson_ArrayMetadata2008834462.h"
#include "LitJson_LitJson_ObjectMetadata3995922398.h"
#include "LitJson_LitJson_JsonMapper800426905.h"
#include "LitJson_LitJson_JsonToken2852816099.h"
#include "LitJson_LitJson_JsonReader1077921503.h"
#include "LitJson_LitJson_Condition1980525237.h"
#include "LitJson_LitJson_WriterContext4137194742.h"
#include "LitJson_LitJson_JsonWriter1927598499.h"
#include "LitJson_LitJson_FsmContext1296252303.h"
#include "LitJson_LitJson_Lexer186508296.h"
#include "LitJson_LitJson_Lexer_StateHandler387387051.h"
#include "LitJson_LitJson_ParserToken1554180950.h"
#include "LitJson_LitJson_ExporterFunc408878057.h"
#include "LitJson_LitJson_ImporterFunc2977850894.h"
#include "LitJson_LitJson_WrapperFactory2219329745.h"
#include "LitJson_U3CPrivateImplementationDetailsU3E1486305137.h"
#include "LitJson_U3CPrivateImplementationDetailsU3E_U24Arra4007721333.h"
#include "Vuforia_UnityExtensions_U3CModuleU3E3783534214.h"
#include "Vuforia_UnityExtensions_Vuforia_ARController2638793709.h"
#include "Vuforia_UnityExtensions_Vuforia_ARController_U3CU32604000414.h"
#include "Vuforia_UnityExtensions_Vuforia_DigitalEyewearARCo1398758191.h"
#include "Vuforia_UnityExtensions_Vuforia_DigitalEyewearARCo2121820252.h"
#include "Vuforia_UnityExtensions_Vuforia_DigitalEyewearARCo3746630162.h"
#include "Vuforia_UnityExtensions_Vuforia_DigitalEyewearARCon342269456.h"
#include "Vuforia_UnityExtensions_Vuforia_DigitalEyewearARCo2750347603.h"
#include "Vuforia_UnityExtensions_Vuforia_EyewearDevice1202635122.h"
#include "Vuforia_UnityExtensions_Vuforia_EyewearDevice_EyeID642957731.h"
#include "Vuforia_UnityExtensions_Vuforia_EyewearDevice_Eyew1521251591.h"
#include "Vuforia_UnityExtensions_Vuforia_NullHoloLensApiAbs1386933393.h"
#include "Vuforia_UnityExtensions_Vuforia_DeviceTracker2183873360.h"
#include "Vuforia_UnityExtensions_Vuforia_DeviceTrackerARCon3939888793.h"
#include "Vuforia_UnityExtensions_Vuforia_DistortionRenderin3766399464.h"
#include "Vuforia_UnityExtensions_Vuforia_DistortionRenderin2945034146.h"
#include "Vuforia_UnityExtensions_Vuforia_DelegateHelper1202011487.h"
#include "Vuforia_UnityExtensions_Vuforia_PlayModeEyewearUser117253723.h"
#include "Vuforia_UnityExtensions_Vuforia_PlayModeEyewearCal3632467967.h"
#include "Vuforia_UnityExtensions_Vuforia_PlayModeEyewearDev2977282393.h"
#include "Vuforia_UnityExtensions_Vuforia_DedicatedEyewearDevi22891981.h"
#include "Vuforia_UnityExtensions_Vuforia_CameraConfiguratio3904398347.h"
#include "Vuforia_UnityExtensions_Vuforia_BaseCameraConfigurat38459502.h"
#include "Vuforia_UnityExtensions_Vuforia_BaseStereoViewerCa1102239676.h"
#include "Vuforia_UnityExtensions_Vuforia_StereoViewerCamera3365023487.h"
#include "Vuforia_UnityExtensions_Vuforia_HoloLensExtendedTr3502001541.h"
#include "Vuforia_UnityExtensions_Vuforia_HoloLensExtendedTr1161658011.h"
#include "Vuforia_UnityExtensions_Vuforia_HoloLensExtendedTr3432166560.h"
#include "Vuforia_UnityExtensions_Vuforia_VuforiaExtendedTra2074328369.h"
#include "Vuforia_UnityExtensions_Vuforia_VuMarkManagerImpl1660847547.h"
#include "Vuforia_UnityExtensions_Vuforia_InstanceIdImpl3955455590.h"
#include "Vuforia_UnityExtensions_Vuforia_VuMarkTargetImpl2700679413.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1900 = { sizeof (PositionAsUV1_t1102546563), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1901 = { sizeof (Shadow_t4269599528), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1901[4] =
{
Shadow_t4269599528::get_offset_of_m_EffectColor_3(),
Shadow_t4269599528::get_offset_of_m_EffectDistance_4(),
Shadow_t4269599528::get_offset_of_m_UseGraphicAlpha_5(),
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1902 = { sizeof (U3CPrivateImplementationDetailsU3E_t1486305142), -1, sizeof(U3CPrivateImplementationDetailsU3E_t1486305142_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1902[1] =
{
U3CPrivateImplementationDetailsU3E_t1486305142_StaticFields::get_offset_of_U24fieldU2D7BBE37982E6C057ED87163CAFC7FD6E5E42EEA46_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1903 = { sizeof (U24ArrayTypeU3D12_t1568637717)+ sizeof (Il2CppObject), sizeof(U24ArrayTypeU3D12_t1568637717 ), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1904 = { sizeof (U3CModuleU3E_t3783534221), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1905 = { sizeof (ShortcutExtensions43_t301896125), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1906 = { sizeof (U3CU3Ec__DisplayClass2_0_t426334720), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1906[1] =
{
U3CU3Ec__DisplayClass2_0_t426334720::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1907 = { sizeof (U3CU3Ec__DisplayClass3_0_t426334751), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1907[1] =
{
U3CU3Ec__DisplayClass3_0_t426334751::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1908 = { sizeof (U3CU3Ec__DisplayClass5_0_t426334817), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1908[1] =
{
U3CU3Ec__DisplayClass5_0_t426334817::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1909 = { sizeof (U3CU3Ec__DisplayClass8_0_t426334918), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1909[1] =
{
U3CU3Ec__DisplayClass8_0_t426334918::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1910 = { sizeof (U3CModuleU3E_t3783534222), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1911 = { sizeof (DOTweenUtils46_t1550156519), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1912 = { sizeof (ShortcutExtensions46_t705180652), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1913 = { sizeof (U3CU3Ec__DisplayClass0_0_t3371939845), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1913[1] =
{
U3CU3Ec__DisplayClass0_0_t3371939845::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1914 = { sizeof (U3CU3Ec__DisplayClass3_0_t3371939942), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1914[1] =
{
U3CU3Ec__DisplayClass3_0_t3371939942::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1915 = { sizeof (U3CU3Ec__DisplayClass4_0_t3371939977), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1915[1] =
{
U3CU3Ec__DisplayClass4_0_t3371939977::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1916 = { sizeof (U3CU3Ec__DisplayClass16_0_t3017480080), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1916[1] =
{
U3CU3Ec__DisplayClass16_0_t3017480080::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1917 = { sizeof (U3CU3Ec__DisplayClass22_0_t3582130305), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1917[1] =
{
U3CU3Ec__DisplayClass22_0_t3582130305::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1918 = { sizeof (U3CU3Ec__DisplayClass23_0_t591124924), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1918[1] =
{
U3CU3Ec__DisplayClass23_0_t591124924::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1919 = { sizeof (U3CU3Ec__DisplayClass25_0_t4039117214), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1919[1] =
{
U3CU3Ec__DisplayClass25_0_t4039117214::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1920 = { sizeof (U3CU3Ec__DisplayClass31_0_t308799891), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1920[1] =
{
U3CU3Ec__DisplayClass31_0_t308799891::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1921 = { sizeof (U3CU3Ec__DisplayClass32_0_t3582130274), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1921[1] =
{
U3CU3Ec__DisplayClass32_0_t3582130274::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1922 = { sizeof (U3CU3Ec__DisplayClass33_0_t591124893), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1922[1] =
{
U3CU3Ec__DisplayClass33_0_t591124893::get_offset_of_target_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1923 = { sizeof (U3CModuleU3E_t3783534223), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1924 = { sizeof (DOTweenVisualManager_t2945673405), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1924[4] =
{
DOTweenVisualManager_t2945673405::get_offset_of_preset_2(),
DOTweenVisualManager_t2945673405::get_offset_of_onEnableBehaviour_3(),
DOTweenVisualManager_t2945673405::get_offset_of_onDisableBehaviour_4(),
DOTweenVisualManager_t2945673405::get_offset_of__requiresRestartFromSpawnPoint_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1925 = { sizeof (HandlesDrawMode_t3273484032)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1925[3] =
{
HandlesDrawMode_t3273484032::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1926 = { sizeof (HandlesType_t3201532857)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1926[3] =
{
HandlesType_t3201532857::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1927 = { sizeof (DOTweenInspectorMode_t2739551672)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1927[3] =
{
DOTweenInspectorMode_t2739551672::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1928 = { sizeof (DOTweenPath_t1397145371), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1928[36] =
{
DOTweenPath_t1397145371::get_offset_of_delay_17(),
DOTweenPath_t1397145371::get_offset_of_duration_18(),
DOTweenPath_t1397145371::get_offset_of_easeType_19(),
DOTweenPath_t1397145371::get_offset_of_easeCurve_20(),
DOTweenPath_t1397145371::get_offset_of_loops_21(),
DOTweenPath_t1397145371::get_offset_of_id_22(),
DOTweenPath_t1397145371::get_offset_of_loopType_23(),
DOTweenPath_t1397145371::get_offset_of_orientType_24(),
DOTweenPath_t1397145371::get_offset_of_lookAtTransform_25(),
DOTweenPath_t1397145371::get_offset_of_lookAtPosition_26(),
DOTweenPath_t1397145371::get_offset_of_lookAhead_27(),
DOTweenPath_t1397145371::get_offset_of_autoPlay_28(),
DOTweenPath_t1397145371::get_offset_of_autoKill_29(),
DOTweenPath_t1397145371::get_offset_of_relative_30(),
DOTweenPath_t1397145371::get_offset_of_isLocal_31(),
DOTweenPath_t1397145371::get_offset_of_isClosedPath_32(),
DOTweenPath_t1397145371::get_offset_of_pathResolution_33(),
DOTweenPath_t1397145371::get_offset_of_pathMode_34(),
DOTweenPath_t1397145371::get_offset_of_lockRotation_35(),
DOTweenPath_t1397145371::get_offset_of_assignForwardAndUp_36(),
DOTweenPath_t1397145371::get_offset_of_forwardDirection_37(),
DOTweenPath_t1397145371::get_offset_of_upDirection_38(),
DOTweenPath_t1397145371::get_offset_of_wps_39(),
DOTweenPath_t1397145371::get_offset_of_fullWps_40(),
DOTweenPath_t1397145371::get_offset_of_path_41(),
DOTweenPath_t1397145371::get_offset_of_inspectorMode_42(),
DOTweenPath_t1397145371::get_offset_of_pathType_43(),
DOTweenPath_t1397145371::get_offset_of_handlesType_44(),
DOTweenPath_t1397145371::get_offset_of_livePreview_45(),
DOTweenPath_t1397145371::get_offset_of_handlesDrawMode_46(),
DOTweenPath_t1397145371::get_offset_of_perspectiveHandleSize_47(),
DOTweenPath_t1397145371::get_offset_of_showIndexes_48(),
DOTweenPath_t1397145371::get_offset_of_showWpLength_49(),
DOTweenPath_t1397145371::get_offset_of_pathColor_50(),
DOTweenPath_t1397145371::get_offset_of_lastSrcPosition_51(),
DOTweenPath_t1397145371::get_offset_of_wpsDropdown_52(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1929 = { sizeof (ABSAnimationComponent_t2205594551), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1929[15] =
{
ABSAnimationComponent_t2205594551::get_offset_of_updateType_2(),
ABSAnimationComponent_t2205594551::get_offset_of_isSpeedBased_3(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnStart_4(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnPlay_5(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnUpdate_6(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnStepComplete_7(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnComplete_8(),
ABSAnimationComponent_t2205594551::get_offset_of_hasOnTweenCreated_9(),
ABSAnimationComponent_t2205594551::get_offset_of_onStart_10(),
ABSAnimationComponent_t2205594551::get_offset_of_onPlay_11(),
ABSAnimationComponent_t2205594551::get_offset_of_onUpdate_12(),
ABSAnimationComponent_t2205594551::get_offset_of_onStepComplete_13(),
ABSAnimationComponent_t2205594551::get_offset_of_onComplete_14(),
ABSAnimationComponent_t2205594551::get_offset_of_onTweenCreated_15(),
ABSAnimationComponent_t2205594551::get_offset_of_tween_16(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1930 = { sizeof (DOTweenAnimationType_t119935370)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1930[23] =
{
DOTweenAnimationType_t119935370::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1931 = { sizeof (OnDisableBehaviour_t125315118)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1931[7] =
{
OnDisableBehaviour_t125315118::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1932 = { sizeof (OnEnableBehaviour_t285142911)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1932[5] =
{
OnEnableBehaviour_t285142911::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1933 = { sizeof (TargetType_t2706200073)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1933[17] =
{
TargetType_t2706200073::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1934 = { sizeof (VisualManagerPreset_t4087939440)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1934[3] =
{
VisualManagerPreset_t4087939440::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1935 = { sizeof (U3CModuleU3E_t3783534224), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1936 = { sizeof (JsonType_t3145703806)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1936[9] =
{
JsonType_t3145703806::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1937 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1938 = { sizeof (JsonData_t269267574), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1938[10] =
{
JsonData_t269267574::get_offset_of_inst_array_0(),
JsonData_t269267574::get_offset_of_inst_boolean_1(),
JsonData_t269267574::get_offset_of_inst_double_2(),
JsonData_t269267574::get_offset_of_inst_int_3(),
JsonData_t269267574::get_offset_of_inst_long_4(),
JsonData_t269267574::get_offset_of_inst_object_5(),
JsonData_t269267574::get_offset_of_inst_string_6(),
JsonData_t269267574::get_offset_of_json_7(),
JsonData_t269267574::get_offset_of_type_8(),
JsonData_t269267574::get_offset_of_object_list_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1939 = { sizeof (OrderedDictionaryEnumerator_t3437478891), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1939[1] =
{
OrderedDictionaryEnumerator_t3437478891::get_offset_of_list_enumerator_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1940 = { sizeof (JsonException_t613047007), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1941 = { sizeof (PropertyMetadata_t3693826136)+ sizeof (Il2CppObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1941[3] =
{
PropertyMetadata_t3693826136::get_offset_of_Info_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
PropertyMetadata_t3693826136::get_offset_of_IsField_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
PropertyMetadata_t3693826136::get_offset_of_Type_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1942 = { sizeof (ArrayMetadata_t2008834462)+ sizeof (Il2CppObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1942[3] =
{
ArrayMetadata_t2008834462::get_offset_of_element_type_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
ArrayMetadata_t2008834462::get_offset_of_is_array_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
ArrayMetadata_t2008834462::get_offset_of_is_list_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1943 = { sizeof (ObjectMetadata_t3995922398)+ sizeof (Il2CppObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1943[3] =
{
ObjectMetadata_t3995922398::get_offset_of_element_type_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
ObjectMetadata_t3995922398::get_offset_of_is_dictionary_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
ObjectMetadata_t3995922398::get_offset_of_properties_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1944 = { sizeof (JsonMapper_t800426905), -1, sizeof(JsonMapper_t800426905_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1944[38] =
{
JsonMapper_t800426905_StaticFields::get_offset_of_max_nesting_depth_0(),
JsonMapper_t800426905_StaticFields::get_offset_of_datetime_format_1(),
JsonMapper_t800426905_StaticFields::get_offset_of_base_exporters_table_2(),
JsonMapper_t800426905_StaticFields::get_offset_of_custom_exporters_table_3(),
JsonMapper_t800426905_StaticFields::get_offset_of_base_importers_table_4(),
JsonMapper_t800426905_StaticFields::get_offset_of_custom_importers_table_5(),
JsonMapper_t800426905_StaticFields::get_offset_of_array_metadata_6(),
JsonMapper_t800426905_StaticFields::get_offset_of_array_metadata_lock_7(),
JsonMapper_t800426905_StaticFields::get_offset_of_conv_ops_8(),
JsonMapper_t800426905_StaticFields::get_offset_of_conv_ops_lock_9(),
JsonMapper_t800426905_StaticFields::get_offset_of_object_metadata_10(),
JsonMapper_t800426905_StaticFields::get_offset_of_object_metadata_lock_11(),
JsonMapper_t800426905_StaticFields::get_offset_of_type_properties_12(),
JsonMapper_t800426905_StaticFields::get_offset_of_type_properties_lock_13(),
JsonMapper_t800426905_StaticFields::get_offset_of_static_writer_14(),
JsonMapper_t800426905_StaticFields::get_offset_of_static_writer_lock_15(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache10_16(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache11_17(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache12_18(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache13_19(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache14_20(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache15_21(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache16_22(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache17_23(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache18_24(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache19_25(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1A_26(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1B_27(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1C_28(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1D_29(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1E_30(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache1F_31(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache20_32(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache21_33(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache22_34(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache23_35(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache24_36(),
JsonMapper_t800426905_StaticFields::get_offset_of_U3CU3Ef__amU24cache27_37(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1945 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1945[1] =
{
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1946 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1946[1] =
{
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1947 = { sizeof (JsonToken_t2852816099)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1947[13] =
{
JsonToken_t2852816099::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1948 = { sizeof (JsonReader_t1077921503), -1, sizeof(JsonReader_t1077921503_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1948[14] =
{
JsonReader_t1077921503_StaticFields::get_offset_of_parse_table_0(),
JsonReader_t1077921503::get_offset_of_automaton_stack_1(),
JsonReader_t1077921503::get_offset_of_current_input_2(),
JsonReader_t1077921503::get_offset_of_current_symbol_3(),
JsonReader_t1077921503::get_offset_of_end_of_json_4(),
JsonReader_t1077921503::get_offset_of_end_of_input_5(),
JsonReader_t1077921503::get_offset_of_lexer_6(),
JsonReader_t1077921503::get_offset_of_parser_in_string_7(),
JsonReader_t1077921503::get_offset_of_parser_return_8(),
JsonReader_t1077921503::get_offset_of_read_started_9(),
JsonReader_t1077921503::get_offset_of_reader_10(),
JsonReader_t1077921503::get_offset_of_reader_is_owned_11(),
JsonReader_t1077921503::get_offset_of_token_value_12(),
JsonReader_t1077921503::get_offset_of_token_13(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1949 = { sizeof (Condition_t1980525237)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1949[6] =
{
Condition_t1980525237::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1950 = { sizeof (WriterContext_t4137194742), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1950[5] =
{
WriterContext_t4137194742::get_offset_of_Count_0(),
WriterContext_t4137194742::get_offset_of_InArray_1(),
WriterContext_t4137194742::get_offset_of_InObject_2(),
WriterContext_t4137194742::get_offset_of_ExpectingValue_3(),
WriterContext_t4137194742::get_offset_of_Padding_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1951 = { sizeof (JsonWriter_t1927598499), -1, sizeof(JsonWriter_t1927598499_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1951[11] =
{
JsonWriter_t1927598499_StaticFields::get_offset_of_number_format_0(),
JsonWriter_t1927598499::get_offset_of_context_1(),
JsonWriter_t1927598499::get_offset_of_ctx_stack_2(),
JsonWriter_t1927598499::get_offset_of_has_reached_end_3(),
JsonWriter_t1927598499::get_offset_of_hex_seq_4(),
JsonWriter_t1927598499::get_offset_of_indentation_5(),
JsonWriter_t1927598499::get_offset_of_indent_value_6(),
JsonWriter_t1927598499::get_offset_of_inst_string_builder_7(),
JsonWriter_t1927598499::get_offset_of_pretty_print_8(),
JsonWriter_t1927598499::get_offset_of_validate_9(),
JsonWriter_t1927598499::get_offset_of_writer_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1952 = { sizeof (FsmContext_t1296252303), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1952[4] =
{
FsmContext_t1296252303::get_offset_of_Return_0(),
FsmContext_t1296252303::get_offset_of_NextState_1(),
FsmContext_t1296252303::get_offset_of_L_2(),
FsmContext_t1296252303::get_offset_of_StateStack_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1953 = { sizeof (Lexer_t186508296), -1, sizeof(Lexer_t186508296_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1953[14] =
{
Lexer_t186508296_StaticFields::get_offset_of_fsm_return_table_0(),
Lexer_t186508296_StaticFields::get_offset_of_fsm_handler_table_1(),
Lexer_t186508296::get_offset_of_allow_comments_2(),
Lexer_t186508296::get_offset_of_allow_single_quoted_strings_3(),
Lexer_t186508296::get_offset_of_end_of_input_4(),
Lexer_t186508296::get_offset_of_fsm_context_5(),
Lexer_t186508296::get_offset_of_input_buffer_6(),
Lexer_t186508296::get_offset_of_input_char_7(),
Lexer_t186508296::get_offset_of_reader_8(),
Lexer_t186508296::get_offset_of_state_9(),
Lexer_t186508296::get_offset_of_string_buffer_10(),
Lexer_t186508296::get_offset_of_string_value_11(),
Lexer_t186508296::get_offset_of_token_12(),
Lexer_t186508296::get_offset_of_unichar_13(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1954 = { sizeof (StateHandler_t387387051), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1955 = { sizeof (ParserToken_t1554180950)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1955[20] =
{
ParserToken_t1554180950::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1956 = { sizeof (ExporterFunc_t408878057), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1957 = { 0, 0, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1958 = { sizeof (ImporterFunc_t2977850894), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1959 = { 0, 0, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1960 = { sizeof (WrapperFactory_t2219329745), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1961 = { sizeof (U3CPrivateImplementationDetailsU3E_t1486305143), -1, sizeof(U3CPrivateImplementationDetailsU3E_t1486305143_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1961[1] =
{
U3CPrivateImplementationDetailsU3E_t1486305143_StaticFields::get_offset_of_U24U24fieldU2D0_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1962 = { sizeof (U24ArrayTypeU24112_t4007721333)+ sizeof (Il2CppObject), sizeof(U24ArrayTypeU24112_t4007721333 ), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1963 = { sizeof (U3CModuleU3E_t3783534225), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1964 = { sizeof (ARController_t2638793709), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1964[1] =
{
ARController_t2638793709::get_offset_of_mVuforiaBehaviour_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1965 = { sizeof (U3CU3Ec__DisplayClass11_0_t2604000414), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1965[1] =
{
U3CU3Ec__DisplayClass11_0_t2604000414::get_offset_of_controller_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1966 = { sizeof (DigitalEyewearARController_t1398758191), -1, sizeof(DigitalEyewearARController_t1398758191_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1966[28] =
{
0,
0,
0,
0,
0,
0,
DigitalEyewearARController_t1398758191::get_offset_of_mCameraOffset_7(),
DigitalEyewearARController_t1398758191::get_offset_of_mDistortionRenderingMode_8(),
DigitalEyewearARController_t1398758191::get_offset_of_mDistortionRenderingLayer_9(),
DigitalEyewearARController_t1398758191::get_offset_of_mEyewearType_10(),
DigitalEyewearARController_t1398758191::get_offset_of_mStereoFramework_11(),
DigitalEyewearARController_t1398758191::get_offset_of_mSeeThroughConfiguration_12(),
DigitalEyewearARController_t1398758191::get_offset_of_mViewerName_13(),
DigitalEyewearARController_t1398758191::get_offset_of_mViewerManufacturer_14(),
DigitalEyewearARController_t1398758191::get_offset_of_mUseCustomViewer_15(),
DigitalEyewearARController_t1398758191::get_offset_of_mCustomViewer_16(),
DigitalEyewearARController_t1398758191::get_offset_of_mCentralAnchorPoint_17(),
DigitalEyewearARController_t1398758191::get_offset_of_mParentAnchorPoint_18(),
DigitalEyewearARController_t1398758191::get_offset_of_mPrimaryCamera_19(),
DigitalEyewearARController_t1398758191::get_offset_of_mPrimaryCameraOriginalRect_20(),
DigitalEyewearARController_t1398758191::get_offset_of_mSecondaryCamera_21(),
DigitalEyewearARController_t1398758191::get_offset_of_mSecondaryCameraOriginalRect_22(),
DigitalEyewearARController_t1398758191::get_offset_of_mSecondaryCameraDisabledLocally_23(),
DigitalEyewearARController_t1398758191::get_offset_of_mVuforiaBehaviour_24(),
DigitalEyewearARController_t1398758191::get_offset_of_mDistortionRenderingBhvr_25(),
DigitalEyewearARController_t1398758191::get_offset_of_mSetFocusPlaneAutomatically_26(),
DigitalEyewearARController_t1398758191_StaticFields::get_offset_of_mInstance_27(),
DigitalEyewearARController_t1398758191_StaticFields::get_offset_of_mPadlock_28(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1967 = { sizeof (EyewearType_t2121820252)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1967[4] =
{
EyewearType_t2121820252::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1968 = { sizeof (StereoFramework_t3746630162)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1968[4] =
{
StereoFramework_t3746630162::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1969 = { sizeof (SeeThroughConfiguration_t342269456)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1969[3] =
{
SeeThroughConfiguration_t342269456::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1970 = { sizeof (SerializableViewerParameters_t2750347603), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1970[11] =
{
SerializableViewerParameters_t2750347603::get_offset_of_Version_0(),
SerializableViewerParameters_t2750347603::get_offset_of_Name_1(),
SerializableViewerParameters_t2750347603::get_offset_of_Manufacturer_2(),
SerializableViewerParameters_t2750347603::get_offset_of_ButtonType_3(),
SerializableViewerParameters_t2750347603::get_offset_of_ScreenToLensDistance_4(),
SerializableViewerParameters_t2750347603::get_offset_of_InterLensDistance_5(),
SerializableViewerParameters_t2750347603::get_offset_of_TrayAlignment_6(),
SerializableViewerParameters_t2750347603::get_offset_of_LensCenterToTrayDistance_7(),
SerializableViewerParameters_t2750347603::get_offset_of_DistortionCoefficients_8(),
SerializableViewerParameters_t2750347603::get_offset_of_FieldOfView_9(),
SerializableViewerParameters_t2750347603::get_offset_of_ContainsMagnet_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1971 = { sizeof (EyewearDevice_t1202635122), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1972 = { sizeof (EyeID_t642957731)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1972[4] =
{
EyeID_t642957731::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1973 = { sizeof (EyewearCalibrationReading_t1521251591)+ sizeof (Il2CppObject), sizeof(EyewearCalibrationReading_t1521251591_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1973[5] =
{
EyewearCalibrationReading_t1521251591::get_offset_of_pose_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
EyewearCalibrationReading_t1521251591::get_offset_of_scale_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
EyewearCalibrationReading_t1521251591::get_offset_of_centerX_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
EyewearCalibrationReading_t1521251591::get_offset_of_centerY_3() + static_cast<int32_t>(sizeof(Il2CppObject)),
EyewearCalibrationReading_t1521251591::get_offset_of_unused_4() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1974 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1975 = { sizeof (NullHoloLensApiAbstraction_t1386933393), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1976 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1977 = { sizeof (DeviceTracker_t2183873360), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1978 = { sizeof (DeviceTrackerARController_t3939888793), -1, sizeof(DeviceTrackerARController_t3939888793_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1978[13] =
{
DeviceTrackerARController_t3939888793_StaticFields::get_offset_of_DEFAULT_HEAD_PIVOT_1(),
DeviceTrackerARController_t3939888793_StaticFields::get_offset_of_DEFAULT_HANDHELD_PIVOT_2(),
DeviceTrackerARController_t3939888793::get_offset_of_mAutoInitTracker_3(),
DeviceTrackerARController_t3939888793::get_offset_of_mAutoStartTracker_4(),
DeviceTrackerARController_t3939888793::get_offset_of_mPosePrediction_5(),
DeviceTrackerARController_t3939888793::get_offset_of_mModelCorrectionMode_6(),
DeviceTrackerARController_t3939888793::get_offset_of_mModelTransformEnabled_7(),
DeviceTrackerARController_t3939888793::get_offset_of_mModelTransform_8(),
DeviceTrackerARController_t3939888793::get_offset_of_mTrackerStarted_9(),
DeviceTrackerARController_t3939888793::get_offset_of_mTrackerWasActiveBeforePause_10(),
DeviceTrackerARController_t3939888793::get_offset_of_mTrackerWasActiveBeforeDisabling_11(),
DeviceTrackerARController_t3939888793_StaticFields::get_offset_of_mInstance_12(),
DeviceTrackerARController_t3939888793_StaticFields::get_offset_of_mPadlock_13(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1979 = { sizeof (DistortionRenderingMode_t3766399464)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1979[4] =
{
DistortionRenderingMode_t3766399464::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1980 = { sizeof (DistortionRenderingBehaviour_t2945034146), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1980[12] =
{
DistortionRenderingBehaviour_t2945034146::get_offset_of_mSingleTexture_2(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mRenderLayer_3(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mOriginalCullingMasks_4(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mStereoCameras_5(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mMeshes_6(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mTextures_7(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mStarted_8(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mVideoBackgroundChanged_9(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mOriginalLeftViewport_10(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mOriginalRightViewport_11(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mDualTextureLeftViewport_12(),
DistortionRenderingBehaviour_t2945034146::get_offset_of_mDualTextureRightViewport_13(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1981 = { sizeof (DelegateHelper_t1202011487), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1982 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1983 = { sizeof (PlayModeEyewearUserCalibratorImpl_t117253723), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1984 = { sizeof (PlayModeEyewearCalibrationProfileManagerImpl_t3632467967), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1985 = { sizeof (PlayModeEyewearDevice_t2977282393), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1985[3] =
{
PlayModeEyewearDevice_t2977282393::get_offset_of_mProfileManager_1(),
PlayModeEyewearDevice_t2977282393::get_offset_of_mCalibrator_2(),
PlayModeEyewearDevice_t2977282393::get_offset_of_mDummyPredictiveTracking_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1986 = { sizeof (DedicatedEyewearDevice_t22891981), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1986[2] =
{
DedicatedEyewearDevice_t22891981::get_offset_of_mProfileManager_1(),
DedicatedEyewearDevice_t22891981::get_offset_of_mCalibrator_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1987 = { sizeof (CameraConfigurationUtility_t3904398347), -1, sizeof(CameraConfigurationUtility_t3904398347_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1987[6] =
{
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MIN_CENTER_0(),
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MAX_CENTER_1(),
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MAX_BOTTOM_2(),
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MAX_TOP_3(),
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MAX_LEFT_4(),
CameraConfigurationUtility_t3904398347_StaticFields::get_offset_of_MAX_RIGHT_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1988 = { sizeof (BaseCameraConfiguration_t38459502), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1988[10] =
{
BaseCameraConfiguration_t38459502::get_offset_of_mCameraDeviceMode_0(),
BaseCameraConfiguration_t38459502::get_offset_of_mLastVideoBackGroundMirroredFromSDK_1(),
BaseCameraConfiguration_t38459502::get_offset_of_mOnVideoBackgroundConfigChanged_2(),
BaseCameraConfiguration_t38459502::get_offset_of_mVideoBackgroundBehaviours_3(),
BaseCameraConfiguration_t38459502::get_offset_of_mVideoBackgroundViewportRect_4(),
BaseCameraConfiguration_t38459502::get_offset_of_mRenderVideoBackground_5(),
BaseCameraConfiguration_t38459502::get_offset_of_mProjectionOrientation_6(),
BaseCameraConfiguration_t38459502::get_offset_of_mInitialReflection_7(),
BaseCameraConfiguration_t38459502::get_offset_of_mBackgroundPlaneBehaviour_8(),
BaseCameraConfiguration_t38459502::get_offset_of_mCameraParameterChanged_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1989 = { sizeof (BaseStereoViewerCameraConfiguration_t1102239676), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1989[5] =
{
BaseStereoViewerCameraConfiguration_t1102239676::get_offset_of_mPrimaryCamera_10(),
BaseStereoViewerCameraConfiguration_t1102239676::get_offset_of_mSecondaryCamera_11(),
BaseStereoViewerCameraConfiguration_t1102239676::get_offset_of_mSkewFrustum_12(),
BaseStereoViewerCameraConfiguration_t1102239676::get_offset_of_mScreenWidth_13(),
BaseStereoViewerCameraConfiguration_t1102239676::get_offset_of_mScreenHeight_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1990 = { sizeof (StereoViewerCameraConfiguration_t3365023487), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1990[7] =
{
0,
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mLastAppliedLeftNearClipPlane_16(),
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mLastAppliedLeftFarClipPlane_17(),
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mLastAppliedRightNearClipPlane_18(),
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mLastAppliedRightFarClipPlane_19(),
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mCameraOffset_20(),
StereoViewerCameraConfiguration_t3365023487::get_offset_of_mIsDistorted_21(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1991 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1992 = { sizeof (HoloLensExtendedTrackingManager_t3502001541), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1992[15] =
{
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mNumFramesStablePose_0(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMaxPoseRelDistance_1(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMaxPoseAngleDiff_2(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMaxCamPoseAbsDistance_3(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMaxCamPoseAngleDiff_4(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMinNumFramesPoseOff_5(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMinPoseUpdateRelDistance_6(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMinPoseUpdateAngleDiff_7(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mTrackableSizeInViewThreshold_8(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mMaxDistanceFromViewCenterForPoseUpdate_9(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mSetWorldAnchors_10(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mTrackingList_11(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mTrackablesExtendedTrackingEnabled_12(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mTrackablesCurrentlyExtendedTracked_13(),
HoloLensExtendedTrackingManager_t3502001541::get_offset_of_mExtendedTrackablesState_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1993 = { sizeof (PoseInfo_t1161658011)+ sizeof (Il2CppObject), sizeof(PoseInfo_t1161658011 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1993[3] =
{
PoseInfo_t1161658011::get_offset_of_Position_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
PoseInfo_t1161658011::get_offset_of_Rotation_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
PoseInfo_t1161658011::get_offset_of_NumFramesPoseWasOff_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1994 = { sizeof (PoseAgeEntry_t3432166560)+ sizeof (Il2CppObject), sizeof(PoseAgeEntry_t3432166560 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1994[3] =
{
PoseAgeEntry_t3432166560::get_offset_of_Pose_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
PoseAgeEntry_t3432166560::get_offset_of_CameraPose_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
PoseAgeEntry_t3432166560::get_offset_of_Age_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1995 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1996 = { sizeof (VuforiaExtendedTrackingManager_t2074328369), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1997 = { sizeof (VuMarkManagerImpl_t1660847547), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1997[6] =
{
VuMarkManagerImpl_t1660847547::get_offset_of_mBehaviours_0(),
VuMarkManagerImpl_t1660847547::get_offset_of_mActiveVuMarkTargets_1(),
VuMarkManagerImpl_t1660847547::get_offset_of_mDestroyedBehaviours_2(),
VuMarkManagerImpl_t1660847547::get_offset_of_mOnVuMarkDetected_3(),
VuMarkManagerImpl_t1660847547::get_offset_of_mOnVuMarkLost_4(),
VuMarkManagerImpl_t1660847547::get_offset_of_mOnVuMarkBehaviourDetected_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1998 = { sizeof (InstanceIdImpl_t3955455590), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1998[5] =
{
InstanceIdImpl_t3955455590::get_offset_of_mDataType_0(),
InstanceIdImpl_t3955455590::get_offset_of_mBuffer_1(),
InstanceIdImpl_t3955455590::get_offset_of_mNumericValue_2(),
InstanceIdImpl_t3955455590::get_offset_of_mDataLength_3(),
InstanceIdImpl_t3955455590::get_offset_of_mCachedStringValue_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1999 = { sizeof (VuMarkTargetImpl_t2700679413), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1999[5] =
{
VuMarkTargetImpl_t2700679413::get_offset_of_mVuMarkTemplate_0(),
VuMarkTargetImpl_t2700679413::get_offset_of_mInstanceId_1(),
VuMarkTargetImpl_t2700679413::get_offset_of_mTargetId_2(),
VuMarkTargetImpl_t2700679413::get_offset_of_mInstanceImage_3(),
VuMarkTargetImpl_t2700679413::get_offset_of_mInstanceImageHeader_4(),
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| 54.789831
| 211
| 0.855761
|
408794550
|
f06ee92972823d6b60af68a5fc9664e81b799368
| 646
|
hpp
|
C++
|
test/split.hpp
|
ortfero/chineseroom
|
6532df6af72f0ab7597e70e00c7f50c45af43c28
|
[
"MIT"
] | null | null | null |
test/split.hpp
|
ortfero/chineseroom
|
6532df6af72f0ab7597e70e00c7f50c45af43c28
|
[
"MIT"
] | null | null | null |
test/split.hpp
|
ortfero/chineseroom
|
6532df6af72f0ab7597e70e00c7f50c45af43c28
|
[
"MIT"
] | null | null | null |
#pragma once
#include <doctest/doctest.h>
#include <chineseroom/split.hpp>
TEST_CASE("splitting string '1,2,,3,'") {
auto const splitted = chineseroom::split(std::string{"1,2,,3,"}, ',');
REQUIRE(splitted.size() == 3);
REQUIRE(splitted[0] == "1");
REQUIRE(splitted[1] == "2");
REQUIRE(splitted[2] == "3");
}
TEST_CASE("strictly splitting string '1,2,,3,'") {
auto const splitted = chineseroom::split_strictly(std::string{"1,2,,3,"}, ',');
REQUIRE(splitted.size() == 5);
REQUIRE(splitted[0] == "1");
REQUIRE(splitted[1] == "2");
REQUIRE(splitted[2] == "");
REQUIRE(splitted[3] == "3");
REQUIRE(splitted[4] == "");
}
| 23.925926
| 81
| 0.608359
|
ortfero
|
7eb7a059af5ad373bdf75c3559c30c7b4abc159a
| 4,987
|
cpp
|
C++
|
source/Dream/Events/Source.cpp
|
kurocha/dream-events
|
b2cf5a188d8e3be2a07a5b7d36ed3eebc812cb72
|
[
"MIT",
"Unlicense"
] | null | null | null |
source/Dream/Events/Source.cpp
|
kurocha/dream-events
|
b2cf5a188d8e3be2a07a5b7d36ed3eebc812cb72
|
[
"MIT",
"Unlicense"
] | null | null | null |
source/Dream/Events/Source.cpp
|
kurocha/dream-events
|
b2cf5a188d8e3be2a07a5b7d36ed3eebc812cb72
|
[
"MIT",
"Unlicense"
] | null | null | null |
//
// Events/Source.cpp
// This file is part of the "Dream" project, and is released under the MIT license.
//
// Created by Samuel Williams on 9/12/08.
// Copyright (c) 2008 Samuel Williams. All rights reserved.
//
//
#include "Source.hpp"
#include "Loop.hpp"
#include <fcntl.h>
#include <iostream>
#include <unistd.h>
#include <Dream/Core/Logger.hpp>
namespace Dream
{
namespace Events
{
// MARK: -
// MARK: class NotificationSource
NotificationSource::NotificationSource (CallbackT callback) : _callback(callback)
{
}
void NotificationSource::process_events (Loop * event_loop, Event event)
{
if (event == NOTIFICATION)
_callback(event_loop, this, event);
}
NotificationSource::~NotificationSource ()
{
}
static void stop_run_loop_callback (Loop * event_loop, NotificationSource * note, Event enent)
{
event_loop->stop();
}
Ref<NotificationSource> NotificationSource::stop_loop_notification ()
{
return new NotificationSource(stop_run_loop_callback);
}
// MARK: -
// MARK: class TimerSource
TimerSource::TimerSource (CallbackT callback, TimeT duration, bool repeats, bool strict) : _cancelled(false), _repeats(repeats), _strict(strict), _duration(duration), _callback(callback)
{
}
TimerSource::~TimerSource ()
{
}
void TimerSource::process_events (Loop * rl, Event events)
{
if (!_cancelled)
_callback(rl, this, events);
}
bool TimerSource::repeats () const
{
if (_cancelled)
return false;
return _repeats;
}
TimeT TimerSource::next_timeout (const TimeT & last_timeout, const TimeT & current_time) const
{
// This means that TimerSource will attempt to "catch-up"
//return last_timeout + _duration;
// This means that TimerSource will process updates as is possible, and might drop
// updates if they are in the past
if (!_strict && last_timeout + _duration < current_time)
return current_time;
else
return last_timeout + _duration;
}
void TimerSource::cancel ()
{
_cancelled = true;
}
// MARK: -
// MARK: class IFileDescriptorSource
void IFileDescriptorSource::debug_file_descriptor_flags(int fd)
{
std::stringstream log_buffer;
int flags = fcntl(fd, F_GETFL);
log_buffer << "Flags for #" << fd << ":";
if (flags & O_NONBLOCK)
log_buffer << " NONBLOCK";
int access_mode = flags & O_ACCMODE;
if (access_mode == O_RDONLY)
log_buffer << " RDONLY";
else if (access_mode == O_WRONLY)
log_buffer << " WRONLY";
else
log_buffer << " RDWR";
if (flags & O_APPEND)
log_buffer << " APPEND";
if (flags & O_CREAT)
log_buffer << " CREATE";
if (flags & O_TRUNC)
log_buffer << " TRUNCATE";
log_debug(log_buffer.str());
}
void IFileDescriptorSource::set_will_block (bool value)
{
FileDescriptor curfd = file_descriptor();
if (value == false) {
fcntl(curfd, F_SETFL, fcntl(curfd, F_GETFL) | O_NONBLOCK);
} else {
fcntl(curfd, F_SETFL, fcntl(curfd, F_GETFL) & ~O_NONBLOCK);
}
}
bool IFileDescriptorSource::will_block ()
{
return !(fcntl(file_descriptor(), F_GETFL) & O_NONBLOCK);
}
// MARK: -
// MARK: class FileDescriptorSource
FileDescriptorSource::FileDescriptorSource (CallbackT callback, FileDescriptor file_descriptor) : _file_descriptor(file_descriptor), _callback(callback)
{
}
FileDescriptorSource::~FileDescriptorSource ()
{
}
void FileDescriptorSource::process_events (Loop * event_loop, Event events)
{
_callback(event_loop, this, events);
}
FileDescriptor FileDescriptorSource::file_descriptor () const
{
return _file_descriptor;
}
Ref<FileDescriptorSource> FileDescriptorSource::for_standard_in (CallbackT callback)
{
return new FileDescriptorSource(callback, STDIN_FILENO);
}
Ref<FileDescriptorSource> FileDescriptorSource::for_standard_out (CallbackT callback)
{
return new FileDescriptorSource(callback, STDOUT_FILENO);
}
Ref<FileDescriptorSource> FileDescriptorSource::for_standard_error (CallbackT callback)
{
return new FileDescriptorSource(callback, STDERR_FILENO);
}
// MARK: -
// MARK: class NotificationPipeSource
NotificationPipeSource::NotificationPipeSource ()
{
int result = pipe(_file_descriptors);
DREAM_ASSERT(result == 0);
}
NotificationPipeSource::~NotificationPipeSource ()
{
close(_file_descriptors[0]);
close(_file_descriptors[1]);
}
FileDescriptor NotificationPipeSource::file_descriptor () const
{
// Read end
return _file_descriptors[0];
}
void NotificationPipeSource::notify_event_loop () const
{
// Send a byte down the pipe
write(_file_descriptors[1], "\0", 1);
}
void NotificationPipeSource::process_events (Loop * loop, Event event)
{
const std::size_t COUNT = 32;
char buffer[COUNT];
// Discard all notification bytes:
read(_file_descriptors[0], &buffer, COUNT);
// Process urgent notifications:
loop->process_notifications();
}
}
}
| 22.263393
| 188
| 0.697814
|
kurocha
|
7eb8f1d7a2ef4df245e9f013d0b1844198240c44
| 1,191
|
cpp
|
C++
|
ESOBrowser/ESODatabaseModel.cpp
|
moon-touched/ESOExplorer
|
a57e6c5d545d48f783664f624cbeee5c5b542ef3
|
[
"MIT"
] | 2
|
2020-07-25T01:51:34.000Z
|
2021-07-12T20:35:28.000Z
|
ESOBrowser/ESODatabaseModel.cpp
|
moon-touched/ESOExplorer
|
a57e6c5d545d48f783664f624cbeee5c5b542ef3
|
[
"MIT"
] | null | null | null |
ESOBrowser/ESODatabaseModel.cpp
|
moon-touched/ESOExplorer
|
a57e6c5d545d48f783664f624cbeee5c5b542ef3
|
[
"MIT"
] | null | null | null |
#include "ESODatabaseModel.h"
#include <ESOData/Database/ESODatabase.h>
ESODatabaseModel::ESODatabaseModel(const esodata::ESODatabase* database, QObject* parent) : QAbstractItemModel(parent), m_database(database) {
}
ESODatabaseModel::~ESODatabaseModel() = default;
int ESODatabaseModel::columnCount(const QModelIndex& parent) const {
if (parent.isValid())
return 0;
return 1;
}
QVariant ESODatabaseModel::data(const QModelIndex& index, int role) const {
auto def = static_cast<esodata::ESODatabaseDef*>(index.internalPointer());
switch (role) {
case Qt::DisplayRole:
return QString::fromStdString(def->name());
default:
return QVariant();
}
}
QModelIndex ESODatabaseModel::index(int row, int column, const QModelIndex& parent) const {
if(parent.isValid() || column != 0)
return QModelIndex();
return createIndex(row, column, const_cast<esodata::ESODatabaseDef *>(&m_database->defs()[row]));
}
QModelIndex ESODatabaseModel::parent(const QModelIndex& index) const {
(void)index;
return QModelIndex();
}
int ESODatabaseModel::rowCount(const QModelIndex& parent) const {
if (parent.isValid())
return 0;
return static_cast<int>(m_database->defs().size());
}
| 24.8125
| 142
| 0.745592
|
moon-touched
|
7ec25261c39def588dac7424a1a1b276fad3ab59
| 11,445
|
cpp
|
C++
|
sdk/src/config.cpp
|
Appdynamics/iot-cpp-sdk
|
abb7d70b2364089495ac73adf2a992c0af6eaf8c
|
[
"Apache-2.0"
] | 3
|
2018-09-13T21:26:27.000Z
|
2022-01-25T06:15:06.000Z
|
sdk/src/config.cpp
|
Appdynamics/iot-cpp-sdk
|
abb7d70b2364089495ac73adf2a992c0af6eaf8c
|
[
"Apache-2.0"
] | 11
|
2018-01-30T00:42:23.000Z
|
2019-10-20T07:19:37.000Z
|
sdk/src/config.cpp
|
Appdynamics/iot-cpp-sdk
|
abb7d70b2364089495ac73adf2a992c0af6eaf8c
|
[
"Apache-2.0"
] | 5
|
2018-01-29T18:52:21.000Z
|
2019-05-19T02:38:18.000Z
|
/*
* Copyright (c) 2018 AppDynamics LLC and its affiliates
*
* 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 "config.hpp"
#include "beacon.hpp"
#include "log.hpp"
static appd_sdk_config_t global_sdk_config;
static std::string appd_iot_eum_collector_url_appkey_prefix = "eumcollector/iot/v1/application/";
static std::string appd_iot_eum_collector_url_beacons_suffix = "/beacons";
static std::string appd_iot_eum_collector_url_enabled_suffix = "/enabled";
static std::string default_eum_collector_url = "https://iot-col.eum-appdynamics.com";
//Server Correlation headers in {key,value} format
static const appd_iot_data_t global_correlation_headers[APPD_IOT_NUM_SERVER_CORRELATION_HEADERS] =
{
{"ADRUM", {"isAjax:true"}, APPD_IOT_STRING},
{"ADRUM_1", {"isMobile:true"}, APPD_IOT_STRING}
};
static appd_iot_sdk_state_t global_sdk_state = APPD_IOT_SDK_UNINITIALIZED;
/**
* @brief This method Initializes the SDK. <br>
* This method should be called atleast once, early in your application's start up sequence.
* @param sdkcfg contains sdk configuration such as collector url, appkey etc
* @param devcfg contains device information such as device type/name and hw/fw/sw versions
* @return appd_iot_error_code_t Error code indicating if the function call is a success or fail.
* Error code returned provides more details on the type of error occurred.
*/
appd_iot_error_code_t appd_iot_init_sdk(appd_iot_sdk_config_t sdkcfg,
appd_iot_device_config_t devcfg)
{
std::string eum_collector_url;
appd_iot_error_code_t retcode;
/* Process Log Config */
if (sdkcfg.log_level >= APPD_IOT_LOG_OFF && sdkcfg.log_level <= APPD_IOT_LOG_ALL)
{
global_sdk_config.log_level = sdkcfg.log_level;
}
else
{
global_sdk_config.log_level = APPD_IOT_LOG_ERROR;
}
if (global_sdk_config.log_level != APPD_IOT_LOG_OFF)
{
global_sdk_config.log_write_cb = sdkcfg.log_write_cb;
}
/* Process Device Config */
retcode = appd_iot_init_device_config(devcfg);
if (retcode != APPD_IOT_SUCCESS)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Device Config Initialization Failed");
return retcode;
}
/* Process SDK Config */
if (sdkcfg.appkey == NULL)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "AppKey cannot be NULL");
return APPD_IOT_ERR_INVALID_INPUT;
}
global_sdk_config.appkey = sdkcfg.appkey;
if (sdkcfg.eum_collector_url == NULL)
{
eum_collector_url = default_eum_collector_url;
appd_iot_log(APPD_IOT_LOG_ERROR, "EUM collector URL is NULL, setting to default:%s",
default_eum_collector_url.c_str());
}
else
{
eum_collector_url = sdkcfg.eum_collector_url;
}
if (eum_collector_url.at(eum_collector_url.length() - 1) != '/')
{
eum_collector_url = eum_collector_url + "/";
}
global_sdk_config.eum_collector_url =
eum_collector_url + appd_iot_eum_collector_url_appkey_prefix +
global_sdk_config.appkey + appd_iot_eum_collector_url_beacons_suffix;
global_sdk_config.eum_appkey_enabled_url =
eum_collector_url + appd_iot_eum_collector_url_appkey_prefix +
global_sdk_config.appkey + appd_iot_eum_collector_url_enabled_suffix;
appd_iot_log(APPD_IOT_LOG_INFO, "EUM Collector URL %s", global_sdk_config.eum_collector_url.c_str());
if (sdkcfg.sdk_state_change_cb != NULL)
{
global_sdk_config.sdk_state_change_cb = sdkcfg.sdk_state_change_cb;
}
appd_iot_set_sdk_state(APPD_IOT_SDK_ENABLED);
return APPD_IOT_SUCCESS;
}
/**
* @brief This method registers network interface <br>
* This method should be called atleast once, early in your application's start up sequence.
* @param http_cb contains function pointers for http request send and http response done callbacks <br>.
* http request send callback will be called when appd_iot_send_all_events is triggered. <br>
* http response done callback will be called after send http request callback returns and
* response is processed.
* @return appd_iot_error_code_t Error code indicating if the function call is a success or fail.
* Error code returned provides more details on the type of error occurred.
*/
appd_iot_error_code_t appd_iot_register_network_interface(appd_iot_http_cb_t http_cb)
{
if (http_cb.http_req_send_cb == NULL)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "http_req_send_cb is NULL");
return APPD_IOT_ERR_INVALID_INPUT;
}
if (http_cb.http_resp_done_cb == NULL)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "http_resp_done_cb is NULL");
return APPD_IOT_ERR_INVALID_INPUT;
}
global_sdk_config.http_cb.http_req_send_cb = http_cb.http_req_send_cb;
global_sdk_config.http_cb.http_resp_done_cb = http_cb.http_resp_done_cb;
return APPD_IOT_SUCCESS;
}
/**
* @brief Get http request send callback function pointer
* @return callback function pointer
*/
appd_iot_http_req_send_cb_t appd_iot_get_http_req_send_cb(void)
{
return global_sdk_config.http_cb.http_req_send_cb;
}
/**
* @brief Get http response done callback function pointer
* @return callback function pointer
*/
appd_iot_http_resp_done_cb_t appd_iot_get_http_resp_done_cb(void)
{
return global_sdk_config.http_cb.http_resp_done_cb;
}
/**
* @brief Get Log Level configured as part of SDK Initialization
* @return appd_iot_log_level_t contains log level enum
*/
appd_iot_log_level_t appd_iot_get_log_level(void)
{
return global_sdk_config.log_level;
}
/**
* @brief Get Log Write Callback Function Pointer.
* @return appd_iot_log_write_cb_t contains log_write_cb fun ptr
*/
appd_iot_log_write_cb_t appd_iot_get_log_write_cb(void)
{
return global_sdk_config.log_write_cb;
}
/**
* @brief Get Configured EUM Collector URL
* @return URL in string format
*/
const char* appd_iot_get_eum_collector_url(void)
{
return global_sdk_config.eum_collector_url.c_str();
}
/**
* @brief Get Server Correlation headers in {key,value} format that need to be added to
* every outgoing http request to enable capturing Business Transaction (BT).
* @return Server Correlation Headers. Total number of headers present is given by
* macro APPD_IOT_NUM_SERVER_CORRELATION_HEADERS. Do not modify or free returned headers.
*/
const appd_iot_data_t* appd_iot_get_server_correlation_headers(void)
{
return global_correlation_headers;
}
/**
* @brief Set SDK State
* @param new_state indicates the new sdk state that need to be set
*/
void appd_iot_set_sdk_state(appd_iot_sdk_state_t new_state)
{
if (global_sdk_state == new_state)
{
appd_iot_log(APPD_IOT_LOG_WARN, "SDK state update with same state as current:%s",
appd_iot_sdk_state_to_str(global_sdk_state));
return;
}
global_sdk_state = new_state;
appd_iot_log(APPD_IOT_LOG_INFO, "New SDK state :%s", appd_iot_sdk_state_to_str(global_sdk_state));
if (global_sdk_config.sdk_state_change_cb != NULL)
{
global_sdk_config.sdk_state_change_cb(global_sdk_state);
}
}
/**
* @brief Get Current SDK State
* @return appd_iot_sdk_state_t with current sdk state
*/
appd_iot_sdk_state_t appd_iot_get_sdk_state(void)
{
return global_sdk_state;
}
/**
* @brief Set SDK state to disabled state based on the HTTP Response Code
* @param http_resp_code indicates the response code from the Collector
*/
void appd_iot_disable_sdk(int http_resp_code)
{
if (http_resp_code == 403)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Resp Code:%d Application on Controller is Disabled",
http_resp_code);
appd_iot_set_sdk_state(APPD_IOT_SDK_DISABLED_KILL_SWITCH);
}
else if (http_resp_code == 429)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Resp Code:%d Application Data Limit Exceeded", http_resp_code);
appd_iot_set_sdk_state(APPD_IOT_SDK_DISABLED_DATA_LIMIT_EXCEEDED);
}
else if (http_resp_code == 402)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Resp Code:%d Application License Expired", http_resp_code);
appd_iot_set_sdk_state(APPD_IOT_SDK_DISABLED_LICENSE_EXPIRED);
}
else
{
appd_iot_log(APPD_IOT_LOG_INFO, "Resp Code:%d not supported to disable SDK", http_resp_code);
}
}
/**
* @brief Use this API to check with AppDynamics Collector on the status of IoT Application on
* AppDynamics Controller, whether instrumentation is enabled or not. If the Collector returns Success, SDK
* gets ENABLED in case it has been DISABLED previously by Collector due to license expiry, kill switch or
* data limit exceeded. <br>
* It is required that SDK initialization is already done using the API appd_iot_init_sdk() before
* calling this function.
* @return appd_iot_error_code_t will indicate success if app is enabled
*/
appd_iot_error_code_t appd_iot_check_app_status(void)
{
appd_iot_sdk_state_t curr_sdk_state = appd_iot_get_sdk_state();
if (curr_sdk_state == APPD_IOT_SDK_UNINITIALIZED)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "SDK is Uninitalized. Call Init SDK before calling this API");
return APPD_IOT_ERR_SDK_NOT_ENABLED;
}
/* Init all the data structures - REQ and RESP */
appd_iot_http_req_t http_req;
appd_iot_http_resp_t* http_resp = NULL;
appd_iot_error_code_t retcode = APPD_IOT_SUCCESS;
appd_iot_http_req_send_cb_t http_req_send_cb = appd_iot_get_http_req_send_cb();
appd_iot_http_resp_done_cb_t http_resp_done_cb = appd_iot_get_http_resp_done_cb();
if (http_req_send_cb == NULL)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Network Interface Not Available");
return APPD_IOT_ERR_NETWORK_NOT_AVAILABLE;
}
appd_iot_init_to_zero(&http_req, sizeof(http_req));
http_req.type = "GET";
http_req.url = global_sdk_config.eum_appkey_enabled_url.c_str();
http_resp = http_req_send_cb(&http_req);
/* check if any error present in http response */
if (http_resp != NULL)
{
retcode = http_resp->error;
}
else
{
appd_iot_log(APPD_IOT_LOG_ERROR, "NULL HTTP Response Returned");
retcode = APPD_IOT_ERR_NULL_PTR;
}
/* Return if there is an error executing http req */
if (retcode != APPD_IOT_SUCCESS)
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Error Executing HTTP Request, ErrorCode:%d", retcode);
if (http_resp_done_cb != NULL)
{
http_resp_done_cb(http_resp);
}
return retcode;
}
if (http_resp->resp_code >= 200 && http_resp->resp_code < 300)
{
appd_iot_set_sdk_state(APPD_IOT_SDK_ENABLED);
appd_iot_log(APPD_IOT_LOG_INFO, "RespCode:%d Application is Enabled on Controller", http_resp->resp_code);
retcode = APPD_IOT_SUCCESS;
}
else if ((http_resp->resp_code == 402) ||
(http_resp->resp_code == 403) ||
(http_resp->resp_code == 429))
{
appd_iot_disable_sdk(http_resp->resp_code);
retcode = APPD_IOT_ERR_NETWORK_REJECT;
}
else
{
appd_iot_log(APPD_IOT_LOG_ERROR, "Resp Code:%d Network Request to Check App Status Failed",
http_resp->resp_code);
retcode = APPD_IOT_ERR_NETWORK_ERROR;
}
if (http_resp_done_cb != NULL)
{
http_resp_done_cb(http_resp);
}
return retcode;
}
| 31.703601
| 110
| 0.757886
|
Appdynamics
|
7ec322b6f9f602c5011df5edd6031a7aa189a19b
| 1,899
|
cpp
|
C++
|
Antiplagiat/Antiplagiat/bin/Debug/u42682_518_E_10004263.cpp
|
DmitryTheFirst/AntiplagiatVkCup
|
556d3fe2e5a630d06a7aa49f2af5dcb28667275a
|
[
"Apache-2.0"
] | 1
|
2015-07-04T14:45:32.000Z
|
2015-07-04T14:45:32.000Z
|
Antiplagiat/Antiplagiat/bin/Debug/u42682_518_E_10004263.cpp
|
DmitryTheFirst/AntiplagiatVkCup
|
556d3fe2e5a630d06a7aa49f2af5dcb28667275a
|
[
"Apache-2.0"
] | null | null | null |
Antiplagiat/Antiplagiat/bin/Debug/u42682_518_E_10004263.cpp
|
DmitryTheFirst/AntiplagiatVkCup
|
556d3fe2e5a630d06a7aa49f2af5dcb28667275a
|
[
"Apache-2.0"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define gc getchar
int a[500005];
bool v[500005];
int read(int i) {
char c = gc();
while((c<'0' || c>'9') && c!='?' && c!='-') c = gc();
bool sig = 1;
if(c=='?') { v[i] = 1; return 0; }
if(c=='-') { c = gc(); sig = 0; }
int ret = 0;
while(c>='0' && c<='9') {
ret = 10 * ret + c - 48;
c = gc();
}
if(sig) return ret;
return -ret;
}
int main(){
ios_base::sync_with_stdio(0);
int n,k;
n = read(0); k = read(0);
//cout<<n<<" "<<k<<endl;
for(int i=0; i<n; i++) {
a[i] = read(i);
//cout<<a[i]<<" "<<v[i]<<endl;
}
bool ov = true;
for(int i=0; i<k; i++) {
int l = i-k;
while(l+k<n) {
int r = l+k; int p = 0;
while(r<n && v[r]) { r+=k; p++; }
//cout<<"1: "<<l<<" "<<r<<endl;
int r2 = r;
if(l<0 && r>=n) {
int cur = -(p/2);
r = l+k; while(r<n) { a[r] = cur; cur++; r+=k; }
}
else if(l<0) {
int cur = a[r]-1; if(cur>p/2) cur = p/2;
r-=k; while(r>=0) { a[r] = cur; cur--; r-=k; }
}
else if(r>=n) {
int cur = a[l]+1; if(cur<-(p/2)) cur = -(p/2);
r = l+k; while(r<n) { a[r] = cur; cur++; r+=k; }
}
else if(a[r]-p-1<a[l]) {
ov = false;
}
else if(a[l]>0) {
int cur = a[l]+1;
r = l+k; while(r<n && v[r]) { a[r] = cur; cur++; r+=k; }
}
else if(a[r]<0) {
int cur = a[r]-1;
r-=k; while(r>=0 && v[r]) { a[r] = cur; cur--; r-=k; }
}
else {
int cur = -(p/2);
if(cur<a[l]+1) cur = a[l]+1;
else {
while(cur+p>a[r]) cur--;
}
r = l+k; while(r<n && v[r]) { a[r] = cur; cur++; r+=k; }
}
l = r2;
}
}
if(!ov) {
cout<<"Incorrect sequence"<<endl;
}
else {
for(int i=0; i<n; i++) cout<<a[i]<<" ";
cout<<endl;
}
return 0;
}
| 22.879518
| 64
| 0.382833
|
DmitryTheFirst
|
7ec43bb8d48251e102fd7ca0fb5c2e2e4e91bbc4
| 302
|
cpp
|
C++
|
dojo/first/06_coroutine_ts/main.cpp
|
adrianimboden/cppusergroup-adynchronous-programming
|
d6fad3ff980be2e7c13ed9e3e05b62e984c9caa4
|
[
"MIT"
] | null | null | null |
dojo/first/06_coroutine_ts/main.cpp
|
adrianimboden/cppusergroup-adynchronous-programming
|
d6fad3ff980be2e7c13ed9e3e05b62e984c9caa4
|
[
"MIT"
] | null | null | null |
dojo/first/06_coroutine_ts/main.cpp
|
adrianimboden/cppusergroup-adynchronous-programming
|
d6fad3ff980be2e7c13ed9e3e05b62e984c9caa4
|
[
"MIT"
] | null | null | null |
#include "http_client.h"
namespace coroutines_ts {
task<std::vector<std::string>>
request_uris(HttpClient& http_client,
const std::vector<std::string>& uris_to_request) {
(void)http_client;
(void)uris_to_request;
co_return std::vector<std::string>{{"42"}};
}
}
| 23.230769
| 63
| 0.652318
|
adrianimboden
|
7ec468508f106eac6bf99e10ec8bd756222a6851
| 1,165
|
hpp
|
C++
|
src/serial/SerialPlayer.hpp
|
stu-inc/DataCapture
|
d2bd01cd431867ec8372687542150391344022d6
|
[
"MIT"
] | null | null | null |
src/serial/SerialPlayer.hpp
|
stu-inc/DataCapture
|
d2bd01cd431867ec8372687542150391344022d6
|
[
"MIT"
] | null | null | null |
src/serial/SerialPlayer.hpp
|
stu-inc/DataCapture
|
d2bd01cd431867ec8372687542150391344022d6
|
[
"MIT"
] | null | null | null |
#pragma once
#include <QReadWriteLock>
#include <QSharedPointer>
#include <QThread>
#include <QtSerialPort>
class QFile;
class QElapsedTimer;
class SerialPlayer : public QThread {
public:
explicit SerialPlayer(QObject *parent = nullptr);
virtual ~SerialPlayer() override;
void start();
void stop();
void restart();
qint64 getCurrentTime() const;
void setPortName(const QString &portName);
void setFileName(const QString &fileName);
void setBaundRate(QSerialPort::BaudRate baudRate);
void setDataBits(QSerialPort::DataBits dataBits);
void setParity(QSerialPort::Parity parity);
void setStopBits(QSerialPort::StopBits stopBits);
void setByteOrder(QSysInfo::Endian byteOrder);
protected:
virtual void run() override;
private:
mutable QReadWriteLock mLock;
QSharedPointer<QSerialPort> mSerialPort;
QSharedPointer<QFile> mFile;
QSharedPointer<QDataStream> mDataStream;
QSharedPointer<QElapsedTimer> mTimer;
QString mPortName;
QString mFileName;
QSerialPort::BaudRate mBaundRate;
QSerialPort::DataBits mDataBits;
QSerialPort::Parity mParity;
QSerialPort::StopBits mStopBits;
QSysInfo::Endian mByteOrder;
};
| 22.843137
| 52
| 0.771674
|
stu-inc
|
7ec85697288a121d2e81564097e612303ade086f
| 1,049
|
cpp
|
C++
|
Ejercicio4Tema11/Ejercicio4Tema11/Rio.cpp
|
gejors55/Algorithm
|
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
|
[
"MIT"
] | null | null | null |
Ejercicio4Tema11/Ejercicio4Tema11/Rio.cpp
|
gejors55/Algorithm
|
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
|
[
"MIT"
] | null | null | null |
Ejercicio4Tema11/Ejercicio4Tema11/Rio.cpp
|
gejors55/Algorithm
|
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
|
[
"MIT"
] | null | null | null |
#include "Rio.h"
Rio::Rio() {}
float Rio::embalsado_pantano(const string& pantano) const {
return buscar_pantano(pantano).vol();
}
float Rio::embalsado_total() const {
DiccionarioHash<string, Pantano>::ConstIterator ipantano = _pantanos.cbegin();
DiccionarioHash<string, Pantano>::ConstIterator ifin = _pantanos.cend();
int suma =0;
while (ipantano != ifin){
suma += ipantano.valor().vol();
ipantano.next();
}
return suma;
}
const Pantano& Rio::buscar_pantano(const string& pantano) const {
DiccionarioHash<string, Pantano>::ConstIterator ipantano = _pantanos.cbusca(pantano);
DiccionarioHash<string, Pantano>::ConstIterator ifin = _pantanos.cend();
if (ipantano == ifin) throw EPantanoNoExiste();
return ipantano.valor();
}
Pantano Rio::busca( string pantano) {
DiccionarioHash<string, Pantano>::Iterator ipantano = _pantanos.busca(pantano);
DiccionarioHash<string, Pantano>::Iterator ifin = _pantanos.end();
if (ipantano == ifin) throw EPantanoNoExiste();
return ipantano.valor();
}
| 29.971429
| 87
| 0.711153
|
gejors55
|
7ece0d313e1768940414c5fe1f211ce55e1716ec
| 18,342
|
cpp
|
C++
|
ccct.cpp
|
Taromati2/yaya-shiori
|
c49e3d4d03f167a8833f2e68810fb46dc33bac90
|
[
"BSD-3-Clause"
] | null | null | null |
ccct.cpp
|
Taromati2/yaya-shiori
|
c49e3d4d03f167a8833f2e68810fb46dc33bac90
|
[
"BSD-3-Clause"
] | 2
|
2022-01-12T03:25:46.000Z
|
2022-01-12T07:15:38.000Z
|
ccct.cpp
|
Taromati2/yaya-shiori
|
c49e3d4d03f167a8833f2e68810fb46dc33bac90
|
[
"BSD-3-Clause"
] | null | null | null |
//
// AYA version 5
//
// 文字コード変換クラス Ccct
//
// 変換部分のコードは以下のサイトで公開されているものを利用しております。
// class CUnicodeF
// kamoland
// http://kamoland.com/comp/unicode.html
//
#if defined(WIN32) || defined(_WIN32_WCE)
# include "stdafx.h"
#endif
#include <string.h>
#include <clocale>
#include <string>
#include "ccct.h"
#include "manifest.h"
#include "globaldef.h"
//#include "babel/babel.h"
#ifdef POSIX
# include <ctype.h>
#endif
/*
#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff)
*/
//////////DEBUG/////////////////////////
#ifdef _WINDOWS
#ifdef _DEBUG
#include <crtdbg.h>
#define new new( _NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#endif
////////////////////////////////////////
#ifdef POSIX
namespace {
int wcsicmp(const wchar_t* a, const wchar_t* b) {
size_t lenA = wcslen(a);
size_t lenB = wcslen(b);
if (lenA != lenB) {
return lenA - lenB;
}
else {
for (size_t i = 0; i < lenA; i++) {
wchar_t A = tolower(a[i]);
wchar_t B = tolower(b[i]);
if (A != B) {
return A - B;
}
}
return 0;
}
}
int stricmp(const char* a, const char* b) {
size_t lenA = strlen(a);
size_t lenB = strlen(b);
if (lenA != lenB) {
return lenA - lenB;
}
else {
for (size_t i = 0; i < lenA; i++) {
wchar_t A = tolower(a[i]);
wchar_t B = tolower(b[i]);
if (A != B) {
return A - B;
}
}
return 0;
}
}
}
#endif
/* -----------------------------------------------------------------------
* 関数名 : Ccct::CheckCharset
* 機能概要: Charset IDのチェック
* -----------------------------------------------------------------------
*/
bool Ccct::CheckInvalidCharset(int charset)
{
if (charset != CHARSET_SJIS &&
charset != CHARSET_UTF8 &&
charset != CHARSET_EUCJP &&
charset != CHARSET_BIG5 &&
charset != CHARSET_GB2312 &&
charset != CHARSET_EUCKR &&
charset != CHARSET_JIS &&
charset != CHARSET_BINARY &&
charset != CHARSET_DEFAULT) {
return true;
}
return false;
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::CharsetTextToID
* 機能概要: Charset 文字列->Charset ID
* -----------------------------------------------------------------------
*/
int Ccct::CharsetTextToID(const wchar_t *ctxt)
{
if (!wcsicmp(L"UTF-8",ctxt) || !wcsicmp(L"UTF8",ctxt))
return CHARSET_UTF8;
else if (!wcsicmp(L"default",ctxt) || !wcsicmp(L"OSNative",ctxt))
return CHARSET_DEFAULT;
else if (!wcsicmp(L"Shift_JIS",ctxt) || !wcsicmp(L"ShiftJIS",ctxt) || !wcsicmp(L"SJIS",ctxt))
return CHARSET_SJIS;
else if (!wcsicmp(L"EUC_JP",ctxt) || !wcsicmp(L"EUC-JP",ctxt) || !wcsicmp(L"EUCJP",ctxt))
return CHARSET_EUCJP;
else if (!wcsicmp(L"ISO-2022-JP",ctxt) || !wcsicmp(L"JIS",ctxt))
return CHARSET_JIS;
else if (!wcsicmp(L"BIG5",ctxt) || !wcsicmp(L"BIG-5",ctxt))
return CHARSET_BIG5;
else if (!wcsicmp(L"GB2312",ctxt) || !wcsicmp(L"GB-2312",ctxt))
return CHARSET_GB2312;
else if (!wcsicmp(L"EUC_KR",ctxt) || !wcsicmp(L"EUC-KR",ctxt) || !wcsicmp(L"EUCKR",ctxt))
return CHARSET_EUCKR;
else if (!wcsicmp(L"binary",ctxt))
return CHARSET_BINARY;
return CHARSET_DEFAULT;
}
int Ccct::CharsetTextToID(const char *ctxt)
{
if (!stricmp("UTF-8",ctxt) || !stricmp("UTF8",ctxt))
return CHARSET_UTF8;
else if (!stricmp("default",ctxt) || !stricmp("OSNative",ctxt))
return CHARSET_DEFAULT;
else if (!stricmp("Shift_JIS",ctxt) || !stricmp("ShiftJIS",ctxt) || !stricmp("SJIS",ctxt))
return CHARSET_SJIS;
else if (!stricmp("EUC_JP",ctxt) || !stricmp("EUC-JP",ctxt) || !stricmp("EUCJP",ctxt))
return CHARSET_EUCJP;
else if (!stricmp("ISO-2022-JP",ctxt) || !stricmp("JIS",ctxt))
return CHARSET_JIS;
else if (!stricmp("BIG5",ctxt) || !stricmp("BIG-5",ctxt))
return CHARSET_BIG5;
else if (!stricmp("GB2312",ctxt) || !stricmp("GB-2312",ctxt))
return CHARSET_GB2312;
else if (!stricmp("EUC_KR",ctxt) || !stricmp("EUC-KR",ctxt) || !stricmp("EUCKR",ctxt))
return CHARSET_EUCKR;
else if (!stricmp("binary",ctxt))
return CHARSET_BINARY;
return CHARSET_DEFAULT;
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::CharsetIDToText(A/W)
* 機能概要: Charset 文字列->Charset ID
* -----------------------------------------------------------------------
*/
const wchar_t *Ccct::CharsetIDToTextW(const int charset)
{
if ( charset == CHARSET_UTF8 ) {
return L"UTF-8";
}
if ( charset == CHARSET_SJIS ) {
return L"Shift_JIS";
}
if ( charset == CHARSET_EUCJP ) {
return L"EUC_JP";
}
if ( charset == CHARSET_JIS ) {
return L"ISO-2022-JP";
}
if ( charset == CHARSET_BIG5 ) {
return L"BIG5";
}
if ( charset == CHARSET_GB2312 ) {
return L"GB2312";
}
if ( charset == CHARSET_EUCKR ) {
return L"EUC_KR";
}
if ( charset == CHARSET_BINARY ) {
return L"binary";
}
return L"default";
}
const char *Ccct::CharsetIDToTextA(const int charset)
{
if ( charset == CHARSET_UTF8 ) {
return "UTF-8";
}
if ( charset == CHARSET_SJIS ) {
return "Shift_JIS";
}
if ( charset == CHARSET_EUCJP ) {
return "EUC_JP";
}
if ( charset == CHARSET_JIS ) {
return "ISO-2022-JP";
}
if ( charset == CHARSET_BIG5 ) {
return "BIG5";
}
if ( charset == CHARSET_GB2312 ) {
return "GB2312";
}
if ( charset == CHARSET_EUCKR ) {
return "EUC_KR";
}
if ( charset == CHARSET_BINARY ) {
return "binary";
}
return "default";
}
/* -----------------------------------------------------------------------
* UTF-8変換用先行宣言
* -----------------------------------------------------------------------
*/
size_t Ccct_ConvUTF8ToUnicode(aya::string_t &buf,const char* pStrIn);
size_t Ccct_ConvUnicodeToUTF8(std::string &buf,const aya::char_t *pStrw);
/* -----------------------------------------------------------------------
* 関数名 : Ccct::Ucs2ToMbcs
* 機能概要: UTF-16BE -> MBCS へ文字列のコード変換
* -----------------------------------------------------------------------
*/
static char* string_to_malloc(const std::string &str)
{
char* pch = (char*)malloc(str.length()+1);
memcpy(pch,str.c_str(),str.length()+1);
return pch;
}
char *Ccct::Ucs2ToMbcs(const aya::char_t *wstr, int charset)
{
return Ucs2ToMbcs(aya::string_t(wstr), charset);
}
//----
char *Ccct::Ucs2ToMbcs(const aya::string_t &wstr, int charset)
{
/*if ( charset == CHARSET_UTF8 ) {
return string_to_malloc(babel::unicode_to_utf8(wstr));
}
else if ( charset == CHARSET_SJIS ) {
return string_to_malloc(babel::unicode_to_sjis(wstr));
}
else if ( charset == CHARSET_EUCJP ) {
return string_to_malloc(babel::unicode_to_euc(wstr));
}
else if ( charset == CHARSET_JIS ) {
return string_to_malloc(babel::unicode_to_jis(wstr));
}*/
if ( charset == CHARSET_UTF8 ) {
std::string buf;
Ccct_ConvUnicodeToUTF8(buf,wstr.c_str());
return string_to_malloc(buf);
}
else {
return utf16be_to_mbcs(wstr.c_str(),charset);
}
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::MbcsToUcs2
* 機能概要: MBCS -> UTF-16BE へ文字列のコード変換
* -----------------------------------------------------------------------
*/
static aya::char_t* wstring_to_malloc(const aya::string_t &str)
{
size_t sz = (str.length()+1) * sizeof(aya::char_t);
aya::char_t* pch = (aya::char_t*)malloc(sz);
memcpy(pch,str.c_str(),sz);
return pch;
}
aya::char_t *Ccct::MbcsToUcs2(const char *mstr, int charset)
{
return MbcsToUcs2(std::string(mstr), charset);
}
//----
aya::char_t *Ccct::MbcsToUcs2(const std::string &mstr, int charset)
{
/*if ( charset == CHARSET_UTF8 ) {
return wstring_to_malloc(babel::utf8_to_unicode(mstr));
}
else if ( charset == CHARSET_SJIS ) {
return wstring_to_malloc(babel::sjis_to_unicode(mstr));
}
else if ( charset == CHARSET_EUCJP ) {
return wstring_to_malloc(babel::euc_to_unicode(mstr));
}
else if ( charset == CHARSET_JIS ) {
return wstring_to_malloc(babel::jis_to_unicode(mstr));
}*/
if ( charset == CHARSET_UTF8 ) {
aya::string_t buf;
Ccct_ConvUTF8ToUnicode(buf,mstr.c_str());
return wstring_to_malloc(buf);
}
else {
return mbcs_to_utf16be(mstr.c_str(),charset);
}
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::sys_setlocale
* 機能概要: OSデフォルトの言語IDでロケール設定する
* -----------------------------------------------------------------------
*/
char *Ccct::sys_setlocale(int category)
{
return setlocale(category,"");
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::ccct_getcodepage
* 機能概要: 言語ID->Windows CP
* -----------------------------------------------------------------------
*/
unsigned int Ccct::ccct_getcodepage(int charset)
{
if (charset == CHARSET_SJIS) {
return 932;
}
else if (charset == CHARSET_EUCJP) {
return 20932;
}
else if (charset == CHARSET_BIG5) {
return 950;
}
else if (charset == CHARSET_GB2312) {
return 936;
}
else if (charset == CHARSET_EUCKR) {
return 949;
}
else if (charset == CHARSET_JIS) {
return 50222;
}
else {
#if defined(WIN32) || defined(_WIN32_WCE)
return ::AreFileApisANSI() ? ::GetACP() : ::GetOEMCP();
#else
return 0;
#endif
}
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::ccct_setlocale
* 機能概要: 言語IDでロケール設定する
* -----------------------------------------------------------------------
*/
char *Ccct::ccct_setlocale(int category, int charset)
{
#ifdef POSIX
if (charset == CHARSET_SJIS) {
return setlocale(category, "ja_JP.SJIS");
}
else if (charset == CHARSET_EUCJP) {
return setlocale(category, "ja_JP.eucJP");
}
else if (charset == CHARSET_BIG5) {
return setlocale(category, "zh_TW.Big5");
}
else if (charset == CHARSET_GB2312) {
return setlocale(category, "zh_CN.GB2312");
}
else if (charset == CHARSET_EUCKR) {
return setlocale(category, "ko_KR.eucKR");
}
else if (charset == CHARSET_JIS) {
return setlocale(category, "ja_JP.SJIS");
}
#else
if (charset == CHARSET_SJIS) {
return setlocale(category, ".932");
}
else if (charset == CHARSET_EUCJP) {
return setlocale(category, ".20932");
}
else if (charset == CHARSET_BIG5) {
return setlocale(category, ".950");
}
else if (charset == CHARSET_GB2312) {
return setlocale(category, ".936");
}
else if (charset == CHARSET_EUCKR) {
return setlocale(category, ".949");
}
else if (charset == CHARSET_JIS) {
return setlocale(category, ".50222");
}
#endif
else {
return sys_setlocale(category);
}
}
/* -----------------------------------------------------------------------
* setlocaleバリア
* -----------------------------------------------------------------------
*/
class CcctSetLocaleSwitcher {
private:
const char *m_oldLocale;
int m_category;
public:
CcctSetLocaleSwitcher(int category,int charset) {
m_category = category;
m_oldLocale = setlocale(category,NULL);
Ccct::ccct_setlocale(category,charset);
}
~CcctSetLocaleSwitcher() {
if ( m_oldLocale ) {
setlocale(m_category,m_oldLocale);
}
}
};
/* -----------------------------------------------------------------------
* 関数名 : Ccct::utf16be_to_mbcs
* 機能概要: UTF-16BE -> MBCS へ文字列のコード変換
* -----------------------------------------------------------------------
*/
char *Ccct::utf16be_to_mbcs(const aya::char_t *pUcsStr, int charset)
{
char *pAnsiStr = NULL;
if (!pUcsStr) {
return NULL;
}
if (!*pUcsStr) {
char *p = (char*)malloc(1);
p[0] = 0;
return p;
}
#if defined(WIN32) || defined(_WIN32_WCE)
int cp = ccct_getcodepage(charset);
int alen = ::WideCharToMultiByte(cp,0,pUcsStr,-1,NULL,0,NULL,NULL);
if ( alen <= 0 ) { return NULL; }
pAnsiStr = (char*)malloc(alen+1+5); //add +5 for safety
alen = ::WideCharToMultiByte(cp,0,pUcsStr,-1,pAnsiStr,alen+1,NULL,NULL);
if ( alen <= 0 ) { return NULL; }
pAnsiStr[alen] = 0;
#else
CcctSetLocaleSwitcher loc(LC_CTYPE, charset);
size_t nLen = wcslen( pUcsStr);
if (charset != CHARSET_BINARY) {
if (pUcsStr[0] == static_cast<aya::char_t>(0xfeff) ||
pUcsStr[0] == static_cast<aya::char_t>(0xfffe)) {
pUcsStr++; // 先頭にBOM(byte Order Mark)があれば,スキップする
nLen--;
}
}
//文字長×マルチバイト最大長+ゼロ終端
pAnsiStr = (char *)malloc((nLen*MB_CUR_MAX)+1);
if (!pAnsiStr) {
return NULL;
}
// 1文字ずつ変換する。
// まとめて変換すると、変換不能文字への対応が困難なので
size_t i, nMbpos = 0;
int nRet;
for (i = 0; i < nLen; i++) {
if (charset != CHARSET_BINARY) {
nRet = wctomb(pAnsiStr+nMbpos, pUcsStr[i]);
}
else {
pAnsiStr[nMbpos] = (char)(0x00ff & pUcsStr[i]);
nRet = 1;
}
if ( nRet <= 0 ) { // can not conversion
pAnsiStr[nMbpos++] = ' ';
}
else {
nMbpos += nRet;
}
}
pAnsiStr[nMbpos] = 0;
#endif
return pAnsiStr;
}
/* -----------------------------------------------------------------------
* 関数名 : Ccct::mbcs_to_utf16be
* 機能概要: MBCS -> UTF-16 へ文字列のコード変換
* -----------------------------------------------------------------------
*/
aya::char_t *Ccct::mbcs_to_utf16be(const char *pAnsiStr, int charset)
{
if (!pAnsiStr) {
return NULL;
}
if (!*pAnsiStr) {
aya::char_t* p = (aya::char_t*)malloc(2);
p[0] = 0;
return p;
}
#if defined(WIN32) || defined(_WIN32_WCE)
size_t nLen = strlen(pAnsiStr);
int cp = ccct_getcodepage(charset);
int wlen = ::MultiByteToWideChar(cp,0,pAnsiStr,nLen,NULL,0);
if ( wlen <= 0 ) { return NULL; }
aya::char_t* pUcsStr = (aya::char_t*)malloc((wlen + 1 + 5) * sizeof(aya::char_t)); //add +5 for safety
wlen = ::MultiByteToWideChar(cp,0,pAnsiStr,nLen,pUcsStr,wlen+1);
if ( wlen <= 0 ) { return NULL; }
pUcsStr[wlen] = 0;
#else
CcctSetLocaleSwitcher loc(LC_CTYPE, charset);
size_t nLen = strlen(pAnsiStr);
aya::char_t *pUcsStr = (aya::char_t *)malloc(sizeof(aya::char_t)*(nLen+7));
if (!pUcsStr) {
return NULL;
}
// 1文字ずつ変換する。
// まとめて変換すると、変換不能文字への対応が困難なので
size_t i, nMbpos = 0;
int nRet;
for (i = 0; i < nLen; ) {
if (charset != CHARSET_BINARY) {
nRet = mbtowc(pUcsStr+nMbpos, pAnsiStr+i, nLen-i);
}
else {
pUcsStr[i]=static_cast<aya::char_t>(pAnsiStr[i]);
nRet = 1;
}
if ( nRet <= 0 ) { // can not conversion
pUcsStr[nMbpos++] = L' ';
i += 1;
}
else {
++nMbpos;
i += nRet;
}
}
pUcsStr[nMbpos] = 0;
#endif
return pUcsStr;
}
/*--------------------------------------------
UTF-9をUTF-16に
--------------------------------------------*/
size_t Ccct_ConvUTF8ToUnicode(aya::string_t &buf,const char* pStrIn)
{
unsigned char *pStr = (unsigned char*)pStrIn;
unsigned char *pStrLast = pStr + strlen(pStrIn);
unsigned char c;
unsigned long tmp;
while( pStr < pStrLast ){
c = *(pStr++);
if( (c & 0x80) == 0 ){ //1Byte - 0???????
buf.append(1,(WORD)c);
}
/*else if( (c & 0xc0) == 0x80 ){ //1Byte - 10?????? -> 必ず2バイト目以降のため、単体で出たら不正
m_Str.Add() = (WORD)c;
}*/
else if( (c & 0xe0) == 0xc0 ){ //2Byte - 110?????
tmp = static_cast<DWORD>(c & 0x1f) << 6; //下5bit - 10-6
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f); //下6bit - 5-0
buf.append(1,static_cast<WORD>(tmp));
}
else if( (c & 0xf0) == 0xe0 ){ //3Byte - 1110????
tmp = static_cast<DWORD>(c & 0x0f) << 12; //下4bit - 15-12
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f) << 6; //下6bit - 11-6
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f); //下6bit - 5-0
if ( tmp != 0xfeff && tmp != 0xfffe ) { //BOMでない
buf.append(1,static_cast<WORD>(tmp));
}
}
else if( (c & 0xf8) == 0xf0 ){ //4Byte - 11110??? UTF-16 Surrogate
tmp = static_cast<DWORD>(c & 0x07) << 18; //下3bit -> 20-18
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f) << 12; //下6bit - 17-12
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f) << 6; //下6bit - 11-6
tmp |= static_cast<DWORD>(*(pStr++) & 0x3f); //下6bit - 5-0
tmp -= 0x10000;
buf.append(1,(WORD)(0xD800U | ((tmp >> 10) & 0x3FF))); //上位サロゲート
buf.append(1,(WORD)(0xDC00U | (tmp & 0x3FF))); //下位サロゲート
}
else if( (c & 0xfc) == 0xf8 ){ //5Byte - 111110?? -- UCS-4
pStr += 4; //無視
}
else if( (c & 0xfe) == 0xfc ){ //6Byte - 1111110? -- UCS-4
pStr += 5; //無視
}
/*else { // - 11111110 , 11111111 (0xfe,0xff) - そんな文字あるかい!
m_Str.Add() = (WORD)c;
}*/
}
return buf.length();
}
/*--------------------------------------------
UTF-16をUTF-8に
--------------------------------------------*/
size_t Ccct_ConvUnicodeToUTF8(std::string &buf,const aya::char_t *pStrw)
{
aya::char_t w;
unsigned long surrogateTemp;
size_t length = wcslen(pStrw);
size_t i = 0;
buf.reserve(length*4+1); //4倍まで (UTF-8 5-6byte領域はUCS-2からの変換では存在しない)
while(i < length){
w = pStrw[i++];
if (w < 0x80) { //1byte
buf.append(1,(char)(BYTE)w); //5-0
}
else if ( w < 0x0800 ) { //2byte
buf.append(1,(char)(BYTE)((w >> 6) & 0x001f) | 0xc0); //10-6
buf.append(1,(char)(BYTE)(w & 0x3f) | 0x80); //5-0
}
else {
if ( (w & 0xF800) == 0xD800 ) { //4byte サロゲートページ D800->DFFF
surrogateTemp = ( ( (w & 0x3FF) << 10 ) | (pStrw[i++] & 0x3FF) ) + 0x10000;
buf.append(1,(char)(BYTE)((surrogateTemp >> 18) & 0x07) | 0xf0); //20-18
buf.append(1,(char)(BYTE)((surrogateTemp >> 12) & 0x3f) | 0x80); //17-12
buf.append(1,(char)(BYTE)((surrogateTemp >> 6 ) & 0x3f) | 0x80); //11-6
buf.append(1,(char)(BYTE)(surrogateTemp & 0x3f) | 0x80); //5-0
}
else { //3byte
buf.append(1,(char)(BYTE)((w >> 12) & 0x0f) | 0xe0); //15-12
buf.append(1,(char)(BYTE)((w >> 6) & 0x3f) | 0x80); //11-6
buf.append(1,(char)(BYTE)(w & 0x3f) | 0x80); //5-0
}
}
}
return buf.length();
}
| 26.737609
| 104
| 0.522953
|
Taromati2
|
7ed02d68dd213deeafc9942003012d4865f18e14
| 10,429
|
hh
|
C++
|
extern/glow/src/glow/objects/Program.hh
|
huzjkevin/portal_maze_zgl
|
efb32b1c3430f20638c1401095999ecb4d0af5aa
|
[
"MIT"
] | null | null | null |
extern/glow/src/glow/objects/Program.hh
|
huzjkevin/portal_maze_zgl
|
efb32b1c3430f20638c1401095999ecb4d0af5aa
|
[
"MIT"
] | null | null | null |
extern/glow/src/glow/objects/Program.hh
|
huzjkevin/portal_maze_zgl
|
efb32b1c3430f20638c1401095999ecb4d0af5aa
|
[
"MIT"
] | null | null | null |
#pragma once
#include <glow/common/gltypeinfo.hh>
#include <glow/common/macro_join.hh>
#include <glow/common/nodiscard.hh>
#include <glow/common/non_copyable.hh>
#include <glow/common/property.hh>
#include <glow/common/shared.hh>
#include <glow/gl.hh>
#include <glow/util/LocationMapping.hh>
#include "NamedObject.hh"
#include "raii/UsedProgram.hh"
#include <map>
#include <string>
#include <vector>
// only vec/mat types
#include <glm/matrix.hpp>
namespace glow
{
GLOW_SHARED(class, Sampler);
GLOW_SHARED(class, Shader);
GLOW_SHARED(class, Program);
GLOW_SHARED(class, LocationMapping);
GLOW_SHARED(class, UniformState);
GLOW_SHARED(class, Texture);
GLOW_SHARED(class, Texture2D);
GLOW_SHARED(class, UniformBuffer);
GLOW_SHARED(class, ShaderStorageBuffer);
GLOW_SHARED(class, AtomicCounterBuffer);
GLOW_SHARED(class, Buffer);
class Program final : public NamedObject<Program, GL_PROGRAM>
{
public:
struct UniformInfo
{
std::string name;
GLint location = -1;
GLint size = -1;
GLenum type = GL_INVALID_ENUM;
bool wasSet = false;
};
private:
/// If true, shader check for shader reloading periodically
static bool sCheckShaderReloading;
/// OpenGL object name
GLuint mObjectName;
/// List of attached shader
std::vector<SharedShader> mShader;
/// Last time of reload checking
int64_t mLastReloadCheck = 0;
/// Last time this shader was linked
int64_t mLastTimeLinked = 0;
/// Uniform lookup cache
/// Invalidates after link
mutable std::vector<UniformInfo> mUniformCache;
/// Texture unit mapping
LocationMapping mTextureUnitMapping;
/// Bounds texture (idx = unit)
std::vector<SharedTexture> mTextures;
/// Bounds texture sampler (idx = unit)
std::vector<SharedSampler> mSamplers;
/// Locations for in-VS-attributes
/// At any point, the mapping saved here must be consistent (i.e. a superset) of the GPU mapping
SharedLocationMapping mAttributeMapping;
/// Locations for out-FS-attributes
/// At any point, the mapping saved here must be consistent (i.e. a superset) of the GPU mapping
SharedLocationMapping mFragmentMapping;
/// Friend for negotiating mAttributeMapping
friend class VertexArray;
friend struct BoundVertexArray;
/// Friend for negotiating mFragmentMapping
friend class Framebuffer;
friend struct BoundFramebuffer;
/// Mapping for uniform buffers
LocationMapping mUniformBufferMapping;
/// Bound uniform buffer
std::map<std::string, SharedUniformBuffer> mUniformBuffers;
/// Mapping for shaderStorage buffers
LocationMapping mShaderStorageBufferMapping;
/// Bound shaderStorage buffer
std::map<std::string, SharedShaderStorageBuffer> mShaderStorageBuffers;
/// Bound AtomicCounter buffer
std::map<int, SharedAtomicCounterBuffer> mAtomicCounterBuffers;
/// List of varyings for transform feedback
std::vector<std::string> mTransformFeedbackVaryings;
/// Buffer mode for transform feedback
GLenum mTransformFeedbackMode;
/// if true, this program is linked properly for transform feedback
bool mIsLinkedForTransformFeedback = false;
/// true if already checked for layout(loc)
bool mCheckedForAttributeLocationLayout = false;
/// true if already checked for layout(loc)
bool mCheckedForFragmentLocationLayout = false;
/// disables unchanged uniform warning
bool mWarnOnUnchangedUniforms = true;
/// true if already checked for unchanged uniforms
bool mCheckedUnchangedUniforms = false;
private:
/// Internal linking
/// returns false on errors
bool linkAndCheckErrors();
/// Restores additional "program state", like textures and shader buffers
void restoreExtendedState();
/// Reset frag location check
/// Necessary because frags cannot be queried ...
void resetFragmentLocationCheck() { mCheckedForFragmentLocationLayout = false; }
/// see public: version
UniformInfo* getUniformInfo(std::string const& name);
/// returns uniform location and sets "wasSet" to true
/// Also verifies that the uniform types match
GLint useUniformLocationAndVerify(std::string const& name, GLint size, GLenum type);
public: // properties
GLuint getObjectName() const { return mObjectName; }
std::vector<SharedShader> const& getShader() const { return mShader; }
SharedLocationMapping const& getAttributeMapping() const { return mAttributeMapping; }
SharedLocationMapping const& getFragmentMapping() const { return mFragmentMapping; }
LocationMapping const& getTextureUnitMapping() const { return mTextureUnitMapping; }
GLOW_GETTER(LastTimeLinked);
GLOW_PROPERTY(WarnOnUnchangedUniforms);
/// returns true iff a shader with this type is attached
bool hasShaderType(GLenum type) const;
/// Gets the currently used program (nullptr if none)
static UsedProgram* getCurrentProgram();
/// Modifies shader reloading state
static void setShaderReloading(bool enabled);
public:
/// Checks if all bound textures have valid mipmaps
void validateTextureMipmaps() const;
/// if not already done so:
/// checks if any uniform is used but not set
void checkUnchangedUniforms();
public: // gl functions without use
/// Returns the in-shader location of the given uniform name
/// Is -1 if not found or optimized out (!)
/// Uses an internal cache to speedup the call
GLint getUniformLocation(std::string const& name) const;
/// Returns information about a uniform
/// If location is -1, information is nullptr
/// (Returned pointer is invalidated if shader is relinked)
UniformInfo const* getUniformInfo(std::string const& name) const;
/// Returns the index of a uniform block
GLuint getUniformBlockIndex(std::string const& name) const;
/// ========================================= UNIFORMS - START =========================================
/// Getter for uniforms
/// If you get linker errors, the type is not supported
/// Returns default-constructed values for optimized uniforms
/// Usage:
/// auto pos = prog->getUniform<glm::vec3>("uPosition");
///
/// LIMITATIONS:
/// currently doesn't work for arrays/structs
///
/// Supported types:
/// * bool
/// * float
/// * int
/// * unsigned int
/// * [ uib]vec[234]
/// * mat[234]
/// * mat[234]x[234]
template <typename DataT>
DataT getUniform(std::string const& name) const
{
DataT value;
auto loc = getUniformLocation(name);
if (loc >= 0)
implGetUniform(glTypeOf<DataT>::basetype, loc, (void*)&value);
else
value = DataT{};
return value;
}
/// ========================================== UNIFORMS - END ==========================================
private:
/// Internal generic getter for uniforms
void implGetUniform(detail::glBaseType type, GLint loc, void* data) const;
public:
Program();
~Program();
/// Returns true iff program is linked properly
bool isLinked() const;
/// Returns a list of all attribute locations
/// Depending on driver, this only returns "used" attributes
std::vector<std::pair<std::string, int>> extractAttributeLocations();
/// Attaches the given shader to this program
/// Requires re-linking!
void attachShader(SharedShader const& shader);
/// Links all attached shader into the program.
/// Has to be done each time shader and/or IO locations are changed
/// CAUTION: linking deletes all currently set uniform values!
void link(bool saveUniformState = true);
/// Configures this shader for use with transform feedback
/// NOTE: cannot be done while shader is in use
void configureTransformFeedback(std::vector<std::string> const& varyings, GLenum bufferMode = GL_INTERLEAVED_ATTRIBS);
/// Returns true if transform feedback can be used
bool isConfiguredForTransformFeedback() const { return mTransformFeedbackVaryings.size() > 0; }
/// Extracts all active uniforms and saves them into a UniformState object
/// This function should not be used very frequently
SharedUniformState getUniforms() const;
/// Binds a uniform buffer to a given block name
/// DOES NOT REQUIRE PROGRAM USE
void setUniformBuffer(std::string const& bufferName, SharedUniformBuffer const& buffer);
/// Binds a shader storage buffer to a given block name
/// DOES NOT REQUIRE PROGRAM USE
void setShaderStorageBuffer(std::string const& bufferName, SharedShaderStorageBuffer const& buffer);
/// Binds an atomic counter buffer to a binding point
/// DOES NOT REQUIRE PROGRAM USE
void setAtomicCounterBuffer(int bindingPoint, SharedAtomicCounterBuffer const& buffer);
/// Verifies registered offsets in the uniform buffer and emits errors if they don't match
/// Return false if verification failed
bool verifyUniformBuffer(std::string const& bufferName, SharedUniformBuffer const& buffer);
/// Activates this shader program.
/// Deactivation is done when the returned object runs out of scope.
GLOW_NODISCARD UsedProgram use() { return {this}; }
friend UsedProgram;
public: // static construction
/// Creates a shader program from a list of shaders
/// Attaches shader and links the program
/// Program can be used directly after this
static SharedProgram create(std::vector<SharedShader> const& shader);
static SharedProgram create(SharedShader const& shader) { return create(std::vector<SharedShader>({shader})); }
/// Creates a program from either a single file or auto-discovered shader files
/// E.g. createFromFile("mesh");
/// will use mesh.vsh as vertex shader and mesh.fsh as fragment shader if available
/// See common/shader_endings.cc for a list of available endings
/// Will also traverse "dots" if file not found to check for base versions
/// E.g. createFromFile("mesh.opaque");
/// might find mesh.opaque.fsh and mesh.vsh
static SharedProgram createFromFile(std::string const& fileOrBaseName);
/// Creates a program from a list of explicitly named files
/// Shader type is determined by common/shader_endings.cc
static SharedProgram createFromFiles(std::vector<std::string> const& filenames);
};
}
| 36.592982
| 122
| 0.698149
|
huzjkevin
|
7ed08d18a4a54352dac118c13d60f2c6715f9bb7
| 1,092
|
cc
|
C++
|
leetcode/p6.cc
|
lhyqie/lhyqie.github.io
|
d986ac4afddf169a07d4f1de95bcc737368e212b
|
[
"MIT"
] | null | null | null |
leetcode/p6.cc
|
lhyqie/lhyqie.github.io
|
d986ac4afddf169a07d4f1de95bcc737368e212b
|
[
"MIT"
] | null | null | null |
leetcode/p6.cc
|
lhyqie/lhyqie.github.io
|
d986ac4afddf169a07d4f1de95bcc737368e212b
|
[
"MIT"
] | null | null | null |
#include "common.h"
class Solution {
public:
string longestPalindrome(string s) {
int start = 0, max_len = 1;
for(int i = 0; i < s.size(); i++){
int len1 = expandAroundCenter(s, i, i);
int len2 = expandAroundCenter(s, i, i+1);
int len = std::max(len1, len2);
if(std::max(len1, len2) > max_len){
// when len is odd e.g. ...abcba... len = 5 center is i => start = i - (len-1)/2 = i - 2
// when len is even e.g. ...abba... len = 4 center is i => start = i - (len-1)/2 = i - 1
start = i - (len-1)/2;
max_len = len;
}
// std::cout << "i=" << i << " len1=" << len1 << " len2=" << len2 << " start=" << start << "\n" ;
}
return s.substr(start, max_len);
}
private:
int expandAroundCenter(const string& s, int left, int right){
while(left >= 0 && right< s.size() && s[left] == s[right]){
left --; right ++;
}
return right - left - 1; // right - left + 1 - 2
}
};
int main()
{
std::cout << Solution().longestPalindrome("babbc");
return 0;
}
| 30.333333
| 112
| 0.494505
|
lhyqie
|
7ed11ddecfb406867da6e2c1f16708dab04c588b
| 1,739
|
hpp
|
C++
|
include/pcl_ros_wrapper/registration/warp_point_2d.hpp
|
larics/pcl_ros_wrapper
|
cbb4fb2c74a463cee8d5c42dcd8cbabb407b617f
|
[
"BSD-3-Clause"
] | null | null | null |
include/pcl_ros_wrapper/registration/warp_point_2d.hpp
|
larics/pcl_ros_wrapper
|
cbb4fb2c74a463cee8d5c42dcd8cbabb407b617f
|
[
"BSD-3-Clause"
] | null | null | null |
include/pcl_ros_wrapper/registration/warp_point_2d.hpp
|
larics/pcl_ros_wrapper
|
cbb4fb2c74a463cee8d5c42dcd8cbabb407b617f
|
[
"BSD-3-Clause"
] | 1
|
2021-03-31T12:42:13.000Z
|
2021-03-31T12:42:13.000Z
|
#ifndef WARP_POINT_2D
#define WARP_POINT_2D
#pragma once
#include <pcl/registration/warp_point_rigid.h>
#include <boost/shared_ptr.hpp>
namespace pcl {
namespace registration {
/** \brief @b WarpPoint2D enables 3D (1D rotation around yaw + 2D translation)
* transformations for points.
*
* \note The class is templated on the source and target point types as well as on the
* output scalar of the transformation matrix (i.e., float or double). Default: float.
* \author Radu B. Rusu
* \ingroup registration
*/
template<typename PointSourceT, typename PointTargetT, typename Scalar = float>
class WarpPoint2D : public WarpPointRigid<PointSourceT, PointTargetT, Scalar>
{
public:
using Matrix4 = typename WarpPointRigid<PointSourceT, PointTargetT, Scalar>::Matrix4;
using VectorX = typename WarpPointRigid<PointSourceT, PointTargetT, Scalar>::VectorX;
using Ptr = boost::shared_ptr<WarpPoint2D<PointSourceT, PointTargetT, Scalar>>;
using ConstPtr =
boost::shared_ptr<const WarpPoint2D<PointSourceT, PointTargetT, Scalar>>;
/** \brief Constructor. */
WarpPoint2D() : WarpPointRigid<PointSourceT, PointTargetT, Scalar>(2) {}
/** \brief Empty destructor */
~WarpPoint2D() {}
/** \brief Set warp parameters.
* \param[in] p warp parameters (tx ty rz)
*/
void setParam(const VectorX &p) override
{
assert(p.rows() == this->getDimension());
Matrix4 &trans = this->transform_matrix_;
trans = Matrix4::Identity();
// Copy the rotation and translation components
trans.block(0, 3, 4, 1) = Eigen::Matrix<Scalar, 4, 1>(p[0], p[1], 0, 1.0);
}
};
}// namespace registration
}// namespace pcl
#endif /* WARP_POINT_2D */
| 32.811321
| 89
| 0.693502
|
larics
|
7ed9e9e405f5aad41a90800b91beedbb009328e9
| 769
|
hpp
|
C++
|
include/Version.hpp
|
marcosivni/dicomlib
|
dd268d07368ff4f1ffd1f94cdaa1e2dbf30bc5c7
|
[
"BSD-3-Clause"
] | null | null | null |
include/Version.hpp
|
marcosivni/dicomlib
|
dd268d07368ff4f1ffd1f94cdaa1e2dbf30bc5c7
|
[
"BSD-3-Clause"
] | null | null | null |
include/Version.hpp
|
marcosivni/dicomlib
|
dd268d07368ff4f1ffd1f94cdaa1e2dbf30bc5c7
|
[
"BSD-3-Clause"
] | null | null | null |
/************************************************************************
* DICOMLIB
* Copyright 2003 Sunnybrook and Women's College Health Science Center
* Implemented by Trevor Morgan (morgan@sten.sunnybrook.utoronto.ca)
*
* See LICENSE.txt for copyright and licensing info.
*************************************************************************/
#ifndef VERSION_HPP_INCLUDE_GUARD_U62KI43SNTDB4
#define VERSION_HPP_INCLUDE_GUARD_U62KI43SNTDB4
namespace dicom
{
//!library meta-information, such as version.
namespace library
{
extern const char* name;
extern const char* version;
extern const int major_version;
extern const int minor_version;
extern const int revision;
}//namespace library
}
#endif //VERSION_HPP_INCLUDE_GUARD_U62KI43SNTDB4
| 26.517241
| 74
| 0.642393
|
marcosivni
|
7edaec75b0cf2648a7cee0b07f42f61f99fa1368
| 389
|
cpp
|
C++
|
cppcode/201710_12/reference.cpp
|
jiedou/study
|
606676ebc3d1fb1a87de26b6609307d71dafec22
|
[
"Apache-2.0"
] | null | null | null |
cppcode/201710_12/reference.cpp
|
jiedou/study
|
606676ebc3d1fb1a87de26b6609307d71dafec22
|
[
"Apache-2.0"
] | null | null | null |
cppcode/201710_12/reference.cpp
|
jiedou/study
|
606676ebc3d1fb1a87de26b6609307d71dafec22
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
using namespace std;
int main()
{
int a=1;
int &b=a;
int c=b;
b=2;
cout<<"a="<<a<<",b="<<b<<",c="<<c<<endl;
int d[]={1,2,3,4,5};
int(&e)[5]=d;
for(int i=0;i<sizeof(d)/sizeof(d[0]);i++)
{
e[i]=e[i]*10+e[i];
}
for(int i=0;i<sizeof(d)/sizeof(d[0]);i++)
{
cout<<d[i]<<endl;
}
return 0;
}
| 16.913043
| 45
| 0.411311
|
jiedou
|
7edb7feacdeb2c8a27981b7a9ea1858e62205737
| 2,881
|
cpp
|
C++
|
algorithms/src/LocalizationAndMapping/registration_localization/fast_gicp/thirdparty/nvbio/nvbio-test/fastq_test.cpp
|
mfkiwl/GAAS
|
29ab17d3e8a4ba18edef3a57c36d8db6329fac73
|
[
"BSD-3-Clause"
] | 2,111
|
2019-01-29T07:01:32.000Z
|
2022-03-29T06:48:14.000Z
|
algorithms/src/LocalizationAndMapping/registration_localization/fast_gicp/thirdparty/nvbio/nvbio-test/fastq_test.cpp
|
mfkiwl/GAAS
|
29ab17d3e8a4ba18edef3a57c36d8db6329fac73
|
[
"BSD-3-Clause"
] | 131
|
2019-02-18T10:56:18.000Z
|
2021-09-27T12:07:00.000Z
|
algorithms/src/LocalizationAndMapping/registration_localization/fast_gicp/thirdparty/nvbio/nvbio-test/fastq_test.cpp
|
mfkiwl/GAAS
|
29ab17d3e8a4ba18edef3a57c36d8db6329fac73
|
[
"BSD-3-Clause"
] | 421
|
2019-02-12T07:59:18.000Z
|
2022-03-27T05:22:01.000Z
|
/*
* nvbio
* Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the 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 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 NVIDIA CORPORATION BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <nvbio/fastq/fastq.h>
using namespace nvbio;
namespace {
struct Writer
{
Writer() : n(0) {}
void push_back(const uint32 read_len, const char* name, const uint8* bp, const uint8* q)
{
#if 0
if ((n & 0x00FF) == 0)
{
char read[16*1024];
for (uint32 i = 0; i < read_len; ++i)
read[i] = bp[i];
read[read_len] = '\0';
fprintf( stderr, " len: %u, read: %s\n", read_len, read );
}
#endif
n++;
}
uint32 n;
};
} // anonymous namespace
int fastq_test(const char* filename)
{
fprintf(stderr, "FASTQ test... started\n");
FASTQ_file fastq_file( filename );
if (fastq_file.valid() == false)
{
fprintf(stderr, "*** error *** : file \"%s\" not found\n", filename);
return 1;
}
FASTQ_reader<FASTQ_file> fastq( fastq_file );
Writer writer;
int n;
while ((n = fastq.read( 100u, writer )))
{
if (n < 0)
{
fprintf(stderr, "*** parsing error ***\n");
char error[1024];
fastq.error_string( error );
fprintf(stderr, " %s\n", error);
return 1;
}
}
fprintf(stderr, "FASTQ test... done: %u reads\n", writer.n);
return 0;
}
| 31.659341
| 92
| 0.645262
|
mfkiwl
|
7edf5e50fc97e2e4a115438d0fe06804eb043f50
| 1,648
|
hpp
|
C++
|
graph_tree/reroot.hpp
|
hotman78/cpplib
|
c2f85c8741cdd0b731a5aa828b28b38c70c8d699
|
[
"CC0-1.0"
] | null | null | null |
graph_tree/reroot.hpp
|
hotman78/cpplib
|
c2f85c8741cdd0b731a5aa828b28b38c70c8d699
|
[
"CC0-1.0"
] | null | null | null |
graph_tree/reroot.hpp
|
hotman78/cpplib
|
c2f85c8741cdd0b731a5aa828b28b38c70c8d699
|
[
"CC0-1.0"
] | null | null | null |
#pragma once
#include<vector>
/**
* @brief 全方位木DP
*/
template<typename T,typename F,typename Fix>
struct reroot{
std::vector<std::vector<long long>>g;
std::vector<int>p_list;
std::vector<T>p_table;
std::vector<bool>p_checked;
std::vector<map<int,T>>table;
std::vector<T>ans;
T e;
F f;
Fix fix;
reroot(const std::vector<std::vector<long long>>& g,T e,F f=F(),Fix fix=Fix()):g(g),e(e),f(f),fix(fix){
int n=g.size();
p_list.resize(n,-1);
p_checked.resize(n,0);
table.resize(n);
p_table.resize(n,e);
ans.resize(n,e);
dfs1(0,-1);
for(int i=0;i<n;++i)ans[i]=dfs2(i,-1);
}
T dfs1(int n,int p){
p_list[n]=p;
T tmp1=e,tmp2=e;
std::vector<T>tmp(g[n].size());
rep(i,g[n].size()){
int t=g[n][i];
if(t==p)continue;
table[n][t]=tmp1;
tmp1=f(tmp1,tmp[i]=dfs1(t,n));
}
for(int i=g[n].size()-1;i>=0;--i){
int t=g[n][i];
if(t==p)continue;
table[n][t]=f(table[n][t],tmp2);
tmp2=f(tmp[i],tmp2);
}
return fix(table[n][p]=tmp1,n,p);
}
T dfs2(int n,int p){
if(n==-1){
return e;
}
if(!p_checked[n]){
p_checked[n]=1;
p_table[n]=dfs2(p_list[n],n);
}
if(p==-1){
return f(table[n][p_list[n]],p_table[n]);
}else{
if(p_list[n]==-1)return fix(table[n][p],n,p);
else return fix(f(table[n][p],p_table[n]),n,p);
}
}
vector<T>query(){
return ans;
}
};
| 25.353846
| 107
| 0.462985
|
hotman78
|
7ee4b87260e8806d0a41f06e5a6ee005bf9bf864
| 1,963
|
cpp
|
C++
|
apps/opencs/view/doc/operations.cpp
|
Bodillium/openmw
|
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
|
[
"Unlicense"
] | null | null | null |
apps/opencs/view/doc/operations.cpp
|
Bodillium/openmw
|
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
|
[
"Unlicense"
] | null | null | null |
apps/opencs/view/doc/operations.cpp
|
Bodillium/openmw
|
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
|
[
"Unlicense"
] | null | null | null |
#include "operations.hpp"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "operation.hpp"
CSVDoc::Operations::Operations()
{
/// \todo make widget height fixed (exactly the height required to display all operations)
setFeatures (QDockWidget::NoDockWidgetFeatures);
QWidget *widgetContainer = new QWidget (this);
mLayout = new QVBoxLayout;
widgetContainer->setLayout (mLayout);
setWidget (widgetContainer);
setVisible (false);
setFixedHeight (widgetContainer->height());
setTitleBarWidget (new QWidget (this));
}
void CSVDoc::Operations::setProgress (int current, int max, int type, int threads)
{
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
if ((*iter)->getType()==type)
{
(*iter)->setProgress (current, max, threads);
return;
}
int oldCount = mOperations.size();
int newCount = oldCount + 1;
Operation *operation = new Operation (type, this);
connect (operation, SIGNAL (abortOperation (int)), this, SIGNAL (abortOperation (int)));
mLayout->addLayout (operation->getLayout());
mOperations.push_back (operation);
operation->setProgress (current, max, threads);
if ( oldCount > 0)
setFixedHeight (height()/oldCount * newCount);
setVisible (true);
}
void CSVDoc::Operations::quitOperation (int type)
{
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
if ((*iter)->getType()==type)
{
int oldCount = mOperations.size();
int newCount = oldCount - 1;
mLayout->removeItem ((*iter)->getLayout());
(*iter)->deleteLater();
mOperations.erase (iter);
if (oldCount > 1)
setFixedHeight (height() / oldCount * newCount);
else
setVisible (false);
break;
}
}
| 28.042857
| 104
| 0.620479
|
Bodillium
|
7ee4c63995bffaf76d26ee7753c7496bf6dd7647
| 10,720
|
cpp
|
C++
|
evs/src/v2/model/ListSnapshotsRequest.cpp
|
yangzhaofeng/huaweicloud-sdk-cpp-v3
|
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
|
[
"Apache-2.0"
] | 5
|
2021-03-03T08:23:43.000Z
|
2022-02-16T02:16:39.000Z
|
evs/src/v2/model/ListSnapshotsRequest.cpp
|
yangzhaofeng/huaweicloud-sdk-cpp-v3
|
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
|
[
"Apache-2.0"
] | null | null | null |
evs/src/v2/model/ListSnapshotsRequest.cpp
|
yangzhaofeng/huaweicloud-sdk-cpp-v3
|
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
|
[
"Apache-2.0"
] | 7
|
2021-02-26T13:53:35.000Z
|
2022-03-18T02:36:43.000Z
|
#include "huaweicloud/evs/v2/model/ListSnapshotsRequest.h"
namespace HuaweiCloud {
namespace Sdk {
namespace Evs {
namespace V2 {
namespace Model {
ListSnapshotsRequest::ListSnapshotsRequest()
{
offset_ = 0;
offsetIsSet_ = false;
limit_ = 0;
limitIsSet_ = false;
name_ = "";
nameIsSet_ = false;
status_ = "";
statusIsSet_ = false;
volumeId_ = "";
volumeIdIsSet_ = false;
availabilityZone_ = "";
availabilityZoneIsSet_ = false;
id_ = "";
idIsSet_ = false;
dedicatedStorageName_ = "";
dedicatedStorageNameIsSet_ = false;
dedicatedStorageId_ = "";
dedicatedStorageIdIsSet_ = false;
serviceType_ = "";
serviceTypeIsSet_ = false;
enterpriseProjectId_ = "";
enterpriseProjectIdIsSet_ = false;
}
ListSnapshotsRequest::~ListSnapshotsRequest() = default;
void ListSnapshotsRequest::validate()
{
}
web::json::value ListSnapshotsRequest::toJson() const
{
web::json::value val = web::json::value::object();
if(offsetIsSet_) {
val[utility::conversions::to_string_t("offset")] = ModelBase::toJson(offset_);
}
if(limitIsSet_) {
val[utility::conversions::to_string_t("limit")] = ModelBase::toJson(limit_);
}
if(nameIsSet_) {
val[utility::conversions::to_string_t("name")] = ModelBase::toJson(name_);
}
if(statusIsSet_) {
val[utility::conversions::to_string_t("status")] = ModelBase::toJson(status_);
}
if(volumeIdIsSet_) {
val[utility::conversions::to_string_t("volume_id")] = ModelBase::toJson(volumeId_);
}
if(availabilityZoneIsSet_) {
val[utility::conversions::to_string_t("availability_zone")] = ModelBase::toJson(availabilityZone_);
}
if(idIsSet_) {
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(id_);
}
if(dedicatedStorageNameIsSet_) {
val[utility::conversions::to_string_t("dedicated_storage_name")] = ModelBase::toJson(dedicatedStorageName_);
}
if(dedicatedStorageIdIsSet_) {
val[utility::conversions::to_string_t("dedicated_storage_id")] = ModelBase::toJson(dedicatedStorageId_);
}
if(serviceTypeIsSet_) {
val[utility::conversions::to_string_t("service_type")] = ModelBase::toJson(serviceType_);
}
if(enterpriseProjectIdIsSet_) {
val[utility::conversions::to_string_t("enterprise_project_id")] = ModelBase::toJson(enterpriseProjectId_);
}
return val;
}
bool ListSnapshotsRequest::fromJson(const web::json::value& val)
{
bool ok = true;
if(val.has_field(utility::conversions::to_string_t("offset"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("offset"));
if(!fieldValue.is_null())
{
int32_t refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setOffset(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("limit"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("limit"));
if(!fieldValue.is_null())
{
int32_t refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setLimit(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("name"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setName(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("status"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setStatus(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("volume_id"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("volume_id"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setVolumeId(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("availability_zone"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("availability_zone"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setAvailabilityZone(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("id"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setId(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("dedicated_storage_name"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("dedicated_storage_name"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setDedicatedStorageName(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("dedicated_storage_id"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("dedicated_storage_id"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setDedicatedStorageId(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("service_type"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("service_type"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setServiceType(refVal);
}
}
if(val.has_field(utility::conversions::to_string_t("enterprise_project_id"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("enterprise_project_id"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setEnterpriseProjectId(refVal);
}
}
return ok;
}
int32_t ListSnapshotsRequest::getOffset() const
{
return offset_;
}
void ListSnapshotsRequest::setOffset(int32_t value)
{
offset_ = value;
offsetIsSet_ = true;
}
bool ListSnapshotsRequest::offsetIsSet() const
{
return offsetIsSet_;
}
void ListSnapshotsRequest::unsetoffset()
{
offsetIsSet_ = false;
}
int32_t ListSnapshotsRequest::getLimit() const
{
return limit_;
}
void ListSnapshotsRequest::setLimit(int32_t value)
{
limit_ = value;
limitIsSet_ = true;
}
bool ListSnapshotsRequest::limitIsSet() const
{
return limitIsSet_;
}
void ListSnapshotsRequest::unsetlimit()
{
limitIsSet_ = false;
}
std::string ListSnapshotsRequest::getName() const
{
return name_;
}
void ListSnapshotsRequest::setName(const std::string& value)
{
name_ = value;
nameIsSet_ = true;
}
bool ListSnapshotsRequest::nameIsSet() const
{
return nameIsSet_;
}
void ListSnapshotsRequest::unsetname()
{
nameIsSet_ = false;
}
std::string ListSnapshotsRequest::getStatus() const
{
return status_;
}
void ListSnapshotsRequest::setStatus(const std::string& value)
{
status_ = value;
statusIsSet_ = true;
}
bool ListSnapshotsRequest::statusIsSet() const
{
return statusIsSet_;
}
void ListSnapshotsRequest::unsetstatus()
{
statusIsSet_ = false;
}
std::string ListSnapshotsRequest::getVolumeId() const
{
return volumeId_;
}
void ListSnapshotsRequest::setVolumeId(const std::string& value)
{
volumeId_ = value;
volumeIdIsSet_ = true;
}
bool ListSnapshotsRequest::volumeIdIsSet() const
{
return volumeIdIsSet_;
}
void ListSnapshotsRequest::unsetvolumeId()
{
volumeIdIsSet_ = false;
}
std::string ListSnapshotsRequest::getAvailabilityZone() const
{
return availabilityZone_;
}
void ListSnapshotsRequest::setAvailabilityZone(const std::string& value)
{
availabilityZone_ = value;
availabilityZoneIsSet_ = true;
}
bool ListSnapshotsRequest::availabilityZoneIsSet() const
{
return availabilityZoneIsSet_;
}
void ListSnapshotsRequest::unsetavailabilityZone()
{
availabilityZoneIsSet_ = false;
}
std::string ListSnapshotsRequest::getId() const
{
return id_;
}
void ListSnapshotsRequest::setId(const std::string& value)
{
id_ = value;
idIsSet_ = true;
}
bool ListSnapshotsRequest::idIsSet() const
{
return idIsSet_;
}
void ListSnapshotsRequest::unsetid()
{
idIsSet_ = false;
}
std::string ListSnapshotsRequest::getDedicatedStorageName() const
{
return dedicatedStorageName_;
}
void ListSnapshotsRequest::setDedicatedStorageName(const std::string& value)
{
dedicatedStorageName_ = value;
dedicatedStorageNameIsSet_ = true;
}
bool ListSnapshotsRequest::dedicatedStorageNameIsSet() const
{
return dedicatedStorageNameIsSet_;
}
void ListSnapshotsRequest::unsetdedicatedStorageName()
{
dedicatedStorageNameIsSet_ = false;
}
std::string ListSnapshotsRequest::getDedicatedStorageId() const
{
return dedicatedStorageId_;
}
void ListSnapshotsRequest::setDedicatedStorageId(const std::string& value)
{
dedicatedStorageId_ = value;
dedicatedStorageIdIsSet_ = true;
}
bool ListSnapshotsRequest::dedicatedStorageIdIsSet() const
{
return dedicatedStorageIdIsSet_;
}
void ListSnapshotsRequest::unsetdedicatedStorageId()
{
dedicatedStorageIdIsSet_ = false;
}
std::string ListSnapshotsRequest::getServiceType() const
{
return serviceType_;
}
void ListSnapshotsRequest::setServiceType(const std::string& value)
{
serviceType_ = value;
serviceTypeIsSet_ = true;
}
bool ListSnapshotsRequest::serviceTypeIsSet() const
{
return serviceTypeIsSet_;
}
void ListSnapshotsRequest::unsetserviceType()
{
serviceTypeIsSet_ = false;
}
std::string ListSnapshotsRequest::getEnterpriseProjectId() const
{
return enterpriseProjectId_;
}
void ListSnapshotsRequest::setEnterpriseProjectId(const std::string& value)
{
enterpriseProjectId_ = value;
enterpriseProjectIdIsSet_ = true;
}
bool ListSnapshotsRequest::enterpriseProjectIdIsSet() const
{
return enterpriseProjectIdIsSet_;
}
void ListSnapshotsRequest::unsetenterpriseProjectId()
{
enterpriseProjectIdIsSet_ = false;
}
}
}
}
}
}
| 24.814815
| 116
| 0.673134
|
yangzhaofeng
|
7ee5dd311a7c3ec42cf4eae373c6b0f129fb3ffa
| 2,332
|
cpp
|
C++
|
School Olympiads/Kazakhstan IOI Team Selection Camp 2018/Day 4/c.cpp
|
SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming
|
ab1ca0d0d2187b561750d547e155e768951d29a0
|
[
"MIT"
] | null | null | null |
School Olympiads/Kazakhstan IOI Team Selection Camp 2018/Day 4/c.cpp
|
SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming
|
ab1ca0d0d2187b561750d547e155e768951d29a0
|
[
"MIT"
] | null | null | null |
School Olympiads/Kazakhstan IOI Team Selection Camp 2018/Day 4/c.cpp
|
SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming
|
ab1ca0d0d2187b561750d547e155e768951d29a0
|
[
"MIT"
] | null | null | null |
# include <bits/stdc++.h>
# define F first
# define S second
# define mp make_pair
// everything go according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1 Y_U_NO_y1
# define left Y_U_NO_left
# define right Y_U_NO_right
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
ios_base :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
unsigned int seed;
asm ("rdtsc" : "=A"(seed));
srand (seed);
}
void files (string problem) {
if (fopen ((problem + ".in").c_str(),"r")) {
freopen ((problem + ".in").c_str(),"r",stdin);
freopen ((problem + ".out").c_str(),"w",stdout);
}
}
void localInput(const char in[] = "s") {
if (fopen (in, "r"))
freopen (in, "r", stdin);
else
cerr << "Warning: Input file not found" << endl;
}
ll n, k, a, b;
ll x, y;
ll binpow (ll a, ll b) {
int res = 1;
while (b) {
if (b & 1)
res = (res * a) % Mod;
b >>= 1;
a = (a * a) % Mod;
}
return res;
}
ll dp[Sz];
ll calc (int n) {
if (n < k)
return binpow (a + b, n);
if (~dp[n])
return dp[n];
dp[n] = 0;
for (int j = 0; j < k; j++)
dp[n] = (dp[n] + (calc (n - j - 1) * b) % Mod * binpow (a, j)) % Mod;
return dp[n];
}
int main()
{
# ifdef Local
//localInput();
# endif
Read_rap();
cin >> n >> k >> a >> b;
/*
memset (dp, -1, sizeof dp);
x = binpow (a + b, k-1);
y = (binpow (a, k-1) * b) % Mod;
ll res1 = binpow (a + b, n) - calc(n);
*/
for (int i = 0; i < k; i++)
dp[i] = binpow (a + b, i);
ll sum = 0;
for (int i = 0; i < k; i++)
sum = (sum + (dp[k - 1 - i] * b) % Mod * binpow (a, i)) % Mod;
dp[k] = sum;
for (int i = k + 1; i <= n; i++) {
sum = (sum * a + b * dp[i - 1]) % Mod;
sum = (sum - ((dp[i - k - 1] * b) % Mod * binpow (a, k))) % Mod;
if (sum < 0)
sum += Mod;
dp[i] = sum;
}
ll res = binpow (a + b, n) - dp[n];
if (res < 0)
res += Mod;
cout << res;
return 0;
}
// Coded by Z..
| 19.433333
| 73
| 0.496998
|
SuperPuperMegaUltraEpicGoldenHacker
|
7ee62dc712cbf004e7453a3de916c97755ceec2b
| 2,417
|
cpp
|
C++
|
src/zone/call-task.cpp
|
localh0rzd/napajs
|
b3f5e67dd20caef5d96ea8c3e3d4c542fcb9a431
|
[
"MIT"
] | 9,088
|
2017-08-08T22:28:16.000Z
|
2019-05-05T14:57:12.000Z
|
src/zone/call-task.cpp
|
localh0rzd/napajs
|
b3f5e67dd20caef5d96ea8c3e3d4c542fcb9a431
|
[
"MIT"
] | 172
|
2017-08-09T21:32:15.000Z
|
2019-05-03T21:21:05.000Z
|
src/zone/call-task.cpp
|
localh0rzd/napajs
|
b3f5e67dd20caef5d96ea8c3e3d4c542fcb9a431
|
[
"MIT"
] | 370
|
2017-08-09T04:58:14.000Z
|
2019-04-13T18:59:29.000Z
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// See: https://groups.google.com/forum/#!topic/nodejs/onA0S01INtw
#ifdef BUILDING_NODE_EXTENSION
#include <node.h>
#endif
#include "call-task.h"
#include <module/core-modules/napa/call-context-wrap.h>
#include <napa/log.h>
using namespace napa::zone;
using namespace napa::v8_helpers;
napa::zone::CallTask::CallTask(std::shared_ptr<CallContext> context) :
_context(std::move(context)) {
}
void CallTask::Execute() {
NAPA_DEBUG("CallTask", "Begin executing function (%s.%s).", _context->GetModule().c_str(), _context->GetFunction().c_str());
auto isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
auto context = isolate->GetCurrentContext();
// Get the module based main function from global scope.
auto executeFunction = context->Global()->Get(MakeExternalV8String(isolate, "__napa_zone_call__"));
JS_ENSURE(isolate, executeFunction->IsFunction(), "__napa_zone_call__ function must exist in global scope");
// Create task wrap.
auto contextWrap = napa::module::CallContextWrap::NewInstance(_context);
v8::Local<v8::Value> argv[] = { contextWrap };
// Execute the function.
v8::TryCatch tryCatch(isolate);
auto res = v8::Local<v8::Function>::Cast(executeFunction)->Call(
isolate->GetCurrentContext(),
context->Global(),
1,
argv);
// Terminating an isolate may occur from a different thread, i.e. from timeout service.
// If the function call already finished successfully when the isolate is terminated it may lead
// to one the following:
// 1. Terminate was called before tryCatch.HasTerminated(), the user gets an error code.
// 2. Terminate was called after tryCatch.HasTerminated(), the user gets a success code.
//
// In both cases the isolate is being restored since this happens before each task executes.
if (tryCatch.HasTerminated()) {
if (_terminationReason == TerminationReason::TIMEOUT) {
(void)_context->Reject(NAPA_RESULT_TIMEOUT, "Terminated due to timeout");
} else {
(void)_context->Reject(NAPA_RESULT_INTERNAL_ERROR, "Terminated with unknown reason");
}
return;
}
NAPA_ASSERT(!tryCatch.HasCaught(), "__napa_zone_call__ should catch all user exceptions and reject task.");
}
| 38.365079
| 128
| 0.695904
|
localh0rzd
|
7ee9248ee9f8bd45268bfd3793b758401e95d653
| 1,892
|
cpp
|
C++
|
SimuVar/Is_Number.cpp
|
TheArquitect/SimuVar
|
b6f4965af938706f6de1497494362c4b5c87d01e
|
[
"BSD-2-Clause"
] | null | null | null |
SimuVar/Is_Number.cpp
|
TheArquitect/SimuVar
|
b6f4965af938706f6de1497494362c4b5c87d01e
|
[
"BSD-2-Clause"
] | null | null | null |
SimuVar/Is_Number.cpp
|
TheArquitect/SimuVar
|
b6f4965af938706f6de1497494362c4b5c87d01e
|
[
"BSD-2-Clause"
] | null | null | null |
/**
File : Is_Number.cpp
Author : Menashe Rosemberg
Created : 2019.02.19 Version: 20190219.1
Check if a string is a number
Copyright (c) 2019 TheArquitect (Menashe Rosemberg) rosemberg@ymail.com
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
#include "Is_Number.h"
bool is_number(const std::string& TxT) {
bool OnePoint = true;
for (auto Letter = TxT.cbegin() + (TxT[0] == '-'? 1 : 0); Letter != TxT.cend(); ++Letter)
if (*Letter =='.' && OnePoint)
OnePoint = false;
else if (!isdigit(*Letter))
return false;
return true;
}
| 44
| 94
| 0.708774
|
TheArquitect
|
7eeb2627333c504966e2194063705b0f39a8d900
| 847
|
cpp
|
C++
|
RealTournament/source/Pickup.cpp
|
willcassella/RealTournament
|
70ed3c0d5cbb67938ec8f86eec7b4d98a26e25f3
|
[
"MIT"
] | null | null | null |
RealTournament/source/Pickup.cpp
|
willcassella/RealTournament
|
70ed3c0d5cbb67938ec8f86eec7b4d98a26e25f3
|
[
"MIT"
] | null | null | null |
RealTournament/source/Pickup.cpp
|
willcassella/RealTournament
|
70ed3c0d5cbb67938ec8f86eec7b4d98a26e25f3
|
[
"MIT"
] | null | null | null |
// Pickup.cpp
#include <Engine/World.h>
#include "../include/RealTournament/Pickup.h"
//////////////////////
/// Reflection ///
BUILD_REFLECTION(real_tournament::Pickup);
namespace real_tournament
{
///////////////////
/// Methods ///
void Pickup::on_collision(Entity& entity, const CollisionData& /*data*/)
{
auto* player = Cast<Player>(entity);
if (player && !spawn_pad.is_null())
{
auto* spawnPad = this->get_world().get_object(spawn_pad);
spawnPad->spawn_timer = spawnPad->spawn_timer_start;
spawn_pad = nullptr;
this->on_pickup(*player);
}
}
void Pickup::on_initialize()
{
this->Base::on_initialize();
this->get_world().bind_event("update", *this, &Pickup::on_update);
}
void Pickup::on_update(float dt)
{
if (!spawn_pad.is_null())
{
this->rotate(Vec3::Up, degrees(dt * 25));
}
}
}
| 19.697674
| 73
| 0.62928
|
willcassella
|
7eed663feab7bd786df2df95d386ddc4d2c7e025
| 820
|
cpp
|
C++
|
src/primitive.cpp
|
WilliamLewww/cuda_pbrt
|
d1136793025b7aa8cc2daf6da6ec19314684580b
|
[
"MIT"
] | null | null | null |
src/primitive.cpp
|
WilliamLewww/cuda_pbrt
|
d1136793025b7aa8cc2daf6da6ec19314684580b
|
[
"MIT"
] | null | null | null |
src/primitive.cpp
|
WilliamLewww/cuda_pbrt
|
d1136793025b7aa8cc2daf6da6ec19314684580b
|
[
"MIT"
] | null | null | null |
#include "primitive.h"
Bounds3 Primitive::worldBounds() {}
bool Primitive::checkRayIntersectionPredicate(Ray* ray) {}
bool Primitive::checkRayIntersection(Ray* ray, SurfaceInteraction* surfaceInteraction) {}
GeometricPrimitive::GeometricPrimitive(Shape* shape) {
this->shape = shape;
}
GeometricPrimitive::~GeometricPrimitive() {
}
Bounds3 GeometricPrimitive::worldBounds() {
return shape->worldBounds();
}
bool GeometricPrimitive::checkRayIntersectionPredicate(Ray* ray) {
return shape->checkRayIntersectionPredicate(ray);
}
bool GeometricPrimitive::checkRayIntersection(Ray* ray, SurfaceInteraction* surfaceInteraction) {
float tHit;
if (!shape->checkRayIntersection(ray, &tHit, surfaceInteraction)) {
return false;
}
ray->tMax = tHit;
surfaceInteraction->primitive = this;
return true;
}
| 25.625
| 97
| 0.767073
|
WilliamLewww
|
7ef3b326accd80455c869d530b44fecb228876a2
| 1,124
|
hpp
|
C++
|
src/Message.hpp
|
relaxtakenotes/xenos
|
24d19b683e85df54f56cd9a5b2c6416b86e1325d
|
[
"MIT"
] | 4
|
2021-12-14T13:32:10.000Z
|
2022-03-08T23:14:58.000Z
|
src/Message.hpp
|
relaxtakenotes/xenos
|
24d19b683e85df54f56cd9a5b2c6416b86e1325d
|
[
"MIT"
] | 1
|
2021-10-20T14:09:51.000Z
|
2021-10-20T14:09:51.000Z
|
src/Message.hpp
|
relaxtakenotes/xenos
|
24d19b683e85df54f56cd9a5b2c6416b86e1325d
|
[
"MIT"
] | null | null | null |
#pragma once
#include "stdafx.h"
#include "Log.h"
class Message
{
enum MsgType
{
Error,
Warning,
Info,
Question,
};
public:
static void ShowError( HWND parent, const std::wstring& msg, const std::wstring& title = L"Error" )
{
Show( msg, title, Error, parent );
}
static void ShowWarning( HWND parent, const std::wstring& msg, const std::wstring& title = L"Warning" )
{
Show( msg, title, Warning, parent );
}
static void ShowInfo( HWND parent, const std::wstring& msg, const std::wstring& title = L"Info" )
{
Show( msg, title, Info, parent );
}
static bool ShowQuestion( HWND parent, const std::wstring& msg, const std::wstring& title = L"Question" )
{
return Show( msg, title, Question, parent ) == IDYES;
}
private:
static int Show(
const std::wstring& msg,
const std::wstring& title,
MsgType type,
HWND parent = NULL
)
{
UINT uType = MB_ICONERROR;
return MessageBoxW( parent, msg.c_str(), title.c_str(), uType );
}
};
| 22.938776
| 109
| 0.573843
|
relaxtakenotes
|
7ef52b1b9f1a18d736be163263fe1a1ea515f441
| 17,553
|
cpp
|
C++
|
src/state/TimeTrial.cpp
|
agral/SimpleGames
|
75779520dbd35b4434b4ee0634ca421624e6876c
|
[
"MIT"
] | null | null | null |
src/state/TimeTrial.cpp
|
agral/SimpleGames
|
75779520dbd35b4434b4ee0634ca421624e6876c
|
[
"MIT"
] | null | null | null |
src/state/TimeTrial.cpp
|
agral/SimpleGames
|
75779520dbd35b4434b4ee0634ca421624e6876c
|
[
"MIT"
] | null | null | null |
#include "TimeTrial.hpp"
#include "../global/globals.hpp"
#include <SDL2/SDL.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
namespace state
{
const int ORB_SIZE = global::ORB_SIZE;
const int DRAG_THRESHOLD = 0.3 * ORB_SIZE;
const double swapAnimationTime = 400; //milliseconds
const double explodeAnimationTime = 1000; // milliseconds
const int BORDER_SIZE = 44;
inline int Signum(int value)
{
return (value > 0) - (value < 0);
}
void BtnExitIngameOnClick()
{
SetNextStateId(STATE_MAINMENU);
}
TimeTrial::TimeTrial()
{
orbClips[0] = {0, 0, ORB_SIZE, ORB_SIZE};
orbClips[1] = {ORB_SIZE, 0, ORB_SIZE, ORB_SIZE};
orbClips[2] = {2 * ORB_SIZE, 0, ORB_SIZE, ORB_SIZE};
orbClips[3] = {3 * ORB_SIZE, 0, ORB_SIZE, ORB_SIZE};
orbClips[4] = {4 * ORB_SIZE, 0, ORB_SIZE, ORB_SIZE};
// boardClip #5 is used for board filling; #1-#4 and #6-#9 are used as borders same as numpad keys
// (e.g. #1 is used for bottom-left border piece, #6 is used for central-right border piece). #0 is unused.
boardClips[1] = {0, 108, 44, 44};
boardClips[2] = {44, 108, 64, 44};
boardClips[3] = {108, 108, 44, 44};
boardClips[4] = {0, 44, 44, 64};
boardClips[5] = {44, 44, 64, 64};
boardClips[6] = {108, 44, 44, 64};
boardClips[7] = {0, 0, 44, 44};
boardClips[8] = {44, 0, 64, 44};
boardClips[9] = {108, 0, 44, 44};
boardGeometry = {
(global::SCREEN_WIDTH - (global::GAMEBOARD_WIDTH * ORB_SIZE) - BORDER_SIZE), BORDER_SIZE,
global::GAMEBOARD_WIDTH * ORB_SIZE,
global::GAMEBOARD_HEIGHT * ORB_SIZE
};
board.SetSize(global::GAMEBOARD_WIDTH, global::GAMEBOARD_HEIGHT);
board.FillRandomlyWithoutChains();
for (auto y = 0; y < board.Height(); ++y)
{
for (auto x = 0; x < board.Width(); ++x)
{
board.At(x, y).posY = ORB_SIZE * (y - board.Height());
board.At(x, y).isFalling = true;
}
}
isDragging = false;
selectedGemXIndex = -1;
selectedGemYIndex = -1;
remainingIdleTime = global::ROUND_TIME_IN_MILLISECONDS;
playerScore = 0;
multiplier = 1;
pbTime = std::make_unique<gse::ProgressBar>(resMgr.spProgressBar, 520, 10, gse::ProgressBarColors::BLUE);
pbTime->SetPosition(boardGeometry.x + (boardGeometry.w - 520) / 2, 10);
btnExit = std::make_unique<gse::Button>(resMgr.spBtnIngameExit.Width(), resMgr.spBtnIngameExit.Height() / 3,
resMgr.spBtnIngameExit);
btnExit->SetPosition((200 - resMgr.spBtnIngameExit.Width()) / 2, global::SCREEN_HEIGHT - 90);
btnExit->SetOnClick(&BtnExitIngameOnClick);
resMgr.txIngameScore.RenderFromTtf(resMgr.fIngameScore, "00000", global::CL_INGAME_SCORE, nullptr);
phase = GamePhase::FALLING;
nextPhase = GamePhase::NONE;
}
void TimeTrial::ProcessInput()
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
{
SetNextStateId(STATE_EXIT);
}
if ((event.type == SDL_MOUSEBUTTONDOWN) || (event.type == SDL_MOUSEBUTTONUP) || (event.type == SDL_MOUSEMOTION))
{
int mouseX, mouseY;
SDL_GetMouseState(&mouseX, &mouseY);
// Regardless of the position of the cursor, the dragging ends when the user releases the mouse:
if (event.type == SDL_MOUSEBUTTONUP)
{
isDragging = false;
}
// If the mouse is over the board, and the game accepts user input (is in "IDLE" state):
if ((phase == GamePhase::IDLE) &&
(mouseX >= boardGeometry.x) && (mouseX < boardGeometry.x + boardGeometry.w) &&
(mouseY >= boardGeometry.y) && (mouseY < boardGeometry.y + boardGeometry.h))
{
if (event.type == SDL_MOUSEBUTTONUP)
{
if (std::max(std::abs(filteredDragDistanceX), std::abs(filteredDragDistanceY)) < DRAG_THRESHOLD)
{
int pointedGemXIndex = (mouseX - boardGeometry.x) / ORB_SIZE;
int pointedGemYIndex = (mouseY - boardGeometry.y) / ORB_SIZE;
if (selectedGemXIndex >= 0)
{
if ((pointedGemXIndex == selectedGemXIndex) && (pointedGemYIndex == selectedGemYIndex))
{
// Unselects the selected Gem when it's clicked again:
selectedGemXIndex = -1;
selectedGemYIndex = -1;
}
else
{
// Performs the swappping, but only iff selected and this Gem are horizontal or vertical neighbors:
int deltaX = std::abs(selectedGemXIndex - pointedGemXIndex);
int deltaY = std::abs(selectedGemYIndex - pointedGemYIndex);
if (((deltaX == 1) && (deltaY == 0)) || ((deltaX == 0) && (deltaY == 1)))
{
CheckAndSwap(selectedGemXIndex, selectedGemYIndex, pointedGemXIndex, pointedGemYIndex);
}
}
}
else
{
// Selects the clicked Gem when no other Gem is selected:
selectedGemXIndex = (mouseX - boardGeometry.x) / ORB_SIZE;
selectedGemYIndex = (mouseY - boardGeometry.y) / ORB_SIZE;
}
}
else
{
otherGemXIndex = draggedGemXIndex;
otherGemYIndex = draggedGemYIndex;
if (filteredDragDistanceX < -DRAG_THRESHOLD)
{
otherGemXIndex -= 1;
}
else if (filteredDragDistanceX > DRAG_THRESHOLD)
{
otherGemXIndex += 1;
}
else if (filteredDragDistanceY < -DRAG_THRESHOLD)
{
otherGemYIndex -= 1;
}
else if (filteredDragDistanceY > DRAG_THRESHOLD)
{
otherGemYIndex += 1;
}
CheckAndSwap(draggedGemXIndex, draggedGemYIndex, otherGemXIndex, otherGemYIndex);
}
}
else if (event.type == SDL_MOUSEBUTTONDOWN)
{
dragOriginX = mouseX;
dragOriginY = mouseY;
dragDistanceX = 0;
dragDistanceY = 0;
draggedGemXIndex = (mouseX - boardGeometry.x) / ORB_SIZE;
draggedGemYIndex = (mouseY - boardGeometry.y) / ORB_SIZE;
isDragging = true;
}
else if (event.type == SDL_MOUSEMOTION)
{
if (isDragging)
{
dragDistanceX = mouseX - dragOriginX;
dragDistanceY = mouseY - dragOriginY;
}
}
}
btnExit->ProcessInput(event, mouseX, mouseY);
}
}
}
void TimeTrial::Logic(gse::GameTimeData td)
{
// Switches to the next state, if applicable:
if (nextPhase != GamePhase::NONE)
{
phase = nextPhase;
nextPhase = GamePhase::NONE;
phaseBirth = td.timeTotal;
std::cout << "[TimeTrial] Switched to " << GamePhaseNames[phase] << " game phase." << std::endl;
}
if (phase == GamePhase::IDLE)
{
// Decrements the game time:
remainingIdleTime -= td.timeSinceLastFrame;
pbTime->SetNormalizedProgress(remainingIdleTime / global::ROUND_TIME_IN_MILLISECONDS);
if (remainingIdleTime <= 0.0)
{
std::cout << "End of remaining idle time." << std::endl;
nextPhase = GamePhase::OVER;
}
}
if (phase == GamePhase::FALLING)
{
bool isStillFalling = false;
for (auto y = 0; y < board.Height(); ++y)
{
for (auto x = 0; x < board.Width(); ++x)
{
if (board.At(x, y).isFalling)
{
isStillFalling = true;
board.At(x, y).velocityY += global::gravityConstant * td.timeSinceLastFrame;
board.At(x, y).posY += board.At(x, y).velocityY * td.timeSinceLastFrame;
if (board.At(x, y).posY > y * ORB_SIZE)
{
board.At(x, y).isFalling = false;
board.At(x, y).posY = y * ORB_SIZE;
}
}
}
}
if (!isStillFalling)
{
if (board.FindChains())
{
nextPhase = GamePhase::EXPLODING;
}
else
{
multiplier = 1;
pbTime->SetForegroundColor(gse::ProgressBarColors::GREEN);
nextPhase = GamePhase::IDLE;
}
}
}
else if (phase == GamePhase::SWAPPING)
{
double animTime = td.timeTotal - phaseBirth;
// Easing function: sin(t) from 0.5PI (max) to 1.5PI (min), mapped to [ORB_SIZE -> 0] range
double distance = animTime > swapAnimationTime ?
0 : (0.5 * ORB_SIZE * (1 + std::sin(M_PI * (animTime / swapAnimationTime + 0.5))));
double swapDirectionX = (draggedGemXIndex - otherGemXIndex);
double swapDirectionY = (draggedGemYIndex - otherGemYIndex);
if (swapDirectionX != 0)
{
board.At(draggedGemXIndex, draggedGemYIndex).posX = (draggedGemXIndex * ORB_SIZE) - (swapDirectionX * distance);
board.At(otherGemXIndex, otherGemYIndex).posX = (otherGemXIndex * ORB_SIZE) + (swapDirectionX * distance);
}
else if (swapDirectionY != 0)
{
board.At(draggedGemXIndex, draggedGemYIndex).posY = (draggedGemYIndex * ORB_SIZE) - (swapDirectionY * distance);
board.At(otherGemXIndex, otherGemYIndex).posY = (otherGemYIndex * ORB_SIZE) + (swapDirectionY * distance);
}
if (animTime >= swapAnimationTime)
{
// Puts the swapped gems both in their exact places:
board.At(draggedGemXIndex, draggedGemYIndex).posX = draggedGemXIndex * ORB_SIZE;
board.At(draggedGemXIndex, draggedGemYIndex).posY = draggedGemYIndex * ORB_SIZE;
board.At(otherGemXIndex, otherGemYIndex).posX = otherGemXIndex * ORB_SIZE;
board.At(otherGemXIndex, otherGemYIndex).posY = otherGemYIndex * ORB_SIZE;
nextPhase = GamePhase::EXPLODING;
}
}
else if (phase == GamePhase::EXPLODING)
{
double animTime = td.timeTotal - phaseBirth;
if ( animTime > explodeAnimationTime )
{
std::cout << "End of Explode animation" << std::endl;
for (int x = 0; x < board.Width(); ++x)
{
int explodedBelowCounter = 0;
for (int y = board.Height() - 1; y >= 0; --y)
{
if (board.At(x, y).isPartOfChain)
{
explodedBelowCounter += 1;
playerScore += multiplier;
}
else
{
if (explodedBelowCounter > 0)
{
// Sets the Gem at its target position on the GameBoard model (as if it already fell):
board.At(x, y + explodedBelowCounter).color = board.At(x, y).color;
// Sets its rendering Y-position exactly where it were so that its fall will be smooth:
board.At(x, y + explodedBelowCounter).posY = y * ORB_SIZE;
board.At(x, y + explodedBelowCounter).velocityY = 0;
board.At(x, y + explodedBelowCounter).isPartOfChain = false;
board.At(x, y + explodedBelowCounter).isFalling = true;
}
}
}
// Adds "new" random Gems in place of those exploded. They start their fall from just above the board:
for (int z = explodedBelowCounter - 1; z >= 0; --z)
{
board.SetRandomColor(x, z);
board.At(x, z).posY = (z - explodedBelowCounter) * ORB_SIZE;
board.At(x, z).velocityY = 0;
board.At(x, z).isPartOfChain = false;
board.At(x, z).isFalling = true;
}
}
multiplier += 1;
nextPhase = GamePhase::FALLING;
}
else
{
// Easing function: cos^2(t) from 0 (max) to PI (min), mapped to [255 -> 0] range:
double factor = 0.5 * (1 + std::cos(M_PI * (animTime / explodeAnimationTime)));
explodingAlpha = 255 * factor * factor;
}
}
}
void TimeTrial::Render()
{
DrawBoard();
DrawBoardBorder();
pbTime->Render();
btnExit->Render();
resMgr.txIngameScoreCaption.Render(35, 5);
resMgr.txIngameScoreBg.Render(35, 35);
std::stringstream ss;
ss << std::setw(5) << std::setfill('0') << playerScore;
resMgr.txIngameScore.RenderFromTtf(resMgr.fIngameScore, ss.str(), global::CL_INGAME_SCORE, nullptr);
resMgr.txIngameScore.Render(35, 35);
if (phase == GamePhase::OVER)
{
resMgr.txGameOver.Render(boardGeometry.x + (boardGeometry.w - resMgr.txGameOver.Width()) / 2,
boardGeometry.y + (boardGeometry.h - resMgr.txGameOver.Height()) / 2);
}
}
void TimeTrial::DrawBoard()
{
// Draws the board background:
for (int x = 0; x < board.Width(); ++x)
{
for (int y = 0; y < board.Height(); ++y)
{
resMgr.spBoard.Render(boardGeometry.x + x * ORB_SIZE, boardGeometry.y + y * ORB_SIZE, &boardClips[5]);
}
}
// Draws the Gems:
for (int x = 0; x < board.Width(); ++x)
{
for (int y = 0; y < board.Height(); ++y)
{
// Indicates the selected gem by drawing a halo underneath it (exclusively in IDLE phase):
if ((phase == GamePhase::IDLE) && (x == selectedGemXIndex) && (y == selectedGemYIndex))
{
resMgr.txHalo.Render(boardGeometry.x + x * ORB_SIZE, boardGeometry.y + y * ORB_SIZE);
}
// Renders all the static gems normally:
if ((!(isDragging && (x == draggedGemXIndex) && (y == draggedGemYIndex))) &&
(!((phase == GamePhase::EXPLODING) && (board.At(x, y).isPartOfChain))))
{
resMgr.spOrbs.Render(
boardGeometry.x + board.At(x, y).posX,
boardGeometry.y + board.At(x, y).posY,
&orbClips[board.At(x, y).color]
);
}
else if (isDragging && (x == draggedGemXIndex) && (y == draggedGemYIndex))
{
resMgr.spOrbs.SetAlpha(0.25 * 255);
resMgr.spOrbs.Render(
boardGeometry.x + board.At(x, y).posX,
boardGeometry.y + board.At(x, y).posY,
&orbClips[board.At(x, y).color]
);
resMgr.spOrbs.SetAlpha(255);
}
else if ((phase == GamePhase::EXPLODING) && (board.At(x, y).isPartOfChain))
{
resMgr.spOrbs.SetAlpha(explodingAlpha);
resMgr.spOrbs.Render(
boardGeometry.x + board.At(x, y).posX,
boardGeometry.y + board.At(x, y).posY,
&orbClips[board.At(x, y).color]
);
resMgr.spOrbs.SetAlpha(255);
}
}
}
// Renders the currently dragged gem (if any) at nonstandard position:
if (isDragging)
{
filteredDragDistanceX = std::abs(dragDistanceX) > std::abs(dragDistanceY) ? dragDistanceX : 0;
filteredDragDistanceY = std::abs(dragDistanceX) > std::abs(dragDistanceY) ? 0 : dragDistanceY;
if (std::abs(filteredDragDistanceX) > ORB_SIZE)
{
filteredDragDistanceX =
Signum(filteredDragDistanceX) * (ORB_SIZE + std::log(std::abs(filteredDragDistanceX) - ORB_SIZE));
}
else if (std::abs(filteredDragDistanceY) > ORB_SIZE)
{
filteredDragDistanceY =
Signum(filteredDragDistanceY) * (ORB_SIZE + std::log(std::abs(filteredDragDistanceY) - ORB_SIZE));
}
resMgr.spOrbs.SetAlpha(0.8 * 255);
resMgr.spOrbs.Render(
boardGeometry.x + board.At(draggedGemXIndex, draggedGemYIndex).posX + filteredDragDistanceX,
boardGeometry.y + board.At(draggedGemXIndex, draggedGemYIndex).posY + filteredDragDistanceY,
&orbClips[board.At(draggedGemXIndex, draggedGemYIndex).color]
);
resMgr.spOrbs.SetAlpha(255);
}
}
void TimeTrial::DrawBoardBorder()
{
resMgr.spBoard.Render(boardGeometry.x - boardClips[7].w, boardGeometry.y - boardClips[7].h, &boardClips[7]);
resMgr.spBoard.Render(boardGeometry.x + boardGeometry.w, boardGeometry.y - boardClips[9].h, &boardClips[9]);
resMgr.spBoard.Render(boardGeometry.x - boardClips[1].w, boardGeometry.y + boardGeometry.h, &boardClips[1]);
resMgr.spBoard.Render(boardGeometry.x + boardGeometry.w, boardGeometry.y + boardGeometry.h, &boardClips[3]);
for (int x = 0; x < board.Width(); ++x)
{
resMgr.spBoard.Render(boardGeometry.x + boardClips[8].w * x, boardGeometry.y - boardClips[8].h, &boardClips[8]);
resMgr.spBoard.Render(boardGeometry.x + boardClips[2].w * x, boardGeometry.y + boardGeometry.h, &boardClips[2]);
}
for (int y = 0; y < board.Height(); ++y)
{
resMgr.spBoard.Render(boardGeometry.x - boardClips[4].w, boardGeometry.y + boardClips[4].h * y, &boardClips[4]);
resMgr.spBoard.Render(boardGeometry.x + boardGeometry.w, boardGeometry.y + boardClips[6].h * y, &boardClips[6]);
}
}
void TimeTrial::CheckAndSwap(int gemAIndexX, int gemAIndexY, int gemBIndexX, int gemBIndexY)
{
// Safeguards against dragging Gems off the board:
if ((gemAIndexX >= 0) && (gemAIndexX < board.Width()) &&
(gemAIndexY >= 0) && (gemAIndexY < board.Height()) &&
(gemBIndexX >= 0) && (gemBIndexX < board.Width()) &&
(gemBIndexY >= 0) && (gemBIndexY < board.Height()))
{
// Swaps the two gems on a model board:
std::cout << "SWAP: [" << gemAIndexX << ", " << gemAIndexY << "] and ["
<< gemBIndexX << ", " << gemBIndexY << "]" << std::endl;
board.SwapColors(gemAIndexX, gemAIndexY, gemBIndexX, gemBIndexY);
if (board.FindChains())
{
// Marks gems A&B as the ones to be dragged around when swapping:
draggedGemXIndex = gemAIndexX;
draggedGemYIndex = gemAIndexY;
otherGemXIndex = gemBIndexX;
otherGemYIndex = gemBIndexY;
// Unselects the previously selected Gem, if applicable:
selectedGemXIndex = -1;
selectedGemYIndex = -1;
pbTime->SetForegroundColor(gse::ProgressBarColors::BLUE);
// Enters the SWAPPING phase in this iteration's logic handling:
nextPhase = GamePhase::SWAPPING;
}
else
{
std::cout << "Swap failed - no new chains." << std::endl;
// Reverts the color change back:
board.SwapColors(gemAIndexX, gemAIndexY, gemBIndexX, gemBIndexY);
}
}
}
} // namespace state
| 34.966135
| 118
| 0.607873
|
agral
|
7efd5d7e2973f268cd492a27fca8f8d3bd86520b
| 4,191
|
cpp
|
C++
|
qtxmlpatterns/src/xmlpatterns/janitors/qatomizer.cpp
|
wgnet/wds_qt
|
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
|
[
"Apache-2.0"
] | 1
|
2020-04-30T15:47:35.000Z
|
2020-04-30T15:47:35.000Z
|
qtxmlpatterns/src/xmlpatterns/janitors/qatomizer.cpp
|
wgnet/wds_qt
|
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
|
[
"Apache-2.0"
] | null | null | null |
qtxmlpatterns/src/xmlpatterns/janitors/qatomizer.cpp
|
wgnet/wds_qt
|
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
|
[
"Apache-2.0"
] | null | null | null |
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtXmlPatterns module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qatomictype_p.h"
#include "qbuiltintypes_p.h"
#include "qcommonsequencetypes_p.h"
#include "qgenericsequencetype_p.h"
#include "qsequencemappingiterator_p.h"
#include "qatomizer_p.h"
QT_BEGIN_NAMESPACE
using namespace QPatternist;
Atomizer::Atomizer(const Expression::Ptr &operand) : SingleContainer(operand)
{
}
Item::Iterator::Ptr Atomizer::mapToSequence(const Item &item, const DynamicContext::Ptr &) const
{
/* Function & Operators, 2.4.2 fn:data, says "If the node does not have a
* typed value an error is raised [err:FOTY0012]."
* When does a node not have a typed value? */
Q_ASSERT(item);
return item.sequencedTypedValue();
}
Item::Iterator::Ptr Atomizer::evaluateSequence(const DynamicContext::Ptr &context) const
{
return makeSequenceMappingIterator<Item>(ConstPtr(this),
m_operand->evaluateSequence(context),
context);
}
Item Atomizer::evaluateSingleton(const DynamicContext::Ptr &context) const
{
const Item item(m_operand->evaluateSingleton(context));
if(!item) /* Empty is allowed, cardinality is considered '?' */
return Item();
const Item::Iterator::Ptr it(mapToSequence(item, context));
Q_ASSERT_X(it, Q_FUNC_INFO, "A valid QAbstractXmlForwardIterator must always be returned.");
Item result(it->next());
Q_ASSERT_X(!it->next(), Q_FUNC_INFO,
"evaluateSingleton should never be used if the cardinality is two or more");
return result;
}
Expression::Ptr Atomizer::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
/* Compress -- the earlier the better. */
if(BuiltinTypes::xsAnyAtomicType->xdtTypeMatches(m_operand->staticType()->itemType()))
return m_operand->typeCheck(context, reqType);
return SingleContainer::typeCheck(context, reqType);
}
SequenceType::Ptr Atomizer::staticType() const
{
const SequenceType::Ptr opt(m_operand->staticType());
return makeGenericSequenceType(opt->itemType()->atomizedType(),
opt->cardinality());
}
SequenceType::List Atomizer::expectedOperandTypes() const
{
SequenceType::List result;
result.append(CommonSequenceTypes::ZeroOrMoreItems);
return result;
}
ExpressionVisitorResult::Ptr Atomizer::accept(const ExpressionVisitor::Ptr &visitor) const
{
return visitor->visit(this);
}
const SourceLocationReflection *Atomizer::actualReflection() const
{
return m_operand->actualReflection();
}
QT_END_NAMESPACE
| 35.516949
| 96
| 0.69005
|
wgnet
|
7d05eabaa6c9d139c099cd7f61b47358ca174b85
| 935
|
cpp
|
C++
|
platforms/gfg/0234_largest_subset_gcd_1.cpp
|
idfumg/algorithms
|
06f85c5a1d07a965df44219b5a6bf0d43a129256
|
[
"MIT"
] | 2
|
2020-09-17T09:04:00.000Z
|
2020-11-20T19:43:18.000Z
|
platforms/gfg/0234_largest_subset_gcd_1.cpp
|
idfumg/algorithms
|
06f85c5a1d07a965df44219b5a6bf0d43a129256
|
[
"MIT"
] | null | null | null |
platforms/gfg/0234_largest_subset_gcd_1.cpp
|
idfumg/algorithms
|
06f85c5a1d07a965df44219b5a6bf0d43a129256
|
[
"MIT"
] | null | null | null |
#include "../../template.hpp"
int LargestSubsetWithGcd1(vi arr) { // size <= 32
int n = arr.size();
int ans = 0;
for (int i = 0; i < (1 << n); ++i) {
int g = 0;
int count = 0;
for (int j = 0; j < n; ++j) {
if (i & (1 << j)) {
++count;
g = gcd(g, arr[j]);
}
}
if (g == 1) {
ans = max(ans, count);
}
}
return ans;
}
int fast(vi arr) {
int n = arr.size();
int g = 0;
for (int i = 0; i < n; ++i) {
g = gcd(g, arr[i]);
if (g == 1) {
return n;
}
}
return 0;
}
int main() { TimeMeasure _; __x();
cout << LargestSubsetWithGcd1({2, 3, 5}) << endl; // 3 // O(n*logn*2^n)
cout << LargestSubsetWithGcd1({3, 18, 12}) << endl; // 0
cout << endl;
cout << fast({2, 3, 5}) << endl; // 3 // O(n)
cout << fast({3, 18, 12}) << endl; // 0
}
| 22.804878
| 75
| 0.387166
|
idfumg
|
7d0aa05c46f1372bd499f5ec56029f30c8b6d2df
| 1,072
|
cpp
|
C++
|
Source/UModEditor/SUModPalette.cpp
|
StoneLineDevTeam/UMod
|
e57e41b95d8cdcc4479965453ac86e5116178795
|
[
"BSD-4-Clause"
] | 21
|
2015-09-03T13:17:55.000Z
|
2022-03-28T15:55:42.000Z
|
Source/UModEditor/SUModPalette.cpp
|
StoneLineDevTeam/UMod
|
e57e41b95d8cdcc4479965453ac86e5116178795
|
[
"BSD-4-Clause"
] | 24
|
2015-09-19T18:03:30.000Z
|
2018-12-21T10:53:01.000Z
|
Source/UModEditor/SUModPalette.cpp
|
StoneLineDevTeam/UMod
|
e57e41b95d8cdcc4479965453ac86e5116178795
|
[
"BSD-4-Clause"
] | 17
|
2015-09-03T13:18:04.000Z
|
2021-11-24T02:14:11.000Z
|
#include "UModEditor.h"
#include "SUModPalette.h"
void SUModPalette::Construct(const FArguments& Args)
{
/*ChildSlot
[
//Creating the button that adds a new item on the list when pressed
SNew(SScrollBox)
+ SScrollBox::Slot()
[
//The actual list view creation
+ SScrollBox::Slot()
[
SAssignNew(ListViewWidget, SListView<TSharedPtr<FString>>)
.ItemHeight(24)
.ListItemsSource(&Items) //The Items array is the source of this listview
.OnGenerateRow(this, &SUModPalette::OnGenerateRowForList)
]
];*/
}
FReply SUModPalette::ButtonPressed()
{
//Adds a new item to the array (do whatever you want with this)
Items.Add(MakeShareable(new FString("Hello 1")));
//Update the listview
ListViewWidget->RequestListRefresh();
return FReply::Handled();
}
TSharedRef<ITableRow> SUModPalette::OnGenerateRowForList(TSharedPtr<FString> Item, const TSharedRef<STableViewBase>& OwnerTable)
{
//Create the row
return
SNew(STableRow<TSharedPtr<FString>>, OwnerTable)
.Padding(2.0f)
[
SNew(SButton).Text(FText::FromString(*Item.Get()))
];
}
| 23.822222
| 128
| 0.726679
|
StoneLineDevTeam
|
7d0c6614694712d3b9099d1ddf3df2b30ef9d34d
| 11,175
|
cpp
|
C++
|
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
|
dalihub/dali-toolk
|
980728a7e35b8ddd28f70c090243e8076e21536e
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 7
|
2016-11-18T10:26:51.000Z
|
2021-01-28T13:51:59.000Z
|
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
|
dalihub/dali-toolk
|
980728a7e35b8ddd28f70c090243e8076e21536e
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 13
|
2020-07-15T11:33:03.000Z
|
2021-04-09T21:29:23.000Z
|
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
|
dalihub/dali-toolk
|
980728a7e35b8ddd28f70c090243e8076e21536e
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 10
|
2019-05-17T07:15:09.000Z
|
2021-05-24T07:28:08.000Z
|
/*
* Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* 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 "dummy-control.h"
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
namespace Dali
{
namespace Toolkit
{
DummyControl::DummyControl()
{
}
DummyControl::DummyControl(const DummyControl& control)
: Control( control )
{
}
DummyControl::~DummyControl()
{
}
DummyControl DummyControl::DownCast( BaseHandle handle )
{
return Control::DownCast<DummyControl, DummyControlImpl>(handle);
}
DummyControl& DummyControl::operator=(const DummyControl& control)
{
Control::operator=( control );
return *this;
}
// Used to test signal connections
void DummyControlImpl::CustomSlot1( Actor actor )
{
mCustomSlot1Called = true;
}
namespace {
BaseHandle Create()
{
return DummyControlImpl::New();
}
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::DummyControl, Toolkit::Control, Create );
DALI_TYPE_REGISTRATION_END()
Dali::PropertyRegistration dummyControlVisualProperty01(
typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty02(
typeRegistration, "testVisual2", Dali::Toolkit::DummyControl::Property::TEST_VISUAL2, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty03(
typeRegistration, "foregroundVisual", Dali::Toolkit::DummyControl::Property::FOREGROUND_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty04(
typeRegistration, "focusVisual", Dali::Toolkit::DummyControl::Property::FOCUS_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
Dali::PropertyRegistration dummyControlVisualProperty05(
typeRegistration, "labelVisual", Dali::Toolkit::DummyControl::Property::LABEL_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
}
DummyControl DummyControlImpl::New()
{
IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
DummyControl control( *impl );
impl->Initialize();
return control;
}
DummyControlImpl::DummyControlImpl()
: Control( ControlBehaviour() ),
mCustomSlot1Called(false)
{
}
DummyControlImpl::~DummyControlImpl()
{
}
void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual )
{
DevelControl::RegisterVisual( *this, index, visual );
VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index );
if( iter == mRegisteredVisualIndices.end() )
{
mRegisteredVisualIndices.push_back(index);
}
}
void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled )
{
DevelControl::RegisterVisual( *this, index, visual, enabled );
VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index );
if( iter == mRegisteredVisualIndices.end() )
{
mRegisteredVisualIndices.push_back(index);
}
}
void DummyControlImpl::UnregisterVisual( Property::Index index )
{
DevelControl::UnregisterVisual( *this, index );
VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index );
if( iter != mRegisteredVisualIndices.end() )
{
mRegisteredVisualIndices.erase(iter);
}
}
Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index )
{
return DevelControl::GetVisual( *this, index );
}
void DummyControlImpl::EnableVisual( Property::Index index, bool enabled )
{
DevelControl::EnableVisual( *this, index, enabled );
}
bool DummyControlImpl::IsVisualEnabled( Property::Index index )
{
return DevelControl::IsVisualEnabled( *this, index );
}
Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
{
return DevelControl::CreateTransition( *this, transition );
}
void DummyControlImpl::DoAction( Dali::Property::Index index, Dali::Property::Index action, const Dali::Property::Value attributes )
{
DummyControl control( *this );
DevelControl::DoAction( control, index, action, attributes);
}
void DummyControlImpl::SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value )
{
Toolkit::DummyControl control = Toolkit::DummyControl::DownCast( Dali::BaseHandle( object ) );
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(control.GetImplementation());
switch(index)
{
case Toolkit::DummyControl::Property::TEST_VISUAL:
case Toolkit::DummyControl::Property::TEST_VISUAL2:
case Toolkit::DummyControl::Property::FOREGROUND_VISUAL:
case Toolkit::DummyControl::Property::FOCUS_VISUAL:
case Toolkit::DummyControl::Property::LABEL_VISUAL:
{
const Property::Map* map = value.GetMap();
if( map != NULL )
{
VisualFactory visualFactory = VisualFactory::Get();
Visual::Base visual = visualFactory.CreateVisual(*map);
dummyImpl.RegisterVisual(index, visual);
}
break;
}
}
}
Property::Value DummyControlImpl::GetProperty( BaseObject* object, Dali::Property::Index propertyIndex )
{
Toolkit::DummyControl control = Toolkit::DummyControl::DownCast( Dali::BaseHandle( object ) );
DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>( control.GetImplementation() );
Visual::Base visual = dummyImpl.GetVisual( propertyIndex );
Property::Map map;
if( visual )
{
visual.CreatePropertyMap( map );
}
Dali::Property::Value value = map;
return value;
}
Toolkit::DummyControl Impl::DummyControl::New()
{
IntrusivePtr< Toolkit::Impl::DummyControl > impl = new Toolkit::Impl::DummyControl;
Toolkit::DummyControl control( *impl );
impl->Initialize();
return control;
}
int Impl::DummyControl::constructorCount;
int Impl::DummyControl::destructorCount;
Impl::DummyControl::DummyControl()
: DummyControlImpl(),
initializeCalled(false),
activatedCalled(false),
onAccValueChangeCalled(false),
themeChangeCalled(false),
fontChangeCalled(false),
pinchCalled(false),
panCalled(false),
tapCalled(false),
longPressCalled(false),
stageConnectionCalled(false),
stageDisconnectionCalled(false),
childAddCalled(false),
childRemoveCalled(false),
sizeSetCalled(false),
sizeAnimationCalled(false),
hoverEventCalled(false),
wheelEventCalled(false),
keyEventCalled(false),
keyInputFocusGained(false),
keyInputFocusLost(false)
{
++constructorCount;
}
Impl::DummyControl::~DummyControl()
{
++destructorCount;
}
void Impl::DummyControl::OnInitialize() { initializeCalled = true; }
bool Impl::DummyControl::OnAccessibilityActivated() { activatedCalled = true; return true; }
bool Impl::DummyControl::OnAccessibilityValueChange( bool isIncrease )
{
onAccValueChangeCalled = true; return true;
}
void Impl::DummyControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
{
themeChangeCalled = change == StyleChange::THEME_CHANGE;
fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
}
void Impl::DummyControl::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
void Impl::DummyControl::OnPan(const PanGesture& pan) { panCalled = true; }
void Impl::DummyControl::OnTap(const TapGesture& tap) { tapCalled = true; }
void Impl::DummyControl::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
void Impl::DummyControl::OnSceneConnection( int depth ) { Control::OnSceneConnection( depth ); stageConnectionCalled = true; }
void Impl::DummyControl::OnSceneDisconnection() { stageDisconnectionCalled = true; Control::OnSceneDisconnection(); }
void Impl::DummyControl::OnChildAdd(Actor& child) { childAddCalled = true; }
void Impl::DummyControl::OnChildRemove(Actor& child) { childRemoveCalled = true; }
void Impl::DummyControl::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
void Impl::DummyControl::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
bool Impl::DummyControl::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
void Impl::DummyControl::OnKeyInputFocusGained() { keyInputFocusGained = true; }
void Impl::DummyControl::OnKeyInputFocusLost() { keyInputFocusLost = true; }
void Impl::DummyControl::SetLayout( Property::Index visualIndex, Property::Map& map )
{
Property::Value value( map );
mLayouts[visualIndex] = value;
}
void Impl::DummyControl::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
if ( mRelayoutCallback )
{
mRelayoutCallback( size ); // Execute callback if set
}
Property::Map emptyMap;
for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter )
{
Visual::Base visual = GetVisual(*iter);
Property::Value value = mLayouts[*iter];
Property::Map* map = NULL;
if( value.GetType() != Property::NONE )
{
map = value.GetMap();
}
if( map == NULL )
{
map = &emptyMap;
}
visual.SetTransformAndSize( *map, size );
}
}
void Impl::DummyControl::SetRelayoutCallback( RelayoutCallbackFunc callback )
{
mRelayoutCallback = callback;
}
Vector3 Impl::DummyControl::GetNaturalSize()
{
Vector2 currentSize;
for( auto elem : mRegisteredVisualIndices )
{
Vector2 naturalSize;
Visual::Base visual = GetVisual(elem);
visual.GetNaturalSize( naturalSize );
currentSize.width = std::max( naturalSize.width, currentSize.width );
currentSize.height = std::max( naturalSize.height, currentSize.height );
}
return Vector3( currentSize );
}
DummyControl DummyControl::New( bool override )
{
DummyControl control;
if (override)
{
control = Impl::DummyControl::New();
}
else
{
control = DummyControlImpl::New();
}
return control;
}
DummyControl::DummyControl( DummyControlImpl& implementation )
: Control( implementation )
{
}
DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
: Control( internal )
{
VerifyCustomActorPointer<DummyControlImpl>(internal);
}
} // namespace Toolkit
} // namespace Dali
| 30.955679
| 214
| 0.747383
|
dalihub
|
7d10dd6416879b3113cbbcf6fc45aee5d1edc9f8
| 2,847
|
cpp
|
C++
|
example/tutorial.cpp
|
anarthal/mysql-asio
|
13d3615464f41222052d9ad8fa0c86bcdddee537
|
[
"BSL-1.0"
] | 47
|
2019-10-21T14:54:39.000Z
|
2020-07-06T19:36:58.000Z
|
example/tutorial.cpp
|
anarthal/mysql-asio
|
13d3615464f41222052d9ad8fa0c86bcdddee537
|
[
"BSL-1.0"
] | 5
|
2020-03-05T12:03:02.000Z
|
2020-07-06T18:18:35.000Z
|
example/tutorial.cpp
|
anarthal/mysql-asio
|
13d3615464f41222052d9ad8fa0c86bcdddee537
|
[
"BSL-1.0"
] | 4
|
2020-03-05T11:28:55.000Z
|
2020-05-20T09:06:21.000Z
|
//
// Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "boost/mysql/connection.hpp"
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/context.hpp>
#include <boost/mysql.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/system/system_error.hpp>
#include <iostream>
#include <string>
/**
* For this example, we will be using the 'boost_mysql_examples' database.
* You can get this database by running db_setup.sql.
* This example assumes you are connecting to a localhost MySQL server.
*
* This example uses synchronous functions and handles errors using exceptions.
*/
void main_impl(int argc, char** argv)
{
if (argc != 4)
{
std::cerr << "Usage: " << argv[0] << " <username> <password> <server-hostname>\n";
exit(1);
}
//[tutorial_connection
// The execution context, required to run I/O operations
boost::asio::io_context ctx;
// The SSL context, required to establish TLS connections.
// The default SSL options are good enough for us at this point.
boost::asio::ssl::context ssl_ctx (boost::asio::ssl::context::tls_client);
// The object defining the connection to the MySQL server.
boost::mysql::tcp_ssl_connection conn (ctx.get_executor(), ssl_ctx);
//]
//[tutorial_connect
// Resolve the hostname to get a collection of endpoints
boost::asio::ip::tcp::resolver resolver (ctx.get_executor());
auto endpoints = resolver.resolve(argv[3], boost::mysql::default_port_string);
// The username and password to use
boost::mysql::connection_params params (
argv[1], // username
argv[2] // password
);
// Connect to the server using the first endpoint returned by the resolver
conn.connect(*endpoints.begin(), params);
//]
//[tutorial_query
const char* sql = "SELECT \"Hello world!\"";
boost::mysql::tcp_ssl_resultset result = conn.query(sql);
//]
//[tutorial_read
std::vector<boost::mysql::row> employees = result.read_all();
//]
//[tutorial_values
const boost::mysql::row& first_row = employees.at(0);
boost::mysql::value first_value = first_row.values().at(0);
std::cout << first_value << std::endl;
//]
//[tutorial_close
conn.close();
//]
}
int main(int argc, char** argv)
{
try
{
main_impl(argc, argv);
}
catch (const boost::system::system_error& err)
{
std::cerr << "Error: " << err.what() << ", error code: " << err.code() << std::endl;
return 1;
}
catch (const std::exception& err)
{
std::cerr << "Error: " << err.what() << std::endl;
return 1;
}
}
| 29.05102
| 92
| 0.645592
|
anarthal
|
7d1125330c9522ef1fd250f11ab7a4f8dbb1bc06
| 3,497
|
cpp
|
C++
|
CNN/activation_test.cpp
|
suiyili/projects
|
29b4ab0435c8994809113c444b3dea4fff60b75c
|
[
"MIT"
] | null | null | null |
CNN/activation_test.cpp
|
suiyili/projects
|
29b4ab0435c8994809113c444b3dea4fff60b75c
|
[
"MIT"
] | null | null | null |
CNN/activation_test.cpp
|
suiyili/projects
|
29b4ab0435c8994809113c444b3dea4fff60b75c
|
[
"MIT"
] | null | null | null |
#ifdef TEST
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "activation_mock.hpp"
#include "layer_mock.hpp"
#include "test_value.hpp"
#include "value_factory_mock.hpp"
#include <array>
#include <forward_list>
#include <future>
#include <numeric>
using namespace Catch;
namespace cnn::neuron {
SCENARIO("activation test", "[activation]") {
GIVEN("a previous layer") {
value_array prev_layer_values{.40f, .25f, .13f, .61f, 1.0f};
constexpr unsigned short prev_size = 4U;
auto prev_layer = std::make_unique<layer_mock>(prev_size);
auto &prev = *prev_layer;
for (size_t i = 0U; i < prev_size; ++i)
prev[i].set_output(prev_layer_values[i]);
AND_GIVEN("a series of W values") {
value_array init_weights{.20f, .31f, .22f, .85f, .58f};
value_factory_mock factory(init_weights);
activation_mock n(std::move(prev_layer), factory);
WHEN("activation forward") {
n.forward();
THEN("it should get argument from linear product") {
auto expected = factory[prev.size()];
for (size_t i = 0; i < prev.size(); ++i)
expected += prev[i].output() * factory[i];
REQUIRE(n.get_argument() == Approx(expected).margin(test_precision));
}
}
AND_GIVEN("a series of error gredients") {
std::array<float, 4> error_gradient{.25f, .22f, .38f, .18f};
WHEN("activation propagates back") {
n.propagate_back(error_gradient[0]);
n.train();
THEN("it should call previous layer with curated value") {
for (size_t i = 0; i < prev.size(); ++i) {
auto expected = error_gradient[0] * factory[i];
REQUIRE(prev[i].propagate_back_called_with() ==
Approx(expected).margin(test_precision));
}
AND_WHEN("learn from more back propagation") {
for (size_t i = 1U; i < error_gradient.size(); ++i) {
n.propagate_back(error_gradient[i]);
n.train();
}
const float learning_rate = .2f;
n.learn(learning_rate);
auto gradient_sum = std::accumulate(error_gradient.begin(),
error_gradient.end(), 0.0f);
value_array delta = prev_layer_values * gradient_sum;
delta /= (float)error_gradient.size();
delta *= learning_rate;
auto weights = init_weights - delta;
for (size_t i = 0; i < prev.size(); ++i)
prev[i].set_output(1.0f);
n.forward();
REQUIRE(n.get_argument() ==
Approx(weights.sum()).margin(test_precision));
}
}
}
WHEN("propagate back with multi-threads") {
std::forward_list<std::future<void>> tasks;
float total_error = 0.0f;
for (auto e : error_gradient) {
tasks.emplace_front(std::async(std::launch::async,
[&n, e] { n.propagate_back(e); }));
total_error += e;
}
for (auto &t : tasks)
t.wait();
n.train();
THEN("it should sum all propagation currectly") {
REQUIRE(n.get_back_prop() ==
Approx(total_error).margin(test_precision));
}
}
}
}
}
}
} // namespace cnn::neuron
#endif // TEST
| 32.37963
| 79
| 0.547612
|
suiyili
|
7d12722e884fe5221263bcfc371a702b1c0ca7bf
| 1,832
|
cpp
|
C++
|
tests/depthai_pybind11_tests.cpp
|
4ndr3aR/depthai-python
|
b4fe1211d19280b2f2be8a43912ea818f6f4b5b3
|
[
"MIT"
] | 182
|
2020-06-25T00:27:12.000Z
|
2022-03-31T05:06:04.000Z
|
tests/depthai_pybind11_tests.cpp
|
4ndr3aR/depthai-python
|
b4fe1211d19280b2f2be8a43912ea818f6f4b5b3
|
[
"MIT"
] | 206
|
2020-07-28T22:32:14.000Z
|
2022-03-31T13:57:59.000Z
|
tests/depthai_pybind11_tests.cpp
|
4ndr3aR/depthai-python
|
b4fe1211d19280b2f2be8a43912ea818f6f4b5b3
|
[
"MIT"
] | 102
|
2020-08-06T23:02:35.000Z
|
2022-03-24T19:43:30.000Z
|
/*
tests/pybind11_tests.cpp -- pybind example plugin
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
*/
#include "depthai_pybind11_tests.hpp"
#include <functional>
#include <list>
/*
For testing purposes, we define a static global variable here in a function that each individual
test .cpp calls with its initialization lambda. It's convenient here because we can just not
compile some test files to disable/ignore some of the test code.
It is NOT recommended as a way to use pybind11 in practice, however: the initialization order will
be essentially random, which is okay for our test scripts (there are no dependencies between the
individual pybind11 test .cpp files), but most likely not what you want when using pybind11
productively.
Instead, see the "How can I reduce the build time?" question in the "Frequently asked questions"
section of the documentation for good practice on splitting binding code over multiple files.
*/
std::list<std::function<void(py::module_ &)>> &initializers() {
static std::list<std::function<void(py::module_ &)>> inits;
return inits;
}
test_initializer::test_initializer(Initializer init) {
initializers().emplace_back(init);
}
test_initializer::test_initializer(const char *submodule_name, Initializer init) {
initializers().emplace_back([=](py::module_ &parent) {
auto m = parent.def_submodule(submodule_name);
init(m);
});
}
PYBIND11_MODULE(depthai_pybind11_tests, m) {
m.doc() = "depthai pybind11 test module";
#if !defined(NDEBUG)
m.attr("debug_enabled") = true;
#else
m.attr("debug_enabled") = false;
#endif
for (const auto &initializer : initializers())
initializer(m);
}
| 32.714286
| 98
| 0.736354
|
4ndr3aR
|
7d12d9242afa2c4b4ec88bd2508da5bb7ffba34f
| 3,377
|
cpp
|
C++
|
Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestEnumerationSuiteFactory.cpp
|
cypherdotXd/o3de
|
bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676
|
[
"Apache-2.0",
"MIT"
] | 11
|
2021-07-08T09:58:26.000Z
|
2022-03-17T17:59:26.000Z
|
Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestEnumerationSuiteFactory.cpp
|
RoddieKieley/o3de
|
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
|
[
"Apache-2.0",
"MIT"
] | 29
|
2021-07-06T19:33:52.000Z
|
2022-03-22T10:27:49.000Z
|
Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestEnumerationSuiteFactory.cpp
|
RoddieKieley/o3de
|
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
|
[
"Apache-2.0",
"MIT"
] | 4
|
2021-07-06T19:24:43.000Z
|
2022-03-31T12:42:27.000Z
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <Artifact/Factory/TestImpactTestEnumerationSuiteFactory.h>
#include <Artifact/TestImpactArtifactException.h>
#include <AzCore/XML/rapidxml.h>
#include <AzCore/std/containers/vector.h>
namespace TestImpact
{
namespace GTest
{
AZStd::vector<TestEnumerationSuite> TestEnumerationSuitesFactory(const AZStd::string& testEnumerationData)
{
// Keys for pertinent XML node and attribute names
constexpr const char* Keys[] =
{
"testsuites",
"testsuite",
"name",
"testcase"
};
enum
{
TestSuitesKey,
TestSuiteKey,
NameKey,
TestCaseKey
};
AZ_TestImpact_Eval(!testEnumerationData.empty(), ArtifactException, "Cannot parse enumeration, string is empty");
AZStd::vector<TestEnumerationSuite> testSuites;
AZStd::vector<char> rawData(testEnumerationData.begin(), testEnumerationData.end());
try
{
AZ::rapidxml::xml_document<> doc;
// Parse the XML doc with default flags
doc.parse<0>(rawData.data());
const auto testsuites_node = doc.first_node(Keys[TestSuitesKey]);
AZ_TestImpact_Eval(testsuites_node, ArtifactException, "Could not parse enumeration, XML is invalid");
for (auto testsuite_node = testsuites_node->first_node(Keys[TestSuiteKey]); testsuite_node;
testsuite_node = testsuite_node->next_sibling())
{
const auto isEnabled = [](const AZStd::string& name)
{
return !name.starts_with("DISABLED_") && name.find("/DISABLED_") == AZStd::string::npos;
};
TestEnumerationSuite testSuite;
testSuite.m_name = testsuite_node->first_attribute(Keys[NameKey])->value();
testSuite.m_enabled = isEnabled(testSuite.m_name);
for (auto testcase_node = testsuite_node->first_node(Keys[TestCaseKey]); testcase_node;
testcase_node = testcase_node->next_sibling())
{
TestEnumerationCase testCase;
testCase.m_name = testcase_node->first_attribute(Keys[NameKey])->value();
testCase.m_enabled = isEnabled(testCase.m_name);
testSuite.m_tests.emplace_back(AZStd::move(testCase));
}
testSuites.emplace_back(AZStd::move(testSuite));
}
}
catch (const std::exception& e)
{
AZ_Error("TestEnumerationSuitesFactory", false, e.what());
throw ArtifactException(e.what());
}
catch (...)
{
throw ArtifactException("An unknown error occured parsing the XML data");
}
return testSuites;
}
} // namespace GTest
} // namespace TestImpact
| 38.375
| 125
| 0.55878
|
cypherdotXd
|
7d16eb73ad5ad9f95d96c26644eecb823e05d550
| 26,472
|
cc
|
C++
|
Ghidra/rulecompile.cc
|
fjqisba/E-Decompiler
|
f598c4205d8b9e4d29172dab0bb2672c75e48af9
|
[
"MIT"
] | 74
|
2021-03-04T08:12:43.000Z
|
2022-03-14T13:50:20.000Z
|
Ghidra/rulecompile.cc
|
fjqisba/E-Decompiler
|
f598c4205d8b9e4d29172dab0bb2672c75e48af9
|
[
"MIT"
] | 10
|
2021-03-05T09:52:10.000Z
|
2021-07-05T13:48:33.000Z
|
Ghidra/rulecompile.cc
|
fjqisba/E-Decompiler
|
f598c4205d8b9e4d29172dab0bb2672c75e48af9
|
[
"MIT"
] | 15
|
2021-04-06T14:22:39.000Z
|
2022-03-29T13:14:47.000Z
|
/* ###
* IP: GHIDRA
*
* 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.
*/
#ifdef CPUI_RULECOMPILE
#include "rulecompile.hh"
#include "ruleparse.hh"
RuleCompile *rulecompile;
extern int4 ruleparsedebug;
extern int4 ruleparseparse(void);
class MyLoadImage : public LoadImage { // Dummy loadimage
public:
MyLoadImage(void) : LoadImage("nofile") {}
virtual void loadFill(uint1 *ptr,int4 size,const Address &addr) { for(int4 i=0;i<size;++i) ptr[i] = 0; }
virtual string getArchType(void) const { return "myload"; }
virtual void adjustVma(long adjust) { }
};
int4 RuleLexer::identlist[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0,
0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5,
0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
int4 RuleLexer::scanIdentifier(void)
{
int4 i=0;
identifier[i] = (char)getNextChar(); // Scan at least the first character
i += 1;
do {
if ((identlist[next(0)]&1) != 0) {
identifier[i] = (char) getNextChar();
i += 1;
}
else
break;
} while(i<255);
if ((i==255)||(i==0))
return -1; // Identifier is too long
identifier[i] = '\0';
identlength = i;
if ((identlist[(int4)identifier[0]]&2) != 0) // First number is digit
return scanNumber();
switch(identifier[0]) {
case 'o':
return buildString(OP_IDENTIFIER);
case 'v':
return buildString(VAR_IDENTIFIER);
case '#':
return buildString(CONST_IDENTIFIER);
case 'O':
return buildString(OP_NEW_IDENTIFIER);
case 'V':
return buildString(VAR_NEW_IDENTIFIER);
case '.':
return buildString(DOT_IDENTIFIER);
default:
return otherIdentifiers();
}
}
int4 RuleLexer::scanNumber(void)
{
istringstream s(identifier);
s.unsetf(ios::dec | ios::hex | ios::oct);
uint8 val;
s >> val;
if (!s)
return BADINTEGER;
ruleparselval.big = new int8(val);
return INTB;
}
int4 RuleLexer::buildString(int4 tokentype)
{
if (identlength <= 1) return -1;
for(int4 i=1;i<identlength;++i) {
if ((identlist[(int4)identifier[i]]&4)==0) return -1;
}
if (identifier[0] == '.') {
ruleparselval.str = new string(identifier+1);
return tokentype;
}
if (identifier[0] == '#')
identifier[0] = 'c';
ruleparselval.str = new string(identifier);
return tokentype;
}
int4 RuleLexer::otherIdentifiers(void)
{
map<string,int4>::const_iterator iter;
iter = keywordmap.find(string(identifier));
if (iter != keywordmap.end())
return (*iter).second;
return -1;
}
void RuleLexer::initKeywords(void)
{
keywordmap["COPY"] = OP_COPY;
keywordmap["ZEXT"] = OP_INT_ZEXT;
keywordmap["CARRY"] = OP_INT_CARRY;
keywordmap["SCARRY"] = OP_INT_SCARRY;
keywordmap["SEXT"] = OP_INT_SEXT;
keywordmap["SBORROW"] = OP_INT_SBORROW;
keywordmap["NAN"] = OP_FLOAT_NAN;
keywordmap["ABS"] = OP_FLOAT_ABS;
keywordmap["SQRT"] = OP_FLOAT_SQRT;
keywordmap["CEIL"] = OP_FLOAT_CEIL;
keywordmap["FLOOR"] = OP_FLOAT_FLOOR;
keywordmap["ROUND"] = OP_FLOAT_ROUND;
keywordmap["INT2FLOAT"] = OP_FLOAT_INT2FLOAT;
keywordmap["FLOAT2FLOAT"] = OP_FLOAT_FLOAT2FLOAT;
keywordmap["TRUNC"] = OP_FLOAT_TRUNC;
keywordmap["GOTO"] = OP_BRANCH;
keywordmap["GOTOIND"] = OP_BRANCHIND;
keywordmap["CALL"] = OP_CALL;
keywordmap["CALLIND"] = OP_CALLIND;
keywordmap["RETURN"] = OP_RETURN;
keywordmap["CBRANCH"] = OP_CBRANCH;
keywordmap["USEROP"] = OP_CALLOTHER;
keywordmap["LOAD"] = OP_LOAD;
keywordmap["STORE"] = OP_STORE;
keywordmap["CONCAT"] = OP_PIECE;
keywordmap["SUBPIECE"] = OP_SUBPIECE;
keywordmap["before"] = BEFORE_KEYWORD;
keywordmap["after"] = AFTER_KEYWORD;
keywordmap["remove"] = REMOVE_KEYWORD;
keywordmap["set"] = SET_KEYWORD;
keywordmap["istrue"] = ISTRUE_KEYWORD;
keywordmap["isfalse"] = ISFALSE_KEYWORD;
}
int4 RuleLexer::nextToken(void)
{
for(;;) {
int4 mychar = next(0);
switch(mychar) {
case '(':
case ')':
case ',':
case '[':
case ']':
case ';':
case '{':
case '}':
case ':':
getNextChar();
ruleparselval.ch = (char)mychar;
return mychar;
case '\r':
case ' ':
case '\t':
case '\v':
getNextChar();
break;
case '\n':
getNextChar();
lineno += 1;
break;
case '-':
getNextChar();
if (next(0) == '>') {
getNextChar();
return RIGHT_ARROW;
}
else if (next(0) == '-') {
getNextChar();
if (next(0) == '>') {
getNextChar();
return DOUBLE_RIGHT_ARROW;
}
return ACTION_TICK;
}
return OP_INT_SUB;
case '<':
getNextChar();
if (next(0) == '-') {
getNextChar();
if (next(0) == '-') {
getNextChar();
return DOUBLE_LEFT_ARROW;
}
return LEFT_ARROW;
}
else if (next(0) == '<') {
getNextChar();
return OP_INT_LEFT;
}
else if (next(0) == '=') {
getNextChar();
return OP_INT_LESSEQUAL;
}
return OP_INT_LESS;
case '|':
getNextChar();
if (next(0) == '|') {
getNextChar();
return OP_BOOL_OR;
}
return OP_INT_OR;
case '&':
getNextChar();
if (next(0) == '&') {
getNextChar();
return OP_BOOL_AND;
}
return OP_INT_AND;
case '^':
getNextChar();
if (next(0) == '^') {
getNextChar();
return OP_BOOL_XOR;
}
return OP_INT_XOR;
case '>':
if (next(1) == '>') {
getNextChar();
getNextChar();
return OP_INT_RIGHT;
}
return -1;
case '=':
getNextChar();
if (next(0) == '=') {
getNextChar();
return OP_INT_EQUAL;
}
ruleparselval.ch = (char)mychar;
return mychar;
case '!':
getNextChar();
if (next(0) == '=') {
getNextChar();
return OP_INT_NOTEQUAL;
}
return OP_BOOL_NEGATE;
case 's':
if (next(1) == '/') {
getNextChar();
getNextChar();
return OP_INT_SDIV;
}
else if (next(1) == '%') {
getNextChar();
getNextChar();
return OP_INT_SREM;
}
else if ((next(1)=='>')&&(next(2)=='>')) {
getNextChar();
getNextChar();
getNextChar();
return OP_INT_SRIGHT;
}
else if (next(1)=='<') {
getNextChar();
getNextChar();
if (next(0) == '=') {
getNextChar();
return OP_INT_SLESSEQUAL;
}
return OP_INT_SLESS;
}
return scanIdentifier();
case 'f':
if (next(1) == '+') {
getNextChar();
getNextChar();
return OP_FLOAT_ADD;
}
else if (next(1) == '-') {
getNextChar();
getNextChar();
return OP_FLOAT_SUB;
}
else if (next(1) == '*') {
getNextChar();
getNextChar();
return OP_FLOAT_MULT;
}
else if (next(1) == '/') {
getNextChar();
getNextChar();
return OP_FLOAT_DIV;
}
else if ((next(1) == '=')&&(next(2) == '=')) {
getNextChar();
getNextChar();
getNextChar();
return OP_FLOAT_EQUAL;
}
else if ((next(1) == '!')&&(next(2) == '=')) {
getNextChar();
getNextChar();
getNextChar();
return OP_FLOAT_NOTEQUAL;
}
else if (next(1) == '<') {
getNextChar();
getNextChar();
if (next(0) == '=') {
getNextChar();
return OP_FLOAT_LESSEQUAL;
}
return OP_FLOAT_LESS;
}
return -1;
case '+':
getNextChar();
return OP_INT_ADD;
case '*':
getNextChar();
return OP_INT_MULT;
case '/':
getNextChar();
return OP_INT_DIV;
case '%':
getNextChar();
return OP_INT_REM;
case '~':
getNextChar();
return OP_INT_NEGATE;
case '#':
if ((identlist[next(1)]&6)==4)
return scanIdentifier();
getNextChar();
ruleparselval.ch = (char)mychar; // Return '#' as single token
return mychar;
default:
return scanIdentifier();
}
}
return -1;
}
RuleLexer::RuleLexer(void)
{
initKeywords();
}
void RuleLexer::initialize(istream &t)
{
s = &t;
pos = 0;
endofstream = false;
lineno = 1;
getNextChar();
getNextChar();
getNextChar();
getNextChar(); // Fill lookahead buffer
}
RuleCompile::RuleCompile(void)
{
DummyTranslate dummy;
error_stream = (ostream *)0;
errors = 0;
finalrule = (ConstraintGroup *)0;
OpBehavior::registerInstructions(inst,&dummy);
}
RuleCompile::~RuleCompile(void)
{
if (finalrule != (ConstraintGroup *)0)
delete finalrule;
for(int4 i=0;i<inst.size();++i) {
OpBehavior *t_op = inst[i];
if (t_op != (OpBehavior *)0)
delete t_op;
}
}
void RuleCompile::ruleError(const char *s)
{
if (error_stream != (ostream *)0) {
*error_stream << "Error at line " << dec << lexer.getLineNo() << endl;
*error_stream << " " << s << endl;
}
errors += 1;
}
int4 RuleCompile::findIdentifier(string *nm)
{
int4 resid;
map<string,int4>::const_iterator iter;
iter = namemap.find(*nm);
if (iter == namemap.end()) {
resid = namemap.size();
namemap[*nm] = resid;
}
else
resid = (*iter).second;
delete nm;
return resid;
}
ConstraintGroup *RuleCompile::newOp(int4 id)
{
ConstraintGroup *res = new ConstraintGroup();
res->addConstraint(new DummyOpConstraint(id));
return res;
}
ConstraintGroup *RuleCompile::newVarnode(int4 id)
{
ConstraintGroup *res = new ConstraintGroup();
res->addConstraint(new DummyVarnodeConstraint(id));
return res;
}
ConstraintGroup *RuleCompile::newConst(int4 id)
{
ConstraintGroup *res = new ConstraintGroup();
res->addConstraint(new DummyConstConstraint(id));
return res;
}
ConstraintGroup *RuleCompile::opCopy(ConstraintGroup *base,int4 opid)
{
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpCopy(opindex,opid);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opInput(ConstraintGroup *base,int8 *slot,int4 varid)
{
int4 ourslot = (int4) *slot;
delete slot;
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpInput(opindex,varid,ourslot);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opInputAny(ConstraintGroup *base,int4 varid)
{
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpInputAny(opindex,varid);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opInputConstVal(ConstraintGroup *base,int8 *slot,RHSConstant *val)
{
int4 ourslot = (int4) *slot;
delete slot;
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint;
ConstantAbsolute *myconst = dynamic_cast<ConstantAbsolute *>(val);
if (myconst != (ConstantAbsolute *)0) {
newconstraint = new ConstraintParamConstVal(opindex,ourslot,myconst->getVal());
}
else {
ConstantNamed *mynamed = dynamic_cast<ConstantNamed *>(val);
if (mynamed != (ConstantNamed *)0) {
newconstraint = new ConstraintParamConst(opindex,ourslot,mynamed->getId());
}
else {
ruleError("Can only use absolute constant here");
newconstraint = new ConstraintParamConstVal(opindex,ourslot,0);
}
}
delete val;
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opOutput(ConstraintGroup *base,int4 varid)
{
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpOutput(opindex,varid);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varCopy(ConstraintGroup *base,int4 varid)
{
int4 varindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintVarnodeCopy(varid,varindex);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varConst(ConstraintGroup *base,RHSConstant *ex,RHSConstant *sz)
{
int4 varindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintVarConst(varindex,ex,sz);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varDef(ConstraintGroup *base,int4 opid)
{
int4 varindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintDef(opid,varindex);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varDescend(ConstraintGroup *base,int4 opid)
{
int4 varindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintDescend(opid,varindex);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varUniqueDescend(ConstraintGroup *base,int4 opid)
{
int4 varindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintLoneDescend(opid,varindex);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opCodeConstraint(ConstraintGroup *base,vector<OpCode> *oplist)
{
if (oplist->size() != 1)
throw LowlevelError("Not currently supporting multiple opcode constraints");
int4 opindex = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpcode(opindex,*oplist);
delete oplist;
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::opCompareConstraint(ConstraintGroup *base,int4 opid,OpCode opc)
{
int4 op1index = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintOpCompare(op1index,opid,(opc==CPUI_INT_EQUAL));
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::varCompareConstraint(ConstraintGroup *base,int4 varid,OpCode opc)
{
int4 var1index = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintVarCompare(var1index,varid,(opc==CPUI_INT_EQUAL));
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::constCompareConstraint(ConstraintGroup *base,int4 constid,OpCode opc)
{
int4 const1index = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintConstCompare(const1index,constid,opc);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::constNamedExpression(int4 id,RHSConstant *expr)
{
ConstraintGroup *res = new ConstraintGroup();
res->addConstraint(new ConstraintNamedExpression(id,expr));
return res;
}
ConstraintGroup *RuleCompile::emptyGroup(void)
{
return new ConstraintGroup();
}
ConstraintGroup *RuleCompile::emptyOrGroup(void)
{
return new ConstraintOr();
}
ConstraintGroup *RuleCompile::mergeGroups(ConstraintGroup *a,ConstraintGroup *b)
{
a->mergeIn(b);
return a;
}
ConstraintGroup *RuleCompile::addOr(ConstraintGroup *base,ConstraintGroup *newor)
{
base->addConstraint(newor);
return base;
}
ConstraintGroup *RuleCompile::opCreation(int4 newid,OpCode oc,bool iafter,int4 oldid)
{
OpBehavior *behave = inst[oc];
int4 numparms = behave->isUnary() ? 1 : 2;
UnifyConstraint *newconstraint = new ConstraintNewOp(newid,oldid,oc,iafter,numparms);
ConstraintGroup *res = new ConstraintGroup();
res->addConstraint(newconstraint);
return res;
}
ConstraintGroup *RuleCompile::newUniqueOut(ConstraintGroup *base,int4 varid,int4 sz)
{
UnifyConstraint *newconstraint = new ConstraintNewUniqueOut(base->getBaseIndex(),varid,sz);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::newSetInput(ConstraintGroup *base,RHSConstant *slot,int4 varid)
{
UnifyConstraint *newconstraint = new ConstraintSetInput(base->getBaseIndex(),slot,varid);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::newSetInputConstVal(ConstraintGroup *base,RHSConstant *slot,RHSConstant *val,RHSConstant *sz)
{
UnifyConstraint *newconstraint = new ConstraintSetInputConstVal(base->getBaseIndex(),slot,val,sz);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::removeInput(ConstraintGroup *base,RHSConstant *slot)
{
UnifyConstraint *newconstraint = new ConstraintRemoveInput(base->getBaseIndex(),slot);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::newSetOpcode(ConstraintGroup *base,OpCode opc)
{
int4 opid = base->getBaseIndex();
UnifyConstraint *newconstraint = new ConstraintSetOpcode(opid,opc);
base->addConstraint(newconstraint);
return base;
}
ConstraintGroup *RuleCompile::booleanConstraint(bool ist,RHSConstant *expr)
{
ConstraintGroup *base = new ConstraintGroup();
UnifyConstraint *newconstraint = new ConstraintBoolean(ist,expr);
base->addConstraint(newconstraint);
return base;
}
RHSConstant *RuleCompile::constNamed(int4 id)
{
RHSConstant *res = new ConstantNamed(id);
return res;
}
RHSConstant *RuleCompile::constAbsolute(int8 *val)
{
RHSConstant *res = new ConstantAbsolute(*val);
delete val;
return res;
}
RHSConstant *RuleCompile::constBinaryExpression(RHSConstant *ex1,OpCode opc,RHSConstant *ex2)
{
RHSConstant *res = new ConstantExpression( ex1, ex2, opc );
return res;
}
RHSConstant *RuleCompile::constVarnodeSize(int4 varindex)
{
RHSConstant *res = new ConstantVarnodeSize(varindex);
return res;
}
RHSConstant *RuleCompile::dotIdentifier(int4 id,string *str)
{
RHSConstant *res;
if ((*str) == "offset")
res = new ConstantOffset(id);
else if ((*str) == "size")
res = new ConstantVarnodeSize(id);
else if ((*str) == "isconstant")
res = new ConstantIsConstant(id);
else if ((*str) == "heritageknown")
res = new ConstantHeritageKnown(id);
else if ((*str) == "consume")
res = new ConstantConsumed(id);
else if ((*str) == "nzmask")
res = new ConstantNZMask(id);
else {
string errmsg = "Unknown variable attribute: " + *str;
ruleError(errmsg.c_str());
res = new ConstantAbsolute(0);
}
delete str;
return res;
}
void RuleCompile::run(istream &s,bool debug)
{
#ifdef YYDEBUG
ruleparsedebug = debug ? 1 : 0;
#endif
if (!s) {
if (error_stream != (ostream *)0)
*error_stream << "Bad input stream to rule compiler" << endl;
return;
}
errors = 0;
if (finalrule != (ConstraintGroup *)0) {
delete finalrule;
finalrule = (ConstraintGroup *)0;
}
lexer.initialize(s);
rulecompile = this; // Setup the global pointer
int4 parseres = ruleparseparse(); // Try to parse
if (parseres!=0) {
errors += 1;
if (error_stream != (ostream *)0)
*error_stream << "Parsing error" << endl;
}
if (errors!=0) {
if (error_stream != (ostream *)0)
*error_stream << "Parsing incomplete" << endl;
}
}
void RuleCompile::postProcess(void)
{
int4 id = 0;
finalrule->removeDummy();
finalrule->setId(id); // Set id for everybody
}
int4 RuleCompile::postProcessRule(vector<OpCode> &opcodelist)
{ // Do normal post processing but also remove initial opcode check
finalrule->removeDummy();
if (finalrule->numConstraints() == 0)
throw LowlevelError("Cannot postprocess empty rule");
ConstraintOpcode *subconst = dynamic_cast<ConstraintOpcode *>(finalrule->getConstraint(0));
if (subconst == (ConstraintOpcode *)0)
throw LowlevelError("Rule does not start with opcode constraint");
opcodelist = subconst->getOpCodes();
int4 opinit = subconst->getMaxNum();
finalrule->deleteConstraint(0);
int4 id = 0;
finalrule->setId(id);
return opinit;
}
ConstraintGroup *RuleCompile::buildUnifyer(const string &rule,const vector<string> &idlist,
vector<int4> &res)
{
RuleCompile ruler;
istringstream s(rule);
ruler.run(s,false);
if (ruler.numErrors() != 0)
throw LowlevelError("Could not build rule");
ConstraintGroup *resconst = ruler.releaseRule();
for(int4 i=0;i<idlist.size();++i) {
char initc;
int4 id = -1;
map<string,int4>::const_iterator iter;
if (idlist[i].size() != 0) {
initc = idlist[i][0];
if ((initc == 'o')||(initc == 'O')||(initc == 'v')||(initc == 'V')||(initc == '#')) {
iter = ruler.namemap.find(idlist[i]);
if (iter != ruler.namemap.end())
id = (*iter).second;
}
}
if (id == -1)
throw LowlevelError("Bad initializer name: "+idlist[i]);
res.push_back(id);
}
return resconst;
}
RuleGeneric::RuleGeneric(const string &g,const string &nm,const vector<OpCode> &sops,int4 opi,ConstraintGroup *c)
: Rule(g,0,nm), state(c)
{
starterops = sops;
opinit = opi;
constraint = c;
}
void RuleGeneric::getOpList(vector<uint4> &oplist) const
{
for(int4 i=0;i<starterops.size();++i)
oplist.push_back((uint4)starterops[i]);
}
int4 RuleGeneric::applyOp(PcodeOp *op,Funcdata &data)
{
state.setFunction(&data);
state.initialize(opinit,op);
constraint->initialize(state);
return constraint->step(state);
}
RuleGeneric *RuleGeneric::build(const string &nm,const string &gp,const string &content)
{
RuleCompile compiler;
istringstream s(content);
compiler.run(s,false);
if (compiler.numErrors() != 0)
throw LowlevelError("Unable to parse dynamic rule: "+nm);
vector<OpCode> opcodelist;
int4 opinit = compiler.postProcessRule(opcodelist);
RuleGeneric *res = new RuleGeneric(gp,nm,opcodelist,opinit,compiler.releaseRule());
return res;
}
#endif
/*
Here is the original flex parser
%{
#include "rulecompile.hh"
#include "ruleparse.hh"
#define ruleparsewrap() 1
#define YY_SKIP_YYWRAP
extern RuleCompile *rulecompile;
int4 scan_number(char *numtext,YYSTYPE *lval)
{
istringstream s(numtext);
s.unsetf(ios::dec | ios::hex | ios::oct);
uintb val;
s >> val;
if (!s)
return BADINTEGER;
lval->big = new intb(val);
return INTB;
}
int4 find_op_identifier(void)
{
string ident(yytext);
ruleparselval.id = rulecompile->findOpIdentifier(ident);
return OP_IDENTIFIER;
}
int4 find_var_identifier(void)
{
string ident(yytext);
ruleparselval.id = rulecompile->findVarIdentifier(ident);
return VAR_IDENTIFIER;
}
int4 find_const_identifier(void)
{
string ident(yytext);
ruleparselval.id = rulecompile->findConstIdentifier(ident);
return CONST_IDENTIFIER;
}
%}
%%
[(),\[\];\{\}\#] { ruleparselval.ch = yytext[0]; return yytext[0]; }
[0-9]+ { return scan_number(yytext,&ruleparselval); }
0x[0-9a-fA-F]+ { return scan_number(yytext,&ruleparselval); }
[\r\ \t\v]+
\n { rulecompile->nextLine(); }
\-\> { return RIGHT_ARROW; }
\<\- { return LEFT_ARROW; }
\|\| { return OP_BOOL_OR; }
\&\& { return OP_BOOL_AND; }
\^\^ { return OP_BOOL_XOR; }
\>\> { return OP_INT_RIGHT; }
\<\< { return OP_INT_LEFT; }
\=\= { return OP_INT_EQUAL; }
\!\= { return OP_INT_NOTEQUAL; }
\<\= { return OP_INT_LESSEQUAL; }
s\/ { return OP_INT_SDIV; }
s\% { return OP_INT_SREM; }
s\>\> { return OP_INT_SRIGHT; }
s\< { return OP_INT_SLESS; }
s\<\= { return OP_INT_SLESSEQUAL; }
f\+ { return OP_FLOAT_ADD; }
f\- { return OP_FLOAT_SUB; }
f\* { return OP_FLOAT_MULT; }
f\/ { return OP_FLOAT_DIV; }
f\=\= { return OP_FLOAT_EQUAL; }
f\!\= { return OP_FLOAT_NOTEQUAL; }
f\< { return OP_FLOAT_LESS; }
f\<\= { return OP_FLOAT_LESSEQUAL; }
ZEXT { return OP_INT_ZEXT; }
CARRY { return OP_INT_CARRY; }
SEXT { return OP_INT_SEXT; }
SCARRY { return OP_INT_SCARRY; }
SBORROW { return OP_INT_SBORROW; }
NAN { return OP_FLOAT_NAN; }
ABS { return OP_FLOAT_ABS; }
SQRT { return OP_FLOAT_SQRT; }
CEIL { return OP_FLOAT_CEIL; }
FLOOR { return OP_FLOAT_FLOOR; }
ROUND { return OP_FLOAT_ROUND; }
INT2FLOAT { return OP_FLOAT_INT2FLOAT; }
FLOAT2FLOAT { return OP_FLOAT_FLOAT2FLOAT; }
TRUNC { return OP_FLOAT_TRUNC; }
GOTO { return OP_BRANCH; }
GOTOIND { return OP_BRANCHIND; }
CALL { return OP_CALL; }
CALLIND { return OP_CALLIND; }
RETURN { return OP_RETURN; }
CBRRANCH { return OP_CBRANCH; }
USEROP { return OP_CALLOTHER; }
LOAD { return OP_LOAD; }
STORE { return OP_STORE; }
CONCAT { return OP_PIECE; }
SUBPIECE { return OP_SUBPIECE; }
\+ { return OP_INT_ADD; }
\- { return OP_INT_SUB; }
\! { return OP_BOOL_NEGATE; }
\& { return OP_INT_AND; }
\| { return OP_INT_OR; }
\^ { return OP_INT_XOR; }
\* { return OP_INT_MULT; }
\/ { return OP_INT_DIV; }
\% { return OP_INT_REM; }
\~ { return OP_INT_NEGATE; }
\< { return OP_INT_LESS; }
o[a-zA-Z0-9_]+ { return find_op_identifier(); }
v[a-zA-Z0-9_]+ { return find_var_identifier(); }
#[a-zA-Z0-9_]+ { return find_const_identifier(); }
*/
| 26.183976
| 124
| 0.624169
|
fjqisba
|
7d1b701c9c52c0c08dbe982a77322b9a4b100356
| 263
|
cpp
|
C++
|
include-engine/utility.cpp
|
sgorsten/include-engine
|
67af882e24beba73ad44621397993e1b6818cf5b
|
[
"Unlicense"
] | 47
|
2017-03-27T12:37:02.000Z
|
2021-05-31T12:34:01.000Z
|
include-engine/utility.cpp
|
sgorsten/include-engine
|
67af882e24beba73ad44621397993e1b6818cf5b
|
[
"Unlicense"
] | 3
|
2017-03-27T12:46:28.000Z
|
2018-03-24T16:05:05.000Z
|
include-engine/utility.cpp
|
sgorsten/include-engine
|
67af882e24beba73ad44621397993e1b6818cf5b
|
[
"Unlicense"
] | 4
|
2017-09-05T11:22:40.000Z
|
2020-05-07T13:17:31.000Z
|
#include "utility.h"
/////////////////
// fail_fast() //
/////////////////
#include <Windows.h>
#include <iostream>
void fail_fast()
{
if(IsDebuggerPresent()) DebugBreak();
std::cerr << "fail_fast() called." << std::endl;
std::exit(EXIT_FAILURE);
}
| 17.533333
| 52
| 0.547529
|
sgorsten
|
7d20aaa9218edb194a674a4700ca96d0bde3c7d5
| 1,120
|
cpp
|
C++
|
source/problem0003.cpp
|
quisseh/project-euler-solutions
|
68a7d0c1c6cff7a80d6afca7f3542715ee4339eb
|
[
"MIT"
] | 1
|
2015-12-19T03:48:46.000Z
|
2015-12-19T03:48:46.000Z
|
source/problem0003.cpp
|
quisseh/project-euler-solutions
|
68a7d0c1c6cff7a80d6afca7f3542715ee4339eb
|
[
"MIT"
] | null | null | null |
source/problem0003.cpp
|
quisseh/project-euler-solutions
|
68a7d0c1c6cff7a80d6afca7f3542715ee4339eb
|
[
"MIT"
] | null | null | null |
/*
* Largest prime factor
*
* Problem 3
*
* Created by quisseh on 11/2/15.
*/
#include "problem0003.h"
/*
* A number will have at most one prime factor
* greater than its square root. So loop through
* potential prime factors of [target], and
* if one is found, reduce [target] by the current
* [factor]. If [factor] exceeds the square root of
* [target], then it is the largest prime factor.
*/
void problem0003::run() {
long target = m_target;
long factor = 2; /* Start with the smallest prime numbers. */
long lastFactor = 1;
long topFactor = (long) sqrt(target);
while (target > 0 && factor <= topFactor) {
while (target % factor == 0) { /* If [factor] is a factor of [target], */
target /= factor; /* reduce [target] by [factor]. */
lastFactor = factor;
topFactor = (long) sqrt(target); /* Get the new square root of the updated [target]. */
}
factor += factor == 2 ? 1 : 2; /* Increment [factor] by 2 once it reaches 3 so only odd numbers are checked. */
}
std::cout << ((target == 1) ? lastFactor : target);
}
| 32.941176
| 119
| 0.608036
|
quisseh
|
7d277e232f3c927894e50b38bf10455e88f25aac
| 14
|
hpp
|
C++
|
src/arrays.hpp
|
radio-rogal/c-pointers
|
a4036d0b8ee982f924463dd2fa79afcca7da9d72
|
[
"Apache-2.0"
] | null | null | null |
src/arrays.hpp
|
radio-rogal/c-pointers
|
a4036d0b8ee982f924463dd2fa79afcca7da9d72
|
[
"Apache-2.0"
] | null | null | null |
src/arrays.hpp
|
radio-rogal/c-pointers
|
a4036d0b8ee982f924463dd2fa79afcca7da9d72
|
[
"Apache-2.0"
] | null | null | null |
void arrays();
| 14
| 14
| 0.714286
|
radio-rogal
|
7d3060c0d0ec2fa7ab587beb1e24987212f8d78a
| 2,625
|
cpp
|
C++
|
Chapter10/testBSPDE1.cpp
|
alamlam1982/fincpp
|
470469d35d90fc0fde96f119e329aedbc5f68f89
|
[
"CECILL-B"
] | null | null | null |
Chapter10/testBSPDE1.cpp
|
alamlam1982/fincpp
|
470469d35d90fc0fde96f119e329aedbc5f68f89
|
[
"CECILL-B"
] | null | null | null |
Chapter10/testBSPDE1.cpp
|
alamlam1982/fincpp
|
470469d35d90fc0fde96f119e329aedbc5f68f89
|
[
"CECILL-B"
] | null | null | null |
// testBSPDE1.cpp
//
// Testing 1 factor BS model.
//
// (C) Datasim Education BV 2005
//
#include "fdmdirector.cpp"
#include "arraymechanisms.cpp"
#include <iostream>
#include <string>
using namespace std;
#include "exceldriver.cpp"
void printOneExcel(Vector<double, long> & x,
Vector<double, long>& functionResult,
string& title)
{
// N.B. Excel has a limit of 8 charts; after that you get a run-time error
cout << "Starting Excel\n";
ExcelDriver & excel = ExcelDriver::Instance();
excel.MakeVisible(true); // Default is INVISIBLE!
excel.CreateChart(x, functionResult, title, "X", "Y");
}
// Excel output as well
void printInExcel(const Vector<double, long>& x, // X array
const list<string>& labels, // Names of each vector
const list<Vector<double, long> >& functionResult) // The list of Y values
{ // Print a list of Vectors in Excel. Each vector is the output of
// a finite difference scheme for a scalar IVP
cout << "Starting Excel\n";
ExcelDriver & excel = ExcelDriver::Instance();
excel.MakeVisible(true); // Default is INVISIBLE!
// Don't make the string names too long!!
excel.CreateChart(x, labels, functionResult, string("FDM Scalar IVP"),
string("Time Axis"), string ("Value"));
}
double mySigma (double x, double t)
{
double sigmaS = 0.30 * 0.30;
return 0.5 * sigmaS * x * x;
}
double myMu (double x, double t)
{
double r = 0.06;
double D = 0.00;
return (r - D) * x;
}
double myB (double x, double t)
{
double r = 0.06;
return -r;
}
double myF (double x, double t)
{
return 0.0;
}
double myBCL (double t)
{
//return 0.0; // C
double K = 10;
double r = 0.06;
double T = 1.0;
return K * ::exp(-r * (T - t));
}
double myBCR (double t)
{
double Smax = 100;
// return Smax;
return 0.0; // P
}
double myIC (double x)
{
double K = 10;
if (x < K)
return -(x - K);
return 0.0;
}
int main()
{
using namespace BlackScholesOneFactorIBVP;
// Assignment of functions
sigma = mySigma;
mu = myMu;
b = myB;
f = myF;
BCL = myBCL;
BCR = myBCR;
IC = myIC;
double T = 1.0; int J= 200; int N = 4000-1;
double Smax = 100.0;
FDMDirector fdir(Smax, T, J, N);
fdir.Start();
L1:
fdir.doit();
// print(fdir.current());
if (fdir.isDone() == false)
goto L1;
Vector<double, long> xresult(J+1, 1);
xresult[xresult.MinIndex()] = 0.0;
double h = Smax / (double) (J);
for (long j = xresult.MinIndex()+1; j <= xresult.MaxIndex(); j++)
{
xresult[j] = xresult[j-1] + h;
}
print (xresult);
//print(fdir.current());
printOneExcel(xresult, fdir.current(), string("Value"));
return 0;
}
| 16.719745
| 79
| 0.629333
|
alamlam1982
|
7d37fd34801cbb6ed2d8a69cdc5b11c3d096f0e4
| 978
|
cpp
|
C++
|
Linux/Linux开发/code/fifo/fifo_write.cpp
|
fengjixuchui/Document-1
|
62c74d94c4f16f94f4a5e473636d3248af0c37fe
|
[
"Apache-2.0"
] | 1
|
2021-02-26T02:40:03.000Z
|
2021-02-26T02:40:03.000Z
|
Linux/Linux开发/code/fifo/fifo_write.cpp
|
fengjixuchui/Document-1
|
62c74d94c4f16f94f4a5e473636d3248af0c37fe
|
[
"Apache-2.0"
] | null | null | null |
Linux/Linux开发/code/fifo/fifo_write.cpp
|
fengjixuchui/Document-1
|
62c74d94c4f16f94f4a5e473636d3248af0c37fe
|
[
"Apache-2.0"
] | null | null | null |
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#define FIFO_NAME "/var/tmp/fifo_test"
int main()
{
int ret = 0;
int pipefd = 0;
// 判断fifo文件是否已存在
if (access(FIFO_NAME, F_OK) == -1) {
// 不存在则创建
ret = mkfifo(FIFO_NAME, 0666);
if (ret == -1) {
perror("mkfifo error");
return -1;
}
}
// 以写端打开
pipefd = open(FIFO_NAME, O_WRONLY);
printf("write open success\n");
if (pipefd == -1) {
perror("open error");
return -1;
}
char buf[BUFSIZ] = {0};
while (1) {
// 从控制台获取输入
int read_bytes = read(STDIN_FILENO, buf, BUFSIZ);
if( read_bytes == -1 ) {
perror("read error");
close(pipefd);
return -1;
}
// 写到管道
int write_bytes = write(pipefd, buf, read_bytes);
}
close(pipefd);
return 0;
}
| 16.862069
| 57
| 0.501022
|
fengjixuchui
|
7d3e7c50c315d62a9e01aa1befec07345b2ea650
| 140
|
cpp
|
C++
|
module8/quiz.cpp
|
canmenzo/CppExamples
|
e569edbedeb9ac1afec7b33602ce32014cbe2b05
|
[
"MIT"
] | null | null | null |
module8/quiz.cpp
|
canmenzo/CppExamples
|
e569edbedeb9ac1afec7b33602ce32014cbe2b05
|
[
"MIT"
] | null | null | null |
module8/quiz.cpp
|
canmenzo/CppExamples
|
e569edbedeb9ac1afec7b33602ce32014cbe2b05
|
[
"MIT"
] | null | null | null |
//quiz.cpp
#include <iostream>
using namespace std;
int main()
{
char c = 'x';
char *pC = &c;
cout << ++(*pC) << endl;
}
| 11.666667
| 26
| 0.492857
|
canmenzo
|
7d44240b68e343d7452b77f8ac30aafaa0bddca4
| 494
|
cpp
|
C++
|
flame/toSystem.cpp
|
ChaosKit/ChaosKit
|
e7cba03db1ae34160868656ea357c7166ae1d84a
|
[
"Apache-2.0"
] | 3
|
2021-01-09T17:25:18.000Z
|
2021-07-11T00:04:22.000Z
|
flame/toSystem.cpp
|
ChaosKit/ChaosKit
|
e7cba03db1ae34160868656ea357c7166ae1d84a
|
[
"Apache-2.0"
] | 1
|
2021-03-21T13:17:04.000Z
|
2021-03-21T14:03:46.000Z
|
flame/toSystem.cpp
|
ChaosKit/ChaosKit
|
e7cba03db1ae34160868656ea357c7166ae1d84a
|
[
"Apache-2.0"
] | 1
|
2020-04-03T16:32:53.000Z
|
2020-04-03T16:32:53.000Z
|
#include "toSystem.h"
namespace chaoskit::flame {
core::TransformSystem toTransformSystem(const System& system) {
return {toTransform(system), toParams(system)};
}
core::CameraSystem toCameraSystem(const System& system) {
core::CameraSystem result{toTransformSystem(system)};
auto cameraTransform = toCameraTransform(system);
if (cameraTransform) {
result.camera = {*std::move(cameraTransform), *toCameraParams(system)};
}
return result;
}
} // namespace chaoskit::flame
| 23.52381
| 75
| 0.742915
|
ChaosKit
|
7d472d0cf518b331645510c063203095f8a14064
| 1,544
|
cpp
|
C++
|
TP1/ex7.cpp
|
biromiro/feup-cal
|
d0fe01603e13729a5b91ca2758d8db5aafd2a13c
|
[
"MIT"
] | null | null | null |
TP1/ex7.cpp
|
biromiro/feup-cal
|
d0fe01603e13729a5b91ca2758d8db5aafd2a13c
|
[
"MIT"
] | null | null | null |
TP1/ex7.cpp
|
biromiro/feup-cal
|
d0fe01603e13729a5b91ca2758d8db5aafd2a13c
|
[
"MIT"
] | 2
|
2021-04-11T17:31:16.000Z
|
2021-04-27T14:04:44.000Z
|
#include "exercises.h"
#include <algorithm>
#include <vector>
#include <numeric>
double minimumAverageCompletionTime(std::vector<unsigned int> tasks, std::vector<unsigned int> &orderedTasks) {
sort(tasks.begin(), tasks.end());
/* What they want you to do
do {
permutations.push_back(tasks);
} while (std::next_permutation(tasks.begin(), tasks.end()));
double bestAverage = 99999;
for (const auto &elem: permutations) {
double average = 0;
for (size_t i = 1; i <= elem.size(); i++) {
average += std::accumulate(elem.begin(), elem.begin() + i, 0);
}
average /= elem.size();
if (bestAverage > average) {
bestAverage = average;
orderedTasks = elem;
}
}
*/
//What you can do (the exercise is just stupid, the best solution will always be the sorted vector)
double bestAverage = 0.0;
orderedTasks = tasks;
for (size_t i = 1; i <= tasks.size(); i++) {
bestAverage += std::accumulate(tasks.begin(), tasks.begin() + i, 0);
}
return bestAverage / tasks.size();
}
/// TESTS ///
#include <gtest/gtest.h>
#include <gmock/gmock.h>
TEST(TP1_Ex7, taskOrdering) {
std::vector<unsigned int> tasks = {15, 8, 3, 10};
std::vector<unsigned int> orderedTasks;
double averageTime = minimumAverageCompletionTime(tasks, orderedTasks);
EXPECT_EQ(orderedTasks.size(), 4 );
ASSERT_NEAR(averageTime, 17.75, 0.00001);
ASSERT_THAT(orderedTasks, ::testing::ElementsAre(3,8,10,15));
}
| 28.072727
| 111
| 0.619819
|
biromiro
|
7d489a715ea88a71eb316a2f9d76283ec7a3169a
| 67,258
|
cpp
|
C++
|
Visualization/JuceLibraryCode/BinaryData.cpp
|
opendragon/Core_MPlusM
|
c82bb00761551a86abe50c86e0df1f247704c848
|
[
"BSD-3-Clause"
] | null | null | null |
Visualization/JuceLibraryCode/BinaryData.cpp
|
opendragon/Core_MPlusM
|
c82bb00761551a86abe50c86e0df1f247704c848
|
[
"BSD-3-Clause"
] | null | null | null |
Visualization/JuceLibraryCode/BinaryData.cpp
|
opendragon/Core_MPlusM
|
c82bb00761551a86abe50c86e0df1f247704c848
|
[
"BSD-3-Clause"
] | null | null | null |
/* ==================================== JUCER_BINARY_RESOURCE ====================================
This is an auto-generated file: Any edits you make may be overwritten!
*/
namespace BinaryData
{
//================== PDOicon.ico ==================
static const unsigned char temp_binary_data_0[] =
{ 0,0,1,0,4,0,16,16,0,0,1,0,32,0,40,5,0,0,70,0,0,0,32,32,0,0,1,0,32,0,40,20,0,0,110,5,0,0,48,48,0,0,1,0,32,0,40,45,0,0,150,25,0,0,0,0,0,0,1,0,32,0,90,29,0,0,190,70,0,0,40,0,0,0,16,0,0,0,32,0,0,0,1,0,32,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,36,7,0,154,0,28,0,127,0,2,0,156,0,26,0,141,0,9,0,135,0,17,0,145,12,21,0,147,13,19,0,150,11,22,0,
145,36,7,0,148,0,31,0,85,0,3,0,158,0,29,0,127,0,10,0,0,0,0,0,0,0,0,0,154,5,48,1,162,0,190,14,141,0,18,1,159,1,179,4,153,0,63,0,153,0,116,1,152,0,142,0,154,0,122,1,157,0,136,0,144,11,44,1,154,1,198,14,141,0,18,1,159,1,185,4,152,4,62,0,0,0,0,0,0,0,0,0,
147,0,52,1,161,1,202,15,111,0,16,1,156,0,191,3,156,0,70,0,156,0,39,0,153,0,53,0,153,0,45,0,151,0,47,0,148,5,48,1,154,0,208,17,119,0,15,1,158,1,196,3,150,0,66,0,0,0,0,0,0,0,0,0,153,0,50,1,160,0,223,0,144,0,53,0,158,0,208,2,157,0,110,0,156,2,101,2,154,
2,101,0,154,0,86,1,158,0,130,0,152,0,77,1,156,0,232,0,153,0,58,1,159,1,208,3,151,0,64,0,0,0,0,0,0,0,0,0,151,0,37,1,159,1,166,1,153,0,164,1,158,0,175,1,153,1,141,0,157,0,197,3,153,0,68,0,154,0,94,1,156,0,168,1,157,0,178,1,156,0,147,1,154,0,163,1,158,0,
167,14,155,0,18,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,127,0,4,0,0,0,1,0,0,0,0,0,127,0,6,0,0,0,0,0,0,0,1,0,0,0,0,0,153,0,5,0,0,0,0,0,170,0,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,0,0,0,32,0,0,0,64,0,0,0,1,0,32,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,5,47,0,158,
0,77,0,155,0,36,0,0,0,0,0,0,0,1,0,153,0,58,0,154,0,76,0,148,0,24,0,0,0,0,0,127,31,8,0,151,0,69,0,155,0,72,0,139,0,11,0,127,0,2,0,153,0,68,0,158,0,79,0,147,0,19,0,0,0,0,0,127,0,12,0,155,0,77,3,153,0,73,28,141,0,9,0,0,0,0,0,153,0,25,0,158,0,82,4,153,0,
63,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,157,9,162,1,170,1,255,4,155,0,126,0,0,0,0,0,85,85,3,0,155,3,203,2,165,0,255,9,156,0,83,0,0,0,0,0,140,17,29,0,157,2,239,1,157,0,248,6,154,0,38,0,95,31,8,0,156,2,221,2,163,1,255,7,155,0,64,0,0,0,0,0,
147,20,38,0,156,0,250,2,159,0,237,16,148,0,31,0,0,0,0,0,157,9,81,2,165,3,255,2,156,0,205,63,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155,3,162,2,166,2,255,4,155,0,125,0,0,0,0,0,127,127,2,0,154,3,202,2,163,1,255,9,155,0,82,0,0,0,0,0,149,17,29,
0,155,0,249,2,158,0,255,6,146,0,40,0,109,36,7,0,156,2,227,2,164,3,255,3,150,0,66,0,0,0,0,0,151,20,37,0,155,0,248,2,156,0,236,17,144,0,30,0,0,0,0,0,156,15,80,2,163,1,255,2,153,0,203,63,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,3,161,2,166,
2,255,4,155,0,125,0,0,0,0,0,127,127,2,0,154,3,201,2,163,1,255,9,155,0,82,0,0,0,0,0,135,30,17,0,153,1,143,1,155,0,149,0,144,11,23,0,127,63,4,0,155,0,131,1,156,1,153,6,151,0,37,0,0,0,0,0,151,20,37,0,155,0,247,2,156,0,235,17,144,0,30,0,0,0,0,0,156,15,80,
2,163,1,255,2,154,0,202,63,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,3,161,2,166,2,255,4,155,0,125,0,0,0,0,0,127,127,2,0,154,3,201,2,163,1,255,3,155,0,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,
20,37,0,155,0,247,2,156,0,235,17,144,0,30,0,0,0,0,0,156,15,80,2,163,1,255,2,154,0,202,63,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,3,161,1,167,2,255,3,155,0,133,0,0,0,0,0,0,255,1,1,156,3,201,2,164,1,255,8,156,0,91,0,0,0,0,0,139,0,11,2,153,
0,103,4,154,0,107,15,135,0,17,0,85,0,3,2,154,0,94,4,156,2,111,17,153,0,30,0,0,0,0,0,155,21,36,1,155,0,248,1,158,0,240,14,155,0,36,0,0,0,0,0,156,9,80,2,163,1,255,2,154,0,202,63,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,3,161,2,164,0,255,2,
157,2,197,31,143,0,16,0,153,12,20,1,156,0,223,2,164,1,255,3,155,0,167,42,127,0,6,4,156,8,57,1,159,1,254,1,156,0,252,15,150,0,34,0,127,31,8,0,156,2,223,1,167,2,255,3,155,0,146,0,109,0,7,3,150,7,71,1,156,0,253,2,161,2,255,4,153,0,111,0,127,0,6,2,156,6,
119,2,164,0,255,3,155,0,197,255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,4,166,2,165,0,255,2,157,2,239,1,158,0,215,1,158,0,209,2,162,2,255,1,156,3,241,1,157,0,230,1,161,0,207,1,158,0,224,2,165,3,255,2,155,2,203,31,127,0,8,0,127,0,10,0,157,
2,225,2,160,2,255,1,156,0,236,1,160,0,208,1,157,0,231,2,163,1,255,1,158,0,222,1,156,0,234,1,160,0,205,1,156,0,245,2,166,0,255,3,155,0,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,157,0,110,1,164,0,175,3,155,0,77,1,158,1,140,1,159,1,214,1,160,
1,191,0,156,3,75,0,154,11,43,1,161,1,175,1,158,0,217,1,158,0,175,5,154,0,48,0,0,0,0,0,127,0,8,1,158,0,143,1,158,0,154,4,153,0,63,1,158,0,167,1,158,0,209,1,159,1,165,14,153,0,35,0,153,6,73,1,161,1,188,1,159,0,205,3,157,0,141,14,155,0,18,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,6,0,85,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,145,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,4,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,0,0,0,48,0,0,0,96,0,0,0,1,0,32,0,0,0,0,0,0,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,11,23,0,153,0,120,0,155,0,121,2,153,0,115,0,127,0,14,0,0,0,0,0,0,0,0,0,0,0,2,0,151,5,99,0,155,0,121,0,155,0,121,5,144,0,44,0,0,0,0,0,0,0,0,0,0,0,0,0,150,7,71,0,158,0,121,0,158,0,121,6,149,0,75,0,0,0,0,0,0,0,0,0,144,
0,46,0,158,0,132,0,156,0,132,2,153,0,110,0,85,0,3,0,0,0,0,0,0,0,0,0,127,0,14,0,152,0,124,0,156,0,132,1,153,0,131,19,137,0,26,0,0,0,0,0,0,0,0,0,0,0,1,0,150,5,100,0,158,0,132,0,160,0,132,4,149,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,145,20,51,2,161,5,255,2,165,3,255,2,155,0,252,16,148,0,31,0,0,0,0,0,0,0,0,0,63,63,4,0,153,6,219,2,166,2,255,3,168,2,255,10,148,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,153,6,155,2,169,2,255,2,169,2,255,4,154,0,165,0,0,0,0,0,0,0,0,0,149,2,92,2,168,5,
255,2,166,2,255,2,153,0,222,42,85,0,6,0,0,0,0,0,0,0,0,0,140,17,29,0,154,1,250,2,165,3,255,4,161,2,255,14,137,0,52,0,0,0,0,0,0,0,0,0,0,127,2,0,154,3,201,2,168,2,255,2,169,2,255,6,152,0,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,145,5,49,0,153,1,253,2,158,0,255,2,154,0,242,17,144,0,30,0,0,0,0,0,0,0,0,0,63,63,4,0,153,4,210,2,159,2,255,3,161,2,255,11,149,0,92,0,0,0,0,0,0,0,0,0,0,0,0,0,150,5,149,2,162,2,255,2,162,2,255,4,153,1,158,0,0,0,0,0,0,0,0,0,147,5,88,2,161,5,255,2,159,
2,255,3,152,0,213,42,85,0,6,0,0,0,0,0,0,0,0,0,136,18,28,0,153,1,240,2,158,0,255,2,153,0,253,15,142,0,50,0,0,0,0,0,0,0,0,0,0,127,2,0,151,1,193,2,161,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,
49,0,153,1,253,2,158,0,255,2,154,0,242,17,144,0,30,0,0,0,0,0,0,0,0,0,63,63,4,0,153,4,210,2,159,2,255,3,161,2,255,11,149,0,92,0,0,0,0,0,0,0,0,0,0,0,0,0,152,8,152,2,165,3,255,2,165,3,255,4,153,1,161,0,0,0,0,0,0,0,0,0,147,2,90,2,164,4,255,2,162,2,255,3,
152,0,218,42,85,0,6,0,0,0,0,0,0,0,0,0,136,18,28,0,153,1,240,2,158,0,255,2,153,0,253,15,142,0,50,0,0,0,0,0,0,0,0,0,0,127,2,0,151,1,193,2,161,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,
1,253,2,158,0,255,2,154,0,242,17,144,0,30,0,0,0,0,0,0,0,0,0,63,63,4,0,153,4,210,2,159,2,255,3,161,2,255,11,149,0,92,0,0,0,0,0,0,0,0,0,0,0,0,2,152,4,122,1,161,1,209,1,161,1,209,9,152,1,129,0,0,0,0,0,0,0,0,0,148,7,72,1,159,1,209,1,156,0,209,4,153,1,174,
51,51,0,5,0,0,0,0,0,0,0,0,0,136,18,28,0,153,1,240,2,158,0,255,2,153,0,253,15,142,0,50,0,0,0,0,0,0,0,0,0,0,127,2,0,151,1,193,2,161,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,158,
0,255,2,154,0,242,17,144,0,30,0,0,0,0,0,0,0,0,0,63,63,4,0,153,4,210,2,159,2,255,3,161,2,255,11,149,0,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,85,0,3,0,85,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,85,0,3,0,85,0,3,0,85,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,136,18,28,0,
153,1,240,2,158,0,255,2,153,0,253,15,142,0,50,0,0,0,0,0,0,0,0,0,0,127,2,0,151,1,193,2,161,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,158,0,255,2,154,0,242,17,144,0,30,0,0,0,0,
0,0,0,0,0,63,63,4,0,153,4,210,2,159,2,255,3,162,2,255,8,153,0,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,136,18,28,0,153,1,240,2,158,0,255,2,155,0,254,15,145,0,
51,0,0,0,0,0,0,0,0,0,0,127,2,0,151,1,193,2,161,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,158,0,255,2,154,1,246,21,145,0,35,0,0,0,0,0,0,0,0,0,63,63,4,0,153,1,211,2,159,2,255,
2,162,2,255,7,152,5,102,0,0,0,0,0,0,0,0,0,0,0,0,0,139,11,22,0,154,0,38,0,154,0,38,0,144,0,23,0,0,0,0,0,0,0,0,0,137,0,13,0,147,6,38,0,151,0,37,0,146,0,33,0,0,0,1,0,0,0,0,0,0,0,0,0,145,18,28,0,154,1,240,2,158,0,255,4,157,0,255,12,151,0,59,0,0,0,0,0,0,0,
0,0,0,0,1,0,152,1,194,2,160,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,157,0,255,1,157,0,254,12,151,0,59,0,0,0,0,0,0,0,0,0,127,42,6,1,153,4,217,2,159,2,255,2,163,1,255,9,153,
0,138,0,0,0,0,0,0,0,0,0,0,0,0,1,153,6,154,1,161,1,247,1,161,1,247,6,153,5,153,0,0,0,0,0,0,0,0,3,147,9,85,1,160,1,247,1,156,0,247,3,154,0,232,20,142,0,25,0,0,0,0,0,0,0,0,0,146,7,33,1,154,1,246,2,157,0,255,3,161,2,255,5,151,0,94,0,0,0,0,0,0,0,0,0,0,0,1,
1,151,5,203,2,160,2,255,2,162,2,255,9,152,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,157,0,255,2,161,2,255,4,153,0,164,0,63,0,4,0,0,0,0,0,151,20,37,0,155,0,242,2,157,0,255,2,159,2,255,2,154,0,223,15,
143,0,32,0,0,0,0,0,102,51,5,0,154,1,206,2,161,2,255,2,164,1,255,6,152,0,147,0,0,0,0,0,0,0,0,0,147,5,88,2,162,5,255,2,157,0,255,2,161,2,255,5,154,1,130,255,0,0,1,0,0,0,0,0,151,9,81,0,159,0,254,2,156,1,255,2,160,2,255,3,153,0,198,14,155,0,18,0,0,0,0,0,
146,30,33,0,154,1,236,2,157,0,255,3,162,2,255,10,151,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,5,49,0,153,1,253,2,157,0,255,2,156,1,255,2,162,2,255,3,153,0,196,1,151,0,148,0,154,1,211,2,159,2,255,2,156,1,255,2,158,0,255,
2,162,2,255,1,155,0,225,1,153,0,151,0,153,0,189,2,158,0,255,2,156,1,255,3,163,1,255,7,150,0,98,0,0,0,0,0,0,0,0,0,147,5,88,2,161,5,255,2,156,1,255,3,156,4,255,3,160,2,255,2,153,0,189,1,153,1,161,0,153,1,233,2,158,0,255,2,157,0,255,3,157,3,255,2,162,2,
255,1,155,0,216,1,154,0,160,0,153,1,215,2,158,0,255,2,157,0,255,2,156,0,254,14,147,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,145,20,51,2,160,6,255,2,166,2,255,5,155,0,216,3,153,1,168,2,167,2,255,2,167,2,255,2,162,2,255,2,
160,2,255,2,164,1,255,3,152,0,149,3,153,7,131,2,162,5,255,2,168,2,255,2,163,1,255,2,160,2,255,2,165,3,255,3,153,1,199,17,136,0,15,0,0,0,0,0,0,0,0,0,149,2,92,2,168,5,255,2,167,2,255,5,155,2,185,0,154,1,183,2,168,2,255,2,167,2,255,2,161,2,255,2,162,2,255,
1,158,0,254,9,149,0,109,1,153,1,154,2,165,3,255,2,167,2,255,2,162,2,255,2,161,2,255,2,164,1,255,4,153,1,154,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,17,30,1,153,1,154,1,157,0,155,6,154,0,119,0,63,0,4,2,153,2,100,0,
157,2,188,0,156,0,214,1,158,0,196,4,153,0,113,0,102,0,5,0,0,0,1,0,152,6,82,0,158,0,180,0,156,0,214,1,156,0,202,3,156,0,137,0,150,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,147,5,50,1,159,0,144,1,161,0,144,3,154,0,84,0,127,0,8,2,153,4,111,0,155,0,188,0,156,0,205,
1,157,0,176,3,151,0,79,0,0,0,0,0,0,0,2,0,151,0,94,1,156,0,181,0,156,0,205,2,157,0,185,4,153,0,106,0,127,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,6,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,6,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,1,0,0,0,1,0,8,6,0,0,0,92,114,
168,102,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,29,20,73,68,65,84,120,1,237,221,11,124,21,213,157,7,240,115,102,238,220,103,114,115,3,33,33,144,240,136,81,20,16,20,148,181,128,149,186,213,138,173,186,171,27,124,180,86,219,186,90,45,214,23,85,171,221,
221,208,79,235,123,165,64,17,80,91,93,235,174,214,104,125,176,104,125,84,176,162,86,1,121,40,85,121,9,129,64,222,239,251,156,199,217,115,38,92,26,66,66,114,103,230,222,220,116,127,243,249,132,203,189,153,57,243,159,239,57,231,63,103,230,206,76,8,193,
4,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,
0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,
128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,
32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,
8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,
2,16,128,0,4,32,144,65,1,154,193,117,13,202,170,24,97,116,225,156,133,242,147,115,42,93,163,75,103,41,49,45,38,121,93,94,227,189,240,123,137,57,127,168,212,215,174,253,15,157,16,202,6,35,184,74,194,164,170,138,201,174,17,115,136,123,20,157,170,212,203,
95,24,245,237,251,181,173,213,117,90,197,82,166,85,17,98,116,197,53,56,241,13,134,73,255,235,100,221,218,172,112,17,239,179,193,135,209,74,30,8,255,225,49,37,227,201,150,216,250,86,237,134,217,247,76,67,233,55,66,255,252,123,202,11,190,8,53,76,77,200,
198,180,118,119,236,36,201,144,203,91,89,108,152,68,37,47,161,68,162,6,211,117,194,98,62,234,107,97,18,249,210,173,230,108,215,136,178,181,168,125,220,150,171,22,188,183,175,146,208,67,29,207,217,45,23,201,104,214,227,19,199,84,107,7,167,235,114,252,
244,184,100,28,223,201,212,178,4,97,185,110,162,184,53,170,25,18,99,9,141,209,120,158,228,175,139,80,163,58,168,6,118,81,67,218,154,171,143,250,228,170,249,31,167,45,54,103,183,212,126,105,194,234,107,75,74,70,87,187,58,79,140,83,114,60,239,83,229,53,
158,206,188,128,68,125,58,147,36,157,26,154,206,88,164,48,81,216,146,32,209,93,9,61,103,87,81,100,212,142,105,183,125,116,160,138,80,158,212,211,55,173,188,246,90,229,177,83,222,44,171,149,106,39,73,146,255,248,6,169,101,172,230,162,65,63,83,220,113,
170,243,182,165,71,117,141,36,10,244,145,181,81,35,82,29,32,161,221,193,104,222,142,43,110,221,124,48,93,109,203,234,214,166,53,1,220,114,75,137,239,245,73,234,229,181,84,13,41,134,148,90,167,146,120,151,164,33,35,247,224,21,85,159,221,125,207,193,254,
54,240,202,5,83,2,27,202,247,157,213,226,234,172,104,99,250,217,113,153,141,38,50,149,197,114,134,88,115,114,31,47,94,249,86,139,95,232,60,81,75,82,23,129,193,155,140,196,164,6,15,11,188,155,163,142,248,125,110,219,37,175,239,190,243,254,54,62,155,237,
233,242,149,39,20,124,204,26,206,107,86,34,23,183,18,117,182,46,145,17,68,226,113,137,88,186,255,28,170,13,51,54,137,199,70,187,62,48,155,179,65,27,101,18,252,48,79,43,120,33,167,233,164,87,191,188,251,149,58,219,129,13,160,128,27,151,148,123,94,243,
69,79,141,40,204,180,28,192,34,71,204,66,245,225,70,205,190,75,182,144,202,202,200,17,191,232,229,141,153,32,151,20,149,29,148,99,115,219,189,241,111,68,153,122,122,76,98,5,28,66,22,94,135,235,176,151,101,137,198,52,131,200,45,126,226,249,216,167,230,
173,14,24,101,171,171,111,120,119,15,175,236,212,218,93,111,101,155,171,174,148,78,95,254,196,212,58,185,225,155,45,146,122,94,130,232,147,53,153,228,153,113,29,90,70,172,72,132,121,196,196,235,151,25,76,101,134,212,236,39,222,45,138,145,247,102,94,172,
244,213,234,31,255,229,115,167,98,59,98,125,41,190,57,212,228,82,92,106,128,179,223,117,83,97,209,211,39,54,110,222,151,75,70,166,156,147,121,231,116,105,57,100,84,211,117,103,236,249,201,67,31,246,181,202,27,111,44,15,174,61,233,192,101,7,60,137,107,
90,136,62,157,184,168,36,58,179,57,8,19,157,43,133,73,12,216,36,23,227,251,15,137,200,70,206,38,79,98,220,210,188,29,119,63,187,127,209,188,104,10,197,28,158,181,226,129,17,35,255,154,215,118,245,126,89,255,65,135,204,202,13,161,157,140,237,240,92,3,
251,143,57,240,229,93,80,52,48,69,245,236,244,26,133,143,106,123,167,62,21,190,39,189,137,224,142,251,38,141,121,58,255,179,141,53,94,22,76,185,43,241,96,189,250,240,246,9,29,183,207,220,124,211,237,59,250,218,82,70,42,165,51,22,47,158,185,39,39,254,
125,62,82,187,64,85,72,129,153,28,133,149,88,104,32,245,200,103,20,179,73,50,255,151,39,78,67,147,235,21,173,232,185,220,142,9,203,155,23,188,101,185,179,49,126,232,120,218,188,7,190,81,163,36,174,171,167,198,63,18,133,248,197,14,197,180,24,72,92,34,
254,67,177,137,189,142,216,223,80,85,106,115,147,130,87,130,177,209,203,234,230,111,216,192,63,225,91,58,56,211,81,9,203,201,48,220,138,232,134,44,198,18,252,95,53,245,31,62,196,139,73,84,237,53,131,51,82,33,159,190,204,127,193,51,167,236,121,99,91,32,
182,178,73,50,78,231,93,87,18,235,73,169,114,186,109,176,25,173,202,27,15,111,125,9,185,253,212,176,255,211,223,214,78,188,254,229,162,135,207,63,153,71,111,182,197,110,179,247,249,95,86,241,156,60,117,121,224,202,53,195,90,214,126,230,213,238,109,147,
88,57,19,141,89,227,63,3,109,52,61,74,23,203,137,229,25,255,137,203,177,242,14,207,190,7,226,227,215,174,41,92,62,229,146,10,98,109,239,220,99,21,189,190,141,52,31,20,99,109,153,15,151,220,196,72,237,135,111,179,91,55,84,183,228,226,89,181,143,105,238,
146,49,19,75,86,254,242,201,77,57,173,127,170,115,197,190,199,135,251,5,102,29,38,173,250,92,178,71,129,194,135,255,48,141,154,109,141,16,173,80,245,30,152,223,28,122,239,157,188,21,19,238,152,94,89,233,239,177,196,49,223,138,209,200,153,75,134,207,40,
249,206,47,94,217,234,142,190,82,171,24,23,240,22,224,55,99,19,221,117,160,113,137,181,28,138,205,172,63,222,62,249,225,75,94,84,169,191,178,206,183,101,141,119,249,216,21,161,135,46,30,123,204,96,210,248,203,180,38,128,116,197,253,195,7,139,10,143,95,
241,218,146,205,222,216,139,141,146,241,15,150,42,165,159,224,168,206,27,146,198,136,225,110,62,167,33,248,231,63,142,122,108,214,133,188,38,251,245,186,246,190,81,99,142,63,247,187,79,125,230,137,62,213,40,27,19,14,39,164,126,214,151,202,175,41,31,74,
136,68,160,185,58,78,106,84,182,61,187,122,249,201,11,167,175,100,74,42,101,12,116,222,214,246,230,132,193,207,75,152,243,139,70,159,250,143,88,226,168,105,3,63,142,158,188,60,231,199,239,5,246,191,93,227,213,175,84,9,117,83,145,188,123,157,251,168,197,
251,253,128,242,222,42,202,35,52,94,208,225,219,121,207,199,197,143,61,119,220,178,239,149,246,187,32,159,225,65,126,56,57,249,145,192,191,109,14,52,191,89,227,50,230,106,148,74,162,243,166,212,233,143,177,34,51,153,139,216,136,225,75,4,246,95,19,9,189,
245,250,176,135,206,61,135,175,96,192,59,153,99,20,159,210,175,250,109,208,41,149,150,129,153,191,190,36,116,234,170,252,166,85,187,253,145,27,120,157,200,233,30,60,49,49,34,144,195,163,26,164,245,79,143,88,122,222,85,188,146,250,56,22,102,244,188,135,
242,103,175,46,168,95,189,219,147,184,66,229,13,57,221,177,153,73,138,50,87,196,247,217,221,187,61,37,139,175,126,226,9,111,6,170,192,246,42,42,126,81,50,122,222,140,39,158,218,238,141,44,110,39,164,200,236,168,14,117,252,158,193,137,68,32,146,48,243,
29,248,102,157,103,213,203,99,23,221,124,82,207,121,186,191,191,226,222,162,178,101,19,62,127,110,135,63,182,176,131,208,160,147,29,191,251,122,196,255,205,17,11,79,173,9,87,199,132,182,208,186,170,81,143,77,159,87,57,128,157,76,207,114,236,188,31,82,
9,96,238,131,242,5,235,3,29,175,240,172,60,195,220,39,165,169,209,244,4,21,29,77,165,90,78,131,239,207,191,30,255,232,89,151,244,204,212,162,175,127,237,215,197,21,235,134,181,189,88,35,27,147,51,25,155,57,188,212,25,105,161,7,175,127,41,113,239,67,100,
122,122,70,2,61,77,172,190,255,206,125,161,169,239,140,172,91,181,71,209,47,19,7,119,78,237,241,251,139,135,38,40,233,116,53,157,122,32,240,236,243,211,150,221,80,222,219,252,115,151,140,59,227,141,194,166,213,123,20,245,124,53,121,8,210,219,140,14,127,
70,249,97,139,46,69,243,26,148,45,143,255,246,145,153,71,181,47,135,87,119,68,113,217,159,0,36,126,58,156,79,179,238,147,231,125,148,111,252,55,63,158,46,49,179,242,17,155,145,254,55,98,216,77,164,152,255,75,233,227,101,69,15,94,62,35,185,70,30,156,52,
247,65,242,253,77,190,186,39,59,9,41,72,247,94,63,185,222,35,94,69,6,226,135,43,173,238,47,127,148,119,245,172,91,120,130,202,202,122,189,168,210,55,115,77,126,219,43,245,46,253,84,177,87,118,106,72,125,132,197,49,222,152,29,205,83,55,241,115,229,165,
39,74,42,31,30,214,125,214,75,31,32,231,110,242,85,255,129,31,82,158,40,230,203,244,36,218,151,106,24,57,213,238,79,31,13,61,116,201,153,153,90,127,86,54,148,238,27,31,72,228,199,207,127,128,124,235,243,2,227,241,38,153,230,14,74,7,59,20,144,168,36,201,
21,46,104,10,173,91,82,182,242,185,60,209,239,206,95,20,188,252,131,124,250,235,86,74,125,41,159,37,239,190,161,118,255,47,14,31,13,141,116,122,183,222,85,250,240,15,166,217,45,206,201,229,101,18,138,95,250,115,114,250,134,81,177,223,215,120,232,152,
193,72,224,201,237,17,135,116,49,79,237,236,230,145,79,252,124,14,97,46,241,249,229,247,122,207,94,151,79,158,174,117,145,226,193,111,95,157,161,104,238,95,22,141,185,247,145,252,100,204,233,124,205,238,4,192,168,26,12,172,251,250,250,124,250,216,96,
119,254,100,37,136,179,204,154,114,112,70,189,246,171,155,231,174,56,225,236,117,161,240,210,54,137,122,7,181,243,31,10,78,28,239,234,74,56,175,193,255,238,194,73,21,204,157,140,121,48,95,117,201,149,40,78,188,61,229,253,17,228,127,106,220,116,80,70,
111,61,183,223,224,163,165,136,178,243,218,45,139,42,206,169,88,122,226,201,111,23,170,79,214,184,164,17,131,217,249,147,49,138,246,165,122,106,167,53,6,159,190,41,19,35,185,62,78,104,37,195,177,247,58,103,102,78,96,211,176,240,191,182,185,104,40,245,
99,61,126,22,151,168,174,102,121,239,217,45,178,17,50,135,224,246,194,113,110,105,198,136,46,31,156,86,79,155,47,110,167,198,176,108,138,77,56,107,82,251,120,54,114,253,134,200,31,183,111,183,187,209,83,79,35,129,157,69,228,250,136,66,115,82,173,67,113,
29,19,53,116,169,222,179,251,236,58,37,49,94,156,75,201,134,73,180,44,34,105,178,172,212,78,171,149,234,254,165,78,49,202,179,161,243,39,109,248,87,144,68,163,29,19,61,51,14,190,164,175,249,176,57,249,121,58,94,179,122,4,192,207,17,201,157,178,230,17,
123,182,108,154,68,60,6,213,131,252,124,196,240,108,234,252,166,145,176,114,105,174,86,255,39,243,167,15,246,9,65,30,11,165,170,175,153,182,151,102,155,147,136,39,44,181,156,84,171,104,19,7,243,144,164,183,118,45,98,99,158,246,66,87,193,186,107,210,61,
10,200,234,4,112,184,65,247,166,212,227,51,209,238,197,17,29,229,223,134,83,241,154,252,225,239,197,231,226,247,142,78,162,113,243,189,237,64,39,198,207,101,30,142,141,143,187,146,241,153,177,57,93,11,252,66,21,157,212,157,217,116,233,143,38,13,52,190,
116,205,39,174,153,25,112,2,23,117,200,45,76,19,81,143,162,238,146,245,231,180,209,161,184,82,58,116,19,241,241,186,59,220,206,186,199,230,116,251,226,223,236,36,228,234,138,227,42,31,42,72,87,221,136,114,121,215,24,218,19,19,151,126,138,33,157,46,213,
249,53,207,70,126,129,253,150,124,150,191,175,73,110,234,204,35,185,10,53,194,37,252,166,160,73,81,22,159,25,151,105,137,121,25,103,10,29,215,174,142,104,44,50,31,250,82,67,249,194,173,121,62,240,51,255,167,113,89,109,164,252,2,73,191,238,42,140,73,241,
83,162,114,98,150,42,147,113,78,197,38,58,28,117,39,252,109,254,77,231,240,248,55,219,221,134,180,47,207,51,41,117,241,152,53,202,24,147,246,42,186,180,51,96,248,106,162,180,35,28,36,126,111,140,196,75,98,84,43,231,140,101,26,79,4,153,30,174,139,164,
36,241,31,126,52,19,86,24,253,34,87,207,221,149,96,225,38,225,226,165,210,168,118,170,158,168,49,189,220,224,151,161,59,53,154,16,59,23,93,110,29,215,22,90,35,190,113,250,223,116,213,193,208,77,0,162,209,200,148,200,106,238,231,10,191,46,190,184,101,
220,11,223,189,243,205,253,149,188,171,69,72,215,125,39,49,18,51,221,196,101,157,231,223,95,50,122,103,126,219,117,251,165,240,205,81,137,31,207,246,122,129,177,115,204,93,95,196,81,226,209,188,107,130,122,225,242,49,45,231,188,177,241,206,149,237,145,
110,227,6,126,17,12,63,218,99,244,162,95,149,21,254,213,91,255,237,122,37,178,160,93,166,142,156,137,54,248,6,170,114,231,87,230,240,253,213,90,243,34,98,231,182,205,201,146,68,130,36,154,187,221,23,207,123,41,72,66,207,134,26,75,63,58,121,211,117,173,
147,170,42,88,37,231,17,53,185,176,114,33,125,157,84,133,162,197,53,95,173,165,157,183,214,43,198,153,76,212,95,186,19,57,223,175,136,219,201,168,46,127,25,136,135,158,25,22,31,251,188,254,229,248,207,175,89,244,92,92,196,198,35,32,29,252,231,156,59,
78,11,214,140,175,153,213,194,26,175,111,144,140,111,117,141,122,196,111,109,76,98,200,170,24,52,234,110,156,205,75,73,91,2,112,122,224,114,196,22,87,46,40,42,252,237,113,245,31,86,123,232,56,39,59,156,24,78,243,118,29,243,233,165,139,71,55,126,243,63,
119,222,181,164,145,87,83,191,205,65,116,182,89,75,67,23,127,18,232,248,77,7,35,121,253,47,113,196,230,12,248,141,24,149,184,13,127,45,77,28,247,243,11,223,254,217,111,170,170,230,117,93,74,219,79,9,151,221,175,156,246,65,174,246,204,94,31,181,125,82,
138,201,6,81,180,209,159,158,176,105,209,87,182,61,50,143,95,162,96,109,186,242,135,164,240,143,39,147,173,13,62,169,200,201,58,20,213,197,120,239,242,104,35,94,246,118,158,250,139,182,91,87,127,204,235,176,223,180,252,224,149,231,6,86,206,126,231,190,
47,21,117,254,225,187,41,173,109,218,49,151,50,219,152,33,199,253,90,233,227,197,225,210,251,119,221,246,206,254,254,218,152,184,7,228,180,179,174,186,105,167,55,246,203,54,202,191,25,234,183,69,30,51,4,62,42,98,196,31,41,123,125,238,178,157,23,86,109,
163,3,106,67,199,46,241,232,223,242,129,205,208,154,204,99,105,73,110,41,72,204,250,94,244,218,93,119,239,188,107,105,67,127,21,147,220,66,113,212,254,222,141,173,127,152,18,245,45,244,242,27,239,147,159,59,249,106,30,146,196,242,119,23,54,206,190,40,
126,253,150,21,3,237,252,34,134,103,239,80,55,156,213,145,251,237,17,6,171,183,125,206,130,119,37,77,15,23,199,70,109,207,200,247,201,169,24,50,222,51,248,229,245,137,225,177,201,119,79,94,121,160,162,237,214,87,197,29,113,253,118,126,177,142,159,252,
238,141,240,203,111,93,120,91,89,66,121,190,235,102,239,84,214,60,176,121,205,206,175,251,154,134,37,166,93,25,249,225,238,155,118,221,246,231,125,3,105,99,180,106,158,190,97,126,244,87,51,162,174,59,249,125,112,186,56,50,181,51,137,4,151,144,98,99,55,
126,235,45,159,157,114,142,181,236,208,74,0,34,165,50,111,172,56,50,103,126,227,245,107,126,207,43,69,140,182,82,154,68,18,88,188,37,111,101,169,42,175,239,235,170,254,148,10,236,54,115,215,94,35,183,182,52,60,231,178,253,119,188,254,209,64,26,77,183,
197,205,255,254,215,29,237,235,203,99,202,34,55,31,122,218,153,248,118,242,91,99,213,32,203,109,25,107,167,28,199,151,53,235,80,54,134,169,167,220,117,246,13,155,238,223,184,209,188,19,32,165,213,76,170,170,74,204,109,31,125,87,129,198,234,108,39,202,
30,107,22,201,73,98,238,54,127,203,236,171,155,111,248,136,63,148,41,181,54,198,251,188,241,198,147,83,30,57,62,33,191,104,187,125,137,36,238,234,40,32,227,87,21,246,8,211,177,183,67,42,1,240,83,44,36,20,153,248,224,129,27,222,124,206,74,231,74,170,157,
246,232,129,200,216,68,224,73,183,205,12,157,44,207,124,53,27,182,59,17,108,255,234,130,125,11,94,224,123,52,107,19,15,137,205,14,143,169,10,170,164,217,110,227,54,40,83,246,70,182,23,89,139,36,61,75,137,243,54,57,234,228,21,141,215,109,88,108,231,201,
61,139,111,223,189,107,116,220,253,162,228,228,89,44,209,249,197,147,32,162,103,252,123,228,246,215,87,91,21,160,27,55,170,83,59,131,143,230,240,135,148,88,45,35,185,28,31,71,4,91,107,235,134,39,223,59,253,58,100,18,128,24,90,203,90,225,167,165,53,183,
46,226,157,223,54,236,164,176,242,118,126,130,180,216,237,100,201,10,97,252,44,182,47,86,246,242,241,79,175,178,149,156,68,121,15,220,94,178,119,36,147,54,154,143,45,74,174,32,213,87,190,97,212,21,35,197,5,181,105,107,60,41,135,196,207,221,176,248,240,
29,35,171,249,77,111,54,235,80,236,105,167,104,161,231,253,170,120,210,130,51,147,216,99,123,227,227,94,45,125,103,237,10,59,59,24,17,205,140,206,49,235,71,232,174,157,93,39,131,173,197,39,246,41,84,9,43,133,69,109,121,214,74,232,127,169,33,147,0,36,
158,155,125,241,9,143,125,114,223,21,173,253,111,86,255,115,252,180,120,238,126,89,114,29,60,250,25,78,253,47,123,212,28,98,36,145,240,196,115,195,51,22,91,25,210,30,85,30,89,107,132,248,163,173,236,30,67,242,230,67,58,98,185,71,220,244,114,244,186,50,
247,9,127,38,35,241,171,19,86,236,188,247,167,252,164,173,253,105,124,75,209,23,126,74,27,28,73,226,162,14,53,119,60,24,157,242,240,182,42,251,39,220,110,174,12,117,6,117,105,155,189,246,197,131,162,148,198,104,48,109,117,56,36,18,128,121,210,72,11,213,
140,104,61,231,69,187,153,57,217,236,138,190,251,187,120,113,92,175,179,223,201,248,152,157,143,78,188,198,200,191,4,215,60,105,121,232,159,140,75,188,138,189,91,94,152,109,207,29,208,105,177,238,75,246,252,63,37,109,97,35,208,243,211,193,120,47,234,
144,37,242,107,71,182,158,39,142,171,249,190,205,254,52,108,71,164,125,88,130,52,216,235,100,93,113,152,117,168,141,250,40,231,173,23,222,183,31,153,168,195,53,122,158,33,127,118,232,145,147,22,139,228,15,164,225,27,87,221,156,8,89,44,160,223,197,134,
68,2,16,67,97,183,90,252,254,174,159,221,221,239,195,65,251,221,226,195,51,84,26,177,156,192,126,39,18,128,24,157,248,163,163,87,237,124,141,198,15,23,111,243,63,90,32,84,173,49,187,195,91,70,124,174,118,15,79,81,98,255,54,184,19,63,86,247,24,197,127,
42,117,176,14,111,220,124,106,140,120,252,252,91,32,251,147,168,195,92,173,248,121,231,234,144,50,191,63,184,211,101,59,137,243,71,157,42,29,252,154,195,244,76,67,34,1,240,19,51,196,167,143,248,128,231,85,219,199,254,73,70,74,42,141,96,123,164,206,54,
128,185,103,243,198,115,232,201,107,147,101,59,241,58,190,182,161,41,200,31,45,109,167,235,26,252,90,21,201,29,79,91,227,73,101,59,37,126,128,237,139,23,190,203,145,28,59,102,39,219,248,227,245,162,209,6,123,123,89,190,21,188,14,13,205,31,38,241,147,
222,77,101,155,250,155,215,221,208,120,192,47,90,172,229,244,203,191,201,225,231,77,188,238,246,180,221,217,105,187,253,247,135,96,251,247,162,114,84,197,48,18,165,142,94,210,42,206,175,132,244,67,151,12,218,8,210,236,160,44,119,191,123,115,105,181,141,
98,142,90,244,132,225,39,119,232,68,182,127,241,135,237,61,208,81,161,165,254,129,56,166,209,60,9,37,54,226,19,179,183,165,94,66,31,75,84,177,97,81,198,159,220,213,199,175,7,248,177,56,60,81,244,220,253,101,202,157,187,6,184,200,128,102,27,171,6,59,92,
252,129,100,142,28,239,12,104,141,169,207,148,245,9,192,196,163,158,150,113,17,31,191,18,203,217,137,250,139,218,108,95,78,202,5,253,52,184,215,243,209,79,29,249,27,2,201,45,140,150,148,116,240,235,10,98,102,227,22,13,220,250,143,205,238,97,30,64,136,
203,10,44,199,32,58,152,76,148,182,227,220,51,246,38,183,207,169,87,57,16,178,237,46,254,54,132,68,243,118,124,248,227,242,174,107,200,29,10,174,53,183,172,147,223,127,18,177,93,1,14,197,211,91,49,78,126,139,218,91,249,246,63,227,141,199,163,5,155,27,
34,51,249,125,209,43,237,151,119,168,4,94,41,108,142,71,14,219,77,0,226,143,119,36,98,158,234,109,219,136,99,135,39,34,196,130,247,63,141,13,47,145,219,154,252,70,72,124,123,102,101,195,249,159,207,225,247,216,40,182,70,17,46,133,95,116,77,229,40,47,
139,63,177,219,98,28,252,230,105,37,54,114,223,222,53,95,109,177,178,29,125,47,195,24,255,146,204,210,223,108,56,162,76,94,135,146,238,217,193,63,115,118,188,212,208,17,206,241,178,120,135,184,209,233,136,21,102,207,155,33,144,0,40,113,43,137,166,41,
103,206,236,172,185,215,89,56,213,205,207,41,216,234,30,93,241,4,61,114,13,191,53,204,82,39,237,107,139,222,218,61,189,115,66,81,241,197,69,81,157,159,196,179,54,49,221,71,213,88,126,221,135,54,206,186,43,239,79,111,61,101,140,255,194,176,79,181,220,
86,152,206,168,75,42,11,175,93,53,189,235,238,44,107,155,211,235,82,49,201,229,192,137,87,74,2,164,168,134,103,18,71,235,80,238,108,99,138,72,222,162,247,59,90,114,175,20,150,62,180,92,169,150,214,102,97,33,113,27,102,71,115,168,237,181,101,229,206,102,
103,30,11,255,75,161,58,79,206,68,181,16,87,114,17,195,144,73,188,51,231,160,179,199,182,132,84,85,85,233,164,138,159,230,26,228,233,81,126,85,27,217,72,182,218,15,67,252,113,167,103,236,23,211,163,4,171,163,146,238,197,240,219,124,249,73,102,173,198,
233,58,52,215,209,213,253,187,175,46,171,254,159,245,231,0,132,86,192,21,104,79,135,154,92,211,25,245,136,115,210,54,198,103,50,79,0,146,81,230,240,208,54,29,91,251,247,87,38,31,88,179,188,166,214,176,199,206,174,65,156,159,48,220,236,64,211,72,219,231,
18,122,10,231,234,9,141,239,97,237,236,95,122,22,233,248,251,172,79,0,162,110,125,254,72,251,156,141,217,57,136,146,249,97,227,232,17,212,241,198,227,120,77,255,157,22,104,14,177,109,110,27,255,115,209,234,152,225,174,176,205,98,142,90,124,100,188,89,
247,18,187,215,114,28,85,172,163,31,100,125,2,16,187,103,77,211,194,115,156,62,65,227,16,163,161,51,67,150,195,24,1,56,228,57,56,197,24,113,87,160,45,45,163,204,193,217,158,129,175,53,235,207,1,136,139,216,226,97,127,164,114,128,247,139,15,124,211,29,
152,147,15,31,53,221,109,212,213,187,236,159,137,118,32,28,20,145,186,128,56,55,167,25,62,181,186,46,232,232,87,128,169,71,50,56,75,12,129,17,0,63,129,154,229,81,50,157,255,221,41,76,16,24,130,2,89,222,181,134,136,104,86,92,108,59,68,172,16,102,86,9,
32,1,216,168,142,174,235,115,188,90,123,243,88,7,190,139,182,17,8,22,181,46,192,15,227,152,225,50,226,137,81,142,94,200,101,61,160,204,46,137,4,96,219,91,54,18,17,175,115,55,184,216,142,7,5,164,44,192,207,227,144,3,227,145,0,82,134,195,2,16,128,192,144,
22,192,8,96,72,87,31,130,135,128,61,1,36,0,123,126,88,26,2,67,90,0,9,96,72,87,31,130,135,128,61,1,36,0,123,126,88,26,2,67,90,0,9,96,72,87,31,130,135,128,61,129,236,191,20,216,222,246,13,217,165,215,204,33,174,127,255,167,194,139,182,231,210,16,191,13,
202,210,221,228,10,255,219,169,90,199,152,205,181,55,175,95,111,21,162,162,130,248,62,249,106,209,63,183,248,137,207,106,28,252,198,107,201,215,58,113,221,158,5,111,124,110,53,14,44,151,30,1,36,128,244,184,218,46,181,161,129,120,195,174,250,251,234,60,
82,185,100,241,27,106,131,215,174,191,179,112,41,191,152,90,252,237,61,75,73,36,238,34,193,6,87,221,146,102,183,52,60,181,63,146,245,55,2,230,146,136,151,149,222,194,63,65,2,248,27,75,86,252,15,9,32,43,170,225,232,32,242,100,115,127,171,137,187,201,237,
220,80,74,153,97,235,34,37,153,63,213,82,50,136,198,196,93,237,22,239,187,55,83,143,248,123,229,152,178,78,0,231,0,178,174,74,16,16,4,50,39,128,4,144,57,107,172,9,2,89,39,128,4,144,117,85,130,128,32,144,57,1,36,128,204,89,99,77,16,200,58,1,36,128,172,
171,18,4,4,129,204,9,32,1,100,206,26,107,130,64,214,9,32,1,100,93,149,32,32,8,100,78,0,9,32,115,214,88,19,4,178,78,0,9,32,235,170,4,1,65,32,115,2,72,0,153,179,198,154,32,144,117,2,72,0,89,87,37,8,8,2,153,19,64,2,200,156,53,214,4,129,172,19,64,2,200,186,
42,65,64,16,200,156,0,18,64,230,172,177,38,8,100,157,0,18,64,214,85,9,2,130,64,230,4,144,0,50,103,141,53,65,32,235,4,144,0,178,174,74,16,16,4,50,39,128,4,144,57,107,172,9,2,89,39,128,4,144,117,85,130,128,32,144,57,129,180,63,19,144,63,137,82,34,148,111,
144,248,177,50,153,203,73,86,151,62,246,26,13,70,69,92,140,7,73,173,172,161,107,153,180,37,81,71,236,204,45,60,54,3,126,251,255,87,32,173,9,192,173,80,70,101,218,65,36,214,201,172,62,18,146,119,47,23,147,18,105,169,34,23,229,207,219,101,157,201,36,144,
242,58,68,215,151,72,44,229,229,6,184,0,79,123,17,211,206,234,99,61,121,124,154,78,109,217,185,100,34,25,50,241,80,133,39,73,139,113,48,209,202,92,226,25,197,206,79,60,133,203,102,108,86,18,184,8,71,230,45,32,33,185,137,174,90,45,161,207,141,114,105,
230,110,207,77,108,216,9,53,67,166,60,202,244,76,105,169,148,100,168,137,15,106,91,228,34,114,9,239,36,10,127,162,172,165,199,82,147,8,147,88,155,212,144,44,211,201,215,214,54,233,205,248,112,54,147,87,147,181,244,36,170,69,229,57,164,233,224,30,39,227,
18,101,125,176,149,68,121,241,151,146,4,115,91,183,35,146,28,245,52,90,125,36,184,136,35,223,61,170,93,81,15,92,203,226,134,151,105,22,235,144,26,178,222,65,63,20,229,57,61,37,84,253,85,53,106,52,242,103,31,91,171,67,23,175,125,149,197,72,123,99,147,
211,177,69,93,164,213,208,200,124,18,55,252,252,213,90,251,215,136,28,78,40,252,177,238,152,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,
0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,
0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,
0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,
128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,
32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,0,2,16,128,0,4,32,0,1,8,64,224,239,85,224,255,0,196,61,49,167,17,160,232,27,0,0,0,0,73,69,78,68,174,66,96,130,0,0 };
const char* PDOicon_ico = (const char*) temp_binary_data_0;
//================== PDOResources.rc ==================
static const unsigned char temp_binary_data_1[] =
"#undef WIN32_LEAN_AND_MEAN\r\n"
"#define WIN32_LEAN_AND_MEAN\r\n"
"#include <windows.h>\r\n"
"\r\n"
"VS_VERSION_INFO VERSIONINFO\r\n"
"FILEVERSION 1,6,8,0\r\n"
"BEGIN\r\n"
" BLOCK \"StringFileInfo\"\r\n"
" BEGIN\r\n"
" BLOCK \"040904E4\"\r\n"
" BEGIN\r\n"
" VALUE \"CompanyName\", \"OpenDragon\\0\"\r\n"
" VALUE \"FileDescription\", \"Platonic display output service\\0\"\r\n"
" VALUE \"FileVersion\", \"1.6.9\\0\"\r\n"
" VALUE \"LegalCopyright\", \"(c) 2016 by OpenDragon\\0\"\r\n"
" VALUE \"ProductName\", \"Platonic display output service\\0\"\r\n"
" VALUE \"ProductVersion\", \"1.6.9\\0\"\r\n"
" END\r\n"
" END\r\n"
"\r\n"
" BLOCK \"VarFileInfo\"\r\n"
" BEGIN\r\n"
" VALUE \"Translation\", 0x409, 65001\r\n"
" END\r\n"
"END\r\n"
"\r\n"
"/* Add the application icon */\r\n"
"IDI_ICON1 ICON DISCARDABLE \"PDOicon.ico\"\r\n"
"IDI_ICON2 ICON DISCARDABLE \"PDOicon.ico\"\r\n";
const char* PDOResources_rc = (const char*) temp_binary_data_1;
const char* getNamedResource (const char*, int&) throw();
const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()
{
unsigned int hash = 0;
if (resourceNameUTF8 != 0)
while (*resourceNameUTF8 != 0)
hash = 31 * hash + (unsigned int) *resourceNameUTF8++;
switch (hash)
{
case 0xac8e7ca6: numBytes = 25624; return PDOicon_ico;
case 0x396c3602: numBytes = 750; return PDOResources_rc;
default: break;
}
numBytes = 0;
return 0;
}
const char* namedResourceList[] =
{
"PDOicon_ico",
"PDOResources_rc"
};
}
| 201.371257
| 254
| 0.597624
|
opendragon
|
7d494e85ccd5ee6a0140412d8217faae1735c7f7
| 15,433
|
cpp
|
C++
|
src/engine/components/collider/collidermath.cpp
|
senaademr/CS1950UFinal
|
efb1d223e68ee02b1386cb8a97200db6faad893d
|
[
"MIT"
] | null | null | null |
src/engine/components/collider/collidermath.cpp
|
senaademr/CS1950UFinal
|
efb1d223e68ee02b1386cb8a97200db6faad893d
|
[
"MIT"
] | null | null | null |
src/engine/components/collider/collidermath.cpp
|
senaademr/CS1950UFinal
|
efb1d223e68ee02b1386cb8a97200db6faad893d
|
[
"MIT"
] | null | null | null |
#include "collidermath.h"
#include "cylindercollider.h"
#include "spherecollider.h"
#include "boxcollider.h"
#include "compoundcollider.h"
#include "engine/components/transformcomponent.h"
#include "engine/components/physicscomponent.h"
#include "engine/components/collisioncomponent.h"
#include "engine/basics/gameobject.h"
#include "engine/util/CommonIncludes.h"
#include "collisionresponse.h"
/*****************************Actual Collisions ***************************/
CollisionResponse ColliderMath::collideCylinderCylinder(CylinderCollider* collider1, CylinderCollider* collider2){
Transform transform1 = collider1->getTransform();
Transform transform2 = collider2->getTransform();
//std::cout << "testing cylinder collide with cylinder" << std::endl;
bool areColliding = collideLineCylinder(transform1, transform2) && collideCircles(transform1, transform2);
if(areColliding){
glm::vec3 circleMtv = getCircleCircleMtv(transform1, transform2);
glm::vec3 lineMtv = getLineMtvCylinder(transform1, transform2);
glm::vec3 mtv = getSmallerMtv(circleMtv, lineMtv);
return CollisionResponse(mtv);
//ColliderMath::resolveMtv(collider1, collider2, circleMtv, lineMtv);
}
return CollisionResponse();
}
CollisionResponse ColliderMath::collideCylinderBox(CylinderCollider *cylinderCollider, BoxCollider *boxCollider){
Transform transformCylinder = cylinderCollider->getTransform();
Transform transformBox = boxCollider->getTransform();
glm::vec2 clampedPoint = clampPointXZ(transformBox, transformCylinder);
bool colliding = collideCylinderLineBox(transformCylinder, transformBox)
&& collidePointCircle(transformCylinder, clampedPoint);
if(colliding){
glm::vec2 cylinderRangeY = getRangeCylinder(transformCylinder);
glm::vec2 boxRangeY = getRangeBox(transformBox, DIMENSION::Y);
glm::vec3 lineMtv = getLineLineMtv(cylinderRangeY, boxRangeY, DIMENSION::Y);
glm::vec3 circleMtv = getPointCircleMtv(transformCylinder, transformBox);
//std::cout << "lineMtv: " << lineMtv << " circleMtv: " << circleMtv << std::endl;
glm::vec3 mtv = getSmallerMtv(lineMtv, circleMtv);
return CollisionResponse(mtv);
}
return CollisionResponse();
}
CollisionResponse ColliderMath::collideCylinderSphere(CylinderCollider *cylinderCollider, SphereCollider * sphereCollider){
//std::cout << "unimplemented collision: cylinder sphere" << std::endl;
return CollisionResponse();
}
CollisionResponse ColliderMath::collideBoxBox(BoxCollider* collider1, BoxCollider* collider2){
Transform transform1 = collider1->getTransform();
Transform transform2 = collider2->getTransform();
bool collideX = collideLineBox(transform1, transform2, DIMENSION::X);
bool collideY = collideLineBox(transform1, transform2, DIMENSION::Y);
bool collideZ = collideLineBox(transform1, transform2, DIMENSION::Z);
bool result = collideX && collideY && collideZ;
if(result){
glm::vec3 lineMtvX = getLineLineMtvBox(transform1, transform2, DIMENSION::X);
glm::vec3 lineMtvY = getLineLineMtvBox(transform1, transform2, DIMENSION::Y);
glm::vec3 lineMtvZ = getLineLineMtvBox(transform1, transform2, DIMENSION::Z);
//resolveMtv(collider1, collider2, lineMtvX, lineMtvY, lineMtvZ);
glm::vec3 mtv = getSmallerMtv(lineMtvX, lineMtvY, lineMtvZ);
return CollisionResponse(mtv);
}
return CollisionResponse();
}
CollisionResponse ColliderMath::collideBoxSphere(BoxCollider* boxCollider, SphereCollider* sphereCollider){
Transform transformBox = boxCollider->getTransform();
Transform transformSphere = sphereCollider->getTransform();
glm::vec3 clampedPoint = clampPoint(transformBox, transformSphere);
bool colliding = collidePointSphere(transformSphere, clampedPoint);
if(colliding){
glm::vec3 mtv = getPointSphereMtv(transformSphere, clampedPoint);
return CollisionResponse(mtv);
}
return CollisionResponse();
}
CollisionResponse ColliderMath::collideSphereSphere(SphereCollider* collider1, SphereCollider* collider2){
Transform transform1 = collider1->getTransform();
Transform transform2 = collider2->getTransform();
bool colliding = collideSpheres(transform1, transform2);
if(colliding){
glm::vec3 mtv = getSphereSphereMtv(transform1, transform2);
return CollisionResponse(mtv);
}
return CollisionResponse();
}
/*************************** dummy collisions *****************/
CollisionResponse ColliderMath::negateResponse(CollisionResponse response){
if(response.didCollide){
return CollisionResponse(-1.f *response.mtv);
}
return response;
}
CollisionResponse ColliderMath::collideSphereBox(SphereCollider* sphereCollider, BoxCollider* boxCollider){
return negateResponse(collideBoxSphere(boxCollider, sphereCollider));
}
CollisionResponse ColliderMath::collideBoxCylinder(BoxCollider *boxCollider, CylinderCollider *cylinderCollider){
return negateResponse(collideCylinderBox(cylinderCollider, boxCollider));
}
CollisionResponse ColliderMath::collideSphereCylinder(SphereCollider * sphereCollider, CylinderCollider *cylinderCollider){
return negateResponse(collideCylinderSphere(cylinderCollider, sphereCollider));
}
/***************************** Line collisions ***************************/
bool ColliderMath::collideLineCylinder(Transform &transform1, Transform &transform2)
{
glm::vec2 range1 = ColliderMath::getRangeCylinder(transform1);
glm::vec2 range2 = ColliderMath::getRangeCylinder(transform2);
return collideLine(range1, range2);
}
bool ColliderMath::collideLine(glm::vec2 range1, glm::vec2 range2){
bool result= (range1.x < range2.y && range2.x < range1.y);
return result;
}
bool ColliderMath::collideLineBox(Transform &transform1, Transform &transform2, DIMENSION dim){
glm::vec2 range1 = getRangeBox(transform1, dim);
glm::vec2 range2 = getRangeBox(transform2, dim);
return collideLine(range1, range2);
}
bool ColliderMath::collideSpheres(Transform &transform1, Transform &transform2){
float distance2 = glm::distance2(transform1.getPosition(), transform2.getPosition());
float radius1 = getRadius(transform1.getSize());
float radius2 = getRadius(transform2.getSize());
bool result = distance2 < powf(radius1 + radius2, 2);
return result;
}
glm::vec3 ColliderMath::getSphereSphereMtv(Transform &transform1, Transform &transform2){
glm::vec3 locationDifference = transform1.getPosition()-transform2.getPosition();
float distance = glm::length(locationDifference);
glm::vec3 direction = glm::normalize(locationDifference);
float radius1 = getRadius(transform1.getSize());
float radius2 = getRadius(transform2.getSize());
glm::vec3 mtv = (distance -radius1 - radius2 )*direction;
return mtv;
}
bool ColliderMath::collideCylinderLineBox(Transform &transformCylinder, Transform &transformBox){
glm::vec2 yRangeCylinder = getRangeCylinder(transformCylinder);
glm::vec2 yRangeBox = getRangeBox(transformBox, DIMENSION::Y);
return collideLine(yRangeCylinder, yRangeBox);
}
glm::vec3 ColliderMath::getCircleCircleMtv(Transform &transform1, Transform &transform2){
glm::vec2 circlePos1 = toCircle(transform1.getPosition());
glm::vec2 circlePos2 = toCircle(transform2.getPosition());
float length = glm::distance(circlePos1, circlePos2);
float radius1 = getRadius(transform1.getSize());
float radius2 = getRadius(transform2.getSize());
glm::vec2 mtv2d = (circlePos2-circlePos1);
mtv2d /= length;
mtv2d *= (radius1 + radius2-length);
glm::vec3 mtv = glm::vec3(mtv2d.x, 0, mtv2d.y);
return mtv;
}
glm::vec3 ColliderMath::getLineMtvCylinder(Transform &transform1, Transform &transform2){
glm::vec2 yRange1 = ColliderMath::getRangeCylinder(transform1);
glm::vec2 yRange2 = ColliderMath::getRangeCylinder(transform2);
return getLineLineMtv(yRange1, yRange2, DIMENSION::Y);
}
glm::vec3 ColliderMath::getLineLineMtvBox(Transform &transform1, Transform &transform2, DIMENSION dim){
glm::vec2 range1 = ColliderMath::getRangeBox(transform1, dim);
glm::vec2 range2 = ColliderMath::getRangeBox(transform2, dim);
return getLineLineMtv(range1, range2, dim);
}
glm::vec3 ColliderMath::getLineLineMtv(glm::vec2 range1, glm::vec2 range2, DIMENSION dim){
float aRight = range2.y - range1.x;
float aLeft = range1.y - range2.x;
float value = 1;
if(aLeft < 0 || aRight < 0){
std::cout << "error? " << std::endl;
}
if(aRight < aLeft){
value = -aRight;
}
else{
value = aLeft;
}
switch(dim){
case(DIMENSION::X):
return glm::vec3(value, 0, 0);
case(DIMENSION::Y):
return glm::vec3(0, value, 0);
case(DIMENSION::Z):
return glm::vec3(0, 0, value);
}
assert(false);
return glm::vec3(0);
}
bool ColliderMath::collideCircles(Transform &transform1, Transform &transform2){
glm::vec2 circlePos1 = toCircle(transform1.getPosition());
glm::vec2 circlePos2 = toCircle(transform2.getPosition());
float distance2 = glm::distance2(circlePos1, circlePos2);
float radius1 = getRadius(transform1.getSize());
float radius2 = getRadius(transform2.getSize());
bool result = distance2 < powf(radius1 + radius2, 2);
if(result){
}
return result;
}
glm::vec3 ColliderMath::getPointSphereMtv(Transform &transformSphere, glm::vec3 point){
float radius = getRadius(transformSphere.getSize());
glm::vec3 mtv = transformSphere.getPosition()- point;
float size = glm::length(mtv);
mtv = glm::normalize(mtv);
mtv = (radius - size)*mtv;
return mtv;
}
//if inside, find the dimension that is shortest
//TODO FIXXXXXXXX
glm::vec3 ColliderMath::getPointCircleMtv(Transform &transformCylinder,Transform &transformBox){
glm::vec2 point = clampPointXZ(transformBox, transformCylinder);
float radius = getRadius(transformCylinder.getSize());
glm::vec2 circle = toCircle(transformCylinder.getPosition());
glm::vec2 mtv = circle - point;
float size = glm::length(mtv);
if(size==0){
glm::vec2 xRange = getRangeBox(transformBox, DIMENSION::X);
glm::vec2 zRange = getRangeBox(transformBox, DIMENSION::Z);
glm::vec3 mtvX1 = glm::vec3(circle.x - xRange.x, 0, 0 );
glm::vec3 mtvX2 = glm::vec3(circle.x - xRange.y, 0, 0 );
glm::vec3 mtvX = getSmallerMtv(mtvX1, mtvX2);
//std::cout << "circleX: " << circle.x << " xRange: " << xRange << std::endl;
//std::cout << "mtvX " <<mtvX << std::endl;
glm::vec3 mtvY1 = glm::vec3(0, 0, circle.y - zRange.x);
glm::vec3 mtvY2 = glm::vec3(0, 0, circle.y - zRange.y);
glm::vec3 mtvY = getSmallerMtv(mtvY1, mtvY2);
glm::vec3 mtv = getSmallerMtv(mtvX, mtvY);
float newSize = glm::length(mtv);
return glm::normalize(mtv)* (radius + newSize);
//float toXMin = glm::distance(circle.x, xRange.x);
//return glm::vec3(100000);
}
else{
mtv = glm::normalize(mtv);
mtv = (size - radius)*mtv;
return glm::vec3(mtv.x, 0, mtv.y);
}
}
bool ColliderMath::collidePointSphere(Transform &transformSphere, glm::vec3 point){
float radius = getRadius(transformSphere.getSize());
float distance = glm::distance(transformSphere.getPosition(), point);
return distance <= radius;
}
bool ColliderMath::collidePointCircle(Transform &transformCylinder, glm::vec2 point){
glm::vec2 circle = toCircle(transformCylinder.getPosition());
float radius = getRadius(transformCylinder.getSize());
return glm::distance(circle, point) <= radius;
}
/*************************** Helper *****************************/
float ColliderMath::getRadius(glm::vec3 size){
return std::abs(size.x/2.f);
}
glm::vec2 ColliderMath::toCircle(glm::vec3 pos){
return glm::vec2(pos.x, pos.z);
}
glm::vec3 ColliderMath::clampPoint(Transform &transformBox, Transform &transformSphere){
float x = clampDimension(transformBox, transformSphere, DIMENSION::X);
float y = clampDimension(transformBox, transformSphere, DIMENSION::Y);
float z = clampDimension(transformBox, transformSphere, DIMENSION::Z);
glm::vec3 clampedPoint = glm::vec3(x,y,z);
return clampedPoint;
}
glm::vec2 ColliderMath::clampPointXZ(Transform &transformBox,Transform &transformCylinder){
float x = clampDimension(transformBox, transformCylinder, DIMENSION::X);
float z = clampDimension(transformBox, transformCylinder, DIMENSION::Z);
glm::vec2 clampedPoint = glm::vec2(x, z);
return clampedPoint;
}
float ColliderMath::clampDimension(Transform &transformBox,Transform &transformSphere, DIMENSION dim){
glm::vec2 range = getRangeBox(transformBox, dim);
glm::vec3 pos = transformSphere.getPosition();
switch(dim){
case(DIMENSION::X):
return glm::clamp(pos.x, range.x, range.y);
case(DIMENSION::Y):
return glm::clamp(pos.y, range.x, range.y);
case(DIMENSION::Z):
return glm::clamp(pos.z, range.x, range.y);
}
assert(false);
return -1;
}
/**
* @brief ColliderMath::getRangeCylinder
* Returns a vec2 representing the vertical dimension of the cylinder.
* This is different from the box range because the starting point of the cylinder is the bottom
* @param transformComponent
* @return
*/
glm::vec2 ColliderMath::getRangeCylinder(Transform &transformCylinder){
glm::vec3 pos = transformCylinder.getPosition();
glm::vec3 size = transformCylinder.getSize();
return glm::vec2(pos.y, pos.y + size.y);
}
/**
* @brief ColliderMath::getRangeBox
* Returns a vec2 representing a dimension of a box.
* This is different from the cylinder range because the starting point of a box is the center
* @param transformComponent
* @param dim
* @return
*/
glm::vec2 ColliderMath::getRangeBox(Transform &transformBox, DIMENSION dim){
glm::vec3 pos = transformBox.getPosition();
glm::vec3 size = transformBox.getSize();
switch(dim){
case(DIMENSION::X):
return getRangeBox(pos.x, size.x);
case(DIMENSION::Y):
return getRangeBox(pos.y, size.y);
case(DIMENSION::Z):
return getRangeBox(pos.z, size.z);
}
assert(false); //should never reach here
return glm::vec2(0);
}
/**
* @brief ColliderMath::getRangeBox
* Returns a vec2 representing a dimension of a box.
* This is different from the cylinder range because the starting point of a box is the center
* @param pos
* @param size
* @return
*/
glm::vec2 ColliderMath::getRangeBox(float pos, float size){
assert(size >= 0);
return glm::vec2(pos-size/2.f, pos + size/2.f);
}
glm::vec3 ColliderMath::getSmallerMtv(glm::vec3 mtv1, glm::vec3 mtv2){
if(glm::length2(mtv1) < glm::length2(mtv2)){
return mtv1;
}
else{
return mtv2;
}
}
glm::vec3 ColliderMath::getSmallerMtv(glm::vec3 mtv1, glm::vec3 mtv2, glm::vec3 mtv3){
float length1 = glm::length2(mtv1);
float length2 = glm::length2(mtv2);
float length3 = glm::length2(mtv3);
if(length1 < length2 && length1 < length3){
return mtv1;
}
else if(length2 < length3){
return mtv2;
}
else{
return mtv3;
}
}
| 36.142857
| 123
| 0.694227
|
senaademr
|
7d4a266a5b7ad0d0c4cd35de51f121afff7cfadf
| 6,674
|
cpp
|
C++
|
data/reddit/extract_train.cpp
|
Sanzo00/NeutronStarLite
|
57d92d1f7f6cd55c55a83ca086096a710185d531
|
[
"Apache-2.0"
] | 38
|
2022-03-09T10:29:08.000Z
|
2022-03-30T13:56:16.000Z
|
data/reddit/extract_train.cpp
|
Sanzo00/NeutronStarLite
|
57d92d1f7f6cd55c55a83ca086096a710185d531
|
[
"Apache-2.0"
] | 3
|
2022-03-09T10:55:27.000Z
|
2022-03-17T02:53:58.000Z
|
data/reddit/extract_train.cpp
|
Sanzo00/NeutronStarLite
|
57d92d1f7f6cd55c55a83ca086096a710185d531
|
[
"Apache-2.0"
] | 6
|
2022-03-10T07:41:31.000Z
|
2022-03-21T06:36:31.000Z
|
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <string.h>
#include <cstring>
using namespace std;
int generate_Mask(int vertices,std::string mask_file){
FILE *fp_mask;
fp_mask=fopen(mask_file.c_str(),"w");
for(int i=0;i<vertices;i++){
int a=rand()%10;
if(a<6){
fprintf(fp_mask,"%d train\n",i);
}else
if(a<8){
fprintf(fp_mask,"%d test\n",i);
}else
if(a<10){
fprintf(fp_mask,"%d val\n",i);
}
}
fclose(fp_mask);
return 0;
}
void writeLabels(int vertices,std::string label_file)
{
std::string str;
std::string label_file_output=label_file+"_nts";
std::ifstream input_lbl(label_file.c_str(), std::ios::in);
std::ofstream output_lbl(label_file_output.c_str(), std::ios::out);
// ID F F F F F F F L
std::cout<<"called"<<std::endl;
if (!input_lbl.is_open())
{
std::cout<<"open label file fail!"<<std::endl;
return;
}
std::string la;
//std::cout<<"finish1"<<std::endl;
int id=0;
int label;
for(int j=0;j<vertices;j++)
{
input_lbl >> label;
output_lbl<<j<<" "<<label<<std::endl;
}
input_lbl.close();
output_lbl.close();
}
int sort_Mask(int vertices,std::string mask_file){
std::cout<<vertices<<std::endl;
std::string mask_file_sorted=mask_file+"sorted";
std::ifstream fp_mask(mask_file.c_str(), std::ios::in);
std::ofstream fp_mask_sorted(mask_file_sorted.c_str(), std::ios::out);
if (!fp_mask.is_open())
{
std::cout<<"open"<<mask_file<<" fail!"<<std::endl;
return 0;
}
int* value=new int[vertices];
memset(value,0,sizeof(int)*vertices);
while(!fp_mask.eof()){
int id;
std::string s;
fp_mask>>id>>s;
std::cout<<id<<" "<<s<<std::endl;
if(s.compare("train")==0){
value[id]=1;
}else if(s.compare("val")==0){
value[id]=2;
}else if(s.compare("test")==0){
value[id]=3;
}else{
;
}
}
for(int i=0;i<vertices;i++){
std::string s;
if(value[i]==1){
fp_mask_sorted<<i<<" train"<<std::endl;
}else if(value[i]==2){
fp_mask_sorted<<i<<" val"<<std::endl;
}
if(value[i]==3){
fp_mask_sorted<<i<<" test"<<std::endl;
}
}
fp_mask_sorted.close();
fp_mask.close();
//fclose(fp_mask);
return 0;
}
int sort_Label(int vertices,std::string label_file){
std::string label_file_sorted=label_file+"sorted";
std::ifstream fp_label(label_file.c_str(), std::ios::in);
std::ofstream fp_label_sorted(label_file_sorted.c_str(), std::ios::out);
if (!fp_label.is_open())
{
std::cout<<"open "<< label_file<<" fail!"<<std::endl;
return 0;
}
int* value=new int[vertices];
memset(value,0,sizeof(int)*vertices);
while(!fp_label.eof()){
int id;
int v;
fp_label>>id>>v;
value[id]=v;
}
for(int i=0;i<vertices;i++){
fp_label_sorted<<i<<" "<<value[i]<<std::endl;
}
fp_label_sorted.close();
fp_label.close();
//fclose(fp_label);
return 0;
}
void generate_edge(int vertices,std::string edge_file){
std::string edge_file_sorted=edge_file+".bin";
std::ifstream fp_edge(edge_file.c_str(), std::ios::in);
std::ofstream fp_edge_sorted(edge_file_sorted.c_str(), std::ios::binary);
if (!fp_edge.is_open())
{
std::cout<<"open "<< edge_file<<" fail!"<<std::endl;
return;
}
while(!fp_edge.eof()){
int src;
int dst;
fp_edge>>src>>dst;
fp_edge_sorted.write((char*)&src,sizeof(int));
fp_edge_sorted.write((char*)&dst,sizeof(int));
fp_edge_sorted.write((char*)&dst,sizeof(int));
fp_edge_sorted.write((char*)&src,sizeof(int));
//fp_edge_sorted<<dst<<" "<<src<<std::endl;
}
for(int i=0;i<vertices;i++){
fp_edge_sorted.write((char*)&i,sizeof(int));
fp_edge_sorted.write((char*)&i,sizeof(int));
}
fp_edge_sorted.close();
fp_edge.close();
//fclose(fp_label);
std::ifstream fp_edge_test(edge_file_sorted.c_str(), std::ios::binary);
for(int i=0;i<23446805;i++){
int src;
int dst;
fp_edge_test.read((char*)&src,sizeof(int));
fp_edge_test.read((char*)&dst,sizeof(int));
if(i>23446705)
std::cout<<"edge[0]: "<<src<<" edge[1]: "<<dst<<std::endl;
//fp_edge_sorted<<dst<<" "<<src<<std::endl;
}
return;
}
void writeFeature(int vertices, int features,std::string input_feature)
{
std::string str;
std::string output_feature=input_feature+"_nts";
std::ifstream input_ftr(input_feature.c_str(), std::ios::in);
std::ofstream output_ftr(output_feature.c_str(), std::ios::out);
std::cout<<"called"<<std::endl;
if (!input_ftr.is_open())
{
std::cout<<"open feature file fail!"<<std::endl;
return;
}
// if (!input_lbl.is_open())
// {
// std::cout<<"open label file fail!"<<std::endl;
// return;
// }
float *con_tmp = new float[features];
std::string la;
//std::cout<<"finish1"<<std::endl;
int id=0;
int label;
for(int j=0;j<vertices;j++)
{
int size_0=features;
output_ftr<<j<<" ";
for (int i = 0; i < size_0; i++){
input_ftr >> con_tmp[i];
if(i!=(size_0-1)){
output_ftr<<con_tmp[i]<<" ";
}else{
output_ftr<<con_tmp[i]<<std::endl;
}
}
// input_lbl >> label;
// output_lbl<<j<<" "<<label<<std::endl;
}
free(con_tmp);
input_ftr.close();
// input_lbl.close();
output_ftr.close();
// output_lbl.close();
}
int main(int argc, char ** argv){
//for reddit
//sort_Mask(232965, "./redditdata/reddit_small/reddit.mask");
//sort_Label(232965, "./redditdata/reddit_small/reddit.labeltable");
generate_edge(232965,"./redditdata/reddit_small/reddit_full.edge.txt");
//writeFeature(232965,602,"./redditdata/reddit_small/reddit.featuretablenorm");
return 0;
}
| 30.336364
| 79
| 0.526521
|
Sanzo00
|
7d4a3b1a7ab527c9acc73bb0b253608a9dc3274c
| 1,751
|
hpp
|
C++
|
LetsGo/ThirdParty/ApproxMVBB/Includes/ApproxMVBB/Common/LogDefines.hpp
|
wis1906/letsgo-ar-space-generation
|
02d888a44bb9eb112f308356ab42720529349338
|
[
"MIT"
] | null | null | null |
LetsGo/ThirdParty/ApproxMVBB/Includes/ApproxMVBB/Common/LogDefines.hpp
|
wis1906/letsgo-ar-space-generation
|
02d888a44bb9eb112f308356ab42720529349338
|
[
"MIT"
] | null | null | null |
LetsGo/ThirdParty/ApproxMVBB/Includes/ApproxMVBB/Common/LogDefines.hpp
|
wis1906/letsgo-ar-space-generation
|
02d888a44bb9eb112f308356ab42720529349338
|
[
"MIT"
] | null | null | null |
// ========================================================================================
// ApproxMVBB
// Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz
// (døt) ch>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// ========================================================================================
#ifndef ApproxMVBB_Common_LogDefines_hpp
#define ApproxMVBB_Common_LogDefines_hpp
#include <iostream>
#include "ApproxMVBB/Config/Config.hpp"
#define ApproxMVBB_LOG(message) std::cout << message;
#define ApproxMVBB_LOGLEVEL(level, setlevel, message) \
if(level <= setlevel) \
{ \
ApproxMVBB_LOG(message); \
}
// Message Log
// ==================================================================================
#if ApproxMVBB_FORCE_MSGLOG_LEVEL >= 0
# define ApproxMVBB_MSGLOG_LEVEL ApproxMVBB_FORCE_MSGLOG_LEVEL // force the output level if set in the config!
#else
# ifndef NDEBUG
// Debug!
# define ApproxMVBB_MSGLOG_LEVEL 2 // 0 = no output
# else
# define ApproxMVBB_MSGLOG_LEVEL 0 // 0 = no output
# endif
#endif
#define ApproxMVBB_MSGLOG_L1(message) ApproxMVBB_LOGLEVEL(1, ApproxMVBB_MSGLOG_LEVEL, message)
#define ApproxMVBB_MSGLOG_L2(message) ApproxMVBB_LOGLEVEL(2, ApproxMVBB_MSGLOG_LEVEL, message)
#define ApproxMVBB_MSGLOG_L3(message) ApproxMVBB_LOGLEVEL(3, ApproxMVBB_MSGLOG_LEVEL, message)
// ==================================================================================
#endif
| 39.795455
| 114
| 0.5494
|
wis1906
|
7d4d41c341c2038489316081bf0031565dc3a428
| 2,456
|
cc
|
C++
|
Assignment1/Q3/daxpy.cc
|
Gurupradeep/Parallel-Programming
|
fe54eb921f8895518c9d041075a92a5bd1499737
|
[
"MIT"
] | null | null | null |
Assignment1/Q3/daxpy.cc
|
Gurupradeep/Parallel-Programming
|
fe54eb921f8895518c9d041075a92a5bd1499737
|
[
"MIT"
] | null | null | null |
Assignment1/Q3/daxpy.cc
|
Gurupradeep/Parallel-Programming
|
fe54eb921f8895518c9d041075a92a5bd1499737
|
[
"MIT"
] | null | null | null |
/*
* DAXPI program.
* Run the program as follows.
* Compilation:
* g++ daxpy.cc -fopenmp
* Run:
* ./a.out
*/
#include <stdio.h>
#include <omp.h>
#include <iostream>
#define SIZE 1 << 16
namespace {
std::pair<double, int> get_parallel_execution_time(int X[], int Y[], int a, int num_of_threads) {
omp_set_num_threads(num_of_threads);
double start_time = omp_get_wtime();
int thread_id;
#pragma omp parallel shared(X, Y)
{
thread_id = omp_get_thread_num();
if (thread_id == 0) {
num_of_threads = omp_get_num_threads();
}
#pragma omp for
for (int i = 0; i < SIZE; i++)
X[i] = a*X[i] + Y[i];
}
double end_time = omp_get_wtime();
return std::make_pair(end_time - start_time, num_of_threads);
}
/*
* Unroll the loop to maximum the work done in a single iteration. This will save few thread operations (like computing the range to operate on etc) and compiler work.
*
*/
std::pair<double, int> get_parallel_execution_time_2(int X[], int Y[], int a, int num_of_threads) {
omp_set_num_threads(num_of_threads);
double start_time = omp_get_wtime();
int thread_id;
#pragma omp parallel shared(X, Y) private(thread_id)
{
thread_id = omp_get_thread_num();
if (thread_id == 0) {
num_of_threads = omp_get_num_threads();
}
#pragma omp for
for (int i = 0; i < SIZE; i += 2) {
X[i] = a * X[i] + Y[i];
X[i+1] = a * X[i+1] + Y[i + 1];
}
}
double end_time = omp_get_wtime();
return std::make_pair(end_time - start_time, num_of_threads);
}
void reset_dataset(int X[], int Y[], int size) {
for (int i = 0; i < SIZE; i++) {
X[i] = 1;
Y[i] = 2;
}
}
}
int main() {
int X[SIZE];
int Y[SIZE];
int a = 6;
reset_dataset(X, Y, SIZE);
double single_thread_time = get_parallel_execution_time(X, Y, a, 1).first;
printf("Time taken for execution using one thread is %lf seconds.\n", single_thread_time);
double time_taken;
for(int thread = 2; thread <= 15; thread++) {
reset_dataset(X, Y, SIZE);
std::pair<double, int> result = get_parallel_execution_time(X, Y, a, thread);
double speed_up = result.first / single_thread_time;
printf("Approach 1: For number of threads: %d speedup is: %lf.\n", result.second, speed_up);
reset_dataset(X, Y, SIZE);
std::pair<double, int> result_2 = get_parallel_execution_time_2(X, Y, a, thread);
speed_up = result_2.first / single_thread_time;
printf("Approach 2: For number of threads: %d speedup is: %lf.\n\n", result_2.second, speed_up);
}
return 0;
}
| 27.909091
| 167
| 0.671824
|
Gurupradeep
|
7d506758d667e9491d9f20c2cc5ec99e20a09365
| 9,141
|
cpp
|
C++
|
source/tools/finite/opt-internal/ceres_direct.cpp
|
DavidAce/DMRG
|
e465fd903eade1bf6aa74daacd8e2cf02e9e9332
|
[
"MIT"
] | 9
|
2017-10-31T22:50:28.000Z
|
2022-03-10T15:45:27.000Z
|
source/tools/finite/opt-internal/ceres_direct.cpp
|
DavidAce/DMRG
|
e465fd903eade1bf6aa74daacd8e2cf02e9e9332
|
[
"MIT"
] | null | null | null |
source/tools/finite/opt-internal/ceres_direct.cpp
|
DavidAce/DMRG
|
e465fd903eade1bf6aa74daacd8e2cf02e9e9332
|
[
"MIT"
] | 1
|
2019-07-16T00:27:56.000Z
|
2019-07-16T00:27:56.000Z
|
//
// Created by david on 2019-07-09.
//
#include "ceres_direct_functor.h"
#include <algorithms/class_algorithm_status.h>
#include <ceres/gradient_problem.h>
#include <config/nmspc_settings.h>
#include <tensors/class_tensors_finite.h>
#include <tensors/model/class_model_finite.h>
#include <tensors/state/class_state_finite.h>
#include <tools/common/fmt.h>
#include <tools/common/log.h>
#include <tools/common/prof.h>
#include <tools/finite/measure.h>
#include <tools/finite/opt-internal/opt-internal.h>
#include <tools/finite/opt-internal/report.h>
#include <tools/finite/opt_mps.h>
tools::finite::opt::opt_mps tools::finite::opt::internal::ceres_direct_optimization(const class_tensors_finite &tensors, const class_algorithm_status &status,
OptType optType, OptMode optMode, OptSpace optSpace) {
std::vector<size_t> sites(tensors.active_sites.begin(), tensors.active_sites.end());
opt_mps initial_state("current state", tensors.state->get_multisite_mps(), sites,
tools::finite::measure::energy(tensors) - tensors.model->get_energy_reduced(), // Eigval
tensors.model->get_energy_reduced(), // Energy reduced for full system
tools::finite::measure::energy_variance(tensors),
1.0, // Overlap
tensors.get_length());
return ceres_direct_optimization(tensors, initial_state, status, optType, optMode, optSpace);
}
tools::finite::opt::opt_mps tools::finite::opt::internal::ceres_direct_optimization(const class_tensors_finite &tensors, const opt_mps &initial_mps,
const class_algorithm_status &status, OptType optType, OptMode optMode,
OptSpace optSpace) {
tools::log->trace("Optimizing in DIRECT mode");
auto t_opt_dir = tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir"]->tic_token();
if constexpr(settings::debug)
if(initial_mps.has_nan()) throw std::runtime_error("initial_mps has nan's");
reports::bfgs_add_entry("Direct", "init", initial_mps);
const auto ¤t_mps = tensors.state->get_multisite_mps();
const auto current_map = Eigen::Map<const Eigen::VectorXcd>(current_mps.data(), current_mps.size());
auto options = internal::ceres_default_options;
auto summary = ceres::GradientProblemSolver::Summary();
opt_mps optimized_mps;
optimized_mps.set_name(initial_mps.get_name());
optimized_mps.set_sites(initial_mps.get_sites());
optimized_mps.set_length(initial_mps.get_length());
optimized_mps.set_energy_reduced(initial_mps.get_energy_reduced());
// When we use "reduced-energy mpo's", the current energy per site is subtracted from all the MPO's at the beginning of every iteration.
// The subtracted number is called "energy_reduced".
// Directly after the energy subtraction, the target energy is exactly zero, and Var H = <(H-Er)²>
// However, after some steps in the same iteration, the optimizer may have found a state with slightly different energy,
// so the target energy is actually 0 + dE.
// We can obtain the shift amount dE = <H-Er>, which we call "eigval", i.e. the eigenvalue of the operator <H-Er>
// Then, technically Var H = <(H-E+|dE|)²>, and if unaccounted for, we may get Var H < 0, which is a real pain since
// we are optimizing the logarithm of Var H.
// Here we use functor->set_shift in order to account for the shifted energy and reach better precision.
// Note 1: shifting only works if the mpo is not already compressed
// Note 2: shifting only makes sense if we are using reduced-energy mpos
switch(optType) {
case OptType::CPLX: {
auto t_opt_dir_bfgs = tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_bfgs"]->tic_token();
// Copy the initial guess and operate directly on it
optimized_mps.set_tensor(initial_mps.get_tensor());
auto * functor = new ceres_direct_functor<std::complex<double>>(tensors, status);
if(settings::precision::use_reduced_energy and settings::precision::use_shifted_mpo and not tensors.model->is_compressed_mpo_squared())
functor->set_shift(-std::abs(initial_mps.get_eigval())); // Account for the shange in energy since the last energy reduction
functor->compress(); // Compress the virtual bond between MPO² and the environments
CustomLogCallback ceres_logger(*functor);
options.callbacks.emplace_back(&ceres_logger);
ceres::GradientProblem problem(functor);
tools::log->trace("Running LBFGS direct cplx");
ceres::Solve(options, problem, optimized_mps.get_vector_cplx_as_2xreal().data(), &summary);
// Copy the results from the functor
optimized_mps.set_counter(functor->get_count());
optimized_mps.set_delta_f(functor->get_delta_f());
optimized_mps.set_grad_norm(functor->get_grad_max_norm());
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH2"] += *functor->t_H2n;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH2v"] += *functor->t_nH2n;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH"] += *functor->t_Hn;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vHv"] += *functor->t_nHn;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_step"] += *functor->t_step;
break;
}
case OptType::REAL: {
auto t_opt_dir_bfgs = tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_bfgs"]->tic_token();
// Here we make a temporary
auto initial_state_real = initial_mps.get_vector_cplx_as_1xreal();
auto * functor = new ceres_direct_functor<double>(tensors, status);
if(settings::precision::use_reduced_energy and settings::precision::use_shifted_mpo and not tensors.model->is_compressed_mpo_squared())
functor->set_shift(initial_mps.get_eigval()); // Account for the shange in energy since the last energy reduction
functor->compress(); // Compress the virtual bond between MPO² and the environments
CustomLogCallback ceres_logger(*functor);
options.callbacks.emplace_back(&ceres_logger);
ceres::GradientProblem problem(functor);
tools::log->trace("Running LBFGS direct real");
if constexpr(settings::debug) if(initial_state_real.hasNaN()) throw std::runtime_error("initial_state_real has nan's");
ceres::Solve(options, problem, initial_state_real.data(), &summary);
// Copy the results from the functor
optimized_mps.set_counter(functor->get_count());
optimized_mps.set_delta_f(functor->get_delta_f());
optimized_mps.set_grad_norm(functor->get_grad_max_norm());
optimized_mps.set_tensor_real(initial_state_real.data(), initial_mps.get_tensor().dimensions());
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH2"] += *functor->t_H2n;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH2v"] += *functor->t_nH2n;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vH"] += *functor->t_Hn;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_vHv"] += *functor->t_nHn;
*tools::common::profile::prof[AlgorithmType::xDMRG]["t_opt_dir_step"] += *functor->t_step;
break;
}
}
// Copy and set the rest of the tensor metadata
optimized_mps.normalize();
optimized_mps.set_energy(tools::finite::measure::energy(optimized_mps.get_tensor(), tensors));
optimized_mps.set_variance(tools::finite::measure::energy_variance(optimized_mps.get_tensor(), tensors));
optimized_mps.set_overlap(std::abs(current_map.dot(optimized_mps.get_vector())));
optimized_mps.set_iter(summary.iterations.size());
optimized_mps.set_time(summary.total_time_in_seconds);
reports::time_add_dir_entry();
int hrs = static_cast<int>(summary.total_time_in_seconds / 3600);
int min = static_cast<int>(std::fmod(summary.total_time_in_seconds, 3600) / 60);
double sec = std::fmod(std::fmod(summary.total_time_in_seconds, 3600), 60);
tools::log->debug("Finished LBFGS in {:0<2}:{:0<2}:{:0<.1f} seconds and {} iters. Exit status: {}. Message: {}", hrs, min, sec, summary.iterations.size(),
ceres::TerminationTypeToString(summary.termination_type), summary.message.c_str());
reports::bfgs_add_entry("Direct", "opt", optimized_mps);
tools::log->trace("Returning theta from optimization mode {} space {}", optMode, optSpace);
return optimized_mps;
}
| 65.76259
| 158
| 0.665791
|
DavidAce
|
7d552bfe40a9a06401a279e7d57c941c60e47bc7
| 271
|
cpp
|
C++
|
Shape/Triangle.cpp
|
AKoudounis/refactored-journey
|
81719c57104f14b141f0f7cd2aa805f9007ed79e
|
[
"MIT"
] | null | null | null |
Shape/Triangle.cpp
|
AKoudounis/refactored-journey
|
81719c57104f14b141f0f7cd2aa805f9007ed79e
|
[
"MIT"
] | null | null | null |
Shape/Triangle.cpp
|
AKoudounis/refactored-journey
|
81719c57104f14b141f0f7cd2aa805f9007ed79e
|
[
"MIT"
] | null | null | null |
//Andreas Koudounis 40089191
#include "Triangle.h"
Triangle::Triangle(Point* pt1, Point* pt2, Point* pt3) {
p1 = pt1;
p2 = pt2;
p3 = pt3;
}
Triangle::~Triangle()
{
std::cout << "Triangle object deleted";
}
void Triangle::print() const
{
}
| 12.318182
| 57
| 0.594096
|
AKoudounis
|
7d5563f2172b8cb46a14800424ba74e408bcb2fd
| 833
|
cc
|
C++
|
cudarap/tests/CDeviceTest.cc
|
seriksen/opticks
|
2173ea282bdae0bbd1abf4a3535bede334413ec1
|
[
"Apache-2.0"
] | 1
|
2020-05-13T06:55:49.000Z
|
2020-05-13T06:55:49.000Z
|
cudarap/tests/CDeviceTest.cc
|
seriksen/opticks
|
2173ea282bdae0bbd1abf4a3535bede334413ec1
|
[
"Apache-2.0"
] | null | null | null |
cudarap/tests/CDeviceTest.cc
|
seriksen/opticks
|
2173ea282bdae0bbd1abf4a3535bede334413ec1
|
[
"Apache-2.0"
] | null | null | null |
#include <vector>
#include "CDevice.hh"
#include "OPTICKS_LOG.hh"
void test_SaveLoad(const char* dirpath)
{
std::vector<CDevice> devs, devs2 ;
bool nosave = true ;
CDevice::Visible(devs, dirpath, nosave );
CDevice::Dump( devs, "visible devices");
CDevice::Save(devs, dirpath );
CDevice::Load(devs2, dirpath );
CDevice::Dump( devs2, "loaded devs2");
}
void test_Visible(const char* dirpath)
{
bool nosave = false ;
std::vector<CDevice> devs ;
CDevice::Visible(devs, dirpath, nosave );
CDevice::Dump( devs , "visible devices");
}
int main(int argc, char** argv)
{
OPTICKS_LOG(argc, argv);
//const char* dirpath = "/tmp" ;
const char* dirpath = "/home/blyth/.opticks/runcache" ;
//test_SaveLoad(dirpath);
test_Visible(dirpath);
return 0 ;
}
| 20.825
| 60
| 0.631453
|
seriksen
|
7d556cb8fda76759552fbb07b74ac1e8578d8717
| 1,632
|
cpp
|
C++
|
01.Introduction/01.Introduction/01.Introduction.cpp
|
zvet80/CppCourse
|
a8d488dba1ba649dfc6e6d906ed25e506ff30d99
|
[
"MIT"
] | null | null | null |
01.Introduction/01.Introduction/01.Introduction.cpp
|
zvet80/CppCourse
|
a8d488dba1ba649dfc6e6d906ed25e506ff30d99
|
[
"MIT"
] | null | null | null |
01.Introduction/01.Introduction/01.Introduction.cpp
|
zvet80/CppCourse
|
a8d488dba1ba649dfc6e6d906ed25e506ff30d99
|
[
"MIT"
] | null | null | null |
// 01.Introduction.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <array>
using namespace std;
void GetLowerUpper(string a)
{
int lower = 0;
int upper = 0;
int total = a.length();
for (int i = 0; i < total; i++)
{
if (int(a[i]) >= 65 && int(a[i]) <= 90)
{
upper++;
}
else if (int(a[i]) >= 97 && int(a[i]) <= 122)
{
lower++;
}
}
cout << "lower: " << lower << endl << "upper: " << upper << endl << "other:" << total - upper - lower << endl;
;
}
int CountLetter(string text, char letter)
{
int count = 0;
for (int i = 0; i < text.length(); i++)
{
if (text[i] == letter)
{
count++;
}
}
return count;
}
double SquareRoot(double x)
{
return sqrt(x);
}
int main()
{
cout << "Task1: Enter symbols: " << endl;
string letters;
getline(cin, letters);
GetLowerUpper(letters);
////////////////////////
cout << "Task2: Count letters: " << endl;
string text;
char letter;
cout << "Enter text: ";
getline(cin, text);
cout << "Enter a letter to search: ";
cin >> letter;
cout << "Letter: " << letter << " is found " << CountLetter(text, letter) << " times" << endl;
//////////////////////////
cout << "Task2: Get square root: " << endl;
double x;
cout << "Enter a positive number: ";
cin >> x;
cout << "The square root of " << x << " is: " << SquareRoot(x) << endl;
//////////////////////////
cout << "Task2: Sum the numbers in array: " << endl;
int arr[] = { 24, 2, 3, 53, 3, 5, 2, 27, 2, 1 };
int sum = 0;
for (int i = 0; i < 10; i++)
{
sum += arr[i];
}
cout << sum << endl;
return 0;
}
| 19.902439
| 111
| 0.53125
|
zvet80
|
7d556cf7f7616a1629e824147d5bebb561c7d7fb
| 13,760
|
cpp
|
C++
|
ocs2_pinocchio/ocs2_sphere_approximation/src/SphereApproximation.cpp
|
RIVeR-Lab/ocs2
|
399d3fad27b4a49e48e075a544f2f717944c5da9
|
[
"BSD-3-Clause"
] | null | null | null |
ocs2_pinocchio/ocs2_sphere_approximation/src/SphereApproximation.cpp
|
RIVeR-Lab/ocs2
|
399d3fad27b4a49e48e075a544f2f717944c5da9
|
[
"BSD-3-Clause"
] | null | null | null |
ocs2_pinocchio/ocs2_sphere_approximation/src/SphereApproximation.cpp
|
RIVeR-Lab/ocs2
|
399d3fad27b4a49e48e075a544f2f717944c5da9
|
[
"BSD-3-Clause"
] | null | null | null |
/******************************************************************************
Copyright (c) 2021, Farbod Farshidian. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the 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.
******************************************************************************/
#include "ocs2_sphere_approximation/SphereApproximation.h"
#include <algorithm>
#include <cmath>
namespace ocs2 {
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
SphereApproximation::SphereApproximation(const hpp::fcl::CollisionGeometry& geometry, size_t geomObjId, scalar_t maxExcess,
scalar_t shrinkRatio)
: geomObjId_(geomObjId), maxExcess_(maxExcess), shrinkRatio_(shrinkRatio) {
if (shrinkRatio <= 0.0 || shrinkRatio >= 1.0) {
throw std::runtime_error("[SphereApproximation] shrinkRation must be larger than 0.0 and smaller than 1.0!");
}
const auto& nodeType = geometry.getNodeType();
switch (nodeType) {
case hpp::fcl::NODE_TYPE::GEOM_BOX: {
const auto* boxPtr = dynamic_cast<const hpp::fcl::Box*>(&geometry);
approximateBox(boxPtr->halfSide * 2);
break;
}
case hpp::fcl::NODE_TYPE::GEOM_CYLINDER: {
const auto* cylinderPtr = dynamic_cast<const hpp::fcl::Cylinder*>(&geometry);
approximateCylinder(cylinderPtr->radius, cylinderPtr->halfLength * 2);
break;
}
case hpp::fcl::NODE_TYPE::GEOM_SPHERE: {
const auto* spherePtr = dynamic_cast<const hpp::fcl::Sphere*>(&geometry);
numSpheres_ = 1;
sphereRadius_ = spherePtr->radius;
sphereCentersToObjectCenter_.resize(1);
sphereCentersToObjectCenter_[0] = vector_t::Zero(3);
break;
}
default:
throw std::runtime_error("[SphereApproximation] Undefined shape primitive for sphere approximation");
}
}
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
void SphereApproximation::approximateBox(const vector_t& sides) {
// indices of the shortest, medium, and longest side
size_array_t idxSorted = {0, 1, 2};
std::stable_sort(idxSorted.begin(), idxSorted.end(),
[&sides](const size_t& idx1, const size_t& idx2) { return sides[idx1] < sides[idx2]; });
vector_t initSphereRadii(3);
size_t caseIdx;
initSphereRadii << sides.norm() / 2, sides[idxSorted[0]] / 2 + maxExcess_, std::sqrt(3) * maxExcess_ / (std::sqrt(3) - 1);
sphereRadius_ = initSphereRadii.minCoeff(&caseIdx);
// Distance between the first sphere center and the corner along x, y, z
vector_t distances(3);
// Number of spheres along x, y, z
vector_t numSpheres(3);
switch (caseIdx) {
case 0:
distances = sides / 2;
numSpheres = vector_t::Ones(3);
// No re-calculation of the distances is required
break;
case 1: {
scalar_t dist = std::sqrt(std::pow(sphereRadius_, 2) - std::pow(sides[idxSorted[0]] / 2, 2)) / std::sqrt(2);
if (dist >= sides[idxSorted[1]] / 2) {
distances[idxSorted[0]] = sides[idxSorted[0]] / 2;
distances[idxSorted[1]] = sides[idxSorted[1]] / 2;
distances[idxSorted[2]] =
std::sqrt(std::pow(sphereRadius_, 2) - std::pow(distances[idxSorted[0]], 2) - std::pow(distances[idxSorted[1]], 2));
numSpheres[idxSorted[0]] = numSpheres[idxSorted[1]] = 1;
numSpheres[idxSorted[2]] = std::ceil(sides[idxSorted[2]] / (2 * distances[idxSorted[2]]));
// Re-calculate the distances
distances[idxSorted[2]] = std::max(sides[idxSorted[2]] / (2 * numSpheres[idxSorted[2]]), sphereRadius_ - maxExcess_);
} else {
distances[idxSorted[0]] = sides[idxSorted[0]] / 2;
distances[idxSorted[1]] = distances[idxSorted[2]] = dist;
numSpheres[idxSorted[0]] = 1;
numSpheres[idxSorted[1]] = std::ceil(sides[idxSorted[1]] / (2 * distances[idxSorted[1]]));
numSpheres[idxSorted[2]] = std::ceil(sides[idxSorted[2]] / (2 * distances[idxSorted[2]]));
// Re-calculate the distances
distances[idxSorted[1]] = distances[idxSorted[2]] =
std::max(sides[idxSorted[1]] / (2 * numSpheres[idxSorted[1]]), sides[idxSorted[2]] / (2 * numSpheres[idxSorted[2]]));
}
break;
}
case 2:
distances = (sphereRadius_ - maxExcess_) * vector_t::Ones(3);
numSpheres[idxSorted[0]] = std::ceil(sides[idxSorted[0]] / (2 * distances[idxSorted[0]]));
numSpheres[idxSorted[1]] = std::ceil(sides[idxSorted[1]] / (2 * distances[idxSorted[1]]));
numSpheres[idxSorted[2]] = std::ceil(sides[idxSorted[2]] / (2 * distances[idxSorted[2]]));
// Re-calculate the distances
distances = std::max({sides[idxSorted[0]] / (2 * numSpheres[idxSorted[0]]), sides[idxSorted[1]] / (2 * numSpheres[idxSorted[1]]),
sides[idxSorted[2]] / (2 * numSpheres[idxSorted[2]])}) *
vector_t::Ones(3);
break;
}
// re-calculate the sphere radius
sphereRadius_ = distances.norm();
numSpheres_ = numSpheres[0] * numSpheres[1] * numSpheres[2];
sphereCentersToObjectCenter_.resize(numSpheres_);
// Sphere spacings along x, y, z
vector_t spacings(3);
for (size_t i = 0; i < numSpheres.size(); i++) {
if (numSpheres[i] > 1) {
spacings[i] = (sides[i] - 2 * distances[i]) / (numSpheres[i] - 1);
}
}
size_t count = 0;
for (size_t i = 0; i < numSpheres[0]; i++) {
for (size_t j = 0; j < numSpheres[1]; j++) {
for (size_t k = 0; k < numSpheres[2]; k++) {
sphereCentersToObjectCenter_[count] << distances[0] + i * spacings[0] - sides[0] / 2, distances[1] + j * spacings[1] - sides[1] / 2,
distances[2] + k * spacings[2] - sides[2] / 2;
count++;
}
}
}
}
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
void SphereApproximation::approximateCylinder(const scalar_t radius, const scalar_t length) {
// First, approximate the rectangle cross-section of the cylinder
vector_t sides(2);
sides << 2 * radius, length;
size_array_t idxSorted = {0, 1};
if (sides(0) > sides(1)) {
std::swap(idxSorted[0], idxSorted[1]);
}
scalar_t maxExcessL = maxExcess_ * shrinkRatio_;
vector_t distances(2);
vector_t numSpheres(2);
approximateRectanglularCrossSection(sides, idxSorted, maxExcess_, sphereRadius_, numSpheres, distances);
bool recursiveApproximation = false; // If recursive approximation of the cylinder base is necessary.
if (numSpheres[0] > 1) {
// More than one sphere is required along radial direction with maxExcess. Re-approximate the rectangular cross-section using the
// reduced threshold in favor of the later approximation of the circular base.
approximateRectanglularCrossSection(sides, idxSorted, maxExcessL, sphereRadius_, numSpheres, distances);
recursiveApproximation = true;
}
scalar_t spacingLength;
if (numSpheres[1] > 1) {
spacingLength = (sides[1] - 2 * distances[1]) / (numSpheres[1] - 1);
}
// Second, approximate the circle base of the cylinder
vector_array_t circleCentersToBaseCenter;
if (!recursiveApproximation) {
circleCentersToBaseCenter.push_back(vector_t::Zero(2));
} else {
scalar_t radiusBase = radius;
scalar_t radiusCircle = std::sqrt(std::pow(sphereRadius_, 2) - std::pow(distances[1], 2));
scalar_t maxExcessR = maxExcess_ - maxExcessL;
while (recursiveApproximation) {
scalar_t shift, alpha, numCircles;
recursiveApproximation = approximateCircleBase(radiusBase, radiusCircle, maxExcessR, shift, alpha, numCircles);
for (size_t i = 0; i < numCircles; i++) {
vector_t circleCenter(2);
circleCenter << shift * std::sin(i * alpha), shift * std::cos(i * alpha);
circleCentersToBaseCenter.push_back(circleCenter);
}
// Enclose the uncovered area by another circle with radiusBase
radiusBase = shift / std::cos(alpha / 2) - radiusCircle;
}
}
numSpheres[0] = circleCentersToBaseCenter.size();
numSpheres_ = numSpheres[0] * numSpheres[1];
sphereCentersToObjectCenter_.resize(numSpheres_);
size_t count = 0;
for (size_t i = 0; i < numSpheres[1]; i++) {
for (size_t j = 0; j < numSpheres[0]; j++) {
sphereCentersToObjectCenter_[count] << circleCentersToBaseCenter[j], distances[1] + i * spacingLength - sides[1] / 2;
count++;
}
}
}
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
void SphereApproximation::approximateRectanglularCrossSection(const vector_t& sides, const size_array_t& idxSorted,
const scalar_t maxExcess, scalar_t& sphereRadius, vector_t& numSpheres,
vector_t& distances) {
vector_t initSphereRadii(3);
size_t caseIdx;
initSphereRadii << sides.norm() / 2, sides[idxSorted[0]] / 2 + maxExcess, std::sqrt(2) * maxExcess / (std::sqrt(2) - 1);
sphereRadius = initSphereRadii.minCoeff(&caseIdx);
switch (caseIdx) {
case 0:
distances = sides / 2;
numSpheres = vector_t::Ones(2);
break;
case 1:
distances[idxSorted[0]] = sides[idxSorted[0]] / 2;
distances[idxSorted[1]] = std::sqrt(std::pow(sphereRadius, 2) - std::pow(distances[idxSorted[0]], 2));
numSpheres[idxSorted[0]] = 1;
numSpheres[idxSorted[1]] = std::ceil(sides[idxSorted[1]] / (2 * distances[idxSorted[1]]));
// Re-calculate the distances
distances[idxSorted[1]] = sides[idxSorted[1]] / (2 * numSpheres[idxSorted[1]]);
break;
case 2:
distances = (sphereRadius - maxExcess) * vector_t::Ones(2);
numSpheres[idxSorted[0]] = std::ceil(sides[idxSorted[0]] / (2 * distances[idxSorted[0]]));
numSpheres[idxSorted[1]] = std::ceil(sides[idxSorted[1]] / (2 * distances[idxSorted[1]]));
// Re-calculate the distances
distances = std::max(sides[idxSorted[0]] / (2 * numSpheres[idxSorted[0]]), sides[idxSorted[1]] / (2 * numSpheres[idxSorted[1]])) *
vector_t::Ones(2);
break;
}
sphereRadius = distances.norm();
}
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
bool SphereApproximation::approximateCircleBase(const scalar_t radiusBase, const scalar_t radiusSphereCrossSection,
const scalar_t maxExcessR, scalar_t& shift, scalar_t& alpha, scalar_t& numCircles) {
if (radiusSphereCrossSection < radiusBase - std::numeric_limits<scalar_t>::epsilon()) {
shift = radiusBase + std::min(0.0, maxExcessR - radiusSphereCrossSection);
alpha =
2 * std::acos((std::pow(radiusBase, 2) + std::pow(shift, 2) - std::pow(radiusSphereCrossSection, 2)) / (2 * radiusBase * shift));
numCircles = std::ceil(2 * M_PI / alpha);
// Re-calculate alpha & shift
alpha = 2 * M_PI / numCircles;
vector_t intersection(2);
intersection << radiusBase * std::sin(alpha / 2), radiusBase * std::cos(alpha / 2);
shift = intersection[1] - std::sqrt(std::pow(radiusSphereCrossSection, 2) - std::pow(intersection[0], 2));
return true;
} else {
shift = 0;
alpha = 0;
numCircles = 1;
return false;
}
}
} // namespace ocs2
| 45.263158
| 140
| 0.579433
|
RIVeR-Lab
|
7d57e5f2f52270ca7a9a1e338350d563caeaa06d
| 8,942
|
cpp
|
C++
|
Source/MapperDefinitions.cpp
|
hamzahamidi/Xidi
|
d7585ecf23fd17dd5be4e69f63bae08aa0e96988
|
[
"BSD-3-Clause"
] | 1
|
2021-06-05T00:22:08.000Z
|
2021-06-05T00:22:08.000Z
|
Source/MapperDefinitions.cpp
|
hamzahamidi/Xidi
|
d7585ecf23fd17dd5be4e69f63bae08aa0e96988
|
[
"BSD-3-Clause"
] | null | null | null |
Source/MapperDefinitions.cpp
|
hamzahamidi/Xidi
|
d7585ecf23fd17dd5be4e69f63bae08aa0e96988
|
[
"BSD-3-Clause"
] | null | null | null |
/*****************************************************************************
* Xidi
* DirectInput interface for XInput controllers.
*****************************************************************************
* Authored by Samuel Grossman
* Copyright (c) 2016-2021
*************************************************************************//**
* @file MapperDefinitions.cpp
* Definitions of all known mapper types.
*****************************************************************************/
#include "ControllerTypes.h"
#include "ElementMapper.h"
#include "Mapper.h"
namespace Xidi
{
namespace Controller
{
// -------- MAPPER DEFINITIONS ------------------------------------- //
/// Defines all known mapper types, one element per type. The first element is the default mapper.
/// Any field that corresponds to an XInput controller element can be omitted or assigned `nullptr` and the mapper will simply ignore input from that XInput controller element.
static const Mapper kMappers[] = {
Mapper(L"StandardGamepad", {
.stickLeftX = std::make_unique<AxisMapper>(EAxis::X),
.stickLeftY = std::make_unique<AxisMapper>(EAxis::Y),
.stickRightX = std::make_unique<AxisMapper>(EAxis::Z),
.stickRightY = std::make_unique<AxisMapper>(EAxis::RotZ),
.dpadUp = std::make_unique<PovMapper>(EPovDirection::Up),
.dpadDown = std::make_unique<PovMapper>(EPovDirection::Down),
.dpadLeft = std::make_unique<PovMapper>(EPovDirection::Left),
.dpadRight = std::make_unique<PovMapper>(EPovDirection::Right),
.triggerLT = std::make_unique<ButtonMapper>(EButton::B7),
.triggerRT = std::make_unique<ButtonMapper>(EButton::B8),
.buttonA = std::make_unique<ButtonMapper>(EButton::B1),
.buttonB = std::make_unique<ButtonMapper>(EButton::B2),
.buttonX = std::make_unique<ButtonMapper>(EButton::B3),
.buttonY = std::make_unique<ButtonMapper>(EButton::B4),
.buttonLB = std::make_unique<ButtonMapper>(EButton::B5),
.buttonRB = std::make_unique<ButtonMapper>(EButton::B6),
.buttonBack = std::make_unique<ButtonMapper>(EButton::B9),
.buttonStart = std::make_unique<ButtonMapper>(EButton::B10),
.buttonLS = std::make_unique<ButtonMapper>(EButton::B11),
.buttonRS = std::make_unique<ButtonMapper>(EButton::B12)
}),
Mapper(L"DigitalGamepad", {
.stickLeftX = std::make_unique<DigitalAxisMapper>(EAxis::X),
.stickLeftY = std::make_unique<DigitalAxisMapper>(EAxis::Y),
.stickRightX = std::make_unique<DigitalAxisMapper>(EAxis::Z),
.stickRightY = std::make_unique<DigitalAxisMapper>(EAxis::RotZ),
.dpadUp = std::make_unique<DigitalAxisMapper>(EAxis::Y, AxisMapper::EDirection::Negative),
.dpadDown = std::make_unique<DigitalAxisMapper>(EAxis::Y, AxisMapper::EDirection::Positive),
.dpadLeft = std::make_unique<DigitalAxisMapper>(EAxis::X, AxisMapper::EDirection::Negative),
.dpadRight = std::make_unique<DigitalAxisMapper>(EAxis::X, AxisMapper::EDirection::Positive),
.triggerLT = std::make_unique<ButtonMapper>(EButton::B7),
.triggerRT = std::make_unique<ButtonMapper>(EButton::B8),
.buttonA = std::make_unique<ButtonMapper>(EButton::B1),
.buttonB = std::make_unique<ButtonMapper>(EButton::B2),
.buttonX = std::make_unique<ButtonMapper>(EButton::B3),
.buttonY = std::make_unique<ButtonMapper>(EButton::B4),
.buttonLB = std::make_unique<ButtonMapper>(EButton::B5),
.buttonRB = std::make_unique<ButtonMapper>(EButton::B6),
.buttonBack = std::make_unique<ButtonMapper>(EButton::B9),
.buttonStart = std::make_unique<ButtonMapper>(EButton::B10),
.buttonLS = std::make_unique<ButtonMapper>(EButton::B11),
.buttonRS = std::make_unique<ButtonMapper>(EButton::B12)
}),
Mapper(L"ExtendedGamepad", {
.stickLeftX = std::make_unique<AxisMapper>(EAxis::X),
.stickLeftY = std::make_unique<AxisMapper>(EAxis::Y),
.stickRightX = std::make_unique<AxisMapper>(EAxis::Z),
.stickRightY = std::make_unique<AxisMapper>(EAxis::RotZ),
.dpadUp = std::make_unique<PovMapper>(EPovDirection::Up),
.dpadDown = std::make_unique<PovMapper>(EPovDirection::Down),
.dpadLeft = std::make_unique<PovMapper>(EPovDirection::Left),
.dpadRight = std::make_unique<PovMapper>(EPovDirection::Right),
.triggerLT = std::make_unique<AxisMapper>(EAxis::RotX),
.triggerRT = std::make_unique<AxisMapper>(EAxis::RotY),
.buttonA = std::make_unique<ButtonMapper>(EButton::B1),
.buttonB = std::make_unique<ButtonMapper>(EButton::B2),
.buttonX = std::make_unique<ButtonMapper>(EButton::B3),
.buttonY = std::make_unique<ButtonMapper>(EButton::B4),
.buttonLB = std::make_unique<ButtonMapper>(EButton::B5),
.buttonRB = std::make_unique<ButtonMapper>(EButton::B6),
.buttonBack = std::make_unique<ButtonMapper>(EButton::B7),
.buttonStart = std::make_unique<ButtonMapper>(EButton::B8),
.buttonLS = std::make_unique<ButtonMapper>(EButton::B9),
.buttonRS = std::make_unique<ButtonMapper>(EButton::B10)
}),
Mapper(L"XInputNative", {
.stickLeftX = std::make_unique<AxisMapper>(EAxis::X),
.stickLeftY = std::make_unique<AxisMapper>(EAxis::Y),
.stickRightX = std::make_unique<AxisMapper>(EAxis::RotX),
.stickRightY = std::make_unique<AxisMapper>(EAxis::RotY),
.dpadUp = std::make_unique<PovMapper>(EPovDirection::Up),
.dpadDown = std::make_unique<PovMapper>(EPovDirection::Down),
.dpadLeft = std::make_unique<PovMapper>(EPovDirection::Left),
.dpadRight = std::make_unique<PovMapper>(EPovDirection::Right),
.triggerLT = std::make_unique<AxisMapper>(EAxis::Z),
.triggerRT = std::make_unique<AxisMapper>(EAxis::RotZ),
.buttonA = std::make_unique<ButtonMapper>(EButton::B1),
.buttonB = std::make_unique<ButtonMapper>(EButton::B2),
.buttonX = std::make_unique<ButtonMapper>(EButton::B3),
.buttonY = std::make_unique<ButtonMapper>(EButton::B4),
.buttonLB = std::make_unique<ButtonMapper>(EButton::B5),
.buttonRB = std::make_unique<ButtonMapper>(EButton::B6),
.buttonBack = std::make_unique<ButtonMapper>(EButton::B7),
.buttonStart = std::make_unique<ButtonMapper>(EButton::B8),
.buttonLS = std::make_unique<ButtonMapper>(EButton::B9),
.buttonRS = std::make_unique<ButtonMapper>(EButton::B10)
}),
Mapper(L"XInputSharedTriggers", {
.stickLeftX = std::make_unique<AxisMapper>(EAxis::X),
.stickLeftY = std::make_unique<AxisMapper>(EAxis::Y),
.stickRightX = std::make_unique<AxisMapper>(EAxis::RotX),
.stickRightY = std::make_unique<AxisMapper>(EAxis::RotY),
.dpadUp = std::make_unique<PovMapper>(EPovDirection::Up),
.dpadDown = std::make_unique<PovMapper>(EPovDirection::Down),
.dpadLeft = std::make_unique<PovMapper>(EPovDirection::Left),
.dpadRight = std::make_unique<PovMapper>(EPovDirection::Right),
.triggerLT = std::make_unique<AxisMapper>(EAxis::Z, AxisMapper::EDirection::Positive),
.triggerRT = std::make_unique<AxisMapper>(EAxis::Z, AxisMapper::EDirection::Negative),
.buttonA = std::make_unique<ButtonMapper>(EButton::B1),
.buttonB = std::make_unique<ButtonMapper>(EButton::B2),
.buttonX = std::make_unique<ButtonMapper>(EButton::B3),
.buttonY = std::make_unique<ButtonMapper>(EButton::B4),
.buttonLB = std::make_unique<ButtonMapper>(EButton::B5),
.buttonRB = std::make_unique<ButtonMapper>(EButton::B6),
.buttonBack = std::make_unique<ButtonMapper>(EButton::B7),
.buttonStart = std::make_unique<ButtonMapper>(EButton::B8),
.buttonLS = std::make_unique<ButtonMapper>(EButton::B9),
.buttonRS = std::make_unique<ButtonMapper>(EButton::B10)
})
};
}
}
| 61.668966
| 184
| 0.576269
|
hamzahamidi
|