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 109 | 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 48.5k ⌀ | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
64ca80d8ea5a2602035e6a05f685edadd30642e9 | 164 | cpp | C++ | GameServer/main.cpp | joyate/EjoyServer | e27da5a26189b9313df6378bd1194845eae45646 | [
"MIT"
] | 3 | 2017-03-27T03:13:41.000Z | 2019-12-24T00:18:14.000Z | GameServer/main.cpp | joyate/EjoyServer | e27da5a26189b9313df6378bd1194845eae45646 | [
"MIT"
] | null | null | null | GameServer/main.cpp | joyate/EjoyServer | e27da5a26189b9313df6378bd1194845eae45646 | [
"MIT"
] | null | null | null | #include "type_common.h"
#include "Server.h"
Server svr;
int main(int argc,const char* argv[])
{
if (!svr.Init())
{
return 0;
}
svr.Run();
return 0;
} | 9.647059 | 37 | 0.597561 | joyate |
64d36602afc8872cfd6532fef70113ea50f00f3d | 12,200 | hpp | C++ | src/nark/circular_queue.hpp | rockeet/nark-bone | 11263ff5a192c85e4a2776aac1096d01138483d2 | [
"BSD-3-Clause"
] | 18 | 2015-02-12T04:41:22.000Z | 2018-08-22T07:44:13.000Z | src/nark/circular_queue.hpp | rockeet/nark-bone | 11263ff5a192c85e4a2776aac1096d01138483d2 | [
"BSD-3-Clause"
] | null | null | null | src/nark/circular_queue.hpp | rockeet/nark-bone | 11263ff5a192c85e4a2776aac1096d01138483d2 | [
"BSD-3-Clause"
] | 13 | 2015-05-24T12:24:46.000Z | 2021-01-05T10:59:40.000Z | /* vim: set tabstop=4 : */
/********************************************************************
@file circular_queue.hpp
@brief 循环队列的实现
@date 2006-9-28 12:07
@author Lei Peng
@{
*********************************************************************/
#ifndef __circular_queue_hpp_
#define __circular_queue_hpp_
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//#include <vector>
#include <boost/swap.hpp>
namespace nark {
/**
@brief 使用一个用户指定的 vector 类容器实现循环队列
- 循环队列的大小是固定的,其结构是一个环状数组,最少会浪费一个元素的存储空间
- 循环队列可以提供 serial/real_index 序列号,可用于元素的标识(如网络协议中的帧序号)
- 所有输入参数均需要满足其前条件,如果不满足,
Debug 版会引发断言失败,Release 版会导致未定义行为
*/
template<class ElemT>
class circular_queue
{
// valid element count is (m_vec.size() - 1)
ElemT* m_vec;
ptrdiff_t m_head; // point to next pop_front position
ptrdiff_t m_tail; // point to next push_back position
ptrdiff_t m_nlen;
ptrdiff_t prev(ptrdiff_t current) const throw()
{
ptrdiff_t i = current - 1;
return i >=0 ? i : i + m_nlen; // == (i + m_nlen) % m_nlen, but more fast
// return (current + m_vec.size() - 1) % m_vec.size();
}
ptrdiff_t next(ptrdiff_t current) const throw()
{
ptrdiff_t i = current + 1;
return i < m_nlen ? i : i - m_nlen; // == i % m_nlen, but more fast
// return (current + 1) % m_vec.size();
}
ptrdiff_t prev_n(ptrdiff_t current, ptrdiff_t n) const throw()
{
assert(n < m_nlen);
ptrdiff_t i = current - n;
return i >=0 ? i : i + m_nlen; // == i % c, but more fast
// return (current + m_vec.size() - n) % m_vec.size();
}
ptrdiff_t next_n(ptrdiff_t current, ptrdiff_t n) const throw()
{
assert(n < m_nlen);
ptrdiff_t c = m_nlen;
ptrdiff_t i = current + n;
return i < c ? i : i - c; // == i % c, but more fast
// return (current + n) % m_vec.size();
}
public:
typedef ElemT value_type;
typedef ElemT& reference;
typedef const ElemT& const_reference;
typedef ElemT* pointer;
typedef const ElemT* const_pointer;
typedef uintptr_t size_type;
class const_iterator
{
friend class circular_queue;
const ElemT* p;
const circular_queue* queue;
const ElemT* base() const throw() { return &queue->m_vec[0]; }
typedef const_iterator my_type;
public:
my_type operator++() const throw()
{ p = base() + queue->next(p - base()); return *this; }
my_type operator++(int) const throw()
{ my_type temp = ++(*this); return temp; }
my_type operator--() const throw()
{ p = base() + queue->prev(p - base()); return *this; }
my_type operator--(int) const throw()
{ my_type temp = --(*this); return temp; }
my_type& operator+=(ptrdiff_t distance) throw()
{ p = base() + queue->next_n(p - base()); return *this; }
my_type& operator-=(ptrdiff_t distance) throw()
{ p = base() + queue->prev_n(p - base()); return *this; }
my_type operator+(ptrdiff_t distance) throw()
{ my_type temp = *this; temp += distance; return temp; }
my_type operator-(ptrdiff_t distance) throw()
{ my_type temp = *this; temp -= distance; return temp; }
bool operator==(const my_type& r) const throw() { return p == r.p; }
bool operator!=(const my_type& r) const throw() { return p != r.p; }
bool operator< (const my_type& r) const throw()
{
return queue->virtual_index(p - base()) <
queue->virtual_index(r.p - base());
}
bool operator> (const my_type& r) const throw()
{
return queue->virtual_index(p - base()) >
queue->virtual_index(r.p - base());
}
bool operator<=(const my_type& r) const throw()
{
return queue->virtual_index(p - base()) <=
queue->virtual_index(r.p - base());
}
bool operator>=(const my_type& r) const throw()
{
return queue->virtual_index(p - base()) >=
queue->virtual_index(r.p - base());
}
const ElemT& operator *() const throw() { return *p; }
const ElemT* operator->() const throw() { return p; }
};
class iterator
{
friend class circular_queue;
ElemT* p;
circular_queue* queue;
ElemT* base() const throw() { return &queue->m_vec[0]; }
typedef iterator my_type;
public:
my_type operator++() const throw()
{ p = base() + queue->next(p - base()); return *this; }
my_type operator++(int) const throw()
{ my_type temp = ++(*this); return temp; }
my_type operator--() const throw()
{ p = base() + queue->prev(p - base()); return *this; }
my_type operator--(int) const throw()
{ my_type temp = --(*this); return temp; }
my_type& operator+=(ptrdiff_t distance) throw()
{ p = base() + queue->next_n(p - base()); return *this; }
my_type& operator-=(ptrdiff_t distance) throw()
{ p = base() + queue->prev_n(p - base()); return *this; }
my_type operator+(ptrdiff_t distance) throw()
{ my_type temp = *this; temp += distance; return temp; }
my_type operator-(ptrdiff_t distance) throw()
{ my_type temp = *this; temp -= distance; return temp; }
bool operator==(const my_type& r) const throw() { return p == r.p; }
bool operator!=(const my_type& r) const throw() { return p != r.p; }
bool operator< (const my_type& r) const throw()
{
return queue->virtual_index(p - base()) <
queue->virtual_index(r.p - base());
}
bool operator> (const my_type& r) const throw()
{
return queue->virtual_index(p - base()) >
queue->virtual_index(r.p - base());
}
bool operator<=(const my_type& r) const throw()
{
return queue->virtual_index(p - base()) <=
queue->virtual_index(r.p - base());
}
bool operator>=(const my_type& r) const throw()
{
return queue->virtual_index(p - base()) >=
queue->virtual_index(r.p - base());
}
ElemT& operator *() const throw() { return *p; }
ElemT* operator->() const throw() { return p; }
operator const const_iterator&() const throw()
{ return *reinterpret_cast<const const_iterator*>(this); }
};
friend class const_iterator;
friend class iterator;
/**
@brief 构造最多能容纳 capacity 个有效元素的循环队列
*/
explicit circular_queue(ptrdiff_t capacity) : m_nlen(capacity + 1)
{
assert(capacity != 0);
m_vec = (ElemT*)malloc(sizeof(ElemT) * m_nlen);
if (NULL == m_vec) throw std::bad_alloc();
m_head = m_tail = 0;
}
circular_queue() {
m_vec = NULL;
m_nlen = m_head = m_tail = 0;
}
void init(ptrdiff_t capacity) {
assert(0 == m_nlen);
new(this)circular_queue(capacity);
}
~circular_queue() {
clear();
if (m_vec) ::free(m_vec);
}
/**
@brief 清除队列中的有效元素
- 前条件:无
- 操作结果:队列为空
*/
void clear()
{
while (!empty())
pop_front();
m_head = m_tail = 0;
}
/**
@brief 测试队列是否为空
- 前条件:无
@return true 表示队列为空,false 表示非空
*/
bool empty() const throw() { return m_head == m_tail; }
/**
@brief 测试队列是否已满
- 前条件:无
@return true 表示队列已满,false 表示未满
*/
bool full() const throw() { return next(m_tail) == m_head; }
// bool full() const throw() { return m_tail+1==m_head || (m_head+m_nlen-1==m_tail); }
/**
@brief 返回队列当前尺寸
- 前条件:无
@return 队列中有效元素的个数,总小于等于 capacity
*/
size_type size() const throw() { return m_head <= m_tail ? m_tail - m_head : m_tail + m_nlen - m_head; }
/**
@brief 返回队列容量
- 前条件:无
@return 即构造该对象时传入的参数,或者 resize 后的新容量
*/
size_type capacity() const throw() { return m_nlen - 1; }
/**
@brief 在队列尾部加入一个新元素
- 前条件:队列不满
- 操作结果:新元素被添加到队列尾部
*/
void push_back(const ElemT& val)
{
assert(!full());
new(&m_vec[m_tail])ElemT(val);
m_tail = next(m_tail);
}
//@{
/**
@brief 返回队列头部的那个元素
- 前条件:队列不空
*/
const ElemT& front() const throw()
{
assert(!empty());
return m_vec[m_head];
}
ElemT& front() throw()
{
assert(!empty());
return m_vec[m_head];
}
//@}
/**
@brief 弹出队列头部的那个元素并通过 out 参数 val 返回
- 前条件:队列不空
@param[out] val 队列头部元素将被复制进 val
*/
void pop_front(ElemT& val)
{
assert(!empty());
boost::swap(val, m_vec);
m_vec[m_head].~ElemT();
m_head = next(m_head);
}
/**
@brief 弹出队列头部的那个元素
- 前条件:队列不空
该函数与 stl vector/list/deque 兼容
*/
void pop_front()
{
assert(!empty());
m_vec[m_head].~ElemT();
m_head = next(m_head);
}
/**
@brief 弹出序列号小于等于输入参数 real_index 的所有元素
pop all elements which real_index is earlier or equal than real_index
- 前条件:队列不空,且参数 real_index 代表的元素必须在队列中
*/
void pop_lower(ptrdiff_t real_index)
{
assert(!empty());
// because poped elements can be equal with real_index
// poped elements count is (virtual_index(real_index) + 1)
ptrdiff_t count = virtual_index(real_index) + 1;
assert(count <= size());
while (count-- > 0)
{
pop_front();
}
}
/**
@name 不是队列操作的成员
none queue operations.
只是为了功能扩展
@{
*/
/**
@brief 在队列头部加入新元素
- 前条件:队列不满
- 操作结果:队列中现存元素的 real_index 均增一,新元素 val 成为新的队头
*/
void push_front(const ElemT& val)
{
assert(!full());
m_head = prev(m_head);
new(&m_vec[m_head])ElemT(val);
}
//@{
/** 返回队列尾部元素 前条件:队列不空 */
ElemT& back() throw()
{
assert(!empty());
return m_vec[prev(m_tail)];
}
const ElemT& back() const throw()
{
assert(!empty());
return m_vec[prev(m_tail)];
}
//@}
/**
@brief 弹出队列尾部元素
- 前条件:队列不空
*/
void pop_back(ElemT& val)
{
assert(!empty());
m_tail = prev(m_tail);
boost::swap(val, m_vec[m_tail]);
m_vec[m_tail].~ElemT();
}
/**
@brief 弹出队列尾部元素
- 前条件:队列不空
*/
void pop_back()
{
assert(!empty());
m_tail = prev(m_tail);
m_vec[m_tail].~ElemT();
}
/**
@brief 弹出序列号比大于等于输入参数 real_index 的所有元素
pop elements which real_index is later or equal than real_index
- 前条件:队列不空,且参数 real_index 代表的元素必须在队列中
*/
void pop_upper(ptrdiff_t real_index)
{
assert(!empty());
// because poped elements can be equal with real_index
// if not include the equal one, count is (size() - virtual_index(real_index) - 1);
ptrdiff_t count = size() - virtual_index(real_index);
assert(count <= size());
while (count-- > 0)
{
pop_back();
}
}
//@} // name 不是队列操作的成员
/**
@name iterator 相关成员
@{
*/
iterator begin() throw()
{
iterator iter;
iter.queue = this;
iter.p = m_vec + m_head;
return iter;
}
const_iterator begin() const throw()
{
iterator iter;
iter.queue = this;
iter.p = m_vec + m_head;
return iter;
}
iterator end() throw()
{
iterator iter;
iter.queue = this;
iter.p = m_vec + m_tail;
return iter;
}
const_iterator end() const throw()
{
iterator iter;
iter.queue = this;
iter.p = m_vec + m_tail;
return iter;
}
//@}
/**
@brief 通过real_index取得元素相对于队头的偏移
*/
ptrdiff_t virtual_index(ptrdiff_t real_index) const throw()
{
assert(real_index >= 0);
assert(real_index < (ptrdiff_t)size());
ptrdiff_t i = real_index - m_head;
return i >= 0 ? i : i + m_nlen;
// return (m_vec.size() + real_index - m_head) % m_vec.size();
}
/**
@brief 通过virtual_index取得元素的序列号
*/
ptrdiff_t real_index(ptrdiff_t virtual_index) const throw()
{
assert(virtual_index >= 0);
assert(virtual_index < size());
ptrdiff_t i = virtual_index + m_head;
return i < m_nlen ? i : i - m_nlen;
// return (virtual_index + m_head) % m_vec.size();
}
/**
@brief 队头的序列号
*/
ptrdiff_t head_real_index() const throw() { return m_head; }
/**
@brief 队尾的序列号
*/
ptrdiff_t tail_real_index() const throw() { return m_tail; }
/**
@brief 通过 virtual_index 取得元素
@{
*/
ElemT& operator[](ptrdiff_t virtual_index)
{
assert(virtual_index >= 0);
assert(virtual_index < size());
ptrdiff_t c = m_nlen;
ptrdiff_t i = m_head + virtual_index;
ptrdiff_t j = i < c ? i : i - c;
return m_vec[j];
// return m_vec[(m_head + virtual_index) % m_vec.size()];
}
const ElemT& operator[](ptrdiff_t virtual_index) const
{
assert(virtual_index >= 0);
assert(virtual_index < size());
ptrdiff_t c = m_nlen;
ptrdiff_t i = m_head + virtual_index;
ptrdiff_t j = i < c ? i : i - c;
return m_vec[j];
// return m_vec[(m_head + virtual_index) % m_vec.size()];
}
//@}
};
/*
template<class ElemT, class VectorT>
inline
circular_queue<ElemT, VectorT>::const_iterator
operator+(ptrdiff_t n, const circular_queue<ElemT, VectorT>::const_iterator& iter)
{
return iter + n;
}
template<class ElemT, class VectorT>
inline
circular_queue<ElemT, VectorT>::iterator
operator+(ptrdiff_t n, const circular_queue<ElemT, VectorT>::iterator& iter)
{
return iter + n;
}
*/
} // namespace nark
#endif
// @} end file circular_queue.hpp
| 22.426471 | 105 | 0.629344 | rockeet |
64d5fd430e8bd0617350ac39defc8981f14ea986 | 555 | hpp | C++ | include/alx/UserEvent.hpp | SpaceManiac/ALX | d0d6b17be43fbd533f05f79c630dcd3ebf0a21e6 | [
"BSD-3-Clause"
] | null | null | null | include/alx/UserEvent.hpp | SpaceManiac/ALX | d0d6b17be43fbd533f05f79c630dcd3ebf0a21e6 | [
"BSD-3-Clause"
] | null | null | null | include/alx/UserEvent.hpp | SpaceManiac/ALX | d0d6b17be43fbd533f05f79c630dcd3ebf0a21e6 | [
"BSD-3-Clause"
] | null | null | null | #ifndef ALX_USEREVENT_HPP
#define ALX_USEREVENT_HPP
namespace alx {
/**
Base class for user events.
*/
class UserEvent {
public:
/**
constructor.
@param type event type.
*/
UserEvent(int type) : m_type(type) {
}
/**
destructor.
*/
virtual ~UserEvent() {
}
/**
Returns the type of event.
@return the type of event.
*/
int getType() const {
return m_type;
}
private:
//type
int m_type;
};
} //namespace alx
#endif //ALX_USEREVENT_HPP
| 12.613636 | 40 | 0.545946 | SpaceManiac |
64d6e51067ebce9bacbd43ac1c8ba145e77c379a | 675 | cpp | C++ | code-samples/Conditionals/Exercise_6.cpp | csdeptku/cs141 | befd96cb22bccc9b1561224967c9feafd2a550e4 | [
"Apache-2.0"
] | null | null | null | code-samples/Conditionals/Exercise_6.cpp | csdeptku/cs141 | befd96cb22bccc9b1561224967c9feafd2a550e4 | [
"Apache-2.0"
] | null | null | null | code-samples/Conditionals/Exercise_6.cpp | csdeptku/cs141 | befd96cb22bccc9b1561224967c9feafd2a550e4 | [
"Apache-2.0"
] | null | null | null | /*
Write a function word_check that takes in a string word and returns a string.
The function should return the string "long" if the word is longer than 6 characters,
"short" if it is less than 6 characters, and "medium" if it is exactly 6 characters long.
*/
#include <iostream>
using namespace std;
string word_check(string word)
{
int length = word.length();
if (length > 6)
return "long";
else if (length < 6)
return "short";
else
return "medium";
}
int main(void)
{
cout << word_check("contraption") << endl;
cout << word_check("fruit") << endl;
cout << word_check("puzzle") << endl;
return 0;
} | 23.275862 | 93 | 0.634074 | csdeptku |
64d7abf482cd886893df1d97ba95505b45bb3081 | 3,086 | cpp | C++ | samples/MDDSSample/src/MDDSSampleApp.cpp | heisters/Cinder-MDDS | 2531ea668eff1aef8e98ca76863242e0bb3a2c54 | [
"MIT"
] | 2 | 2015-03-10T17:51:49.000Z | 2015-04-29T14:34:00.000Z | samples/MDDSSample/src/MDDSSampleApp.cpp | heisters/Cinder-MDDS | 2531ea668eff1aef8e98ca76863242e0bb3a2c54 | [
"MIT"
] | null | null | null | samples/MDDSSample/src/MDDSSampleApp.cpp | heisters/Cinder-MDDS | 2531ea668eff1aef8e98ca76863242e0bb3a2c54 | [
"MIT"
] | null | null | null | #include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Utilities.h"
#include "cinder/Text.h"
#include "cinder/Rand.h"
#include <boost/format.hpp>
#include "MDDSMovie.h"
class MDDSSampleApp : public ci::app::AppNative {
public:
MDDSSampleApp();
// Lifecycle ---------------------------------------------------------------
void prepareSettings( Settings *settings );
void setup();
void update();
void draw();
// Events ------------------------------------------------------------------
void keyDown( ci::app::KeyEvent event );
protected:
mdds::MovieRef mMovie;
ci::Font mFont;
};
using namespace ci;
using namespace ci::app;
using namespace std;
MDDSSampleApp::MDDSSampleApp() :
mFont( "Helvetica", 14 )
{
}
void
MDDSSampleApp::prepareSettings( Settings *settings )
{
settings->setWindowSize( 1920, 1080 );
settings->setFrameRate( 60 );
}
void
MDDSSampleApp::setup()
{
try
{
mMovie = mdds::Movie::create( getFolderPath(), ".DDS", 29.97 );
}
catch ( mdds::Movie::LoadError boom )
{
console() << "Error loading movie: " << boom.what() << endl;
}
}
void
MDDSSampleApp::update()
{
if ( mMovie ) mMovie->update();
}
void
MDDSSampleApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
if ( mMovie ) mMovie->draw();
TextLayout info;
info.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
info.setColor( ColorA::white() );
info.setBorder( 4, 2 );
info.setFont( mFont );
info.addLine( (boost::format( "App FPS: %.2d" ) % getAverageFps()).str() );
info.addLine( (boost::format( "Movie FPS: %.2d" ) % mMovie->getFrameRate()).str() );
info.addLine( (boost::format( "Play rate: %.2d" ) % mMovie->getPlayRate()).str() );
info.addLine( (boost::format( "Average playback FPS: %.2d" ) % mMovie->getAverageFps()).str() );
info.addLine( "Controls:" );
info.addLine( "↑: double playback rate" );
info.addLine( "↓: halve playback rate" );
info.addLine( "f: play forward at normal rate" );
info.addLine( "r: play reverse at normal rate" );
info.addLine( "space: pause" );
info.addLine( "↵: jump to random frame" );
gl::draw( gl::Texture( info.render( true ) ), Vec2f( 10, 10 ) );
}
void
MDDSSampleApp::keyDown( KeyEvent event )
{
if ( event.getChar() == 'f' )
mMovie->setPlayRate( 1.0 );
else if ( event.getChar() == 'r' )
mMovie->setPlayRate( -1.0 );
else if ( event.getCode() == KeyEvent::KEY_UP )
mMovie->setPlayRate( mMovie->getPlayRate() * 2.0 );
else if ( event.getCode() == KeyEvent::KEY_DOWN )
mMovie->setPlayRate( mMovie->getPlayRate() * 0.5 );
else if ( event.getCode() == KeyEvent::KEY_SPACE )
mMovie->setPlayRate( 0.0 );
else if ( event.getCode() == KeyEvent::KEY_RETURN )
mMovie->seekToFrame( Rand::randInt( mMovie->getNumFrames() ) );
}
CINDER_APP_NATIVE( MDDSSampleApp, RendererGl )
| 26.834783 | 100 | 0.568049 | heisters |
64d96398fd9eec516cb2142498338c782b41ada1 | 947 | hpp | C++ | examples/saber-salient/include/saber-salient.hpp | achirkin/real-salient | e3bceca601562aa03ee4261ba41709b63cc5286b | [
"BSD-3-Clause"
] | 9 | 2020-07-05T08:21:39.000Z | 2021-10-30T09:52:43.000Z | examples/saber-salient/include/saber-salient.hpp | achirkin/real-salient | e3bceca601562aa03ee4261ba41709b63cc5286b | [
"BSD-3-Clause"
] | null | null | null | examples/saber-salient/include/saber-salient.hpp | achirkin/real-salient | e3bceca601562aa03ee4261ba41709b63cc5286b | [
"BSD-3-Clause"
] | 1 | 2020-07-05T10:45:12.000Z | 2020-07-05T10:45:12.000Z | #pragma once
#include "salient/salient_structs.hpp"
extern "C"
{
struct SaberSalient;
__declspec(dllexport) int SaberSalient_init(SaberSalient** out_SaberSalient, void (*in_loadColor)(uint8_t*), void (*in_loadDepth)(float*));
__declspec(dllexport) void SaberSalient_destroy(SaberSalient *in_SaberSalient);
__declspec(dllexport) int SaberSalient_cameraIntrinsics(SaberSalient *in_SaberSalient, salient::CameraIntrinsics *out_intrinsics);
__declspec(dllexport) int SaberSalient_currentTransform(SaberSalient* in_SaberSalient, float *out_mat44);
__declspec(dllexport) int SaberSalient_currentPosition(SaberSalient* in_SaberSalient, float* out_vec3);
__declspec(dllexport) int SaberSalient_currentRotation(SaberSalient* in_SaberSalient, float* out_mat33);
__declspec(dllexport) uint8_t* SaberSalient_getColorBuf(SaberSalient* in_SaberSalient);
__declspec(dllexport) float* SaberSalient_getDepthBuf(SaberSalient* in_SaberSalient);
} | 37.88 | 140 | 0.832101 | achirkin |
64dc3178a38f6c13407c3d84a4880b8359e6f9ba | 5,799 | hpp | C++ | AutomatedScheduler/include/TextHandler.hpp | Electrux/CCPP-Code | 3c5e5b866cf050c11bced9651b112eb31dd2465d | [
"BSD-3-Clause"
] | 6 | 2019-08-29T23:31:17.000Z | 2021-11-14T20:35:47.000Z | AutomatedScheduler/include/TextHandler.hpp | Electrux/CCPP-Code | 3c5e5b866cf050c11bced9651b112eb31dd2465d | [
"BSD-3-Clause"
] | null | null | null | AutomatedScheduler/include/TextHandler.hpp | Electrux/CCPP-Code | 3c5e5b866cf050c11bced9651b112eb31dd2465d | [
"BSD-3-Clause"
] | 1 | 2019-09-01T12:22:58.000Z | 2019-09-01T12:22:58.000Z | #ifndef TEXT_HANDLER_HPP
#define TEXT_HANDLER_HPP
#include <SFML/Graphics.hpp>
#include "Data.hpp"
class TextHandler : public sf::Drawable
{
std::string text, typwhat, typwhat2, _count, _time;
sf::Text temptext, typehere, typewhat, typewhat2, counts, time;
std::vector<sf::Text> drawtext;
int count;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
{
target.draw(typehere, states);
target.draw(typewhat, states);
target.draw(typewhat2, states);
target.draw(counts, states);
target.draw(time, states);
for (auto it = drawtext.begin(); it != drawtext.end(); ++it)
{
target.draw(*it, states);
}nn
}
void SetDrawText(std::string &text, float variation = 0)
{
temptext.setString(text);
temptext.setPosition((float)10 + variation, (float)470);
drawtext.push_back(temptext);
int tempcount = count;
bool deletefront = false;
for (auto it = drawtext.begin(); it != drawtext.end(); ++it)
{
if ((470 - (tempcount * 20)) <= 20)
{
deletefront = true;
}
else
it->setPosition(it->getPosition().x, (float)(470 - (tempcount * 20)));
tempcount--;
}
if (deletefront == true)
{
drawtext.erase(drawtext.begin());
}
else
count++;
}
public:
TextHandler()
{
count = 0;
temptext.setFont(font);
temptext.setFillColor(sf::Color::White);
temptext.setCharacterSize(15);
typehere.setFont(font);
typehere.setFillColor(sf::Color::White);
typehere.setCharacterSize(15);
typehere.setPosition((float)10, (float)510);
typewhat.setFont(font);
typewhat.setFillColor(sf::Color::White);
typewhat.setCharacterSize(15);
typewhat.setPosition((float)10, (float)530);
typewhat2.setFont(font);
typewhat2.setFillColor(sf::Color::White);
typewhat2.setCharacterSize(15);
typewhat2.setPosition((float)10, (float)550);
counts.setFont(font);
counts.setFillColor(sf::Color::Green);
counts.setCharacterSize(15);
counts.setPosition((float)10, (float)10);
_count = "Jobs: Updating...";
counts.setString(_count);
time.setFont(font);
time.setFillColor(sf::Color::Green);
time.setCharacterSize(15);
time.setPosition((float)550, (float)10);
_time = "Time: Updating...";
time.setString(_time);
typehere.setString("Command:");
typewhat.setString("");
typewhat.setString("");
typwhat.clear();
typwhat2.clear();
}
void AddText(std::string &ttext)
{
text = ttext;
std::string linetext;
std::vector<std::string> alllines;
bool firstline = false;
int linecount = 0, letters = 0, netletters = GetStringSize(text), templinecount = 1;
if (netletters <= 90)
{
alllines.push_back(text);
}
else
{
for (auto it = text.begin(); it != text.end(); ++it)
{
if (letters > 90 && firstline == false)
{
letters = 0;
alllines.push_back(linetext);
linetext.clear();
linecount++;
firstline = true;
}
else if (letters >= 84 && firstline == true)
{
letters = 0;
alllines.push_back(linetext);
linetext.clear();
linecount++;
}
else if ((netletters - ((linecount * 84))) <= 84)
{
linetext += FetchFrom(text, it);
alllines.push_back(linetext);
linecount++;
break;
}
linetext += *it;
letters++;
}
}
for (auto it = alllines.begin(); it != alllines.end(); ++it)
{
if (templinecount > 1)
SetDrawText(*it, 80);
else
SetDrawText(*it);
templinecount++;
}
}
std::string FetchFrom(std::string &_text, std::string::iterator _it)
{
std::string temp;
bool found = false;
for (auto it = _text.begin(); it != text.end(); ++it)
{
if (found == true)
temp += *it;
if (it == _it)
{
temp += *it;
found = true;
}
}
return temp;
}
void UpdateCount(std::string &__count)
{
_count = "Jobs: " + __count;
counts.setString(_count);
}
void UpdateTime(std::string &__time)
{
_time = "Time: " + __time;
time.setString(_time);
}
void UpdateTypeWhat(char c)
{
if (c != 8)
{
if (GetStringSize(typwhat) >= 90)
{
typwhat2 += c;
}
else
{
typwhat += c;
}
}
else if (!typwhat.empty())
{
if (!typwhat2.empty())
{
typwhat2.pop_back();
}
else
{
typwhat.pop_back();
}
}
typewhat.setString(typwhat);
typewhat2.setString(typwhat2);
}
int GetStringSize(std::string &str)
{
int num = 0;
for (auto it = str.begin(); it != str.end(); ++it)
{
num++;
}
return num;
}
void ClearTyped()
{
typwhat.clear();
typewhat.setString("");
typwhat2.clear();
typewhat2.setString("");
}
std::string GetTyped()
{
return typwhat + typwhat2;
}
bool getDelimitedStrings(std::string &str, std::vector<std::string> *_dest, int args = 3, char delim = ' ')
{
std::string temp;
int delimcounter = 0;
for (std::string::iterator it = str.begin(); it != str.end(); it++)
{
if ((*it == delim || delimcounter == args - 1))
{
if (delimcounter == args - 1)
{
_dest->push_back(cutStringFrom(&str, &it));
delimcounter++;
break;
}
_dest->push_back(temp);
temp.clear();
delimcounter++;
}
else
{
temp += (*it);
}
}
return (delimcounter == args) ? true : false;
}
std::string cutStringFrom(std::string *str, std::string::iterator *it)
{
std::string temp;
int reach = 0;
for (std::string::iterator it2 = str->begin(); it2 != str->end(); it2++)
{
if (!reach)
{
if (*it == it2)
{
reach = 1;
temp += *it2;
}
}
else
temp += *it2;
}
return temp;
}
};
#endif // TEXT_HANDLER_HPP
| 22.04943 | 109 | 0.583032 | Electrux |
64e1c2b4ba3a945831eeb80a7d9b65338f08b00c | 8,821 | cpp | C++ | runtime/device.cpp | fletcherjiang/ssm-alipay | d7cd911c72c2538859597b9ed3c96d02693febf2 | [
"Apache-2.0"
] | 169 | 2021-10-07T03:50:42.000Z | 2021-12-20T01:55:51.000Z | runtime/device.cpp | fletcherjiang/ssm-alipay | d7cd911c72c2538859597b9ed3c96d02693febf2 | [
"Apache-2.0"
] | 11 | 2021-10-09T01:53:49.000Z | 2021-10-09T01:53:49.000Z | runtime/device.cpp | JoeAnimation/ssm-alipay | d7cd911c72c2538859597b9ed3c96d02693febf2 | [
"Apache-2.0"
] | 56 | 2021-10-07T03:50:53.000Z | 2021-10-12T00:41:59.000Z | /**
* @file device.cpp
*
* Copyright (C) Huawei Technologies Co., Ltd. 2019-2020. All Rights Reserved.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include "acl/acl_rt.h"
#include <cstring>
#include "runtime/dev.h"
#include "runtime/context.h"
#include "framework/executor/ge_executor.h"
#include "log_inner.h"
#include "error_codes_inner.h"
#include "toolchain/profiling_manager.h"
#include "toolchain/resource_statistics.h"
#include "set_device_vxx.h"
#include "common_inner.h"
namespace {
std::map<int32_t, uint64_t> g_deviceCounterMap;
std::mutex g_deviceCounterMutex;
void IncDeviceCounter(const int32_t deviceId)
{
std::unique_lock<std::mutex> lk(g_deviceCounterMutex);
auto iter = g_deviceCounterMap.find(deviceId);
if (iter == g_deviceCounterMap.end()) {
g_deviceCounterMap[deviceId] = 1U;
} else {
++iter->second;
}
}
bool DecDeviceCounter(const int32_t deviceId)
{
std::unique_lock<std::mutex> lk(g_deviceCounterMutex);
auto iter = g_deviceCounterMap.find(deviceId);
if (iter != g_deviceCounterMap.end()) {
if (iter->second != 0U) {
--iter->second;
if (iter->second == 0U) {
return true;
}
}
} else {
ACL_LOG_INFO("device %d has not been set.", deviceId);
}
return false;
}
}
aclError aclrtSetDevice(int32_t deviceId)
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_ADD_APPLY_TOTAL_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
ACL_LOG_INFO("start to execute aclrtSetDevice, deviceId = %d.", deviceId);
rtError_t rtErr = rtSetDevice(deviceId);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("open device %d failed, runtime result = %d.", deviceId, static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
IncDeviceCounter(deviceId);
ACL_LOG_INFO("successfully execute aclrtSetDevice, deviceId = %d", deviceId);
ACL_ADD_APPLY_SUCCESS_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
return ACL_SUCCESS;
}
aclError aclrtSetDeviceWithoutTsdVXX(int32_t deviceId)
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_ADD_APPLY_TOTAL_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
ACL_LOG_INFO("start to execute aclrtSetDeviceWithoutTsdVXX, deviceId = %d.", deviceId);
const std::string socVersion = GetSocVersion();
if (strncmp(socVersion.c_str(), "Ascend910", strlen("Ascend910")) != 0) {
ACL_LOG_INFO("The soc version is not Ascend910, not support");
return ACL_ERROR_API_NOT_SUPPORT;
}
rtError_t rtErr = rtSetDeviceWithoutTsd(deviceId);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("open device %d failed, runtime result = %d.", deviceId, static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
IncDeviceCounter(deviceId);
ACL_LOG_INFO("open device %d successfully.", deviceId);
ACL_ADD_APPLY_SUCCESS_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
return ACL_SUCCESS;
}
aclError aclrtResetDevice(int32_t deviceId)
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_ADD_RELEASE_TOTAL_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
ACL_LOG_INFO("start to execute aclrtResetDevice, deviceId = %d.", deviceId);
if (DecDeviceCounter(deviceId)) {
ACL_LOG_INFO("device %d reference count is 0.", deviceId);
// get default context
rtContext_t rtDefaultCtx = nullptr;
rtError_t rtErr = rtGetPriCtxByDeviceId(deviceId, &rtDefaultCtx);
if ((rtErr == RT_ERROR_NONE) && (rtDefaultCtx != nullptr)) {
ACL_LOG_INFO("try release op resource for device %d.", deviceId);
(void) ge::GeExecutor::ReleaseSingleOpResource(rtDefaultCtx);
}
}
rtError_t rtErr = rtDeviceReset(deviceId);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("reset device %d failed, runtime result = %d.", deviceId, static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_INFO("successfully execute aclrtResetDevice, reset device %d.", deviceId);
ACL_ADD_RELEASE_SUCCESS_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
return ACL_SUCCESS;
}
aclError aclrtResetDeviceWithoutTsdVXX(int32_t deviceId)
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_ADD_RELEASE_TOTAL_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
ACL_LOG_INFO("start to execute aclrtResetDeviceWithoutTsdVXX, deviceId = %d.", deviceId);
const std::string socVersion = GetSocVersion();
if (strncmp(socVersion.c_str(), "Ascend910", strlen("Ascend910")) != 0) {
ACL_LOG_INNER_ERROR("The soc version is not Ascend910, not support");
return ACL_ERROR_API_NOT_SUPPORT;
}
if (DecDeviceCounter(deviceId)) {
ACL_LOG_INFO("device %d reference count is 0.", deviceId);
// get default context
rtContext_t rtDefaultCtx = nullptr;
rtError_t rtErr = rtGetPriCtxByDeviceId(deviceId, &rtDefaultCtx);
if ((rtErr == RT_ERROR_NONE) && (rtDefaultCtx != nullptr)) {
ACL_LOG_INFO("try release op resource for device %d.", deviceId);
(void) ge::GeExecutor::ReleaseSingleOpResource(rtDefaultCtx);
}
}
rtError_t rtErr = rtDeviceResetWithoutTsd(deviceId);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("reset device %d failed, runtime result = %d.", deviceId, static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_INFO("successfully execute aclrtResetDeviceWithoutTsdVXX, reset device %d", deviceId);
ACL_ADD_RELEASE_SUCCESS_COUNT(ACL_STATISTICS_SET_RESET_DEVICE);
return ACL_SUCCESS;
}
aclError aclrtGetDevice(int32_t *deviceId)
{
ACL_LOG_INFO("start to execute aclrtGetDevice");
ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(deviceId);
rtError_t rtErr = rtGetDevice(deviceId);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_WARN("get device failed, runtime result = %d.", static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_DEBUG("successfully execute aclrtGetDevice, get device id is %d.", *deviceId);
return ACL_SUCCESS;
}
aclError aclrtGetRunMode(aclrtRunMode *runMode)
{
ACL_LOG_INFO("start to execute aclrtGetRunMode");
ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(runMode);
rtRunMode rtMode;
rtError_t rtErr = rtGetRunMode(&rtMode);
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("get runMode failed, runtime result = %d.", static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
if (rtMode == RT_RUN_MODE_OFFLINE) {
*runMode = ACL_DEVICE;
return ACL_SUCCESS;
}
*runMode = ACL_HOST;
ACL_LOG_INFO("successfully execute aclrtGetRunMode, current runMode is %d.", static_cast<int32_t>(*runMode));
return ACL_SUCCESS;
}
aclError aclrtSynchronizeDevice()
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_LOG_INFO("start to execute aclrtSynchronizeDevice");
rtError_t rtErr = rtDeviceSynchronize();
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("wait for compute device to finish failed, runtime result = %d.",
static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_INFO("device synchronize successfully.");
return ACL_SUCCESS;
}
aclError aclrtSetTsDevice(aclrtTsId tsId)
{
ACL_PROFILING_REG(ACL_PROF_FUNC_RUNTIME);
ACL_LOG_INFO("start to execute aclrtSetTsDevice, tsId = %d.", static_cast<int32_t>(tsId));
if ((tsId != ACL_TS_ID_AICORE) && (tsId != ACL_TS_ID_AIVECTOR)) {
ACL_LOG_INNER_ERROR("invalid tsId, tsID is %d.", static_cast<int32_t>(tsId));
return ACL_ERROR_INVALID_PARAM;
}
rtError_t rtErr = rtSetTSDevice(static_cast<uint32_t>(tsId));
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("set device ts %d failed, runtime result = %d.", static_cast<int32_t>(tsId), rtErr);
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_INFO("successfully execute aclrtSetTsDevice, set device ts %d", static_cast<int32_t>(tsId));
return ACL_SUCCESS;
}
aclError aclrtGetDeviceCount(uint32_t *count)
{
ACL_LOG_INFO("start to execute aclrtGetDeviceCount");
ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(count);
rtError_t rtErr = rtGetDeviceCount(reinterpret_cast<int32_t *>(count));
if (rtErr != RT_ERROR_NONE) {
ACL_LOG_CALL_ERROR("get device count failed, runtime result = %d.", static_cast<int32_t>(rtErr));
return ACL_GET_ERRCODE_RTS(rtErr);
}
ACL_LOG_INFO("successfully execute aclrtGetDeviceCount, get device count is %u.", *count);
return ACL_SUCCESS;
}
| 38.688596 | 114 | 0.701961 | fletcherjiang |
64ea0f4c80afa7839f4b8ce7366f4a249103dc15 | 1,181 | cpp | C++ | codeforce6/1006D. Two Strings Swaps.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | codeforce6/1006D. Two Strings Swaps.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | codeforce6/1006D. Two Strings Swaps.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | /*
Idea:
- Each 2 mirror indexes in `a` and `b` are solvable alone,
in other words they does not affect the other indexes.
- We can use the fact in the previous point and solve each
2 mirror indexes and add the result of them to the solution
of the problem.
*/
#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 10;
char a[N], b[N];
int n;
int main() {
scanf("%d", &n);
scanf("%s", a + 1);
scanf("%s", b + 1);
int res = 0;
for(int i = 1, j = n; i <= j; ++i, --j) {
if(i == j) {
if(a[i] != b[i])
++res;
continue;
}
if(a[i] == b[j] && b[i] == a[j])
continue;
if(a[i] == a[j] && b[i] == b[j])
continue;
if(a[i] == b[i] && a[j] == b[j])
continue;
if(a[i] != a[j] && a[i] != b[i] && a[i] != b[j] && a[j] != b[i] && a[j] != b[j] && b[i] != b[j]) {
res += 2;
continue;
}
if(a[i] != a[j] && b[i] == b[j] && a[i] != b[i] && a[j] != b[i]) {
res += 1;
continue;
}
if(a[i] == a[j] && b[i] != b[j] && a[i] != b[i] && a[i] != b[j]) {
res += 2;
continue;
}
++res;
}
printf("%d\n", res);
return 0;
}
| 19.683333 | 102 | 0.421677 | khaled-farouk |
64ebf495a4d7c5a3c0dfcd93ecca0cb12a0eddb4 | 7,736 | cpp | C++ | src/tools/SxStructPatch.cpp | ashtonmv/sphinx_vdw | 5896fee0d92c06e883b72725cb859d732b8b801f | [
"Apache-2.0"
] | 1 | 2020-02-29T03:26:32.000Z | 2020-02-29T03:26:32.000Z | src/tools/SxStructPatch.cpp | ashtonmv/sphinx_vdw | 5896fee0d92c06e883b72725cb859d732b8b801f | [
"Apache-2.0"
] | null | null | null | src/tools/SxStructPatch.cpp | ashtonmv/sphinx_vdw | 5896fee0d92c06e883b72725cb859d732b8b801f | [
"Apache-2.0"
] | null | null | null | // ---------------------------------------------------------------------------
//
// The ab-initio based multiscale library
//
// S / P H I / n X
//
// Copyright: Max-Planck-Institute for Iron Research
// 40237 Duesseldorf, Germany
//
// Contact: https://sxlib.mpie.de
// Authors: see sphinx/AUTHORS
// License: see sphinx/LICENSE
//
// ---------------------------------------------------------------------------
#include <SxCLI.h>
#include <SxConfig.h>
#include <SxParser.h>
#include <SxAtomicStructure.h>
#include <SxNeighbors.h>
#include <SxGrid.h>
#include <SxFileIO.h>
SxVector3<Double> toCoords (const SxString &s)
{
SxList<SxString> coords
= s.substitute ("{","")
.substitute ("}","")
.substitute (" ","")
.tokenize (',');
if (coords.getSize () != 3) {
throw SxException (("Cannot extract coordinates from " + s).ascii ());
}
// => might throw an exception, too
Coord pos(coords(0).toDouble (),
coords(1).toDouble (),
coords(2).toDouble ());
return pos;
}
int main (int argc, char **argv)
{
// --- init S/PHI/nX Utilities
initSPHInXMath ();
// --- parse command line
SxCLI cli (argc, argv);
cli.preUsageMessage =
"This add-on modifies the structure according to the structure patch "
"file as produced by sxstructdiff.";
cli.authors = "C. Freysoldt";
SxString inFile
= cli.option ("-i|--input", "input file",
"take original input file")
.toString ("input.sx");
SxString outFile
= cli.option ("-o","filename", "output file name (screen otherwise)")
.toString ("");
SxString patchFile
= cli.option ("-p","filename", "patch file name")
.toString ();
double distMax = cli.option ("-d|--dmax","distance",
"tolerance for finding atoms").toDouble (0.);
bool labels = cli.option ("-l|--labels", "transfer labels").toBool ();
cli.finalize ();
// --- read input
SxAtomicStructure structure;
SxArray<SxString> chemNames;
{
SxParser parser;
SxConstPtr<SxSymbolTable> tree;
tree = parser.read (inFile, "std/structure.std");
structure = SxAtomicStructure (&*tree);
chemNames = SxSpeciesData::getElements (&*tree);
}
if (!structure.hasLabels ()) labels=false;
SxArray<bool> keep(structure.getNAtoms ());
keep.set (true);
SxArray<SxString> patch = SxString(SxFileIO::readBinary (patchFile,-1))
.tokenize ('\n');
SxGrid grid(structure, 10);
SxArray<SxList<Coord> > addedAtoms(structure.getNSpecies ());
for (int ip = 0; ip < patch.getSize (); ++ip) {
if (patch(ip).getSize () == 0) continue;
if (patch(ip)(0) != '>') continue;
if (patch(ip).contains ("> new")) {
// --- additional atom
SxList<SxString> split = patch(ip).tokenize ('@');
if (split.getSize () != 2) {
if (split.getSize () > 0) {
cout << "Cannot parse this line (ignored):" << endl;
cout << patch(ip) << endl;
}
continue;
}
SxString element = split(0).right ("new").substitute (" ","");
int is = (int)chemNames.findPos (element);
if (is == -1) {
is = (int)chemNames.getSize ();
chemNames.resize (is + 1, true);
chemNames(is) = element;
addedAtoms.resize (is + 1, true);
}
Coord pos;
try {
pos = toCoords (split(1));
} catch (SxException e) {
e.print ();
continue;
}
addedAtoms(is) << pos;
cout << "Adding " << element << " atom @ " << pos << endl;
}
// --- atoms were deleted, shifted, or changed species
SxList<SxString> split = patch(ip).tokenize (':');
if (split.getSize () != 2) {
if (split.getSize () > 2) {
cout << "Cannot parse this line (ignored):" << endl;
cout << patch(ip) << endl;
}
continue;
}
// --- find the relevant atom
Coord pos;
try {
pos = toCoords (split(0).right ("@"));
} catch (SxException e) {
e.print ();
continue;
}
int iTlAtom = structure.find (pos, grid);
if (iTlAtom == -1 && distMax > 0.) {
// --- try atoms nearby
SxNeighbors nn;
nn.compute (grid, structure, pos, distMax, SxNeighbors::StoreIdx | SxNeighbors::StoreAbs);
if (nn.getSize () == 1) iTlAtom = nn.idx(0);
else if (nn.getSize () > 0) cout << nn.absPositions << endl;
}
if (iTlAtom == -1) {
cout << "Could not find atom @ " << pos << endl;
continue;
}
// --- now apply the patch
//
// --- delete atom
if (split(1).contains ("delete")) {
keep(iTlAtom) = false;
cout << "Deleting atom " << (iTlAtom+1) << " @ "
<< structure.getAtom (iTlAtom) << endl;
continue;
}
// --- shift atom
if (split(1).contains ("shift")) {
Coord by;
try {
by = toCoords (split(1).right ("shift"));
} catch (SxException e) {
e.print ();
continue;
}
cout << "Shifting atom " << (iTlAtom+1) << " @ "
<< structure.getAtom (iTlAtom)
<< " by " << by
<< endl;
structure.ref (iTlAtom) += by;
continue;
}
// --- change species (delete and add)
if (split(1).contains ("new species")) {
keep(iTlAtom) = false;
SxString element = split(1).right ("species").substitute (" ","");
int is = (int)chemNames.findPos (element);
if (is == -1) {
is = (int)chemNames.getSize ();
chemNames.resize (is + 1, true);
chemNames(is) = element;
addedAtoms.resize (is + 1, true);
}
addedAtoms(is) << structure.getAtom (iTlAtom);
cout << "Changing species for atom " << (iTlAtom+1)
<< " @ " << structure.getAtom (iTlAtom) << " from "
<< chemNames(structure.getISpecies(iTlAtom)) << " to "
<< element << endl;
}
}
// --- copy atoms that have not been deleted
SxAtomicStructure result(structure.cell);
SxStack<SxString> newLabels;
const SxArray<SxString> *oldLabels = labels ? &structure.getLabels () : NULL;
for (int is = 0, iTl = 0; is < chemNames.getSize (); ++is) {
result.newSpecies ();
if (is < structure.getNSpecies ()) {
for (int ia = 0; ia < structure.getNAtoms (is); ++ia, ++iTl) {
if (keep(iTl)) {
result.addAtom (structure.getAtom (is, ia));
if (oldLabels) newLabels << (*oldLabels)(iTl);
}
}
}
for (int ia = 0; ia < addedAtoms(is).getSize (); ++ia) {
result.addAtom (addedAtoms(is)(ia));
newLabels << "";
}
}
result.endCreation ();
result.atomInfo->meta.attach (SxAtomicStructure::Elements, chemNames);
if (labels) {
result.atomInfo->meta.update (SxAtomicStructure::Labels,
SxArray<SxString> (newLabels));
}
// --- output
{
FILE *file;
if (outFile.getSize () > 0) {
file = fopen(outFile.ascii(),"w");
if (file == NULL) {
cout << "Can't open '" << outFile << "'." << endl;
SX_EXIT;
}
} else {
file = stdout;
}
result.fprint (file);
if (file != stdout) fclose (file);
}
}
| 30.944 | 99 | 0.496768 | ashtonmv |
64edbf53d0c907a17531b431824a0921b05e2927 | 6,536 | hh | C++ | GeneralUtilities/inc/OwningPointerCollection.hh | lborrel/Offline | db9f647bad3c702171ab5ffa5ccc04c82b3f8984 | [
"Apache-2.0"
] | 9 | 2020-03-28T00:21:41.000Z | 2021-12-09T20:53:26.000Z | GeneralUtilities/inc/OwningPointerCollection.hh | lborrel/Offline | db9f647bad3c702171ab5ffa5ccc04c82b3f8984 | [
"Apache-2.0"
] | 684 | 2019-08-28T23:37:43.000Z | 2022-03-31T22:47:45.000Z | GeneralUtilities/inc/OwningPointerCollection.hh | lborrel/Offline | db9f647bad3c702171ab5ffa5ccc04c82b3f8984 | [
"Apache-2.0"
] | 61 | 2019-08-16T23:28:08.000Z | 2021-12-20T08:29:48.000Z | #ifndef GeneralUtilities_OwningPointerCollection_hh
#define GeneralUtilities_OwningPointerCollection_hh
//
// A class template to take ownership of a collection of bare pointers to
// objects, to provide access to those objects and to delete them when the
// container object goes out of scope.
//
// This is designed to allow complex objects made on the heap to be used
// as transient-only data products.
//
// The original use is for BaBar tracks.
//
//
// Original author Rob Kutschke
//
// Notes:
// 1) I believe it would be wise to make the underlying container:
// std::vector<boost::right_kind_of_smart_pointer<T>>.
// scoped_ptr will not work since they are not copyable ( needed for vector ).
// unique_ptr seems mostly concerned with threads.
// I tried shared_ptr but I could not make it play nice with genreflex.
//
#include <vector>
#include <memory>
#include "canvas/Persistency/Common/detail/maybeCastObj.h"
namespace mu2e {
template<typename T>
class OwningPointerCollection{
public:
typedef typename std::vector<const T*>::const_iterator const_iterator;
typedef T const* value_type;
OwningPointerCollection():v_(){}
// Caller transfers ownership of the pointees to us.
explicit OwningPointerCollection( std::vector<T*>& v ):
v_(v.begin(), v.end() ){
}
// Caller transfers ownership of the pointees to us.
explicit OwningPointerCollection( std::vector<value_type>& v ):
v_(v){
}
// We own the pointees so delete them when our destructor is called.
~OwningPointerCollection(){
for( typename std::vector<value_type>::iterator i=v_.begin();
i!=v_.end(); ++i ){
delete *i;
}
}
#ifndef __GCCXML__
// GCCXML does not know about move syntax - so hide it.
OwningPointerCollection( OwningPointerCollection && rhs ):
v_(std::move(rhs.v_)){
rhs.v_.clear();
}
OwningPointerCollection& operator=( OwningPointerCollection && rhs ){
v_ = std::move(rhs.v_);
rhs.v_.clear();
return *this;
}
#endif /* GCCXML */
// Caller transfers ownership of the pointee to us.
void push_back( T* t){
v_.push_back(t);
}
void push_back( value_type t){
v_.push_back(t);
}
typename std::vector<value_type>::const_iterator begin() const{
return v_.begin();
}
typename std::vector<value_type>::const_iterator end() const{
return v_.end();
}
typename std::vector<value_type>::const_iterator cbegin() const{
return v_.cbegin();
}
typename std::vector<value_type>::const_iterator cend() const{
return v_.cend();
}
// Possibly needed by producer modules?
/*
void pop_back( ){
delete v_.back();
v_.pop_back();
}
*/
// Needed for event.put().
void swap( OwningPointerCollection& rhs){
std::swap( this->v_, rhs.v_);
}
// Accessors: this container retains ownership of the pointees.
size_t size() const { return v_.size(); }
T const& operator[](std::size_t i) const { return *v_.at(i); }
T const& at (std::size_t i) const { return *v_.at(i); }
value_type get (std::size_t i) const { return v_.at(i); }
value_type operator()(std::size_t i) const { return v_.at(i); }
// const access to the underlying container.
std::vector<value_type> const& getAll(){ return v_; }
private:
// Not copy-copyable or copy-assignable; this is needed to ensure exactly one delete.
// GCCXML does not know about =delete so leave these private and unimplemented.
OwningPointerCollection( OwningPointerCollection const& );
OwningPointerCollection& operator=( OwningPointerCollection const& );
// Owning pointers to the objects.
std::vector<value_type> v_;
};
} // namespace mu2e
// Various template specializations needed to make an art::Ptr<T> into an OwningPointerCollection<T>
// work.
//
// ItemGetter - return a bare pointer to an requested by giving its index.
// has_setPtr - do specializations exists for setPtr and getElementAddresses
// setPtr - return a bare pointer to an requested by giving its index.
// getElementAddresses - return a vector of bare pointers to a vector of elements requested by index.
//
#ifndef __GCCXML__
#include "canvas/Persistency/Common/Ptr.h"
namespace art {
namespace detail {
template <typename T>
class ItemGetter<T, mu2e::OwningPointerCollection<T> >;
}
template <class T>
struct has_setPtr<mu2e::OwningPointerCollection<T> >;
}
namespace mu2e {
template <class T>
void
setPtr(OwningPointerCollection<T> const & coll,
const std::type_info & iToType,
unsigned long iIndex,
void const *& oPtr);
template <typename T>
void
getElementAddresses(OwningPointerCollection<T> const & obj,
const std::type_info & iToType,
const std::vector<unsigned long>& iIndices,
std::vector<void const *>& oPtr);
}
template <typename T>
class art::detail::ItemGetter<T, mu2e::OwningPointerCollection<T> > {
public:
T const * operator()(mu2e::OwningPointerCollection<T> const * product,
typename art::Ptr<T>::key_type iKey) const;
};
template <typename T>
inline
T const *
art::detail::ItemGetter<T, mu2e::OwningPointerCollection<T> >::
operator()(mu2e::OwningPointerCollection<T> const * product,
typename art::Ptr<T>::key_type iKey) const
{
assert(product != 0);
std::size_t i(iKey);
return product->get(i);
}
namespace art {
template <class T>
struct has_setPtr<mu2e::OwningPointerCollection<T> >
{
static bool const value = true;
};
}
namespace mu2e {
template <class T>
void
setPtr(OwningPointerCollection<T> const & coll,
const std::type_info & iToType,
unsigned long iIndex,
void const *& oPtr)
{
oPtr = art::detail::maybeCastObj(coll.get(iIndex),iToType);
}
template <typename T>
void
getElementAddresses(OwningPointerCollection<T> const & obj,
const std::type_info & iToType,
const std::vector<unsigned long>& iIndices,
std::vector<void const *>& oPtr)
{
oPtr.reserve(iIndices.size());
for ( auto i : iIndices ){
oPtr.push_back(art::detail::maybeCastObj(obj.get(i),iToType));
}
}
}
#endif // __GCCXML__
#endif /* GeneralUtilities_OwningPointerCollection_hh */
| 27.812766 | 101 | 0.655141 | lborrel |
64ee53277ab5a72163a299848984f1413a0c879b | 1,777 | hpp | C++ | shared_model/backend/plain/engine_log.hpp | Insafin/iroha | 5e3c3252b2a62fa887274bdf25547dc264c10c26 | [
"Apache-2.0"
] | 1,467 | 2016-10-25T12:27:19.000Z | 2022-03-28T04:32:05.000Z | shared_model/backend/plain/engine_log.hpp | Insafin/iroha | 5e3c3252b2a62fa887274bdf25547dc264c10c26 | [
"Apache-2.0"
] | 2,366 | 2016-10-25T10:07:57.000Z | 2022-03-31T22:03:24.000Z | shared_model/backend/plain/engine_log.hpp | Insafin/iroha | 5e3c3252b2a62fa887274bdf25547dc264c10c26 | [
"Apache-2.0"
] | 662 | 2016-10-26T04:41:22.000Z | 2022-03-31T04:15:02.000Z | /**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef IROHA_SHARED_MODEL_PLAIN_ENGINE_LOG_HPP
#define IROHA_SHARED_MODEL_PLAIN_ENGINE_LOG_HPP
#include "interfaces/query_responses/engine_log.hpp"
#include "interfaces/common_objects/types.hpp"
namespace shared_model {
namespace plain {
class EngineLog final : public interface::EngineLog {
public:
EngineLog() = delete;
EngineLog(EngineLog const &) = delete;
EngineLog &operator=(EngineLog const &) = delete;
EngineLog(interface::types::EvmAddressHexString const &address,
interface::types::EvmDataHexString const &data)
: address_(address), data_(data) {}
EngineLog(interface::types::EvmAddressHexString &&address,
interface::types::EvmDataHexString &&data)
: address_(std::move(address)), data_(std::move(data)) {}
interface::types::EvmAddressHexString const &getAddress() const {
return address_;
}
interface::types::EvmDataHexString const &getData() const {
return data_;
}
interface::EngineLog::TopicsCollectionType const &getTopics() const {
return topics_;
}
void addTopic(interface::types::EvmTopicsHexString &&topic) {
topics_.emplace_back(std::move(topic));
}
void addTopic(interface::types::EvmTopicsHexString const &topic) {
topics_.emplace_back(topic);
}
private:
interface::types::EvmAddressHexString const address_;
interface::types::EvmDataHexString const data_;
interface::EngineLog::TopicsCollectionType topics_;
};
} // namespace plain
} // namespace shared_model
#endif // IROHA_SHARED_MODEL_PLAIN_ENGINE_LOG_HPP
| 29.616667 | 75 | 0.684299 | Insafin |
64f16b150a5787b3cee60de5b57c74eeadffac73 | 195 | cpp | C++ | Code full house/buoi17-nguyendinhtrungduc dequy/dequy/bai2.cpp | ducyb2001/CbyTrungDuc | 0e93394dce600876a098b90ae969575bac3788e1 | [
"Apache-2.0"
] | null | null | null | Code full house/buoi17-nguyendinhtrungduc dequy/dequy/bai2.cpp | ducyb2001/CbyTrungDuc | 0e93394dce600876a098b90ae969575bac3788e1 | [
"Apache-2.0"
] | null | null | null | Code full house/buoi17-nguyendinhtrungduc dequy/dequy/bai2.cpp | ducyb2001/CbyTrungDuc | 0e93394dce600876a098b90ae969575bac3788e1 | [
"Apache-2.0"
] | null | null | null | /*bai 2 S=1^2+2^2+3^2+.....+n^2 */
#include<stdio.h>
int tong(int n){
if(n==1) return 1;
else return n*n+tong(n-1);
}
int main(){
int n;
scanf("%d",&n);
int a = tong(n);
printf("%d",a);
}
| 13.928571 | 34 | 0.517949 | ducyb2001 |
64ff2b7560463b0cc2cfd8afa46d17f74d3bddfe | 3,308 | cpp | C++ | ocs2_robotic_examples/ocs2_nadia/src/constraint/EndEffectorLinearConstraint.cpp | james-p-foster/ocs2 | 8f1da414ba9ebb94ad1e8dd9bd513dbb9cc462fa | [
"BSD-3-Clause"
] | null | null | null | ocs2_robotic_examples/ocs2_nadia/src/constraint/EndEffectorLinearConstraint.cpp | james-p-foster/ocs2 | 8f1da414ba9ebb94ad1e8dd9bd513dbb9cc462fa | [
"BSD-3-Clause"
] | null | null | null | ocs2_robotic_examples/ocs2_nadia/src/constraint/EndEffectorLinearConstraint.cpp | james-p-foster/ocs2 | 8f1da414ba9ebb94ad1e8dd9bd513dbb9cc462fa | [
"BSD-3-Clause"
] | null | null | null | #include "ocs2_nadia/constraint/EndEffectorLinearConstraint.h"
namespace ocs2 {
namespace legged_robot {
EndEffectorLinearConstraint::EndEffectorLinearConstraint(const EndEffectorKinematics<scalar_t>& endEffectorKinematics,
size_t numConstraints, Config config)
: StateInputConstraint(ConstraintOrder::Linear),
endEffectorKinematicsPtr_(endEffectorKinematics.clone()),
numConstraints_(numConstraints),
config_(std::move(config)) {
if (endEffectorKinematicsPtr_->getIds().size() != 1) {
throw std::runtime_error("[EndEffectorLinearConstraint] this class only accepts a single end-effector!");
}
}
EndEffectorLinearConstraint::EndEffectorLinearConstraint(const EndEffectorLinearConstraint& rhs)
: StateInputConstraint(rhs),
endEffectorKinematicsPtr_(rhs.endEffectorKinematicsPtr_->clone()),
numConstraints_(rhs.numConstraints_),
config_(rhs.config_) {}
void EndEffectorLinearConstraint::configure(Config&& config) {
assert(config.b.rows() == numConstraints_);
assert(config.Ax.size() > 0 || config.Av.size() > 0);
assert((config.Ax.size() > 0 && config.Ax.rows() == numConstraints_) || config.Ax.size() == 0);
assert((config.Ax.size() > 0 && config.Ax.cols() == 3) || config.Ax.size() == 0);
assert((config.Av.size() > 0 && config.Av.rows() == numConstraints_) || config.Av.size() == 0);
assert((config.Av.size() > 0 && config.Av.cols() == 3) || config.Av.size() == 0);
config_ = std::move(config);
}
vector_t EndEffectorLinearConstraint::getValue(scalar_t time, const vector_t& state, const vector_t& input,
const PreComputation& preComp) const {
vector_t f = config_.b;
if (config_.Ax.size() > 0) {
f.noalias() += config_.Ax * endEffectorKinematicsPtr_->getPosition(state).front();
}
if (config_.Av.size() > 0) {
f.noalias() += config_.Av * endEffectorKinematicsPtr_->getVelocity(state, input).front();
}
return f;
}
VectorFunctionLinearApproximation EndEffectorLinearConstraint::getLinearApproximation(scalar_t time, const vector_t& state,
const vector_t& input,
const PreComputation& preComp) const {
VectorFunctionLinearApproximation linearApproximation =
VectorFunctionLinearApproximation::Zero(getNumConstraints(time), state.size(), input.size());
linearApproximation.f = config_.b;
if (config_.Ax.size() > 0) {
const auto positionApprox = endEffectorKinematicsPtr_->getPositionLinearApproximation(state).front();
linearApproximation.f.noalias() += config_.Ax * positionApprox.f;
linearApproximation.dfdx.noalias() += config_.Ax * positionApprox.dfdx;
}
if (config_.Av.size() > 0) {
const auto velocityApprox = endEffectorKinematicsPtr_->getVelocityLinearApproximation(state, input).front();
linearApproximation.f.noalias() += config_.Av * velocityApprox.f;
linearApproximation.dfdx.noalias() += config_.Av * velocityApprox.dfdx;
linearApproximation.dfdu.noalias() += config_.Av * velocityApprox.dfdu;
}
return linearApproximation;
}
} // namespace legged_robot
} // namespace ocs2
| 46.591549 | 124 | 0.674123 | james-p-foster |
64ff86bb1abd98bcc80d11f3bf21964ffda6bf5d | 102 | hpp | C++ | include/libelfxx/sys_types.hpp | syoch/libelfxx | b8717d48f21012df079a05956186296f434f82bc | [
"MIT"
] | null | null | null | include/libelfxx/sys_types.hpp | syoch/libelfxx | b8717d48f21012df079a05956186296f434f82bc | [
"MIT"
] | 1 | 2021-07-04T09:16:49.000Z | 2021-07-04T09:16:49.000Z | include/libelfxx/sys_types.hpp | syoch/libelfxx | b8717d48f21012df079a05956186296f434f82bc | [
"MIT"
] | 1 | 2021-11-26T23:14:02.000Z | 2021-11-26T23:14:02.000Z | #pragma once
enum ClassType
{
class32 = 1,
class64 = 2
};
enum Endian
{
Little = 1,
Big = 2
}; | 9.272727 | 14 | 0.588235 | syoch |
64ffedd24923217129d2d81a58942531afcfffaa | 13,569 | cpp | C++ | cpp/tests/experimental/mg_bfs_test.cpp | goncaloperes/cugraph | d4decff28d1f9b15a95c4bd25a6da21c2ed42ce0 | [
"Apache-2.0"
] | null | null | null | cpp/tests/experimental/mg_bfs_test.cpp | goncaloperes/cugraph | d4decff28d1f9b15a95c4bd25a6da21c2ed42ce0 | [
"Apache-2.0"
] | null | null | null | cpp/tests/experimental/mg_bfs_test.cpp | goncaloperes/cugraph | d4decff28d1f9b15a95c4bd25a6da21c2ed42ce0 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2021, NVIDIA 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.
*/
#include <utilities/high_res_clock.h>
#include <utilities/base_fixture.hpp>
#include <utilities/test_utilities.hpp>
#include <utilities/thrust_wrapper.hpp>
#include <algorithms.hpp>
#include <experimental/graph.hpp>
#include <experimental/graph_functions.hpp>
#include <experimental/graph_view.hpp>
#include <partition_manager.hpp>
#include <raft/comms/comms.hpp>
#include <raft/comms/mpi_comms.hpp>
#include <raft/handle.hpp>
#include <rmm/device_scalar.hpp>
#include <rmm/device_uvector.hpp>
#include <gtest/gtest.h>
#include <random>
// do the perf measurements
// enabled by command line parameter s'--perf'
//
static int PERF = 0;
typedef struct BFS_Usecase_t {
cugraph::test::input_graph_specifier_t input_graph_specifier{};
size_t source{0};
bool check_correctness{false};
BFS_Usecase_t(std::string const& graph_file_path, size_t source, bool check_correctness = true)
: source(source), check_correctness(check_correctness)
{
std::string graph_file_full_path{};
if ((graph_file_path.length() > 0) && (graph_file_path[0] != '/')) {
graph_file_full_path = cugraph::test::get_rapids_dataset_root_dir() + "/" + graph_file_path;
} else {
graph_file_full_path = graph_file_path;
}
input_graph_specifier.tag = cugraph::test::input_graph_specifier_t::MATRIX_MARKET_FILE_PATH;
input_graph_specifier.graph_file_full_path = graph_file_full_path;
};
BFS_Usecase_t(cugraph::test::rmat_params_t rmat_params,
size_t source,
bool check_correctness = true)
: source(source), check_correctness(check_correctness)
{
input_graph_specifier.tag = cugraph::test::input_graph_specifier_t::RMAT_PARAMS;
input_graph_specifier.rmat_params = rmat_params;
}
} BFS_Usecase;
template <typename vertex_t, typename edge_t, typename weight_t, bool multi_gpu>
std::tuple<cugraph::experimental::graph_t<vertex_t, edge_t, weight_t, false, multi_gpu>,
rmm::device_uvector<vertex_t>>
read_graph(raft::handle_t const& handle, BFS_Usecase const& configuration, bool renumber)
{
auto& comm = handle.get_comms();
auto const comm_size = comm.get_size();
auto const comm_rank = comm.get_rank();
std::vector<size_t> partition_ids(multi_gpu ? size_t{1} : static_cast<size_t>(comm_size));
std::iota(partition_ids.begin(),
partition_ids.end(),
multi_gpu ? static_cast<size_t>(comm_rank) : size_t{0});
return configuration.input_graph_specifier.tag ==
cugraph::test::input_graph_specifier_t::MATRIX_MARKET_FILE_PATH
? cugraph::test::
read_graph_from_matrix_market_file<vertex_t, edge_t, weight_t, false, multi_gpu>(
handle, configuration.input_graph_specifier.graph_file_full_path, false, renumber)
: cugraph::test::
generate_graph_from_rmat_params<vertex_t, edge_t, weight_t, false, multi_gpu>(
handle,
configuration.input_graph_specifier.rmat_params.scale,
configuration.input_graph_specifier.rmat_params.edge_factor,
configuration.input_graph_specifier.rmat_params.a,
configuration.input_graph_specifier.rmat_params.b,
configuration.input_graph_specifier.rmat_params.c,
configuration.input_graph_specifier.rmat_params.seed,
configuration.input_graph_specifier.rmat_params.undirected,
configuration.input_graph_specifier.rmat_params.scramble_vertex_ids,
false,
renumber,
partition_ids,
static_cast<size_t>(comm_size));
}
class Tests_MGBFS : public ::testing::TestWithParam<BFS_Usecase> {
public:
Tests_MGBFS() {}
static void SetupTestCase() {}
static void TearDownTestCase() {}
virtual void SetUp() {}
virtual void TearDown() {}
// Compare the results of running BFS on multiple GPUs to that of a single-GPU run
template <typename vertex_t, typename edge_t>
void run_current_test(BFS_Usecase const& configuration)
{
using weight_t = float;
// 1. initialize handle
raft::handle_t handle{};
HighResClock hr_clock{};
raft::comms::initialize_mpi_comms(&handle, MPI_COMM_WORLD);
auto& comm = handle.get_comms();
auto const comm_size = comm.get_size();
auto const comm_rank = comm.get_rank();
auto row_comm_size = static_cast<int>(sqrt(static_cast<double>(comm_size)));
while (comm_size % row_comm_size != 0) { --row_comm_size; }
cugraph::partition_2d::subcomm_factory_t<cugraph::partition_2d::key_naming_t, vertex_t>
subcomm_factory(handle, row_comm_size);
// 2. create MG graph
if (PERF) {
CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement
hr_clock.start();
}
cugraph::experimental::graph_t<vertex_t, edge_t, weight_t, false, true> mg_graph(handle);
rmm::device_uvector<vertex_t> d_mg_renumber_map_labels(0, handle.get_stream());
std::tie(mg_graph, d_mg_renumber_map_labels) =
read_graph<vertex_t, edge_t, weight_t, true>(handle, configuration, true);
if (PERF) {
CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement
double elapsed_time{0.0};
hr_clock.stop(&elapsed_time);
std::cout << "MG read_graph took " << elapsed_time * 1e-6 << " s.\n";
}
auto mg_graph_view = mg_graph.view();
ASSERT_TRUE(static_cast<vertex_t>(configuration.source) >= 0 &&
static_cast<vertex_t>(configuration.source) <
mg_graph_view.get_number_of_vertices())
<< "Invalid starting source.";
// 3. run MG BFS
rmm::device_uvector<vertex_t> d_mg_distances(mg_graph_view.get_number_of_local_vertices(),
handle.get_stream());
rmm::device_uvector<vertex_t> d_mg_predecessors(mg_graph_view.get_number_of_local_vertices(),
handle.get_stream());
if (PERF) {
CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement
hr_clock.start();
}
cugraph::experimental::bfs(handle,
mg_graph_view,
d_mg_distances.data(),
d_mg_predecessors.data(),
static_cast<vertex_t>(configuration.source),
false,
std::numeric_limits<vertex_t>::max());
if (PERF) {
CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement
double elapsed_time{0.0};
hr_clock.stop(&elapsed_time);
std::cout << "MG BFS took " << elapsed_time * 1e-6 << " s.\n";
}
// 5. copmare SG & MG results
if (configuration.check_correctness) {
// 5-1. create SG graph
cugraph::experimental::graph_t<vertex_t, edge_t, weight_t, false, false> sg_graph(handle);
std::tie(sg_graph, std::ignore) =
read_graph<vertex_t, edge_t, weight_t, false>(handle, configuration, false);
auto sg_graph_view = sg_graph.view();
std::vector<vertex_t> vertex_partition_lasts(comm_size);
for (size_t i = 0; i < vertex_partition_lasts.size(); ++i) {
vertex_partition_lasts[i] = mg_graph_view.get_vertex_partition_last(i);
}
rmm::device_scalar<vertex_t> d_source(static_cast<vertex_t>(configuration.source),
handle.get_stream());
cugraph::experimental::unrenumber_int_vertices<vertex_t, true>(
handle,
d_source.data(),
size_t{1},
d_mg_renumber_map_labels.data(),
mg_graph_view.get_local_vertex_first(),
mg_graph_view.get_local_vertex_last(),
vertex_partition_lasts,
true);
auto unrenumbered_source = d_source.value(handle.get_stream());
// 5-2. run SG BFS
rmm::device_uvector<vertex_t> d_sg_distances(sg_graph_view.get_number_of_local_vertices(),
handle.get_stream());
rmm::device_uvector<vertex_t> d_sg_predecessors(sg_graph_view.get_number_of_local_vertices(),
handle.get_stream());
cugraph::experimental::bfs(handle,
sg_graph_view,
d_sg_distances.data(),
d_sg_predecessors.data(),
unrenumbered_source,
false,
std::numeric_limits<vertex_t>::max());
// 5-3. compare
std::vector<edge_t> h_sg_offsets(sg_graph_view.get_number_of_vertices() + 1);
std::vector<vertex_t> h_sg_indices(sg_graph_view.get_number_of_edges());
raft::update_host(h_sg_offsets.data(),
sg_graph_view.offsets(),
sg_graph_view.get_number_of_vertices() + 1,
handle.get_stream());
raft::update_host(h_sg_indices.data(),
sg_graph_view.indices(),
sg_graph_view.get_number_of_edges(),
handle.get_stream());
std::vector<vertex_t> h_sg_distances(sg_graph_view.get_number_of_vertices());
std::vector<vertex_t> h_sg_predecessors(sg_graph_view.get_number_of_vertices());
raft::update_host(
h_sg_distances.data(), d_sg_distances.data(), d_sg_distances.size(), handle.get_stream());
raft::update_host(h_sg_predecessors.data(),
d_sg_predecessors.data(),
d_sg_predecessors.size(),
handle.get_stream());
std::vector<vertex_t> h_mg_distances(mg_graph_view.get_number_of_local_vertices());
std::vector<vertex_t> h_mg_predecessors(mg_graph_view.get_number_of_local_vertices());
raft::update_host(
h_mg_distances.data(), d_mg_distances.data(), d_mg_distances.size(), handle.get_stream());
cugraph::experimental::unrenumber_int_vertices<vertex_t, true>(
handle,
d_mg_predecessors.data(),
d_mg_predecessors.size(),
d_mg_renumber_map_labels.data(),
mg_graph_view.get_local_vertex_first(),
mg_graph_view.get_local_vertex_last(),
vertex_partition_lasts,
true);
raft::update_host(h_mg_predecessors.data(),
d_mg_predecessors.data(),
d_mg_predecessors.size(),
handle.get_stream());
std::vector<vertex_t> h_mg_renumber_map_labels(d_mg_renumber_map_labels.size());
raft::update_host(h_mg_renumber_map_labels.data(),
d_mg_renumber_map_labels.data(),
d_mg_renumber_map_labels.size(),
handle.get_stream());
handle.get_stream_view().synchronize();
for (vertex_t i = 0; i < mg_graph_view.get_number_of_local_vertices(); ++i) {
auto mapped_vertex = h_mg_renumber_map_labels[i];
ASSERT_TRUE(h_mg_distances[i] == h_sg_distances[mapped_vertex])
<< "MG BFS distance for vertex: " << mapped_vertex << " in rank: " << comm_rank
<< " has value: " << h_mg_distances[i]
<< " different from the corresponding SG value: " << h_sg_distances[mapped_vertex];
if (h_mg_predecessors[i] == cugraph::invalid_vertex_id<vertex_t>::value) {
ASSERT_TRUE(h_sg_predecessors[mapped_vertex] == h_mg_predecessors[i])
<< "vertex reachability does not match with the SG result.";
} else {
ASSERT_TRUE(h_sg_distances[h_mg_predecessors[i]] + 1 == h_sg_distances[mapped_vertex])
<< "distances to this vertex != distances to the predecessor vertex + 1.";
bool found{false};
for (auto j = h_sg_offsets[h_mg_predecessors[i]];
j < h_sg_offsets[h_mg_predecessors[i] + 1];
++j) {
if (h_sg_indices[j] == mapped_vertex) {
found = true;
break;
}
}
ASSERT_TRUE(found) << "no edge from the predecessor vertex to this vertex.";
}
}
}
}
};
TEST_P(Tests_MGBFS, CheckInt32Int32) { run_current_test<int32_t, int32_t>(GetParam()); }
INSTANTIATE_TEST_CASE_P(
simple_test,
Tests_MGBFS,
::testing::Values(
// enable correctness checks
BFS_Usecase("test/datasets/karate.mtx", 0),
BFS_Usecase("test/datasets/web-Google.mtx", 0),
BFS_Usecase("test/datasets/ljournal-2008.mtx", 0),
BFS_Usecase("test/datasets/webbase-1M.mtx", 0),
BFS_Usecase(cugraph::test::rmat_params_t{10, 16, 0.57, 0.19, 0.19, 0, false, false}, 0),
// disable correctness checks for large graphs
BFS_Usecase(cugraph::test::rmat_params_t{20, 32, 0.57, 0.19, 0.19, 0, false, false},
0,
false)));
CUGRAPH_MG_TEST_PROGRAM_MAIN()
| 41.495413 | 99 | 0.644336 | goncaloperes |
8f0319c8fc93b9a0d9f9a1eb51b7f3a9146c280c | 275 | hpp | C++ | simulator/version.hpp | xuanruiqi/et2-java | 1e82b3a26f6eeb1054da8244173666d107de38ca | [
"BSD-2-Clause"
] | 1 | 2019-05-29T06:35:58.000Z | 2019-05-29T06:35:58.000Z | simulator/version.hpp | xuanruiqi/et2-java | 1e82b3a26f6eeb1054da8244173666d107de38ca | [
"BSD-2-Clause"
] | 22 | 2018-04-04T23:05:09.000Z | 2019-04-20T00:04:03.000Z | simulator/version.hpp | RedlineResearch/QTR-tool | 7838a726b66c990b5278e7f9f5d4c642ed43775d | [
"BSD-2-Clause"
] | 2 | 2018-03-30T19:35:07.000Z | 2019-04-19T23:38:17.000Z | #ifndef _VERSION_H
#define _VERSION_H
extern const char *build_git_time;
extern const char *build_git_sha;
// From Stackoverflow:
// http://stackoverflow.com/questions/1704907/how-can-i-get-my-c-code-to-automatically-print-out-its-git-version-hash
#endif /* _VERSION_H */
| 25 | 117 | 0.778182 | xuanruiqi |
8f07528ecd91228eef5326d3d528862b1f6ffe35 | 170 | cpp | C++ | CodeChef/Easy-Problems/TEST.cpp | annukamat/My-Competitive-Journey | adb13a5723483cde13e5f3859b3a7ad840b86c97 | [
"MIT"
] | 7 | 2018-11-08T11:39:27.000Z | 2020-09-10T17:50:57.000Z | CodeChef/Easy-Problems/TEST.cpp | annukamat/My-Competitive-Journey | adb13a5723483cde13e5f3859b3a7ad840b86c97 | [
"MIT"
] | null | null | null | CodeChef/Easy-Problems/TEST.cpp | annukamat/My-Competitive-Journey | adb13a5723483cde13e5f3859b3a7ad840b86c97 | [
"MIT"
] | 2 | 2019-09-16T14:34:03.000Z | 2019-10-12T19:24:00.000Z | #include <iostream>
using namespace std;
int main(){
int num;
cin>>num;
while(!(num == 42)){
cout<<num<<"\n";
cin>>num;
}
return 0;
} | 14.166667 | 24 | 0.482353 | annukamat |
8f07dfbf5bfa333b4f55400f2924f908231cecb4 | 5,557 | cpp | C++ | iceoryx_utils/test/moduletests/test_cxx_helplets.cpp | dotChris90/iceoryx | 9a71b9274d60f5665375e67d142e79660c4c8365 | [
"Apache-2.0"
] | null | null | null | iceoryx_utils/test/moduletests/test_cxx_helplets.cpp | dotChris90/iceoryx | 9a71b9274d60f5665375e67d142e79660c4c8365 | [
"Apache-2.0"
] | null | null | null | iceoryx_utils/test/moduletests/test_cxx_helplets.cpp | dotChris90/iceoryx | 9a71b9274d60f5665375e67d142e79660c4c8365 | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
#include "iceoryx_utils/cxx/helplets.hpp"
#include "test.hpp"
#include <type_traits>
namespace
{
using namespace ::testing;
using namespace iox::cxx;
namespace
{
struct Bar
{
alignas(8) uint8_t m_dummy[73];
};
struct Foo
{
uint8_t m_dummy[73];
};
struct FooBar
{
alignas(32) uint8_t m_dummy[73];
};
struct FuBar
{
alignas(32) uint8_t m_dummy[73];
};
} // namespace
class Helplets_test : public Test
{
public:
void SetUp() override
{
}
void TearDown() override
{
}
};
TEST_F(Helplets_test, maxSize)
{
EXPECT_THAT(iox::cxx::maxSize<Foo>(), Eq(sizeof(Foo)));
EXPECT_THAT(sizeof(Bar), Ne(sizeof(Foo)));
EXPECT_THAT((iox::cxx::maxSize<Bar, Foo>()), Eq(sizeof(Bar)));
EXPECT_THAT(sizeof(Bar), Ne(sizeof(FooBar)));
EXPECT_THAT(sizeof(Foo), Ne(sizeof(FooBar)));
EXPECT_THAT((iox::cxx::maxSize<Bar, Foo, FooBar>()), Eq(sizeof(FooBar)));
EXPECT_THAT(sizeof(FooBar), Eq(sizeof(FuBar)));
EXPECT_THAT((iox::cxx::maxSize<FooBar, FuBar>()), Eq(sizeof(FooBar)));
}
TEST_F(Helplets_test, maxAlignment)
{
EXPECT_THAT(iox::cxx::maxAlignment<Foo>(), Eq(alignof(Foo)));
EXPECT_THAT(alignof(Bar), Ne(alignof(Foo)));
EXPECT_THAT((iox::cxx::maxAlignment<Bar, Foo>()), Eq(alignof(Bar)));
EXPECT_THAT(alignof(Bar), Ne(alignof(FooBar)));
EXPECT_THAT(alignof(Foo), Ne(alignof(FooBar)));
EXPECT_THAT((iox::cxx::maxAlignment<Bar, Foo, FooBar>()), Eq(alignof(FooBar)));
EXPECT_THAT(alignof(FooBar), Eq(alignof(FuBar)));
EXPECT_THAT((iox::cxx::maxAlignment<FooBar, FuBar>()), Eq(alignof(FooBar)));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint8WhenValueSmaller256)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<123U>, uint8_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint8WhenValueEqualTo255)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<255U>, uint8_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint16WhenValueEqualTo256)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<256U>, uint16_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint16WhenValueBetween256And65535)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<8172U>, uint16_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint16WhenValueEqualTo65535)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<65535U>, uint16_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint32WhenValueEqualTo65536)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<65536U>, uint32_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint32WhenValueBetween2p16And2p32)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<81721U>, uint32_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint32WhenValueEqualTo4294967295)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<4294967295U>, uint32_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint64WhenValueEqualTo4294967296)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<4294967296U>, uint64_t>::value));
}
TEST_F(Helplets_test, bestFittingTypeUsesUint32WhenValueGreater2p32)
{
EXPECT_TRUE((std::is_same<BestFittingType_t<42949672961U>, uint64_t>::value));
}
template <class T>
class Helplets_test_isPowerOfTwo : public Helplets_test
{
public:
using CurrentType = T;
static constexpr T MAX = std::numeric_limits<T>::max();
static constexpr T MAX_POWER_OF_TWO = MAX / 2U + 1U;
};
using HelpletsIsPowerOfTwoTypes = Types<uint8_t, uint16_t, uint32_t, uint64_t, size_t>;
/// we require TYPED_TEST since we support gtest 1.8 for our safety targets
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TYPED_TEST_CASE(Helplets_test_isPowerOfTwo, HelpletsIsPowerOfTwoTypes);
#pragma GCC diagnostic pop
TYPED_TEST(Helplets_test_isPowerOfTwo, OneIsPowerOfTwo)
{
EXPECT_TRUE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(1)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, TwoIsPowerOfTwo)
{
EXPECT_TRUE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(2)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, FourIsPowerOfTwo)
{
EXPECT_TRUE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(4)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, MaxPossiblePowerOfTwoForTypeIsPowerOfTwo)
{
EXPECT_TRUE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(TestFixture::MAX_POWER_OF_TWO)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, ZeroIsNotPowerOfTwo)
{
EXPECT_FALSE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(0)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, FourtyTwoIsNotPowerOfTwo)
{
EXPECT_FALSE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(42)));
}
TYPED_TEST(Helplets_test_isPowerOfTwo, MaxValueForTypeIsNotPowerOfTwo)
{
EXPECT_FALSE(isPowerOfTwo(static_cast<typename TestFixture::CurrentType>(TestFixture::MAX)));
}
} // namespace
| 28.792746 | 109 | 0.755983 | dotChris90 |
8f089cd4b779573677570eeb9519ee49c84f0435 | 795 | cpp | C++ | src/gui/widget/BodyWidget/RawBodyTab/RawBodyTabView.cpp | bartkessels/GetIt | 8adde91005d00d83a73227a91b08706657513f41 | [
"MIT"
] | 16 | 2020-09-07T18:53:39.000Z | 2022-03-21T08:15:55.000Z | src/gui/widget/BodyWidget/RawBodyTab/RawBodyTabView.cpp | bartkessels/GetIt | 8adde91005d00d83a73227a91b08706657513f41 | [
"MIT"
] | 23 | 2017-03-29T21:21:43.000Z | 2022-03-23T07:27:55.000Z | src/gui/widget/BodyWidget/RawBodyTab/RawBodyTabView.cpp | bartkessels/GetIt | 8adde91005d00d83a73227a91b08706657513f41 | [
"MIT"
] | 4 | 2020-06-15T12:51:10.000Z | 2021-09-05T20:50:46.000Z | #include "gui/widget/BodyWidget/RawBodyTab/RawBodyTabView.hpp"
#include "./ui_RawBodyTabView.h"
using namespace getit::gui::widget::BodyWidget;
RawBodyTabView::RawBodyTabView(QWidget* parent):
QWidget(parent),
ui(new Ui::RawBodyTabView())
{
ui->setupUi(this);
}
RawBodyTabView::~RawBodyTabView()
{
delete ui;
}
std::string RawBodyTabView::getContentType()
{
return ui->contentType->text().toStdString();
}
std::string RawBodyTabView::getBody()
{
return ui->rawBody->document()->toPlainText().toStdString();
}
void RawBodyTabView::setContentType(std::string contentType)
{
ui->contentType->setText(QString::fromStdString(contentType));
}
void RawBodyTabView::setBody(std::string body)
{
ui->rawBody->document()->setPlainText(QString::fromStdString(body));
} | 22.083333 | 72 | 0.72956 | bartkessels |
557f2b58794d0d4e0f9604d125de0a6bc6e95df8 | 1,830 | cpp | C++ | Source/Tetris3D/Tetris3DSpawner.cpp | dingjun/Tetris3D | 66adfa23a8fb94376553dcc890fd0a61d9e8c297 | [
"MIT"
] | null | null | null | Source/Tetris3D/Tetris3DSpawner.cpp | dingjun/Tetris3D | 66adfa23a8fb94376553dcc890fd0a61d9e8c297 | [
"MIT"
] | null | null | null | Source/Tetris3D/Tetris3DSpawner.cpp | dingjun/Tetris3D | 66adfa23a8fb94376553dcc890fd0a61d9e8c297 | [
"MIT"
] | null | null | null | // Fill out your copyright notice in the Description page of Project Settings.
#include "Tetris3DSpawner.h"
#include "Tetris3DTetromino.h"
#include "Tetris3DGameMode.h"
#include "Engine/World.h"
// Sets default values
ATetris3DSpawner::ATetris3DSpawner()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
// Create dummy root scene component
DummyRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Dummy0"));
RootComponent = DummyRoot;
}
// Called when the game starts or when spawned
void ATetris3DSpawner::BeginPlay()
{
Super::BeginPlay();
GameMode = (ATetris3DGameMode*)(GetWorld()->GetAuthGameMode());
}
void ATetris3DSpawner::SpawnTetromino()
{
if (GameMode->GetCurrentState() != ETetris3DPlayState::EPlaying)
{
return;
}
ATetris3DTetromino* Tetromino;
int32 RandIndex = FMath::RandHelper(3);
switch (RandIndex)
{
case 0:
Tetromino = GetWorld()->SpawnActor<ATetris3DTetromino>(TetrominoI, GetActorLocation(), FRotator(0, 0, 0));
break;
case 1:
Tetromino = GetWorld()->SpawnActor<ATetris3DTetromino>(TetrominoO, GetActorLocation(), FRotator(0, 0, 0));
break;
case 2:
Tetromino = GetWorld()->SpawnActor<ATetris3DTetromino>(TetrominoT, GetActorLocation(), FRotator(0, 0, 0));
break;
}
TetrominoArray.Push(Tetromino);
}
void ATetris3DSpawner::Init()
{
for (auto Tetromino : TetrominoArray)
{
Tetromino->Destroy();
}
TetrominoArray.SetNum(0);
SpawnTetromino();
}
void ATetris3DSpawner::MoveActiveTetrominoLeft()
{
TetrominoArray.Top()->MoveLeft();
}
void ATetris3DSpawner::MoveActiveTetrominoRight()
{
TetrominoArray.Top()->MoveRight();
}
void ATetris3DSpawner::MoveActiveTetrominoDown()
{
TetrominoArray.Top()->MoveDown();
}
| 24.4 | 115 | 0.727322 | dingjun |
557f74abe6322e2eeeab60c9ae0dfc457bcfa204 | 1,304 | cpp | C++ | CMinus/CMinus/node/list_node.cpp | benbraide/CMinus | 3b845e0bc22840b549f108bf6600f1f34d865e7b | [
"MIT"
] | null | null | null | CMinus/CMinus/node/list_node.cpp | benbraide/CMinus | 3b845e0bc22840b549f108bf6600f1f34d865e7b | [
"MIT"
] | null | null | null | CMinus/CMinus/node/list_node.cpp | benbraide/CMinus | 3b845e0bc22840b549f108bf6600f1f34d865e7b | [
"MIT"
] | null | null | null | #include "../logic/runtime.h"
#include "list_node.h"
cminus::node::list::list(object *parent, const std::vector<std::shared_ptr<object>> &value)
: object(parent), value_(value){}
cminus::node::list::list(object *parent, std::vector<std::shared_ptr<object>> &&value)
: object(parent), value_(std::move(value)){}
cminus::node::list::~list() = default;
const cminus::node::object::index_info &cminus::node::list::get_index() const{
return value_[0]->get_index();
}
std::shared_ptr<cminus::node::object> cminus::node::list::clone() const{
std::vector<std::shared_ptr<object>> value;
value.reserve(value_.size());
for (auto item : value_)
value.push_back(item->clone());
return std::make_shared<list>(nullptr, value);
}
void cminus::node::list::print(logic::runtime &runtime) const{
auto is_first = true;
for (auto item : value_){
if (!is_first)
runtime.writer.write_scalar(', ');
else
is_first = false;
item->print(runtime);
}
}
std::shared_ptr<cminus::memory::reference> cminus::node::list::evaluate(logic::runtime &runtime) const{
std::shared_ptr<memory::reference> result;
for (auto item : value_)
result = item->evaluate(runtime);
return result;
}
const std::vector<std::shared_ptr<cminus::node::object>> &cminus::node::list::get_value() const{
return value_;
}
| 26.612245 | 103 | 0.697853 | benbraide |
557fc58ce0b623b4afaa2af211a1f90c521732bd | 1,924 | hpp | C++ | Sniper.hpp | dvirs12345/cpp-wargame2 | 084f93e124b723730d716379282bdd1bf394d3ea | [
"MIT"
] | null | null | null | Sniper.hpp | dvirs12345/cpp-wargame2 | 084f93e124b723730d716379282bdd1bf394d3ea | [
"MIT"
] | null | null | null | Sniper.hpp | dvirs12345/cpp-wargame2 | 084f93e124b723730d716379282bdd1bf394d3ea | [
"MIT"
] | null | null | null | // Author - Dvir Sadon
#include "Soldier.hpp"
#include "Board.hpp"
#define MAX_HEALTHS 100
#define DPAS 50
#pragma once
using namespace std;
namespace WarGame
{
class Sniper : public Soldier
{
public:
int dpa;
Sniper(){ this->hp = MAX_HEALTHS; this->dpa = DPAS; this->maxHP = MAX_HEALTHS; this->type = 2; }
Sniper(int player) { this->player = player; this->hp = MAX_HEALTHS; this->dpa = DPAS; this->maxHP = MAX_HEALTHS; this->type = 2; }
void MAction(std::vector<std::vector<Soldier*>> &board, std::pair<int,int> dest_location) override
{
auto close = strongest(board, board[dest_location.first][dest_location.second]->player, dest_location);
board[close.first][close.second]->hp = board[close.first][close.second]->hp - this->dpa; // Shoot!
if(board[close.first][close.second]->hp <= 0)
board[close.first][close.second] = nullptr;
}
private:
pair<int, int> strongest(std::vector<std::vector<Soldier*>> &board, int playernum, pair<int, int> loc1)
{
int max = 0;
int temp;
pair<int, int> sol;
for(int i= 0; i < board.size(); ++i)
{
for(int j = 0; j < board[0].size(); ++j)
{
if(board[i][j] != nullptr)
{
temp = board[i][j]->hp;
if(temp >= max && board[i][j]->player != playernum)
{
max = temp;
sol.first = i;
sol.second = j;
}
}
}
}
return sol;
}
};
} | 37 | 143 | 0.43815 | dvirs12345 |
55820b931ae22cd1c3a397d4abb4bb91b4f731c3 | 1,515 | cpp | C++ | src/utils/ComplexCalculator.cpp | nolasconapoleao/complex-library | cbf4ee14739a42a9f6880440ad37a1854cbad8f5 | [
"MIT"
] | null | null | null | src/utils/ComplexCalculator.cpp | nolasconapoleao/complex-library | cbf4ee14739a42a9f6880440ad37a1854cbad8f5 | [
"MIT"
] | 1 | 2020-02-19T21:12:21.000Z | 2020-02-19T21:12:21.000Z | src/utils/ComplexCalculator.cpp | nolasconapoleao/complex-library | cbf4ee14739a42a9f6880440ad37a1854cbad8f5 | [
"MIT"
] | null | null | null | #include "../complex/RectangularComplex.h"
#include "../complex/PolarComplex.h"
#include "ComplexConverter.cpp"
namespace complex {
inline RectangularComplex operator+(RectangularComplex rc1, RectangularComplex rc2) {
const double real = rc1.getReal() + rc2.getReal();
const double imaginary = rc1.getImaginary() + rc2.getImaginary();
return RectangularComplex(real, imaginary);
}
inline RectangularComplex operator+(RectangularComplex rc, PolarComplex pc) {
auto rc2 = toRectangular(pc);
const double real = rc.getReal() + rc2.getReal();
const double iamginary = rc.getImaginary() + rc2.getImaginary();
return RectangularComplex(real, iamginary);
}
inline PolarComplex operator+(PolarComplex pc1, PolarComplex pc2) {
auto rc1 = toRectangular(pc1);
auto rc2 = toRectangular(pc2);
const double real = rc1.getReal() + rc2.getReal();
const double iamginary = rc1.getImaginary() + rc2.getImaginary();
RectangularComplex resRec(real, iamginary);
PolarComplex resPol = toPolar(resRec);
return resPol;
}
inline PolarComplex operator+(PolarComplex pc, RectangularComplex rc) {
auto rc2 = toRectangular(pc);
const double real = rc.getReal() + rc2.getReal();
const double iamginary = rc.getImaginary() + rc2.getImaginary();
RectangularComplex resRec(real, iamginary);
PolarComplex resPol = toPolar(resRec);
return resPol;
}
};
| 37.875 | 89 | 0.671947 | nolasconapoleao |
5584b10f0ac21752110b8cf5c25a9075ec19cf44 | 23 | cpp | C++ | CudaTest/CudaTest.cpp | chenzhengxi/example | 07a8436e92ccab8e330d2a77e2cca23b8a540df3 | [
"MIT"
] | null | null | null | CudaTest/CudaTest.cpp | chenzhengxi/example | 07a8436e92ccab8e330d2a77e2cca23b8a540df3 | [
"MIT"
] | null | null | null | CudaTest/CudaTest.cpp | chenzhengxi/example | 07a8436e92ccab8e330d2a77e2cca23b8a540df3 | [
"MIT"
] | null | null | null | int CudaTest()
{
} | 5.75 | 14 | 0.478261 | chenzhengxi |
5587f0d801da097b18d89797e2ed364a87ec2c39 | 7,393 | cpp | C++ | ARM/ST/STM32L4xx/src/i2c_stm32l4xx.cpp | tmaltesen/IOsonata | 3ada9216305653670fccfca8fd53c6597ace8f12 | [
"MIT"
] | null | null | null | ARM/ST/STM32L4xx/src/i2c_stm32l4xx.cpp | tmaltesen/IOsonata | 3ada9216305653670fccfca8fd53c6597ace8f12 | [
"MIT"
] | null | null | null | ARM/ST/STM32L4xx/src/i2c_stm32l4xx.cpp | tmaltesen/IOsonata | 3ada9216305653670fccfca8fd53c6597ace8f12 | [
"MIT"
] | null | null | null | /**-------------------------------------------------------------------------
@file i2c_stm32l4xx.cpp
@brief I2C implementation on STM32L4xx series MCU
@author Hoang Nguyen Hoan
@date Sep. 5, 2019
@license
Copyright (c) 2019, I-SYST inc., all rights reserved
Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies, and none of the
names : I-SYST or its contributors may be used to endorse or
promote products derived from this software without specific prior written
permission.
For info or contributing contact : hnhoan at i-syst dot com
THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "stm32l4xx.h"
#include "istddef.h"
#include "coredev/i2c.h"
#include "iopinctrl.h"
#include "system_core_clock.h"
#include "idelay.h"
#include "diskio_flash.h"
#define STM32L4XX_I2C_MAXDEV 3
#pragma pack(push, 4)
typedef struct {
int DevNo;
I2CDEV *pI2cDev;
I2C_TypeDef *pReg;
} STM32L4XX_I2CDEV;
#pragma pack(pop)
static STM32L4XX_I2CDEV s_STM32L4xxI2CDev[STM32L4XX_I2C_MAXDEV] = {
{
0, NULL, .pReg = I2C1
},
{
1, NULL, .pReg = I2C2
},
{
2, NULL, .pReg = I2C3
},
};
static int STM32L4xxI2CGetRate(DEVINTRF * const pDev)
{
int rate = 0;
return rate;
}
// Set data rate in bits/sec (Hz)
// return actual rate
static int STM32L4xxI2CSetRate(DEVINTRF * const pDev, int DataRate)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev->pDevData;
uint32_t pclk = SystemPeriphClockGet();
uint32_t div = (pclk + (DataRate >> 1)) / DataRate;
return DataRate;
}
void STM32L4xxI2CDisable(DEVINTRF * const pDev)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev->pDevData;
int32_t timout = 100000;
}
static void STM32L4xxI2CEnable(DEVINTRF * const pDev)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev->pDevData;
}
static void STM32L4xxI2CPowerOff(DEVINTRF * const pDev)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev->pDevData;
}
// Initial receive
static bool STM32L4xxI2CStartRx(DEVINTRF * const pDev, int DevCs)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev->pDevData;
return true;
}
// Receive Data only, no Start/Stop condition
static int STM32L4xxI2CRxDataDma(DEVINTRF * const pDev, uint8_t *pBuff, int BuffLen)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
int cnt = 0;
return cnt;
}
// Receive Data only, no Start/Stop condition
static int STM32L4xxI2CRxData(DEVINTRF * const pDev, uint8_t *pBuff, int BuffLen)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
int cnt = 0;
uint16_t d = 0;
return cnt;
}
// Stop receive
static void STM32L4xxI2CStopRx(DEVINTRF * const pDev)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
}
// Initiate transmit
static bool STM32L4xxI2CStartTx(DEVINTRF * const pDev, int DevCs)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
return true;
}
// Transmit Data only, no Start/Stop condition
static int STM32L4xxI2CTxDataDma(DEVINTRF * const pDev, uint8_t *pData, int DataLen)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
int cnt = 0;
return cnt;
}
// Send Data only, no Start/Stop condition
static int STM32L4xxI2CTxData(DEVINTRF *pDev, uint8_t *pData, int DataLen)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV*)pDev->pDevData;
int cnt = 0;
uint16_t d;
return cnt;
}
// Stop transmit
static void STM32L4xxI2CStopTx(DEVINTRF * const pDev)
{
STM32L4XX_I2CDEV *dev = (STM32L4XX_I2CDEV *)pDev-> pDevData;
}
void I2CIrqHandler(int DevNo)
{
STM32L4XX_I2CDEV *dev = &s_STM32L4xxI2CDev[DevNo];
}
bool I2CInit(I2CDEV * const pDev, const I2CCFG *pCfgData)
{
I2C_TypeDef *reg;
uint32_t cr1reg = 0;
uint32_t tmp = 0;
bool retval = false;
if (pDev == NULL || pCfgData == NULL)
{
return false;
}
if (pCfgData->DevNo >= STM32L4XX_I2C_MAXDEV)
{
return false;
}
pDev->Mode = pCfgData->Mode;
s_STM32L4xxI2CDev[pCfgData->DevNo].pI2cDev = pDev;
pDev->DevIntrf.pDevData = (void*)&s_STM32L4xxI2CDev[pCfgData->DevNo];
// Configure I/O pins
memcpy(pDev->Pins, pCfgData->Pins, sizeof(pDev->Pins));
IOPinCfg(pCfgData->Pins, I2C_MAX_NB_IOPIN);
for (int i = 0; i < I2C_MAX_NB_IOPIN; i++)
{
IOPinSetSpeed(pCfgData->Pins[i].PortNo, pCfgData->Pins[i].PinNo, IOPINSPEED_TURBO);
}
// Get the correct register map
reg = s_STM32L4xxI2CDev[pCfgData->DevNo].pReg;
// Note : this function call will modify CR1 register
STM32L4xxI2CSetRate(&pDev->DevIntrf, pCfgData->Rate);
pDev->DevIntrf.Type = DEVINTRF_TYPE_SPI;
pDev->DevIntrf.Disable = STM32L4xxI2CDisable;
pDev->DevIntrf.Enable = STM32L4xxI2CEnable;
pDev->DevIntrf.GetRate = STM32L4xxI2CGetRate;
pDev->DevIntrf.SetRate = STM32L4xxI2CSetRate;
pDev->DevIntrf.StartRx = STM32L4xxI2CStartRx;
pDev->DevIntrf.RxData = STM32L4xxI2CRxData;
pDev->DevIntrf.StopRx = STM32L4xxI2CStopRx;
pDev->DevIntrf.StartTx = STM32L4xxI2CStartTx;
pDev->DevIntrf.TxData = STM32L4xxI2CTxData;
pDev->DevIntrf.StopTx = STM32L4xxI2CStopTx;
pDev->DevIntrf.IntPrio = pCfgData->IntPrio;
pDev->DevIntrf.EvtCB = pCfgData->EvtCB;
pDev->DevIntrf.MaxRetry = pCfgData->MaxRetry;
pDev->DevIntrf.bDma = pCfgData->bDmaEn;
pDev->DevIntrf.PowerOff = STM32L4xxI2CPowerOff;
pDev->DevIntrf.EnCnt = 1;
atomic_flag_clear(&pDev->DevIntrf.bBusy);
if (pCfgData->bIntEn && pCfgData->Mode == I2CMODE_SLAVE)
{
switch (pCfgData->DevNo)
{
case 0:
NVIC_ClearPendingIRQ(I2C1_EV_IRQn);
NVIC_SetPriority(I2C1_EV_IRQn, pCfgData->IntPrio);
NVIC_EnableIRQ(I2C1_EV_IRQn);
break;
case 1:
NVIC_ClearPendingIRQ(I2C2_EV_IRQn);
NVIC_SetPriority(I2C2_EV_IRQn, pCfgData->IntPrio);
NVIC_EnableIRQ(I2C2_EV_IRQn);
break;
case 2:
NVIC_ClearPendingIRQ(I2C3_EV_IRQn);
NVIC_SetPriority(I2C3_EV_IRQn, pCfgData->IntPrio);
NVIC_EnableIRQ(I2C3_EV_IRQn);
break;
}
}
return true;
}
void QSPIIrqHandler()
{
}
extern "C" void I2C1_EV_IRQHandler(void)
{
NVIC_ClearPendingIRQ(I2C1_EV_IRQn);
}
extern "C" void I2C1_ER_IRQHandler(void)
{
NVIC_ClearPendingIRQ(I2C1_ER_IRQn);
}
extern "C" void I2C2_EV_IRQHandler(void)
{
NVIC_ClearPendingIRQ(I2C2_EV_IRQn);
}
extern "C" void I2C2_ER_IRQHandler(void)
{
NVIC_ClearPendingIRQ(I2C2_ER_IRQn);
}
extern "C" void I2C3_EV_IRQHandler()
{
NVIC_ClearPendingIRQ(I2C3_EV_IRQn);
}
extern "C" void I2C3_ER_IRQHandler()
{
NVIC_ClearPendingIRQ(I2C3_ER_IRQn);
}
| 24.976351 | 85 | 0.710943 | tmaltesen |
558848098a7f26a6f3528ea53ac0c3411668a351 | 4,584 | cpp | C++ | srcs/cgi/Cgi.cpp | NeuggWebserv/webserv | 0b90c362239761f561a0db8b03da4c4586a44197 | [
"MIT"
] | null | null | null | srcs/cgi/Cgi.cpp | NeuggWebserv/webserv | 0b90c362239761f561a0db8b03da4c4586a44197 | [
"MIT"
] | 6 | 2021-04-17T10:28:23.000Z | 2021-05-02T09:51:32.000Z | srcs/cgi/Cgi.cpp | NeuggWebserv/webserv | 0b90c362239761f561a0db8b03da4c4586a44197 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Cgi.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: youlee <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/13 19:04:40 by youlee #+# #+# */
/* Updated: 2021/05/13 19:04:41 by youlee ### ########.fr */
/* */
/* ************************************************************************** */
#include "Cgi.hpp"
Cgi::Cgi(Request &request, ConfigRequest &config):body(request.get_body())
{
this->init_env(request, config);
}
Cgi::Cgi(Cgi const &src)
{
if (this != &src)
{
this->body = src.body;
this->env = src.env;
}
return ;
}
Cgi::~Cgi(void)
{
return ;
}
Cgi &Cgi::operator=(Cgi const &src)
{
if (this != &src)
{
this->body = src.body;
this->env = src.env;
}
return (*this);
}
void Cgi::init_env(Request &request, ConfigRequest &config)
{
std::map<std::string, std::string> headers = request.get_headers();
if (headers.find("Auth-Scheme") != headers.end() && headers["Auth-Scheme"] != "")
this->env["AUTH_TYPE"] = headers["Authorization"];
this->env["REDIRECT_STATUS"] = "200";
this->env["GATAWAY_INTERFACE"] = "CGI/1.1";
this->env["SCRIPT_NAME"] = config.get_path();
this->env["SCRIPT_FILENAME"] = config.get_path();
this->env["REQUEST_METHOD"] = request.get_method();
this->env["CONTENT_LENGTH"] = to_string(this->body.length());
this->env["CONTENT_TYPE"] = headers["Content-Type"];
this->env["PATH_INFO"] = request.get_path();
this->env["PATH_TRANSLATED"] = request.get_path();
this->env["QUERY_STRING"] = request.get_query();
this->env["REMOTEaddr"] = to_string(config.get_host_port().host);
this->env["REMOTE_IDENT"] = headers["Authorization"];
this->env["REMOTE_USER"] = headers["Authorization"];
this->env["REQUEST_URI"] = request.get_path() + request.get_query();
if (headers.find("Hostname") != headers.end())
this->env["SERVER_NAME"] = headers["Hostname"];
else
this->env["SERVER_NAME"] = this->env["REMOTEaddr"];
this->env["SERVER_PORT"] = to_string(config.get_host_port().port);
this->env["SERVER_PROTOCOL"] = "HTTP/1.1";
this->env["SERVER_SOFTWARE"] = "Weebserv/1.0";
this->env.insert(config.get_cgi_param().begin(), config.get_cgi_param().end());
}
char **Cgi::get_env_as_cstr_array() const
{
char **env = new char*[this->env.size() + 1];
int j = 0;
for (std::map<std::string, std::string>::const_iterator i = this->env.begin();i != this->env.end();i++)
{
std::string element = i->first + "=" + i->second;
env[j] = new char[element.size() + 1];
env[j] = strcpy(env[j], (const char*)element.c_str());
j++;
}
env[j] = NULL;
return (env);
}
std::string Cgi::execute_cgi(const std::string &script_name)
{
pid_t pid;
int save_stdin;
int save_stdout;
char **env;
std::string new_body;
try
{
env = this->get_env_as_cstr_array();
}
catch(const std::bad_alloc& e)
{
std::cerr << e.what() << std::endl;
}
save_stdin = dup(STDIN_FILENO);
save_stdout = dup(STDOUT_FILENO);
FILE *file_in = tmpfile();
FILE *file_out = tmpfile();
long fd_in = fileno(file_in);
long fd_out = fileno(file_out);
int ret = 1;
write(fd_in, body.c_str(), body.size());
lseek(fd_in, 0, SEEK_SET);
pid = fork();
if (pid == -1)
{
std::cerr << "Fork crashed." << std::endl;
return ("Status: 500\r\n\r\n");
}
else if (!pid)
{
char * const *nll = NULL;
dup2(fd_in, STDIN_FILENO);
dup2(fd_out, STDOUT_FILENO);
execve(script_name.c_str(), nll, env);
std::cerr<< "Execve crashed." << std::endl;
write(STDOUT_FILENO, "Status; 500\r\n\r\n", 15);
}
else
{
char buf[CGI_BUF_SIZE] = {0};
waitpid(-1, NULL, 0);
lseek(fd_out, 0, SEEK_SET);
ret = 1;
while (ret > 0)
{
memset(buf, 0, CGI_BUF_SIZE);
ret = read(fd_out, buf, CGI_BUF_SIZE - 1);
new_body += buf;
}
}
dup2(save_stdin,STDIN_FILENO);
dup2(save_stdout,STDOUT_FILENO);
fclose(file_in);
fclose(file_out);
close(fd_in);
close(fd_out);
close(save_stdout);
close(save_stdin);
for (size_t i = 0; env[i];i++)
delete[] env[i];
delete[] env;
if (!pid) exit(0);
return (new_body);
} | 27.95122 | 104 | 0.535558 | NeuggWebserv |
55947a783c75b740e572a4d65c9e6e913d77f08f | 373 | hpp | C++ | internal/states/common/helper/helper.hpp | YarikRevich/SyE | 3f73350f7e8fd9975e747c9c49667bbee278b594 | [
"MIT"
] | null | null | null | internal/states/common/helper/helper.hpp | YarikRevich/SyE | 3f73350f7e8fd9975e747c9c49667bbee278b594 | [
"MIT"
] | null | null | null | internal/states/common/helper/helper.hpp | YarikRevich/SyE | 3f73350f7e8fd9975e747c9c49667bbee278b594 | [
"MIT"
] | null | null | null | #pragma once
#include <map>
#include <vector>
#include "./../../../bufs/bufs.hpp"
namespace CommonStateHelper
{
extern std::map<int, bool> key_handlers;
extern std::vector<int> key_exceptions;
bool isKeyException(int ch);
void setKeyHandled(int ch);
bool isKeyHandled(int ch);
void resetKeysHandled();
bool isCommonKeyHandler(int ch);
}; | 16.954545 | 44 | 0.678284 | YarikRevich |
559dca1edb60826065bdd054d771fac58ae39db4 | 10,655 | cpp | C++ | src/core/Identifier.cpp | grealish/opentxs | 614999063079f5843428abcaa62974f5f19f88a1 | [
"Apache-2.0"
] | 1 | 2015-11-05T12:09:37.000Z | 2015-11-05T12:09:37.000Z | src/core/Identifier.cpp | grealish/opentxs | 614999063079f5843428abcaa62974f5f19f88a1 | [
"Apache-2.0"
] | null | null | null | src/core/Identifier.cpp | grealish/opentxs | 614999063079f5843428abcaa62974f5f19f88a1 | [
"Apache-2.0"
] | null | null | null | /************************************************************
*
* OTIdentifier.cpp
*
*/
/************************************************************
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
* OPEN TRANSACTIONS
*
* Financial Cryptography and Digital Cash
* Library, Protocol, API, Server, CLI, GUI
*
* -- Anonymous Numbered Accounts.
* -- Untraceable Digital Cash.
* -- Triple-Signed Receipts.
* -- Cheques, Vouchers, Transfers, Inboxes.
* -- Basket Currencies, Markets, Payment Plans.
* -- Signed, XML, Ricardian-style Contracts.
* -- Scripted smart contracts.
*
* Copyright (C) 2010-2013 by "Fellow Traveler" (A pseudonym)
*
* EMAIL:
* [email protected]
*
* BITCOIN: 1NtTPVVjDsUfDWybS4BwvHpG2pdS9RnYyQ
*
* KEY FINGERPRINT (PGP Key in license file):
* 9DD5 90EB 9292 4B48 0484 7910 0308 00ED F951 BB8E
*
* OFFICIAL PROJECT WIKI(s):
* https://github.com/FellowTraveler/Moneychanger
* https://github.com/FellowTraveler/Open-Transactions/wiki
*
* WEBSITE:
* http://www.OpenTransactions.org/
*
* Components and licensing:
* -- Moneychanger..A Java client GUI.....LICENSE:.....GPLv3
* -- otlib.........A class library.......LICENSE:...LAGPLv3
* -- otapi.........A client API..........LICENSE:...LAGPLv3
* -- opentxs/ot....Command-line client...LICENSE:...LAGPLv3
* -- otserver......Server Application....LICENSE:....AGPLv3
* Github.com/FellowTraveler/Open-Transactions/wiki/Components
*
* All of the above OT components were designed and written by
* Fellow Traveler, with the exception of Moneychanger, which
* was contracted out to Vicky C ([email protected]).
* The open-source community has since actively contributed.
*
* -----------------------------------------------------
*
* LICENSE:
* This program is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* ADDITIONAL PERMISSION under the GNU Affero GPL version 3
* section 7: (This paragraph applies only to the LAGPLv3
* components listed above.) If you modify this Program, or
* any covered work, by linking or combining it with other
* code, such other code is not for that reason alone subject
* to any of the requirements of the GNU Affero GPL version 3.
* (==> This means if you are only using the OT API, then you
* don't have to open-source your code--only your changes to
* Open-Transactions itself must be open source. Similar to
* LGPLv3, except it applies to software-as-a-service, not
* just to distributing binaries.)
*
* Extra WAIVER for OpenSSL, Lucre, and all other libraries
* used by Open Transactions: This program is released under
* the AGPL with the additional exemption that compiling,
* linking, and/or using OpenSSL is allowed. The same is true
* for any other open source libraries included in this
* project: complete waiver from the AGPL is hereby granted to
* compile, link, and/or use them with Open-Transactions,
* according to their own terms, as long as the rest of the
* Open-Transactions terms remain respected, with regard to
* the Open-Transactions code itself.
*
* Lucre License:
* This code is also "dual-license", meaning that Ben Lau-
* rie's license must also be included and respected, since
* the code for Lucre is also included with Open Transactions.
* See Open-Transactions/src/otlib/lucre/LUCRE_LICENSE.txt
* The Laurie requirements are light, but if there is any
* problem with his license, simply remove the Lucre code.
* Although there are no other blind token algorithms in Open
* Transactions (yet. credlib is coming), the other functions
* will continue to operate.
* See Lucre on Github: https://github.com/benlaurie/lucre
* -----------------------------------------------------
* You should have received a copy of the GNU Affero General
* Public License along with this program. If not, see:
* http://www.gnu.org/licenses/
*
* If you would like to use this software outside of the free
* software license, please contact FellowTraveler.
* (Unfortunately many will run anonymously and untraceably,
* so who could really stop them?)
*
* DISCLAIMER:
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Affero General Public License for
* more details.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iQIcBAEBAgAGBQJRSsfJAAoJEAMIAO35UbuOQT8P/RJbka8etf7wbxdHQNAY+2cC
vDf8J3X8VI+pwMqv6wgTVy17venMZJa4I4ikXD/MRyWV1XbTG0mBXk/7AZk7Rexk
KTvL/U1kWiez6+8XXLye+k2JNM6v7eej8xMrqEcO0ZArh/DsLoIn1y8p8qjBI7+m
aE7lhstDiD0z8mwRRLKFLN2IH5rAFaZZUvj5ERJaoYUKdn4c+RcQVei2YOl4T0FU
LWND3YLoH8naqJXkaOKEN4UfJINCwxhe5Ke9wyfLWLUO7NamRkWD2T7CJ0xocnD1
sjAzlVGNgaFDRflfIF4QhBx1Ddl6wwhJfw+d08bjqblSq8aXDkmFA7HeunSFKkdn
oIEOEgyj+veuOMRJC5pnBJ9vV+7qRdDKQWaCKotynt4sWJDGQ9kWGWm74SsNaduN
TPMyr9kNmGsfR69Q2Zq/FLcLX/j8ESxU+HYUB4vaARw2xEOu2xwDDv6jt0j3Vqsg
x7rWv4S/Eh18FDNDkVRChiNoOIilLYLL6c38uMf1pnItBuxP3uhgY6COm59kVaRh
nyGTYCDYD2TK+fI9o89F1297uDCwEJ62U0Q7iTDp5QuXCoxkPfv8/kX6lS6T3y9G
M9mqIoLbIQ1EDntFv7/t6fUTS2+46uCrdZWbQ5RjYXdrzjij02nDmJAm2BngnZvd
kamH0Y/n11lCvo1oQxM+
=uSzz
-----END PGP SIGNATURE-----
**************************************************************/
#include <opentxs/core/stdafx.hpp>
#include <opentxs/core/Identifier.hpp>
#include <opentxs/core/Contract.hpp>
#include <opentxs/core/crypto/OTCachedKey.hpp>
#include <opentxs/core/crypto/OTCrypto.hpp>
#include <opentxs/core/Nym.hpp>
#include <opentxs/core/crypto/OTSymmetricKey.hpp>
#include <bitcoin-base58/hash.h>
#include <cstring>
#include <iostream>
namespace opentxs
{
Identifier::Identifier()
: OTData()
{
}
Identifier::Identifier(const Identifier& theID)
: OTData(theID)
{
}
Identifier::Identifier(const char* szStr)
: OTData()
{
OT_ASSERT(nullptr != szStr);
SetString(szStr);
}
Identifier::Identifier(const std::string& theStr)
: OTData()
{
OT_ASSERT(!theStr.empty());
SetString(theStr.c_str());
}
Identifier::Identifier(const String& theStr)
: OTData()
{
SetString(theStr);
}
Identifier::Identifier(const Contract& theContract)
: OTData() // Get the contract's ID into this identifier.
{
(const_cast<Contract&>(theContract)).GetIdentifier(*this);
}
Identifier::Identifier(const Nym& theNym)
: OTData() // Get the Nym's ID into this identifier.
{
(const_cast<Nym&>(theNym)).GetIdentifier(*this);
}
Identifier::Identifier(const OTSymmetricKey& theKey)
: OTData() // Get the Symmetric Key's ID into *this. (It's a hash of the
// encrypted form of the symmetric key.)
{
(const_cast<OTSymmetricKey&>(theKey)).GetIdentifier(*this);
}
Identifier::Identifier(const OTCachedKey& theKey)
: OTData() // Cached Key stores a symmetric key inside, so this actually
// captures the ID for that symmetrickey.
{
const bool bSuccess =
(const_cast<OTCachedKey&>(theKey)).GetIdentifier(*this);
OT_ASSERT(bSuccess); // should never fail. If it does, then we are calling
// this function at a time we shouldn't, when we aren't
// sure the master key has even been generated yet. (If
// this asserts, need to examine the line of code that
// tried to do this, and figure out where its logic
// went wrong, since it should have made sure this
// would not happen, before constructing like this.)
}
void Identifier::SetString(const char* szString)
{
OT_ASSERT(nullptr != szString);
const String theStr(szString);
SetString(theStr);
}
bool Identifier::operator==(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return ots1.Compare(ots2);
}
bool Identifier::operator!=(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return !(ots1.Compare(ots2));
}
bool Identifier::operator>(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return ots1.operator>(ots2);
}
bool Identifier::operator<(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return ots1.operator<(ots2);
}
bool Identifier::operator<=(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return ots1.operator<=(ots2);
}
bool Identifier::operator>=(const Identifier& s2) const
{
const String ots1(*this), ots2(s2);
return ots1.operator>=(ots2);
}
Identifier::~Identifier()
{
}
// When calling SignContract or VerifySignature with "HASH256" as the hash type,
// the signature will use (sha256 . sha256) as a message digest.
// In this case, SignContractDefaultHash and VerifyContractDefaultHash are used,
// which resort to low level calls to accomplish non standard message digests.
// Otherwise, it will use whatever OpenSSL provides by that name (see
// GetOpenSSLDigestByName).
const String Identifier::DefaultHashAlgorithm("HASH256");
// This method implements the (ripemd160 . sha256) hash,
// so the result is 20 bytes long.
bool Identifier::CalculateDigest(const unsigned char* data, size_t len)
{
// The Hash160 function comes from the Bitcoin reference client, where
// it is implemented as RIPEMD160 ( SHA256 ( x ) ) => 20 byte hash
auto hash160 = Hash160(data, data + len);
SetSize(20);
memcpy(const_cast<void*>(GetPointer()), hash160, 20);
return true;
}
bool Identifier::CalculateDigest(const String& strInput)
{
return CalculateDigest(
reinterpret_cast<const unsigned char*>(strInput.Get()),
static_cast<size_t>(strInput.GetLength()));
}
bool Identifier::CalculateDigest(const OTData& dataInput)
{
auto dataPtr = static_cast<const unsigned char*>(dataInput.GetPointer());
return CalculateDigest(dataPtr, dataInput.GetSize());
}
// SET (binary id) FROM ENCODED STRING
//
void Identifier::SetString(const String& theStr)
{
OTCrypto::It()->SetIDFromEncoded(theStr, *this);
}
// This Identifier is stored in binary form.
// But what if you want a pretty string version of it?
// Just call this function.
//
void Identifier::GetString(String& theStr) const
{
OTCrypto::It()->EncodeID(*this, theStr); // *this input, theStr output.
}
} // namespace opentxs
| 34.370968 | 80 | 0.687565 | grealish |
55a1403817ca4bce43b4cc7f9a766496af14f577 | 12,986 | cpp | C++ | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 32 | 2015-09-02T22:56:22.000Z | 2021-02-24T17:15:50.000Z | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 30 | 2015-04-26T18:35:07.000Z | 2021-06-06T09:57:02.000Z | beelzebub/src/tests/bigint.cpp | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 11 | 2015-09-03T20:47:41.000Z | 2021-06-25T17:00:01.000Z | /*
Copyright (c) 2016 Alexandru-Mihai Maftei. All rights reserved.
Developed by: Alexandru-Mihai Maftei
aka Vercas
http://vercas.com | https://github.com/vercas/Beelzebub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal with the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of Alexandru-Mihai Maftei, Vercas, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
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
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
WITH THE SOFTWARE.
---
You may also find the text of this license in "LICENSE.md", along with a more
thorough explanation regarding other files.
*/
#ifdef __BEELZEBUB__TEST_BIGINT
#include <beel/utils/bigint.hpp>
#include <math.h>
#include <debug.hpp>
using namespace Beelzebub;
using namespace Beelzebub::Utils;
typedef BigUInt<15> BIT;
void TestBigInt()
{
BIT a = 5ULL, b = 55ULL, c;
c = a + b;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 60U, c.Data[0]);
ASSERT_EQ("%u4", 0U, c.Data[1]);
c += b;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 115U, c.Data[0]);
ASSERT_EQ("%u4", 0U, c.Data[1]);
BIT d = 0xFFFFFFFAULL;
c += d;
ASSERT_EQ("%u4", 2U, c.CurrentSize);
ASSERT_EQ("%u4", 0x6DU, c.Data[0]);
ASSERT_EQ("%u4", 1U, c.Data[1]);
BIT e = 0xFFFFFFFFFFFFFFFFULL;
c += e;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0x6CU, c.Data[0]);
ASSERT_EQ("%u4", 1U, c.Data[1]);
ASSERT_EQ("%u4", 1U, c.Data[2]);
c += c;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD8U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 2U, c.Data[2]);
c -= a;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD3U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 2U, c.Data[2]);
b -= a;
ASSERT_EQ("%u4", 2U, b.CurrentSize);
ASSERT_EQ("%u4", 50U, b.Data[0]);
ASSERT_EQ("%u4", 0U, b.Data[1]);
c -= e;
ASSERT_EQ("%u4", 3U, c.CurrentSize);
ASSERT_EQ("%u4", 0xD4U, c.Data[0]);
ASSERT_EQ("%u4", 2U, c.Data[1]);
ASSERT_EQ("%u4", 1U, c.Data[2]);
d = a * b;
ASSERT_EQ("%u4", 4U, d.CurrentSize);
ASSERT_EQ("%u4", 250U, d.Data[0]);
ASSERT_EQ("%u4", 0U, d.Data[1]);
ASSERT_EQ("%u4", 0U, d.Data[2]);
ASSERT_EQ("%u4", 0U, d.Data[3]);
d.Data[2] = 3;
BIT f = c, g = c * d;
ASSERT_EQ("%u4", 7U, g.CurrentSize);
ASSERT_EQ("%u4", 53000U, g.Data[0]);
ASSERT_EQ("%u4", 500U, g.Data[1]);
ASSERT_EQ("%u4", 886U, g.Data[2]);
ASSERT_EQ("%u4", 6U, g.Data[3]);
ASSERT_EQ("%u4", 3U, g.Data[4]);
ASSERT_EQ("%u4", 0U, g.Data[5]);
ASSERT_EQ("%u4", 0U, g.Data[6]);
c *= d;
ASSERT_EQ("%u4", 53000U, f.Data[0] * d.Data[0]);
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%u4", 53000U, c.Data[0]);
ASSERT_EQ("%u4", 500U, c.Data[1]);
ASSERT_EQ("%u4", 886U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 3U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
// Now overflow propagation.
ASSERT_EQ("%u4", 2U, e.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[1]);
f = e * e;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
e *= e;
ASSERT_EQ("%u4", 4U, e.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, e.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, e.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, e.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[3]);
e += b;
ASSERT_EQ("%u4", 4U, e.CurrentSize);
ASSERT_EQ("%X4", 0x00000033U, e.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, e.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, e.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, e.Data[3]);
f = e - b;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000001U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
c += f;
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%u4", 53001U, c.Data[0]);
ASSERT_EQ("%u4", 500U, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
BIT h = 0xFFFFFFFFFFFFFFFFULL;
f = f + h;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
f += h;
ASSERT_EQ("%u4", 4U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
f += h;
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFEU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[3]);
ASSERT_EQ("%X4", 0x00000001U, f.Data[4]);
f = f - h;
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f = f | h; // Should basically remain unchanged.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f |= h; // And again.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f &= h; // Mostly changed.
ASSERT_EQ("%u4", 5U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[3]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[4]);
f = f & h; // And a size reduction.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
f ^= h; // Nulling out.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, f.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, f.Data[1]);
f = f ^ h; // And restoring.
ASSERT_EQ("%u4", 2U, f.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, f.Data[1]);
c = c ^ f; // Funky.
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%X4", 0xFFFF30F6U, c.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFE0BU, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
c |= f; // Less funky.
ASSERT_EQ("%u4", 7U, c.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, c.Data[0]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, c.Data[1]);
ASSERT_EQ("%u4", 884U, c.Data[2]);
ASSERT_EQ("%u4", 6U, c.Data[3]);
ASSERT_EQ("%u4", 4U, c.Data[4]);
ASSERT_EQ("%u4", 0U, c.Data[5]);
ASSERT_EQ("%u4", 0U, c.Data[6]);
BIT i = ~c;
ASSERT_EQ("%u4", 7U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFFFFF9U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFFFBU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
i <<= 36;
ASSERT_EQ("%u4", 9U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFFC8B0U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFF9FU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFBFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[7]);
ASSERT_EQ("%X4", 0x0000000FU, i.Data[8]);
i = i << 4;
ASSERT_EQ("%u4", 9U, i.CurrentSize);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[2]);
ASSERT_EQ("%X4", 0xFFFC8B00U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFF9FFU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFBFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[7]);
ASSERT_EQ("%X4", 0x000000FFU, i.Data[8]);
i = i >> 36;
ASSERT_EQ("%u4", 8U, i.CurrentSize);
ASSERT_EQ("%X4", 0x0000000FU, i.Data[7]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFBFU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFF9FU, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFC8B0U, i.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
i >>= 4;
ASSERT_EQ("%u4", 7U, i.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[6]);
ASSERT_EQ("%X4", 0xFFFFFFFFU, i.Data[5]);
ASSERT_EQ("%X4", 0xFFFFFFFBU, i.Data[4]);
ASSERT_EQ("%X4", 0xFFFFFFF9U, i.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, i.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, i.Data[0]);
BIT j = i[4];
ASSERT_EQ("%u4", 4U, j.CurrentSize);
ASSERT_EQ("%X4", 0xFFFFFFF9U, j.Data[3]);
ASSERT_EQ("%X4", 0xFFFFFC8BU, j.Data[2]);
ASSERT_EQ("%X4", 0x00000000U, j.Data[1]);
ASSERT_EQ("%X4", 0x00000000U, j.Data[0]);
BIT k = 0xFFFFFFF9FFFFFC8BU, l = j >> 999, m = 0U;
ASSERTX( k == (j >> 64) , "Expected equality." )XEND;
ASSERTX(!(k == (j >> 63)), "Expected inequality.")XEND;
ASSERTX( k != (j >> 63) , "Expected inequality.")XEND;
ASSERT_EQ("%u4", 0U, l.CurrentSize);
ASSERT_EQ("%u4", 2U, m.CurrentSize);
ASSERTX(m == 0U)XEND;
// , "Expected equality [%X4:%X4:%X4:%X4]."
// , m.Data[3], m.Data[2], m.Data[1], m.Data[0]);
ASSERTX(l == m)XEND;
// , "Expected equality [%u4 %X4:%X4:%X4:%X4] vs [%u4 %X4:%X4:%X4:%X4].%n%i4%n"
// , l.CurrentSize, l.Data[3], l.Data[2], l.Data[1], l.Data[0]
// , m.CurrentSize, m.Data[3], m.Data[2], m.Data[1], m.Data[0]
// , BigIntCmp(&(l.Data[0]), l.CurrentSize, &(m.Data[0]), m.CurrentSize));
ASSERTX(l == 0U)XEND;
// , "Expected equality [%X4:%X4:%X4:%X4]."
// , l.Data[3], l.Data[2], l.Data[1], l.Data[0]);
ASSERTX(i > j)XEND; ASSERTX(i >= j)XEND;
ASSERTX(j < i)XEND; ASSERTX(j <= i)XEND;
ASSERTX(i > k)XEND; ASSERTX(i >= k)XEND;
ASSERTX(j > k)XEND; ASSERTX(j >= k)XEND;
}
#endif
| 32.710327 | 87 | 0.569844 | vercas |
55a1b52862820322526616c3d1d946a6fd97b712 | 7,104 | cpp | C++ | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | 3 | 2015-12-21T09:04:49.000Z | 2015-12-21T19:22:47.000Z | framework/src/App/main.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | #include <iostream>
#include <unistd.h>
#include "../../../dist/cppframework.hh"
static void tcpServer(fwk::System* system, uint16_t port) {
int i = 0;
try {
fwk::TcpServer& server = fwk::NetworkManager::get().getTCP().createServer(port);
server.events.onAccept.subscribe([] (fwk::TcpSocketStream*) {
INFO("New client connected");
}, &i);
server.events.onReceivedData.subscribe([] (fwk::TcpSocketStream*) {
INFO("Received data");
}, &i);
server.events.onClientClosed.subscribe([] (fwk::TcpSocketStream*) {
INFO("Client closed");
}, &i);
server.events.onClosed.subscribe([] (fwk::TcpSocket*) {
INFO("Server closed");
}, &i);
fwk::NetworkManager::get().getTCP().run(server);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void tcpClient(fwk::System* system, const std::string& hostname, uint16_t port) {
try {
int i = 0;
fwk::TcpClient& client = fwk::NetworkManager::get().getTCP().createClient(hostname, port);
client.events.onReceivedData.subscribe([] (fwk::TcpSocketStream*) {
INFO("Received data");
}, &i);
client.events.onClosed.subscribe([] (fwk::TcpSocketStream*) {
INFO("Connection closed");
}, &i);
fwk::NetworkManager::get().getTCP().run(client);
fwk::NetworkManager::get().getTCP().push(client.socket, (void*)"Hello\n", 6);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void udpServer(fwk::System* system, uint16_t port) {
int i = 0;
try {
fwk::UdpServer& server = fwk::NetworkManager::get().getUDP().createServer(port);
// on accept new socket callback
server.events.onNewClient.subscribe([] (fwk::UdpSocketClient*) {
INFO("New client connected");
}, &i);
// on received data callback
server.events.onReceivedData.subscribe([] (fwk::UdpSocketClient*) {
INFO("Received data");
}, &i);
// on client closed callback
server.events.onClientClosed.subscribe([] (fwk::UdpSocketClient*) {
INFO("Client closed");
}, &i);
// on server closed callback
server.events.onClosed.subscribe([] (fwk::UdpSocketServer*) {
INFO("Server closed");
}, &i);
fwk::NetworkManager::get().getUDP().run(server);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void udpClient(fwk::System* system, const std::string& hostname, uint16_t port) {
try {
int i = 0;
fwk::UdpClient& client = fwk::NetworkManager::get().getUDP().createClient(hostname, port);
client.events.onReceivedData.subscribe([] (fwk::UdpSocketStream*) {
INFO("Received data");
}, &i);
client.events.onClosed.subscribe([] (fwk::UdpSocketStream*) {
INFO("Connection closed");
}, &i);
fwk::NetworkManager::get().getUDP().run(client);
fwk::NetworkManager::get().getUDP().push(client.socket, (void*)"Hello", 5);
system->run();
} catch (const fwk::CoreException& e) {
CRITICAL(e.what());
}
}
static void http(fwk::System* system) {
fwk::HttpRequest* request;
fwk::HttpConnection* connection = fwk::HttpClient::get().initConnection(
"jsonplaceholder.typicode.com",
80,
fwk::HttpProtocol::HTTP,
true);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} {} / Size: {}", response->status, response->reason, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
request = fwk::HttpRequest::getFromPool();
request->init();
request->method = "GET";
request->url = "/posts";
request->success = [] (const fwk::HttpResponse* response) -> void {
INFO(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
request->error = [] (const fwk::HttpResponse* response) -> void {
WARNING(fmt::format("Response: {} / Size: {}", response->status, response->body->getSize()));
};
fwk::HttpClient::get().sendRequest(connection, request);
connection->run();
system->run();
}
int main(int ac, char ** av) {
if ((ac != 2 && ac != 3 && ac != 4) || (std::string(av[1]) != "http" && std::string(av[1]) != "tcp" && std::string(av[1]) != "udp" && std::string(av[1]) != "delayed" && std::string(av[1]) != "periodic" && std::string(av[1]) != "simple")) {
std::cerr << "usage: " << av[0] << " \"http\"|\"tcp\"|\"udp\" HOSTNAME PORT || " << av[0] << " PORT" << std::endl;
return -1;
}
fwk::LoggerManager::get().init("cppframework", fwk::Logger::Level::DEBUG);
fwk::System* system = new fwk::System();
fwk::Signal::get().setCallback(fwk::Signal::Type::INT, [&] (void) -> bool {
INFO("Caught SIGINT, exiting.");
system->end();
return false;
});
std::string protocol = av[1];
if (protocol == "udp") {
system->initUDP();
if (ac == 3) {
// udp server
udpServer(system, StringToUInt16(av[2]));
} else if (ac == 4) {
// udp client
udpClient(system, av[2], StringToUInt16(av[3]));
} else {
std::cerr << "invalid nb of arguments" << std::endl;
}
} else if (protocol == "tcp") {
system->initTCP();
if (ac == 3) {
// tcp server
tcpServer(system, StringToUInt16(av[2]));
} else if (ac == 4) {
// tcp client
tcpClient(system, av[2], StringToUInt16(av[3]));
} else {
std::cerr << "invalid nb of arguments" << std::endl;
}
} else if (protocol == "http") {
system->initHTTP("test useragent");
http(system);
} else if (protocol == "delayed") {
system->initWorkerThreads(1, true);
fwk::WorkerManager::get().addDelayedTask(fwk::SimpleTask::getFromPool([] (void) {
INFO("SimpleTask working");
}), std::chrono::seconds(2));
system->run();
} else if (protocol == "periodic") {
system->initWorkerThreads(1, true);
fwk::WorkerManager::get().addPeriodicTask([] (void) {
INFO("Hello");
}, nullptr, std::chrono::seconds(5), true);
system->run();
} else if (protocol == "simple") {
fwk::WorkerManager::get().addSimpleTask([] (void) {
INFO("SimpleTask :)");
});
system->run();
} else {
std::cerr << "unknown protocol" << std::endl;
}
delete system;
return 0;
}
| 29.974684 | 241 | 0.603322 | gautier-lefebvre |
55a86c5cf49b250d2aec738c971545b6158131cf | 2,454 | cpp | C++ | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | CS2/DanielPinedoCS2Assignment3/DanielPinedoCS2Assignment3/FractionList.cpp | odenipinedo/cpp | 74a7c00e60bfd68e0004013ee05f1fa294056395 | [
"Unlicense"
] | null | null | null | /*
Name: Daniel Pinedo
Class: CS 2
Assignment #: 3
All Compilers Used: VS17
Operating Systems on Which Compiled: Win10
Date and Time of Last successful run: 10/4/2017 @0345
Email: [email protected]
*/
#include "FractionList.h"
FractionList::FractionList() : num_elements(0), isSorted(false)
{
}
void FractionList::addFraction(const Fraction & F)
{
if (num_elements == MAX) {
cout << "List is full." << endl;
return;
}
List[num_elements] = F;
num_elements++;
}
const string FractionList::toString() const
{
string temp = "";
for (size_t i = 0; i < num_elements; i++) {
temp += List[i].toString();
}
return temp;
}
void FractionList::sort()
{
for (size_t i = 0; i < num_elements; i++) {
for (size_t j = 0; j < num_elements - 1 - i; j++) {
if (List[j].toDouble() > List[j + 1].toDouble()) {
Fraction temp = List[j];
List[j] = List[j + 1];
List[j + 1] = temp;
}
}
}
isSorted = true;
}
bool FractionList::isEmpty() const
{
return (num_elements == 0);
}
bool FractionList::isFull() const
{
return (num_elements == MAX);
}
size_t FractionList::getNumberOfElements() const
{
return num_elements;
}
istream & operator >> (istream & in, FractionList & FL)
{
FractionList::getInstance(FL, in);
return in;
}
ostream & operator << (ostream & out, FractionList & FL)
{
for (size_t i = 0; i < FL.num_elements; i++) {
out << FL.List[i];
}
return out;
}
void FractionList::getInstance(FractionList & FL, istream & in = cin)
{
if (&in == &cin) {
bool done = false;
while (!done && (FL.num_elements < FractionList::MAX)) {
Fraction temp(0);
cin.ignore(20, '\n');
cin >> temp;
FL.addFraction(temp);
cout << "More fractions? Enter 0 to continue or 1 to stop: ";
cin >> done;
}
}
else {
while ((in.peek() != EOF) && (FL.num_elements < FractionList::MAX)) {
Fraction temp(0);
in >> temp;
FL.addFraction(temp);
}
}
}
const Fraction FractionList::getLargest()
{
if (isSorted) {
return List[num_elements - 1];
}
else {
sort();
return List[num_elements - 1];
}
}
const Fraction FractionList::getSumOfFractions()
{
Fraction temp(0);
for (size_t i = 0; i < num_elements; i++) {
temp = temp + List[i];
}
return temp;
}
bool FractionList::getSortState() const
{
return isSorted;
}
Fraction FractionList::operator [] (size_t index) const
{
if (index < num_elements) {
return List[index];
}
throw "Out of bounds array at index";
}
FractionList::~FractionList()
{
}
| 18.313433 | 71 | 0.635697 | odenipinedo |
55b3cd6b93a7279163db4755860b4a680cb50e44 | 2,568 | cpp | C++ | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 327 | 2015-01-02T19:25:13.000Z | 2022-03-07T21:25:48.000Z | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 13 | 2015-01-14T23:35:43.000Z | 2016-02-07T16:13:18.000Z | external/mintomic/tests/template.test_bitarray.cpp | ehei1/orbit | f990a7f9abb7d330e93d0d20018a62869890f04e | [
"BSD-2-Clause"
] | 72 | 2015-01-01T11:11:23.000Z | 2021-12-28T06:52:10.000Z | #include <mintomic/mintomic.h>
#include <mintpack/random.h>
#include <mintpack/timewaster.h>
#include <mintpack/threadsynchronizer.h>
#include <assert.h>
#include <string.h>
#define ELEMENT(index) ((index) >> ${TEST_INT_BITSHIFT})
#define BIT(index) ((uint${TEST_INT_BITSIZE}_t) 1 << ((index) & (${TEST_INT_BITSIZE} - 1)))
static int g_success;
static const int kDataBitSize = ${TEST_DATA_SIZE};
static mint_atomic${TEST_INT_BITSIZE}_t* g_data;
static int* g_indices;
static int g_numThreads;
static void threadFunc(int threadNum)
{
// Decide upon index range and number of times to iterate
int lo = kDataBitSize * threadNum / g_numThreads;
int hi = kDataBitSize * (threadNum + 1) / g_numThreads;
int times = 10000000 / kDataBitSize;
TimeWaster tw(threadNum);
for (int i = 0; i < times; i++)
{
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
mint_fetch_or_${TEST_INT_BITSIZE}_relaxed(&g_data[ELEMENT(index)], BIT(index));
tw.wasteRandomCycles();
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
if ((g_data[ELEMENT(index)]._nonatomic & BIT(index)) == 0)
g_success = 0;
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
mint_fetch_and_${TEST_INT_BITSIZE}_relaxed(&g_data[ELEMENT(index)], ~BIT(index));
tw.wasteRandomCycles();
}
for (int j = lo; j < hi; j++)
{
int index = g_indices[j];
if ((g_data[ELEMENT(index)]._nonatomic & BIT(index)) != 0)
g_success = 0;
}
}
}
bool ${TEST_FUNC}(int numThreads)
{
g_success = 1;
g_numThreads = numThreads;
// Create bit array and clear it
assert((kDataBitSize & 63) == 0);
g_data = new mint_atomic${TEST_INT_BITSIZE}_t[kDataBitSize / ${TEST_INT_BITSIZE}];
memset(g_data, 0, kDataBitSize / 8);
// Create index array
g_indices = new int[kDataBitSize];
for (int i = 0; i < kDataBitSize; i++)
g_indices[i] = i;
// Shuffle the index array
Random random;
for (int i = 0; i < kDataBitSize; i++)
{
int swap = random.generate32() % (kDataBitSize - i);
int temp = g_indices[i];
g_indices[i] = g_indices[swap];
g_indices[swap] = temp;
}
// Launch threads
ThreadSynchronizer threads(numThreads);
threads.run(threadFunc);
// Clean up
delete[] g_data;
delete[] g_indices;
return g_success != 0;
}
| 28.21978 | 93 | 0.589564 | ehei1 |
55bbc358cefbdfda93859d14d6f84cacb949dc08 | 4,865 | cpp | C++ | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | null | null | null | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | null | null | null | src/number/ratio.cpp | peelonet/peelo-cpp | 8b1923f25175497cf46478c9ab5e9fbab365b6d6 | [
"BSD-2-Clause"
] | 1 | 2018-10-06T05:02:45.000Z | 2018-10-06T05:02:45.000Z | /*
* Copyright (c) 2014, peelo.net
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <peelo/number/ratio.hpp>
namespace peelo
{
static inline int64_t gcd(int64_t a, int64_t b)
{
return b == 0 ? a : gcd(b, a % b);
}
ratio::ratio()
: m_numerator(0)
, m_denominator(0) {}
ratio::ratio(const ratio& that)
: m_numerator(that.m_numerator)
, m_denominator(that.m_denominator) {}
ratio::ratio(int64_t numerator, int64_t denominator)
throw(std::domain_error)
: m_numerator(0)
, m_denominator(0)
{
if (denominator == 0)
{
throw std::domain_error("division by zero");
}
const int64_t g = gcd(numerator, denominator);
m_numerator = numerator / g;
m_denominator = denominator / g;
}
ratio& ratio::assign(const ratio& that)
{
m_numerator = that.m_numerator;
m_denominator = that.m_denominator;
return *this;
}
bool ratio::equals(const ratio& that) const
{
return m_numerator == that.m_numerator
&& m_denominator == that.m_denominator;
}
int ratio::compare(const ratio& that) const
{
const int64_t a = m_numerator * that.m_numerator;
const int64_t b = m_denominator * that.m_denominator;
return a < b ? -1 : a > b ? 1 : 0;
}
ratio ratio::operator-() const
{
return ratio(-m_numerator, m_denominator);
}
ratio ratio::operator+(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator + m_denominator * that.m_denominator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator+(int64_t n) const
{
return operator+(ratio(n));
}
ratio ratio::operator-(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator - m_denominator * that.m_denominator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator-(int64_t n) const
{
return operator-(ratio(n));
}
ratio ratio::operator*(const ratio& that) const
{
return ratio(
m_numerator * that.m_numerator,
m_denominator * that.m_denominator
);
}
ratio ratio::operator*(int64_t n) const
{
return operator*(ratio(n));
}
ratio ratio::operator/(const ratio& that) const
{
return ratio(
m_numerator * that.m_denominator,
m_denominator * that.m_numerator
);
}
ratio ratio::operator/(int64_t n) const
{
return operator/(ratio(n));
}
ratio& ratio::operator+=(const ratio& that)
{
return *this;
}
ratio& ratio::operator+=(int64_t n)
{
return operator+=(ratio(n));
}
ratio& ratio::operator-=(const ratio& that)
{
return *this;
}
ratio& ratio::operator-=(int64_t n)
{
return operator-=(ratio(n));
}
ratio& ratio::operator*=(const ratio& that)
{
return *this;
}
ratio& ratio::operator*=(int64_t n)
{
return operator*=(ratio(n));
}
ratio& ratio::operator/=(const ratio& that)
{
return *this;
}
ratio& ratio::operator/=(int64_t n)
{
return operator/=(ratio(n));
}
std::ostream& operator<<(std::ostream& os, const class ratio& ratio)
{
os << ratio.numerator() << '/' << ratio.denominator();
return os;
}
}
| 26.297297 | 84 | 0.612333 | peelonet |
55c16bef9d6e1bcfb465455be82e6c3eecf84335 | 3,787 | cpp | C++ | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | src/consensus/sliver.cpp | beerriot/concord | b03ccf01963bd072915020bb954a7afdb3074d79 | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Sliver -- Zero-copy management of bytes.
*
* See sliver.hpp for design details.
*/
#include "sliver.hpp"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <ios>
#include <memory>
#include "consensus/hex_tools.h"
namespace concord {
namespace consensus {
/**
* Create an empty sliver.
*/
Sliver::Sliver() : m_data(nullptr), m_offset(0), m_length(0) {}
/**
* Create a new sliver that will own the memory pointed to by `data`, which is
* `length` bytes in size.
*
* Important: the `data` buffer should have been allocated with `new`, and not
* `malloc`, because the shared pointer will use `delete` and not `free`.
*/
Sliver::Sliver(uint8_t* data, const size_t length)
: m_data(data, std::default_delete<uint8_t[]>()),
m_offset(0),
m_length(length) {
// Data must be non-null.
assert(data);
}
Sliver::Sliver(char* data, const size_t length)
: m_data(reinterpret_cast<uint8_t*>(data),
std::default_delete<uint8_t[]>()),
m_offset(0),
m_length(length) {
// Data must be non-null.
assert(data);
}
/**
* Create a sub-sliver that references a region of a base sliver.
*/
Sliver::Sliver(const Sliver& base, const size_t offset, const size_t length)
: m_data(base.m_data),
// This sliver starts offset bytes from the offset of its base.
m_offset(base.m_offset + offset),
m_length(length) {
// This sliver must start no later than the end of the base sliver.
assert(offset <= base.m_length);
// This sliver must end no later than the end of the base sliver.
assert(length <= base.m_length - offset);
}
/**
* Get the byte at `offset` in this sliver.
*/
uint8_t Sliver::operator[](const size_t offset) const {
// This offset must be within this sliver.
assert(offset < m_length);
// The data for the requested offset is that many bytes after the offset from
// the base sliver.
return m_data.get()[m_offset + offset];
}
/**
* Get a direct pointer to the data for this sliver. Remember that the Sliver
* (or its base) still owns the data, so ensure that the lifetime of this Sliver
* (or its base) is at least as long as the lifetime of the returned pointer.
*/
uint8_t* Sliver::data() const { return m_data.get() + m_offset; }
/**
* Create a subsliver. Syntactic sugar for cases where a function call is more
* natural than using the sub-sliver constructor directly.
*/
Sliver Sliver::subsliver(const size_t offset, const size_t length) const {
return Sliver(*this, offset, length);
}
size_t Sliver::length() const { return m_length; }
std::ostream& Sliver::operator<<(std::ostream& s) const {
return hexPrint(s, data(), length());
}
std::ostream& operator<<(std::ostream& s, const Sliver& sliver) {
return sliver.operator<<(s);
}
/**
* Slivers are == if their lengths are the same, and each byte of their data is
* the same.
*/
bool Sliver::operator==(const Sliver& other) const {
// This could be just "compare(other) == 0", but the short-circuit of checking
// lengths first can save us many cycles in some cases.
return length() == other.length() &&
memcmp(data(), other.data(), length()) == 0;
}
/**
* a.compare(b) is:
* - 0 if lengths are the same, and bytes are the same
* - -1 if bytes are the same, but a is shorter
* - 1 if bytes are the same, but a is longer
*/
int Sliver::compare(const Sliver& other) const {
int comp = memcmp(data(), other.data(), std::min(length(), other.length()));
if (comp == 0) {
if (length() < other.length()) {
comp = -1;
} else if (length() > other.length()) {
comp = 1;
}
}
return comp;
}
} // namespace consensus
} // namespace concord
| 28.473684 | 80 | 0.667019 | beerriot |
55c198449268a5b7ebfd22023399226b5bf3369f | 228 | cpp | C++ | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | main.cpp | robbor78/OpenGLTetris3D | b388cbdc2eda9fcc9a073f8aa857b0912819e695 | [
"Apache-2.0"
] | null | null | null | /*
* main.cpp
*
* Created on: 20 Dec 2013
* Author: bert
*/
#include "Application.h"
int main() {
Tetris3D::Application* app = new Tetris3D::Application();
app->Init();
app->Run();
delete app;
return 0;
}
| 10.363636 | 58 | 0.587719 | robbor78 |
55c3f45c2955619e2b1d1c5d5a9e28969c810ee3 | 6,576 | hpp | C++ | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 1,570 | 2016-06-30T10:40:04.000Z | 2022-03-31T01:47:33.000Z | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 9 | 2017-01-16T07:09:08.000Z | 2020-08-25T18:28:59.000Z | src/Vulkan/VkTimelineSemaphore.hpp | sunnycase/swiftshader | 592bce0dc7daaa8d2c7ee4b94bec98e0e7beeacc | [
"Apache-2.0"
] | 253 | 2016-06-30T18:57:10.000Z | 2022-03-25T03:57:40.000Z | // Copyright 2021 The SwiftShader 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.
#ifndef VK_TIMELINE_SEMAPHORE_HPP_
#define VK_TIMELINE_SEMAPHORE_HPP_
#include "VkConfig.hpp"
#include "VkObject.hpp"
#include "VkSemaphore.hpp"
#include "marl/conditionvariable.h"
#include "marl/mutex.h"
#include "System/Synchronization.hpp"
#include <chrono>
namespace vk {
struct Shared;
// Timeline Semaphores track a 64-bit payload instead of a binary payload.
//
// A timeline does not have a "signaled" and "unsignalled" state. Threads instead wait
// for the payload to become a certain value. When a thread signals the timeline, it provides
// a new payload that is greater than the current payload.
//
// There is no way to reset a timeline or to decrease the payload's value. A user must instead
// create a new timeline with a new initial payload if they desire this behavior.
class TimelineSemaphore : public Semaphore, public Object<TimelineSemaphore, VkSemaphore>
{
public:
TimelineSemaphore(const VkSemaphoreCreateInfo *pCreateInfo, void *mem, const VkAllocationCallbacks *pAllocator);
TimelineSemaphore();
static size_t ComputeRequiredAllocationSize(const VkSemaphoreCreateInfo *pCreateInfo);
// Block until this semaphore is signaled with the specified value;
void wait(uint64_t value);
// Wait until a certain amount of time has passed or until the specified value is signaled.
template<class CLOCK, class DURATION>
VkResult wait(uint64_t value, const std::chrono::time_point<CLOCK, DURATION> end_ns);
// Set the payload to the specified value and signal all waiting threads.
void signal(uint64_t value);
// Retrieve the current payload. This should not be used to make thread execution decisions
// as there's no guarantee that the value returned here matches the actual payload's value.
uint64_t getCounterValue();
// Dependent timeline semaphores allow an 'any' semaphore to be created that can wait on the
// state of multiple other timeline semaphores and be signaled like a binary semaphore
// if any of its parent semaphores are signaled with a certain value.
//
// Since a timeline semaphore can be signalled with nearly any value, but threads waiting
// on a timeline semaphore only unblock when a specific value is signaled, dependents can't
// naively become signaled whenever their parent semaphores are signaled with a new value.
// Instead, the dependent semaphore needs to wait for its parent semaphore to be signaled
// with a specific value as well. This specific value may differ for each parent semaphore.
//
// So this function adds other as a dependent semaphore, and tells it to only become unsignaled
// by this semaphore when this semaphore is signaled with waitValue.
void addDependent(TimelineSemaphore &other, uint64_t waitValue);
void addDependency(int id, uint64_t waitValue);
// Tells this semaphore to become signaled as part of a dependency chain when the parent semaphore
// with the specified id is signaled with the specified waitValue.
void addToWaitMap(int parentId, uint64_t waitValue);
// Clean up any allocated resources
void destroy(const VkAllocationCallbacks *pAllocator);
private:
// Track the 64-bit payload. Timeline Semaphores have a shared_ptr<Shared>
// that they can pass to other Timeline Semaphores to create dependency chains.
struct Shared
{
private:
// Guards access to all the resources that may be accessed by other threads.
// No clang Thread Safety Analysis is used on variables guarded by mutex
// as there is an issue with TSA. Despite instrumenting everything properly,
// compilation will fail when a lambda function uses a guarded resource.
marl::mutex mutex;
static std::atomic<int> nextId;
public:
Shared(marl::Allocator *allocator, uint64_t initialState);
// Block until this semaphore is signaled with the specified value;
void wait(uint64_t value);
// Wait until a certain amount of time has passed or until the specified value is signaled.
template<class CLOCK, class DURATION>
VkResult wait(uint64_t value, const std::chrono::time_point<CLOCK, DURATION> end_ns);
// Pass a signal down to a dependent.
void signal(int parentId, uint64_t value);
// Set the payload to the specified value and signal all waiting threads.
void signal(uint64_t value);
// Retrieve the current payload. This should not be used to make thread execution decisions
// as there's no guarantee that the value returned here matches the actual payload's value.
uint64_t getCounterValue();
// Add the other semaphore's Shared to deps.
void addDependent(TimelineSemaphore &other);
// Add {id, waitValue} as a key-value pair to waitMap.
void addDependency(int id, uint64_t waitValue);
// Entry point to the marl threading library that handles blocking and unblocking.
marl::ConditionVariable cv;
// TODO(b/181683382) -- Add Thread Safety Analysis instrumentation when it can properly
// analyze lambdas.
// The 64-bit payload.
uint64_t counter;
// A list of this semaphore's dependents.
marl::containers::vector<std::shared_ptr<Shared>, 1> deps;
// A map of {parentId: waitValue} pairs that tracks when this semaphore should unblock if it's
// signaled as a dependent by another semaphore.
std::map<int, uint64_t> waitMap;
// An ID that's unique for each instance of Shared
const int id;
};
std::shared_ptr<Shared> shared;
};
template<typename Clock, typename Duration>
VkResult TimelineSemaphore::wait(uint64_t value,
const std::chrono::time_point<Clock, Duration> timeout)
{
return shared->wait(value, timeout);
}
template<typename Clock, typename Duration>
VkResult TimelineSemaphore::Shared::wait(uint64_t value,
const std::chrono::time_point<Clock, Duration> timeout)
{
marl::lock lock(mutex);
if(!cv.wait_until(lock, timeout, [&]() { return counter == value; }))
{
return VK_TIMEOUT;
}
return VK_SUCCESS;
}
} // namespace vk
#endif // VK_TIMELINE_SEMAPHORE_HPP_
| 39.377246 | 113 | 0.756083 | sunnycase |
55c42a09001231832430ab515221e62db87f5a28 | 1,537 | hpp | C++ | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | test/tuple_hash.hpp | gkoszegi/cached_func | 97ad6158c31e39bb041b7612965d5a03c39020bf | [
"BSL-1.0"
] | null | null | null | #ifndef FUNCTOOLS_TEST_TUPLE_HASH_HPP_INCUDED
#define FUNCTOOLS_TEST_TUPLE_HASH_HPP_INCUDED
#include <boost/functional/hash.hpp>
#include <tuple>
// =====================================================================================================================
namespace std
{
template<typename T>
struct hash<std::tuple<T>>
{
size_t operator() (const std::tuple<T>& tup) const
{
return std::hash<T>()(std::get<0>(tup));
}
};
template<typename T1, typename T2>
struct hash<std::pair<T1, T2>>
{
size_t operator() (const std::pair<T1, T2>& p) const
{
size_t h = 0;
boost::hash_combine(h, p.first);
boost::hash_combine(h, p.second);
return h;
}
};
template<typename T1, typename T2>
struct hash<std::tuple<T1, T2>>
{
size_t operator() (const std::tuple<T1, T2>& tup) const
{
size_t h = 0;
boost::hash_combine(h, std::get<0>(tup));
boost::hash_combine(h, std::get<1>(tup));
return h;
}
};
template<typename T1, typename T2, typename T3>
struct hash<std::tuple<T1, T2, T3>>
{
size_t operator() (const std::tuple<T1, T2, T3>& tup) const
{
size_t h = 0;
boost::hash_combine(h, std::get<0>(tup));
boost::hash_combine(h, std::get<1>(tup));
boost::hash_combine(h, std::get<2>(tup));
return h;
}
};
}
#endif
| 26.5 | 120 | 0.488614 | gkoszegi |
55d0439f046914458c65f31edb2f53ced9d40a73 | 1,951 | cpp | C++ | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | 11_CPP/02_CPP02/ex03/bsp.cpp | tderwedu/42cursus | 2f56b87ce87227175e7a297d850aa16031acb0a8 | [
"Unlicense"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsp.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tderwedu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/31 12:15:32 by tderwedu #+# #+# */
/* Updated: 2021/10/14 13:09:37 by tderwedu ### ########.fr */
/* */
/* ************************************************************************** */
#include "Fixed.hpp"
#include "Point.hpp"
/*
** This algorithm is based on the:
** *INSIDE-OUTSIDE test*
** From 'A Parallel Algorithm for Polygon Rasterization'
**
** The edge function (which is the magnitude of the cross product) can be
** positive (clockwise) or negative (counter-wise) depending of the ordering
** of the given vertex points.
*/
Fixed edge_fct(Point const v0, Point const v1, Point const p)
{
Fixed res;
res = (p.getX() - v0.getX()) * (v1.getY() - v0.getY());
res = res - ((p.getY() - v0.getY()) * (v1.getX() - v0.getX()));
return (res);
}
bool bsp(Point const a, Point const b, Point const c, Point const point)
{
Fixed sign_ab = edge_fct(a, b, point);
Fixed sign_bc = edge_fct(b, c, point);
Fixed sign_ca = edge_fct(c, a, point);
if (sign_ab == Fixed(0) || sign_bc == Fixed(0) || sign_ca == Fixed(0))
return false;
bool test_cw = (sign_ab > Fixed(0) && sign_bc > Fixed(0) && sign_ca > Fixed(0));
bool test_ccw = (sign_ab < Fixed(0) && sign_bc < Fixed(0) && sign_ca < Fixed(0));
return (test_cw || test_ccw);
}
| 39.816327 | 82 | 0.401845 | tderwedu |
55d544cba0d062d05eac5b65bd04cb2badee4341 | 73,663 | cpp | C++ | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs14.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <limits>
#include "vm/CachedCCWBase.h"
#include "utils/New.h"
// System.Collections.Generic.IEqualityComparer`1<UnityEngine.XR.InputDevice>
struct IEqualityComparer_1_tC19DB848F703F8CA24DB77C30EBE9F5B58ABFDD4;
// System.Collections.Generic.IEqualityComparer`1<System.Int16>
struct IEqualityComparer_1_t6908210243A58C7DF5D08E9156020D5CA84621F3;
// System.Collections.Generic.IEqualityComparer`1<System.Int32>
struct IEqualityComparer_1_t62010156673DE1460AB1D1CEBE5DCD48665E1A38;
// System.Collections.Generic.Dictionary`2/KeyCollection<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.Int32,=a0B=>
struct KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549;
// System.Collections.Generic.Dictionary`2/ValueCollection<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.Int32,=a0B=>
struct ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B;
// System.Collections.Generic.Dictionary`2/Entry<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>[]
struct EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96;
// System.Collections.Generic.Dictionary`2/Entry<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>[]
struct EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4;
// System.Collections.Generic.Dictionary`2/Entry<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>[]
struct EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,=aaBf=`2<System.Int32,=ae8=>>[]
struct EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>[]
struct EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>[]
struct EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735;
// System.Collections.Generic.Dictionary`2/Entry<System.Int32,=a0B=>[]
struct EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72;
// System.Int32[]
struct Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32;
// System.String
struct String_t;
struct IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Windows.UI.Xaml.Interop.IBindableIterable
struct NOVTABLE IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) = 0;
};
// System.Object
// System.Collections.Generic.Dictionary`2<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___entries_1)); }
inline EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t588EF551291B9BFE6EE5AD33A68F2BDCD1EE8B96* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___keys_7)); }
inline KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tA878E0C7F1FAF030CD94D532B83181F352AD648F * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ___values_8)); }
inline ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * get_values_8() const { return ___values_8; }
inline ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tE111A93CA94079B22C1C9D6E0D6F92FE91F7544A * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___entries_1)); }
inline EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t1602302F909D51FFEBA7A9A95CD683BE16421EE4* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___keys_7)); }
inline KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tD780D5FD154A82B59C271F92768D7230E1A9846C * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ___values_8)); }
inline ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * get_values_8() const { return ___values_8; }
inline ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t8686962183CD9AB5201C4B979E298FBA5F306B8E * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___entries_1)); }
inline EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t37ABCBBB3ABB9B82EBE61986D43657582829A003* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___keys_7)); }
inline KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t173F12F37A9494FD22DEA048E368C00C2165DE57 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ___values_8)); }
inline ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * get_values_8() const { return ___values_8; }
inline ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tB74E6EDCF88D34BFA04801E119CFA45E0B5CDA6A * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___entries_1)); }
inline EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t3AF2ECC3EC1240DC062B33CD417B4FCD80C1A03B* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___keys_7)); }
inline KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t742EAABC06F80131310BE3260BA08050201E13D4 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ___values_8)); }
inline ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * get_values_8() const { return ___values_8; }
inline ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tE75C7DF04F25E941E3692B4CF9E52AC6160996A1 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___entries_1)); }
inline EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tFE0E128DF3C0A340037F84F082D249D963E9E390* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___keys_7)); }
inline KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tEE68C3504733D9FC39CE9ADA31E42E37910367EB * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ___values_8)); }
inline ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * get_values_8() const { return ___values_8; }
inline ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t5FD88F521A60613BE4E32103A938CC8D402D4611 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___entries_1)); }
inline EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_tA5A38417B9E5E9255C330C6D7B4B91C21F038735* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___keys_7)); }
inline KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC * get_keys_7() const { return ___keys_7; }
inline KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_tFB3B983744FE3A5FD539DE747C39618143C717AC * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ___values_8)); }
inline ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * get_values_8() const { return ___values_8; }
inline ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t986D804F65FB61E3953F7E95F5829B8F4CF159F3 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
// System.Collections.Generic.Dictionary`2<System.Int32,=a0B=>
struct Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___buckets_0)); }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___entries_1)); }
inline EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t54F6C58192FE1FF7F8ADDF4A33FF2BB3C6CACF72* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___keys_7)); }
inline KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t64FDA7D9861CF0139F8D86C053AC7E0A332E8549 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ___values_8)); }
inline ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * get_values_8() const { return ___values_8; }
inline ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_tD3D5E05ACF40FD3A53209CCC1CD2372FE3437A1B * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
il2cpp_hresult_t IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue);
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<UnityEngine.XR.InputDevice,Microsoft.MixedReality.Toolkit.XRSDK.Input.GenericXRSDKController>
struct Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tBDD5926BC1EE372C9A9E1DB2F7D5D2A1CF1BAE97_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkMessageDelegate>
struct Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t2E34DBEAE46F8D581A2BD36DF01436181B0748F3_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int16,UnityEngine.Networking.NetworkConnection/PacketStat>
struct Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tE8371663EC9914BEC5F635B74C54849B326ADE0C_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,=aaBf=`2<System.Int32,=ae8=>>
struct Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tB2B3FCA3CCA71CAD5314ED8E3326583FB41B1867_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>
struct Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t6431821EA0C996A318CFB028504B2F54E0732139_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,System.Tuple`2<Microsoft.MixedReality.Toolkit.Input.KeyBinding/KeyType,System.Int32>>
struct Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tBEB1E9AF3E721B2F2C0D7A9097B3BAB08B88AC4A_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Int32,=a0B=>
struct Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8
{
inline Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
*iidCount = 1;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tA3C01E6D49CE0A89B4A4002123AF1E4BF0CB75F9_ComCallableWrapper(obj));
}
| 47.219872 | 257 | 0.819109 | frenchmajorcsminor |
55d7ba03bdda2056f37782b518d1ef175d618f3b | 1,697 | cpp | C++ | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 19 | 2016-08-16T10:19:07.000Z | 2018-12-04T01:00:00.000Z | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 1 | 2016-08-18T04:23:19.000Z | 2017-01-26T22:46:44.000Z | Source/Shared/engine/cfc/gpu/gfx.cpp | JJoosten/IndirectOcclusionCulling | 0376da0f9bdb14e67238a5b54e928e50ee33aef6 | [
"MIT"
] | 1 | 2019-09-23T10:49:36.000Z | 2019-09-23T10:49:36.000Z | #include "gfx.h"
#include <cfc/core/io.h>
namespace cfc {
void gfx_gpu_timer_query::Begin(gfx_command_list* const cmdList, const char* const description)
{
m_cmdList = cmdList;
m_startIndex = cmdList->InsertTimerQuery();
usize descriptionLength = strlen(description);
stl_assert(descriptionLength < GFX_MAX_TIMER_QUERY_DESCRIPTION_STRING_SIZE);
memcpy(m_description, description, descriptionLength);
}
void gfx_gpu_timer_query::Begin(gfx_command_list* const cmdList)
{
m_cmdList = cmdList;
m_startIndex = cmdList->InsertTimerQuery();
}
void gfx_gpu_timer_query::End()
{
m_endIndex = m_cmdList->InsertTimerQuery();
}
usize gfx::AddShaderFromFile(context& ctx, const char* filename, const char* funcName /*= "main"*/, const char* shaderType /*= "vs_5_0"*/, const char* defineData /*=null*/)
{
iobuffer ioData = ctx.IO->ReadFileToMemory(filename);
stl_assert(ioData); // read shader
return AddShaderFromMemory(ioData.data, ioData.size, funcName, shaderType, filename, defineData);
}
gfx_barrier_list::gfx_barrier_list(usize reserve /* = 4*/)
{
Barriers.reserve(reserve);
}
void gfx_barrier_list::Reset()
{
Barriers.resize(0);
}
void gfx_barrier_list::BarrierResource(usize resourceIdx, u32 stateBefore, u32 stateAfter)
{
Barriers.push_back(gpu_resourcebarrier_desc::Transition(resourceIdx, stateBefore, stateAfter));
}
void gfx_barrier_list::BarrierUAV(usize resourceIdx)
{
Barriers.push_back(gpu_resourcebarrier_desc::UAV(resourceIdx));
}
void gfx_barrier_list::BarrierAliasing(usize resourceBeforeIdx, usize resourceAfterIdx)
{
Barriers.push_back(gpu_resourcebarrier_desc::Aliasing(resourceBeforeIdx, resourceAfterIdx));
}
}; | 27.819672 | 173 | 0.763701 | JJoosten |
55dc54a2eced19c10cf783d11aeed761de3f342d | 2,157 | hpp | C++ | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | memhlp.hpp | yqw1212/demovfuscator | d27dd1c87ba6956dae4a3003497fe8760b7299f9 | [
"BSD-2-Clause"
] | null | null | null | #ifndef MEMHLP_H
#define MEMHLP_H
#include <tuple>
#include <map>
#include <unordered_map>
#include <elf.h>
#include <cstddef>
#include <string>
enum symbl{
SYM_INVALID, SYM_ON, SYM_SEL_ON, SYM_M_LOOP, SYM_ENTRYP,
SYM_ALU_EQ, SYM_ALU_ADD, SYM_BIT_SET, SYM_BIT_CLR,
SYM_ALU_AND, SYM_ALU_OR, SYM_ALU_XOR, SYM_ALU_SHL,
SYM_ALU_SHR, SYM_ALU_SARI, SYM_ALU_MULL, SYM_ALU_MULH,
SYM_BOOL_OR, SYM_BOOL_XOR, SYM_BOOL_XNOR, SYM_BOOL_AND,
SYM_IMP_BAND, SYM_TARGET, SYM_SEL_TARGET, SYM_SP, SYM_END,
SYM_ALU_TRUE, SYM_ALU_FALSE, SYM_ALU_B0, SYM_ALU_B1,
SYM_ALU_B2, SYM_ALU_B3, SYM_ALU_B4, SYM_ALU_B5, SYM_ALU_B6,
SYM_ALU_B7, SYM_ALU_ADD8L, SYM_ALU_ADD8H, SYM_ALU_INV8,
SYM_ALU_INV16, SYM_ALU_CLAMP32, SYM_ALU_MUL_SUM8L,
SYM_ALU_MUL_SUM8H, SYM_ALU_MUL_SHL2, SYM_ALU_MUL_SUMS,
SYM_ALU_DIV_SHL1_8_C_D, SYM_ALU_DIV_SHL1_8_D, SYM_ALU_DIV_SHL2_8_D,
SYM_ALU_DIV_SHL3_8_D, SYM_ALU_SEX8, SYM_SEL_DATA, SYM_DATA,
SYM_STP_ADD4, SYM_STP_SUB4, SYM_DISCARD, SYM_FAULT, SYM_DISPATCH
};
class memhlp{
public:
void set_segments(std::map<uint64_t,
std::tuple<uint8_t *, uint64_t, int>>*);
std::pair<const uint64_t, std::tuple<uint8_t *, uint64_t, int>>*
get_segment(uint64_t addr);
uint8_t* get_ptr(uint64_t addr);
size_t space(uint64_t addr);
int is_X(uint64_t addr);
symbl analyse_table(uint64_t addr, int dim);
symbl get_sym(uint64_t addr);
int add_sym(uint64_t addr, symbl sym);
bool has_sym(symbl sym);
uint64_t get_sym_addr(symbl sym);
bool has_sym_to(uint64_t addr);
int rem_sym(uint64_t addr);
std::string dump_syms();
std::string dump_syms_idc();
std::string get_sym_name(enum symbl sym);
template <typename T>
int get_data(uint64_t addr, T** data) {
size_t off;
auto *seg = get_segment(addr);
if (!seg) return -1;
off = addr - seg->first;
if ((std::get<1>(seg->second)) - off < sizeof(T)) return -2;
if ((std::get<0>(seg->second)) == NULL)
*data = NULL;
else
*data = ((T*) ((std::get<0>(seg->second)) + off));
return 0;
}
private:
std::map<uint64_t, std::tuple<uint8_t *, uint64_t, int>> segs;
std::unordered_map<uint64_t, symbl> symbol;
};
#endif
| 32.681818 | 69 | 0.724618 | yqw1212 |
55e1cec71fcea52c28148e45891cab7c6eaaad90 | 15,001 | hpp | C++ | include/pstore/mcrepo/compilation.hpp | paulhuggett/pstore2 | a0c663d10a2e2713fdf39ecdae1f9c1e96041f5c | [
"Apache-2.0"
] | 11 | 2018-02-02T21:24:49.000Z | 2020-12-11T04:06:03.000Z | include/pstore/mcrepo/compilation.hpp | SNSystems/pstore | 74e9dd960245d6bfc125af03ed964d8ad660a62d | [
"Apache-2.0"
] | 63 | 2018-02-05T17:24:59.000Z | 2022-03-22T17:26:28.000Z | include/pstore/mcrepo/compilation.hpp | paulhuggett/pstore2 | a0c663d10a2e2713fdf39ecdae1f9c1e96041f5c | [
"Apache-2.0"
] | 5 | 2020-01-13T22:47:11.000Z | 2021-05-14T09:31:15.000Z | //===- include/pstore/mcrepo/compilation.hpp --------------*- mode: C++ -*-===//
//* _ _ _ _ *
//* ___ ___ _ __ ___ _ __ (_) | __ _| |_(_) ___ _ __ *
//* / __/ _ \| '_ ` _ \| '_ \| | |/ _` | __| |/ _ \| '_ \ *
//* | (_| (_) | | | | | | |_) | | | (_| | |_| | (_) | | | | *
//* \___\___/|_| |_| |_| .__/|_|_|\__,_|\__|_|\___/|_| |_| *
//* |_| *
//===----------------------------------------------------------------------===//
//
// Part of the pstore project, under the Apache License v2.0 with LLVM Exceptions.
// See https://github.com/SNSystems/pstore/blob/master/LICENSE.txt for license
// information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef PSTORE_MCREPO_COMPILATION_HPP
#define PSTORE_MCREPO_COMPILATION_HPP
#include <new>
#include "pstore/core/index_types.hpp"
#include "pstore/core/transaction.hpp"
#include "pstore/mcrepo/repo_error.hpp"
#include "pstore/support/bit_field.hpp"
#include "pstore/support/unsigned_cast.hpp"
namespace pstore {
namespace repo {
#define PSTORE_REPO_LINKAGES \
X (append) \
X (common) \
X (external) \
X (internal_no_symbol) \
X (internal) \
X (link_once_any) \
X (link_once_odr) \
X (weak_any) \
X (weak_odr)
#define X(a) a,
enum class linkage : std::uint8_t { PSTORE_REPO_LINKAGES };
#undef X
std::ostream & operator<< (std::ostream & os, linkage l);
#define PSTORE_REPO_VISIBILITIES \
X (default_vis) \
X (hidden_vis) \
X (protected_vis)
#define X(a) a,
enum class visibility : std::uint8_t { PSTORE_REPO_VISIBILITIES };
#undef X
//* _ __ _ _ _ _ *
//* __| |___ / _(_)_ _ (_) |_(_)___ _ _ *
//* / _` / -_) _| | ' \| | _| / _ \ ' \ *
//* \__,_\___|_| |_|_||_|_|\__|_\___/_||_| *
//* *
/// \brief Represents an individual symbol in a compilation.
///
/// A definition provides the connection between a symbol name, its linkage, and the
/// fragment which holds the associated data.
struct definition {
/// \param d The fragment digest for this compilation symbol.
/// \param x The fragment extent for this compilation symbol.
/// \param n Symbol name address.
/// \param l The symbol linkage.
/// \param v The symbol visibility.
definition (index::digest d, extent<fragment> x, typed_address<indirect_string> n,
linkage l, visibility v = repo::visibility::default_vis) noexcept;
/// The digest of the fragment referenced by this compilation symbol.
index::digest digest;
/// The extent of the fragment referenced by this compilation symbol.
extent<fragment> fext;
// TODO: it looks tempting to use some of the bits of this address for the
// linkage/visibility fields. We know that they're not all used and it would eliminate
// all of the padding bits from the structure. Unfortunately, repo-object-writer is
// currently stashing host pointers in this field and although the same may be true for
// those, it's difficult to be certain.
typed_address<indirect_string> name;
union {
std::uint8_t bf = UINT8_C (0);
bit_field<std::uint8_t, 0, 4> linkage_;
bit_field<std::uint8_t, 4, 2> visibility_;
};
std::uint8_t padding1 = 0;
std::uint16_t padding2 = 0;
std::uint32_t padding3 = 0;
auto linkage () const noexcept -> enum linkage {
return static_cast<enum linkage> (linkage_.value ());
}
auto visibility () const noexcept -> enum visibility {
return static_cast<enum visibility> (visibility_.value ());
}
/// \brief Returns a pointer to an in-store definition instance.
///
/// \param db The database from which the definition should be loaded.
/// \param addr Address of the definition.
/// \result A pointer to the in-store definition.
static auto load (database const & db, typed_address<definition> addr)
-> std::shared_ptr<definition const>;
private:
friend class compilation;
// TODO: using "=default" here causes clang-8 to issue an error:
// "default member initializer for 'padding1' needed within definition of enclosing
// class 'definition' outside of member functions"
definition () noexcept {}
};
// load
// ~~~~
inline auto definition::load (database const & db, typed_address<definition> const addr)
-> std::shared_ptr<definition const> {
return db.getro (addr);
}
//* _ _ _ _ *
//* __ ___ _ __ _ __(_) |__ _| |_(_)___ _ _ *
//* / _/ _ \ ' \| '_ \ | / _` | _| / _ \ ' \ *
//* \__\___/_|_|_| .__/_|_\__,_|\__|_\___/_||_| *
//* |_| *
/// A compilation is a holder for zero or more definitions. It is the top-level object
/// representing the result of processing of a transaction unit by the compiler.
class compilation {
public:
using iterator = definition *;
using const_iterator = definition const *;
using size_type = std::uint32_t;
void operator delete (void * p);
/// \name Construction
///@{
/// Allocates a new compilation in-store and copy the ticket file path and the contents
/// of a vector of definitions into it.
///
/// \param transaction The transaction to which the compilation will be appended.
/// \param triple The target-triple associated with this compilation.
/// \param first_member The first of a sequence of definition instances. The
/// range defined by \p first_member and \p last_member will be copied into the newly
/// allocated compilation.
/// \param last_member The end of the range of definition instances.
/// \result A pair of a pointer and an extent which describes
/// the in-store location of the allocated compilation.
template <typename TransactionType, typename Iterator>
static extent<compilation> alloc (TransactionType & transaction,
typed_address<indirect_string> triple,
Iterator first_member, Iterator last_member);
/// \brief Returns a pointer to an in-pstore compilation instance.
///
/// \param db The database from which the compilation should be loaded.
/// \param location An extent describing the compilation location in the store.
/// \result A pointer to the compilation in-store memory.
static std::shared_ptr<compilation const> load (database const & db,
extent<compilation> const & location);
///@}
/// \name Element access
///@{
definition const & operator[] (std::size_t const i) const {
PSTORE_ASSERT (i < size_);
return members_[i];
}
///@}
/// \name Iterators
///@{
iterator begin () { return members_; }
const_iterator begin () const { return members_; }
const_iterator cbegin () const { return this->begin (); }
iterator end () { return members_ + size_; }
const_iterator end () const { return members_ + size_; }
const_iterator cend () const { return this->end (); }
///@}
/// \name Capacity
///@{
/// Checks whether the container is empty.
bool empty () const noexcept { return size_ == 0; }
/// Returns the number of elements.
size_type size () const noexcept { return size_; }
///@}
/// \name Storage
///@{
/// Returns the number of bytes of storage required for a compilation with 'size'
/// members.
static std::size_t size_bytes (size_type size) noexcept {
size = std::max (size, size_type{1}); // Always at least enough for one member.
return sizeof (compilation) - sizeof (compilation::members_) +
sizeof (compilation::members_[0]) * size;
}
/// \returns The number of bytes needed to accommodate this compilation.
std::size_t size_bytes () const noexcept {
return compilation::size_bytes (this->size ());
}
///@}
/// Returns the target triple.
typed_address<indirect_string> triple () const noexcept { return triple_; }
/// Compute the address of the definition given by \p index within compilation \p c.
///
/// \param c The address of a compilation.
/// \param index The index of a definition within compilation \p c.
/// \result The address of the definition \p index within compilation \p c.
static constexpr typed_address<definition>
index_address (typed_address<compilation> const c, size_type const index) noexcept {
return typed_address<definition>::make (c.to_address () +
offsetof (compilation, members_) +
sizeof (definition) * index);
}
private:
template <typename Iterator>
compilation (typed_address<indirect_string> triple, size_type size,
Iterator first_member, Iterator last_member) noexcept;
struct nmembers {
size_type n;
};
/// A placement-new implementation which allocates sufficient storage for a
/// compilation with the number of members given by the size parameter.
void * operator new (std::size_t s, nmembers size);
/// A copy of the standard placement-new function.
void * operator new (std::size_t s, void * ptr);
void operator delete (void * p, nmembers size);
void operator delete (void * p, void * ptr);
static constexpr std::array<char, 8> compilation_signature_ = {
{'C', 'm', 'p', 'l', '8', 'i', 'o', 'n'}};
std::array<char, 8> signature_ = compilation_signature_;
/// The target triple for this compilation.
typed_address<indirect_string> triple_;
/// The number of entries in the members_ array.
size_type size_ = 0;
std::uint32_t padding1_ = 0;
definition members_[1];
};
PSTORE_STATIC_ASSERT (std::is_standard_layout<compilation>::value);
PSTORE_STATIC_ASSERT (sizeof (compilation) == 32 + sizeof (definition));
PSTORE_STATIC_ASSERT (alignof (compilation) == 16);
template <typename Iterator>
compilation::compilation (typed_address<indirect_string> const triple, size_type const size,
Iterator const first_member, Iterator const last_member) noexcept
: triple_{triple}
, size_{size} {
// Assignment to suppress a warning from clang that the field is not used.
padding1_ = 0;
PSTORE_STATIC_ASSERT (offsetof (compilation, signature_) == 0);
PSTORE_STATIC_ASSERT (offsetof (compilation, triple_) == 8);
PSTORE_STATIC_ASSERT (offsetof (compilation, size_) == 16);
PSTORE_STATIC_ASSERT (offsetof (compilation, padding1_) == 20);
PSTORE_STATIC_ASSERT (offsetof (compilation, members_) == 32);
// This check can safely be an assertion because the method is private and alloc(),
// the sole caller, performs a full run-time check of the size.
PSTORE_ASSERT (unsigned_cast (std::distance (first_member, last_member)) == size);
std::copy (first_member, last_member, this->begin ());
}
// alloc
// ~~~~~
template <typename TransactionType, typename Iterator>
auto compilation::alloc (TransactionType & transaction,
typed_address<indirect_string> triple, Iterator first_member,
Iterator last_member) -> extent<compilation> {
// First work out its size.
auto const dist = std::distance (first_member, last_member);
PSTORE_ASSERT (dist >= 0);
if (dist > std::numeric_limits<size_type>::max ()) {
raise (error_code::too_many_members_in_compilation);
}
auto const num_members = static_cast<size_type> (dist);
auto const size = size_bytes (num_members);
// Allocate the storage.
auto const addr = transaction.allocate (size, alignof (compilation));
auto ptr = std::static_pointer_cast<compilation> (transaction.getrw (addr, size));
// Write the data to the store.
new (ptr.get ()) compilation{triple, num_members, first_member, last_member};
return extent<compilation> (typed_address<compilation> (addr), size);
}
} // end namespace repo
} // end namespace pstore
#endif // PSTORE_MCREPO_COMPILATION_HPP
| 49.022876 | 100 | 0.515632 | paulhuggett |
55e6582fa1a3884c2a5e27b5936a50fdd0af71b0 | 828 | cpp | C++ | src_test/blockchain/trx/DummyAddress.cpp | alinous-core/codable-cash | 32a86a152a146c592bcfd8cc712f4e8cb38ee1a0 | [
"MIT"
] | 1 | 2020-10-15T08:24:35.000Z | 2020-10-15T08:24:35.000Z | src_test/blockchain/trx/DummyAddress.cpp | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | src_test/blockchain/trx/DummyAddress.cpp | Codablecash/codablecash | 8816b69db69ff2f5da6cdb6af09b8fb21d3df1d9 | [
"MIT"
] | null | null | null | /*
* DummyAddress.cpp
*
* Created on: 2019/01/04
* Author: iizuka
*/
#include "blockchain/trx/DummyAddress.h"
namespace codablecash {
DummyAddress::DummyAddress() : AbstractAddress(100){
}
DummyAddress::~DummyAddress() {
}
AbstractAddress* DummyAddress::clone() const noexcept {
return nullptr;
}
bool DummyAddress::equals(const AbstractAddress* other) const noexcept{
return false;
}
int DummyAddress::binarySize() const {
return 0;
}
void DummyAddress::toBinary(ByteBuffer* out) const {
}
IBlockObject* DummyAddress::copyData() const noexcept {
return nullptr;
}
AbstractTransactionInput* DummyAddress::toTransactionInput(const BalanceUnit* amount) const noexcept {
return nullptr;
}
const ScPublicKey* DummyAddress::getPubkey() const noexcept {
return nullptr;
}
} /* namespace codablecash */
| 16.897959 | 102 | 0.741546 | alinous-core |
55e8a46085f327361786e5db44c171b77f43827f | 13,139 | hpp | C++ | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/GameSongController.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
#include "extern/beatsaber-hook/shared/utils/byref.hpp"
// Including type: SongController
#include "GlobalNamespace/SongController.hpp"
// Including type: IStartSeekSongController
#include "GlobalNamespace/IStartSeekSongController.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: AudioTimeSyncController
class AudioTimeSyncController;
// Forward declaring type: AudioPitchGainEffect
class AudioPitchGainEffect;
// Forward declaring type: IBeatmapObjectCallbackController
class IBeatmapObjectCallbackController;
}
// Forward declaring namespace: UnityEngine
namespace UnityEngine {
// Forward declaring type: WaitUntil
class WaitUntil;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Size: 0x39
#pragma pack(push, 1)
// Autogenerated type: GameSongController
// [TokenAttribute] Offset: FFFFFFFF
class GameSongController : public GlobalNamespace::SongController/*, public GlobalNamespace::IStartSeekSongController*/ {
public:
// private AudioTimeSyncController _audioTimeSyncController
// Size: 0x8
// Offset: 0x20
GlobalNamespace::AudioTimeSyncController* audioTimeSyncController;
// Field size check
static_assert(sizeof(GlobalNamespace::AudioTimeSyncController*) == 0x8);
// private AudioPitchGainEffect _failAudioPitchGainEffect
// Size: 0x8
// Offset: 0x28
GlobalNamespace::AudioPitchGainEffect* failAudioPitchGainEffect;
// Field size check
static_assert(sizeof(GlobalNamespace::AudioPitchGainEffect*) == 0x8);
// [InjectAttribute] Offset: 0xEB6928
// private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
// Size: 0x8
// Offset: 0x30
GlobalNamespace::IBeatmapObjectCallbackController* beatmapObjectCallbackController;
// Field size check
static_assert(sizeof(GlobalNamespace::IBeatmapObjectCallbackController*) == 0x8);
// private System.Boolean _songDidFinish
// Size: 0x1
// Offset: 0x38
bool songDidFinish;
// Field size check
static_assert(sizeof(bool) == 0x1);
// Creating value type constructor for type: GameSongController
GameSongController(GlobalNamespace::AudioTimeSyncController* audioTimeSyncController_ = {}, GlobalNamespace::AudioPitchGainEffect* failAudioPitchGainEffect_ = {}, GlobalNamespace::IBeatmapObjectCallbackController* beatmapObjectCallbackController_ = {}, bool songDidFinish_ = {}) noexcept : audioTimeSyncController{audioTimeSyncController_}, failAudioPitchGainEffect{failAudioPitchGainEffect_}, beatmapObjectCallbackController{beatmapObjectCallbackController_}, songDidFinish{songDidFinish_} {}
// Creating interface conversion operator: operator GlobalNamespace::IStartSeekSongController
operator GlobalNamespace::IStartSeekSongController() noexcept {
return *reinterpret_cast<GlobalNamespace::IStartSeekSongController*>(this);
}
// Get instance field: private AudioTimeSyncController _audioTimeSyncController
GlobalNamespace::AudioTimeSyncController* _get__audioTimeSyncController();
// Set instance field: private AudioTimeSyncController _audioTimeSyncController
void _set__audioTimeSyncController(GlobalNamespace::AudioTimeSyncController* value);
// Get instance field: private AudioPitchGainEffect _failAudioPitchGainEffect
GlobalNamespace::AudioPitchGainEffect* _get__failAudioPitchGainEffect();
// Set instance field: private AudioPitchGainEffect _failAudioPitchGainEffect
void _set__failAudioPitchGainEffect(GlobalNamespace::AudioPitchGainEffect* value);
// Get instance field: private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
GlobalNamespace::IBeatmapObjectCallbackController* _get__beatmapObjectCallbackController();
// Set instance field: private readonly IBeatmapObjectCallbackController _beatmapObjectCallbackController
void _set__beatmapObjectCallbackController(GlobalNamespace::IBeatmapObjectCallbackController* value);
// Get instance field: private System.Boolean _songDidFinish
bool _get__songDidFinish();
// Set instance field: private System.Boolean _songDidFinish
void _set__songDidFinish(bool value);
// public System.Single get_songLength()
// Offset: 0x1F1BF2C
float get_songLength();
// public UnityEngine.WaitUntil get_waitUntilIsReadyToStartTheSong()
// Offset: 0x1F1BF48
UnityEngine::WaitUntil* get_waitUntilIsReadyToStartTheSong();
// protected System.Void LateUpdate()
// Offset: 0x1F1BF64
void LateUpdate();
// public System.Void StartSong(System.Single songTimeOffset)
// Offset: 0x1F1BFDC
void StartSong(float songTimeOffset);
// public System.Void FailStopSong()
// Offset: 0x1F1C1A4
void FailStopSong();
// public System.Void SeekTo(System.Single songTime)
// Offset: 0x1F1C368
void SeekTo(float songTime);
// private System.Void <FailStopSong>b__13_0()
// Offset: 0x1F1C38C
void $FailStopSong$b__13_0();
// public System.Void .ctor()
// Offset: 0x1F1C384
// Implemented from: SongController
// Base method: System.Void SongController::.ctor()
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static GameSongController* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::GameSongController::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<GameSongController*, creationType>()));
}
// public override System.Void StopSong()
// Offset: 0x1F1C000
// Implemented from: SongController
// Base method: System.Void SongController::StopSong()
void StopSong();
// public override System.Void PauseSong()
// Offset: 0x1F1C01C
// Implemented from: SongController
// Base method: System.Void SongController::PauseSong()
void PauseSong();
// public override System.Void ResumeSong()
// Offset: 0x1F1C0E0
// Implemented from: SongController
// Base method: System.Void SongController::ResumeSong()
void ResumeSong();
}; // GameSongController
#pragma pack(pop)
static check_size<sizeof(GameSongController), 56 + sizeof(bool)> __GlobalNamespace_GameSongControllerSizeCheck;
static_assert(sizeof(GameSongController) == 0x39);
}
DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::GameSongController*, "", "GameSongController");
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::get_songLength
// Il2CppName: get_songLength
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::get_songLength)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "get_songLength", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::get_waitUntilIsReadyToStartTheSong
// Il2CppName: get_waitUntilIsReadyToStartTheSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<UnityEngine::WaitUntil* (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::get_waitUntilIsReadyToStartTheSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "get_waitUntilIsReadyToStartTheSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::LateUpdate
// Il2CppName: LateUpdate
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::LateUpdate)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "LateUpdate", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::StartSong
// Il2CppName: StartSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)(float)>(&GlobalNamespace::GameSongController::StartSong)> {
static const MethodInfo* get() {
static auto* songTimeOffset = &::il2cpp_utils::GetClassFromName("System", "Single")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "StartSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{songTimeOffset});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::FailStopSong
// Il2CppName: FailStopSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::FailStopSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "FailStopSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::SeekTo
// Il2CppName: SeekTo
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)(float)>(&GlobalNamespace::GameSongController::SeekTo)> {
static const MethodInfo* get() {
static auto* songTime = &::il2cpp_utils::GetClassFromName("System", "Single")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "SeekTo", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{songTime});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::$FailStopSong$b__13_0
// Il2CppName: <FailStopSong>b__13_0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::$FailStopSong$b__13_0)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "<FailStopSong>b__13_0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::StopSong
// Il2CppName: StopSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::StopSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "StopSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::PauseSong
// Il2CppName: PauseSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::PauseSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "PauseSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::GameSongController::ResumeSong
// Il2CppName: ResumeSong
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::GameSongController::*)()>(&GlobalNamespace::GameSongController::ResumeSong)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::GameSongController*), "ResumeSong", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
| 56.878788 | 498 | 0.755841 | marksteward |
55ec9afa2f616b458c9948c60c14610c41382a65 | 36,597 | cpp | C++ | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 523 | 2018-02-02T08:07:24.000Z | 2022-03-21T15:44:39.000Z | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 28 | 2018-02-02T20:58:13.000Z | 2022-02-06T15:03:41.000Z | lib/dffi_impl.cpp | kamino/dragonffi | 3c983cc8c091d5472f7cdeab1b06dc3b1902e1be | [
"Apache-2.0"
] | 28 | 2018-02-02T12:05:55.000Z | 2021-09-16T21:05:05.000Z | // Copyright 2018 Adrien Guinet <[email protected]>
//
// 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 <string>
#include <cinttypes>
#include <clang/Basic/FileManager.h>
#include <clang/Basic/LangStandard.h>
#include <clang/CodeGen/CodeGenAction.h>
#include <clang/Driver/Compilation.h>
#include <clang/Driver/Driver.h>
#include <clang/Driver/DriverDiagnostic.h>
#include <clang/Driver/Options.h>
#include <clang/Driver/Tool.h>
#include <clang/Driver/ToolChain.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/CompilerInvocation.h>
#include <clang/Frontend/FrontendActions.h>
#include <clang/Frontend/FrontendDiagnostic.h>
#include <clang/Frontend/TextDiagnosticBuffer.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/Utils.h>
#include <clang/FrontendTool/Utils.h>
#include <llvm/BinaryFormat/Dwarf.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/IR/DebugInfo.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/Object/ObjectFile.h>
#include <llvm/Option/Arg.h>
#include <llvm/Option/ArgList.h>
#include <llvm/Support/Compiler.h>
#include <llvm/Support/ErrorHandling.h>
#include <llvm/Support/Host.h>
#include <llvm/Support/Path.h>
#include <llvm/Support/Process.h>
#include <llvm/Support/Program.h>
#include <llvm/Support/Signals.h>
#include <llvm/Support/TargetRegistry.h>
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/VirtualFileSystem.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Target/TargetMachine.h>
#include <dffi/config.h>
#include <dffi/ctypes.h>
#include <dffi/dffi.h>
#include <dffi/types.h>
#include <dffi/composite_type.h>
#include <dffi/casting.h>
#include "dffi_impl.h"
#include "types_printer.h"
using namespace llvm;
using namespace clang;
namespace dffi {
static CallingConv dwarfCCToDFFI(uint8_t DwCC)
{
// This is the inverse of the getDwarfCC function in clang/lib/CodeGen/CGDebugInfo.cpp!
switch (DwCC) {
case 0:
return CC_C;
case dwarf::DW_CC_BORLAND_stdcall:
return CC_X86StdCall;
case dwarf::DW_CC_BORLAND_msfastcall:
return CC_X86FastCall;
case dwarf::DW_CC_BORLAND_thiscall:
return CC_X86ThisCall;
case dwarf::DW_CC_LLVM_vectorcall:
return CC_X86VectorCall;
case dwarf::DW_CC_BORLAND_pascal:
return CC_X86Pascal;
case dwarf::DW_CC_LLVM_Win64:
return CC_Win64;
case dwarf::DW_CC_LLVM_X86_64SysV:
return CC_X86_64SysV;
case dwarf::DW_CC_LLVM_AAPCS:
return CC_AAPCS;
case dwarf::DW_CC_LLVM_AAPCS_VFP:
return CC_AAPCS_VFP;
case dwarf::DW_CC_LLVM_IntelOclBicc:
return CC_IntelOclBicc;
case dwarf::DW_CC_LLVM_SpirFunction:
return CC_SpirFunction;
case dwarf::DW_CC_LLVM_OpenCLKernel:
return CC_OpenCLKernel;
case dwarf::DW_CC_LLVM_Swift:
return CC_Swift;
case dwarf::DW_CC_LLVM_PreserveMost:
return CC_PreserveMost;
case dwarf::DW_CC_LLVM_PreserveAll:
return CC_PreserveAll;
case dwarf::DW_CC_LLVM_X86RegCall:
return CC_X86RegCall;
}
assert(false && "unknown calling convention!");
return CC_C;
}
std::string CCOpts::getSysroot() const
{
// If this->Sysroot is defined, returns it. Otherwise, check the DFFI_SYSROOT
// environment variable.
if (!Sysroot.empty()) {
return Sysroot;
}
auto OEnv = sys::Process::GetEnv("DFFI_SYSROOT");
if (OEnv.hasValue()) {
return std::move(OEnv.getValue());
}
return {};
}
namespace details {
namespace {
const char* WrapperPrefix = "__dffi_wrapper_";
llvm::DIType const* getCanonicalDIType(llvm::DIType const* Ty)
{
// Go throught every typedef and returns the "original" type!
if (auto* DTy = llvm::dyn_cast_or_null<DIDerivedType>(Ty)) {
switch (DTy->getTag()) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_const_type:
case dwarf::DW_TAG_volatile_type:
case dwarf::DW_TAG_restrict_type:
return getCanonicalDIType(DTy->getBaseType());
default:
break;
};
}
return Ty;
}
llvm::DIType const* stripDITypePtr(llvm::DIType const* Ty)
{
auto* PtrATy = llvm::cast<DIDerivedType>(Ty);
assert(PtrATy->getTag() == llvm::dwarf::DW_TAG_pointer_type && "must be a pointer type!");
return PtrATy->getBaseType();
}
std::string getWrapperName(size_t Idx)
{
return std::string{WrapperPrefix} + std::to_string(Idx);
}
} // anonymous
DFFIImpl::DFFIImpl(CCOpts const& Opts):
Clang_(new CompilerInstance{}),
DiagOpts_(new DiagnosticOptions{}),
DiagID_(new DiagnosticIDs{}),
ErrorMsgStream_(ErrorMsg_),
VFS_(new llvm::vfs::InMemoryFileSystem{}),
Opts_(Opts)
{
TextDiagnosticPrinter *DiagClient =
new TextDiagnosticPrinter{ErrorMsgStream_, &*DiagOpts_};
Diags_ = new DiagnosticsEngine{DiagID_, &*DiagOpts_, DiagClient, true};
// Add an overleay with our virtual file system on top of the system!
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> Overlay(new llvm::vfs::OverlayFileSystem{vfs::getRealFileSystem()});
Overlay->pushOverlay(VFS_);
// Finally add clang's ressources
Overlay->pushOverlay(getClangResFileSystem());
const auto TripleStr = llvm::sys::getProcessTriple();
Driver_.reset(new driver::Driver{"dummy", TripleStr, *Diags_, Overlay});
Driver_->setTitle("clang interpreter");
Driver_->setCheckInputsExist(false);
const char* ResDir = getClangResRootDirectory();
SmallVector<const char*, 17> Args = {"dffi",
Opts.hasCXX() ? "dummy.cpp" : "dummy.c",
"-fsyntax-only", "-resource-dir", ResDir};
const auto Sysroot = Opts.getSysroot();
if (!Sysroot.empty()) {
Args.push_back("--sysroot");
Args.push_back(Sysroot.c_str());
}
for (auto const& D: Opts.IncludeDirs) {
Args.push_back("-I");
Args.push_back(D.c_str());
}
std::unique_ptr<driver::Compilation> C(Driver_->BuildCompilation(Args));
if (!C) {
unreachable("unable to instantiate clang");
}
const driver::JobList &Jobs = C->getJobs();
if (Jobs.size() != 1 || !isa<driver::Command>(*Jobs.begin())) {
SmallString<256> Msg;
llvm::raw_svector_ostream OS(Msg);
Jobs.Print(OS, "; ", true);
unreachable(OS.str().str().c_str());
}
const driver::Command &Cmd = cast<driver::Command>(*Jobs.begin());
if (llvm::StringRef(Cmd.getCreator().getName()) != "clang") {
Diags_->Report(diag::err_fe_expected_clang_command);
unreachable("bad command");
}
// Initialize a compiler invocation object from the clang (-cc1) arguments.
const llvm::opt::ArgStringList &CCArgs = Cmd.getArguments();
std::unique_ptr<CompilerInvocation> pCI(new CompilerInvocation{});
CompilerInvocation::CreateFromArgs(*pCI, CCArgs, *Diags_);
auto& CI = *pCI;
auto& TO = CI.getTargetOpts();
TO.Triple = TripleStr;
// We create it by hand to have a minimal user-friendly API!
auto& CGO = CI.getCodeGenOpts();
CGO.OptimizeSize = false;
CGO.OptimizationLevel = Opts.OptLevel;
CGO.CodeModel = "default";
CGO.RelocationModel = llvm::Reloc::PIC_;
CGO.ThreadModel = "posix";
// We use debug info for type recognition!
CGO.setDebugInfo(codegenoptions::FullDebugInfo);
CI.getDiagnosticOpts().ShowCarets = false;
CI.getLangOpts()->LineComment = true;
CI.getLangOpts()->Optimize = true;
CI.getLangOpts()->C99 = !Opts.hasCXX();
CI.getLangOpts()->C11 = !Opts.hasCXX();
CI.getLangOpts()->CPlusPlus = Opts.hasCXX();
CI.getLangOpts()->CPlusPlus11 = Opts.CXX >= CXXMode::Std11;
CI.getLangOpts()->CPlusPlus14 = Opts.CXX >= CXXMode::Std14;
CI.getLangOpts()->CPlusPlus17 = Opts.CXX >= CXXMode::Std17;
CI.getLangOpts()->CPlusPlus20 = Opts.CXX >= CXXMode::Std20;
CI.getLangOpts()->CXXExceptions = false;
CI.getLangOpts()->CXXOperatorNames = Opts.hasCXX();
CI.getLangOpts()->Bool = Opts.hasCXX();
CI.getLangOpts()->WChar = Opts.hasCXX(); // builtin in C++, typedef in C (stddef.h)
CI.getLangOpts()->EmitAllDecls = true;
const bool IsWinMSVC = Triple{TO.Triple}.isWindowsMSVCEnvironment();
CI.getLangOpts()->MSVCCompat = IsWinMSVC;
CI.getLangOpts()->MicrosoftExt = IsWinMSVC;
CI.getLangOpts()->AsmBlocks = IsWinMSVC;
CI.getLangOpts()->DeclSpecKeyword = IsWinMSVC;
CI.getLangOpts()->MSBitfields = IsWinMSVC;
// gnu compatibility
CI.getLangOpts()->GNUMode = Opts.GNUExtensions;
CI.getLangOpts()->GNUKeywords = Opts.GNUExtensions;
CI.getLangOpts()->GNUAsm = Opts.GNUExtensions;
CI.getFrontendOpts().ProgramAction = frontend::EmitLLVMOnly;
Clang_->setInvocation(std::move(pCI));
Clang_->setDiagnostics(&*Diags_);
assert(Clang_->hasDiagnostics());
FileMgr_ = new FileManager(Clang_->getFileSystemOpts(), std::move(Overlay));
Clang_->createSourceManager(*FileMgr_);
Clang_->setFileManager(FileMgr_.get());
// Intialize execution engine!
std::string Error;
const llvm::Target *Tgt = TargetRegistry::lookupTarget(TO.Triple, Error);
if (!Tgt) {
std::stringstream ss;
ss << "unable to find native target: " << Error << "!";
unreachable(ss.str().c_str());
}
std::unique_ptr<llvm::Module> DummyM(new llvm::Module{"DummyM",Ctx_});
DummyM->setTargetTriple(TO.Triple);
EngineBuilder EB(std::move(DummyM));
EB.setEngineKind(EngineKind::JIT)
.setErrorStr(&Error)
.setOptLevel(CodeGenOpt::Default)
.setRelocationModel(Reloc::Static);
SmallVector<std::string, 1> Attrs;
// TODO: get the target machine from clang?
EE_.reset(EB.create());
if (!EE_) {
std::stringstream ss;
ss << "error creating jit: " << Error;
unreachable(ss.str().c_str());
}
}
void DFFIImpl::resetDiagnostics()
{
auto& Diag = Clang_->getDiagnostics();
Diag.Reset();
Diag.getClient()->clear();
}
void DFFIImpl::getCompileError(std::string& Err)
{
ErrorMsgStream_.flush();
Err = std::move(ErrorMsg_);
ErrorMsg_ = std::string{};
}
std::unique_ptr<llvm::Module> DFFIImpl::compile_llvm_with_decls(StringRef const Code, StringRef const CUName, FuncAliasesMap& FuncAliases, std::string& Err)
{
// Two pass compilation!
// First pass parse the AST of clang and generate wrappers for every
// defined-only functions. Second pass generates the LLVM IR of the original
// code with these definitions!
const bool hasCXX = Opts_.hasCXX();
auto& CI = Clang_->getInvocation();
CI.getFrontendOpts().Inputs.clear();
CI.getFrontendOpts().Inputs.push_back(
FrontendInputFile(CUName, hasCXX ? Language::CXX : Language::C));
auto Buf = MemoryBuffer::getMemBufferCopy(Code);
VFS_->addFile(CUName, time(NULL), std::move(Buf));
auto Action = std::make_unique<ASTGenWrappersAction>(FuncAliases);
if(!Clang_->ExecuteAction(*Action)) {
getCompileError(Err);
resetDiagnostics();
return nullptr;
}
resetDiagnostics();
auto BufForceDecl = Code.str() + "\n";
if (hasCXX) BufForceDecl += "extern \"C\" {\n";
BufForceDecl += Action->forceDecls();
if (hasCXX) BufForceDecl += "\n}\n";
SmallString<128> PrivateCU;
("/__dffi_private/force_decls/" + CUName).toStringRef(PrivateCU);
return compile_llvm(BufForceDecl, PrivateCU, Err);
}
std::unique_ptr<llvm::Module> DFFIImpl::compile_llvm(StringRef const Code, StringRef const CUName, std::string& Err)
{
// DiagnosticsEngine->Reset() does not seem to reset everything, as errors
// are added up from other compilation units!
auto Buf = MemoryBuffer::getMemBufferCopy(Code);
auto& CI = Clang_->getInvocation();
CI.getFrontendOpts().Inputs.clear();
CI.getFrontendOpts().Inputs.push_back(
FrontendInputFile(CUName, Opts_.hasCXX() ? Language::CXX : Language::C));
VFS_->addFile(CUName, time(NULL), std::move(Buf));
auto LLVMAction = std::make_unique<clang::EmitLLVMOnlyAction>(&Ctx_);
if(!Clang_->ExecuteAction(*LLVMAction)) {
getCompileError(Err);
resetDiagnostics();
return nullptr;
}
resetDiagnostics();
return LLVMAction->takeModule();
}
void getFuncWrapperName(SmallVectorImpl<char>& Ret, StringRef const Name)
{
(WrapperPrefix + Name).toVector(Ret);
}
StringRef getFuncNameFromWrapper(StringRef const Name)
{
assert(isWrapperFunction(Name));
return Name.substr(strlen(WrapperPrefix));
}
bool isWrapperFunction(StringRef const Name)
{
return Name.startswith(WrapperPrefix);
}
DFFIImpl::~DFFIImpl()
{ }
std::pair<size_t, bool> DFFIImpl::getFuncTypeWrapperId(FunctionType const* FTy)
{
size_t TyIdx = WrapperIdx_;
auto Ins = FuncTyWrappers_.try_emplace(FTy, TyIdx);
if (!Ins.second) {
return {Ins.first->second, true};
}
++WrapperIdx_;
return {TyIdx, false};
}
std::pair<size_t, bool> DFFIImpl::getFuncTypeWrapperId(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
size_t TyIdx = WrapperIdx_;
auto Ins = VarArgsFuncTyWrappers_.try_emplace(std::make_pair(FTy, VarArgs), TyIdx);
if (!Ins.second) {
return {Ins.first->second, true};
}
++WrapperIdx_;
return {TyIdx, false};
}
void DFFIImpl::genFuncTypeWrapper(TypePrinter& P, size_t WrapperIdx, llvm::raw_string_ostream& ss, FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
ss << "void " << getWrapperName(WrapperIdx) << "(";
auto RetTy = FTy->getReturnType();
P.print_def(ss, getPointerType(FTy), TypePrinter::Full, "__FPtr") << ",";
P.print_def(ss, getPointerType(RetTy), TypePrinter::Full, "__Ret") << ",";
ss << "void** __Args) {\n ";
if (RetTy) {
ss << "*__Ret = ";
}
ss << "(__FPtr)(";
size_t Idx = 0;
auto& Params = FTy->getParams();
for (QualType ATy: Params) {
ss << "*((";
P.print_def(ss, getPointerType(ATy), TypePrinter::Full) << ')' << "__Args[" << Idx << ']' << ')';
if (Idx < Params.size()-1) {
ss << ',';
}
++Idx;
}
if (VarArgs.size() > 0) {
assert(FTy->hasVarArgs() && "function type must be variadic if VarArgsCount > 0");
assert(Params.size() >= 1 && "variadic arguments must have at least one defined argument");
for (Type const* Ty: VarArgs) {
ss << ", *((";
P.print_def(ss, getPointerType(Ty), TypePrinter::Full) << ')' << "__Args[" << Idx << ']' << ')';
++Idx;
}
}
ss << ");\n}\n";
}
CUImpl* DFFIImpl::compile(StringRef const Code, StringRef CUName, bool IncludeDefs, std::string& Err, bool UseLastError)
{
std::string AnonCUName;
if (CUName.empty()) {
AnonCUName = "/__dffi_private/anon_cu_" + std::to_string(CUIdx_++) + (Opts_.hasCXX() ? ".cpp":".c");
CUName = AnonCUName;
}
#ifdef _WIN32
else {
// TODO: figure out why!
Err = "named compilation unit does not work on Windows!";
return nullptr;
}
#endif
std::unique_ptr<llvm::Module> M;
std::unique_ptr<CUImpl> CU(new CUImpl{*this});
if (IncludeDefs) {
M = compile_llvm_with_decls(Code, CUName, CU->FuncAliases_, Err);
}
else {
M = compile_llvm(Code, CUName, Err);
}
if (!M) {
return nullptr;
}
auto* pM = M.get();
// Pre-parse metadata in two passes to find and declare structures
// First pass will declare every structure as opaque ones. Next pass defines the ones which are.
DebugInfoFinder DIF;
DIF.processModule(*pM);
SmallVector<DICompositeType const*, 16> Composites;
SmallVector<DIDerivedType const*, 16> Typedefs;
for (DIType const* Ty: DIF.types()) {
if (Ty == nullptr) {
continue;
}
if (auto const* DTy = llvm::dyn_cast<DIDerivedType>(Ty)) {
if (DTy->getTag() == dwarf::DW_TAG_typedef) {
Typedefs.push_back(DTy);
}
}
else {
Ty = getCanonicalDIType(Ty);
if (auto const* CTy = llvm::dyn_cast<DICompositeType>(Ty)) {
auto Tag = Ty->getTag();
if (Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type || Tag == dwarf::DW_TAG_enumeration_type) {
Composites.push_back(CTy);
CU->declareDIComposite(CTy);
}
}
}
}
// Parse structures and unions
for (DICompositeType const* Ty: Composites) {
CU->parseDIComposite(Ty, *M);
}
CU->inlineCompositesAnonymousMembers();
for (auto const* DTy: Typedefs) {
// TODO: optimize this! We could add the visited typedefs in the alias list
// as long as we traverse it, and remove them from the list of typedefs to
// visit.
CU->setAlias(DTy->getName(), CU->getTypeFromDIType(DTy));
}
// Generate function types
std::string Buf;
llvm::raw_string_ostream Wrappers(Buf);
TypePrinter Printer;
SmallVector<Function*, 16> ToRemove;
const bool hasCXX = Opts_.hasCXX();
for (Function& F: *M) {
if (F.isIntrinsic())
continue;
if (hasCXX && !F.getSubprogram()->getLinkageName().empty())
continue;
StringRef FName = F.getName();
const bool ForceDecl = FName.startswith("__dffi_force_decl_");
const bool ForceTypedef = FName.startswith("__dffi_force_typedef");
if (!ForceDecl && !ForceTypedef && F.doesNotReturn())
continue;
if (ForceTypedef) {
ToRemove.push_back(&F);
continue;
}
auto* DFTy = CU->getFunctionType(F, UseLastError);
if (!DFTy)
continue;
if (ForceDecl) {
FName = FName.substr(strlen("__dffi_force_decl_"));
ToRemove.push_back(&F);
}
else {
if (FName.size() > 0 && FName[0] == 1) {
// Clang emits the "\01" prefix in some cases, when ASM function
// redirects are used!
F.setName(FName.substr(1));
FName = F.getName();
}
CU->parseFunctionAlias(F);
}
CU->FuncTys_[FName] = DFTy;
if (!Opts_.LazyJITWrappers) {
auto Id = getFuncTypeWrapperId(DFTy);
if (!Id.second) {
// TODO: if varag, do we always generate the wrapper for the version w/o varargs?
genFuncTypeWrapper(Printer, Id.first, Wrappers, DFTy, {});
}
}
}
for (Function* F: ToRemove) {
F->eraseFromParent();
}
// Strip debug info (we don't need them anymore)!
llvm::StripDebugInfo(*pM);
// Add the module to the EE
EE_->addModule(std::move(M));
EE_->generateCodeForModule(pM);
// Compile wrappers
compileWrappers(Printer, Wrappers.str());
// We don't need these anymore
CU->AnonTys_.clear();
auto* Ret = CU.get();
CUs_.emplace_back(std::move(CU));
return Ret;
}
void DFFIImpl::compileWrappers(TypePrinter& Printer, std::string const& Wrappers)
{
auto& CI = Clang_->getInvocation();
CI.getLangOpts()->CPlusPlus = false;
CI.getLangOpts()->C99 = true;
CI.getLangOpts()->C11 = true;
auto& CGO = CI.getCodeGenOpts();
std::string WCode = Printer.getDecls() + "\n" + Wrappers;
std::stringstream ss;
ss << "/__dffi_private/wrappers_" << CUIdx_++ << ".c";
CGO.setDebugInfo(codegenoptions::NoDebugInfo);
std::string Err;
auto M = compile_llvm(WCode, ss.str(), Err);
CGO.setDebugInfo(codegenoptions::FullDebugInfo);
if (!M) {
errs() << WCode;
errs() << Err;
llvm::report_fatal_error("unable to compile wrappers!");
}
auto* pM = M.get();
EE_->addModule(std::move(M));
EE_->generateCodeForModule(pM);
CI.getLangOpts()->CPlusPlus = Opts_.hasCXX();
CI.getLangOpts()->C99 = !Opts_.hasCXX();
CI.getLangOpts()->C11 = !Opts_.hasCXX();
}
void* DFFIImpl::getWrapperAddress(FunctionType const* FTy)
{
// TODO: merge with getWrapperAddress for varargs
auto Id = getFuncTypeWrapperId(FTy);
size_t WIdx = Id.first;
if (!Id.second) {
std::string Buf;
llvm::raw_string_ostream ss(Buf);
TypePrinter P;
genFuncTypeWrapper(P, WIdx, ss, FTy, None);
compileWrappers(P, ss.str());
}
std::string TName = getWrapperName(WIdx);
void* Ret = (void*)EE_->getFunctionAddress(TName.c_str());
assert(Ret && "function wrapper does not exist!");
return Ret;
}
Function* DFFIImpl::getWrapperLLVMFunc(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
// TODO: suboptimal. Lookup of the wrapper ID is done twice, and the full
// compilation of the wrapper is done, whereas it might not be necessary!
getWrapperAddress(FTy);
std::pair<size_t, bool> Id;
if (FTy->hasVarArgs()) {
Id = getFuncTypeWrapperId(FTy, VarArgs);
}
else {
assert(VarArgs.size() == 0 && "VarArgs specified when function type doesn't support variadic arguments");
Id = getFuncTypeWrapperId(FTy);
}
assert(Id.second && "wrapper should already exist!");
std::string TName = getWrapperName(Id.first);
return EE_->FindFunctionNamed(TName);
}
void* DFFIImpl::getWrapperAddress(FunctionType const* FTy, ArrayRef<Type const*> VarArgs)
{
auto Id = getFuncTypeWrapperId(FTy, VarArgs);
size_t WIdx = Id.first;
if (!Id.second) {
std::string Buf;
llvm::raw_string_ostream ss(Buf);
TypePrinter P;
genFuncTypeWrapper(P, WIdx, ss, FTy, VarArgs);
compileWrappers(P, ss.str());
}
std::string TName = getWrapperName(WIdx);
void* Ret = (void*)EE_->getFunctionAddress(TName.c_str());
assert(Ret && "function wrapper does not exist!");
return Ret;
}
void* DFFIImpl::getFunctionAddress(StringRef Name)
{
// TODO: chances that this is clearly sub optimal
// TODO: use getAddressToGlobalIfAvailable?
Function* F = EE_->FindFunctionNamed(Name);
const std::string NameStr = Name.str();
if (!F || F->isDeclaration()) {
return sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr);
}
return (void*)EE_->getFunctionAddress(NameStr);
#if 0
// TODO: we would like to be able to do this! Unfortunatly, MCJIT API is
// private...
auto Sym = EE_->findSymbol(Name.str(), true);
if (!Sym) {
return nullptr;
}
auto AddrOrErr = Sym.getAddress();
if (!AddrOrErr) {
return nullptr;
}
return (void*)(*AddrOrErr);
#endif
}
NativeFunc DFFIImpl::getFunction(FunctionType const* FTy, void* FPtr)
{
auto TFPtr = (NativeFunc::TrampPtrTy)getWrapperAddress(FTy);
assert(TFPtr && "function type trampoline doesn't exist!");
return {TFPtr, FPtr, FTy};
}
// TODO: QualType here!
NativeFunc DFFIImpl::getFunction(FunctionType const* FTy, ArrayRef<Type const*> VarArgs, void* FPtr)
{
if (!FTy->hasVarArgs()) {
return NativeFunc{};
}
auto TFPtr = (NativeFunc::TrampPtrTy)getWrapperAddress(FTy, VarArgs);
// Generates new function type for this list of variadic arguments
SmallVector<QualType, 8> Types;
auto const& Params = FTy->getParams();
Types.reserve(Params.size() + VarArgs.size());
for (auto const& P: Params) {
Types.emplace_back(P.getType());
}
for (auto T: VarArgs) {
Types.emplace_back(T);
}
FTy = getContext().getFunctionType(*this, FTy->getReturnType(), Types, FTy->getCC(), false, FTy->useLastError());
return {TFPtr, FPtr, FTy};
}
BasicType const* DFFIImpl::getBasicType(BasicType::BasicKind K)
{
return getContext().getBasicType(*this, K);
}
PointerType const* DFFIImpl::getPointerType(QualType Ty)
{
return getContext().getPtrType(*this, Ty);
}
ArrayType const* DFFIImpl::getArrayType(QualType Ty, uint64_t NElements)
{
return getContext().getArrayType(*this, Ty, NElements);
}
// Compilation unit
//
CUImpl::CUImpl(DFFIImpl& DFFI):
DFFI_(DFFI)
{ }
std::tuple<void*, FunctionType const*> CUImpl::getFunctionAddressAndTy(llvm::StringRef Name)
{
auto ItAlias = FuncAliases_.find(Name);
if (ItAlias != FuncAliases_.end()) {
Name = ItAlias->second;
}
auto ItFTy = FuncTys_.find(Name);
if (ItFTy == FuncTys_.end()) {
return std::tuple<void*, FunctionType const*>{nullptr,nullptr};
}
return std::tuple<void*, FunctionType const*>{DFFI_.getFunctionAddress(Name), ItFTy->second};
}
NativeFunc CUImpl::getFunction(llvm::StringRef Name)
{
void* FPtr;
FunctionType const* FTy;
std::tie(FPtr, FTy) = getFunctionAddressAndTy(Name);
return getFunction(FPtr, FTy);
}
NativeFunc CUImpl::getFunction(llvm::StringRef Name, llvm::ArrayRef<Type const*> VarArgs)
{
void* FPtr;
FunctionType const* FTy;
std::tie(FPtr, FTy) = getFunctionAddressAndTy(Name);
return getFunction(FPtr, FTy, VarArgs);
}
NativeFunc CUImpl::getFunction(void* FPtr, FunctionType const* FTy, llvm::ArrayRef<Type const*> VarArgs)
{
if (!FPtr || !FTy) {
return {};
}
return DFFI_.getFunction(FTy, VarArgs, FPtr);
}
NativeFunc CUImpl::getFunction(void* FPtr, FunctionType const* FTy)
{
if (!FPtr || !FTy) {
return {};
}
return DFFI_.getFunction(FTy, FPtr);
}
template <class T>
static T const* getCompositeType(CompositeTysMap const& Tys, StringRef Name)
{
auto It = Tys.find(Name);
if (It == Tys.end()) {
return nullptr;
}
return dffi::dyn_cast<T>(It->second.get());
}
StructType const* CUImpl::getStructType(StringRef Name) const
{
return getCompositeType<StructType>(CompositeTys_, Name);
}
UnionType const* CUImpl::getUnionType(StringRef Name) const
{
return getCompositeType<UnionType>(CompositeTys_, Name);
}
EnumType const* CUImpl::getEnumType(StringRef Name) const
{
return getCompositeType<EnumType>(CompositeTys_, Name);
}
std::vector<std::string> CUImpl::getTypes() const
{
std::vector<std::string> Ret;
Ret.reserve(CompositeTys_.size() + AliasTys_.size());
for (auto const& C: CompositeTys_) {
Ret.emplace_back(C.getKey().str());
}
for (auto const& C: AliasTys_) {
Ret.emplace_back(C.getKey().str());
}
return Ret;
}
std::vector<std::string> CUImpl::getFunctions() const
{
std::vector<std::string> Ret;
Ret.reserve(FuncTys_.size() + FuncAliases_.size());
for (auto const& C: FuncTys_) {
Ret.emplace_back(C.getKey().str());
}
for (auto const& C: FuncAliases_) {
Ret.emplace_back(C.getKey().str());
}
return Ret;
}
void CUImpl::declareDIComposite(DICompositeType const* DCTy)
{
const auto Tag = DCTy->getTag();
assert((Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type ||
Tag == dwarf::DW_TAG_enumeration_type) && "declareDIComposite called without a valid type!");
StringRef Name = DCTy->getName();
auto AddTy = [&](StringRef Name_) {
CanOpaqueType* Ptr;
switch (Tag) {
case dwarf::DW_TAG_structure_type:
Ptr = new StructType{DFFI_};
break;
case dwarf::DW_TAG_union_type:
Ptr = new UnionType{DFFI_};
break;
case dwarf::DW_TAG_enumeration_type:
Ptr = new EnumType{DFFI_};
break;
};
return CompositeTys_.try_emplace(Name_, std::unique_ptr<CanOpaqueType>{Ptr});
};
if (Name.size() > 0) {
// Sets the struct as an opaque one.
if (Name.startswith("__dffi")) {
llvm::report_fatal_error("__dffi is a compiler reserved prefix and can't be used in a structure name!");
}
auto It = AddTy(Name);
It.first->getValue()->addName(It.first->getKeyData());
}
else {
// Add to the map of anonymous types, and generate a name
if (AnonTys_.count(DCTy) == 1) {
return;
}
auto ID = AnonTys_.size() + 1;
std::stringstream ss;
ss << "__dffi_anon_struct_" << ID;
auto It = AddTy(ss.str());
assert(It.second && "anonymous structure ID already existed!!");
AnonTys_[DCTy] = It.first->second.get();
}
}
void CUImpl::parseDIComposite(DICompositeType const* DCTy, llvm::Module& M)
{
// C++ type, we don't support this!
if (!DCTy->getIdentifier().empty()) {
return;
}
const auto Tag = DCTy->getTag();
assert((Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type ||
Tag == dwarf::DW_TAG_enumeration_type) && "parseDIComposite called without a valid type!");
StringRef Name = DCTy->getName();
dffi::CanOpaqueType* CATy;
if (Name.size() > 0) {
auto It = CompositeTys_.find(Name);
assert(It != CompositeTys_.end() && "structure/union/enum hasn't been previously declared!");
CATy = It->second.get();
}
else {
auto It = AnonTys_.find(DCTy);
assert(It != AnonTys_.end() && "anonymous structure/union/enum hasn't been previously declared!");
CATy = dffi::cast<dffi::CanOpaqueType>(It->second);
}
// If the structure/union isn't know yet, this sets the composite type as an
// opaque one. This can be useful if the type is self-referencing
// itself throught a pointer (classical case in linked list for instance).
if (DCTy->isForwardDecl()) {
// Nothing new here!
return;
}
if (!CATy->isOpaque()) {
return;
}
if (auto* CTy = dffi::dyn_cast<CompositeType>(CATy)) {
// Parse the structure/union and create the associated StructType/UnionType
std::vector<CompositeField> Fields;
unsigned Align = 1;
size_t AnonIdx = 0;
for (auto const* Op: DCTy->getElements()) {
auto const* DOp = llvm::cast<DIDerivedType>(Op);
assert(DOp->getTag() == llvm::dwarf::DW_TAG_member && "element of a struct/union must be a DW_TAG_member!");
std::string FName;
{
StringRef S = DOp->getName();
if (!S.empty()) {
FName = S.str();
}
else {
FName = std::string{"__dffi_anon_"} + std::to_string(AnonIdx++);
}
}
unsigned FOffset = DOp->getOffsetInBits()/8;
#ifndef NDEBUG
if (DCTy->getTag() == dwarf::DW_TAG_union_type) {
assert(FOffset == 0 && "union field member must have an offset of 0!");
}
#endif
DIType const* FDITy = getCanonicalDIType(DOp->getBaseType());
dffi::Type const* FTy = getTypeFromDIType(FDITy);
Fields.emplace_back(CompositeField{FName.c_str(), FTy, FOffset});
Align = std::max(Align, FTy->getAlign());
}
auto Size = DCTy->getSizeInBits()/8;
CTy->setBody(std::move(Fields), Size, Align);
}
else {
auto* ETy = dffi::cast<EnumType>(CATy);
EnumType::Fields Fields;
for (auto const* Op: DCTy->getElements()) {
auto const* EOp = llvm::cast<DIEnumerator>(Op);
const APInt Val = EOp->getValue();
assert(Val.isSignedIntN(sizeof(int)*8) && "enum whose value isn't an int");
Fields[EOp->getName().str()] = Val.getSExtValue();
}
ETy->setBody(std::move(Fields));
}
}
dffi::QualType CUImpl::getQualTypeFromDIType(llvm::DIType const* Ty)
{
// Go throught every typedef and returns the qualified type
if (auto* DTy = llvm::dyn_cast_or_null<DIDerivedType>(Ty)) {
switch (DTy->getTag()) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_volatile_type:
case dwarf::DW_TAG_restrict_type:
return getQualTypeFromDIType(DTy->getBaseType());
case dwarf::DW_TAG_const_type:
return getQualTypeFromDIType(DTy->getBaseType()).withConst();
default:
break;
};
}
return getTypeFromDIType(Ty);
}
dffi::Type const* CUImpl::getTypeFromDIType(llvm::DIType const* Ty)
{
Ty = getCanonicalDIType(Ty);
if (!Ty) {
return nullptr;
}
if (auto* BTy = llvm::dyn_cast<llvm::DIBasicType>(Ty)) {
#define HANDLE_BASICTY(TySize, KTy)\
if (Size == TySize)\
return DFFI_.getBasicType(BasicType::getKind<KTy>());
const auto Size = BTy->getSizeInBits();
switch (BTy->getEncoding()) {
case llvm::dwarf::DW_ATE_boolean:
return DFFI_.getBasicType(BasicType::Bool);
case llvm::dwarf::DW_ATE_unsigned:
case llvm::dwarf::DW_ATE_unsigned_char:
{
if (BTy->getName() == "char") {
return DFFI_.getBasicType(BasicType::Char);
}
HANDLE_BASICTY(8, uint8_t);
HANDLE_BASICTY(16, uint16_t);
HANDLE_BASICTY(32, uint32_t);
HANDLE_BASICTY(64, uint64_t);
#ifdef DFFI_SUPPORT_I128
HANDLE_BASICTY(128, __uint128_t);
#endif
break;
}
case llvm::dwarf::DW_ATE_signed:
case llvm::dwarf::DW_ATE_signed_char:
{
if (BTy->getName() == "char") {
return DFFI_.getBasicType(BasicType::Char);
}
HANDLE_BASICTY(8, int8_t);
HANDLE_BASICTY(16, int16_t);
HANDLE_BASICTY(32, int32_t);
HANDLE_BASICTY(64, int64_t);
#ifdef DFFI_SUPPORT_I128
HANDLE_BASICTY(128, __int128_t);
#endif
break;
}
case llvm::dwarf::DW_ATE_float:
HANDLE_BASICTY(sizeof(float)*8, c_float);
HANDLE_BASICTY(sizeof(double)*8, c_double);
HANDLE_BASICTY(sizeof(long double)*8, c_long_double);
break;
#ifdef DFFI_SUPPORT_COMPLEX
case llvm::dwarf::DW_ATE_complex_float:
HANDLE_BASICTY(sizeof(_Complex float)*8, c_complex_float);
HANDLE_BASICTY(sizeof(_Complex double)*8, c_complex_double);
HANDLE_BASICTY(sizeof(_Complex long double)*8, c_complex_long_double);
break;
#endif
default:
return nullptr;
};
}
if (auto* PtrTy = llvm::dyn_cast<llvm::DIDerivedType>(Ty)) {
// C++ type, not supported
const auto Tag = PtrTy->getTag();
if (Tag == llvm::dwarf::DW_TAG_pointer_type) {
auto Pointee = getQualTypeFromDIType(PtrTy->getBaseType());
return getPointerType(Pointee);
}
if (Tag == llvm::dwarf::DW_TAG_reference_type) {
// C++ type, not supported
return nullptr;
}
#ifdef LLVM_BUILD_DEBUG
Ty->dump();
#endif
llvm::report_fatal_error("unsupported type");
}
if (auto* DTy = llvm::dyn_cast<DICompositeType>(Ty)) {
// C++ type, not supported
if (!DTy->getIdentifier().empty()) {
return nullptr;
}
const auto Tag = DTy->getTag();
switch (Tag) {
case llvm::dwarf::DW_TAG_structure_type:
case llvm::dwarf::DW_TAG_union_type:
case llvm::dwarf::DW_TAG_enumeration_type:
{
StringRef Name = DTy->getName();
if (Name.size() == 0) {
auto It = AnonTys_.find(DTy);
if (It == AnonTys_.end()) {
llvm::report_fatal_error("unknown literal struct/union/enum!");
}
return It->second;
}
auto It = CompositeTys_.find(Name);
if (It == CompositeTys_.end()) {
llvm::report_fatal_error("unknown struct/union/enum!");
}
return It->second.get();
}
case llvm::dwarf::DW_TAG_array_type:
{
auto EltTy = getQualTypeFromDIType(DTy->getBaseType());
auto Count = llvm::cast<DISubrange>(*DTy->getElements().begin())->getCount();
if (auto* CCount = Count.dyn_cast<ConstantInt*>()) {
return DFFI_.getArrayType(EltTy, CCount->getZExtValue());
}
else {
return getPointerType(EltTy);
}
}
};
}
if (auto* FTy = llvm::dyn_cast<DISubroutineType>(Ty)) {
return getFunctionType(FTy, false /* UseLastError */);
}
#ifdef LLVM_BUILD_DEBUG
Ty->dump();
#endif
llvm::report_fatal_error("unsupported type");
}
dffi::FunctionType const* CUImpl::getFunctionType(DISubroutineType const* Ty, bool UseLastError)
{
auto ArrayTys = Ty->getTypeArray();
auto ItTy = ArrayTys.begin();
auto RetTy = getQualTypeFromDIType((*(ItTy++)));
llvm::SmallVector<QualType, 8> ParamsTy;
ParamsTy.reserve(ArrayTys.size()-1);
for (auto ItEnd = ArrayTys.end(); ItTy != ItEnd; ++ItTy) {
auto ATy = getQualTypeFromDIType((*ItTy));
ParamsTy.push_back(ATy);
}
bool IsVarArgs = false;
if (ParamsTy.size() > 1 && ParamsTy.back().getType() == nullptr) {
IsVarArgs = true;
ParamsTy.pop_back();
}
auto CC = dwarfCCToDFFI(Ty->getCC());
return getContext().getFunctionType(DFFI_, RetTy, ParamsTy, CC, IsVarArgs, UseLastError);
}
void CUImpl::parseFunctionAlias(Function& F)
{
MDNode* MD = F.getMetadata("dbg");
if (!MD) {
return;
}
// See tests/asm_redirect.cpp. The name of the DISubprogram object can be
// different from the LLVM function name! Let's register the debug info name
// as an alias to the llvm one.
auto* SP = llvm::cast<DISubprogram>(MD);
auto AliasName = SP->getName();
if (AliasName != F.getName()) {
assert(FuncTys_.count(AliasName) == 0 && "function alias already defined!");
assert(FuncAliases_.count(AliasName) == 0 && "function alias already in alias list!");
FuncAliases_[AliasName] = F.getName().str();
}
}
dffi::FunctionType const* CUImpl::getFunctionType(Function& F, bool UseLastError)
{
MDNode* MD = F.getMetadata("dbg");
if (!MD) {
return nullptr;
}
auto* SP = llvm::cast<DISubprogram>(MD);
auto* Ty = llvm::cast<DISubroutineType>(SP->getType());
return getFunctionType(Ty, UseLastError);
}
dffi::Type const* CUImpl::getType(StringRef Name) const
{
{
auto It = AliasTys_.find(Name);
if (It != AliasTys_.end())
return It->second;
}
{
auto It = CompositeTys_.find(Name);
if (It != CompositeTys_.end())
return It->second.get();
}
return nullptr;
}
} // details
} // dffi
| 30.909628 | 156 | 0.672268 | kamino |
55ef13ffe7397e3cd0f9122590867242ec7e6615 | 1,165 | cpp | C++ | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | UnionFind and Kruskal/1160.cpp | enricava/Competitive-Programming | ea39f5c74acc2202f3933f693f6d7f03f5435391 | [
"MIT"
] | null | null | null | #include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <utility>
#include <queue>
using namespace std;
int MAX = 100000;
struct UFDS {
vector<int> p;
int numSets;
UFDS(int n) : p(n, 0), numSets(n) {
for (int i = 0; i < n; ++i) p[i] = i;
}
int find(int x) {
return (p[x] == x) ? x : p[x] = find(p[x]);
}
void merge(int x, int y) {
int i = find(x), j = find(y);
if (i == j) return;
p[i] = j;
--numSets;
}
};
bool resolverCaso() {
int a, b;
cin >> a;
if (!cin) return false;
int c = 0;
UFDS uf(MAX);
while (a != -1) {
cin >> b;
if (uf.find(a) != uf.find(b))
uf.merge(a, b);
else c++;
cin >> a;
}
cout << c << '\n';
cin.ignore();
return true;
}
int main() {
#ifndef DOMJUDGE
std::ifstream in("datos.txt");
std::ofstream out("salida.txt");
auto cinbuf = std::cin.rdbuf(in.rdbuf());
auto coutbuf = std::cout.rdbuf(out.rdbuf());
#endif
while (resolverCaso());
#ifndef DOMJUDGE
std::cin.rdbuf(cinbuf);
std::cout.rdbuf(coutbuf);
system("PAUSE");
#endif
return 0;
} | 17.651515 | 46 | 0.549356 | enricava |
55f8c49ba682152823f34a8e664ed909846c13d9 | 298 | hpp | C++ | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | null | null | null | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | 1 | 2017-04-21T16:18:44.000Z | 2017-04-21T16:18:44.000Z | include/lilypad.hpp | yt-siden/lilypad | 38f3000675b1ac2e350c70157bd31cf58f105b87 | [
"MIT"
] | null | null | null | #ifndef LILYPAD_HPP
#define LILYPAD_HPP
#include "lilypad/info.hpp"
#include "lilypad/global.hpp"
#include "lilypad/communicator.hpp"
#include "lilypad/multivector.hpp"
#include "lilypad/localmatrix.hpp"
#include "lilypad/mkl_wrapper.hpp"
#include "lilypad/cholesky_qr.hpp"
#endif // LILYPAD_HPP
| 22.923077 | 35 | 0.788591 | yt-siden |
55f92026527a5d536ca73a29c5aaee8d5095dda9 | 4,723 | cpp | C++ | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/university | 5561969b1b11678228aaf7e6660e8b1a93d10294 | [
"WTFPL"
] | 1 | 2018-06-03T17:48:50.000Z | 2018-06-03T17:48:50.000Z | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | null | null | null | discrete-maths/languages/i_fastminimization.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | 14 | 2019-04-07T21:27:09.000Z | 2021-12-05T13:37:25.000Z | #include <fstream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_set>
using namespace std;
struct vertex {
int index;
bool accept, reach, reachable;
int transitions[26];
vector<int> back[26];
vertex() {
for (int i = 0; i < 26; ++i)
transitions[i] = -1;
}
};
vector<pair<int, int>>* tr;
vector<int>* b;
vertex* dka;
int main() {
ifstream fin("fastminimization.in");
int n, m, k, from, to;
char c;
fin >> n >> m >> k;
dka = new vertex[n];
tr = new vector<pair<int, int>>[n];
b = new vector<int>[n];
queue<int> reach;
for (int i = 0; i < k; ++i) {
fin >> from;
dka[from - 1].accept = true;
reach.push(from - 1);
}
for (int i = 0; i < m; ++i) {
fin >> from >> to >> c;
tr[from - 1].push_back({c - 97, to - 1});
b[to - 1].push_back(from - 1);
}
while (!reach.empty()) {
int pop = reach.front();
reach.pop();
if (!dka[pop].reach) {
dka[pop].reach = true;
for (int i : b[pop])
reach.push(i);
}
}
reach.push(0);
while (!reach.empty()) {
int pop = reach.front();
reach.pop();
if (dka[pop].reach && !dka[pop].reachable) {
dka[pop].reachable = true;
for (pair<int, int> i : tr[pop])
reach.push(i.second);
}
}
unordered_set<int> terms, other;
for (int i = 0; i < n; ++i)
if (dka[i].reachable) {
(dka[i].accept ? terms.insert(i) : other.insert(i));
dka[i].index = !dka[i].accept;
for (pair<int, int> j : tr[i])
if (dka[j.second].reachable) {
dka[i].transitions[j.first] = j.second;
dka[j.second].back[j.first].push_back(i);
}
}
vector<unordered_set<int>> new_dka({terms});
if (!other.empty())
new_dka.push_back(other);
queue<pair<int, int>> q;
for (int i = 0; i < 26; ++i) {
q.push({0, i});
if (!other.empty())
q.push({1, i});
}
while (!q.empty()) {
pair<int, int> pop = q.front();
q.pop();
map<int, vector<int>> involved;
for (int i : new_dka[pop.first])
for (int r : dka[i].back[pop.second])
involved[dka[r].index].push_back(r);
for (pair<int, vector<int>> i : involved)
if (i.second.size() < new_dka[i.first].size()) {
new_dka.push_back(unordered_set<int>());
int j = new_dka.size() - 1;
for (int r : i.second) {
new_dka[i.first].erase(r);
new_dka[j].insert(r);
dka[r].index = j;
}
for (int k = 0; k < 26; ++k)
q.push({j, k});
}
}
vector<int> new_terms;
map<pair<int, int>, int> new_trans;
for (int j : new_dka[0])
dka[j].index = dka[0].index;
for (int j : new_dka[dka[0].index])
dka[j].index = 0;
for (int i = 0; i < new_dka.size(); ++i)
for (int j : new_dka[i]) {
if (dka[j].accept)
new_terms.push_back(i);
for (int k = 0; k < 26; ++k)
if (dka[j].transitions[k] != -1)
new_trans[{dka[j].index, k}] = dka[dka[j].transitions[k]].index;
break;
}
ofstream fout("fastminimization.out");
fout << new_dka.size() << ' ' << new_trans.size() << ' ' << new_terms.size() << '\n';
for (int i : new_terms)
fout << i + 1 << ' ';
for (pair<pair<int, int>, int> i : new_trans)
fout << '\n' << i.first.first + 1 << ' ' << i.second + 1 << ' ' << char(i.first.second + 97);
}
| 38.398374 | 109 | 0.367986 | nothingelsematters |
3602aeb157c769208642c454418c8692085b651e | 439 | hpp | C++ | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | 2 | 2020-05-05T13:31:55.000Z | 2022-01-16T15:38:00.000Z | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | null | null | null | include/Sprite/Magema.hpp | VisualGMQ/Chaos_Dungeon | 95f9b23934ee16573bf9289b9171958f750ffc93 | [
"MIT"
] | 1 | 2021-11-27T02:32:24.000Z | 2021-11-27T02:32:24.000Z | #ifndef MAGEMA_HPP
#define MAGEMA_HPP
#include "Animation.hpp"
#include "Sprite.hpp"
#include "ColliSystem.hpp"
#include "WorldModel.hpp"
class Magema : public ColliableSprite{
public:
static Magema* Create();
void Init() override;
void Collied(Object* oth, BasicProp* prop, const Manifold* m) override;
~Magema();
private:
Magema();
void update() override;
void draw() override;
Animation ani;
};
#endif
| 19.954545 | 75 | 0.694761 | VisualGMQ |
3604de1cd1b5720a81401a9316a4387b0af2c56f | 333 | cpp | C++ | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | 9 | 2017-10-08T16:22:03.000Z | 2021-08-20T09:32:17.000Z | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | null | null | null | LeetCode/1018.Binary_Prefix_Divisible_By_5.cpp | w181496/OJ | 67d1d32770376865eba8a9dd1767e97dae68989a | [
"MIT"
] | 2 | 2018-01-15T16:35:44.000Z | 2019-03-21T18:30:04.000Z | class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
vector<bool>ans;
int now = 0;
for(int i = 0; i < A.size(); ++i) {
now = (now * 2 + A[i]) % 5;
if(now % 5 == 0) ans.push_back(true);
else ans.push_back(false);
}
return ans;
}
};
| 23.785714 | 49 | 0.453453 | w181496 |
360831d1f77f6b94ffda27eda355bd34ba9f2c54 | 2,949 | cpp | C++ | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 2 | 2018-10-31T08:09:03.000Z | 2021-01-18T19:23:54.000Z | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 1 | 2020-02-02T11:58:22.000Z | 2020-02-02T11:58:22.000Z | microbench/check.cpp | DanieleDeSensi/Nornir | 60587824d6b0a6e61b8fc75bdea37c9fc69199c7 | [
"MIT"
] | 1 | 2019-04-13T09:54:49.000Z | 2019-04-13T09:54:49.000Z | /*
* check.cpp
*
* Created on: 26/03/2016
*
* Checks if the architecture is supported.
*
* =========================================================================
* Copyright (C) 2015-, Daniele De Sensi ([email protected])
*
* This file is part of nornir.
*
* nornir is free software: you can redistribute it and/or
* modify it under the terms of the Lesser GNU General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
* nornir is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public
* License along with nornir.
* If not, see <http://www.gnu.org/licenses/>.
*
* =========================================================================
*/
#include <iostream>
#include <mammut/mammut.hpp>
using namespace std;
using namespace mammut;
using namespace mammut::topology;
using namespace mammut::energy;
#ifndef __linux__
#error "For the moment, Nornir only supports linux machines."
#endif
int main(int argc, char** argv){
Mammut m;
Topology* t = m.getInstanceTopology();
vector<VirtualCore*> virtualCores = t->getVirtualCores();
for(size_t i = 0; i < virtualCores.size(); i++){
if(!virtualCores.at(i)->hasFlag("constant_tsc")){
cerr << "=======================ATTENTION=======================\n"
"| Processor must have the constant_tsc flag. This is |\n"
"| needed since nornir gets timestamps considering |\n "
"| cores clock ticks. This constraint is not imposed |\n"
"| by the algorithm but it is needed since for the |\n"
"| moment no other timestamping mechanisms are |\n"
"| supported. |\n"
"=======================================================\n";
return -1;
}
}
Energy* energy = m.getInstanceEnergy();
Counter* counter = energy->getCounter();
if(!counter){
cerr << "========================WARNING========================\n"
"| Power counters not available on this machine (or if |\n"
"| available, they are still not supported by Nornir). |\n"
"| Accordingly, no guarantees on power consumption can |\n"
"| be provided. |\n"
"| If you are on an Intel machine, you can try to load |\n"
"| the 'msr' module and run the command again. |\n"
"=======================================================\n";
}
}
| 39.851351 | 80 | 0.515768 | DanieleDeSensi |
3610adb7cb01067df9c3119fc13902553ffd12e1 | 696 | cpp | C++ | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | 1 | 2021-08-12T21:59:50.000Z | 2021-08-12T21:59:50.000Z | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | null | null | null | src/cookie-engine/struct/SceneSettings.cpp | an22/cookie | 3c4b8cf6f9f3aab5e2e2d13ea8ba717fb19da640 | [
"MIT"
] | null | null | null | //
// SceneSettings.cpp
// cookie-engine
//
// Created by Antiufieiev Michael on 06.08.2021.
//
#include "SceneSettings.hpp"
namespace cookie {
SceneSettings::SceneSettings(
uint32_t width,
uint32_t height,
float x,
float y,
float z,
float fov,
float nearZ,
float farZ
) : width(width),
height(height),
cameraPos(glm::vec3(x, y, z)),
FOV(fov),
nearZ(nearZ),
farZ(farZ) {
onWindowResized(width, height);
}
void SceneSettings::onWindowResized(uint32_t newWidth, uint32_t newHeight) {
width = newWidth;
height = newHeight;
aspectRatio = (float) newWidth / (float) newHeight;
perspectiveMx = glm::perspective(FOV, aspectRatio, nearZ, farZ);
}
}
| 19.333333 | 77 | 0.679598 | an22 |
361112eed960dce6539ef49df634412c8f8ac440 | 746 | cc | C++ | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | 5 | 2020-04-11T21:30:19.000Z | 2021-12-04T16:16:09.000Z | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | null | null | null | examples/toy/iterative.cc | paulhjkelly/taskgraph-metaprogramming | 54c4e2806a97bec555a90784ab4cf0880660bf89 | [
"BSD-3-Clause"
] | null | null | null | #include <TaskGraph>
#include "TaskIterative.h"
using namespace tg;
typedef TaskGraph<void,int> iterative_TaskGraph;
void taskTest (coreTaskGraph *&t, unsigned param)
{
iterative_TaskGraph* const tg = new iterative_TaskGraph();
taskgraph(iterative_TaskGraph, *tg, tuple1(b))
{
tPrintf("param + b = %d\n", param + b);
}
t = tg;
}
int main(int argc, char* argv[])
{
OneVariableIterative iter(taskTest, 8, 128*2, 4, 4);
int a = (argc > 1) ? atoi(argv[1]) : 0;
unsigned int param;
for (int i = 0; i < 150; ++i)
{
iterative_TaskGraph* const iterative = static_cast<iterative_TaskGraph *>(iter.getNext(¶m));
tg::Timer timer;
iterative->execute(a);
timer.stop();
iter.setResult(param, timer.getTime());
}
}
| 23.3125 | 99 | 0.668901 | paulhjkelly |
3611f37d1e05d236303f0139c73aeebd5058d05c | 5,832 | cpp | C++ | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | src/graphics/model.cpp | Eae02/space-game | d3a4589f137a1485320fc2cd3485bff7c3afcd49 | [
"Zlib"
] | null | null | null | #include "model.hpp"
#include "../utils.hpp"
#include <tiny_obj_loader.h>
#include <iostream>
static_assert(sizeof(Vertex) == sizeof(float) * 7);
void Model::initializeVao() {
glCreateVertexArrays(1, &vao);
for (GLuint i = 0; i < 4; i++) {
glEnableVertexArrayAttrib(vao, i);
glVertexArrayAttribBinding(vao, i, 0);
}
glVertexArrayAttribFormat(vao, 0, 3, GL_FLOAT, GL_FALSE, offsetof(Vertex, pos));
glVertexArrayAttribFormat(vao, 1, 3, GL_BYTE, GL_TRUE, offsetof(Vertex, normal));
glVertexArrayAttribFormat(vao, 2, 3, GL_BYTE, GL_TRUE, offsetof(Vertex, tangent));
glVertexArrayAttribFormat(vao, 3, 2, GL_FLOAT, GL_FALSE, offsetof(Vertex, texcoord));
}
void Model::initialize(std::span<Vertex> vertices, std::span<uint32_t> indices) {
glCreateBuffers(1, &vertexBuffer);
glNamedBufferStorage(vertexBuffer, vertices.size_bytes(), vertices.data(), 0);
glCreateBuffers(1, &indexBuffer);
glNamedBufferStorage(indexBuffer, indices.size_bytes(), indices.data(), 0);
sphereRadius = 0;
minPos = maxPos = vertices[0].pos;
for (const Vertex& vertex : vertices) {
sphereRadius = std::max(glm::length(vertex.pos), sphereRadius);
minPos = glm::min(minPos, vertex.pos);
maxPos = glm::max(maxPos, vertex.pos);
}
}
void Model::destroy() {
glDeleteBuffers(1, &vertexBuffer);
glDeleteBuffers(1, &indexBuffer);
}
void generateTangents(std::span<Vertex> vertices, std::span<const glm::vec3> normals, std::span<const uint32_t> indices) {
glm::vec3* tangents1 = (glm::vec3*)std::calloc(1, vertices.size() * sizeof(glm::vec3));
glm::vec3* tangents2 = (glm::vec3*)std::calloc(1, vertices.size() * sizeof(glm::vec3));
for (size_t i = 0; i < indices.size(); i += 3) {
const glm::vec3 dp0 = vertices[indices[i + 1]].pos - vertices[indices[i]].pos;
const glm::vec3 dp1 = vertices[indices[i + 2]].pos - vertices[indices[i]].pos;
const glm::vec2 dtc0 = vertices[indices[i + 1]].texcoord - vertices[indices[i]].texcoord;
const glm::vec2 dtc1 = vertices[indices[i + 2]].texcoord - vertices[indices[i]].texcoord;
const float div = dtc0.x * dtc1.y - dtc1.x * dtc0.y;
if (std::abs(div) < 1E-6f)
continue;
const float r = 1.0f / div;
glm::vec3 d1((dtc1.y * dp0.x - dtc0.y * dp1.x) * r, (dtc1.y * dp0.y - dtc0.y * dp1.y) * r, (dtc1.y * dp0.z - dtc0.y * dp1.z) * r);
glm::vec3 d2((dtc0.x * dp1.x - dtc1.x * dp0.x) * r, (dtc0.x * dp1.y - dtc1.x * dp0.y) * r, (dtc0.x * dp1.z - dtc1.x * dp0.z) * r);
for (size_t j = i; j < i + 3; j++) {
tangents1[indices[j]] += d1;
tangents2[indices[j]] += d2;
}
}
for (size_t v = 0; v < vertices.size(); v++) {
if (glm::length2(tangents1[v]) > 1E-6f) {
tangents1[v] -= normals[v] * glm::dot(normals[v], tangents1[v]);
tangents1[v] = glm::normalize(tangents1[v]);
if (glm::dot(glm::cross(normals[v], tangents1[v]), tangents2[v]) < 0.0f) {
tangents1[v] = -tangents1[v];
}
}
vertices[v].tangent = packVectorS(tangents1[v]);
}
std::free(tangents1);
std::free(tangents2);
}
void Model::loadObj(const std::string& path) {
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string errorString;
if (!tinyobj::LoadObj(shapes, materials, errorString, path.c_str(), nullptr, tinyobj::triangulation)) {
std::cerr << "error loading obj: " << errorString << std::endl;
std::abort();
}
assert(shapes.size() < MAX_MESHES);
std::vector<Vertex> vertices;
std::vector<glm::vec3> normals;
std::vector<uint32_t> indices;
for (const tinyobj::shape_t& shape : shapes) {
Mesh& mesh = meshes[numMeshes++];
mesh.name = std::move(shape.name);
mesh.firstIndex = indices.size();
mesh.firstVertex = vertices.size();
mesh.numIndices = shape.mesh.indices.size();
size_t underscorePos = mesh.name.rfind('_');
if (underscorePos != std::string::npos) {
mesh.name = mesh.name.substr(underscorePos + 1);
}
indices.insert(indices.end(), shape.mesh.indices.begin(), shape.mesh.indices.end());
normals.clear();
assert(shape.mesh.positions.size() % 3 == 0);
assert(shape.mesh.positions.size() == shape.mesh.normals.size());
assert(shape.mesh.positions.size() / 3 == shape.mesh.texcoords.size() / 2);
for (size_t i = 0; i * 3 < shape.mesh.positions.size(); i++) {
const glm::vec3 normal = glm::normalize(glm::vec3(
shape.mesh.normals[i * 3 + 0],
shape.mesh.normals[i * 3 + 1],
shape.mesh.normals[i * 3 + 2]
));
Vertex& vertex = vertices.emplace_back();
vertex.pos.x = shape.mesh.positions[i * 3 + 0];
vertex.pos.y = shape.mesh.positions[i * 3 + 1];
vertex.pos.z = shape.mesh.positions[i * 3 + 2];
vertex.normal = packVectorS(normal);
vertex.texcoord.x = shape.mesh.texcoords[i * 2 + 0];
vertex.texcoord.y = shape.mesh.texcoords[i * 2 + 1];
normals.push_back(normal);
}
generateTangents(
std::span<Vertex>(&vertices[mesh.firstVertex], vertices.size() - mesh.firstVertex),
normals, shape.mesh.indices);
}
#ifdef DEBUG
std::cout << path << " mesh names: ";
for (uint32_t i = 0; i < numMeshes; i++) {
if (i) std::cout << ", ";
std::cout << "'" << meshes[i].name << "'";
}
std::cout << std::endl;
#endif
initialize(vertices, indices);
}
uint32_t Model::findMesh(std::string_view name) const {
for (uint32_t i = 0; i < numMeshes; i++) {
if (meshes[i].name == name) {
return i;
}
}
std::abort();
}
void Model::bind() const {
glBindVertexBuffer(0, vertexBuffer, 0, sizeof(Vertex));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
}
void Model::drawMesh(uint32_t meshIndex) const {
glDrawElementsBaseVertex(
GL_TRIANGLES,
meshes[meshIndex].numIndices,
GL_UNSIGNED_INT,
(void*)(meshes[meshIndex].firstIndex * sizeof(uint32_t)),
meshes[meshIndex].firstVertex
);
}
void Model::drawAllMeshes() const {
for (uint32_t i = 0; i < numMeshes; i++) {
drawMesh(i);
}
}
| 32.043956 | 132 | 0.655178 | Eae02 |
36155ea412d8e4bbc9a16427c163379f9760e753 | 9,590 | cpp | C++ | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | LycheeCam/src/NetTask.cpp | h7ga40/LycheeCam | 10ee0ed948a02ccbe5f9a008e7c371ba5bd84478 | [
"Apache-2.0"
] | null | null | null | #include "mbed.h"
#include "NetTask.h"
#include "http_request.h"
NtpTask::NtpTask(NetTask *owner) :
Task(osWaitForever),
_owner(owner),
_state(State::Unsynced),
_retry(0)
{
}
NtpTask::~NtpTask()
{
}
void NtpTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::WifiConnected) != 0) {
_state = State::Unsynced;
_timer = 0;
}
}
void NtpTask::Process()
{
if (_timer != 0)
return;
switch (_state) {
case State::Unsynced:
if (!_owner->IsConnected()) {
_state = State::Unsynced;
_timer = osWaitForever;
}
else if (_owner->InvokeNtp()) {
_retry = 0;
_state = State::Synced;
_timer = 3 * 60 * 1000;
}
else {
_retry++;
if (_retry >= 3) {
_retry = 0;
_state = State::Unsynced;
_timer = 1 * 60 * 1000;
}
else {
_state = State::Unsynced;
_timer = 10 * 1000;
}
}
break;
case State::Synced:
_state = State::Unsynced;
_timer = 0;
break;
default:
_state = State::Unsynced;
_timer = 10 * 1000;
break;
}
}
UploadTask::UploadTask(NetTask *owner) :
Task(osWaitForever),
_owner(owner),
_state(),
_retry(0),
_server(),
_serverAddr(),
_storage(),
_storageAddr(),
_update_req(false),
_uploads()
{
}
UploadTask::~UploadTask()
{
}
void UploadTask::Init(std::string server, std::string storage)
{
_server = server;
_serverAddr.set_ip_address(server.c_str());
_storage = storage;
_storageAddr.set_ip_address(storage.c_str());
}
void UploadTask::UploadRequest(std::string filename)
{
_mutex.lock();
_uploads.push_back(filename);
_mutex.unlock();
_owner->Signal(InterTaskSignals::UploadRequest);
}
void UploadTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::UpdateRequest) != 0) {
_update_req = true;
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Update;
_timer = 0;
}
}
if ((signals & InterTaskSignals::UploadRequest) != 0) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Upload;
_timer = 0;
}
}
}
bool UploadTask::Upload()
{
bool result;
std::string filename;
_mutex.lock();
result = !_uploads.empty();
if (result) {
filename = _uploads.front();
_uploads.pop_front();
}
_mutex.unlock();
if (result) {
result = _owner->Upload(_serverAddr, filename);
}
if (!result) {
_mutex.lock();
_uploads.push_back(filename);
_mutex.unlock();
}
return result;
}
void UploadTask::Process()
{
SocketAddress addr;
if (_timer != 0)
return;
switch (_state) {
case State::Undetected:
if (!_owner->IsConnected()) {
_state = State::Undetected;
_timer = osWaitForever;
}
else if (_owner->QuerySever(_server.c_str(), addr)) {
_serverAddr.set_addr(addr.get_addr());
_retry = 0;
if (_update_req) {
_state = State::Update;
_timer = 0;
}
else {
_state = State::Detected;
_timer = 1 * 60 * 1000;
}
}
else {
_retry++;
if (_retry >= 3) {
_retry = 0;
_state = State::Undetected;
_timer = 1 * 60 * 1000;
}
else {
_state = State::Undetected;
_timer = 10 * 1000;
}
}
break;
case State::Detected:
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_state = State::Undetected;
_timer = 0;
}
else {
_state = State::Detected;
_timer = osWaitForever;
}
break;
case State::Update:
if (_owner->Update(_serverAddr, _storageAddr)) {
_owner->WifiSleep(true);
_update_req = false;
_retry = 0;
_state = State::Detected;
_timer = osWaitForever;
}
else {
_retry++;
if (_retry >= 3) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_serverAddr.set_addr(nsapi_addr_t());
_retry = 0;
_state = State::Undetected;
_timer = 0;
}
else {
_retry = 0;
_state = State::Update;
_timer = 3 * 60 * 1000;
}
}
else {
_state = State::Update;
_timer = 10 * 1000;
}
}
break;
case State::Upload:
if (Upload()) {
_retry = 0;
_state = State::Detected;
_timer = osWaitForever;
}
else {
_retry++;
if (_retry >= 3) {
if (_serverAddr.get_ip_version() == NSAPI_UNSPEC) {
_serverAddr.set_addr(nsapi_addr_t());
_retry = 0;
_state = State::Undetected;
_timer = 0;
}
else {
_retry = 0;
_state = State::Upload;
_timer = 3 * 60 * 1000;
}
}
else {
_state = State::Upload;
_timer = 10 * 1000;
}
}
break;
default:
_state = State::Undetected;
_timer = 0;
break;
}
}
WifiTask::WifiTask(NetTask *owner, ESP32Interface *wifi) :
Task(osWaitForever),
_owner(owner),
_wifi(wifi),
_ssid(),
_password(),
_state(State::Disconnected)
{
}
WifiTask::~WifiTask()
{
}
void WifiTask::Init(std::string ssid, std::string password, std::string host_name)
{
_ssid = ssid;
_password = password;
_host_name = host_name;
}
void WifiTask::wifi_status(nsapi_event_t evt, intptr_t obj)
{
_owner->WifiStatus(evt);
}
void WifiTask::OnStart()
{
_wifi->attach(callback(this, &WifiTask::wifi_status));
_state = State::Disconnected;
if (!_ssid.empty() && !_password.empty()) {
_timer = 1000;
}
else {
_timer = 30 * 1000;
}
}
void WifiTask::ProcessEvent(InterTaskSignals::T signals)
{
if ((signals & InterTaskSignals::WifiStatusChanged) != 0) {
State new_state;
switch (_wifi->get_connection_status()) {
case NSAPI_STATUS_LOCAL_UP:
case NSAPI_STATUS_GLOBAL_UP:
_owner->WifiConnected();
_state = State::Connected;
_timer = osWaitForever;
break;
case NSAPI_STATUS_DISCONNECTED:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
case NSAPI_STATUS_CONNECTING:
_state = State::Connecting;
_timer = osWaitForever;
break;
case NSAPI_STATUS_ERROR_UNSUPPORTED:
default:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
}
}
}
void WifiTask::Process()
{
nsapi_connection_status_t ret;
if (_timer != 0)
return;
switch (_state) {
case State::Disconnected:
if (!_ssid.empty() && !_password.empty()) {
if (_wifi->connect(_ssid.c_str(), _password.c_str(), NSAPI_SECURITY_WPA_WPA2) == NSAPI_ERROR_OK) {
_wifi->ntp(true, 0);
_wifi->mdns(true, _host_name.c_str(), "_iot", 3601);
_state = State::Connecting;
_timer = 1000;
}
else {
_state = State::Disconnected;
_timer = 30 * 1000;
}
}
else {
_state = State::Disconnected;
_timer = 30 * 1000;
}
break;
default:
switch (_wifi->get_connection_status()) {
case NSAPI_STATUS_LOCAL_UP:
case NSAPI_STATUS_GLOBAL_UP:
if (_state == State::Connecting) {
_owner->WifiConnected();
}
_state = State::Connected;
_timer = osWaitForever;
break;
case NSAPI_STATUS_CONNECTING:
_state = State::Connecting;
_timer = 1000;
break;
case NSAPI_STATUS_DISCONNECTED:
case NSAPI_STATUS_ERROR_UNSUPPORTED:
default:
_state = State::Disconnected;
_timer = 30 * 1000;
break;
}
break;
}
}
NetTask::NetTask(GlobalState *globalState, ESP32Interface *wifi) :
TaskThread(&_task, osPriorityNormal, (1024 * 8), NULL, "NetTask"),
_tasks{ &_wifiTask, &_ntpTask, &_uploadTask, &_googleDriveTask },
_task(_tasks, sizeof(_tasks) / sizeof(_tasks[0])),
_globalState(globalState),
_wifi(wifi),
_ntpTask(this),
_uploadTask(this),
_wifiTask(this, wifi),
_googleDriveTask(this),
upload_file(NULL)
{
}
NetTask::~NetTask()
{
}
void NetTask::Init(std::string ssid, std::string password, std::string host_name,
std::string server, std::string storage)
{
_wifiTask.Init(ssid, password, host_name);
_uploadTask.Init(server, storage);
}
#define CHAR3_TO_INT(a, b, c) (((int)a) + (((int)b) << 8) + (((int)c) << 16))
bool NetTask::InvokeNtp()
{
char temp[32];
char mon[4], week[4];
struct tm tm;
if (!_wifi->ntp_time(&tm)) {
return false;
}
set_time(mktime(&tm) + (9 * 60 * 60));
return true;
}
bool NetTask::IsActive()
{
return _uploadTask.GetState() == UploadTask::State::Update;
}
bool NetTask::QuerySever(const std::string hostname, SocketAddress &addr)
{
return _wifi->mdns_query(hostname.c_str(), addr);
}
bool NetTask::Update(SocketAddress server, SocketAddress storage)
{
auto url = std::string("http://") + std::string(server.get_ip_address())
+ ":3000/update?ip=" + std::string(storage.get_ip_address());
auto get_req = new HttpRequest(_wifi, HTTP_GET, url.c_str());
auto get_res = get_req->send();
return (get_res != NULL) && (get_res->get_status_code() == 200);
}
void NetTask::UploadRequest(std::string filename)
{
_uploadTask.UploadRequest(filename);
}
bool NetTask::Upload(SocketAddress server, std::string filename)
{
if (upload_file != NULL)
return false;
upload_file = fopen(filename.c_str(), "rb");
auto url = std::string("http://") + std::string(server.get_ip_address())
+ ":3000/upload?name=" + filename;
auto post_req = new HttpRequest(_wifi, HTTP_POST, url.c_str());
auto post_res = post_req->send(mbed::callback(this, &NetTask::UploadBody));
fclose(upload_file);
upload_file = NULL;
if ((post_res == NULL) || (post_res->get_status_code() == 200))
return false;
return true;
}
size_t NetTask::UploadBody(char *buf, size_t length)
{
return fread(buf, sizeof(char), length, upload_file);
}
void NetTask::WifiStatus(nsapi_event_t evt)
{
printf("NetTask::WifiStatus(%d)\r\n", (int)evt);
Signal(InterTaskSignals::WifiStatusChanged);
}
void NetTask::WifiConnected()
{
printf("NetTask::WifiConnected\r\n");
Signal(InterTaskSignals::WifiConnected);
}
bool NetTask::WifiSleep(bool enable)
{
return _wifi->sleep(enable);
}
| 19.571429 | 101 | 0.652868 | h7ga40 |
3615f66a0ceaaf69df8a9b53166c3e17636f3cd0 | 5,913 | cpp | C++ | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 74 | 2021-05-31T15:23:49.000Z | 2022-03-12T04:46:39.000Z | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 16 | 2021-05-31T15:26:38.000Z | 2022-03-30T06:02:43.000Z | unittest/obproxy/test_netsystem.cpp | stutiredboy/obproxy | b5f98a6e1c45e6a878376df49b9c10b4249d3626 | [
"Apache-2.0"
] | 64 | 2021-05-31T15:25:36.000Z | 2022-02-23T08:43:58.000Z | /**
* Copyright (c) 2021 OceanBase
* OceanBase Database Proxy(ODP) is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#define private public
#define protected public
#include <gtest/gtest.h>
#include <pthread.h>
#include "test_eventsystem_api.h"
#include "ob_mysql_stats.h"
#include "stat/ob_net_stats.h"
namespace oceanbase
{
namespace obproxy
{
using namespace proxy;
using namespace common;
using namespace event;
using namespace net;
#define UNUSED_PARAMER 1000
#define TEST_EVENT_START_THREADS_NUM 2
#define TEST_MAX_STRING_LENGTH 70
#define TEST_STRING_GROUP_COUNT 5
char g_output[TEST_STRING_GROUP_COUNT][TEST_MAX_STRING_LENGTH] = {};
TestWaitCond g_wait_cond;
struct TestNetSMCont : public ObContinuation
{
ObVIO *read_vio_;
ObIOBufferReader *reader_;
ObNetVConnection *vc_;
ObMIOBuffer *buf_;
TestNetSMCont(ObProxyMutex * mutex, ObNetVConnection * vc)
: ObContinuation(mutex)
{
MUTEX_TRY_LOCK(lock, mutex_, vc->thread_);
ob_release_assert(lock.is_locked());
vc_ = vc;
SET_HANDLER(&TestNetSMCont::handle_read);
buf_ = new_miobuffer(32 * 1024);
reader_ = buf_->alloc_reader();
read_vio_ = vc->do_io_read(this, INT64_MAX, buf_);
memset(g_output, 0 , TEST_STRING_GROUP_COUNT * TEST_MAX_STRING_LENGTH);
INFO_NET("TEST", "TestNetSMCont : create test sm");
}
int handle_read(int event, void *data)
{
UNUSED(data);
int size;
static int i = 0;
switch (event) {
case VC_EVENT_READ_READY: {
size = (int)reader_->read_avail();
ob_assert(size <= TEST_MAX_STRING_LENGTH);
reader_->read(g_output[i++], size);
printf("output:%s\n", g_output[i - 1]);
fflush(stdout);
break;
}
case VC_EVENT_READ_COMPLETE:
case VC_EVENT_EOS: {
size = (int)reader_->read_avail();
reader_->read(g_output[i++], size);
printf("output:%s\n", g_output[i - 1]);
fflush(stdout);
vc_->do_io_close();
break;
}
case VC_EVENT_ERROR: {
vc_->do_io_close();
break;
}
default:
ob_release_assert(!"unknown event");
}
return EVENT_CONT;
}
};
struct TestNetAcceptCont : public event::ObContinuation
{
TestNetAcceptCont(ObProxyMutex * mutex)
: ObContinuation(mutex)
{
SET_HANDLER(&TestNetAcceptCont::handle_accept);
}
int handle_accept(int event, void *data)
{
UNUSED(event);
INFO_NET("TEST", "TestNetAcceptCont : Accepted a connection");
ObNetVConnection *vc = static_cast<ObNetVConnection *>(data);
new TestNetSMCont(new_proxy_mutex(), vc);
signal_condition(&g_wait_cond);
return EVENT_CONT;
}
};
void *thread_net_processor_start(void *data);
void init_net_processor();
class TestNetSystem : public ::testing::Test
{
public:
virtual void SetUp();
virtual void TearDown();
public:
FILE *test_fp_;
};
void TestNetSystem::SetUp()
{
test_fp_ = NULL;
}
void TestNetSystem::TearDown()
{
if (NULL != test_fp_) {
pclose(test_fp_);
} else {}
}
void *thread_net_processor_start(void *data)
{
UNUSED(data);
init_event_system(EVENT_SYSTEM_MODULE_VERSION);
ObNetProcessor::ObAcceptOptions options;
options.local_port_ = 9876;
options.accept_threads_ = 1;
options.frequent_accept_ = true;
init_mysql_stats();
ObNetOptions net_options;
if (OB_SUCCESS != init_net(NET_SYSTEM_MODULE_VERSION, net_options)) {
ERROR_NET("failed to init net");
} else if (OB_SUCCESS != init_net_stats()) {
ERROR_NET("failed to init net stats");
} else if (OB_SUCCESS != g_event_processor.start(TEST_EVENT_START_THREADS_NUM, DEFAULT_STACKSIZE, false, false)) {
DEBUG_NET("TEST", "failed to START g_event_processor");
} else if (OB_SUCCESS != g_net_processor.start(UNUSED_PARAMER, UNUSED_PARAMER)){
DEBUG_NET("TEST", "failed to START g_net_processor");
} else {
INFO_NET("TEST", "g_net_processor START success");
g_net_processor.accept(new TestNetAcceptCont(new_proxy_mutex()), options);
this_ethread()->execute();
}
return NULL;
}
void init_net_processor()
{
ObThreadId tid;
tid = thread_create(thread_net_processor_start, NULL, true, 0);
if (tid <= 0) {
LOG_ERROR("failed to create thread_net_processor_start");
} else {}
}
TEST_F(TestNetSystem, test_start)
{
INFO_NET("TEST", "test_start");
char buffer[TEST_STRING_GROUP_COUNT][TEST_MAX_STRING_LENGTH] ={
"OceanBase was originally designed to solve the problem of ",
"large-scale data of Taobao in ALIBABA GROUP. ",
"OceanBase experiences these versions such as 0.3, 0.4, 0.5. ",
"You can refer to \"OceanBase 0.5 System Overview\" for system ",
"overview of version 0.5."
};
if (NULL == (test_fp_ = popen("telnet 127.0.0.1 9876", "w"))) {
DEBUG_NET("TEST", "failed to popen test_fp_");
} else {
wait_condition(&g_wait_cond);
for (int64_t i = 0; i < TEST_STRING_GROUP_COUNT; ++i) {
fputs(buffer[i], test_fp_);
fflush(test_fp_);
printf("input :%s\n", buffer[i]);
fflush(stdout);
sleep(1);
}
for (int64_t i = 0; i < TEST_STRING_GROUP_COUNT; ++i) {
EXPECT_EQ(0, memcmp(buffer[i], g_output[i], TEST_MAX_STRING_LENGTH));
}
}
}
} // end of namespace obproxy
} // end of namespace oceanbase
int main(int argc, char **argv)
{
oceanbase::common::ObLogger::get_logger().set_log_level("INFO");
oceanbase::obproxy::init_net_processor();
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 27.502326 | 116 | 0.687976 | stutiredboy |
361f2d444e5e38f108416f322e0e6ad62dc84bf7 | 561 | hpp | C++ | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | include/Boots/Utils/json.hpp | Plaristote/Boots | ba6bd74fd06c5b26f1e159c6c861d46992db1145 | [
"BSD-3-Clause"
] | null | null | null | #ifndef DATATREE_JSON_HPP
# define DATATREE_JSON_HPP
# include "datatree.hpp"
namespace Json
{
class Parser
{
public:
Parser(const std::string&, bool filename = true);
DataTree* Run(void);
private:
void ParseValue(DataBranch*);
void ParseString(DataBranch*);
void ParseOther(DataBranch*);
void ParseObject(DataBranch*);
void ParseArray(DataBranch*);
std::string _source;
std::string _str;
unsigned int _it;
bool _fileLoaded;
};
}
#endif
| 18.7 | 53 | 0.600713 | Plaristote |
361fac8704e7985f5d946500a9743b622e77df96 | 7,205 | cpp | C++ | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 4 | 2017-12-18T20:10:16.000Z | 2021-02-07T21:21:24.000Z | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | null | null | null | SDKs/CryCode/3.6.15/GameDll/MultiplayerEntities/NetworkBuilding.cpp | amrhead/FireNET | 34d439aa0157b0c895b20b2b664fddf4f9b84af1 | [
"BSD-2-Clause"
] | 3 | 2019-03-11T21:36:15.000Z | 2021-02-07T21:21:26.000Z | /*************************************************************************
"BeatGames" Source File.
Copyright (C), BeatGames, 2014.
-------------------------------------------------------------------------
History:
- 03.12.2014 13:49 : Created by AfroStalin(chernecoff)
- 10.12.2014 21:08 : Edited by AfroStalin(chernecoff)
-------------------------------------------------------------------------
*************************************************************************/
#include "StdAfx.h"
#include "NetworkBuilding.h"
#include "ScriptBind_NetworkBuilding.h"
#include "WorldState/WorldState.h"
CNetworkBuilding::CNetworkBuilding()
: m_state(eState_NotUsed)
{
}
CNetworkBuilding::~CNetworkBuilding()
{
g_pGame->GetNetworkBuildingScriptBind()->Detach(GetEntityId());
}
bool CNetworkBuilding::Init( IGameObject * pGameObject )
{
SetGameObject(pGameObject);
defMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial("Materials/special/not_built_building.mtl");
if (!pGameObject->BindToNetwork())
return false;
if (!Reset())
return false;
g_pGame->GetNetworkBuildingScriptBind()->AttachTo(this);
if(gEnv->bServer)
{
ws=CWorldState::GetInstance();
ReadWorldState();
}
GetEntity()->Activate(true);
return true;
}
void CNetworkBuilding::PostInit( IGameObject * pGameObject )
{
pGameObject->EnableUpdateSlot(this, 0);
}
bool CNetworkBuilding::GetSettings()
{
SmartScriptTable entityProperties;
IScriptTable* pScriptTable = GetEntity()->GetScriptTable();
if(!pScriptTable || !pScriptTable->GetValue("Properties", entityProperties))
{
CryLog("[Network Building] : Error read lua properties !");
return false;
}
//Physics properties
SmartScriptTable physicProperties;
if (entityProperties->GetValue("Physics", physicProperties))
{
physicProperties->GetValue("iPhysType", phys_type);
physicProperties->GetValue("fPhysMass", phys_mass);
physicProperties->GetValue("fPhysDensity", phys_density);
}
//Building properties
SmartScriptTable buildingProperties;
if (entityProperties->GetValue("Building", buildingProperties))
{
// Geometry
buildingProperties->GetValue("sDefaultModel",default_model);
buildingProperties->GetValue("sModel_1",model_1);
buildingProperties->GetValue("sModel_2",model_2);
buildingProperties->GetValue("sModel_3",model_3);
buildingProperties->GetValue("sFinishModel",finish_model);
// Materials
buildingProperties->GetValue("sModel_1_material",Model_1_mat);
buildingProperties->GetValue("sModel_2_material",Model_2_mat);
buildingProperties->GetValue("sModel_3_material",Model_3_mat);
buildingProperties->GetValue("sFinishMaterial",finishMat);
//
buildingProperties->GetValue("fBuildTime",build_time);
}
return true;
}
bool CNetworkBuilding::Reset()
{
if(!GetSettings())
return false;
entity_name = GetEntity()->GetName();
fStartTime = 0.f;
build_status = -1;
m_state = eState_NotUsed;
GetEntity()->LoadGeometry(0,default_model);
GetEntity()->SetMaterial(defMat);
Physicalize(PE_NONE);
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
return true;
}
bool CNetworkBuilding::ReloadExtension( IGameObject * pGameObject, const SEntitySpawnParams ¶ms )
{
ResetGameObject();
CRY_ASSERT_MESSAGE(false, "CCTFFlag::ReloadExtension not implemented");
return false;
}
bool CNetworkBuilding::GetEntityPoolSignature( TSerialize signature )
{
CRY_ASSERT_MESSAGE(false, "CCTFFlag::GetEntityPoolSignature not implemented");
return true;
}
void CNetworkBuilding::Release()
{
delete this;
}
bool CNetworkBuilding::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags )
{
if (aspect == POSITION_ASPECT)
{
if(gEnv->bServer && !gEnv->IsEditor())
{
int cur_state = (int)m_state;
ws->SetInt(entity_name,"BuildStatus",build_status);
ws->SetInt(entity_name,"EntityState",cur_state);
}
EState newState = m_state;
ser.EnumValue("cur_state", newState, eState_NotUsed, eState_Done);
ser.Value( "build_status", build_status);
if (ser.IsWriting())
{
//CryLog("CNetworkBuilding::NetSerialize writing !!!");
}
if (ser.IsReading())
{
//CryLog("CNetworkBuilding::NetSerialize reading !!!");
m_state = newState;
Building(build_status);
}
}
return true;
}
void CNetworkBuilding::Update( SEntityUpdateContext& ctx, int updateSlot )
{
if (g_pGame->GetIGameFramework()->IsEditing())
{
Reset();
return;
}
float curTime = gEnv->pTimer->GetAsyncTime().GetSeconds();
float newTime = fStartTime+(build_time/4);
if(build_status!=-1 && gEnv->bServer)
{
if(curTime >= newTime && m_state!=eState_Done)
{
build_status++;
Building(build_status);
fStartTime = curTime;
}
}
// Test
//Vec3 test = GetEntity()->GetWorldPos();
//test.z = test.z+5.f;
//gEnv->pRenderer->DrawLabel(test, 1.f,GetEntity()->GetName());
}
int CNetworkBuilding::CanUse(EntityId entityId) const
{
const bool canUse = (m_state == eState_NotUsed);
if(canUse)
return 1;
else
return 0;
}
void CNetworkBuilding::StartBuild()
{
if(m_state==eState_NotUsed && gEnv->bServer)
{
CryLog("CNetworkBuilding::Building started...");
m_state = eState_InUse;
build_status = 0;
fStartTime = gEnv->pTimer->GetAsyncTime().GetSeconds();
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
}
}
bool CNetworkBuilding::Building(int part)
{
if(part>0)
{
if(part==1)
{
CryLog("CNetworkBuilding::Building part 1...");
// Geometry
GetEntity()->LoadGeometry(0, model_1);
// Material
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_1_mat);
GetEntity()->SetMaterial(pMat);
// Physics
Physicalize((pe_type)phys_type);
}
if(part==2)
{
CryLog("CNetworkBuilding::Building part 2...");
GetEntity()->LoadGeometry(0, model_2);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_2_mat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
}
if(part==3)
{
CryLog("CNetworkBuilding::Building part 3...");
GetEntity()->LoadGeometry(0, model_3);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(Model_3_mat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
}
if(part==4)
{
CryLog("CNetworkBuilding::Building finish part...");
GetEntity()->LoadGeometry(0, finish_model);
IMaterial *pMat = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(finishMat);
GetEntity()->SetMaterial(pMat);
Physicalize((pe_type)phys_type);
m_state = eState_Done;
CryLog("CNetworkBuilding::Building finished !");
}
if (gEnv->bServer)
{
CHANGED_NETWORK_STATE(this, POSITION_ASPECT);
}
}
return true;
}
void CNetworkBuilding::Physicalize(pe_type phys_type)
{
SEntityPhysicalizeParams params;
params.type = phys_type;
params.density = phys_density;
params.mass = phys_mass;
GetEntity()->Physicalize(params);
if (gEnv->bServer)
{
GetGameObject()->SetAspectProfile(eEA_Physics, phys_type);
}
}
void CNetworkBuilding::ReadWorldState()
{
if(gEnv->bServer && ws->CheckEntityTag(entity_name) && !gEnv->IsEditor())
{
build_status = ws->GetInt(entity_name,"BuildStatus");
m_state = (EState)ws->GetInt(entity_name,"EntityState");
}
} | 23.700658 | 106 | 0.694656 | amrhead |
36249ccc7f686680819704dc0fe8e1adcce533ab | 357 | hpp | C++ | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | 4 | 2020-12-28T15:29:15.000Z | 2021-06-27T12:37:15.000Z | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | null | null | null | components/operators/src/misc/antialiasing_cuda.hpp | knicos/voltu | 70b39da7069f8ffd7e33aeb5bdacc84fe4a78f01 | [
"MIT"
] | 2 | 2021-01-13T05:28:39.000Z | 2021-05-04T03:37:11.000Z | #ifndef _FTL_CUDA_ANTIALIASING_HPP_
#define _FTL_CUDA_ANTIALIASING_HPP_
#include <ftl/cuda_common.hpp>
namespace ftl {
namespace cuda {
void fxaa(ftl::cuda::TextureObject<uchar4> &colour, cudaStream_t stream);
void fxaa(ftl::cuda::TextureObject<uchar4> &colour, ftl::cuda::TextureObject<float> &depth, float threshold, cudaStream_t stream);
}
}
#endif
| 22.3125 | 130 | 0.784314 | knicos |
3626b3c4db07a233b0bb15b2fbd725302b6636da | 5,842 | hxx | C++ | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | c++/Utils/cmSNRUnitsReconstructorB1Weighted.hxx | cloudmrhub-com/CMRCode | 23cf19f35ac9590054aa05ddbdc82b87e8dfd3a0 | [
"MIT"
] | null | null | null | #ifndef __cmSNRUnitsReconstructorB1Weighted_hxx
#define __cmSNRUnitsReconstructorB1Weighted_hxx
#include "cmSNRUnitsReconstructorB1Weighted.h"
#include "itkImageAlgorithm.h"
#include "vnl/vnl_inverse.h"
#include "vnl/vnl_vector.h"
#include "vnl/vnl_matrix.h"
#include "vnl/algo/vnl_matrix_inverse.h"
#include "itkVector.h"
namespace cm
{
template< class VectorImageType,class ScalarImageType>
void SNRUnitsReconstructorB1Weighted< VectorImageType,ScalarImageType>
::ThreadedGenerateData(const VectorImageRegionType& outputRegionForThread, itk::ThreadIdType threadId)
{
VectorImageTypePointer SENSITIVITYMAP=this->GetSensitivityMap();
VectorImageTypePointer KSPACEDATAIFFT=this->GetInputIFFT();
ScalarImageTypePointer OUT=this->GetOutput();
ChannelArrayType iCM=this->GetInverseNoiseCovariance();
const int Kdimension =KSPACEDATAIFFT->GetNumberOfComponentsPerPixel();
const int Sdimension =SENSITIVITYMAP->GetNumberOfComponentsPerPixel();
itk::ImageRegionIterator<VectorImageType> is(SENSITIVITYMAP,outputRegionForThread);
itk::ImageRegionIterator<VectorImageType> iif(KSPACEDATAIFFT,outputRegionForThread);
itk::ImageRegionIterator<ScalarImageType> io(OUT,outputRegionForThread);
// /* prepare */
is.GoToBegin();
iif.GoToBegin();
io.GoToBegin();
VectorImagePixelType S;
ChannelArrayType SV(Sdimension,1);
ChannelArrayType D(1,1);
VectorImagePixelType I;
ChannelArrayType IV(Kdimension,1);
ChannelArrayType OV(1,1);
ChannelArrayType REG(1,1);
REG(0,0)= (ScalarImagePixelType) std::sqrt(2.0);
/* BANG!!*/
while( !iif.IsAtEnd() )
{
S=is.Get();
I=iif.Get();
/* reset counter and calculate the sos*/
for(auto y=0;y<Sdimension;y++)
{
SV(y,0)=S.GetElement(y);
IV(y,0)=I.GetElement(y);
}
D=SV.conjugate_transpose()*iCM*SV;
D=D.apply(sqrt);
OV= SV.conjugate_transpose()*iCM*IV;
io.Set((ScalarImagePixelType) REG(0,0) * std::abs(OV(0,0)) / std::abs(D(0,0)));
++is;
++iif;
++io;
}
}
}// end namespace
#endif
//
//
///* Allocate the output */
//
//typedef typename ScalarImageType::PixelType ScalarImagePixelType;
//typedef typename VectorImageType::PixelType VectorImagePixelType;
//
///* The first step is to take the signal and the noise data*/
//typename VectorImageType::ConstPointer s = this->GetInput();
//typename VectorImageType::Pointer noise = this->GetNoise();
//
//
///* allocate the Output file (scalar)*/
//typename ScalarImageType::Pointer output = this->GetOutput();
//output->SetBufferedRegion(output->GetRequestedRegion());
//output->Allocate();
//
//
//
//typename VectorImageType::Pointer signal=ConstPointerToPointer<VectorImageType>(s);
//
//vnl_matrix<typename VectorImageType::InternalPixelType>C;
///* Then we calculate the covariance matrix (yes is more a correlation one but the mean of the noise is supposed to be zero)*/
//C=this->calculateCovarianceMatrix();
//int nChan=noise->GetNumberOfComponentsPerPixel();
//
///* then we build the tensor image of the*/
//std::vector<typename ScalarImageType::Pointer> tmp;
//typename VectorImageType::Pointer CIFFT;
//typename ScalarImageType::Pointer tmpIm;
//
//int NP= PixelCount<VectorImageType>(signal);
//
//// typename VectorImageType::IndexType TTT;
//// TTT[0]==128;
//// TTT[1]==64;
//
//for (int t=0;t<nChan; t++){
// tmpIm=VectorImageElementAsImage<VectorImageType, ScalarImageType>(t,signal);
// tmpIm=InverseFFT<ScalarImageType>(tmpIm);
// tmpIm=multiplyImageTimesScalar<ScalarImageType>(tmpIm,sqrt((ScalarImagePixelType)NP) );
// tmp.push_back(tmpIm);
//};
//
///* compose the */
//CIFFT=composeVectorImage<ScalarImageType,VectorImageType>(tmp);
//
//
//
//
//
//itk::ImageRegionIterator<ScalarImageType> snr(output,output->GetLargestPossibleRegion());
//itk::ImageRegionIterator<VectorImageType> it(CIFFT,CIFFT->GetLargestPossibleRegion());
//
//it.GoToBegin();
//snr.GoToBegin();
//
//
//VectorImagePixelType v;
//VectorImagePixelType v2;
//// ScalarImagePixelType sMag;
//// ScalarImagePixelType nPow;
//
//
//
//
//
//vnl_vector<ScalarImagePixelType>S(nChan);
//vnl_matrix<ScalarImagePixelType> X(nChan,1);
//vnl_matrix<ScalarImagePixelType> sMag;
//vnl_matrix<ScalarImagePixelType> nPow;
//
//
//
//
//
//
//ScalarImagePixelType N= sqrt(2);
//
//
//
//
//typename vnl_matrix<ScalarImagePixelType>::iterator II;
//
//
//
//if (this->GetUseCovarianceMatrix())
//{
// while( !snr.IsAtEnd() )
// {
// v=it.Get();
//
// for (int t=0;t<v.GetSize();t++)
// {
//
// X(t,0)=v.GetElement(t);
//
// }
//
//
//// std::cout<<"X is";
//// vcl_cout<<X;
//// std::cout<<std::endl;
//
//
// sMag=(X.conjugate_transpose()*X);
//
//// sMag=(X.transpose()*X);
//
//
//
// for (II= sMag.begin(); II != sMag.end(); II++){
// *II=abs(*II)*N;
// };
//
//
//
// nPow= X.transpose()*C*X;
//
//
//// vcl_cout<<nPow;
//// std::cout<<std::endl;
// for (II= nPow.begin(); II != nPow.end(); II++){
// *II=sqrt(abs(*II));
// };
//
//// std::cout<<"after sqrt abs";
//// vcl_cout<<nPow;
//// std::cout<<std::endl;
//
// //std::cout<<"SNR"<<sMag(0,0)/nPow(0,0)<<std::endl;
// snr.Set((ScalarImagePixelType)(sMag(0,0)/nPow(0,0)));
// ++it;
// ++snr;
// }
//
//}else{
//
// try
// {
// sMag=vnl_matrix_inverse<ScalarImagePixelType>(C);
// }catch (const std::exception& e) { std::cout<<"NO"; }
//
//
//
// while( !snr.IsAtEnd() )
// {
//
// v=it.Get();
//
// for (int t=0;t<v.GetSize();t++)
// {
//
// X(t,0)=v.GetElement(t);
//
// }
//
//
// //nPow=X.transpose()*sMag*X;
//
// nPow=X.conjugate_transpose()*sMag*X;
//
// snr.Set(N*(ScalarImagePixelType)sqrt(nPow(0,0)));
//
// ++it;
// ++snr;
// }
//
//
//}
//
//
//
//
//
//}
| 20.790036 | 127 | 0.649264 | cloudmrhub-com |
36285eb7da9fe516b891787505e706fad97ac9aa | 608 | cpp | C++ | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | 120 | 2021-02-19T07:39:50.000Z | 2022-02-19T14:55:28.000Z | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | null | null | null | C++/soln-string-problems/string-compression.cpp | ansumandas441/Data-Structures-and-Algorithms | 8fa30569b974c8e24e761df266072069f1dfe033 | [
"MIT"
] | 22 | 2021-06-21T17:21:27.000Z | 2021-12-24T01:56:29.000Z | /**
@author Farheen Bano
Date 11-08-2021
Reference-
https://leetcode.com/problems/string-compression
*/
class Solution {
public:
int compress(vector<char>& chars) {
int i=0;
int index=0;
while(i<chars.size()){
int j=i;
while(j<chars.size() && chars[i]==chars[j])
j++;
chars[index++]=chars[i];
if(j-i>1){
string count=to_string(j-i);
for(char ch:count)
chars[index++]=ch;
}
i=j;
}
return index;
}
}; | 20.266667 | 55 | 0.440789 | ansumandas441 |
362c1fc71e35832af041c75fab189a17a61b25b2 | 3,181 | hpp | C++ | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | 4 | 2019-09-17T13:11:02.000Z | 2021-02-22T15:39:15.000Z | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | null | null | null | demos/python_demos/speech_recognition_demo/ctcdecode-numpy/ctcdecode_numpy/yoklm/language_model.hpp | ivanvikhrev/open_model_zoo | 322e7ac5ed8a17611b56c46e5e56bfef05d8cc2a | [
"Apache-2.0"
] | 1 | 2021-02-24T00:40:03.000Z | 2021-02-24T00:40:03.000Z | /*********************************************************************
* Copyright (c) 2020 Intel Corporation
* SPDX-License-Identifier: Apache-2.0
**********************************************************************/
#ifndef YOKLM_LANGUAGE_MODEL_HPP
#define YOKLM_LANGUAGE_MODEL_HPP
#include <vector>
#include <string>
#include <utility>
#include "word_index.hpp"
#include "memory_section.hpp"
namespace yoklm {
struct UnigramNodeFormat {
float prob; // log10-prob for this node
float backoff; // log10-backoff for this node
uint64_t start_index; // starting index of the subtrie in the next trie layer
};
struct MediumLayer {
int bhiksha_total_bits;
int bhiksha_low_bits; // TODO: get rid of data duplication here
int backoff_bits; // TODO: get rid of data duplication here
size_t bhiksha_highs_count; // number of elements in bhiksha_highs
MemorySectionArray<uint64_t> bhiksha_highs;
MemorySectionBitArray bit_array; // contains bit fields: word_index, backoff, prob, bhiksha_low_bits
BitField word_field;
BitField backoff_field;
BitField prob_field;
BitField bhiksha_low_field;
};
struct LmConfig {
size_t order; // the value of n in n-gram
std::vector<uint64_t> ngram_counts; // ngram_count[k-1] = number of k-grams, vector length = order
int prob_bits; // size of quantized representation of log-probability values; guaranteed to be in [0,24]
int backoff_bits; // size of quantized representation of log-backoff values; guaranteed to be in [0,24]
std::vector<MemorySectionArray<float> > prob_quant_tables; // [k-2] for k-grams, k=2...n
std::vector<MemorySectionArray<float> > backoff_quant_tables; // [k-2] for k-grams, k=2...(n-1)
MemorySectionArray<UnigramNodeFormat> unigram_layer;
std::vector<MediumLayer> medium_layers;
//MediumLayer leaves_layer;
};
struct LmState {
LmState() {}
explicit LmState(int order) {
backoffs.reserve(order - 1);
context_words.reserve(order);
}
// Backoffs in reverse order: backoffs[0] for 1-gram, backoffs[1] for 2-gram, etc
std::vector<float> backoffs;
// Up to (order-1) last words in reverse order
std::vector<WordIndex> context_words;
};
class LanguageModel {
public:
LanguageModel() : config_() {}
void load(LmConfig config) { config_ = config; }
//float log10_p_cond(const std::vector<WordIndex>& words) const;
float log10_p_cond(WordIndex new_word, LmState& state) const;
size_t order() const { return config_.order; };
uint64_t num_words() const { return config_.ngram_counts[0]; };
private:
LmConfig config_;
// Accepts n-gram in state.words (as const, reverse order: the last word in state.words[0])
// Returns:
// * Return value (float) = raw p-value for the longest n-gram present in the LM
// * state.backoff.size(): the length of the longest n-gram present in the LM
// * state.backoff[]: state.backoff[k] if backoff for (k+1)-gram postfix
float find_ngram(LmState& state) const;
//std::pair<uint64_t, uint64_t> bhiksha_lookup(const MemorySectionArray<uint64_t>& bhiksha_highs, uint64_t index) const;
};
} // namespace yoklm
#endif // YOKLM_LANGUAGE_MODEL_HPP
| 34.576087 | 124 | 0.69255 | ivanvikhrev |
362d28d4b1b9c75eb1a13c5b8c5b409f9e5fa0d9 | 27 | cpp | C++ | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | src/cues/animism/AnimismCues.cpp | HfMT-ZM4/cvgl-osc | 97b4259aac6757a68959cfa625c59c97bd7a62d1 | [
"CC0-1.0"
] | null | null | null | #include "AnimismCues.hpp"
| 13.5 | 26 | 0.777778 | HfMT-ZM4 |
362dba564948c3777123e5181dc6cec927daffd1 | 1,684 | hpp | C++ | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 1 | 2015-10-21T14:22:12.000Z | 2015-10-21T14:22:12.000Z | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 2 | 2019-05-26T20:52:31.000Z | 2019-05-28T16:19:49.000Z | libs/besiq/method/wald_lm_method.hpp | hoehleatsu/besiq | 94959e2819251805e19311ce377919e6bccb7bf9 | [
"BSD-3-Clause"
] | 2 | 2016-11-06T14:58:37.000Z | 2019-05-26T14:03:13.000Z | #ifndef __WALD_LM_METHOD_H__
#define __WALD_LM_METHOD_H__
#include <string>
#include <vector>
#include <armadillo>
#include <besiq/method/method.hpp>
#include <besiq/stats/log_scale.hpp>
/**
* This class is responsible for executing the closed form
* wald test for a logistic regression model.
*/
class wald_lm_method
: public method_type
{
public:
/**
* Constructor.
*
* @param data Additional data required by all methods, such as
* covariates.
* @param unequal_var If true, estimates a separate variance for each cell.
*/
wald_lm_method(method_data_ptr data, bool unequal_var = false);
/**
* @see method_type::init.
*/
virtual std::vector<std::string> init();
/**
* Returns the last computed covariance matrix.
*
* @return the last computed covariance matrix.
*/
arma::mat get_last_C();
/**
* Returns the last computed beta.
*
* @return the last computed beta.
*/
arma::vec get_last_beta();
/**
* @see method_type::run.
*/
virtual double run(const snp_row &row1, const snp_row &row2, float *output);
private:
/**
* Weight for each sample.
*/
arma::vec m_weight;
/**
* Phenotype.
*/
arma::vec m_pheno;
/**
* Missing samples.
*/
arma::uvec m_missing;
/**
* Determines whether variances should be estimated separately.
*/
bool m_unequal_var;
/**
* Current covariance matrix for the betas.
*/
arma::mat m_C;
/**
* Current betas.
*/
arma::vec m_beta;
};
#endif /* End of __WALD_LM_METHOD_H__ */
| 19.811765 | 80 | 0.597387 | hoehleatsu |
156a027c2be706ad495539c53f1f7e14bdb27d95 | 5,914 | cpp | C++ | IDA/FUN_0001d6e0.cpp | Mochongli/evil-mhyprot-cli | 628470626532d663a1f557b5048b319266f70f75 | [
"MIT"
] | 91 | 2020-10-18T07:59:47.000Z | 2022-03-08T18:34:04.000Z | IDA/FUN_0001d6e0.cpp | Game-Academy-of-Sciences/evil-mhyprot-cli | ff4e1413f7e878fa0dbc4ebe724830ac6a5db3e1 | [
"MIT"
] | 2 | 2021-08-29T22:38:30.000Z | 2021-12-16T20:32:38.000Z | IDA/FUN_0001d6e0.cpp | Game-Academy-of-Sciences/evil-mhyprot-cli | ff4e1413f7e878fa0dbc4ebe724830ac6a5db3e1 | [
"MIT"
] | 36 | 2020-10-18T17:13:54.000Z | 2022-03-30T10:16:00.000Z |
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
//
// Pseudocode
//
undefined8 IOCTL_FUN_0001d6e0(undefined8 param_1,longlong param_2)
{
uint uVar1;
uint uVar2;
uint uVar3;
ulonglong *puVar4;
int iVar5;
undefined8 uVar6;
longlong lVar7;
ulonglong uVar8;
ulonglong *puVar9;
ulonglong uVar10;
uint local_res10 [2];
ulonglong *local_res18;
undefined8 local_198 [48];
lVar7 = *(longlong *)(param_2 + 0xb8);
puVar4 = *(ulonglong **)(param_2 + 0x18);
uVar1 = *(uint *)(lVar7 + 0x18);
uVar2 = *(uint *)(lVar7 + 0x10);
uVar3 = *(uint *)(lVar7 + 8);
uVar10 = (ulonglong)uVar3;
*(undefined8 *)(param_2 + 0x38) = 0;
if (uVar1 == 0x80104000) {
uVar6 = FUN_000121ec((longlong)puVar4,uVar2);
_DAT_0001a110 = (int)uVar6;
*(uint *)puVar4 = -(uint)(_DAT_0001a110 != 0) & 1;
LAB_0001d75c:
uVar10 = 4;
goto LAB_0001da4f;
}
if (((uVar1 + 0x7feec000 & 0xfffcffff) == 0) && (uVar1 != 0x80134000)) goto LAB_0001da4f;
if (uVar1 == 0x80134000) {
lVar7 = FUN_00012314();
*(int *)puVar4 = (int)lVar7;
goto LAB_0001d75c;
}
if (uVar1 == 0x82054000) {
uVar8 = FUN_000126d0(*(uint *)puVar4,(longlong)(uint *)((longlong)puVar4 + 4),
*(uint *)((longlong)puVar4 + 4));
iVar5 = (int)uVar8;
}
else {
if (uVar1 == 0x83024000) {
uVar8 = FUN_000162ec((longlong)puVar4 + 4,(int *)puVar4);
iVar5 = (int)uVar8;
}
else {
if (uVar1 == 0x83074000) {
uVar6 = FUN_00015f18();
iVar5 = (int)uVar6;
}
else {
/* MHYPROT_IOCTL_READ_KERNEL_MEMORY */
if (uVar1 != 0x83064000) {
if (uVar1 == 0x82074000) {
if (((uVar2 < 4) || (uVar3 < 0x38)) || (puVar4 == (ulonglong *)0x0)) goto LAB_0001da4f;
puVar9 = (ulonglong *)ExAllocatePoolWithTag(1,uVar10,0x4746544d);
*puVar9 = SUB168(ZEXT816(0xaaaaaaaaaaaaaaab) * ZEXT816(uVar10 - 8) >> 0x45,0) &
0xffffffff;
uVar8 = FUN_000132b0((uint *)puVar4,puVar9);
*(int *)(param_2 + 0x30) = (int)uVar8;
if ((int)uVar8 < 0) {
uVar10 = 8;
*puVar4 = *puVar9;
}
else {
uVar8 = *puVar9 * 0x30 + 8;
LAB_0001d842:
*(ulonglong *)(param_2 + 0x38) = uVar8;
FUN_000175c0(puVar4,puVar9,uVar8);
}
LAB_0001d85b:
uVar6 = 0x4746544d;
}
else {
if (uVar1 == 0x82104000) {
if (((uVar2 < 0x28) || (uVar3 < 0x20)) || (puVar4 == (ulonglong *)0x0))
goto LAB_0001da4f;
puVar9 = (ulonglong *)ExAllocatePoolWithTag(1,uVar10,0x4746544d);
*(int *)puVar9 =
(int)SUB168(ZEXT816(0xaaaaaaaaaaaaaaab) * ZEXT816(uVar10 - 4) >> 0x44,0);
uVar6 = FUN_0001377c((longlong)puVar4,(uint *)puVar9);
*(int *)(param_2 + 0x30) = (int)uVar6;
if (-1 < (int)uVar6) {
uVar8 = (ulonglong)*(uint *)puVar9 * 0x18 + 4;
goto LAB_0001d842;
}
uVar10 = 4;
*(uint *)puVar4 = *(uint *)puVar9;
goto LAB_0001d85b;
}
if (uVar1 == 0x82094000) {
*(undefined4 *)puVar4 = 0;
goto LAB_0001da4f;
}
/* MHYPROT_IOCTL_INITIALIZE */
if (uVar1 == 0x80034000) {
if (uVar2 == 0x10) {
puVar4[1] = puVar4[1] ^ 0xebbaaef4fff89042;
*puVar4 = *puVar4 ^ puVar4[1];
if (*(int *)((longlong)puVar4 + 4) == -0x45145114) {
FUN_000151a8(*(undefined4 *)puVar4);
if ((int)DAT_0001a108 == 0) {
FUN_0001301c((longlong *)&DAT_0001a0e8,puVar4[1]);
lVar7 = 7;
do {
uVar10 = FUN_00012eb0((uint **)&DAT_0001a0e8);
*puVar4 = uVar10;
DAT_0001a108._0_4_ = 1;
lVar7 = lVar7 + -1;
} while (lVar7 != 0);
uVar10 = 8;
}
else {
uVar10 = 0;
}
}
}
goto LAB_0001da4f;
}
if (uVar1 == 0x81134000) goto LAB_0001da4f;
if (uVar1 == 0x81144000) {
uVar10 = FUN_00016654(*(uint *)puVar4,(longlong)local_198);
iVar5 = (int)uVar10;
if (-1 < iVar5) {
uVar10 = (ulonglong)(uint)(iVar5 * 0x18);
if (0 < iVar5) {
FUN_000175c0(puVar4,local_198,(longlong)iVar5 * 0x18);
}
goto LAB_0001da4f;
}
uVar10 = 4;
goto LAB_0001d7c1;
}
local_res18 = (ulonglong *)0x0;
local_res10[0] = 0;
uVar8 = IOCTL_FUN_0001d000(uVar1,puVar4,uVar2,&local_res18,(int *)local_res10);
puVar9 = local_res18;
if ((char)uVar8 == '\0') goto LAB_0001da4f;
if (uVar3 < local_res10[0]) {
local_res10[0] = uVar3;
}
if ((local_res18 == (ulonglong *)0x0) || (local_res10[0] == 0)) goto LAB_0001da4f;
uVar10 = (ulonglong)local_res10[0];
FUN_000175c0(puVar4,local_res18,(ulonglong)local_res10[0]);
uVar6 = 0;
}
ExFreePoolWithTag(puVar9,uVar6);
goto LAB_0001da4f;
}
uVar6 = FUN_000163a8((undefined4 *)((longlong)puVar4 + 4),*puVar4,*(uint *)(puVar4 + 1));
iVar5 = (int)uVar6;
}
}
}
LAB_0001d7c1:
*(int *)puVar4 = iVar5;
LAB_0001da4f:
*(ulonglong *)(param_2 + 0x38) = uVar10;
*(undefined4 *)(param_2 + 0x30) = 0;
IofCompleteRequest(param_2,0);
return 0;
}
| 34.383721 | 99 | 0.49442 | Mochongli |
156a0e6602ed4e0182c7a7a546ca88d2ef20fe82 | 5,671 | cpp | C++ | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 32 | 2021-07-21T14:55:10.000Z | 2022-03-09T22:07:20.000Z | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 1 | 2021-07-21T18:42:39.000Z | 2021-07-21T18:45:53.000Z | million-sdk/cheat/hooks/functions/draw_model_execute.cpp | excludes/millionware-v1 | 78429e0c50d33df4acb675e403a313384f6fb2e0 | [
"MIT"
] | 29 | 2021-07-21T14:56:45.000Z | 2022-03-29T20:57:25.000Z | #include "../hooks.hpp"
#include <cstdio>
#include "../../../source engine/sdk.hpp"
#include "../../features/bt.hpp"
#include "../../../engine/utilities/config.hpp"
#include "../../../source engine/classes/key_values.hpp"
void __fastcall hooks::draw_model_execute( void* ecx, void* edx, void* ctx, void* state, model_render_info_t* info, matrix_t* matrix )
{
auto original = [ & ]( matrix_t* _matrix )
{
dme_holy_hook.call_original<void>( ecx, edx, ctx, state, info, _matrix );
};
if ( interfaces::model_render->is_forced_material_override( ) )
{
original( matrix );
return;
}
static auto flat = interfaces::material_system->find_material( xor ( "debug/debugdrawflat" ) );
static auto textured = interfaces::material_system->find_material( xor ( "debug/debugambientcube" ) );
static i_material* mat = nullptr;
switch ( *config::get<int>( crc( "esp:chams:material" ) ) )
{
case 0: mat = textured; break;
case 1: mat = flat; break;
}
if ( mat == textured )
{
static key_values* kv = nullptr;
if ( !kv )
{
kv = static_cast< key_values* >( malloc( 36 ) );
kv->init( xor ( "VertexLitGeneric" ) );
}
else
{
static bool something_changed = true;
color clr( *config::get<color>( crc( "esp:chams:reflectivity_clr" ) ) );
static color old_clr = clr;
float reflectivity = *config::get<float>( crc( "esp:chams:reflectivity" ) );
static float old_reflectivity = reflectivity;
float pearlescent = *config::get<float>( crc( "esp:chams:pearlescent" ) );
static float old_pearlescent = pearlescent;
float shine = *config::get<float>( crc( "esp:chams:shine" ) );
static float old_shine = shine;
float rim = *config::get<float>( crc( "esp:chams:rim" ) );
static float old_rim = rim;
if ( old_clr != clr ||
old_reflectivity != reflectivity ||
old_pearlescent != pearlescent ||
old_shine != shine )
{
something_changed = true;
}
if ( something_changed )
{
kv->set_string( "$basetexture", "" );
// reflectivity
{
char $envmaptint[ 64 ];
sprintf( $envmaptint, "[%f %f %f]", float( clr.r / 255.f ) * reflectivity / 100.f, float( clr.g / 255.f ) * reflectivity / 100.f, float( clr.b / 255.f ) * reflectivity / 100.f );
kv->set_string( "$envmaptint", $envmaptint );
kv->set_string( "$envmap", "env_cubemap" );
}
// pearlescence
{
char $pearlescent[ 64 ];
sprintf( $pearlescent, "%f", pearlescent );
kv->set_string( "$pearlescent", $pearlescent );
}
// shine
{
kv->set_int( "$phong", 1 );
kv->set_int( "$phongexponent", 15 );
kv->set_int( "$normalmapalphaenvmask", 1 );
char $phongboost[ 64 ];
sprintf( $phongboost, "[%f %f %f]", shine / 100.f, shine / 100.f, shine / 100.f );
kv->set_string( "$phongboost", $phongboost );
kv->set_string( "$phongfresnelranges", "[.5 .5 1]" );
kv->set_int( "$BasemapAlphaPhongMask", 1 );
}
// rim
{
kv->set_int( "$rimlight", 1 );
kv->set_int( "$rimlightexponent", 2 );
char $rimlightboost[ 64 ];
sprintf( $rimlightboost, "%f", rim / 100.f );
kv->set_string( "$rimlightboost", $rimlightboost );
}
mat->set_shader_and_params( kv );
old_clr = clr;
old_reflectivity = reflectivity;
old_pearlescent = pearlescent;
old_shine = shine; // alpha ty kurwa idioto
something_changed = false;
}
}
}
if ( strstr( info->model->name, xor ( "shadow" ) ) != nullptr )
{ // fucking shadows are ugly anyways smfh
return;
}
auto local = interfaces::entity_list->get<player_t>( interfaces::engine->get_local_player( ) );
if ( local && info && info->entity_index && info->entity_index < 65 )
{
if ( strstr( info->model->name, xor ( "models/player" ) ) != nullptr )
{
[ & ]( )
{
auto ent = interfaces::entity_list->get<player_t>( info->entity_index );
if ( !ent )
return;
if ( !ent->health( ) )
return;
if ( ent->team( ) == local->team( ) )
return;
auto record = backtrack::find_last_record( info->entity_index );
if ( record.has_value( ) && *config::get<bool>( crc( "ass:backtrack" ) ) && *config::get<bool>( crc( "esp:chams:backtrack" ) ) )
{
if ( std::fabs( ( ent->abs_origin( ) - record.value( ).m_abs_origin ).length( ) ) > 2.5f )
{
color clr( *config::get<color>( crc( "ass:backtrack:color" ) ) );
flat->set_color( clr.r, clr.g, clr.b );
flat->set_alpha( clr.a );
flat->set_flag( ( 1 << 15 ), false );
interfaces::model_render->force_override_material( flat );
original( record.value( ).m_matrix );
interfaces::model_render->force_override_material( nullptr );
}
}
if ( *config::get<bool>( crc( "esp:chams:invisible" ) ) )
{
color clr( *config::get<color>( crc( "esp:chams:invisible_color" ) ) );
mat->set_color( clr.r, clr.g, clr.b );
mat->set_alpha( clr.a );
mat->set_flag( ( 1 << 15 ), true );
interfaces::model_render->force_override_material( mat );
original( matrix );
if ( !*config::get<bool>( crc( "esp:chams:visible" ) ) )
{
interfaces::model_render->force_override_material( nullptr );
original( matrix );
}
}
if ( *config::get<bool>( crc( "esp:chams:visible" ) ) )
{
color clr( *config::get<color>( crc( "esp:chams:color" ) ) );
mat->set_color( clr.r, clr.g, clr.b );
mat->set_alpha( clr.a );
mat->set_flag( ( 1 << 15 ), false );
interfaces::model_render->force_override_material( mat );
original( matrix );
}
}( );
}
}
original( matrix );
interfaces::model_render->force_override_material( nullptr );
} | 28.786802 | 183 | 0.603245 | excludes |
156c3c7e30f0ba52484e4ff5663aaa3c5bc6c8ad | 1,436 | cpp | C++ | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | null | null | null | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | 2 | 2020-06-13T11:48:59.000Z | 2020-06-13T11:56:24.000Z | src/scenes/menu.cpp | AgoutiGames/Piper | 160f0c7e8afb8d3ea91dd69ee10c63da60f66a21 | [
"MIT"
] | null | null | null | #include "scenes/menu.hpp"
#include "core/scene_manager.hpp"
#include <iostream>
const char* Menu::type = "Menu";
const bool Menu::good = GameScene::register_class<Menu>(Menu::type);
Menu::Menu(salmon::MapRef map, SceneManager* scene_manager) :
GameScene(map,scene_manager) {}
void Menu::init() {
m_scene_manager->set_linear_filtering(false);
m_scene_manager->next_scene("stage1.tmx");
m_scene_manager->set_game_resolution(960,720);
m_scene_manager->set_fullscreen(false);
m_scene_manager->set_window_size(960,720);
// Preload whole data folder
m_scene_manager->add_preload_directory("");
m_scene_manager->preload(50);
// Initializes all characters in scene
GameScene::init();
// Setup member vars here | example: put(m_speed, "m_speed");
// Clear data accessed via put
get_data().clear();
}
void Menu::update() {
// Add scene logic here
salmon::InputCacheRef input = get_input_cache();
if(input.just_pressed("Escape")) {
m_scene_manager->shutdown();
}
// Calls update on all characters in scene
GameScene::update();
}
void Menu::button_pressed(std::string id) {
if(id == "Quit") {
m_scene_manager->shutdown();
}
else if(id == "Start") {
// Load next scene file
// m_scene_manager->next_scene("stage1.tmx");
}
else {
std::cerr << "Button type: " << id << " is unrecognized!\n";
}
}
| 26.592593 | 68 | 0.655292 | AgoutiGames |
156ed93956ad72fe0ab6b04e54915020ac764ab4 | 5,412 | cpp | C++ | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | 8 | 2020-04-26T11:48:29.000Z | 2022-02-23T15:13:50.000Z | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | null | null | null | examples/helloasge/ASGEGame.cpp | Alexthehuman3/ASGE | a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44 | [
"MIT"
] | 1 | 2021-05-13T16:37:24.000Z | 2021-05-13T16:37:24.000Z | #include <map>
#include <Engine/GameSettings.hpp>
#include <Engine/Logger.hpp>
#include <Engine/OGLGame.hpp>
#include <Engine/Sprite.hpp>
class ASGENetGame : public ASGE::OGLGame
{
public:
explicit ASGENetGame(const ASGE::GameSettings& settings) :
OGLGame(settings)
{
inputs->use_threads = false;
inputs->addCallbackFnc(ASGE::EventType::E_KEY, &ASGENetGame::keyHandler, this);
bg = renderer->createUniqueSprite();
bg->loadTexture("/data/FHD.png");
bg->xPos(-512*0.25F);
robot = renderer->createUniqueSprite();
robot->loadTexture("/data/character_zombie_idle.png");
robot->xPos((robot->width() * 0.5F));
robot->yPos(768/2.0F - (robot->height() * 0.5F));
zombie = renderer->createUniqueSprite();
zombie->loadTexture("/data/character_zombie_idle.png");
zombie->xPos(1024/2.0F - (zombie->width() * 0.5F));
zombie->yPos(768/2.0F - (zombie->height() * 0.5F));
lh_camera.resize(1024 / 2.0F, 768);
rh_camera.resize(1024 / 2.0F, 768);
lh_camera.lookAt({1024 * 0.25F, 768 / 2.0F});
rh_camera.lookAt({1024 * 0.50F, 768 / 2.0F});
toggleFPS();
}
~ASGENetGame() override = default;
ASGENetGame(const ASGENetGame&) = delete;
ASGENetGame& operator=(const ASGENetGame&) = delete;
private:
std::map<int, bool> keys;
std::map<int, bool> buttons;
void keyHandler(ASGE::SharedEventData data)
{
const auto* key_event = dynamic_cast<const ASGE::KeyEvent*>(data.get());
auto key = key_event->key;
auto action = key_event->action;
if (action == ASGE::KEYS::KEY_PRESSED)
{
if (key == ASGE::KEYS::KEY_8)
{
renderer->setWindowedMode(ASGE::GameSettings::WindowMode::BORDERLESS_FULLSCREEN);
}
if (key == ASGE::KEYS::KEY_9)
{
renderer->setWindowedMode(ASGE::GameSettings::WindowMode::WINDOWED);
}
keys[key] = true;
}
if (action == ASGE::KEYS::KEY_RELEASED)
{
keys[key] = false;
}
}
void update(const ASGE::GameTime& us) override
{
if (auto gamepad_data = inputs->getGamePad(0); gamepad_data.is_connected)
{
for( int i=0; i<gamepad_data.no_of_buttons; ++i)
{
if(gamepad_data.buttons[i] == true)
{
Logging::ERRORS("button event" + std::to_string(i));
}
}
}
if(keys[ASGE::KEYS::KEY_A])
{
robot->xPos(robot->xPos() -5);
// rh_camera.translateX(-5);
}
if(keys[ASGE::KEYS::KEY_D])
{
robot->xPos(robot->xPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_W])
{
robot->yPos(robot->yPos() -5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_S])
{
robot->yPos(robot->yPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_LEFT])
{
zombie->xPos(zombie->xPos() -5);
// rh_camera.translateX(-5);
}
if(keys[ASGE::KEYS::KEY_RIGHT])
{
zombie->xPos(zombie->xPos() +5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_UP])
{
zombie->yPos(zombie->yPos() -5);
// rh_camera.translateX(+5);
}
if(keys[ASGE::KEYS::KEY_DOWN])
{
zombie->yPos(zombie->yPos() +5);
// rh_camera.translateX(+5);
}
lh_camera.lookAt(
{
robot->xPos() + robot->width() * 0.5F,
robot->yPos() + robot->height() * 0.5F });
rh_camera.lookAt(
{
zombie->xPos() + zombie->width() * 0.5F,
zombie->yPos() + zombie->height() * 0.5F });
lh_camera.update(us);
rh_camera.update(us);
};
void render(const ASGE::GameTime& us) override
{
renderer->setViewport({0, 0, 1024/2, 768});
renderer->setProjectionMatrix(lh_camera.getView());
renderer->render(*bg);
renderer->render(*robot);
renderer->render(*zombie);
auto view = rh_camera.getView();
renderer->setViewport({1024/2, 0, 1024/2, 768});
renderer->setProjectionMatrix(view);
renderer->render(*bg);
renderer->render(*robot);
renderer->render(*zombie);
ASGE::Text camera1 = ASGE::Text{ renderer->getDefaultFont(), "CAMERA1" };
camera1.setPositionX(1024 * 0.25F - (camera1.getWidth() * 0.5F));
camera1.setPositionY(30);
ASGE::Text camera2 = ASGE::Text{ renderer->getDefaultFont(), "CAMERA2" };
camera2.setPositionX(1024 * 0.75F - (camera2.getWidth() * 0.5F));
camera2.setPositionY(30);
renderer->setViewport({0, 0, 1024, 768});
renderer->setProjectionMatrix(0, 1024, 0, 768);
renderer->render(camera1);
renderer->render(camera2);
};
private:
int key_callback_id = -1; /**< Key Input Callback ID. */
std::unique_ptr<ASGE::Sprite> bg = nullptr;
std::unique_ptr<ASGE::Sprite> zombie = nullptr;
std::unique_ptr<ASGE::Sprite> robot = nullptr;
ASGE::Camera lh_camera{};
ASGE::Camera rh_camera{};
};
int main(int /*argc*/, char* /*argv*/[])
{
ASGE::GameSettings game_settings;
game_settings.window_title = "ASGEGame";
game_settings.window_width = 1024;
game_settings.window_height = 768;
game_settings.mode = ASGE::GameSettings::WindowMode::WINDOWED;
game_settings.fixed_ts = 60;
game_settings.fps_limit = 60;
game_settings.msaa_level = 1;
game_settings.vsync = ASGE::GameSettings::Vsync::DISABLED;
Logging::INFO("Launching Game!");
ASGENetGame game(game_settings);
game.run();
return 0;
}
| 27.612245 | 89 | 0.610495 | Alexthehuman3 |
15743c4d3608a7c308708ba8361f4a10efa99cec | 692 | cpp | C++ | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | OOP/Lab 1/Ex 1/main.cpp | LjupcheD14/FINKI1408 | be2454864d8aa0c33621141295f958424c7b0f16 | [
"Apache-2.0"
] | null | null | null | #include <stdio.h>
#include <ctype.h>
#include <string.h>
struct Product {
char ime[100];
float cena;
float kolicina;
};
typedef struct Product Product;
int main() {
// Product p;
// readProduct(&p);
// printProduct(p);
Product p[100];
int n, i;
float vkupno, total = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %f %f", &p[i].ime, &p[i].cena, &p[i].kolicina);
}
for (i = 0; i < n; i++) {
vkupno = (p[i].cena) * (p[i].kolicina);
total += vkupno;
printf("%d. %s\t%.2f x %.1f = %.2f \n", i+1, p[i].ime, p[i].cena, p[i].kolicina, vkupno);
}
printf("Total: %.2f", total);
return 0;
}
| 18.702703 | 97 | 0.492775 | LjupcheD14 |
1574697262692c84ffdfca80b6206837b0b7ebcd | 452 | hpp | C++ | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | 1 | 2022-02-02T21:41:59.000Z | 2022-02-02T21:41:59.000Z | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | null | null | null | sources/cards/Land.hpp | angeluriot/Magic_royal | a337ce4ad6c3215bbdec8c376d6e88fe97f48f94 | [
"MIT"
] | 2 | 2022-02-01T12:59:57.000Z | 2022-03-05T12:50:27.000Z | #ifndef LAND_HPP
#define LAND_HPP
#include "cards/Card.hpp"
#include <string>
/**
* @brief A class that represent a land.
*/
class Land : public Card
{
public:
Land();
Land(const Land& other) = default;
virtual ~Land();
Land& operator=(const Land& other) = default;
virtual Type get_type() const override;
virtual std::string get_full_type() const override;
virtual Cost get_cost() const override;
virtual void print() const;
};
#endif
| 16.740741 | 52 | 0.705752 | angeluriot |
157d4409d04beef2c70f721cd2e0e9ed106de6f5 | 3,551 | hpp | C++ | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | 19 | 2020-12-04T01:50:52.000Z | 2022-03-27T18:18:50.000Z | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | 5 | 2021-02-09T21:21:35.000Z | 2022-01-28T09:50:20.000Z | src/app.hpp | ITotalJustice/untitled | e4058e3a2ddd3b23e76707ff79de66000b16be71 | [
"MIT"
] | null | null | null | #pragma once
#include "nanovg/nanovg.h"
#include "nanovg/deko3d/dk_renderer.hpp"
#include <switch.h>
#include <cstdint>
#include <vector>
#include <string>
#include <future>
#include <mutex>
#include <optional>
#include <functional>
namespace tj {
using AppID = std::uint64_t;
enum class MenuMode { LIST, CONFIRM, PROGRESS };
struct Controller final {
// these are tap only
bool A;
bool B;
bool X;
bool Y;
bool L;
bool R;
bool L2;
bool R2;
bool START;
bool SELECT;
// these can be held
bool LEFT;
bool RIGHT;
bool UP;
bool DOWN;
static constexpr int MAX = 1000;
static constexpr int MAX_STEP = 250;
int step = 50;
int counter = 0;
void UpdateButtonHeld(bool& down, bool held);
};
struct AppEntry final {
std::string name;
std::string author;
std::string display_version;
std::size_t size_nand;
std::size_t size_sd;
std::size_t size_total;
AppID id;
int image;
bool selected{false};
};
struct NsDeleteData final {
std::vector<AppID> entries;
std::function<void(bool)> del_cb; // called when deleted an entry
std::function<void(void)> done_cb; // called when finished
};
void NsDeleteAppsAsync(const NsDeleteData& data);
class App final {
public:
App();
~App();
void Loop();
private:
NVGcontext* vg{nullptr};
std::vector<AppEntry> entries;
std::vector<AppID> delete_entries;
PadState pad{};
Controller controller{};
std::size_t nand_storage_size_total{};
std::size_t nand_storage_size_used{};
std::size_t nand_storage_size_free{};
std::size_t sdcard_storage_size_total{};
std::size_t sdcard_storage_size_used{};
std::size_t sdcard_storage_size_free{};
std::future<void> async_thread;
std::mutex mutex{};
std::size_t delete_index{}; // mutex locked
bool finished_deleting{false}; // mutex locked
// this is just bad code, ignore it
static constexpr float BOX_HEIGHT{120.f};
float yoff{130.f};
float ypos{130.f};
std::size_t start{0};
std::size_t delete_count{0};
std::size_t index{}; // where i am in the array
MenuMode menu_mode{MenuMode::LIST};
bool quit{false};
enum class SortType {
Alpha_AZ,
Alpha_ZA,
Size_BigSmall,
Size_SmallBig,
MAX,
};
uint8_t sort_type{static_cast<uint8_t>(SortType::Size_BigSmall)};
void Draw();
void Update();
void Poll();
bool Scan(); // called on init
void Sort();
const char* GetSortStr();
void UpdateList();
void UpdateConfirm();
void UpdateProgress();
void DrawBackground();
void DrawList();
void DrawConfirm();
void DrawProgress();
private: // from nanovg decko3d example by adubbz
static constexpr unsigned NumFramebuffers = 2;
static constexpr unsigned StaticCmdSize = 0x1000;
dk::UniqueDevice device;
dk::UniqueQueue queue;
std::optional<CMemPool> pool_images;
std::optional<CMemPool> pool_code;
std::optional<CMemPool> pool_data;
dk::UniqueCmdBuf cmdbuf;
CMemPool::Handle depthBuffer_mem;
CMemPool::Handle framebuffers_mem[NumFramebuffers];
dk::Image depthBuffer;
dk::Image framebuffers[NumFramebuffers];
DkCmdList framebuffer_cmdlists[NumFramebuffers];
dk::UniqueSwapchain swapchain;
DkCmdList render_cmdlist;
std::optional<nvg::DkRenderer> renderer;
void createFramebufferResources();
void destroyFramebufferResources();
void recordStaticCommands();
};
} // namespace tj
| 23.673333 | 69 | 0.669952 | ITotalJustice |
15813d024190ed209c448087869968168e95854e | 2,599 | cpp | C++ | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | 2 | 2016-04-01T21:10:33.000Z | 2018-02-26T19:36:56.000Z | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | 1 | 2017-04-05T01:33:08.000Z | 2017-04-05T01:33:08.000Z | Engine_Core/source/Window.cpp | subr3v/s-engine | d77b9ccd0fff3982a303f14ce809691a570f61a3 | [
"MIT"
] | null | null | null | #include "Window.h"
#include "Input.h"
#include <algorithm>
static LRESULT CALLBACK MyWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
{
if (uMsg == WM_QUIT || uMsg == WM_CLOSE)
{
PostQuitMessage(0);
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
FWindow::FWindow(HINSTANCE hInstance, int nCmdShow, int Width, int Height) : WindowWidth(Width), WindowHeight(Height)
{
RegisterWindow(hInstance);
WindowHandle = CreateWindow ("WindowClass",
"Engine Window",
WS_OVERLAPPED | WS_THICKFRAME | WS_MAXIMIZEBOX,
0,
0,
Width,
Height,
NULL,
NULL,
hInstance,
NULL);
SetWindowLong(WindowHandle, GWL_USERDATA, (LONG)this);
ShowWindow(WindowHandle, nCmdShow);
UpdateWindow(WindowHandle);
}
FWindow::~FWindow()
{
DestroyWindow(WindowHandle);
}
bool FWindow::HandleEvents()
{
bool IsWindowBeingDestroyed = false;
MSG Message;
while (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Message);
if (Message.message == WM_QUIT || Message.message == WM_CLOSE || Message.message == WM_DESTROY)
{
IsWindowBeingDestroyed = true;
}
for (auto EventHandler : EventHandlers)
{
EventHandler->HandleMessage(Message);
}
DispatchMessage(&Message);
}
return IsWindowBeingDestroyed == false;
}
// Defines the window
void FWindow::RegisterWindow(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof (wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = MyWindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor (NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "WindowClass";
wcex.hIconSm = 0;
RegisterClassEx (&wcex);
}
int FWindow::GetWidth() const
{
RECT wRect;
GetWindowRect(WindowHandle, &wRect);
return wRect.right - wRect.left;
}
int FWindow::GetHeight() const
{
RECT wRect;
GetWindowRect(WindowHandle, &wRect);
return wRect.bottom - wRect.top;
}
void FWindow::SetTitle(const std::string& Title)
{
SetWindowText(WindowHandle, Title.c_str());
}
void FWindow::RegisterEventHandler(IWindowsEventHandler* EventHandler)
{
EventHandlers.Add(EventHandler);
EventHandler->WindowHandle = WindowHandle;
}
void FWindow::UnregisterEventHandler(IWindowsEventHandler* EventHandler)
{
EventHandler->WindowHandle = nullptr;
EventHandlers.Remove(EventHandler);
}
void FMessageBox::ShowSimpleMessage(LPSTR MessageText)
{
MessageBox(NULL, MessageText, "MessageBox", MB_OK);
}
| 21.130081 | 117 | 0.722201 | subr3v |
158226c04206e99f39e4a181a1e8308f0b5768de | 476 | hpp | C++ | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | 2 | 2021-01-14T11:19:02.000Z | 2021-03-07T03:08:08.000Z | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | null | null | null | include/operations/system.hpp | rationalis-petra/hydra | a1c14e560f5f1c64983468e5fd0be7b32824971d | [
"MIT"
] | null | null | null | #ifndef __MODULUS_OPERATIONS_SYSTEM_HPP
#define __MODULUS_OPERATIONS_SYSTEM_HPP
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
#include <string>
#include "expressions.hpp"
namespace op {
void initialize_system();
extern expr::Operator* get_dir;
extern expr::Operator* set_dir;
extern expr::Operator* mk_dir;
extern expr::Operator* mk_file;
extern expr::Operator* fs_remove;
extern expr::Operator* fs_remove_all;
}
#endif
| 19.04 | 42 | 0.768908 | rationalis-petra |
15865ad7436e927b97a9785032a5aced22cb68fb | 1,254 | cpp | C++ | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 3 | 2017-08-13T14:47:57.000Z | 2020-03-02T06:48:29.000Z | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 1 | 2018-09-19T14:14:54.000Z | 2018-09-26T22:35:03.000Z | rssavers-0.2/src/Implicit/impSphere.cpp | NickPepper/MacScreensavers | 088625b06b123adcb61c7e9e1adc4415dda66a59 | [
"MIT"
] | 1 | 2018-09-19T14:13:55.000Z | 2018-09-19T14:13:55.000Z | /*
* Copyright (C) 2001-2010 Terence M. Welsh
*
* This file is part of Implicit.
*
* Implicit is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Implicit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <Implicit/impSphere.h>
float impSphere::value(float* position){
const float tx(invmat[12] + position[0]);
const float ty(invmat[13] + position[1]);
const float tz(invmat[14] + position[2]);
// Use thickness instead of relying on scale to be in the matrix
// because the value computation for a sphere is simplified by
// using an incomplete matrix.
return thicknessSquared / (tx*tx + ty*ty + tz*tz + IMP_MIN_DIVISOR);
}
| 35.828571 | 76 | 0.730463 | NickPepper |
158774882ee46c4b3893765ae1921c01dab98682 | 3,523 | cpp | C++ | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | pinpoint_common/trace_data_sender.cpp | wy1238/pinpoint-c-agent | c762804c58fa75755680f52174647b0f208839a1 | [
"Apache-2.0"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
// Copyright 2018 NAVER Corp.
//
// 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 "trace_data_sender.h"
#include "pinpoint_agent_context.h"
#include "serializer.h"
using namespace Pinpoint::log;
using namespace Pinpoint::utils;
using namespace Pinpoint::Trace;
namespace Pinpoint
{
namespace Agent
{
TraceDataSender::TraceDataSender(const boost::shared_ptr<DataSender> &dataSender)
: dataSender(dataSender)
{
}
TraceDataSender::~TraceDataSender()
{
}
int32_t TraceDataSender::init()
{
LOGI("TraceDataSender::init() start. ");
TMemoryBuffer *tb = new(std::nothrow) TMemoryBuffer();
if (tb == NULL)
{
LOGE("new TMemoryBuffer fail.");
return FAILED;
}
this->transportOut.reset(tb);
TCompactProtocol *tp = new(std::nothrow) TCompactProtocol(this->transportOut);
if (tp == NULL)
{
LOGE("new TCompactProtocol fail.");
return FAILED;
}
this->protocolOut.reset(tp);
return SUCCESS;
}
int32_t TraceDataSender::start()
{
return SUCCESS;
}
int32_t TraceDataSender::send(const TracePtr &tracePtr)
{
if (protocolOut == NULL || transportOut == NULL)
{
return FAILED;
}
try
{
std::string data;
int32_t err;
PINPOINT_ASSERT_RETURN ((tracePtr != NULL), FAILED);
DefaultTracePtr defaultTracePtr = boost::dynamic_pointer_cast<DefaultTrace>(tracePtr);
SpanPtr& spanPtr = defaultTracePtr->getSpanPtr();
PINPOINT_ASSERT_RETURN ((spanPtr != NULL), FAILED);
LOGI("Span: [%s]", utils::TBaseToString(spanPtr->getTSpan()).c_str());
err = serializer.serializer(spanPtr->getTSpan(), data);
if (err != SUCCESS)
{
LOGE("serializer trace failed");
return err;
}
PacketPtr packetPtr(new Packet(PacketType::HEADLESS, 1));
PacketData& packetData = packetPtr->getPacketData();
packetData = data;
return this->dataSender->sendPacket(packetPtr, 100);
}
catch (std::bad_alloc& e)
{
LOGE("TraceDataSender::send throw: e=%s", e.what());
return FAILED;
}
catch (std::exception& e)
{
LOGE("TraceDataSender::send throw: e=%s", e.what());
assert (false);
return FAILED;
}
}
}
}
| 29.855932 | 102 | 0.516321 | wy1238 |
1592a0ee02eeca8c71a3027a1dac478fcbc7f092 | 536 | hpp | C++ | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | 1 | 2020-07-11T14:53:38.000Z | 2020-07-11T14:53:38.000Z | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | 1 | 2020-07-04T16:45:49.000Z | 2020-07-04T16:45:49.000Z | include/core/i_token.hpp | nathanmullenax83/rhizome | e7410341fdc4d38ab5aaecc55c94d3ac6efd51da | [
"MIT"
] | null | null | null | #ifndef RHIZOME_CORE_I_TOKEN
#define RHIZOME_CORE_I_TOKEN
#include <string>
using std::string;
namespace rhizome {
namespace core {
class IToken {
public:
virtual void set( string const &tvalue, string const &tname, size_t line_no, size_t col) = 0;
virtual size_t line() const = 0;
virtual size_t column() const = 0;
virtual string token_value() const = 0;
virtual string token_class() const = 0;
};
}
}
#endif
| 19.851852 | 105 | 0.574627 | nathanmullenax83 |
1592c20bc5e43827ebc67ceab4b66bf191a85f2c | 3,752 | hpp | C++ | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 1 | 2021-11-12T09:29:31.000Z | 2021-11-12T09:29:31.000Z | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | null | null | null | include/codegen/include/System/Diagnostics/Tracing/EventManifestOptions.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:09:54 PM
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
// Including type: System.Enum
#include "System/Enum.hpp"
#include "utils/il2cpp-utils.hpp"
// Completed includes
// Begin forward declares
// Completed forward declares
// Type namespace: System.Diagnostics.Tracing
namespace System::Diagnostics::Tracing {
// Autogenerated type: System.Diagnostics.Tracing.EventManifestOptions
struct EventManifestOptions : public System::Enum {
public:
// public System.Int32 value__
// Offset: 0x0
int value;
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions None
static constexpr const int None = 0;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions None
static System::Diagnostics::Tracing::EventManifestOptions _get_None();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions None
static void _set_None(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static constexpr const int Strict = 1;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static System::Diagnostics::Tracing::EventManifestOptions _get_Strict();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions Strict
static void _set_Strict(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static constexpr const int AllCultures = 2;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static System::Diagnostics::Tracing::EventManifestOptions _get_AllCultures();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions AllCultures
static void _set_AllCultures(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static constexpr const int OnlyIfNeededForRegistration = 4;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static System::Diagnostics::Tracing::EventManifestOptions _get_OnlyIfNeededForRegistration();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions OnlyIfNeededForRegistration
static void _set_OnlyIfNeededForRegistration(System::Diagnostics::Tracing::EventManifestOptions value);
// static field const value: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static constexpr const int AllowEventSourceOverride = 8;
// Get static field: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static System::Diagnostics::Tracing::EventManifestOptions _get_AllowEventSourceOverride();
// Set static field: static public System.Diagnostics.Tracing.EventManifestOptions AllowEventSourceOverride
static void _set_AllowEventSourceOverride(System::Diagnostics::Tracing::EventManifestOptions value);
// Creating value type constructor for type: EventManifestOptions
EventManifestOptions(int value_ = {}) : value{value_} {}
}; // System.Diagnostics.Tracing.EventManifestOptions
}
DEFINE_IL2CPP_ARG_TYPE(System::Diagnostics::Tracing::EventManifestOptions, "System.Diagnostics.Tracing", "EventManifestOptions");
#pragma pack(pop)
| 65.824561 | 129 | 0.784915 | Futuremappermydud |
15953631a5d2d4b574af1f3a6153bdadf255b2f5 | 15,158 | hpp | C++ | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | 1 | 2020-06-22T04:15:16.000Z | 2020-06-22T04:15:16.000Z | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | null | null | null | include/GaussianMixture.hpp | szma/RFS-SLAM | def8f1e8cc788bbe4347cd57f79061f70b0b41dd | [
"Unlicense"
] | null | null | null | /*
* Software License Agreement (New BSD License)
*
* Copyright (c) 2013, Keith Leung, Felipe Inostroza
* 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 Advanced Mining Technology Center (AMTC), the
* Universidad de Chile, 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 AMTC, UNIVERSIDAD DE CHILE, OR THE COPYRIGHT
* HOLDERS 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.
*/
#ifndef GAUSSIAN_MIXTURE_HPP
#define GAUSSIAN_MIXTURE_HPP
#include <algorithm>
#include <iostream>
#include "Landmark.hpp"
#include "RandomVecMathTools.hpp"
#include <vector>
/**
* \class GaussianMixture
* \brief A class for mixture of Gaussians
*
* This class represents a mixture of weighted Gaussians
* It is designed to work with the RBPHDFilter
*
* \author Keith Leung
*/
template< class Landmark >
class GaussianMixture
{
public:
typedef Landmark TLandmark;
typedef Landmark* pLandmark;
/** \brief A data structure representing a weighted Gaussian distribution in GaussianMixture */
struct Gaussian{
pLandmark landmark; /**< pointer to a Landmark, which holds the mean and covariance */
double weight; /**< weight of Gaussian */
double weight_prev; /**< previous weight of Gaussian (used in computations by the RBPHDFilter) */
};
/** Default constructor */
GaussianMixture();
/** Destructor */
~GaussianMixture();
/**
* Copy data from this GaussianMixture to another GaussianMixture.
* Memory is allocated for creating copies of Gaussians for the other GaussianMixture.
* \param[in,out] other the other Gaussian mixture to which data is copied to
*/
void copyTo( GaussianMixture *other);
/**
* Add a Gaussian to this GaussianMixture
* \param[in] p pointer to the Landmark which holds the mean and covariance
* \param[in] w weight of the new Gaussian
* \param[in] allocateMem if false, the function assumes memory for Landmark has already been allocated
* and will not go out of scope or get deleted, other than by the current instantiation of GaussianMixture.
* If true, memory is allocated for a new Landmark and data from p is copied to it.
* \return number of Gaussians in the mixture
*/
unsigned int addGaussian( pLandmark p, double w = 1, bool allocateMem = false);
/**
* Remove a Gaussian from the mixture
* \param[in] idx index number of the Gaussian to remove
* \return number of Gaussians in the mixture
*/
unsigned int removeGaussian( unsigned int idx );
/**
* Get the number of Gaussians in the mixture
* \return count
*/
unsigned int getGaussianCount();
/**
* Set the weight of a Gaussian indicated by the given index
* \param[in] idx index
* \param[in] w weight
*/
void setWeight( unsigned int idx, double w );
/**
* Get the weight of a Gaussian indicated by the given index
* \param[in] idx index
* \return weight
*/
double getWeight( unsigned int idx );
/**
* Get the parameters of a Gaussian (stored as a Landmark)
* \param[in] idx index
* \return pointer to a Landmark, or NULL if the Gaussian does not exist.
*/
pLandmark getGaussian( unsigned int idx );
/**
* Get the parameters of a Gaussian (stored as a Landmark)
* \param[in] idx index
* \param[out] p pointer to a Landmark that holds the Gaussian parameters
*/
void getGaussian( unsigned int idx, pLandmark &p);
/**
* Get the state and weight of a Gaussian
* \param[in] idx index
* \param[out] p pointer to a Landmark which holds the mean and covariance
* \param[out] w the weight
*/
void getGaussian( unsigned int idx, pLandmark &p, double &w);
/**
* Get the parameters and weight of a Gaussian
* \param[in] idx index
* \param[out] p pointer to a Landmark which holds the mean and covariance
* \param[out] w overwritten by the weight
* \param[out] w_prev overwritten by the previous weight (used in parts of the RBPHDFilter)
*/
void getGaussian( unsigned int idx, pLandmark &p, double &w, double &w_prev);
/**
* Update an Gaussian in the mixture.
* \param[in] idx index of the Gaussian to update
* \param[in] lm Landmark object with the updated mean and covariance
* \param[in] w weight of the updated Gaussian. No change are made to the existing weight if this is negative.
* \return true if idx is valid and Gaussian is updated
*/
bool updateGaussian( unsigned int idx, Landmark &lm, double w = -1);
/**
* Check all Gaussians in the mixture and merge those that are within a certain Mahalanobis distance of each other
* \param[in] t distance threshold (the default value squares to 0.1)
* \param[in] f_inflation merged Gaussian covariance inflation factor (default value causes no inflation)
* \return number of merging operations
*/
unsigned int merge(const double t = 0.31622776601, const double f_inflation = 1.0);
/**
* Prune the Gaussian mixture to remove Gaussians with weights that are
* less than a given threshold.
* \note Gaussians may have difference indices after using this function due to sorting performed on gList_
* \param[in] t weight threshold, below which Gaussians are removed.
* \return number of Gaussians removed
*/
unsigned int prune( const double t );
/**
* Sort the Gaussian mixture container gList_ from highest to lowest Gaussian weight.
*/
void sortByWeight();
protected:
int n_; /**< number of Gaussians in this GaussianMixture */
std::vector<Gaussian> gList_; /**< container for Gaussians */
bool isSorted_; /**< a flag to prevent unecessary sorting */
/**
* Comparison function used by sortByWeight() for sorting the Gaussian container gList_.
*/
static bool weightCompare(Gaussian a, Gaussian b);
/**
* Add a Gaussian to this GaussianMixture, by overwrite an existing spot in the Gaussian container.
* \param[in] idx element in the container gList_ to overwrite.
* \param[in] p pointer to the Landmark to add, which holds the mean and covariance.
* \param[in] w weight of the new Gaussian.
* \param[in] allocateMem if false, this assumes memory for Landmark has already been allocated
* and will not go out of scope or get deleted, other than by the current instantiation of GaussianMixture.
* If true, memory is allocated for a new Landmark and data from p is copied to it.
* \return number of Gaussians in the mixture
*/
unsigned int addGaussian( unsigned int idx, pLandmark p, double w = 1, bool allocateMem = false);
/**
* Merge two Guassians if the second is within a Mahalanobis distance of the first.
* If merging occurs, the resulting Gaussian will overwrite the first Gaussian,
* and second one will be removed from the Gaussian mixture.
* \param[in] idx1 index of the first Gaussian
* \param[in] idx2 index of the second Gaussian
* \param[in] t distance threshold (the default value squares to 0.1)
* \param[in] f_inflation merged Gaussian covariance inflation factor
* \return true if merging is successful
*/
bool merge(unsigned int idx1, unsigned int idx2,
const double t = 0.3162277660, const double f_inflation = 1.0);
};
////////// Implementation //////////
template< class Landmark >
GaussianMixture<Landmark>::GaussianMixture(){
n_ = 0;
isSorted_ = false;
}
template< class Landmark >
GaussianMixture<Landmark>::~GaussianMixture(){
for( int i = 0; i < gList_.size(); i++){
removeGaussian(i);
}
}
template< class Landmark >
void GaussianMixture<Landmark>::copyTo( GaussianMixture *other){
other->n_ = n_;
other->gList_ = gList_;
for(int i = 0; i < gList_.size(); i++){
Landmark* lmkCopy = new Landmark;
*lmkCopy = *(gList_[i].landmark);
other->gList_[i].landmark = lmkCopy;
}
other->isSorted_ = isSorted_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::addGaussian( pLandmark p, double w,
bool allocateMem){
isSorted_ = false;
Landmark* pNew = NULL;
if(allocateMem){
pNew = new Landmark;
*pNew = *p;
}else{
pNew = p;
}
Gaussian g = {pNew, w, 0};
gList_.push_back(g);
n_++;
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::addGaussian( unsigned int idx, pLandmark p, double w,
bool allocateMem){
isSorted_ = false;
Landmark* pNew = NULL;
if(allocateMem){
pNew = new Landmark;
*pNew = *p;
}else{
pNew = p;
}
if (gList_[idx].landmark != NULL){
removeGaussian( idx );
}
gList_[idx].landmark = pNew;
gList_[idx].weight = w;
gList_[idx].weight_prev = 0;
n_++;
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::removeGaussian( unsigned int idx ){
isSorted_ = false;
if(gList_[idx].landmark != NULL){
delete gList_[idx].landmark;
gList_[idx].landmark = NULL;
gList_[idx].weight = 0;
gList_[idx].weight_prev = 0;
n_--;
}
return n_;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::getGaussianCount(){
return n_;
}
template< class Landmark >
void GaussianMixture<Landmark>::setWeight( unsigned int idx, double w ){
isSorted_ = false;
gList_[idx].weight_prev = gList_[idx].weight;
gList_[idx].weight = w;
}
template< class Landmark >
double GaussianMixture<Landmark>::getWeight( unsigned int idx){
return gList_[idx].weight;
}
template< class Landmark >
typename GaussianMixture<Landmark>::pLandmark GaussianMixture<Landmark>::getGaussian( unsigned int idx ){
return (gList_[idx].landmark);
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p){
p = gList_[idx].landmark;
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p, double &w){
p = gList_[idx].landmark;
w = gList_[idx].weight;
}
template< class Landmark >
void GaussianMixture<Landmark>::getGaussian( unsigned int idx, pLandmark &p, double &w, double &w_prev){
p = gList_[idx].landmark;
w = gList_[idx].weight;
w_prev = gList_[idx].weight_prev;
}
template< class Landmark >
bool GaussianMixture<Landmark>::updateGaussian( unsigned int idx, Landmark &lm, double w){
isSorted_ = false;
if( idx > gList_.size() || gList_[idx].landmark == NULL)
return false;
if ( w < 0 )
w = getWeight( idx );
*(gList_[idx].landmark) = lm;
gList_[idx].weight_prev = gList_[idx].weight;
gList_[idx].weight = w;
return true;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::merge(const double t,
const double f_inflation){
isSorted_ = false;
unsigned int nMerged = 0;
int nGaussians = gList_.size();
for(unsigned int i = 0; i < nGaussians; i++){
for(unsigned int j = i+1; j < nGaussians; j++){
if( merge(i, j, t, f_inflation) ){
nMerged++;
}
}
}
return nMerged;
}
template< class Landmark >
bool GaussianMixture<Landmark>::merge(unsigned int idx1, unsigned int idx2,
const double t, const double f_inflation){
isSorted_ = false;
if (gList_[idx1].landmark == NULL ||
gList_[idx2].landmark == NULL ){
return false;
}
double w_m, w_1, w_2;
double d_mahalanobis_1, d_mahalanobis_2;
w_1 = gList_[idx1].weight;
w_2 = gList_[idx2].weight;
double t2 = t * t;
d_mahalanobis_1 = gList_[idx1].landmark->mahalanobisDist2( *(gList_[idx2].landmark) );
if( d_mahalanobis_1 > t2 ){
d_mahalanobis_2 = gList_[idx2].landmark->mahalanobisDist2( *(gList_[idx1].landmark) );
if( d_mahalanobis_2 > t2 ){
return false;
}
}
w_m = w_1 + w_2;
if( w_m == 0 )
return false;
typename Landmark::Vec x_1, x_2, x_m, d_1, d_2;
typename Landmark::Mat S_1, S_2, S_m;
gList_[idx1].landmark->get(x_1, S_1);
gList_[idx2].landmark->get(x_2, S_2);
x_m = (x_1 * w_1 + x_2 * w_2) / w_m;
d_1 = x_m - x_1;
d_2 = x_m - x_2;
S_m = ( w_1 * ( S_1 + f_inflation * d_1 * d_1.transpose() ) +
w_2 * ( S_2 + f_inflation * d_2 * d_2.transpose() ) ) / w_m;
//std::cout << "\n" << x_1 << "\n" << S_1 << "\n\n";
//std::cout << "\n" << x_2 << "\n" << S_2 << "\n\n";
//std::cout << "\n" << x_m << "\n" << S_m << "\n\n";
gList_[idx1].landmark->set(x_m, S_m);
gList_[idx1].weight = w_m;
gList_[idx1].weight_prev = 0;
removeGaussian( idx2 ); // this also takes care of updating Gaussian count
return true;
}
template< class Landmark >
unsigned int GaussianMixture<Landmark>::prune( const double t ){
isSorted_ = false;
unsigned int nPruned = 0;
if( gList_.size() < 1 ){
return nPruned;
}
sortByWeight(); // Sort from greatest to smallest weight
// Binary search for the Gaussian with weight closest to and greater than t
unsigned int min_idx = 0;
unsigned int max_idx = gList_.size() - 1;
unsigned int idx = (unsigned int)( (max_idx + min_idx) / 2 );
unsigned int idx_old = idx + 1;
double w = gList_[idx].weight;
while(idx != idx_old){
if( w <= t ){
max_idx = idx;
}else if ( w > t ){
min_idx = idx;
}
idx_old = idx;
idx = (unsigned int)( (max_idx + min_idx) / 2 );
w = gList_[idx].weight;
}
while( w >= t && idx < gList_.size() - 1 ){
idx++;
w = gList_[idx].weight;
}
idx_old = idx;
while( idx < gList_.size() ){
removeGaussian(idx); // this already takes care updating the Gaussian count
idx++;
nPruned++;
}
gList_.resize(idx_old);
return nPruned;
}
template< class Landmark >
void GaussianMixture<Landmark>::sortByWeight(){
if( !isSorted_ ){
std::sort( gList_.begin(), gList_.end(), weightCompare );
isSorted_ = true;
}
}
template< class Landmark >
bool GaussianMixture<Landmark>::weightCompare(Gaussian a, Gaussian b){
return a.weight > b.weight;
}
#endif
| 30.255489 | 116 | 0.68162 | szma |
1598549d05d06faa7337a37ea28978e5f03f4c8b | 13,161 | cpp | C++ | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | 1 | 2020-04-19T20:34:15.000Z | 2020-04-19T20:34:15.000Z | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | null | null | null | src/chrono_fea/ChBeamSection.cpp | LongJohnCoder/chrono | eb7ab2f650c14de65bfff1209c9d56f2f202c428 | [
"BSD-3-Clause"
] | null | null | null | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Alessandro Tasora
// =============================================================================
#include "chrono_fea/ChBeamSection.h"
namespace chrono {
namespace fea {
/// Shortcut: set Area, Ixx, Iyy, Ksy, Ksz and J torsion constant
/// at once, given the y and z widths of the beam assumed
/// with rectangular shape.
void ChElasticityTimoshenkoSimple::SetAsRectangularSection(double width_y, double width_z) {
this->Izz = (1.0 / 12.0) * width_z * pow(width_y, 3);
this->Iyy = (1.0 / 12.0) * width_y * pow(width_z, 3);
// use Roark's formulas for torsion of rectangular sect:
double t = ChMin(width_y, width_z);
double b = ChMax(width_y, width_z);
this->J = b * pow(t, 3) * ((1.0 / 3.0) - 0.210 * (t / b) * (1.0 - (1.0 / 12.0) * pow((t / b), 4)));
// set Ks using Timoshenko-Gere formula for solid rect.shapes
double poisson = this->E / (2.0 * this->G) - 1.0;
this->Ks_y = 10.0 * (1.0 + poisson) / (12.0 + 11.0 * poisson);
this->Ks_z = this->Ks_y;
}
/// Shortcut: set Area, Ixx, Iyy, Ksy, Ksz and J torsion constant
/// at once, given the diameter of the beam assumed
/// with circular shape.
void ChElasticityTimoshenkoSimple::SetAsCircularSection(double diameter) {
this->Izz = (CH_C_PI / 4.0) * pow((0.5 * diameter), 4);
this->Iyy = Izz;
// exact expression for circular beam J = Ixx ,
// where for polar theorem Ixx = Izz+Iyy
this->J = Izz + Iyy;
// set Ks using Timoshenko-Gere formula for solid circular shape
double poisson = this->E / (2.0 * this->G) - 1.0;
this->Ks_y = 6.0 * (1.0 + poisson) / (7.0 + 6.0 * poisson);
this->Ks_z = this->Ks_y;
}
void ChElasticityTimoshenkoSimple::ComputeStress(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
stress_n.x() = E * section->Area * strain_n.x();
stress_n.y() = Ks_y * G * section->Area * strain_n.y();
stress_n.z() = Ks_z * G * section->Area * strain_n.z();
stress_m.x() = G * J * strain_m.x();
stress_m.y() = E * Iyy * strain_m.y();
stress_m.z() = E * Izz * strain_m.z();
}
/// Compute the 6x6 tangent material stiffness matrix [Km] =d\sigma/d\epsilon
void ChElasticityTimoshenkoSimple::ComputeStiffnessMatrix(
ChMatrixDynamic<>& K, ///< return the 6x6 stiffness matrix
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
K.Reset(6, 6);
K(0, 0) = E * section->Area;
K(1, 1) = Ks_y * G * section->Area;
K(2, 2) = Ks_z * G * section->Area;
K(3, 3) = G * J;
K(4, 4) = E * Iyy;
K(5, 5) = E * Izz;
}
////////////////////////////////////////////////////////////////////////////////////
void ChElasticityTimoshenkoAdvanced::ComputeStress(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
double Area = section->Area;
double cos_alpha = cos(alpha);
double sin_alpha = sin(alpha);
double a11 = E * section->Area;
double a22 = E * (Iyy * pow(cos_alpha, 2.) + Izz * pow(sin_alpha, 2.) + Cz * Cz * Area);
double a33 = E * (Izz * pow(cos_alpha, 2.) + Iyy * pow(sin_alpha, 2.) + Cy * Cy * Area);
double a12 = Cz * E * Area;
double a13 = -Cy * E * Area;
double a23 = (E* Iyy - E * Izz)*cos_alpha*sin_alpha - E * Cy * Cz * Area;
stress_n.x() = a11 * strain_n.x() + a12 * strain_m.y() + a13 * strain_m.z();
stress_m.y() = a12 * strain_n.x() + a22 * strain_m.y() + a23 * strain_m.z();
stress_m.z() = a13 * strain_n.x() + a23 * strain_m.y() + a33 * strain_m.z();
double cos_beta = cos(beta);
double sin_beta = sin(beta);
double KsyGA = Ks_y * G * Area;
double KszGA = Ks_z * G * Area;
double s11 = KsyGA * pow(cos_beta, 2.) + KszGA * pow(sin_beta, 2.);
double s22 = KsyGA * pow(sin_beta, 2.) + KszGA * pow(cos_beta, 2.); // ..+s_loc_12*sin(beta)*cos(beta);
double s33 = G * J + Sz * Sz * KsyGA + Sy * Sy * KszGA;
double s12 = (KszGA - KsyGA) * sin_beta * cos_beta;
double s13 = Sy * KszGA * sin_beta - Sz * KsyGA * cos_beta;
double s23 = Sy * KszGA * cos_beta + Sz * KsyGA * sin_beta;
stress_n.y() = s11 * strain_n.y() + s12 * strain_n.z() + s13 * strain_m.x();
stress_n.z() = s12 * strain_n.y() + s22 * strain_n.z() + s23 * strain_m.x();
stress_m.x() = s13 * strain_n.y() + s23 * strain_n.z() + s33 * strain_m.x();
}
/// Compute the 6x6 tangent material stiffness matrix [Km] =d\sigma/d\epsilon
void ChElasticityTimoshenkoAdvanced::ComputeStiffnessMatrix(
ChMatrixDynamic<>& K, ///< return the 6x6 stiffness matrix
const ChVector<>& strain_n, ///< the local strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m ///< the local strain (curvature part), x= torsion, y and z are line curvatures
) {
K.Reset(6, 6);
double Area = section->Area;
double cos_alpha = cos(alpha);
double sin_alpha = sin(alpha);
double a11 = E * section->Area;
double a22 = E * (Iyy * pow(cos_alpha, 2.) + Izz * pow(sin_alpha, 2.) + Cz * Cz * Area);
double a33 = E * (Izz * pow(cos_alpha, 2.) + Iyy * pow(sin_alpha, 2.) + Cy * Cy * Area);
double a12 = Cz * E * Area;
double a13 = -Cy * E * Area;
double a23 = (E* Iyy - E * Izz)*cos_alpha*sin_alpha - E * Cy * Cz * Area;
double cos_beta = cos(beta);
double sin_beta = sin(beta);
double KsyGA = Ks_y * G * Area;
double KszGA = Ks_z * G * Area;
double s11 = KsyGA * pow(cos_beta, 2.) + KszGA * pow(sin_beta, 2.);
double s22 = KsyGA * pow(sin_beta, 2.) + KszGA * pow(cos_beta, 2.); // ..+s_loc_12*sin(beta)*cos(beta);
double s33 = G * J + Sz * Sz * KsyGA + Sy * Sy * KszGA;
double s12 = (KszGA - KsyGA) * sin_beta * cos_beta;
double s13 = Sy * KszGA * sin_beta - Sz * KsyGA * cos_beta;
double s23 = Sy * KszGA * cos_beta + Sz * KsyGA * sin_beta;
K(0, 0) = a11;
K(0, 4) = a12;
K(0, 5) = a13;
K(1, 1) = s11;
K(1, 2) = s12;
K(1, 3) = s13;
K(2, 1) = s12;
K(2, 2) = s22;
K(2, 3) = s23;
K(3, 1) = s13;
K(3, 2) = s23;
K(3, 3) = s33;
K(4, 0) = a12;
K(4, 4) = a22;
K(4, 5) = a23;
K(5, 0) = a13;
K(5, 4) = a23;
K(5, 5) = a33;
}
////////////////////////////////////////////////////////////////////////////////////
bool ChPlasticityTimoshenkoLumped::ComputeStressWithReturnMapping(
ChVector<>& stress_n, ///< return the local stress (generalized force), x component = traction along beam
ChVector<>& stress_m, ///< return the local stress (generalized torque), x component = torsion torque along beam
ChVector<>& e_strain_e_new, ///< return updated elastic strain (deformation part)
ChVector<>& e_strain_k_new, ///< return updated elastic strain (curvature part)
ChBeamMaterialInternalData& data_new,///< return updated material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
const ChVector<>& tot_strain_e, ///< trial tot strain (deformation part): x= elongation, y and z are shear
const ChVector<>& tot_strain_k, ///< trial tot strain (curvature part), x= torsion, y and z are line curvatures
const ChBeamMaterialInternalData& data ///< current material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
) {
auto mydata = dynamic_cast<const ChInternalDataLumpedTimoshenko*>(&data);
auto mydata_new = dynamic_cast<ChInternalDataLumpedTimoshenko*>(&data_new);
if (!mydata)
throw ChException("ComputeStressWithReturnMapping cannot cast data to ChInternalDataLumpedTimoshenko*.");
// Implement return mapping for a simple 1D plasticity model.
// Compute the elastic trial stress:
e_strain_e_new = tot_strain_e - mydata->p_strain_e;
e_strain_k_new = tot_strain_k - mydata->p_strain_k;
double p_strain_acc = mydata->p_strain_acc;
this->section->GetElasticity()->ComputeStress(stress_n, stress_m, e_strain_e_new, e_strain_k_new); //<<<< elastic sigma(epsilon)
// compute yeld:
double strain_yeld_x = this->n_yeld_x->Get_y(mydata->p_strain_acc); ///<<<< sigma_y(p_strain_acc)
double eta_x = stress_n.x() - this->n_beta_x->Get_y(mydata->p_strain_e.x()); ///<<<< beta(p_strain_e)
double Fyeld_x = fabs(eta_x) - strain_yeld_x; //<<<< Phi(sigma,p_strain_acc)
if (Fyeld_x < 0)
return false;
// NR loop to compute plastic multiplier:
double Dgamma = 0;
double Dgamma_old = 0;
mydata_new->p_strain_acc = mydata->p_strain_acc;
mydata_new->p_strain_e.x() = mydata->p_strain_e.x();
int iters = 0;
while ((Fyeld_x > this->nr_yeld_tolerance) && (iters < this->nr_yeld_maxiters)) {
double E_x = stress_n.x() / e_strain_e_new.x(); //instead of costly evaluation of Km, =dstress/dstrain
double H = this->n_beta_x->Get_y_dx(mydata->p_strain_e.x())
+ this->n_yeld_x->Get_y_dx(mydata->p_strain_acc); //<<<< H = dyeld/dplasticflow
Dgamma -= Fyeld_x / (-E_x - H);
double dDgamma = Dgamma - Dgamma_old;
Dgamma_old = Dgamma;
mydata_new->p_strain_acc += dDgamma;
e_strain_e_new.x() -= dDgamma * chrono::ChSignum(stress_n.x());
mydata_new->p_strain_e.x() += dDgamma * chrono::ChSignum(stress_n.x());
this->section->GetElasticity()->ComputeStress(stress_n, stress_m, e_strain_e_new, e_strain_k_new); //<<<< elastic sigma(epsilon)
// compute yeld
strain_yeld_x = this->n_yeld_x->Get_y(mydata_new->p_strain_acc); ///<<<< sigma_y(p_strain_acc)
eta_x = stress_n.x() - this->n_beta_x->Get_y(mydata_new->p_strain_e.x()); ///<<<< beta(p_strain_acc)
Fyeld_x = fabs(eta_x) - strain_yeld_x; //<<<< Phi(sigma,p_strain_acc)
++iters;
}
//mydata_new->p_strain_e.x() += Dgamma * chrono::ChSignum(stress_n.x());
return true;
};
////////////////////////////////////////////////////////////////////////////////////
void ChPlasticityTimoshenko::ComputeStiffnessMatrixElastoplastic(
ChMatrixDynamic<>& K, ///< return the 6x6 material stiffness matrix values here
const ChVector<>& strain_n, ///< tot strain (deformation part): x= elongation, y and z are shear
const ChVector<>& strain_m, ///< tot strain (curvature part), x= torsion, y and z are line curvatures
const ChBeamMaterialInternalData& data ///< get & return updated material internal variables, at this point, including {p_strain_m, p_strain_n, p_strain_acc}
) {
ChVector<> astress_n;
ChVector<> astress_m;
ChVector<> me_strain_n_new; // needed only as placeholder
ChVector<> me_strain_m_new; // needed only as placeholder
std::vector< std::unique_ptr<ChBeamMaterialInternalData> > a_plastic_data;
this->CreatePlasticityData(1, a_plastic_data);
std::vector< std::unique_ptr<ChBeamMaterialInternalData> > b_plastic_data;
this->CreatePlasticityData(1, b_plastic_data);
bool in_plastic = ComputeStressWithReturnMapping(astress_n, astress_m, me_strain_n_new, me_strain_m_new, *a_plastic_data[0], strain_n, strain_m, data);
if (!in_plastic) {
// if no return mapping is needed at this strain state, just use elastic matrix:
return this->section->GetElasticity()->ComputeStiffnessMatrix(K, strain_n, strain_m);
}
else {
// if return mapping is needed at this strain state, compute the elastoplastic stiffness by brute force BDF
double epsi = 1e-6;
double invepsi = 1.0 / epsi;
ChVector<> bstress_n;
ChVector<> bstress_m;
ChVector<> strain_n_inc = strain_n;
ChVector<> strain_m_inc = strain_m;
for (int i = 0;i < 2; ++i) {
strain_n_inc[i] += epsi;
this->ComputeStressWithReturnMapping(bstress_n, bstress_m, me_strain_n_new, me_strain_m_new, *b_plastic_data[0], strain_n_inc, strain_m_inc, data);
K.PasteVector((bstress_n - astress_n)*invepsi, 0, i);
K.PasteVector((bstress_m - astress_m)*invepsi, 3, i);
strain_n_inc[i] -= epsi;
}
for (int i = 0;i < 2; ++i) {
strain_m_inc[i] += epsi;
this->ComputeStressWithReturnMapping(bstress_n, bstress_m, me_strain_n_new, me_strain_m_new, *b_plastic_data[0], strain_n_inc, strain_m_inc, data);
K.PasteVector((bstress_n - astress_n)*invepsi, 0, i + 3);
K.PasteVector((bstress_m - astress_m)*invepsi, 3, i + 3);
strain_m_inc[i] -= epsi;
}
}
}
} // end namespace fea
} // end namespace chrono
| 43.57947 | 158 | 0.649723 | LongJohnCoder |
159875b6b5c85376f5b923d32e423bfc9c594dc3 | 140,498 | cpp | C++ | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 496 | 2016-06-10T04:16:47.000Z | 2022-01-24T19:37:03.000Z | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 91 | 2016-07-26T13:18:48.000Z | 2021-08-10T08:54:18.000Z | src/backend/gpu/initmod.intrinsics.cpp | huangjd/simit-staging | 6a1d7946e88c7bf383abe800ee835d3680e86559 | [
"MIT"
] | 63 | 2016-07-22T17:15:46.000Z | 2021-08-20T03:18:42.000Z | extern "C" {
unsigned char simit_gpu_intrinsics[] = {
59, 32, 73, 110, 116, 101, 110, 116, 105, 111, 110, 97, 108, 108, 121, 32, 98, 108, 97, 110, 107, 46, 32, 87, 101, 32, 99, 97, 110, 32, 105, 110, 99, 108, 117, 100, 101, 32, 76, 76, 32, 65, 83, 77, 32, 71, 80, 85, 32, 105, 110, 116, 114, 105, 110, 115, 105, 99, 32, 105, 109, 112, 108, 101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 115, 44, 32, 97, 115, 32, 119, 101, 108, 108, 46, 10, 59, 32, 78, 86, 86, 77, 32, 55, 46, 48, 32, 100, 101, 109, 97, 110, 100, 115, 32, 97, 32, 116, 97, 114, 103, 101, 116, 32, 116, 114, 105, 112, 108, 101, 10, 116, 97, 114, 103, 101, 116, 32, 116, 114, 105, 112, 108, 101, 32, 61, 32, 34, 110, 118, 112, 116, 120, 54, 52, 45, 110, 118, 105, 100, 105, 97, 45, 99, 117, 100, 97, 34, 10, 59, 32, 77, 111, 100, 117, 108, 101, 73, 68, 32, 61, 32, 39, 108, 105, 110, 97, 108, 103, 46, 99, 39, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 105, 51, 50, 32, 64, 108, 111, 99, 40, 105, 51, 50, 32, 37, 118, 48, 44, 32, 105, 51, 50, 32, 37, 118, 49, 44, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 44, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 118, 48, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 118, 49, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 108, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 105, 51, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 118, 48, 44, 32, 105, 51, 50, 42, 32, 37, 118, 48, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 118, 49, 44, 32, 105, 51, 50, 42, 32, 37, 118, 49, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 118, 48, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 100, 120, 112, 114, 111, 109, 32, 61, 32, 115, 101, 120, 116, 32, 105, 51, 50, 32, 37, 48, 32, 116, 111, 32, 105, 54, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 42, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 95, 115, 116, 97, 114, 116, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 49, 44, 32, 105, 54, 52, 32, 37, 105, 100, 120, 112, 114, 111, 109, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 98, 114, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 44, 32, 37, 101, 110, 116, 114, 121, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 100, 120, 112, 114, 111, 109, 49, 32, 61, 32, 115, 101, 120, 116, 32, 105, 51, 50, 32, 37, 51, 32, 116, 111, 32, 105, 54, 52, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 42, 44, 32, 105, 51, 50, 42, 42, 32, 37, 110, 101, 105, 103, 104, 98, 111, 114, 115, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 37, 105, 100, 120, 112, 114, 111, 109, 49, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 118, 49, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 109, 112, 32, 61, 32, 105, 99, 109, 112, 32, 110, 101, 32, 105, 51, 50, 32, 37, 53, 44, 32, 37, 54, 10, 32, 32, 98, 114, 32, 105, 49, 32, 37, 99, 109, 112, 44, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 44, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 101, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 98, 111, 100, 121, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 110, 99, 32, 61, 32, 97, 100, 100, 32, 110, 115, 119, 32, 105, 51, 50, 32, 37, 55, 44, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 105, 51, 50, 32, 37, 105, 110, 99, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 98, 114, 32, 108, 97, 98, 101, 108, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 10, 119, 104, 105, 108, 101, 46, 101, 110, 100, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 112, 114, 101, 100, 115, 32, 61, 32, 37, 119, 104, 105, 108, 101, 46, 99, 111, 110, 100, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 105, 51, 50, 44, 32, 105, 51, 50, 42, 32, 37, 108, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 114, 101, 116, 32, 105, 51, 50, 32, 37, 56, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 100, 111, 117, 98, 108, 101, 32, 64, 100, 101, 116, 51, 95, 102, 54, 52, 40, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 44, 32, 37, 53, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 44, 32, 37, 57, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 53, 10, 32, 32, 37, 109, 117, 108, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 44, 32, 37, 115, 117, 98, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 51, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 115, 117, 98, 49, 52, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 49, 48, 44, 32, 37, 109, 117, 108, 49, 51, 10, 32, 32, 37, 109, 117, 108, 49, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 49, 44, 32, 37, 115, 117, 98, 49, 52, 10, 32, 32, 37, 115, 117, 98, 49, 54, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 54, 44, 32, 37, 109, 117, 108, 49, 53, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 51, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 51, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 55, 44, 32, 37, 50, 57, 10, 32, 32, 37, 115, 117, 98, 50, 52, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 48, 44, 32, 37, 109, 117, 108, 50, 51, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 49, 44, 32, 37, 115, 117, 98, 50, 52, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 49, 54, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 114, 101, 116, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 102, 108, 111, 97, 116, 32, 64, 100, 101, 116, 51, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 42, 32, 37, 97, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 44, 32, 37, 53, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 44, 32, 37, 57, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 53, 10, 32, 32, 37, 109, 117, 108, 54, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 44, 32, 37, 115, 117, 98, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 115, 117, 98, 49, 52, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 49, 48, 44, 32, 37, 109, 117, 108, 49, 51, 10, 32, 32, 37, 109, 117, 108, 49, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 49, 44, 32, 37, 115, 117, 98, 49, 52, 10, 32, 32, 37, 115, 117, 98, 49, 54, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 54, 44, 32, 37, 109, 117, 108, 49, 53, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 51, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 55, 44, 32, 37, 50, 57, 10, 32, 32, 37, 115, 117, 98, 50, 52, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 48, 44, 32, 37, 109, 117, 108, 50, 51, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 49, 44, 32, 37, 115, 117, 98, 50, 52, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 49, 54, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 114, 101, 116, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 118, 111, 105, 100, 32, 64, 105, 110, 118, 51, 95, 102, 54, 52, 40, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 105, 110, 118, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 49, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 50, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 100, 101, 116, 101, 114, 109, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 100, 111, 117, 98, 108, 101, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 105, 110, 118, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 44, 32, 37, 51, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 53, 44, 32, 37, 55, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 54, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 57, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 54, 44, 32, 37, 49, 49, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 49, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 44, 32, 37, 109, 117, 108, 49, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 49, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 49, 44, 32, 37, 50, 51, 10, 32, 32, 37, 115, 117, 98, 49, 56, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 49, 52, 44, 32, 37, 109, 117, 108, 49, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 49, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 50, 48, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 50, 48, 44, 32, 37, 50, 55, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 48, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 51, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 50, 57, 44, 32, 37, 51, 49, 10, 32, 32, 37, 97, 100, 100, 50, 54, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 50, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 50, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 51, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 50, 57, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 51, 44, 32, 37, 51, 53, 10, 32, 32, 37, 51, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 54, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 51, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 51, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 51, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 51, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 51, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 51, 55, 44, 32, 37, 51, 57, 10, 32, 32, 37, 115, 117, 98, 51, 51, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 50, 57, 44, 32, 37, 109, 117, 108, 51, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 51, 51, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 52, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 51, 53, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 52, 49, 10, 32, 32, 37, 52, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 50, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 52, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 51, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 51, 53, 44, 32, 37, 52, 51, 10, 32, 32, 37, 52, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 54, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 52, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 52, 53, 44, 32, 37, 52, 55, 10, 32, 32, 37, 97, 100, 100, 52, 49, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 51, 55, 44, 32, 37, 109, 117, 108, 52, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 52, 49, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 52, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 52, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 48, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 52, 57, 44, 32, 37, 53, 49, 10, 32, 32, 37, 53, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 50, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 53, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 52, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 53, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 52, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 53, 51, 44, 32, 37, 53, 53, 10, 32, 32, 37, 115, 117, 98, 52, 56, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 52, 52, 44, 32, 37, 109, 117, 108, 52, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 52, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 53, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 54, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 53, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 115, 117, 98, 53, 48, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 53, 55, 10, 32, 32, 37, 53, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 53, 56, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 53, 48, 44, 32, 37, 53, 57, 10, 32, 32, 37, 54, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 54, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 54, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 49, 44, 32, 37, 54, 51, 10, 32, 32, 37, 97, 100, 100, 53, 54, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 53, 50, 44, 32, 37, 109, 117, 108, 53, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 53, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 54, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 54, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 54, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 53, 57, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 53, 44, 32, 37, 54, 55, 10, 32, 32, 37, 54, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 54, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 54, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 48, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 55, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 54, 57, 44, 32, 37, 55, 49, 10, 32, 32, 37, 115, 117, 98, 54, 51, 32, 61, 32, 102, 115, 117, 98, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 53, 57, 44, 32, 37, 109, 117, 108, 54, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 115, 117, 98, 54, 51, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 55, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 53, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 51, 44, 32, 37, 55, 52, 10, 32, 32, 37, 55, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 53, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 55, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 55, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 54, 55, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 54, 44, 32, 37, 55, 55, 10, 32, 32, 37, 97, 100, 100, 54, 56, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 54, 53, 44, 32, 37, 109, 117, 108, 54, 55, 10, 32, 32, 37, 55, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 55, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 55, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 55, 57, 44, 32, 37, 56, 48, 10, 32, 32, 37, 97, 100, 100, 55, 49, 32, 61, 32, 102, 97, 100, 100, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 54, 56, 44, 32, 37, 109, 117, 108, 55, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 97, 100, 100, 55, 49, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 100, 105, 118, 32, 61, 32, 102, 100, 105, 118, 32, 100, 111, 117, 98, 108, 101, 32, 49, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 56, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 100, 105, 118, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 50, 44, 32, 37, 56, 51, 10, 32, 32, 37, 56, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 50, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 53, 44, 32, 37, 56, 54, 10, 32, 32, 37, 56, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 56, 55, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 52, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 56, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 56, 56, 44, 32, 37, 56, 57, 10, 32, 32, 37, 57, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 55, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 49, 44, 32, 37, 57, 50, 10, 32, 32, 37, 57, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 51, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 55, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 48, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 52, 44, 32, 37, 57, 53, 10, 32, 32, 37, 57, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 48, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 57, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 50, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 57, 55, 44, 32, 37, 57, 56, 10, 32, 32, 37, 57, 57, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 57, 57, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 50, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 51, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 48, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 49, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 52, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 48, 44, 32, 37, 49, 48, 49, 10, 32, 32, 37, 49, 48, 50, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 52, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 53, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 51, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 52, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 54, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 51, 44, 32, 37, 49, 48, 52, 10, 32, 32, 37, 49, 48, 53, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 53, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 54, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 55, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 54, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 49, 48, 55, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 109, 117, 108, 56, 56, 32, 61, 32, 102, 109, 117, 108, 32, 100, 111, 117, 98, 108, 101, 32, 37, 49, 48, 54, 44, 32, 37, 49, 48, 55, 10, 32, 32, 37, 49, 48, 56, 32, 61, 32, 108, 111, 97, 100, 32, 100, 111, 117, 98, 108, 101, 42, 44, 32, 100, 111, 117, 98, 108, 101, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 100, 111, 117, 98, 108, 101, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 49, 48, 56, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 100, 111, 117, 98, 108, 101, 32, 37, 109, 117, 108, 56, 56, 44, 32, 100, 111, 117, 98, 108, 101, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 57, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 114, 101, 116, 32, 118, 111, 105, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 118, 111, 105, 100, 32, 64, 105, 110, 118, 51, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 110, 118, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 97, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 42, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 99, 111, 102, 48, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 48, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 48, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 49, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 48, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 49, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 102, 50, 50, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 100, 101, 116, 101, 114, 109, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 110, 118, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 44, 32, 37, 51, 10, 32, 32, 37, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 53, 44, 32, 37, 55, 10, 32, 32, 37, 115, 117, 98, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 54, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 57, 10, 32, 32, 37, 49, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 49, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 54, 44, 32, 37, 49, 49, 10, 32, 32, 37, 49, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 50, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 49, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 52, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 49, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 51, 44, 32, 37, 49, 53, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 44, 32, 37, 109, 117, 108, 49, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 54, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 49, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 56, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 49, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 55, 44, 32, 37, 49, 57, 10, 32, 32, 37, 50, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 48, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 50, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 50, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 49, 44, 32, 37, 50, 51, 10, 32, 32, 37, 115, 117, 98, 49, 56, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 49, 52, 44, 32, 37, 109, 117, 108, 49, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 49, 56, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 50, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 50, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 49, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 50, 48, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 50, 53, 10, 32, 32, 37, 50, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 54, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 50, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 50, 48, 44, 32, 37, 50, 55, 10, 32, 32, 37, 50, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 50, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 50, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 48, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 51, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 57, 44, 32, 37, 51, 49, 10, 32, 32, 37, 97, 100, 100, 50, 54, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 50, 44, 32, 37, 109, 117, 108, 50, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 50, 54, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 51, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 52, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 37, 51, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 50, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 50, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 51, 44, 32, 37, 51, 53, 10, 32, 32, 37, 51, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 54, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 51, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 51, 56, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 51, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 51, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 51, 55, 44, 32, 37, 51, 57, 10, 32, 32, 37, 115, 117, 98, 51, 51, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 50, 57, 44, 32, 37, 109, 117, 108, 51, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 51, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 48, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 52, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 51, 53, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 52, 49, 10, 32, 32, 37, 52, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 50, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 37, 52, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 51, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 51, 53, 44, 32, 37, 52, 51, 10, 32, 32, 37, 52, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 52, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 54, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 37, 52, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 51, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 52, 53, 44, 32, 37, 52, 55, 10, 32, 32, 37, 97, 100, 100, 52, 49, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 51, 55, 44, 32, 37, 109, 117, 108, 52, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 52, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 52, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 52, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 52, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 48, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 52, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 52, 57, 44, 32, 37, 53, 49, 10, 32, 32, 37, 53, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 50, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 53, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 53, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 52, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 53, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 52, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 53, 51, 44, 32, 37, 53, 53, 10, 32, 32, 37, 115, 117, 98, 52, 56, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 52, 52, 44, 32, 37, 109, 117, 108, 52, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 52, 56, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 53, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 54, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 53, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 52, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 115, 117, 98, 53, 48, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 45, 48, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 53, 55, 10, 32, 32, 37, 53, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 53, 56, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 37, 53, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 53, 48, 44, 32, 37, 53, 57, 10, 32, 32, 37, 54, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 54, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 51, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 50, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 54, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 49, 44, 32, 37, 54, 51, 10, 32, 32, 37, 97, 100, 100, 53, 54, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 53, 50, 44, 32, 37, 109, 117, 108, 53, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 53, 54, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 54, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 55, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 54, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 37, 54, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 53, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 53, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 53, 44, 32, 37, 54, 55, 10, 32, 32, 37, 54, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 54, 56, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 54, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 48, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 37, 55, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 50, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 54, 57, 44, 32, 37, 55, 49, 10, 32, 32, 37, 115, 117, 98, 54, 51, 32, 61, 32, 102, 115, 117, 98, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 53, 57, 44, 32, 37, 109, 117, 108, 54, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 115, 117, 98, 54, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 50, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 37, 55, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 51, 44, 32, 37, 55, 52, 10, 32, 32, 37, 55, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 53, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 37, 55, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 55, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 54, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 54, 44, 32, 37, 55, 55, 10, 32, 32, 37, 97, 100, 100, 54, 56, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 54, 53, 44, 32, 37, 109, 117, 108, 54, 55, 10, 32, 32, 37, 55, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 97, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 55, 56, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 37, 55, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 54, 57, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 48, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 55, 57, 44, 32, 37, 56, 48, 10, 32, 32, 37, 97, 100, 100, 55, 49, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 54, 56, 44, 32, 37, 109, 117, 108, 55, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 55, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 99, 111, 110, 118, 32, 61, 32, 102, 112, 101, 120, 116, 32, 102, 108, 111, 97, 116, 32, 37, 56, 49, 32, 116, 111, 32, 100, 111, 117, 98, 108, 101, 10, 32, 32, 37, 100, 105, 118, 32, 61, 32, 102, 100, 105, 118, 32, 100, 111, 117, 98, 108, 101, 32, 49, 46, 48, 48, 48, 48, 48, 48, 101, 43, 48, 48, 44, 32, 37, 99, 111, 110, 118, 10, 32, 32, 37, 99, 111, 110, 118, 55, 50, 32, 61, 32, 102, 112, 116, 114, 117, 110, 99, 32, 100, 111, 117, 98, 108, 101, 32, 37, 100, 105, 118, 32, 116, 111, 32, 102, 108, 111, 97, 116, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 99, 111, 110, 118, 55, 50, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 50, 44, 32, 37, 56, 51, 10, 32, 32, 37, 56, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 52, 44, 32, 105, 54, 52, 32, 48, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 53, 44, 32, 37, 56, 54, 10, 32, 32, 37, 56, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 56, 55, 44, 32, 105, 54, 52, 32, 49, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 53, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 56, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 56, 56, 44, 32, 37, 56, 57, 10, 32, 32, 37, 57, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 48, 44, 32, 105, 54, 52, 32, 50, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 55, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 55, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 55, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 49, 44, 32, 37, 57, 50, 10, 32, 32, 37, 57, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 51, 44, 32, 105, 54, 52, 32, 51, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 55, 57, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 52, 44, 32, 37, 57, 53, 10, 32, 32, 37, 57, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 50, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 54, 44, 32, 105, 54, 52, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 49, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 49, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 57, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 51, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 57, 55, 44, 32, 37, 57, 56, 10, 32, 32, 37, 57, 57, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 52, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 57, 57, 44, 32, 105, 54, 52, 32, 53, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 51, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 52, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 48, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 53, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 48, 44, 32, 37, 49, 48, 49, 10, 32, 32, 37, 49, 48, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 54, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 50, 44, 32, 105, 54, 52, 32, 54, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 53, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 54, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 49, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 52, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 55, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 51, 44, 32, 37, 49, 48, 52, 10, 32, 32, 37, 49, 48, 53, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 56, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 53, 44, 32, 105, 54, 52, 32, 55, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 55, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 56, 56, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 54, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 99, 111, 102, 50, 50, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 48, 55, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 100, 101, 116, 101, 114, 109, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 56, 57, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 49, 48, 54, 44, 32, 37, 49, 48, 55, 10, 32, 32, 37, 49, 48, 56, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 42, 44, 32, 102, 108, 111, 97, 116, 42, 42, 32, 37, 105, 110, 118, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 56, 10, 32, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 48, 32, 61, 32, 103, 101, 116, 101, 108, 101, 109, 101, 110, 116, 112, 116, 114, 32, 105, 110, 98, 111, 117, 110, 100, 115, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 49, 48, 56, 44, 32, 105, 54, 52, 32, 56, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 56, 57, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 97, 114, 114, 97, 121, 105, 100, 120, 57, 48, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 114, 101, 116, 32, 118, 111, 105, 100, 10, 125, 10, 10, 59, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 65, 116, 116, 114, 115, 58, 32, 110, 111, 117, 110, 119, 105, 110, 100, 32, 117, 119, 116, 97, 98, 108, 101, 10, 100, 101, 102, 105, 110, 101, 32, 102, 108, 111, 97, 116, 32, 64, 99, 111, 109, 112, 108, 101, 120, 78, 111, 114, 109, 95, 102, 51, 50, 40, 102, 108, 111, 97, 116, 32, 37, 114, 44, 32, 102, 108, 111, 97, 116, 32, 37, 105, 41, 32, 97, 108, 119, 97, 121, 115, 105, 110, 108, 105, 110, 101, 32, 123, 10, 101, 110, 116, 114, 121, 58, 10, 32, 32, 37, 114, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 105, 46, 97, 100, 100, 114, 32, 61, 32, 97, 108, 108, 111, 99, 97, 32, 102, 108, 111, 97, 116, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 114, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 115, 116, 111, 114, 101, 32, 102, 108, 111, 97, 116, 32, 37, 105, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 48, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 49, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 114, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 48, 44, 32, 37, 49, 10, 32, 32, 37, 50, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 51, 32, 61, 32, 108, 111, 97, 100, 32, 102, 108, 111, 97, 116, 44, 32, 102, 108, 111, 97, 116, 42, 32, 37, 105, 46, 97, 100, 100, 114, 44, 32, 97, 108, 105, 103, 110, 32, 52, 10, 32, 32, 37, 109, 117, 108, 49, 32, 61, 32, 102, 109, 117, 108, 32, 102, 108, 111, 97, 116, 32, 37, 50, 44, 32, 37, 51, 10, 32, 32, 37, 97, 100, 100, 32, 61, 32, 102, 97, 100, 100, 32, 102, 108, 111, 97, 116, 32, 37, 109, 117, 108, 44, 32, 37, 109, 117, 108, 49, 10, 32, 32, 37, 99, 97, 108, 108, 32, 61, 32, 99, 97, 108, 108, 32, 102, 108, 111, 97, 116, 32, 64, 95, 95, 110, 118, 95, 115, 113, 114, 116, 102, 40, 102, 108, 111, 97, 116, 32, 37, 97, 100, 100, 41, 10, 32, 32, 114, 101, 116, 32, 102, 108, 111, 97, 116, 32, 37, 99, 97, 108, 108, 10, 125, 10, 10, 100, 101, 99, 108, 97, 114, 101, 32, 102, 108, 111, 97, 116, 32, 64, 95, 95, 110, 118, 95, 115, 113, 114, 116, 102, 40, 102, 108, 111, 97, 116, 41, 10, 10, 10, 33, 108, 108, 118, 109, 46, 105, 100, 101, 110, 116, 32, 61, 32, 33, 123, 33, 48, 125, 10, 10, 33, 48, 32, 61, 32, 33, 123, 33, 34, 99, 108, 97, 110, 103, 32, 118, 101, 114, 115, 105, 111, 110, 32, 51, 46, 55, 46, 49, 32, 40, 98, 114, 97, 110, 99, 104, 101, 115, 47, 114, 101, 108, 101, 97, 115, 101, 95, 51, 55, 32, 50, 54, 56, 57, 54, 55, 41, 32, 40, 108, 108, 118, 109, 47, 98, 114, 97, 110, 99, 104, 101, 115, 47, 114, 101, 108, 101, 97, 115, 101, 95, 51, 55, 32, 50, 54, 56, 57, 54, 54, 41, 34, 125, 10, 0};
int simit_gpu_intrinsics_length = 31428;
}
| 23,416.333333 | 140,400 | 0.552435 | huangjd |
159bd0a283a65730be8195d921ba0766b618c20e | 441 | hpp | C++ | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | 5 | 2016-04-07T19:49:39.000Z | 2021-08-03T05:24:11.000Z | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | null | null | null | include/wire/encoding/buffers_fwd.hpp | zmij/wire | 9981eb9ea182fc49ef7243eed26b9d37be70a395 | [
"Artistic-2.0"
] | 1 | 2020-12-27T11:47:31.000Z | 2020-12-27T11:47:31.000Z | /*
* buffers_fwd.hpp
*
* Created on: Feb 3, 2016
* Author: zmij
*/
#ifndef WIRE_ENCODING_BUFFERS_FWD_HPP_
#define WIRE_ENCODING_BUFFERS_FWD_HPP_
#include <memory>
namespace wire {
namespace encoding {
class outgoing;
typedef std::shared_ptr< outgoing > outgoing_ptr;
class incoming;
typedef std::shared_ptr< incoming > incoming_ptr;
} // namespace encoding
} // namespace wire
#endif /* WIRE_ENCODING_BUFFERS_FWD_HPP_ */
| 16.961538 | 49 | 0.741497 | zmij |
159dec75e8ed94395b369b35892c254e2e5d6fdc | 2,385 | cpp | C++ | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | 3 | 2019-05-20T10:06:37.000Z | 2021-08-08T02:30:23.000Z | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | null | null | null | example-bus/src/ofApp.cpp | nariakiiwatani/ofxNNG | 443827c4d4d6bd47c66682fdbd50ae9abf3ef7ee | [
"MIT"
] | null | null | null | #include "ofApp.h"
using namespace ofxNNG;
//--------------------------------------------------------------
void ofApp::setup(){
// 4 buses making all-to-all mesh connection
bus_.resize(4);
for(int i = 0; i < bus_.size(); ++i) {
auto &b = bus_[i];
b = std::make_shared<Bus>();
b->setup();
b->setCallback<std::string, int>([i](const std::string& str, int index) {
ofLogNotice("node "+ofToString(i)+" receive from "+ofToString(index)) << str;
});
std::string recv_url = "inproc://bus"+ofToString(i);
b->createListener(recv_url)->start();
for(int j = i+1; j < bus_.size(); ++j) {
std::string send_url = "inproc://bus"+ofToString(j);
b->createDialer(send_url)->start();
}
}
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofDrawBitmapString("press 1,2,3,4 and see console to know what happens", 10, 14);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
int index = key-'1';
if(index >= 0 && index < bus_.size()) {
bus_[key-'1']->send({"message from node "+ofToString(index), index});
ofLogNotice("from node "+ofToString(index)+" send");
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
| 25.923913 | 82 | 0.398323 | nariakiiwatani |
159e96bdaf5be73811866b2fe6e53659e6dec646 | 1,057 | hh | C++ | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | psdaq/drp/TimingDef.hh | slac-lcls/pdsdata2 | 6e2ad4f830cadfe29764dbd280fa57f8f9edc451 | [
"BSD-3-Clause-LBNL"
] | null | null | null | #include "xtcdata/xtc/VarDef.hh"
#include "xtcdata/xtc/NamesLookup.hh"
#include <stdint.h>
namespace XtcData {
class Xtc;
class NamesId;
};
namespace Drp {
class TimingDef : public XtcData::VarDef
{
public:
enum index {
pulseId,
timeStamp,
fixedRates,
acRates,
timeSlot,
timeSlotPhase,
ebeamPresent,
ebeamDestn,
ebeamCharge,
ebeamEnergy,
xWavelength,
dmod5,
mpsLimits,
mpsPowerClass,
sequenceValues,
};
TimingDef();
static void describeData (XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*);
static void createDataNoBSA(XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*);
static void createDataETM (XtcData::Xtc&, const void* bufEnd, XtcData::NamesLookup&, XtcData::NamesId, const uint8_t*, const uint8_t*);
};
};
| 27.102564 | 144 | 0.579943 | slac-lcls |
15ad04e847d7d35124bbd4a2f748de637d1ff1c4 | 3,921 | cpp | C++ | YorozuyaGSLib/source/std__bad_allocDetail.cpp | lemkova/Yorozuya | f445d800078d9aba5de28f122cedfa03f26a38e4 | [
"MIT"
] | 29 | 2017-07-01T23:08:31.000Z | 2022-02-19T10:22:45.000Z | YorozuyaGSLib/source/std__bad_allocDetail.cpp | kotopes/Yorozuya | 605c97d3a627a8f6545cc09f2a1b0a8afdedd33a | [
"MIT"
] | 90 | 2017-10-18T21:24:51.000Z | 2019-06-06T02:30:33.000Z | YorozuyaGSLib/source/std__bad_allocDetail.cpp | kotopes/Yorozuya | 605c97d3a627a8f6545cc09f2a1b0a8afdedd33a | [
"MIT"
] | 44 | 2017-12-19T08:02:59.000Z | 2022-02-24T23:15:01.000Z | #include <common/ATFCore.hpp>
#include <std__bad_allocDetail.hpp>
START_ATF_NAMESPACE
namespace std
{
namespace Detail
{
Info::std__bad_allocctor_bad_alloc5_ptr std__bad_allocctor_bad_alloc5_next(nullptr);
Info::std__bad_allocctor_bad_alloc5_clbk std__bad_allocctor_bad_alloc5_user(nullptr);
Info::std__bad_allocctor_bad_alloc7_ptr std__bad_allocctor_bad_alloc7_next(nullptr);
Info::std__bad_allocctor_bad_alloc7_clbk std__bad_allocctor_bad_alloc7_user(nullptr);
Info::std__bad_allocctor_bad_alloc8_ptr std__bad_allocctor_bad_alloc8_next(nullptr);
Info::std__bad_allocctor_bad_alloc8_clbk std__bad_allocctor_bad_alloc8_user(nullptr);
Info::std__bad_allocdtor_bad_alloc10_ptr std__bad_allocdtor_bad_alloc10_next(nullptr);
Info::std__bad_allocdtor_bad_alloc10_clbk std__bad_allocdtor_bad_alloc10_user(nullptr);
void std__bad_allocctor_bad_alloc5_wrapper(struct std::bad_alloc* _this, char* _Message)
{
std__bad_allocctor_bad_alloc5_user(_this, _Message, std__bad_allocctor_bad_alloc5_next);
};
void std__bad_allocctor_bad_alloc7_wrapper(struct std::bad_alloc* _this, struct std::bad_alloc* __that)
{
std__bad_allocctor_bad_alloc7_user(_this, __that, std__bad_allocctor_bad_alloc7_next);
};
int64_t std__bad_allocctor_bad_alloc8_wrapper(struct std::bad_alloc* _this)
{
return std__bad_allocctor_bad_alloc8_user(_this, std__bad_allocctor_bad_alloc8_next);
};
void std__bad_allocdtor_bad_alloc10_wrapper(struct std::bad_alloc* _this)
{
std__bad_allocdtor_bad_alloc10_user(_this, std__bad_allocdtor_bad_alloc10_next);
};
::std::array<hook_record, 4> bad_alloc_functions =
{
_hook_record {
(LPVOID)0x14007efb0L,
(LPVOID *)&std__bad_allocctor_bad_alloc5_user,
(LPVOID *)&std__bad_allocctor_bad_alloc5_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc5_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)(char*))&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14007f0f0L,
(LPVOID *)&std__bad_allocctor_bad_alloc7_user,
(LPVOID *)&std__bad_allocctor_bad_alloc7_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc7_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)(struct std::bad_alloc*))&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14061f760L,
(LPVOID *)&std__bad_allocctor_bad_alloc8_user,
(LPVOID *)&std__bad_allocctor_bad_alloc8_next,
(LPVOID)cast_pointer_function(std__bad_allocctor_bad_alloc8_wrapper),
(LPVOID)cast_pointer_function((int64_t(std::bad_alloc::*)())&std::bad_alloc::ctor_bad_alloc)
},
_hook_record {
(LPVOID)0x14007f020L,
(LPVOID *)&std__bad_allocdtor_bad_alloc10_user,
(LPVOID *)&std__bad_allocdtor_bad_alloc10_next,
(LPVOID)cast_pointer_function(std__bad_allocdtor_bad_alloc10_wrapper),
(LPVOID)cast_pointer_function((void(std::bad_alloc::*)())&std::bad_alloc::dtor_bad_alloc)
},
};
}; // end namespace Detail
}; // end namespace std
END_ATF_NAMESPACE
| 48.407407 | 131 | 0.61974 | lemkova |
15ae7e40fa3cf309f1ddce6eb06d7b2ee6d40d03 | 7,860 | hpp | C++ | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 10 | 2018-06-28T00:21:46.000Z | 2022-03-30T03:31:32.000Z | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 35 | 2019-03-19T21:54:46.000Z | 2022-03-17T02:20:42.000Z | include/path-finding/molecular_path.hpp | bigginlab/chap | 17de36442e2e80cb01432e84050c4dfce31fc3a2 | [
"MIT"
] | 8 | 2018-10-27T19:35:13.000Z | 2022-01-06T01:10:39.000Z | // CHAP - The Channel Annotation Package
//
// Copyright (c) 2016 - 2018 Gianni Klesse, Shanlin Rao, Mark S. P. Sansom, and
// Stephen J. Tucker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef MOLECULAR_PATH_HPP
#define MOLECULAR_PATH_HPP
#include <map>
#include <string>
#include <vector>
#include <gromacs/math/vec.h>
#include <gromacs/pbcutil/pbc.h>
#include <gromacs/utility/real.h>
#include <gromacs/selection/selection.h>
#include "external/rapidjson/document.h"
#include "geometry/spline_curve_1D.hpp"
#include "geometry/spline_curve_3D.hpp"
/*!
* Enum for different methods for aligning molecular pathways between frames.
*/
enum ePathAlignmentMethod {ePathAlignmentMethodNone,
ePathAlignmentMethodIpp};
/*!
* \brief Parameter container for MolecularPath path mapping functionality.
*
* Note that this is not currently used, but is retained in case parameters
* need to be reintroduced at a later time.
*/
class PathMappingParameters
{
public:
};
/*!
* \brief Representation of a molecular pathway.
*
* This class is used to describe a molecular pathway (e.g. an ion channel
* pore). It is typically created by a class derived from AbstractPathFinder
* and permits access the pathways properties, such as its length(), volume(),
* or minRadius(). A MolecularPathObjExporter can be used to generate a
* mesh representing the pathways surface in the Wavefront Object format.
*
* Internally, the pathway is represented by a SplineCurve3D object, which
* describes a \f$ C^2 \f$ -continuous curve corresponding to the centre line
* of the pathway. A further SplineCurve1D object is used to describe the
* pathway's radius along the centre line. Together, these splines provide a
* means of determining where in the pathway a particle is located using
* mapSelection() and to decide whether a given particle lies inside the
* pathway or not using checkIfInside().
*
* The class also exposes several auxiliary functions such as samplePoints() or
* sampleRadii() to provide access to the properties of the centre line curve
* and radius spline directly.
*/
class MolecularPath
{
public:
// costructors and destructor:
MolecularPath(
std::vector<gmx::RVec> &pathPoints,
std::vector<real> &poreRadii);
MolecularPath(
const rapidjson::Document &doc);
/*
MolecularPath(
std::vector<real> poreRadiusKnots,
std::vector<real> poreRadiusCtrlPoints,
std::vector<real> centreLineKnots,
std::vector<gmx::RVec> centreLineCtrlPoints);*/
~MolecularPath();
// interface for mapping particles onto pathway:
std::vector<gmx::RVec> mapPositions(
const std::vector<gmx::RVec> &positions);
std::map<int, gmx::RVec> mapSelection(
const gmx::Selection &mapSel);
// check if points lie inside pore:
std::map<int, bool> checkIfInside(
const std::map<int, gmx::RVec> &mappedCoords,
real margin);
std::map<int, bool> checkIfInside(
const std::map<int, gmx::RVec> &mappedCoords,
real margin,
real sLo,
real sHi);
// centreline-mapped properties:
void addScalarProperty(
std::string name,
SplineCurve1D property,
bool divergent);
std::map<std::string, std::pair<SplineCurve1D, bool>> scalarProperties() const;
// access original points:
std::vector<gmx::RVec> pathPoints();
std::vector<real> pathRadii();
// access internal spline curves:
SplineCurve1D pathRadius();
SplineCurve3D centreLine();
// access aggregate properties of path:
real length() const;
std::pair<real, real> minRadius();
real volume();
real radius(real);
real sLo();
real sHi();
// access properties of splines
std::vector<real> poreRadiusKnots() const;
std::vector<real> poreRadiusUniqueKnots() const;
std::vector<real> poreRadiusCtrlPoints() const;
std::vector<real> centreLineKnots() const;
std::vector<real> centreLineUniqueKnots() const;
std::vector<gmx::RVec> centreLineCtrlPoints() const;
// sample points from centreline:
std::vector<real> sampleArcLength(
size_t nPoints,
real extrapDist) const;
std::vector<gmx::RVec> samplePoints(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> samplePoints(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleTangents(
size_t nPoints, real extrapDist);
std::vector<gmx::RVec> sampleTangents(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleNormTangents(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> sampleNormTangents(
std::vector<real> arcLengthSample);
std::vector<gmx::RVec> sampleNormals(
size_t nPoints,
real extrapDist);
std::vector<gmx::RVec> sampleNormals(
std::vector<real> arcLengthSample);
std::vector<real> sampleRadii(
size_t nPoints,
real extrapDist);
std::vector<real> sampleRadii(
std::vector<real> arcLengthSample);
// change internal coordinate representation of path:
void shift(const gmx::RVec &shift);
private:
// mathematical constants:
const real PI_ = std::acos(-1.0);
// utilities for sampling functions:
inline real sampleArcLenStep(
size_t nPoints,
real extrapDist) const;
// utilities for path mapping:
inline gmx::RVec mapPosition(
const gmx::RVec &cartCoord,
const std::vector<real> &arcLenSample,
const std::vector<gmx::RVec> &pathPointSample,
const real mapTol);
inline int numSamplePoints(const PathMappingParameters ¶ms);
// original path points and corresponding radii:
std::vector<gmx::RVec> pathPoints_;
std::vector<real> pathRadii_;
// pore centre line and corresponding radius:
SplineCurve3D centreLine_;
SplineCurve1D poreRadius_;
// properties mapped onto path:
std::map<std::string, std::pair<SplineCurve1D, bool>> properties_;
// properties of path:
real openingLo_;
real openingHi_;
real length_;
};
#endif
| 35.890411 | 87 | 0.640712 | bigginlab |
15aef5da8ac2751f9c8b2c5fbe1d14faf1e8002c | 2,249 | cpp | C++ | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 108 | 2018-10-08T17:03:32.000Z | 2022-03-21T00:52:26.000Z | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 287 | 2018-09-18T14:59:12.000Z | 2022-01-13T12:28:23.000Z | src/OpcUaStackServer/ServiceSet/SessionConfig.cpp | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 32 | 2018-10-19T14:35:03.000Z | 2021-11-12T09:36:46.000Z | /*
Copyright 2015 Kai Huebl ([email protected])
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Eine Kopie der Lizenz erhalten Sie auf http://www.apache.org/licenses/LICENSE-2.0.
Sofern nicht gemäß geltendem Recht vorgeschrieben oder schriftlich vereinbart,
erfolgt die Bereitstellung der im Rahmen der Lizenz verbreiteten Software OHNE
GEWÄHR ODER VORBEHALTE – ganz gleich, ob ausdrücklich oder stillschweigend.
Informationen über die jeweiligen Bedingungen für Genehmigungen und Einschränkungen
im Rahmen der Lizenz finden Sie in der Lizenz.
Autor: Kai Huebl ([email protected])
*/
#include "OpcUaStackCore/Base/Log.h"
#include "OpcUaStackCore/Base/Config.h"
#include "OpcUaStackServer/ServiceSet/SessionConfig.h"
#include "OpcUaStackServer/ServiceSet/EndpointDescriptionConfig.h"
using namespace OpcUaStackCore;
namespace OpcUaStackServer
{
#if 0
bool
SessionConfig::initial(SessionOld::SPtr sessionSPtr, const std::string& configPrefix, Config* config)
{
if (config == nullptr) config = Config::instance();
boost::optional<Config> childConfig = config->getChild(configPrefix);
if (!childConfig) {
Log(Error, "session server configuration not found")
.parameter("ConfigurationFileName", config->configFileName())
.parameter("ParameterPath", configPrefix);
return false;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
//
// create session
//
// --------------------------------------------------------------------------
//
// EndpointDescription - mandatory
//
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
EndpointDescriptionArray::SPtr endpointDescriptionArray = constructSPtr<EndpointDescriptionArray>();
if (!EndpointDescriptionConfig::endpointDescriptions(endpointDescriptionArray, configPrefix, config, config->configFileName())) {
return false;
}
sessionSPtr->endpointDescriptionArray(endpointDescriptionArray);
return true;
}
#endif
}
| 34.075758 | 131 | 0.629169 | gianricardo |
15b3463de06815d624443b011b41b3d274d4b536 | 2,076 | cpp | C++ | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | test/fiber/test_fiber_unexpected_event_callback_add.cpp | nanolith/rcpr | d8464e83fa09603802ba8c0c4f2b5ae3dcf69158 | [
"0BSD"
] | null | null | null | /**
* \file test/fiber/test_fiber_unexpected_event_callback_add.cpp
*
* \brief Unit tests for fiber_unexpected_event_callback_add.
*/
#include <minunit/minunit.h>
#include <rcpr/allocator.h>
#include <rcpr/fiber.h>
#include "../../src/fiber/common/fiber_internal.h"
RCPR_IMPORT_allocator;
RCPR_IMPORT_fiber;
RCPR_IMPORT_fiber_internal;
RCPR_IMPORT_resource;
RCPR_IMPORT_uuid;
TEST_SUITE(fiber_unexpected_event_callback_add);
static status dummy_event(
void*, fiber*, const rcpr_uuid*, int, void*, const rcpr_uuid*, int)
{
return STATUS_SUCCESS;
}
/**
* Verify that we can add an unexpected event callback function to a fiber.
*/
TEST(add)
{
allocator* alloc = nullptr;
fiber* f = nullptr;
fiber_scheduler* sched = nullptr;
int dummyval = 73;
/* we should be able to create a malloc allocator. */
TEST_ASSERT(
STATUS_SUCCESS == malloc_allocator_create(&alloc));
/* we should be able to create a disciplined fiber scheduler. */
TEST_ASSERT(
STATUS_SUCCESS ==
fiber_scheduler_create_with_disciplines(&sched, alloc));
/* we should be able to create a fiber for a thread. */
TEST_ASSERT(STATUS_SUCCESS == fiber_create_for_thread(&f, sched, alloc));
/* PRECONDITION: fiber unexpected event callback not set. */
TEST_ASSERT(nullptr == f->unexpected_fn);
TEST_ASSERT(nullptr == f->unexpected_context);
/* add a custom event callback to this fiber. */
TEST_ASSERT(
STATUS_SUCCESS ==
fiber_unexpected_event_callback_add(f, &dummy_event, &dummyval));
/* POSTCONDITION: fiber unexpected event callback is set. */
TEST_EXPECT(&dummy_event == f->unexpected_fn);
TEST_EXPECT(&dummyval == f->unexpected_context);
/* clean up. */
TEST_ASSERT(
STATUS_SUCCESS ==
resource_release(fiber_scheduler_resource_handle(sched)));
TEST_ASSERT(
STATUS_SUCCESS ==
resource_release(fiber_resource_handle(f)));
TEST_ASSERT(
STATUS_SUCCESS == resource_release(allocator_resource_handle(alloc)));
}
| 28.833333 | 78 | 0.701349 | nanolith |
15b826106c1e596c31cab7b3fc8dbfbe6479e838 | 1,712 | cpp | C++ | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | LevelSwitch.cpp | programistagd/Simple-SFML-game-engine | 212e347145e88c14722a9d61ffb0aa7dcf9ec931 | [
"CC-BY-3.0"
] | null | null | null | /*
* File: LevelSwitch.cpp
* Author: radek
*
* Created on 7 kwiecień 2014, 17:35
*/
#include "LevelSwitch.hpp"
LevelSwitch::LevelSwitch() : Obstacle(){
jumpable = false;
}
LevelSwitch::~LevelSwitch() {
}
GameObject* LevelSwitch::create(GameWorld& world, ResourceManager* rm, std::stringstream& in){
LevelSwitch* obj = new LevelSwitch();
float x,y;
std::string texture;
in>>texture>>x>>y>>obj->nextLevel;
sf::Texture* tex = nullptr;
if(texture!="None"){
tex = rm->loadTexture(texture);
obj->image.setTexture(*tex);
obj->image.setPosition(x,y);
}
if(!in.eof()){
obj->aabb.start = sf::Vector2f(0,0);
//obj->aabb.end = sf::Vector2f(0.1,0.1);
in>>obj->aabb.end.x>>obj->aabb.end.y;
if(tex)
obj->image.setScale(obj->aabb.end.x/tex->getSize().x,obj->aabb.end.y/tex->getSize().y);
}
else{
obj->aabb.start = sf::Vector2f(0,0);
if(tex)
obj->aabb.end = sf::Vector2f(tex->getSize().x,tex->getSize().y);
}
obj->aabb=obj->aabb+sf::Vector2f(x,y);
obj->textureName = texture;
return obj;
}
std::string LevelSwitch::dumpToString(){
std::stringstream s;
s<<getType()<<" "<<textureName<<" "<<aabb.start.x<<" "<<aabb.start.y<<" "<<nextLevel;
if(textureName == "None"){
sf::Vector2f size = aabb.end-aabb.start;
s<<" "<<size.x<<" "<<size.y;
}else if(image.getScale()!=sf::Vector2f(1.f,1.f)){
s<<" "<<image.getTexture()->getSize().x*image.getScale().x<<" "<<image.getTexture()->getSize().y*image.getScale().y;
}
return s.str();
}
const std::string LevelSwitch::getType(){
return "LevelSwitch";
} | 28.065574 | 124 | 0.574182 | programistagd |
15b9a534bf79f5db22d4f878c7eba87a7113e24b | 350 | hpp | C++ | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | 2 | 2019-09-09T06:08:26.000Z | 2020-10-14T12:01:26.000Z | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | null | null | null | src/godotmation_converter.hpp | kakoeimon/GodotMationCpp | d05b157b420688e1ffae9a49de80b26da21ab41f | [
"MIT"
] | 1 | 2021-08-16T07:28:19.000Z | 2021-08-16T07:28:19.000Z | #ifndef GODOTMATION_CONVERTER_H
#define GODOTMATION_CONVERTER_H
#include "godotmation_pool.hpp"
class GodotMation_Resource;
class GodotMation_State;
class GodotMation_Converter : public GodotMation_Pool{
public:
GodotMation_Converter();
~GodotMation_Converter();
virtual bool trigger();
virtual int can_push(int) const;
};
#endif | 19.444444 | 54 | 0.788571 | kakoeimon |
15bd26e9d1e4062d0ad1ff06efa037304e75a13a | 1,177 | cpp | C++ | apps/tests/test_font.cpp | kdt3rd/gecko | 756a4e4587eb5023495294d9b6c6d80ebd79ebde | [
"MIT"
] | 15 | 2017-10-18T05:08:16.000Z | 2022-02-02T11:01:46.000Z | apps/tests/test_font.cpp | kdt3rd/gecko | 756a4e4587eb5023495294d9b6c6d80ebd79ebde | [
"MIT"
] | null | null | null | apps/tests/test_font.cpp | kdt3rd/gecko | 756a4e4587eb5023495294d9b6c6d80ebd79ebde | [
"MIT"
] | 1 | 2018-11-10T03:12:57.000Z | 2018-11-10T03:12:57.000Z | // SPDX-License-Identifier: MIT
// Copyright contributors to the gecko project.
#include <base/contract.h>
#include <fstream>
#include <script/font_manager.h>
namespace
{
int safemain( int /*argc*/, char * /*argv*/[] )
{
std::shared_ptr<script::font_manager> fontmgr =
script::font_manager::make();
auto fams = fontmgr->get_families();
for ( auto f: fams )
std::cout << f << std::endl;
auto font = fontmgr->get_font( "Times", "bold", 16, 95, 95, 1024, 1024 );
if ( font )
{
for ( char32_t c = 'a'; c <= 'z'; ++c )
font->load_glyph( c );
std::ofstream out( "font.raw" );
auto bmp = font->bitmap();
out.write(
reinterpret_cast<const char *>( bmp.data() ),
static_cast<std::streamsize>( bmp.size() ) );
}
else
throw std::runtime_error( "could not load font" );
return 0;
}
} // namespace
////////////////////////////////////////
int main( int argc, char *argv[] )
{
try
{
return safemain( argc, argv );
}
catch ( std::exception &e )
{
base::print_exception( std::cerr, e );
}
return -1;
}
| 21.796296 | 77 | 0.525913 | kdt3rd |
15c54d976d9f22078105d13579c798e57bce3c31 | 6,137 | cpp | C++ | src/codec/rdb/RdbDecoder.cpp | TimothyZhang023/vcdb | 2604ab3703d82efdbf6c66a713b5b23a61b96672 | [
"BSD-2-Clause"
] | null | null | null | src/codec/rdb/RdbDecoder.cpp | TimothyZhang023/vcdb | 2604ab3703d82efdbf6c66a713b5b23a61b96672 | [
"BSD-2-Clause"
] | null | null | null | src/codec/rdb/RdbDecoder.cpp | TimothyZhang023/vcdb | 2604ab3703d82efdbf6c66a713b5b23a61b96672 | [
"BSD-2-Clause"
] | null | null | null | /*
Copyright (c) 2017, Timothy. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
*/
#include "RdbDecoder.h"
#include "util/bytes.h"
#include "util/cfree.h"
#include <netinet/in.h>
#include <memory>
extern "C" {
#include "redis/lzf.h"
#include "redis/endianconv.h"
#include "redis/util.h"
#include "redis/zmalloc.h"
};
int RdbDecoder::rdbLoadLenByRef(int *isencoded, uint64_t *lenptr) {
unsigned char buf[2];
int type;
if (isencoded) *isencoded = 0;
if (rioRead(buf, 1) == 0) return -1;
type = (buf[0] & 0xC0) >> 6;
if (type == RDB_ENCVAL) {
/* Read a 6 bit encoding type. */
if (isencoded) *isencoded = 1;
*lenptr = buf[0] & 0x3F;
} else if (type == RDB_6BITLEN) {
/* Read a 6 bit len. */
*lenptr = buf[0] & 0x3F;
} else if (type == RDB_14BITLEN) {
/* Read a 14 bit len. */
if (rioRead(buf + 1, 1) == 0) return -1;
*lenptr = ((buf[0] & 0x3F) << 8) | buf[1];
} else if (buf[0] == RDB_32BITLEN) {
/* Read a 32 bit len. */
uint32_t len;
if (rioRead(&len, 4) == 0) return -1;
*lenptr = ntohl(len);
} else if (buf[0] == RDB_64BITLEN) {
/* Read a 64 bit len. */
uint64_t len;
if (rioRead(&len, 8) == 0) return -1;
*lenptr = ntohu64(len);
} else {
rdbExitReportCorruptRDB(
"Unknown length encoding %d in rdbLoadLen()", type);
return -1; /* Never reached. */
}
return 0;
}
size_t RdbDecoder::rioRead(void *buf, size_t len) {
if (len > remain_size) {
return 0;
}
memcpy((char *) buf, p, len);
p = p + len;
remain_size = remain_size - len;
return len;
}
size_t RdbDecoder::rioReadString(const char **start, size_t len) {
if (len > remain_size) {
return 0;
}
*start = p;
p = p + len;
remain_size = remain_size - len;
return len;
}
size_t RdbDecoder::rioReadString(std::string &res, size_t len) {
if (len > remain_size) {
return 0;
}
// res = std::string(p, len);
res.assign(p, len);
p = p + len;
remain_size = remain_size - len;
return len;
}
std::string RdbDecoder::rdbLoadIntegerObject(int enctype, int *ret) {
unsigned char enc[4];
long long val;
if (enctype == RDB_ENC_INT8) {
if (rioRead(enc, 1) == 0) return NULL;
val = (signed char) enc[0];
} else if (enctype == RDB_ENC_INT16) {
uint16_t v;
if (rioRead(enc, 2) == 0) return NULL;
v = enc[0] | (enc[1] << 8);
val = (int16_t) v;
} else if (enctype == RDB_ENC_INT32) {
uint32_t v;
if (rioRead(enc, 4) == 0) return NULL;
v = enc[0] | (enc[1] << 8) | (enc[2] << 16) | (enc[3] << 24);
val = (int32_t) v;
} else {
val = 0; /* anti-warning */
rdbExitReportCorruptRDB("Unknown RDB integer encoding type %d", enctype);
}
return str((int64_t) val);
}
std::string RdbDecoder::rdbLoadLzfStringObject(int *ret) {
uint64_t len, clen;
char *t_val = NULL;
if ((clen = rdbLoadLen(NULL)) == RDB_LENERR) return NULL;
if ((len = rdbLoadLen(NULL)) == RDB_LENERR) return NULL;
/* Allocate our target according to the uncompressed size. */
/* Load the compressed representation and uncompress it to target. */
const char* tmp_c;
if (rioReadString(&tmp_c, clen) == 0) {
*ret = -1;
return "";
}
std::unique_ptr<char, cfree_delete<char>> out((char *)malloc(len));
t_val = out.get();
if (lzf_decompress(tmp_c, clen, t_val, len) == 0) {
*ret = -1;
return "";
}
std::string tmp(t_val, len);
*ret = 0;
return tmp;
}
std::string RdbDecoder::rdbGenericLoadStringObject(int *ret) {
int isencoded;
uint64_t len;
len = rdbLoadLen(&isencoded);
if (isencoded) {
switch (len) {
case RDB_ENC_INT8:
case RDB_ENC_INT16:
case RDB_ENC_INT32:
return rdbLoadIntegerObject(len, ret);
case RDB_ENC_LZF:
return rdbLoadLzfStringObject(ret);
default: rdbExitReportCorruptRDB("Unknown RDB string encoding type %d", len);
}
}
if (len == RDB_LENERR) {
*ret = -1;
return "";
}
std::string tmp;
if (len && rioReadString(tmp, len) == 0) {
*ret = -1;
return "";
} else {
*ret = 0;
return tmp;
}
}
bool RdbDecoder::verifyDumpPayload() {
const char *footer;
uint16_t rdbver;
uint64_t crc;
/* At least 2 bytes of RDB version and 8 of CRC64 should be present. */
if (remain_size < 10) return false;
footer = p + (remain_size - 10);
/* Verify RDB version */
rdbver = (footer[1] << 8) | footer[0];
if (rdbver > RDB_VERSION) return false;
/* Verify CRC64 */
crc = crc64_fast(0, (const unsigned char *) p, remain_size - 8);
memrev64ifbe(&crc);
remain_size = remain_size - 10;
return std::memcmp(&crc, footer + 2, 8) == 0;
}
int RdbDecoder::rdbLoadObjectType() {
int type;
if ((type = rdbLoadType()) == -1) return -1;
if (!rdbIsObjectType(type)) return -1;
return type;
}
uint64_t RdbDecoder::rdbLoadLen(int *isencoded) {
uint64_t len;
if (rdbLoadLenByRef(isencoded, &len) == -1) return RDB_LENERR;
return len;
}
int RdbDecoder::rdbLoadType() {
unsigned char type;
if (rioRead(&type, 1) == 0) return -1;
return type;
}
int RdbDecoder::rdbLoadBinaryDoubleValue(double *val) {
if (rioRead(val,sizeof(*val)) == 0) return -1;
memrev64ifbe(val);
return 0;
}
int RdbDecoder::rdbLoadDoubleValue(double *val) {
char buf[256];
unsigned char len;
if (rioRead(&len,1) == 0) return -1;
switch(len) {
case 255: *val = R_NegInf; return 0;
case 254: *val = R_PosInf; return 0;
case 253: *val = R_Nan; return 0;
default:
if (rioRead(buf,len) == 0) return -1;
buf[len] = '\0';
sscanf(buf, "%lg", val);
return 0;
}
}
| 24.646586 | 89 | 0.561675 | TimothyZhang023 |
15c65aa5c73eb13cf6190cdd1dde08de126e323f | 12,423 | cpp | C++ | Start.cpp | kongying-tavern/yuanshendt-updater | 68ab945a2f179b35857be125cdef14077b2329de | [
"WTFPL"
] | 5 | 2021-08-08T15:09:51.000Z | 2022-03-13T07:12:46.000Z | Start.cpp | kongying-tavern/yuanshendt-updater | 68ab945a2f179b35857be125cdef14077b2329de | [
"WTFPL"
] | null | null | null | Start.cpp | kongying-tavern/yuanshendt-updater | 68ab945a2f179b35857be125cdef14077b2329de | [
"WTFPL"
] | 2 | 2021-09-25T01:03:44.000Z | 2022-01-10T07:02:50.000Z | #include "Start.h"
#include <QStringList>
#include <QtWidgets/QMessageBox>
#include <QCoreApplication>
#include <QDebug>
#include <QUrl>
#include <QtConcurrent>
#include <QFileInfo>
#include <windows.h>
#include "file.h"
#include "MD5.h"
#include "Sandefine.h"
#include "Json.h"
#include "mainwindow.h"
Start *tp;
Start::Start(QString dir, QObject *parent)
: QObject(parent)
{
tp=this;
qDebug()<<"Start被创建";
tp->stlog(moduleStart,"Start被创建",NULL);
http = new HTTP("","",NULL);//单线程下载
connect(this, &Start::tstart, this, &Start::work);
connect(http, &HTTP::tworkMessageBox, this, &Start::tworkMessageBox);
workProcess = new QThread;
moveToThread(workProcess);
workProcess->start();
this->dir = dir;
}
Start::~Start()
{
tp->stlog(moduleStart,"Start被销毁",NULL);
qDebug()<<"Start被销毁";
}
void Start::dlworking(LONG64 dlnow,LONG64 dltotal,void *tid,QString path)
{
for(int i=0;i<maxDlThreah;++i)
{
//清理已完成的任务
//if(netspeed[i].dl==netspeed[i].total && netspeed[i].total>0)
if( netspeed[i].isdling==true && (netspeed[i].dl==netspeed[i].total && netspeed[i].total>0))
{
qDebug()<<&netspeed[i].tid<<"end dl"<<netspeed[i].path;
netspeed[i].isdling=false;
netspeed[i].tid=NULL;
//netspeed[i].dl=0;
//netspeed[i].hisDl=0;
//netspeed[i].total=0;
//netspeed[i].path="";
MainWindow::mutualUi->updataDlingmag();//更新进度文本
}
}
for(int i=0;i<3;++i)
{
if(netspeed[i].tid==NULL && path!="")
{
//新下载线程开始
qDebug()<<&tid<<"new dl"<<path;
netspeed[i].isdling=true;
netspeed[i].tid=tid;
netspeed[i].dl=0;
netspeed[i].dlt=QDateTime::currentDateTime().toMSecsSinceEpoch();
netspeed[i].hisDl=0;
netspeed[i].hisDlt=QDateTime::currentDateTime().toMSecsSinceEpoch();
netspeed[i].total=0;
netspeed[i].path=path;
break;
}
if(netspeed[i].tid==tid)
{
//正在下载的线程
netspeed[i].dl=dlnow;
netspeed[i].dlt=QDateTime::currentDateTime().toMSecsSinceEpoch();
netspeed[i].total=dltotal;
break;
}
}
}
void Start::stlog(int module,QString str,int mod=NULL)
{
if(tp) emit tp->log(module,str,mod);
}
void Start::dldone()
{
emit tworkProcess(doneFile++,totalFile);
tp->stlog(moduleStart,"下载完成 "+
QString::number(doneFile)+"/"+
QString::number(totalFile)
,NULL);
}
QString tNowWork()
{
//return "";
qint64 DETLAms;
int p;
LONG64 s;
QString tem="";
QString tems="0.00B/s";
for(int i=0;i<3;++i)
{
if(netspeed[i].path!="")
{
//计算已下载的百分比
DETLAms=netspeed[i].dlt-netspeed[i].hisDlt;
p = (int)(100*((double)netspeed[i].dl/(double)netspeed[i].total));
if(p<0)p=0;
//下载速度格式化
//s = (netspeed[i].dl-netspeed[i].hisDl)*2;
s=(int)((double)(netspeed[i].dl-netspeed[i].hisDl)*((double)1000/(double)DETLAms));
if(s>0)tems=conver(s);
//下载信息构造
tem+=QString::number(p)+"%\t | "
+QString(tems)+"\t | "
+netspeed[i].path
;
//下载字节数缓存
netspeed[i].hisDl=netspeed[i].dl;
netspeed[i].hisDlt=netspeed[i].dlt;
p=0;
tems="0.00B/s";
if(i<2)tem+="\n";
}
}
return tem;
}
void Start::updaterErr()
{
tp->stlog(moduleStart,"自动更新失败",NULL);
emit tworkProcess(0,1);
MainWindow::mutualUi->changePBText("自动更新失败,请单击重试");
emit tworkFinished(false);
MainWindow::mutualUi->changeMainPage(1,false);
emit tworkMessageBox(1,
"自动更新失败",
uperr_new);
}
void Start::stopWork()
{
tp->stlog(moduleStart,"任务线程被要求终止",NULL);
if(tpoolhttp->activeThreadCount()>0)
{
tp->stlog(moduleStart,"停止下载线程池",NULL);
qDebug()<<"停止线程池";
tpoolhttp->thread()->terminate();
this->thread()->terminate();
}
}
void Start::work()
{
QString path=this->dir;
//Start::updaterErr();
//return;
MainWindow::mutualUi->changeMainPage(0);
qDebug()<<"工作目标:"<<path;
tp->stlog(moduleStart,"工作目标:"+path,NULL);
//return;
//return;
/*前期工作********************************************************/
/*互斥原神本体路径*/
QFileInfo yuanshen(path+"/YuanShen.exe");
if(yuanshen.exists())
{
qDebug()<<"目标目录找到原神本体";
tp->stlog(moduleStart,"目标目录找到原神本体",NULL);
MainWindow::mutualUi->changeProgressBarColor(
QString("rgb(255, 0, 0)")
,QString("rgb(255, 0, 0)"));
MainWindow::mutualUi->changeMainPage0label_Text("?");
emit tworkMessageBox(
1,
"我受过专业的训练",
"但是请你不要把地图装在原神目录"
);
MainWindow::mutualUi->changeMainPage(1,false);
emit tworkFinished(false);
tp->stlog(moduleStart,"线程主动退出",NULL);
return;
}
/*获取系统环境变量temp*********************************************/
MainWindow::mutualUi->changeMainPage0label_Text("初始化...");
tp->stlog(moduleStart,"初始化...",NULL);
emit tworkProcess(1,2);
MainWindow::mutualUi->changeProgressBarColor(
QString("rgb(235, 235, 235)")
,QString("rgb(58, 59, 64)"));
QString tempPath;
tempPath=getTempPath("temp");
qDebug()<<"临时目录:"<<tempPath;
tp->stlog(moduleStart,"临时目录:"+tempPath,NULL);
/*在%temp%创建临时目录*/
tempPath=tempPath+updaterTempDir;
qDebug()<<"临时文件夹:"<<tempPath;
tp->stlog(moduleStart,"创建临时文件夹"+tempPath,NULL);
createFolderSlot(tempPath);
/*在临时目录释放crt证书*/
tp->stlog(moduleStart,"释放crt证书",NULL);
httpcrt();
/*获取在线md5******************************************************/
/* 获取在线文件md5
* url download.yuanshen.site/md5.json
* url dlurl"md5.json"
* path "md5.json"
*/
tp->stlog(moduleStart,"\r\n获取在线文件MD5json",NULL);
MainWindow::mutualUi->changeMainPage0label_Text("获取在线文件MD5...");
http->httpDownLoad(dlurl"md5.json","md5.json");
/*读取在线文件md5.json到
* QJson newmd5.json
* 字符串 QString newMD5Str
* 文件数 QSL newFileList
* 文件MD5 QSL newFileMD5
*/
//_sleep(1000);
QString newMD5Str;
QStringList newFileList;
QStringList newFileMD5;
//qDebug()<<tempPath<<"download/md5.json";
tp->stlog(moduleStart,"读入MD5文件",NULL);
newMD5Str = readTXT(tempPath+"download/md5.json");
qDebug()<<"开始转换成QSL";
tp->stlog(moduleStart,"格式化MD5List",NULL);
JSON *json=new JSON();
json->tp=tp;
json->jsonStr2QSL(newMD5Str,newFileList,newFileMD5);
// return;
/*按需读取本地文件MD5**************************************************/
emit tworkProcess(0,1);//进度条归零
QStringList needUpdate;
QStringList needUpdateMD5;
qDebug()<<"按需读取本地文件MD5:"<<path;
emit log(moduleStart,"按需读取本地文件MD5",NULL);
QString omd5;
for(int i = 0; i< newFileList.size();++i)
{
//qDebug()<<newFileMD5.at(i)<<this->dir+"/"+newFileList.at(i);
omd5 = getFlieMD5(this->dir+"/"+newFileList.at(i));
//emit log(moduleMD5,"本地文件MD5:"+omd5+"|"+newFileList.at(i),NULL);
emit log(moduleMD5,"本地文件:\t"+newFileList.at(i),NULL);
emit log(moduleMD5,"本地MD5:\t"+omd5,NULL);
emit tworkProcess(i,newFileList.size());
MainWindow::mutualUi->changeMainPage0label_Text("正在扫描本地文件MD5:"+newFileList.at(i));
if(newFileMD5.at(i) == omd5)
{
emit log(moduleMD5,"云端MD5\t"+newFileMD5.at(i),NULL);
}else{
qDebug()<<"MD5不匹配:"<<dir+"/"+newFileList.at(i);
emit log(moduleMD5,"云端MD5\t"+newFileMD5.at(i)+"\t需要更新",NULL);
needUpdate<<newFileList.at(i);
needUpdateMD5<<newFileMD5.at(i);
}
emit log(moduleMD5,"\r\n",NULL);
}
//return;
/*下载需要更新的文件**********************************************/
/* 下载文件
* 需要更新的文件在 QStringList needUpdater
* 下载文件前需要对字符串做很多工作
* 一是反斜杠转斜杠并删除第一个斜杠
*/
emit log(moduleStart,"根据本地文件MD5下载需要更新的文件",NULL);
QString tem;
MainWindow::mutualUi->changeProgressBarColor(
QString("#3880cc")
,QString("#00c500"));
int retry=0;//多线程下载如何重试QAQ
totalFile=needUpdate.size();
doneFile=0;
//初始libcurl线程池
emit log(moduleStart,"初始libcurl线程池",NULL);
emit log(moduleStart,"设置同时下载任务数为"+QString::number(maxDlThreah),NULL);
tpoolhttp=QThreadPool::globalInstance();
tpoolhttp->setMaxThreadCount(maxDlThreah);
//tpoolhttp->setMaxThreadCount(needUpdate.size());//A8:我tm谢谢你
tpoolhttp->setExpiryTimeout(-1);
for(int i = 0; i< needUpdate.size();++i)
{
if(needUpdateMD5.at(i)!=getFlieMD5(tempPath+"download/Map/"+needUpdate.at(i)))
{
qDebug()<<"全新下载";
emit log(moduleStart,"新建下载任务\t"+needUpdate.at(i),NULL);
//构造下载链接
QString url=dlurlMap+QUrl::toPercentEncoding(needUpdate.at(i));
QString dlpath="Map/"+QString(needUpdate.at(i));
thttp = new HTTP(url,dlpath,this);
connect(thttp,&HTTP::dldone
,this,&Start::dldone
,Qt::DirectConnection
);
connect(thttp, &HTTP::tworkMessageBox
, this, &Start::tworkMessageBox
,Qt::DirectConnection
);
tpoolhttp->start(thttp);
}else{
qDebug()<<needUpdate.at(i)<<"已下载";
tp->stlog(moduleStart,"文件已被下载\t"+needUpdate.at(i),NULL);
Start::dldone();
}
}
//tpoolhttp->activeThreadCount();
tpoolhttp->dumpObjectTree();
tpoolhttp->waitForDone(-1);
tpoolhttp->clear();
qDebug()<<"下载完成";
tp->stlog(moduleStart,"下载完成",NULL);
//MainWindow::mutualUi->changeMainPage0label_Text("下载完成");
//qDebug()<<FindWindowW(NULL,(LPCWSTR)QString("「空荧酒馆」原神地图").unicode());//地图进程窗口
//return;
/*移动文件至目标目录*********************************************/
/*
* 移动文件
* 下载好的地图存在%temp%\download\Map\
* 移动的目标文件夹为path
*/
//MainWindow::mutualUi->changeMainPage0label_Text("正在移动文件");
tp->stlog(moduleStart,"正在移动文件",NULL);
MainWindow::mutualUi->changeProgressBarColor(
QString("#00c500")
,QString("#078bff"));
int f=0;
for(int i = 0; i< needUpdate.size();++i)
{
//构造新旧文件名
QString oldPath=getTempPath("temp")+
updaterTempDir+
"download/"+"Map/"+
QString(needUpdate.at(i))
;
QString newPath=path+
"/"+
QString(needUpdate.at(i))
;
qDebug()<<QString::number(i+1)+
"|"+
QString::number(needUpdate.size())
;
MainWindow::mutualUi->changeMainPage0label_Text(
QString::number(i+1)+
"|"+
QString::number(needUpdate.size())+
" 正在移动文件:"+
needUpdate.at(i)
);
QFileInfo info(newPath);
createFolderSlot(info.path());
if(moveFile(oldPath,newPath))
{
qDebug()<<"√(^-^)";
f=0;
}else{
qDebug()<<"移动失败第"<<f<<"次";
f++;
i--;
if(f>1)
{
Start::updaterErr();
return;
}
}
emit tworkProcess(i,needUpdate.size());
}
emit tworkProcess(1,1);
MainWindow::mutualUi->changeMainPage0label_Text("不存在的看不到这句话的");
MainWindow::mutualUi->changeMainPage(1,true);
emit tworkFinished(true);
tp->stlog(moduleStart,"更新流程结束",NULL);
}
| 31.292191 | 101 | 0.519681 | kongying-tavern |
15cb6a77994877a44b18c097680e944e35a78627 | 659 | cpp | C++ | other/TopTec2021/S1/N.cpp | axelgio01/cp | 7a1c3490f913e4aea53e46bcfb5bb56c9b15605d | [
"MIT"
] | null | null | null | other/TopTec2021/S1/N.cpp | axelgio01/cp | 7a1c3490f913e4aea53e46bcfb5bb56c9b15605d | [
"MIT"
] | null | null | null | other/TopTec2021/S1/N.cpp | axelgio01/cp | 7a1c3490f913e4aea53e46bcfb5bb56c9b15605d | [
"MIT"
] | null | null | null | //
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t;
while (t--) {
long long n, all = 0; cin >> n;
set<int> winners;
vector< pair<long long, int> > a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i].first;
a[i].second = i + 1;
all += a[i].first;
}
sort(a.rbegin(), a.rend());
for (int i = 0; i < n; ++i) {
long long cur = a[i].first;
all -= cur;
winners.insert(a[i].second);
if (cur > all) {
break;
}
}
cout << (int) winners.size() << '\n';
for (auto &ans : winners) {
cout << ans << ' ';
}
cout << '\n';
}
return 0;
} | 19.382353 | 39 | 0.496206 | axelgio01 |
15ce56fd139435072285e28c57ca2ff95ab2a751 | 927 | hpp | C++ | flare/include/flare/paint/actor_gradient_fill.hpp | taehyub/flare_cpp | 7731bc0bcf2ce721f103586a48f74aa5c12504e8 | [
"MIT"
] | 14 | 2019-04-29T15:17:24.000Z | 2020-12-30T12:51:05.000Z | flare/include/flare/paint/actor_gradient_fill.hpp | taehyub/flare_cpp | 7731bc0bcf2ce721f103586a48f74aa5c12504e8 | [
"MIT"
] | null | null | null | flare/include/flare/paint/actor_gradient_fill.hpp | taehyub/flare_cpp | 7731bc0bcf2ce721f103586a48f74aa5c12504e8 | [
"MIT"
] | 6 | 2019-04-29T15:17:25.000Z | 2021-11-16T03:20:59.000Z | #ifndef _FLARE_ACTOR_GRADIENT_FILL_HPP_
#define _FLARE_ACTOR_GRADIENT_FILL_HPP_
#include "flare/paint/actor_fill.hpp"
#include "flare/paint/actor_gradient_color.hpp"
namespace flare
{
class BlockReader;
class ActorArtboard;
class ActorGradientFill : public ActorGradientColor, public ActorFill
{
typedef ActorGradientColor Base;
public:
ActorGradientFill();
void copy(const ActorGradientFill* gradientColor, ActorArtboard* artboard);
static ActorGradientFill* read(ActorArtboard* artboard, BlockReader* reader, ActorGradientFill* component);
void onShapeChanged(ActorShape* from, ActorShape* to) override;
ActorComponent* makeInstance(ActorArtboard* artboard) const override;
void initializeGraphics() override;
void validatePaint() override { ActorGradientColor::validatePaint(); }
void markPaintDirty() override { ActorGradientColor::markPaintDirty(); }
};
} // namespace flare
#endif | 33.107143 | 109 | 0.79288 | taehyub |
15d132691ab76cd46b34a9f55d3b8503b32ac5f4 | 4,411 | cc | C++ | src/trace.cc | offis/libbla | 4d6391df7ddd6a6ab0a61d9469b6f9fd49d060de | [
"Apache-2.0"
] | null | null | null | src/trace.cc | offis/libbla | 4d6391df7ddd6a6ab0a61d9469b6f9fd49d060de | [
"Apache-2.0"
] | null | null | null | src/trace.cc | offis/libbla | 4d6391df7ddd6a6ab0a61d9469b6f9fd49d060de | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2018-2020 OFFIS Institute for Information Technology
* Oldenburg, Germany
*
* 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.
*/
/*
* trace.cc
*
* Created on: 21.06.2019
* Author: irune
* Edited on: 08.07.2019
* Author: irune
*/
#include "../include/trace.h"
#include <sstream>
#include <iomanip>
int traceSingleton::cnt;
int traceSingleton::cntPet;
int traceSingleton::cntPnet;
int traceSingleton::counter;
sysx::units::time_type traceSingleton::startTimeL1;
sysx::units::time_type traceSingleton::startTimeL2;
#ifdef TRACEON
std::vector<std::string> traceSingleton::hierarchy;
std::vector<std::string> traces;
//#define NELEMS(x) (sizeof(x) / sizeof((x)[0]))
traceSingleton::traceSingleton()
: myfile_(NULL)
{
// myfile_.open("traces.txt")
myfile_.rdbuf(std::cout.rdbuf());;
cnt = 0;
cntPet = -1;
cntPnet = 0;
counter = 0;
startTimeL1 = timer::getTime();
startTimeL2 = timer::getTime();
}
traceSingleton& traceSingleton::getInstance()
{
static traceSingleton instance;
return instance;
}
void traceSingleton::print(std::string id, time_type instant){
auto &mem = memory::getInstance();
double time_ns = static_cast<double>(instant / ::sysx::si::milliseconds);
for (int i = 0; i < (hierarchy.size() - 1); i++) {
mem.bodies[counter].identity = mem.bodies[counter].identity + hierarchy.at(i) + ".";
}
mem.bodies[counter].identity = mem.bodies[counter].identity + " " + id + " " ;
mem.bodies[counter].times = time_ns;
counter++;
}
void traceSingleton::output(){
auto &mem = memory::getInstance();
mem.output();
//mem.switchingTime();
}
void traceSingleton::FET_entry_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "FET_" << id;
hierarchy.push_back(oss.str());
oss << ".Entry " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::FET_exit_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "FET_" << id << ".Exit " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::BET_entry_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "BET_" << id;
hierarchy.push_back(oss.str());
oss << ".Entry " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::BET_pentry_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "BET_" << id << ".PEntry " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::BET_exit_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "BET_" << id << ".Exit " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::PET_entry_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "PET_" << id;
hierarchy.push_back(oss.str());
oss << ".Entry " << causal_id_;
print(oss.str(), instant);
}
void traceSingleton::PET_exit_trace(int id, int causal_id_, time_type instant)
{
std::ostringstream oss;
oss << "PET_" << id << ".Exit " << causal_id_;
print(oss.str(), instant);
}
#else
traceSingleton::traceSingleton(){ }
traceSingleton& traceSingleton::getInstance()
{
static traceSingleton instance;
return instance;
}
void traceSingleton::output(){}
void traceSingleton::FET_entry_trace(int id, int causal_id_, time_type instant) { }
void traceSingleton::FET_exit_trace(int id, int causal_id_, time_type instant) { }
void traceSingleton::BET_entry_trace(int id, int causal_id_, time_type instant) { }
void traceSingleton::BET_pentry_trace(int id, int causal_id_, time_type instant){ }
void traceSingleton::BET_exit_trace(int id, int causal_id_, time_type instant) { }
void traceSingleton::PET_entry_trace(int id, int causal_id_, time_type instant) { }
void traceSingleton::PET_exit_trace(int id, int causal_id_, time_type instant) { }
#endif //TRACEON
| 27.917722 | 89 | 0.697574 | offis |
15d2b2c8a1eac7279da29bc6a0b3b0f415de9f6d | 6,599 | cpp | C++ | src/row_renderer.cpp | magicmoremagic/bengine-ctable | ab82acd66f3021888701fb086dcec0e0713038c2 | [
"MIT"
] | null | null | null | src/row_renderer.cpp | magicmoremagic/bengine-ctable | ab82acd66f3021888701fb086dcec0e0713038c2 | [
"MIT"
] | null | null | null | src/row_renderer.cpp | magicmoremagic/bengine-ctable | ab82acd66f3021888701fb086dcec0e0713038c2 | [
"MIT"
] | null | null | null | #include "pch.hpp"
#include "row_renderer.hpp"
#include "table_sizer.hpp"
#include <memory>
namespace be::ct {
namespace detail {
namespace {
///////////////////////////////////////////////////////////////////////////////
U8 get_margin(const BorderConfig& config) {
return config.margin > 0 ? config.margin - 1 : 0;
}
///////////////////////////////////////////////////////////////////////////////
U8 get_margin(const Row& row, BoxConfig::side side) {
return get_margin(row.config().box.sides[side]);
}
///////////////////////////////////////////////////////////////////////////////
U8 get_padding(const Row& row, BoxConfig::side side) {
return row.config().box.sides[side].padding;
}
} // be::ct::detail::()
///////////////////////////////////////////////////////////////////////////////
RowRenderer::RowRenderer(const Row& row)
: seq(),
padding(seq,
get_padding(row, BoxConfig::top_side),
get_padding(row, BoxConfig::right_side),
get_padding(row, BoxConfig::bottom_side),
get_padding(row, BoxConfig::left_side),
row.config().box.foreground,
row.config().box.background),
border(padding),
margin(border,
get_margin(row, BoxConfig::top_side),
get_margin(row, BoxConfig::right_side),
get_margin(row, BoxConfig::bottom_side),
get_margin(row, BoxConfig::left_side)),
config_(row.config().box),
align_(row.config().box.align)
{
border.foreground(row.config().box.foreground);
border.background(row.config().box.background);
try_add_border_(BoxConfig::top_side);
try_add_border_(BoxConfig::right_side);
try_add_border_(BoxConfig::bottom_side);
try_add_border_(BoxConfig::left_side);
cells_.reserve(row.size());
for (const Cell& cell : row) {
cells_.push_back(std::make_unique<CellRenderer>(cell));
seq.add(cells_.back().get());
}
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::auto_size(I32 max_total_width) {
TableSizer sizer(1);
sizer.add(*this);
sizer.set_sizes(max_total_width);
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::combine_border_corners() {
freeze();
for (auto& cell : cells_) {
cell->combine_border_corners();
}
if (config_.corners) {
if (!border.left().empty()) {
if (!border.top().empty()) {
auto& bc = border.top().front();
bc = config_.corners(bc, border.left().front(), BoxConfig::top_side, BoxConfig::left_side);
}
if (!border.bottom().empty()) {
auto& bc = border.bottom().front();
bc = config_.corners(bc, border.left().back(), BoxConfig::bottom_side, BoxConfig::left_side);
}
}
if (!border.right().empty()) {
if (!border.top().empty()) {
auto& bc = border.top().back();
bc = config_.corners(bc, border.right().front(), BoxConfig::top_side, BoxConfig::right_side);
}
if (!border.bottom().empty()) {
auto& bc = border.bottom().back();
bc = config_.corners(bc, border.right().back(), BoxConfig::bottom_side, BoxConfig::right_side);
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::align(U8 align) {
align_ = align;
}
///////////////////////////////////////////////////////////////////////////////
U8 RowRenderer::align() const {
return align_;
}
///////////////////////////////////////////////////////////////////////////////
I32 RowRenderer::width_() const {
return margin.width();
}
///////////////////////////////////////////////////////////////////////////////
I32 RowRenderer::height_() const {
return margin.height();
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::freeze_() {
bool first_freeze = cached_width_ == -1;
if (first_freeze) {
constexpr const U8 halign_mask = BoxConfig::align_left | BoxConfig::align_center | BoxConfig::align_right;
constexpr const U8 valign_mask = BoxConfig::align_top | BoxConfig::align_middle | BoxConfig::align_bottom;
for (auto& cell : cells_) {
if ((cell->text.align() & halign_mask) == BoxConfig::inherit_alignment) {
cell->text.align(cell->text.align() | (align_ & halign_mask));
}
if ((cell->text.align() & valign_mask) == BoxConfig::inherit_alignment) {
cell->text.align(cell->text.align() | (align_ & valign_mask));
}
}
}
margin.freeze();
base::freeze_();
if (first_freeze) {
generate_border_(BoxConfig::top_side);
generate_border_(BoxConfig::right_side);
generate_border_(BoxConfig::bottom_side);
generate_border_(BoxConfig::left_side);
}
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::render_(std::ostream& os) {
margin(os);
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::try_add_border_(BoxConfig::side side) {
if (config_.sides[side].margin > 0) {
border.enabled(side, true);
border.top().emplace_back();
}
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::generate_border_(BoxConfig::side side) {
auto& b = border.get(side);
if (!b.empty() || border.enabled(side)) {
auto pattern = config_.sides[side].pattern;
std::size_t size = 2 + (side == BoxConfig::top_side || side == BoxConfig::bottom_side ?
padding.width() : padding.height());
b = expand_border_pattern(pattern, size);
resolve_border_colors_(side);
}
}
///////////////////////////////////////////////////////////////////////////////
void RowRenderer::resolve_border_colors_(BoxConfig::side side) {
LogColor fg = config_.sides[side].foreground;
LogColor bg = border.background();
if (fg == LogColor::current) {
fg = border.foreground();
} else if (fg == LogColor::other) {
fg = bg;
}
for (auto& bc : border.get(side)) {
if (bc.foreground == LogColor::current) {
bc.foreground = fg;
} else if (bc.foreground == LogColor::other) {
bc.foreground = bg;
}
if (bc.background == LogColor::current) {
bc.background = bg;
} else if (bc.background == LogColor::other) {
bc.background = fg;
}
}
}
} // be::ct::detail
} // be::ct
| 32.830846 | 112 | 0.504167 | magicmoremagic |
15d74717934c1cdd6bd4f073ec485bf529f7e93d | 6,872 | cpp | C++ | liblink/native/src/deterministic_wallet.cpp | oklink-dev/bitlink | 69705ccd8469a11375ad3c08c00c9dc54773355e | [
"MIT"
] | null | null | null | liblink/native/src/deterministic_wallet.cpp | oklink-dev/bitlink | 69705ccd8469a11375ad3c08c00c9dc54773355e | [
"MIT"
] | null | null | null | liblink/native/src/deterministic_wallet.cpp | oklink-dev/bitlink | 69705ccd8469a11375ad3c08c00c9dc54773355e | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2011-2013 libwallet developers (see AUTHORS)
*
* This file is part of libwallet.
*
* libwallet is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deterministic_wallet.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <openssl/ec.h>
#include <openssl/obj_mac.h>
#include <openssl/sha.h>
#include "constants.hpp"
#include "format.hpp"
#include "utility/assert.hpp"
#include "utility/sha256.hpp"
template <typename ssl_type>
struct ssl_wrapper
{
ssl_wrapper(ssl_type* obj)
: obj(obj) {}
virtual ~ssl_wrapper()
{
}
operator ssl_type*()
{
return obj;
}
ssl_type* obj;
};
struct ssl_bignum
: public ssl_wrapper<BIGNUM>
{
ssl_bignum()
: ssl_wrapper(BN_new()) {}
~ssl_bignum()
{
BN_free(obj);
}
};
#define SSL_TYPE(name, ssl_type, free_func) \
struct name \
: public ssl_wrapper<ssl_type> \
{ \
name(ssl_type* obj) \
: ssl_wrapper(obj) {} \
~name() \
{ \
free_func(obj); \
} \
};
SSL_TYPE(ec_group, EC_GROUP, EC_GROUP_free)
SSL_TYPE(ec_point, EC_POINT, EC_POINT_free)
SSL_TYPE(bn_ctx, BN_CTX, BN_CTX_free)
const std::string bignum_hex(BIGNUM* bn)
{
char* repr = BN_bn2hex(bn);
std::string result = repr;
OPENSSL_free(repr);
boost::algorithm::to_lower(result);
return result;
}
const data_chunk bignum_data(BIGNUM* bn)
{
data_chunk result(32);
size_t copy_offset = result.size() - BN_num_bytes(bn);
BN_bn2bin(bn, result.begin() + copy_offset);
// Zero out beginning 0x00 bytes (if they exist).
std::fill(result.begin(), result.begin() + copy_offset, 0x00);
return result;
}
void deterministic_wallet::new_seed()
{
const size_t bits_needed = 8 * seed_size / 2;
ssl_bignum rand_value;
BN_rand(rand_value, bits_needed, 0, 0);
bool set_success = set_seed(bignum_hex(rand_value));
BITCOIN_ASSERT(set_success);
}
secret_parameter stretch_seed(const std::string& seed)
{
BITCOIN_ASSERT(seed.size() == deterministic_wallet::seed_size);
secret_parameter stretched;
std::copy(seed.begin(), seed.end(), stretched.begin());
secret_parameter oldseed = stretched;
for (size_t i = 0; i < 100000; ++i)
{
SHA256_CTX ctx;
SHA256_Init(&ctx);
SHA256_Update(&ctx, stretched.data(), stretched.size());
SHA256_Update(&ctx, oldseed.data(), oldseed.size());
SHA256_Final(stretched.data(), &ctx);
}
return stretched;
}
data_chunk pubkey_from_secret(const secret_parameter& secret)
{
elliptic_curve_key privkey;
if (!privkey.set_secret(secret))
return data_chunk();
return privkey.public_key();
}
bool deterministic_wallet::set_seed(std::string seed)
{
// Trim spaces and newlines around the string.
boost::algorithm::trim(seed);
if (seed.size() != seed_size)
return false;
seed_ = seed;
stretched_seed_ = stretch_seed(seed);
master_public_key_ = pubkey_from_secret(stretched_seed_);
// Snip the beginning 04 byte for compat reasons.
master_public_key_.erase(master_public_key_.begin());
if (master_public_key_.empty())
return false;
return true;
}
const std::string& deterministic_wallet::seed() const
{
return seed_;
}
bool deterministic_wallet::set_master_public_key(const data_chunk& mpk)
{
master_public_key_ = mpk;
return true;
}
const data_chunk& deterministic_wallet::master_public_key() const
{
return master_public_key_;
}
data_chunk deterministic_wallet::generate_public_key(
size_t n, bool for_change) const
{
hash_digest sequence = get_sequence(n, for_change);
ssl_bignum x, y, z;
BN_bin2bn(sequence.data(), sequence.size(), z);
BN_bin2bn(master_public_key_.begin(), 32, x);
BN_bin2bn(master_public_key_.begin() + 32, 32, y);
// Create a point.
ec_group group(EC_GROUP_new_by_curve_name(NID_secp256k1));
ec_point mpk(EC_POINT_new(group));
bn_ctx ctx(BN_CTX_new());
EC_POINT_set_affine_coordinates_GFp(group, mpk, x, y, ctx);
ec_point result(EC_POINT_new(group));
// result pubkey_point = mpk_pubkey_point + z*curve.generator
ssl_bignum one;
BN_one(one);
EC_POINT_mul(group, result, z, mpk, one, ctx);
// Create the actual public key.
EC_POINT_get_affine_coordinates_GFp(group, result, x, y, ctx);
// 04 + x + y
data_chunk raw_pubkey;
raw_pubkey.push_back(0x04);
extend_data(raw_pubkey, bignum_data(x));
extend_data(raw_pubkey, bignum_data(y));
return raw_pubkey;
}
secret_parameter deterministic_wallet::generate_secret(
size_t n, bool for_change) const
{
if (seed_.empty())
return null_hash;
ssl_bignum z;
hash_digest sequence = get_sequence(n, for_change);
BN_bin2bn(sequence.data(), sequence.size(), z);
ec_group group(EC_GROUP_new_by_curve_name(NID_secp256k1));
ssl_bignum order;
bn_ctx ctx(BN_CTX_new());
EC_GROUP_get_order(group, order, ctx);
// secexp = (stretched_seed + z) % order
ssl_bignum secexp;
BN_bin2bn(stretched_seed_.data(), stretched_seed_.size(), secexp);
BN_add(secexp, secexp, z);
BN_mod(secexp, secexp, order, ctx);
secret_parameter secret;
int secexp_bytes_size = BN_num_bytes(secexp);
BITCOIN_ASSERT(secexp_bytes_size >= 0 &&
static_cast<size_t>(BN_num_bytes(secexp)) <= secret.size());
// If bignum value begins with 0x00, then
// SSL will skip to the first significant digit.
size_t copy_offset = secret.size() - BN_num_bytes(secexp);
BN_bn2bin(secexp, secret.data() + copy_offset);
// Zero out beginning 0x00 bytes (if they exist).
std::fill(secret.begin(), secret.begin() + copy_offset, 0x00);
return secret;
}
hash_digest deterministic_wallet::get_sequence(
size_t n, bool for_change) const
{
data_chunk chunk;
extend_data(chunk, boost::lexical_cast<std::string>(n));
chunk.push_back(':');
chunk.push_back(for_change ? '1' : '0');
chunk.push_back(':');
extend_data(chunk, master_public_key_);
hash_digest result = generate_sha256_hash(chunk);
std::reverse(result.begin(), result.end());
return result;
}
| 28.633333 | 75 | 0.688009 | oklink-dev |
15d9f9a3830d5e095f06541835660dc168304512 | 1,302 | cpp | C++ | test/main.cpp | fyquah95/robot_cpp | f0898957fb0b1258419e4ace9d7464143caaa5e4 | [
"MIT"
] | 11 | 2018-01-10T12:35:04.000Z | 2018-08-29T01:47:48.000Z | test/main.cpp | fyquah95/robot_cpp | f0898957fb0b1258419e4ace9d7464143caaa5e4 | [
"MIT"
] | null | null | null | test/main.cpp | fyquah95/robot_cpp | f0898957fb0b1258419e4ace9d7464143caaa5e4 | [
"MIT"
] | 2 | 2018-01-10T13:04:08.000Z | 2018-01-10T13:24:12.000Z | #include <iostream>
#include <thread>
#include <chrono>
#include <utility>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <robot.h>
#include "strategy.hpp"
#include "game.hpp"
#include "vision.hpp"
#include "interact.hpp"
int entry_point(int argc, const char *argv[])
{
static char char_buffer[200];
robot_h robot = robot_init();
vision_init(robot);
interact_init(robot);
game_state_t game_state = load_initial_game_state();
std::cout << "Initial state = " << game_state << std::endl;
try {
game_state = strategy_init(game_state);
bool moved;
do {
game_state = strategy_step(game_state, &moved);
} while(moved);
} catch (std::exception e) {
}
std::cout << "Wrapping up " << game_state << std::endl;
game_state = strategy_term(game_state);
std::cout << "I AM DONE (not sure if i won the game)" << std::endl;
std::cout << "Strategy internal state:" << std::endl;
strategy_print_internal_state();
std::cout << "Game state: " << std::endl;
std::cout << game_state << "\n";
robot_mouse_move(robot, 2000, 100);
robot_mouse_press(robot, ROBOT_BUTTON1_MASK);
robot_mouse_release(robot, ROBOT_BUTTON1_MASK);
robot_free(robot);
return 0;
}
| 22.067797 | 69 | 0.678955 | fyquah95 |
15db8f5260aaa60a00b0c9e6ce2f08c738014e07 | 2,436 | cc | C++ | logging/rtc_event_log/events/rtc_event_begin_log.cc | brandongatling/WebRTC | 5b661302097ba03e1055357556c35f6e5d37b550 | [
"BSD-3-Clause"
] | null | null | null | logging/rtc_event_log/events/rtc_event_begin_log.cc | brandongatling/WebRTC | 5b661302097ba03e1055357556c35f6e5d37b550 | [
"BSD-3-Clause"
] | null | null | null | logging/rtc_event_log/events/rtc_event_begin_log.cc | brandongatling/WebRTC | 5b661302097ba03e1055357556c35f6e5d37b550 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "logging/rtc_event_log/events/rtc_event_begin_log.h"
#include "absl/strings/string_view.h"
namespace webrtc {
constexpr RtcEvent::Type RtcEventBeginLog::kType;
constexpr EventParameters RtcEventBeginLog::event_params_;
constexpr FieldParameters RtcEventBeginLog::utc_start_time_params_;
RtcEventBeginLog::RtcEventBeginLog(Timestamp timestamp,
Timestamp utc_start_time)
: RtcEvent(timestamp.us()), utc_start_time_ms_(utc_start_time.ms()) {}
RtcEventBeginLog::RtcEventBeginLog(const RtcEventBeginLog& other)
: RtcEvent(other.timestamp_us_) {}
RtcEventBeginLog::~RtcEventBeginLog() = default;
std::string RtcEventBeginLog::Encode(rtc::ArrayView<const RtcEvent*> batch) {
EventEncoder encoder(event_params_, batch);
encoder.EncodeField(
utc_start_time_params_,
ExtractRtcEventMember(batch, &RtcEventBeginLog::utc_start_time_ms_));
return encoder.AsString();
}
RtcEventLogParseStatus RtcEventBeginLog::Parse(
absl::string_view encoded_bytes,
bool batched,
std::vector<LoggedStartEvent>& output) {
EventParser parser;
auto status = parser.Initialize(encoded_bytes, batched);
if (!status.ok())
return status;
rtc::ArrayView<LoggedStartEvent> output_batch =
ExtendLoggedBatch(output, parser.NumEventsInBatch());
constexpr FieldParameters timestamp_params{
"timestamp_ms", FieldParameters::kTimestampField, FieldType::kVarInt, 64};
RtcEventLogParseStatusOr<rtc::ArrayView<uint64_t>> result =
parser.ParseNumericField(timestamp_params);
if (!result.ok())
return result.status();
PopulateRtcEventTimestamp(result.value(), &LoggedStartEvent::timestamp,
output_batch);
result = parser.ParseNumericField(utc_start_time_params_);
if (!result.ok())
return result.status();
PopulateRtcEventTimestamp(result.value(), &LoggedStartEvent::utc_start_time,
output_batch);
return RtcEventLogParseStatus::Success();
}
} // namespace webrtc
| 34.8 | 80 | 0.741379 | brandongatling |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.