lang
stringclasses 10
values | seed
stringlengths 5
2.12k
|
---|---|
cpp | static void on_event_internal(uv_async_t* async, int status) {
#else
static void on_event_internal(uv_async_t* async) {
#endif
EventThread* thread = static_cast<EventThread*>(async->data);
E event;
while (thread->event_queue_->dequeue(event)) {
thread->on_event(event);
}
} |
cpp |
TEST(Seq, mult_random_matr_7x7) {
std::vector<double> a = GenSpareMatrix(7);
std::vector<double> b = GenSpareMatrix(7);
CCS c = createCCS(7, MultMatrix(7, a, b));
CCS A = createCCS(7, a);
CCS B = createCCS(7, b);
CCS C = MultCCS(TranspSpareMatrix(A), B); |
cpp | while (n) {
if (n & 1) {
ans += pow(2, po);
}
n >>= 1;
po--; |
cpp | return *cached_interpolable_value_;
}
NonInterpolableValue* TransitionInterpolation::CurrentNonInterpolableValue()
const {
if (cached_fraction_ == 0) {
return start_.non_interpolable_value.Get();
}
if (cached_fraction_ == 1) { |
cpp |
void PurgeLog()
{
std::ofstream logfile;
logfile.open("./logs/log");
logfile << "";
logfile.close();
}
void LogIt(LogSeverityType type, String method, String message)
{ |
cpp | //--------------------------------------------------------------------------
#include <pch.cpp>
#pragma hdrstop
#include <stdlib.h>
#include "csdisp.h"
#include "csprop.h"
#define __dwFILE__ __dwFILE_CERTLIB_VIEWEXT_CPP__
//+------------------------------------------------------------------------
// IEnumCERTVIEWEXTENSION dispatch support
|
cpp | }
switch (image->format) {
case Image_Format_R32G32B32A32_SFLOAT: headerDX10.mDXGIFormat = 6;
break;
case Image_Format_E5B9G9R9_UFLOAT_PACK32: headerDX10.mDXGIFormat = 67;
break;
case Image_Format_B10G11R11_UFLOAT_PACK32: headerDX10.mDXGIFormat = 26;
break;
default: return false;
}
}
}
// header. |
cpp | #include "main_window.h"
// Resources file auto-generated during build that packs all the
// web resources into a single blob that sciter knows how to reference
#include "resources.h"
int uimain(std::function<int()> run) |
cpp | min_height = min(min_height, h1);
max_height = max(max_height, h1);
}
else
{ |
cpp | _webpa = nullptr;
_service = nullptr;
}
/* virtual */ string WebPA::Information() const
{
// No additional info to report.
return (string());
}
/* virtual */ void WebPA::Inbound(Web::Request& /* request */)
{
}
|
cpp |
uint64_t shaderID;
uint32_t pipelineLayoutIdentifier;
struct Input
{
operator bool() const // Returns true if stream contains data
{
return format != VK_FORMAT_UNDEFINED;
}
VkFormat format; // TODO(b/148016460): Could be restricted to VK_FORMAT_END_RANGE
unsigned int attribType : BITS(SpirvShader::ATTRIBTYPE_LAST);
}; |
cpp | nLargerCrd = nStartCrd[0] > nEndCrd[0] ? nStartCrd[0] : nEndCrd[0];
for (int i=nSmallerCrd; i<=nLargerCrd; i++)
{
oceanFloor[i][nStartCrd[1]] += 1;
}
}
// PART2: If diagnoal
else
{
nSmallerXCrd = nStartCrd[0] < nEndCrd[0] ? nStartCrd[0] : nEndCrd[0];
nLargerXCrd = nStartCrd[0] > nEndCrd[0] ? nStartCrd[0] : nEndCrd[0]; |
cpp | int aboutLabelWidth = ui->aboutImage_label->width();
// Getting the height of the aboutImage_label
int aboutLabelHeight = ui->aboutImage_label->height();
// Setting the cover image of the aboutImage_label
ui->aboutImage_label->setPixmap(aboutImagePix.scaled(aboutLabelWidth, aboutLabelHeight, Qt::KeepAspectRatio));
}
AboutDialog::~AboutDialog()
{
delete ui;
}
|
cpp | bool Timer::hasExpired() const {
std::lock_guard<std::mutex> lock(impl_->mutex);
return !impl_->isRunning;
}
Source Timer::eventSource() const {
return impl_->eventGenerator.eventSource();
}
}
}
|
cpp | ranges[1][0] = BitCast<UintT>(static_cast<T>(-0.0));
ranges[1][1] = min_bits;
range_count = 2;
}
|
cpp |
// These aren't declared in any Boehm GC header.
void GC_finalize_all (void);
ptr_t GC_debug_generic_malloc (size_t size, int k, GC_EXTRA_PARAMS);
};
#define MAYBE_MARK(Obj, Top, Limit, Source, Exit) \
Top=GC_MARK_AND_PUSH((GC_PTR)Obj, Top, Limit, (GC_PTR *)Source)
// `kind' index used when allocating Java arrays.
static int array_kind_x;
// Freelist used for Java arrays.
static ptr_t *array_free_list; |
cpp | }
Namespace const* Database::getNamespaceById(std::size_t id) const noexcept
{
return entityCast<Namespace>(getEntityById(id));
}
Namespace const* Database::getNamespaceByName(char const* name) const |
cpp | #include <cstring>
int main(void) {
int lo = 1, hi = 1000;
while (true) {
int m = (lo+hi)/2;
printf("%d\n", m);
fflush(stdout);
char res[1000];
scanf("%s", res);
if (!strcmp(res, "correct")) break; |
cpp | }
int64_t SimpleDataProviderBase::getSize() {
LOG(FATAL) << "Currently, not implemented";
return 0;
}
int64_t SimpleDataProviderBase::fillBuffer() {
int64_t n = sampleNumInBuf_ - nextItemIndex_;
/* flash the remaining data to the beginning of the buffer */ |
cpp |
void QHttpHash::slotFinished()
{
QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (reply->error()) {
reset();
} else if (! redirectionTarget.isNull()) {
qDebug() << "Redirect?";
QUrl newUrl = url.resolved(redirectionTarget.toUrl());
url = newUrl;
reset();
download();
return;
} |
cpp | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#include <up/prolog.hpp>
#ifdef UP_HAS_STDC_WCHAR
#include <up/filesystem.hpp> |
cpp | // Writing MetadataGetter for method: GlobalNamespace::DlcPromoExperimentModel::BuyPackButtonWasShown
// Il2CppName: BuyPackButtonWasShown
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::DlcPromoExperimentModel::*)(GlobalNamespace::IBeatmapLevelPack*, ::Il2CppString*, ::Il2CppString*)>(&GlobalNamespace::DlcPromoExperimentModel::BuyPackButtonWasShown)> {
static const MethodInfo* get() {
static auto* pack = &::il2cpp_utils::GetClassFromName("", "IBeatmapLevelPack")->byval_arg;
static auto* page = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
static auto* customText = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::DlcPromoExperimentModel*), "BuyPackButtonWasShown", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{pack, page, customText});
}
};
// Writing MetadataGetter for method: GlobalNamespace::DlcPromoExperimentModel::GetExperimentEventData |
cpp | : m_SrcColor(Color::White)
// properties
, m_fDuration(1.0f)
, m_DestColor(Color::Black)
{
}
//! destructor
LightVisitor::~LightVisitor()
{ |
cpp | // BlueprintGeneratedClass LobbyCharacterMale_v2.LobbyCharacterMale_v2_C
// 0x0000 (0x0960 - 0x0960)
class ALobbyCharacterMale_v2_C : public ALobbyCharacterBase_v2_C
{
public:
|
cpp | Mute object2( value2 );
std::stringstream default_constructed;
object1.toStream( default_constructed, 0 );
std::stringstream object2_stream;
object2.toStream( object2_stream, 2 );
std::string expected = R"(<mute>off</mute>)";
std::string actual = default_constructed.str();
CHECK_EQUAL( expected, actual )
expected = indentString+indentString+R"(<mute>straight</mute>)"; |
cpp | {
bool has_bits(boost::uint8_t const* k, boost::uint8_t const* bits, int len)
{
boost::uint32_t idx1 = boost::uint32_t(k[0]) | (boost::uint32_t(k[1]) << 8);
boost::uint32_t idx2 = boost::uint32_t(k[2]) | (boost::uint32_t(k[3]) << 8);
idx1 %= len * 8;
idx2 %= len * 8;
return (bits[idx1/8] & (1 << (idx1 & 7))) != 0
&& (bits[idx2/8] & (1 << (idx2 & 7))) != 0; |
cpp |
Buffer ParityFEC::Decode(const std::vector<Buffer>& dataPackets, const Buffer& fecPacket)
{
std::size_t maxSize = 0;
for (const Buffer& pkt : dataPackets)
{
maxSize = std::max(maxSize, pkt.Length());
} |
cpp | c << apply_QGate(qvec, H);
c << apply_QGate(qvec, X);
c << Z(qvec.back()).control(controller);
c << apply_QGate(qvec, X);
c << apply_QGate(qvec, H);
|
cpp | }
//------------------------------------------------------------------------------
namespace
{
|
cpp | else {
// Take the first 25 characters only.
mCourseName = newName.substr(0, 25);
}
// is there a loophole to this rule?
}
// What is the return type of this method? |
cpp |
envelope.SetSelection(id, true);
if (envelope.Commit())
{
envelope.MoveArrangeToPoint(id, ((int)ct->user > 0) ? (id-1) : (id+1));
Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG | UNDO_STATE_ITEMS, -1);
} |
cpp | * the agent checks that the FINGERPRINT Attribute is present and contains the correct value. If any errors
* are detected, the Message is silently discarded. In the case when STUN is being multiplexed with another Protocol,
* an error may indicate that this is not really a STUN Message; in this case, the agent should try to parse
* the Message as a different Protocol.
*
* Since all STUN attributes are padded to a multiple of 4 bytes, the last 2 bits of this field are always zero.
* This provides another way to distinguish STUN packets from packets of other protocols.
*/
std::optional<std::pair<Header, uint16_t>> Header::parse(BufferReader &reader) {
MS_GET(raw_header, reader.read_raw(header_length), std::nullopt)
NetworkHeader raw{net::ntoh(*reinterpret_cast<const NetworkHeader *>(raw_header))};
|
cpp |
\ingroup appearance
This style provides a slightly improved Motif look similar to some
versions of the Common Desktop Environment (CDE). The main
differences are thinner frames and more modern radio buttons and |
cpp | }
}
template <typename T>
T sign(T x) { return (x == .0 ? .0 : (x < .0 ? -1.0 : 1.0)); }
void GpgpuSneRaster::updateEmbedding(embedding_type* embedding, float exaggeration, float iteration, float mult) {
for (int i = 0; i < _gradient.size(); ++i) {
_gain[i] = static_cast<float>((sign(_gradient[i]) != sign(_previous_gradient[i])) ? (_gain[i] + .2) : (_gain[i] * .8));
if (_gain[i] < _params._minimum_gain) {
_gain[i] = static_cast<float>(_params._minimum_gain);
} |
cpp | if (process::current() != nullptr)
{
name = process::current()->get_name();
}
if (log_state > 4 || log_state == 3)
{
printf(log_type_table[LOG_FATAL], name, data);
return;
}
printf(log_type_table[log_state], name, data);
}
logging::logging()
{
} |
cpp | }
bool BloomFilter::contains(const uint32_t* filter, uint32_t filterSize, uint32_t nbHash, uint32_t value)
{
uint32_t seed = DEFAULT_HASH_SEED;
filterSize *= BLOOM_FILTER_UNIT_SIZE;
for (uint32_t i = 0; i < nbHash; i++)
{
seed = hash(value, seed);
uint32_t h = seed % filterSize;
if (!(filter[h / BLOOM_FILTER_UNIT_SIZE] & 1U << (h % BLOOM_FILTER_UNIT_SIZE)))
return false;
}
return true; |
cpp | int main(){
vector<int> graph[V];
addEdge(graph,0,1);
addEdge(graph,0,3);
addEdge(graph,1,2);
addEdge(graph,2,3);
addEdge(graph,2,6);
addEdge(graph,3,4);
addEdge(graph,4,5);
addEdge(graph,5,6);
bfs(graph,0); |
cpp | return OPENSSL_OK == EVP_DigestUpdate(m_ctx, &value, sizeof(value));
}
bool OpenSslDigest::processUInt16(uint16_t value) noexcept {
const DataBlock bigEndianValue{(DataBlock::value_type)(value >> 8), (DataBlock::value_type)value}; |
cpp | #include "../Include/Server.hpp"
|
cpp | <gh_stars>10-100
/*
* Package: CommonAlignmentProducer
* Class : AlignmentMonitorMuonVsCurvature
*
* Original Author: <NAME>
* Created: Fri Feb 19 21:45:02 CET 2010
*
* $Id:$
*/
#include "Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorPluginFactory.h"
#include "Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorBase.h"
#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h" |
cpp | (is_clockwise ? clockwise_edges_ : anticlockwise_edges_)
->push_back(MakeEdge(start_vertex_id,
static_cast<int>(vertices_->size()) - 1));
start_pos = end_pos + 1;
y = (is_clockwise ? bbox_.down_contour : bbox_.up_contour)
->at(start_pos - this->x_min());
vertices_->push_back(Vertex(start_pos, y));
start_vertex_id = static_cast<int>(vertices_->size()) - 1;
}
(is_clockwise ? clockwise_edges_ : anticlockwise_edges_)
->push_back(MakeEdge(start_vertex_id, end_vertex_id));
} else { |
cpp | #include <toy_compiler/munster/ast/node.hpp>
namespace munster::ast
{
auto node_factory(grammar::action type, const lex_item& item, std::vector<node_ptr>& recs)
-> node_ptr;
}; // namespace munster::ast
|
cpp | memo_->TestSuccess(curr_iroot_, true);
}
}
void Scheduler::TestFail() {
SchedulerCommon::TestFail();
if (!knob_->ValueInt("target_iroot")) {
memo_->TestFail(curr_iroot_, false);
}
} |
cpp | {
return ONI_STATUS_NOT_IMPLEMENTED;
}
OniStatus OzDevice::tryManualTrigger()
{
return ONI_STATUS_NOT_IMPLEMENTED;
}
OniBool OzDevice::isImageRegistrationModeSupported(OniImageRegistrationMode mode) |
cpp | {
REQUIRE(a(i) == b(i));
}
}
TEST_CASE("Vector Tests", "[Vector]")
{
double tol = 1e-12; |
cpp |
struct CResourceAsyncReference : CRTTIType
{
CName name; // 10
CName unk18; // 18
CRTTIType* innerType; // 20 |
cpp | void sound::initialize(){
result = System_Create(&fmodSystem);
result = fmodSystem->init(NUM_CHANNELS, FMOD_INIT_NORMAL, 0);
//listener position at origin
listenerpos.x=0;
listenerpos.y=0;
listenerpos.z=0;
//will not move so velociity set at 0
listenervel.x=0;
listenervel.y=0;
listenervel.z=0; |
cpp |
void ProxySetting::additionalInfo(TclObject& result) const
{
if (const auto* setting = getSetting()) {
setting->additionalInfo(result);
} |
cpp | cout << &numero << endl;
cout << ptr << endl;
//Mi puntero ptr SOLO puede apunter a variables de tipo INT (entero)
//Si yo quiero crear un puntero que apunte a flotantes
float decimal;
//Yo no puedo hacer algo como esto
//ptr=&decimal;
float *ptr2;
//LOS PUNTEROS SON VARIABLES TAMBIEN
//TAMBIEN TIENEN DIRECCIONES DE MEMORIA
cout << &ptr << endl;
|
cpp | }
hasFromMongosElem = true;
request.setFromMongos(elem.Bool());
} else if (kNeedsMergeName == fieldName) {
if (elem.type() != BSONType::Bool) {
return {ErrorCodes::TypeMismatch,
str::stream() << kNeedsMergeName << " must be a boolean, not a " |
cpp | template <typename T>
std::ostream& operator<<(std::ostream& os, Intervalo<T> i)
{
os << "[" << i.getInicio() << "," << i.getFim() << "]";
return os;
}
template <typename T>
Intervalo<T> encontrarIntervaloComRaiz (T inicio, FuncaoMatematica funcao, T incremento = 1) {
T i = inicio - 1; |
cpp | case STATE_ESCAPE_OUTER: // '\' outside quotes
curarg += ch; state = STATE_ARGUMENT;
break;
case STATE_ESCAPE_DOUBLEQUOTED: // '\' in double-quoted text
if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself
curarg += ch; state = STATE_DOUBLEQUOTED;
break;
}
} |
cpp | }
futures[i] = std::async(std::launch::async, &ParallelSTS::computeSkylineSubset, this, i, subset, subtrees[i]);
}
for(std::size_t i = 0; i < NUMBER_OF_THREADS; i++){
futures[i].get();
}
// compute final skyline
std::vector<std::vector<int>> input;
for(std::size_t i = 0; i < subset_results.size(); i++){
if(!subset_results[i].empty()){
input.push_back(subset_results[i]);
} |
cpp | namespace Reactor
{
ReactorConfig::CommandControllerAccess CommandFactoryState::executors() const {
return ReactorConfig::GetCommandControllerAccess();
}
CommandFactory::CommandFactory()
{ }
CommandFactory::~CommandFactory()
{ }
}
|
cpp | std::tuple<int, double, float> my_tupull = std::make_tuple(3, 2.7, 8.2);
std::tuple<int, double, float> my_tupull_output;
transform(my_tupull, my_tupull_output, std::make_index_sequence<3>{});
CHECK(std::get<0>(my_tupull_output) == 6);
CHECK(std::get<1>(my_tupull_output) == 5.4);
CHECK(std::get<2>(my_tupull_output) == 16.4f);
}
/// [expand_pack_example]
namespace {
template <typename>
struct Templated {};
} // namespace
static_assert(tmpl::list_contains_v<tmpl::list<Templated<int>, |
cpp | if (s->_batch.id != 0 && !s->isAborted()) {
s->_batch.extend(s->_state.connection, s->_progress, s->_state.syncerId);
s->startRecurringBatchExtension();
}
}
}
});
}
|
cpp | Kirt[ez-eilute-1+Variant[i].KirtRaide]=Variant[i].Priegaide;
strncpy(&SkPb[ez-eilute-1], Variant[i].Skiem, strlen(ez));
TarptautF(ez, &Trmp[ez-eilute], Variant[i].Tarpt);
}
else
TarptautF(ez, &Trmp[ez-eilute], 0);
}
}
} |
cpp | while (m_iterator != FastqIterator{} && chromosome != m_sequence.name())
m_sequence = ++m_iterator;
if (m_iterator == FastqIterator{})
throw new ChromosomeNotFoundException{chromosome};
if (one_based_location > static_cast<const int>(m_sequence.sequence().size()))
throw new ChromosomeSizeException{chromosome, m_sequence.sequence().size(), one_based_location};
return m_sequence.sequence()[one_based_location-1];
}
} // namespace gamgee
|
cpp | SDL_Texture* TextureManager::LoadTexture(const char* texture)
{
SDL_Surface* tempSurface = IMG_Load(texture);
SDL_Texture* tex = SDL_CreateTextureFromSurface(Game::renderer, tempSurface);
SDL_FreeSurface(tempSurface);
return tex;
}
void TextureManager::Draw(SDL_Texture* tex, SDL_Rect src, SDL_Rect dest) {
SDL_RenderCopy(Game::renderer, tex, &src, &dest);
|
cpp | sf::RenderWindow* window = Engine::Instance()->window;
sf::Mouse::setPosition(screenCenterWindowSpace, *window);
}
aRibeiro::vec2 AppBase::WindowCoordToNormalizedCoord(const aRibeiro::vec2 &_2dCoord) {
aRibeiro::vec2 result = _2dCoord - MousePosCenter;
if (screenCenterWindowSpace.x > screenCenterWindowSpace.y)
result /= (float)screenCenterWindowSpace.y;
else
result /= (float)screenCenterWindowSpace.x;
|
cpp | stage->pipeline->SetViewport(float(extent.x), float(extent.y));
stage->pipeline->BuildPipeline();
// Map bindings
for (auto& textureBinding : stage->texture)
{
textureBinding.binding = stage->pipeline->GetBindingByName(textureBinding.name); |
cpp | {
UVaQuoleUIViewportClient* ViewportClient = Cast<UVaQuoleUIViewportClient>(GEngine->GameViewport);
if (ViewportClient)
{
ViewportClient->UnregisterHudUI(this);
}
}
Super::BeginDestroy(); |
cpp |
int x1 = ann.bbox.x;
int y1 = ann.bbox.y;
int x2 = x1 + ann.bbox.width;
int y2 = y1 + ann.bbox.height;
|
cpp |
Status FileSystem::DeleteRecursively(const string& dirname,
int64* undeleted_files,
int64* undeleted_dirs) {
CHECK_NOTNULL(undeleted_files);
CHECK_NOTNULL(undeleted_dirs);
*undeleted_files = 0;
*undeleted_dirs = 0;
// Make sure that dirname exists; |
cpp | variable_st.def_property("state",
&ov::VariableState::get_state,
&ov::VariableState::set_state,
R"(
Gets/sets variable state. |
cpp |
namespace first_run {
namespace internal {
bool ImportSettings(Profile* profile,
scoped_refptr<ImporterHost> importer_host,
scoped_refptr<ImporterList> importer_list,
int items_to_import) {
return ImportSettingsWin(
profile,
importer_list->GetSourceProfileAt(0).importer_type,
items_to_import,
FilePath(),
false);
} |
cpp |
auto header = context.header.value_or(Header());
StreamContext stream_context{
header,
paths,
args,
storage_address,
setup_storage_spaces(storage_address, header)
};
|
cpp | // for (int i = 0; i < v.size(); i++)
// {
// /* code */
// cout<<v[i]<<'\n';
// }
// string s = "mrinal";
// string a(s);//copied s string in a
// cout<<a<<endl;
// string b(s,1,3);
// string c = s.substr(0,2);
// cout<<b<<endl<<c<<endl;
// if(b.compare(c)==0){
// cout<<b<<" is equal to "<<c<<endl;
// }else{
|
cpp | * 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 <string> |
cpp | if(PsychMatch(command,"GetNumAxes"))return &JOYSTICKGetNumAxes;
if(PsychMatch(command,"GetNumBalls"))return &JOYSTICKGetNumBalls;
if(PsychMatch(command,"GetNumHats"))return &JOYSTICKGetNumHats;
if(PsychMatch(command,"GetButton"))return &JOYSTICKGetButton;
if(PsychMatch(command,"GetAxis"))return &JOYSTICKGetAxis;
if(PsychMatch(command,"GetBall"))return &JOYSTICKGetBall;
if(PsychMatch(command,"GetHat"))return &JOYSTICKGetHat;
if(PsychMatch(command,"GetJoystickName"))return &JOYSTICKGetJoystickName;
if(PsychMatch(command,"GetJoystickNumbersFromName"))return &JOYSTICKGetJoystickNumbersFromName;
if(PsychMatch(command,"Unplug"))return &JOYSTICKUnplug;
// Unknown command.
return NULL; |
cpp | std::uniform_real_distribution<> rand_real(std::min(min, max), std::max(min, max));
return rand_real(internal::rng);
}
double uniform_double_box(double halfwidth) {
std::uniform_real_distribution<> rand_real(-halfwidth, halfwidth);
return rand_real(internal::rng);
}
std::complex<double> uniform_complex_in_unit_circle() { return std::polar(uniform_double_01(), internal::rand_double_0_2pi(internal::rng)); }
std::complex<double> uniform_complex_on_unit_circle() { return std::polar(1.0, internal::rand_double_0_2pi(internal::rng)); }
std::complex<double> uniform_complex_box(double real_min, double real_max, double imag_min, double imag_max) {
return {uniform_double_box(real_min, real_max), uniform_double_box(imag_min, imag_max)};
} |
cpp | }
string fitToFieldSize(const string &in,
char padWith,
size_t fieldSize,
JUSTIFY justify) {
if (in.size() > fieldSize) {
return in.substr(0, fieldSize); |
cpp | addPiece(from120+10, wP);
}
}
else if (move.getCap()) { //any capture otherwise, put the piece back on
uint pieceCapped = move.getCap();
assert(pieceValid(pieceCapped));
fiftyMove = 0; //however resets when piece is capped
addPiece(from120, pieceCapped);
} |
cpp | >>"const uint64_t kerValue23 = _vel_pack_f32p("
>>" pKerValue + 2 * inChannelGroup * kernHW,"
>>" pKerValue + 3 * inChannelGroup * kernHW);"
>>(maskW
?"vrsum01 = _vel_pvfmad_vvsvMvl(vrsum01, kerValue01, vrinP, vmP, vrsum01, vl);"
:"vrsum01 = _vel_pvfmad_vvsvl(vrsum01, kerValue01, vrinP, vl);")
>>(maskW
?"vrsum23 = _vel_pvfmad_vvsvMvl(vrsum23, kerValue23, vrinP, vmP, vrsum23, vl);"
:"vrsum23 = _vel_pvfmad_vvsv l(vrsum23, kerValue23, vrinP, vl);")
>>"const uint64_t kerValue45 = _vel_pack_f32p("
>>" pKerValue + 4 * inChannelGroup * kernHW,"
>>" pKerValue + 5 * inChannelGroup * kernHW);" |
cpp | * File: examples/metrics/main.cpp
* Part of commonpp.
*
* Distributed under the 2-clause BSD licence (See LICENCE.TXT file at the
* project root).
*
* Copyright (c) 2018 <NAME>. All rights reserved. |
cpp | message = other5.message;
return *this;
}
TranscodingError::~TranscodingError() throw() {
}
void TranscodingError::__set_code(const int32_t val) { |
cpp | dist);
UnmanagedToManagedAAPlaneClass(thisPlane);
}
bool AAPlaneClass::InFront(Vector3 point)
{
::Vector3 pointVec;
::AAPlaneClass thisPlane;
|
cpp | #include "SimG4CMS/Muon/interface/MuonME0FrameRotation.h"
#include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h"
#include "G4Step.hh"
MuonME0FrameRotation::MuonME0FrameRotation(const MuonGeometryConstants&) : MuonFrameRotation::MuonFrameRotation() {}
MuonME0FrameRotation::~MuonME0FrameRotation() {}
Local3DPoint MuonME0FrameRotation::transformPoint(const Local3DPoint& point, const G4Step*) const {
return Local3DPoint(point.x(), point.z(), -point.y()); |
cpp | it("should be created from command line arguments", [&]() {
int argc(9);
const char *argv[] = {"benchmark", "-a", "samplesort", "-d", "staggered", "-i", "1000", "-i", "128000"};
auto settings = Settings::parse_from_cmd(argc, argv);
AssertThat(settings.algorithm, Equals(Algorithm::Value::samplesort));
AssertThat(settings.distribution_type, Equals(Distributions::Type::Value::staggered));
AssertThat(settings.sizes.size(), Equals(2));
AssertThat(settings.sizes, Contains(1000));
AssertThat(settings.sizes, Contains(128000));
});
it("should throw an exception if required arguments are missing", [&]() {
|
cpp |
return nullptr;
}
/**
\brief mouse down handler for Pro Tools keyboard shortcuts
Operation:\n
- This handles several ProTools-specific mouse events
- ctrl-alt-cmd: enable automation
- alt: set control to default value (VSTGUI uses ctrl and this overrides it)
|
cpp | #ifndef __SELECTOR__
#define __SELECTOR__
template<bool PARAMETER> selector{};
|
cpp | fl_key_responder_handle_event(
responder,
fl_key_event_new_by_mock(101, kPress, GDK_KEY_a, kKeyCodeKeyA, state,
kIsNotModifier),
verify_response_handled, &user_data);
EXPECT_EQ(g_call_records->len, 2u);
record = FL_KEY_EMBEDDER_CALL_RECORD(g_ptr_array_index(g_call_records, 0));
EXPECT_EQ(record->event->timestamp, 101000);
EXPECT_EQ(record->event->type, kFlutterKeyEventTypeDown); |
cpp | ///////////////////////////////////////////////////////////////////////////////////
// Messages that were logged before initializing the log
// - cache the message (and I'll write it even if the filter is turned off)
#define HPX_LOG_USE_LOG(l, do_func, is_log_enabled) if ( !(is_log_enabled) ) ; \
else l-> do_func
}}}
#endif
|
cpp | {-2.2821,4.09131,-0.749535},
{-0.25415,5.57874,-0.749535},
{2.68359,5.27625,-0.749535},
{4.57263,2.45605,-0.749535},
{4.84595,-0.78833,-0.749535}, |
cpp | m_d3d12.OnUpdate.Disconnect(m_connectUpdate);
}
void Overlay::SetActiveWidget(WidgetID aNewActive)
{
if (aNewActive < WidgetID::COUNT)
m_nextActiveWidgetID = aNewActive;
if (m_activeWidgetID != m_nextActiveWidgetID)
{
assert(m_activeWidgetID < WidgetID::COUNT);
if (m_widgets[static_cast<size_t>(m_activeWidgetID)]->OnDisable())
{
assert(m_nextActiveWidgetID < WidgetID::COUNT);
if (m_widgets[static_cast<size_t>(m_nextActiveWidgetID)]->OnEnable()) |
cpp | struct BaseCmdArgs
{
bool m_PrintRaw = false;
bool m_PrintNet = false;
bool m_PrintDemo = false;
bool m_PrintVars = false;
bool m_PrintStringTables = false;
};
|
cpp | {
// Operate button loop at 4Hz unless no button has been pressed in one cycle
unsigned long now = millis();
if (now - m_lastButtonActivity < 250)
return;
button_t button = m_readButton();
if (button == BUTTON_NONE)
{
unsigned long dur = getTimeoutDuration();
if (dur != 0 && now - m_lastStateChange > dur)
button = BUTTON_TIMEOUT; |
cpp | #include "zaf/actor.hpp"
#include "zaf/actor_system.hpp"
#include "zaf/net_gate.hpp"
#include "zaf/net_gate_client.hpp"
#include "zaf/serializer.hpp"
namespace zaf {
void serialize(Serializer& s, const LocalActorHandle& l) {
s.write(l.local_actor_id).write(l.use_swsr_msg_delivery); |
cpp | bool ImGUI::Category( nString label, nString description ) {
if ( nHelper::GetIsValid( label ) ) {
ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing, ImVec2{ 0.f, 1.f } );
auto state = ImGui::CollapsingHeader( label, ImGuiTreeNodeFlags_DefaultOpen );
if ( state )
ImGUI::Tooltip( description );
ImGui::Dummy( ImVec2{ .0f, ImGUI::ItemSpacer } );
return state; |
cpp | /// opening a string literal, advances CurPtr if a delimiter is found and
/// returns a non-zero delimiter length. CurPtr[-1] must be '#' when called.
static unsigned advanceIfCustomDelimiter(const char *&CurPtr,
DiagnosticEngine *Diags) {
assert(CurPtr[-1] == '#');
const char *TmpPtr = CurPtr; |
cpp | } else if(context->GetDaemon<InputDaemon>()->IsKeyPressed(renderContext, InputKeys::Left) &&
context->GetDaemon<InputDaemon>()->IsKeyPressed(renderContext, InputKeys::Down)
) {
map->GetCharacter()->QueueAction(MapCharacterActionTypes::MoveSouthWest);
} else if(context->GetDaemon<InputDaemon>()->IsKeyPressed(renderContext, InputKeys::Right) &&
context->GetDaemon<InputDaemon>()->IsKeyPressed(renderContext, InputKeys::Down)
) { |
cpp | ICPwithSpatialIndex(dkMat, ad.mesh.vertices, ad.mesh.vertexTriangleNeighborIndex,tc,Freg,skMat,ckMat,errork,debug);
}
std::vector<Eigen::Vector3d> sk(splitVectors(skMat));
std::vector<Eigen::Vector3d> ck(splitVectors(ckMat));
std::string outputFilename = dataFilenamePrefix + "-Output.txt";
std::ofstream ofs (outputFilename, std::ofstream::out);
output1CISCSV_PA3(ofs,outputFilename,sk,ck,errork);
ofs.close();
} |
cpp |
//
// @author <EMAIL>
//
#include <graph/execution/LogicLoopCond.h>
namespace sd { |
cpp | }
} // namespace edk
} // namespace mojo
|
cpp | * a ShadowMap.
* @details Every Entity in a Scene that has a ShadowMap System will cast
* shadows if it has a Shadow Component. If the Entity also has a ShadowRenderer
* System attached to it, it will also render any shadows cast onto the Entity.
*/
class Shadow : virtual public RenderPack {
public: |
cpp | bi::managed_external_buffer::handle_t handle)
{
AllocatedSharedMemory<StringShm> string_container_shm =
shm_pool->Load<StringShm>(handle);
AllocatedSharedMemory<char> string_shm =
shm_pool->Load<char>(string_container_shm.data_->data);
return std::unique_ptr<PbString>(
new PbString(string_container_shm, string_shm));
}
std::unique_ptr<PbString> |
cpp | }
// then this must be a boundary region
if (bnd)
{
m_Label[i] = 2;
m_NumberOfBoundary++;
}
} |
cpp |
direction.setPeriodHertz(50);
direction.attach(GPIO_NUM_14, 500, 2400);
}
|
cpp | const char** names,
const ImColor* colors,
float(*getter)(const void* data, int idx),
const void * const * datas,
int values_count, |
cpp | eluents_(source.eluents_),
times_(source.times_),
percentages_(source.percentages_)
{
}
Gradient::~Gradient() |
Subsets and Splits