hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
02d2de8629626de6b798c45d57cec46020ad9d3d | 28,047 | cc | C++ | Simulation/OMNeT++/inet/src/inet/linklayer/bmac/BMacLayer.cc | StarStuffSteve/masters-research-project | 47c1874913d0961508f033ca9a1144850eb8f8b7 | [
"Apache-2.0"
] | 1 | 2017-03-13T15:51:22.000Z | 2017-03-13T15:51:22.000Z | Simulation/OMNeT++/inet/src/inet/linklayer/bmac/BMacLayer.cc | StarStuffSteve/masters-research-project | 47c1874913d0961508f033ca9a1144850eb8f8b7 | [
"Apache-2.0"
] | null | null | null | Simulation/OMNeT++/inet/src/inet/linklayer/bmac/BMacLayer.cc | StarStuffSteve/masters-research-project | 47c1874913d0961508f033ca9a1144850eb8f8b7 | [
"Apache-2.0"
] | null | null | null | //
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 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 Lesser 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, see http://www.gnu.org/licenses/.
//
#include "inet/common/INETUtils.h"
#include "inet/common/INETMath.h"
#include "inet/networklayer/common/InterfaceEntry.h"
#include "inet/common/ModuleAccess.h"
#include "inet/linklayer/contract/IMACProtocolControlInfo.h"
#include "inet/linklayer/common/SimpleLinkLayerControlInfo.h"
#include "inet/linklayer/bmac/BMacLayer.h"
namespace inet {
Define_Module(BMacLayer);
void BMacLayer::initialize(int stage)
{
MACProtocolBase::initialize(stage);
if (stage == INITSTAGE_LOCAL) {
queueLength = hasPar("queueLength") ? par("queueLength") : 10;
animation = hasPar("animation") ? par("animation") : true;
slotDuration = hasPar("slotDuration") ? par("slotDuration") : 1.;
bitrate = hasPar("bitrate") ? par("bitrate") : 15360.;
headerLength = hasPar("headerLength") ? par("headerLength") : 10.;
checkInterval = hasPar("checkInterval") ? par("checkInterval") : 0.1;
useMacAcks = hasPar("useMACAcks") ? par("useMACAcks") : false;
maxTxAttempts = hasPar("maxTxAttempts") ? par("maxTxAttempts") : 2;
EV_DETAIL << "headerLength: " << headerLength << ", bitrate: " << bitrate << endl;
nbTxDataPackets = 0;
nbTxPreambles = 0;
nbRxDataPackets = 0;
nbRxPreambles = 0;
nbMissedAcks = 0;
nbRecvdAcks = 0;
nbDroppedDataPackets = 0;
nbTxAcks = 0;
txAttempts = 0;
lastDataPktDestAddr = MACAddress::BROADCAST_ADDRESS;
lastDataPktSrcAddr = MACAddress::BROADCAST_ADDRESS;
macState = INIT;
initializeMACAddress();
registerInterface();
cModule *radioModule = getModuleFromPar<cModule>(par("radioModule"), this);
radioModule->subscribe(IRadio::radioModeChangedSignal, this);
radioModule->subscribe(IRadio::transmissionStateChangedSignal, this);
radio = check_and_cast<IRadio *>(radioModule);
// init the dropped packet info
WATCH(macState);
}
else if (stage == INITSTAGE_LINK_LAYER) {
wakeup = new cMessage("wakeup");
wakeup->setKind(BMAC_WAKE_UP);
data_timeout = new cMessage("data_timeout");
data_timeout->setKind(BMAC_DATA_TIMEOUT);
data_timeout->setSchedulingPriority(100);
data_tx_over = new cMessage("data_tx_over");
data_tx_over->setKind(BMAC_DATA_TX_OVER);
stop_preambles = new cMessage("stop_preambles");
stop_preambles->setKind(BMAC_STOP_PREAMBLES);
send_preamble = new cMessage("send_preamble");
send_preamble->setKind(BMAC_SEND_PREAMBLE);
ack_tx_over = new cMessage("ack_tx_over");
ack_tx_over->setKind(BMAC_ACK_TX_OVER);
cca_timeout = new cMessage("cca_timeout");
cca_timeout->setKind(BMAC_CCA_TIMEOUT);
cca_timeout->setSchedulingPriority(100);
send_ack = new cMessage("send_ack");
send_ack->setKind(BMAC_SEND_ACK);
start_bmac = new cMessage("start_bmac");
start_bmac->setKind(BMAC_START_BMAC);
ack_timeout = new cMessage("ack_timeout");
ack_timeout->setKind(BMAC_ACK_TIMEOUT);
resend_data = new cMessage("resend_data");
resend_data->setKind(BMAC_RESEND_DATA);
resend_data->setSchedulingPriority(100);
scheduleAt(0.0, start_bmac);
}
}
BMacLayer::~BMacLayer()
{
cancelAndDelete(wakeup);
cancelAndDelete(data_timeout);
cancelAndDelete(data_tx_over);
cancelAndDelete(stop_preambles);
cancelAndDelete(send_preamble);
cancelAndDelete(ack_tx_over);
cancelAndDelete(cca_timeout);
cancelAndDelete(send_ack);
cancelAndDelete(start_bmac);
cancelAndDelete(ack_timeout);
cancelAndDelete(resend_data);
for (auto & elem : macQueue) {
delete (elem);
}
macQueue.clear();
}
void BMacLayer::finish()
{
recordScalar("nbTxDataPackets", nbTxDataPackets);
recordScalar("nbTxPreambles", nbTxPreambles);
recordScalar("nbRxDataPackets", nbRxDataPackets);
recordScalar("nbRxPreambles", nbRxPreambles);
recordScalar("nbMissedAcks", nbMissedAcks);
recordScalar("nbRecvdAcks", nbRecvdAcks);
recordScalar("nbTxAcks", nbTxAcks);
recordScalar("nbDroppedDataPackets", nbDroppedDataPackets);
//recordScalar("timeSleep", timeSleep);
//recordScalar("timeRX", timeRX);
//recordScalar("timeTX", timeTX);
}
void BMacLayer::initializeMACAddress()
{
const char *addrstr = par("address");
if (!strcmp(addrstr, "auto")) {
// assign automatic address
address = MACAddress::generateAutoAddress();
// change module parameter from "auto" to concrete address
par("address").setStringValue(address.str().c_str());
}
else {
address.setAddress(addrstr);
}
}
InterfaceEntry *BMacLayer::createInterfaceEntry()
{
InterfaceEntry *e = new InterfaceEntry(this);
// data rate
e->setDatarate(bitrate);
// generate a link-layer address to be used as interface token for IPv6
e->setMACAddress(address);
e->setInterfaceToken(address.formInterfaceIdentifier());
// capabilities
e->setMtu(par("mtu").longValue());
e->setMulticast(false);
e->setBroadcast(true);
return e;
}
/**
* Check whether the queue is not full: if yes, print a warning and drop the
* packet. Then initiate sending of the packet, if the node is sleeping. Do
* nothing, if node is working.
*/
void BMacLayer::handleUpperPacket(cPacket *msg)
{
bool pktAdded = addToQueue(msg);
if (!pktAdded)
return;
// force wakeup now
if (wakeup->isScheduled() && (macState == SLEEP)) {
cancelEvent(wakeup);
scheduleAt(simTime() + dblrand() * 0.1f, wakeup);
}
}
/**
* Send one short preamble packet immediately.
*/
void BMacLayer::sendPreamble()
{
BMacFrame *preamble = new BMacFrame();
preamble->setSrcAddr(address);
preamble->setDestAddr(MACAddress::BROADCAST_ADDRESS);
preamble->setKind(BMAC_PREAMBLE);
preamble->setBitLength(headerLength);
//attach signal and send down
attachSignal(preamble);
sendDown(preamble);
nbTxPreambles++;
}
/**
* Send one short preamble packet immediately.
*/
void BMacLayer::sendMacAck()
{
BMacFrame *ack = new BMacFrame();
ack->setSrcAddr(address);
ack->setDestAddr(lastDataPktSrcAddr);
ack->setKind(BMAC_ACK);
ack->setBitLength(headerLength);
//attach signal and send down
attachSignal(ack);
sendDown(ack);
nbTxAcks++;
//endSimulation();
}
/**
* Handle own messages:
* BMAC_WAKEUP: wake up the node, check the channel for some time.
* BMAC_CHECK_CHANNEL: if the channel is free, check whether there is something
* in the queue and switch the radio to TX. When switched to TX, the node will
* start sending preambles for a full slot duration. If the channel is busy,
* stay awake to receive message. Schedule a timeout to handle false alarms.
* BMAC_SEND_PREAMBLES: sending of preambles over. Next time the data packet
* will be send out (single one).
* BMAC_TIMEOUT_DATA: timeout the node after a false busy channel alarm. Go
* back to sleep.
*/
void BMacLayer::handleSelfMessage(cMessage *msg)
{
switch (macState) {
case INIT:
if (msg->getKind() == BMAC_START_BMAC) {
EV_DETAIL << "State INIT, message BMAC_START, new state SLEEP" << endl;
changeDisplayColor(BLACK);
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
macState = SLEEP;
scheduleAt(simTime() + dblrand() * slotDuration, wakeup);
return;
}
break;
case SLEEP:
if (msg->getKind() == BMAC_WAKE_UP) {
EV_DETAIL << "State SLEEP, message BMAC_WAKEUP, new state CCA" << endl;
scheduleAt(simTime() + checkInterval, cca_timeout);
radio->setRadioMode(IRadio::RADIO_MODE_RECEIVER);
changeDisplayColor(GREEN);
macState = CCA;
return;
}
break;
case CCA:
if (msg->getKind() == BMAC_CCA_TIMEOUT) {
// channel is clear
// something waiting in eth queue?
if (macQueue.size() > 0) {
EV_DETAIL << "State CCA, message CCA_TIMEOUT, new state"
" SEND_PREAMBLE" << endl;
macState = SEND_PREAMBLE;
radio->setRadioMode(IRadio::RADIO_MODE_TRANSMITTER);
changeDisplayColor(YELLOW);
scheduleAt(simTime() + slotDuration, stop_preambles);
return;
}
// if not, go back to sleep and wake up after a full period
else {
EV_DETAIL << "State CCA, message CCA_TIMEOUT, new state SLEEP"
<< endl;
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
return;
}
}
// during CCA, we received a preamble. Go to state WAIT_DATA and
// schedule the timeout.
if (msg->getKind() == BMAC_PREAMBLE) {
nbRxPreambles++;
EV_DETAIL << "State CCA, message BMAC_PREAMBLE received, new state"
" WAIT_DATA" << endl;
macState = WAIT_DATA;
cancelEvent(cca_timeout);
scheduleAt(simTime() + slotDuration + checkInterval, data_timeout);
delete msg;
return;
}
// this case is very, very, very improbable, but let's do it.
// if in CCA and the node receives directly the data packet, switch to
// state WAIT_DATA and re-send the message
if (msg->getKind() == BMAC_DATA) {
nbRxDataPackets++;
EV_DETAIL << "State CCA, message BMAC_DATA, new state WAIT_DATA"
<< endl;
macState = WAIT_DATA;
cancelEvent(cca_timeout);
scheduleAt(simTime() + slotDuration + checkInterval, data_timeout);
scheduleAt(simTime(), msg);
return;
}
//in case we get an ACK, we simply dicard it, because it means the end
//of another communication
if (msg->getKind() == BMAC_ACK) {
EV_DETAIL << "State CCA, message BMAC_ACK, new state CCA" << endl;
delete msg;
return;
}
break;
case SEND_PREAMBLE:
if (msg->getKind() == BMAC_SEND_PREAMBLE) {
EV_DETAIL << "State SEND_PREAMBLE, message BMAC_SEND_PREAMBLE, new"
" state SEND_PREAMBLE" << endl;
sendPreamble();
scheduleAt(simTime() + 0.5f * checkInterval, send_preamble);
macState = SEND_PREAMBLE;
return;
}
// simply change the state to SEND_DATA
if (msg->getKind() == BMAC_STOP_PREAMBLES) {
EV_DETAIL << "State SEND_PREAMBLE, message BMAC_STOP_PREAMBLES, new"
" state SEND_DATA" << endl;
macState = SEND_DATA;
txAttempts = 1;
return;
}
break;
case SEND_DATA:
if ((msg->getKind() == BMAC_SEND_PREAMBLE)
|| (msg->getKind() == BMAC_RESEND_DATA))
{
EV_DETAIL << "State SEND_DATA, message BMAC_SEND_PREAMBLE or"
" BMAC_RESEND_DATA, new state WAIT_TX_DATA_OVER" << endl;
// send the data packet
sendDataPacket();
macState = WAIT_TX_DATA_OVER;
return;
}
break;
case WAIT_TX_DATA_OVER:
if (msg->getKind() == BMAC_DATA_TX_OVER) {
if ((useMacAcks) && !lastDataPktDestAddr.isBroadcast()) {
EV_DETAIL << "State WAIT_TX_DATA_OVER, message BMAC_DATA_TX_OVER,"
" new state WAIT_ACK" << endl;
macState = WAIT_ACK;
radio->setRadioMode(IRadio::RADIO_MODE_RECEIVER);
changeDisplayColor(GREEN);
scheduleAt(simTime() + checkInterval, ack_timeout);
}
else {
EV_DETAIL << "State WAIT_TX_DATA_OVER, message BMAC_DATA_TX_OVER,"
" new state SLEEP" << endl;
delete macQueue.front();
macQueue.pop_front();
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
}
return;
}
break;
case WAIT_ACK:
if (msg->getKind() == BMAC_ACK_TIMEOUT) {
// No ACK received. try again or drop.
if (txAttempts < maxTxAttempts) {
EV_DETAIL << "State WAIT_ACK, message BMAC_ACK_TIMEOUT, new state"
" SEND_DATA" << endl;
txAttempts++;
macState = SEND_PREAMBLE;
scheduleAt(simTime() + slotDuration, stop_preambles);
radio->setRadioMode(IRadio::RADIO_MODE_TRANSMITTER);
changeDisplayColor(YELLOW);
}
else {
EV_DETAIL << "State WAIT_ACK, message BMAC_ACK_TIMEOUT, new state"
" SLEEP" << endl;
//drop the packet
cMessage *mac = macQueue.front();
macQueue.pop_front();
emit(NF_LINK_BREAK, mac);
delete mac;
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
nbMissedAcks++;
}
return;
}
//ignore and other packets
if ((msg->getKind() == BMAC_DATA) || (msg->getKind() == BMAC_PREAMBLE)) {
EV_DETAIL << "State WAIT_ACK, message BMAC_DATA or BMAC_PREMABLE, new"
" state WAIT_ACK" << endl;
delete msg;
return;
}
if (msg->getKind() == BMAC_ACK) {
EV_DETAIL << "State WAIT_ACK, message BMAC_ACK" << endl;
BMacFrame *mac = static_cast<BMacFrame *>(msg);
const MACAddress src = mac->getSrcAddr();
// the right ACK is received..
EV_DETAIL << "We are waiting for ACK from : " << lastDataPktDestAddr
<< ", and ACK came from : " << src << endl;
if (src == lastDataPktDestAddr) {
EV_DETAIL << "New state SLEEP" << endl;
nbRecvdAcks++;
lastDataPktDestAddr = MACAddress::BROADCAST_ADDRESS;
cancelEvent(ack_timeout);
delete macQueue.front();
macQueue.pop_front();
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
lastDataPktDestAddr = MACAddress::BROADCAST_ADDRESS;
}
delete msg;
return;
}
break;
case WAIT_DATA:
if (msg->getKind() == BMAC_PREAMBLE) {
//nothing happens
EV_DETAIL << "State WAIT_DATA, message BMAC_PREAMBLE, new state"
" WAIT_DATA" << endl;
nbRxPreambles++;
delete msg;
return;
}
if (msg->getKind() == BMAC_ACK) {
//nothing happens
EV_DETAIL << "State WAIT_DATA, message BMAC_ACK, new state WAIT_DATA"
<< endl;
delete msg;
return;
}
if (msg->getKind() == BMAC_DATA) {
nbRxDataPackets++;
BMacFrame *mac = static_cast<BMacFrame *>(msg);
const MACAddress& dest = mac->getDestAddr();
const MACAddress& src = mac->getSrcAddr();
if ((dest == address) || dest.isBroadcast()) {
EV_DETAIL << "Local delivery " << mac << endl;
sendUp(decapsMsg(mac));
}
else {
EV_DETAIL << "Received " << mac << " is not for us, dropping frame." << endl;
delete msg;
msg = nullptr;
mac = nullptr;
}
cancelEvent(data_timeout);
if ((useMacAcks) && (dest == address)) {
EV_DETAIL << "State WAIT_DATA, message BMAC_DATA, new state"
" SEND_ACK" << endl;
macState = SEND_ACK;
lastDataPktSrcAddr = src;
radio->setRadioMode(IRadio::RADIO_MODE_TRANSMITTER);
changeDisplayColor(YELLOW);
}
else {
EV_DETAIL << "State WAIT_DATA, message BMAC_DATA, new state SLEEP"
<< endl;
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
}
return;
}
if (msg->getKind() == BMAC_DATA_TIMEOUT) {
EV_DETAIL << "State WAIT_DATA, message BMAC_DATA_TIMEOUT, new state"
" SLEEP" << endl;
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
return;
}
break;
case SEND_ACK:
if (msg->getKind() == BMAC_SEND_ACK) {
EV_DETAIL << "State SEND_ACK, message BMAC_SEND_ACK, new state"
" WAIT_ACK_TX" << endl;
// send now the ack packet
sendMacAck();
macState = WAIT_ACK_TX;
return;
}
break;
case WAIT_ACK_TX:
if (msg->getKind() == BMAC_ACK_TX_OVER) {
EV_DETAIL << "State WAIT_ACK_TX, message BMAC_ACK_TX_OVER, new state"
" SLEEP" << endl;
// ack sent, go to sleep now.
// if something in the queue, wakeup soon.
if (macQueue.size() > 0)
scheduleAt(simTime() + dblrand() * checkInterval, wakeup);
else
scheduleAt(simTime() + slotDuration, wakeup);
macState = SLEEP;
radio->setRadioMode(IRadio::RADIO_MODE_SLEEP);
changeDisplayColor(BLACK);
lastDataPktSrcAddr = MACAddress::BROADCAST_ADDRESS;
return;
}
break;
}
throw cRuntimeError("Undefined event of type %d in state %d (radio mode %d, radio reception state %d, radio transmission state %d)!",
msg->getKind(), macState, radio->getRadioMode(), radio->getReceptionState(), radio->getTransmissionState());
}
/**
* Handle BMAC preambles and received data packets.
*/
void BMacLayer::handleLowerPacket(cPacket *msg)
{
if (msg->hasBitError()) {
EV << "Received " << msg << " contains bit errors or collision, dropping it\n";
delete msg;
return;
}
else
// simply pass the massage as self message, to be processed by the FSM.
handleSelfMessage(msg);
}
void BMacLayer::sendDataPacket()
{
nbTxDataPackets++;
BMacFrame *pkt = macQueue.front()->dup();
attachSignal(pkt);
lastDataPktDestAddr = pkt->getDestAddr();
pkt->setKind(BMAC_DATA);
sendDown(pkt);
}
void BMacLayer::receiveSignal(cComponent *source, simsignal_t signalID, long value DETAILS_ARG)
{
Enter_Method_Silent();
if (signalID == IRadio::radioModeChangedSignal) {
IRadio::RadioMode radioMode = (IRadio::RadioMode)value;
if (radioMode == IRadio::RADIO_MODE_TRANSMITTER) {
// we just switched to TX after CCA, so simply send the first
// sendPremable self message
if (macState == SEND_PREAMBLE)
scheduleAt(simTime(), send_preamble);
else if (macState == SEND_ACK)
scheduleAt(simTime(), send_ack);
// we were waiting for acks, but none came. we switched to TX and now
// need to resend data
else if (macState == SEND_DATA)
scheduleAt(simTime(), resend_data);
}
}
// Transmission of one packet is over
else if (signalID == IRadio::transmissionStateChangedSignal) {
IRadio::TransmissionState newRadioTransmissionState = (IRadio::TransmissionState)value;
if (transmissionState == IRadio::TRANSMISSION_STATE_TRANSMITTING && newRadioTransmissionState == IRadio::TRANSMISSION_STATE_IDLE) {
if (macState == WAIT_TX_DATA_OVER)
scheduleAt(simTime(), data_tx_over);
else if (macState == WAIT_ACK_TX)
scheduleAt(simTime(), ack_tx_over);
}
transmissionState = newRadioTransmissionState;
}
}
/**
* Encapsulates the received network-layer packet into a BMacFrame and set all
* needed header fields.
*/
bool BMacLayer::addToQueue(cMessage *msg)
{
if (macQueue.size() >= queueLength) {
// queue is full, message has to be deleted
EV_DETAIL << "New packet arrived, but queue is FULL, so new packet is"
" deleted\n";
emit(packetFromUpperDroppedSignal, msg);
nbDroppedDataPackets++;
return false;
}
BMacFrame *macPkt = encapsMsg((cPacket *)msg);
macQueue.push_back(macPkt);
EV_DETAIL << "Max queue length: " << queueLength << ", packet put in queue"
"\n queue size: " << macQueue.size() << " macState: "
<< macState << endl;
return true;
}
void BMacLayer::flushQueue()
{
// TODO:
macQueue.clear();
}
void BMacLayer::clearQueue()
{
macQueue.clear();
}
void BMacLayer::attachSignal(BMacFrame *macPkt)
{
//calc signal duration
simtime_t duration = macPkt->getBitLength() / bitrate;
//create and initialize control info with new signal
macPkt->setDuration(duration);
}
/**
* Change the color of the node for animation purposes.
*/
void BMacLayer::changeDisplayColor(BMAC_COLORS color)
{
if (!animation)
return;
cDisplayString& dispStr = findContainingNode(this)->getDisplayString();
//b=40,40,rect,black,black,2"
if (color == GREEN)
dispStr.setTagArg("b", 3, "green");
//dispStr.parse("b=40,40,rect,green,green,2");
if (color == BLUE)
dispStr.setTagArg("b", 3, "blue");
//dispStr.parse("b=40,40,rect,blue,blue,2");
if (color == RED)
dispStr.setTagArg("b", 3, "red");
//dispStr.parse("b=40,40,rect,red,red,2");
if (color == BLACK)
dispStr.setTagArg("b", 3, "black");
//dispStr.parse("b=40,40,rect,black,black,2");
if (color == YELLOW)
dispStr.setTagArg("b", 3, "yellow");
//dispStr.parse("b=40,40,rect,yellow,yellow,2");
}
/*void BMacLayer::changeMacState(States newState)
{
switch (macState)
{
case RX:
timeRX += (simTime() - lastTime);
break;
case TX:
timeTX += (simTime() - lastTime);
break;
case SLEEP:
timeSleep += (simTime() - lastTime);
break;
case CCA:
timeRX += (simTime() - lastTime);
}
lastTime = simTime();
switch (newState)
{
case CCA:
changeDisplayColor(GREEN);
break;
case TX:
changeDisplayColor(BLUE);
break;
case SLEEP:
changeDisplayColor(BLACK);
break;
case RX:
changeDisplayColor(YELLOW);
break;
}
macState = newState;
}*/
cPacket *BMacLayer::decapsMsg(BMacFrame *msg)
{
cPacket *m = msg->decapsulate();
setUpControlInfo(m, msg->getSrcAddr());
// delete the macPkt
delete msg;
EV_DETAIL << " message decapsulated " << endl;
return m;
}
BMacFrame *BMacLayer::encapsMsg(cPacket *netwPkt)
{
BMacFrame *pkt = new BMacFrame(netwPkt->getName(), netwPkt->getKind());
pkt->setBitLength(headerLength);
// copy dest address from the Control Info attached to the network
// message by the network layer
IMACProtocolControlInfo *cInfo = check_and_cast<IMACProtocolControlInfo *>(netwPkt->removeControlInfo());
EV_DETAIL << "CInfo removed, mac addr=" << cInfo->getDestinationAddress() << endl;
pkt->setDestAddr(cInfo->getDestinationAddress());
//delete the control info
delete cInfo;
//set the src address to own mac address (nic module getId())
pkt->setSrcAddr(address);
//encapsulate the network packet
pkt->encapsulate(netwPkt);
EV_DETAIL << "pkt encapsulated\n";
return pkt;
}
/**
* Attaches a "control info" (MacToNetw) structure (object) to the message pMsg.
*/
cObject *BMacLayer::setUpControlInfo(cMessage *const pMsg, const MACAddress& pSrcAddr)
{
SimpleLinkLayerControlInfo *const cCtrlInfo = new SimpleLinkLayerControlInfo();
cCtrlInfo->setSrc(pSrcAddr);
cCtrlInfo->setInterfaceId(interfaceEntry->getInterfaceId());
pMsg->setControlInfo(cCtrlInfo);
return cCtrlInfo;
}
} // namespace inet
| 36.519531 | 139 | 0.563162 | StarStuffSteve |
02d31868361dd0c9f4989a93a35b15ca4e87301c | 1,705 | cpp | C++ | console/src/boost_1_78_0/libs/utility/test/operators_constexpr_test.cpp | vany152/FilesHash | 39f282807b7f1abc56dac389e8259ee3bb557a8d | [
"MIT"
] | 106 | 2015-08-07T04:23:50.000Z | 2020-12-27T18:25:15.000Z | console/src/boost_1_78_0/libs/utility/test/operators_constexpr_test.cpp | vany152/FilesHash | 39f282807b7f1abc56dac389e8259ee3bb557a8d | [
"MIT"
] | 130 | 2016-06-22T22:11:25.000Z | 2020-11-29T20:24:09.000Z | Libs/boost_1_76_0/libs/utility/test/operators_constexpr_test.cpp | Antd23rus/S2DE | 47cc7151c2934cd8f0399a9856c1e54894571553 | [
"MIT"
] | 41 | 2015-07-08T19:18:35.000Z | 2021-01-14T16:39:56.000Z | /*
Copyright 2020 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_CONSTEXPR) && \
(!defined(BOOST_MSVC) || (BOOST_MSVC >= 1922))
#include <boost/operators.hpp>
#include <boost/static_assert.hpp>
namespace {
class Value
: boost::operators<Value> {
public:
BOOST_OPERATORS_CONSTEXPR explicit Value(int v)
: v_(v) { }
BOOST_OPERATORS_CONSTEXPR bool
operator<(const Value& x) const {
return v_ < x.v_;
}
BOOST_OPERATORS_CONSTEXPR bool
operator==(const Value& x) const {
return v_ == x.v_;
}
private:
int v_;
};
} // namespace
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) == Value(2)));
BOOST_STATIC_ASSERT(Value(1) != Value(2));
BOOST_STATIC_ASSERT(Value(1) < Value(2));
BOOST_STATIC_ASSERT(Value(1) <= Value(2));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) > Value(2)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) >= Value(2)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) == Value(1)));
BOOST_STATIC_ASSERT(Value(2) != Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) < Value(1)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) <= Value(1)));
BOOST_STATIC_ASSERT(Value(2) > Value(1));
BOOST_STATIC_ASSERT(Value(2) >= Value(1));
BOOST_STATIC_ASSERT(Value(1) == Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) != Value(1)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) < Value(1)));
BOOST_STATIC_ASSERT(Value(1) <= Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) > Value(1)));
BOOST_STATIC_ASSERT(Value(1) >= Value(1));
#endif
| 28.416667 | 62 | 0.702639 | vany152 |
02d405e120039570fa69a9d5976388c2d4f8c6c0 | 839 | hpp | C++ | libs/fnd/tuple/include/bksge/fnd/tuple/tuple_sort_type.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 4 | 2018-06-10T13:35:32.000Z | 2021-06-03T14:27:41.000Z | libs/fnd/tuple/include/bksge/fnd/tuple/tuple_sort_type.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 566 | 2017-01-31T05:36:09.000Z | 2022-02-09T05:04:37.000Z | libs/fnd/tuple/include/bksge/fnd/tuple/tuple_sort_type.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 1 | 2018-07-05T04:40:53.000Z | 2018-07-05T04:40:53.000Z | /**
* @file tuple_sort_type.hpp
*
* @brief tuple_sort_type の定義
*
* @author myoukaku
*/
#ifndef BKSGE_FND_TUPLE_TUPLE_SORT_TYPE_HPP
#define BKSGE_FND_TUPLE_TUPLE_SORT_TYPE_HPP
#include <bksge/fnd/tuple/fwd/tuple_sort_type_fwd.hpp>
#include <bksge/fnd/type_traits/bool_constant.hpp>
namespace bksge
{
/**
* @brief Tupleの要素をCompareに従って並べ替えたTuple型を取得する
*
* Compareを指定しなかったときは、
* Tupleの各要素をTとすると、T::valueが昇順になるように並べ替える。
*/
template <typename Tuple, typename Compare>
struct tuple_sort_type;
/**
* @brief tuple_sort_type でデフォルトで使われる比較演算
*/
struct value_less
{
template <typename T1, typename T2>
using type = bksge::bool_constant<(T1::value < T2::value)>;
};
} // namespace bksge
#include <bksge/fnd/tuple/inl/tuple_sort_type_inl.hpp>
#endif // BKSGE_FND_TUPLE_TUPLE_SORT_TYPE_HPP
| 20.463415 | 61 | 0.72944 | myoukaku |
02d6224b81e8b04d4ebb04c1be415b210f277c0a | 363 | cpp | C++ | DBusTest/main.cpp | tomoyuki-nakabayashi/MyQtSamples | 2bb2d74b989bd3895338a9d3740c26d813e76b74 | [
"MIT"
] | null | null | null | DBusTest/main.cpp | tomoyuki-nakabayashi/MyQtSamples | 2bb2d74b989bd3895338a9d3740c26d813e76b74 | [
"MIT"
] | 5 | 2018-03-31T11:54:59.000Z | 2018-10-14T10:32:15.000Z | DBusTest/main.cpp | tomoyuki-nakabayashi/MyQtSamples | 2bb2d74b989bd3895338a9d3740c26d813e76b74 | [
"MIT"
] | null | null | null | /**
* Copyright <2017> <Tomoyuki Nakabayashi>
* This software is released under the MIT License, see LICENSE.
*/
#include <gtest/gtest.h>
#include <QCoreApplication>
#include "global_args.h"
int g_argc;
char **g_argv;
int main(int argc, char *argv[])
{
g_argc = argc;
g_argv = argv;
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 18.15 | 64 | 0.69146 | tomoyuki-nakabayashi |
02d7f248a3a5cb7a7b1b32564d7a828421783999 | 5,757 | cpp | C++ | frameworks/compile/mclinker/lib/Support/LEB128.cpp | touxiong88/92_mediatek | 5e96a7bb778fd9d9b335825584664e0c8b5ff2c7 | [
"Apache-2.0"
] | 1 | 2022-01-07T01:53:19.000Z | 2022-01-07T01:53:19.000Z | frameworks/compile/mclinker/lib/Support/LEB128.cpp | touxiong88/92_mediatek | 5e96a7bb778fd9d9b335825584664e0c8b5ff2c7 | [
"Apache-2.0"
] | null | null | null | frameworks/compile/mclinker/lib/Support/LEB128.cpp | touxiong88/92_mediatek | 5e96a7bb778fd9d9b335825584664e0c8b5ff2c7 | [
"Apache-2.0"
] | 1 | 2020-02-28T02:48:42.000Z | 2020-02-28T02:48:42.000Z | //===- LEB128.cpp ---------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <mcld/Support/LEB128.h>
namespace mcld {
namespace leb128 {
//===---------------------- LEB128 Encoding APIs -------------------------===//
template<>
size_t encode<uint64_t>(ByteType *&pBuf, uint64_t pValue) {
size_t size = 0;
do {
ByteType byte = pValue & 0x7f;
pValue >>= 7;
if (pValue)
byte |= 0x80;
*pBuf++ = byte;
size++;
} while (pValue);
return size;
}
/*
* Fast version for encoding 32-bit integer. This unrolls the loop in the
* generic version defined above.
*/
template<>
size_t encode<uint32_t>(ByteType *&pBuf, uint32_t pValue) {
if ((pValue & ~0x7f) == 0) {
*pBuf++ = static_cast<ByteType>(pValue);
return 1;
} else if ((pValue & ~0x3fff) == 0){
*pBuf++ = static_cast<ByteType>((pValue & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>((pValue >> 7) & 0x7f);
return 2;
} else if ((pValue & ~0x1fffff) == 0) {
*pBuf++ = static_cast<ByteType>((pValue & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 7) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>((pValue >> 14) & 0x7f);
return 3;
} else if ((pValue & ~0xfffffff) == 0) {
*pBuf++ = static_cast<ByteType>((pValue & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 7) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 14) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>((pValue >> 21) & 0x7f);
return 4;
} else {
*pBuf++ = static_cast<ByteType>((pValue & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 7) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 14) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>(((pValue >> 21) & 0x7f) | 0x80);
*pBuf++ = static_cast<ByteType>((pValue >> 28) & 0x7f);
return 5;
}
// unreachable
}
template<>
size_t encode<int64_t>(ByteType *&pBuf, int64_t pValue) {
size_t size = 0;
bool more = true;
do {
ByteType byte = pValue & 0x7f;
pValue >>= 7;
if (((pValue == 0) && ((byte & 0x40) == 0)) ||
((pValue == -1) && ((byte & 0x40) == 0x40)))
more = false;
else
byte |= 0x80;
*pBuf++ = byte;
size++;
} while (more);
return size;
}
template<>
size_t encode<int32_t>(ByteType *&pBuf, int32_t pValue) {
return encode<int64_t>(pBuf, static_cast<int64_t>(pValue));
}
//===---------------------- LEB128 Decoding APIs -------------------------===//
template<>
uint64_t decode<uint64_t>(const ByteType *pBuf, size_t &pSize) {
uint64_t result = 0;
if ((*pBuf & 0x80) == 0) {
pSize = 1;
return *pBuf;
} else if ((*(pBuf + 1) & 0x80) == 0) {
pSize = 2;
return ((*(pBuf + 1) & 0x7f) << 7) |
(*pBuf & 0x7f);
} else if ((*(pBuf + 2) & 0x80) == 0) {
pSize = 3;
return ((*(pBuf + 2) & 0x7f) << 14) |
((*(pBuf + 1) & 0x7f) << 7) |
(*pBuf & 0x7f);
} else {
pSize = 4;
result = ((*(pBuf + 3) & 0x7f) << 21) |
((*(pBuf + 2) & 0x7f) << 14) |
((*(pBuf + 1) & 0x7f) << 7) |
(*pBuf & 0x7f);
}
if ((*(pBuf + 3) & 0x80) != 0) {
// Large number which is an unusual case.
unsigned shift;
ByteType byte;
// Start the read from the 4th byte.
shift = 28;
pBuf += 4;
do {
byte = *pBuf;
pBuf++;
pSize++;
result |= (static_cast<uint64_t>(byte & 0x7f) << shift);
shift += 7;
} while (byte & 0x80);
}
return result;
}
template<>
uint64_t decode<uint64_t>(const ByteType *&pBuf) {
ByteType byte;
uint64_t result;
byte = *pBuf++;
result = byte & 0x7f;
if ((byte & 0x80) == 0) {
return result;
} else {
byte = *pBuf++;
result |= ((byte & 0x7f) << 7);
if ((byte & 0x80) == 0) {
return result;
} else {
byte = *pBuf++;
result |= (byte & 0x7f) << 14;
if ((byte & 0x80) == 0) {
return result;
} else {
byte = *pBuf++;
result |= (byte & 0x7f) << 21;
if ((byte & 0x80) == 0) {
return result;
}
}
}
}
// Large number which is an unusual case.
unsigned shift;
// Start the read from the 4th byte.
shift = 28;
do {
byte = *pBuf++;
result |= (static_cast<uint64_t>(byte & 0x7f) << shift);
shift += 7;
} while (byte & 0x80);
return result;
}
/*
* Signed LEB128 decoding is Similar to the unsigned version but setup the sign
* bit if necessary. This is rarely used, therefore we don't provide unrolling
* version like decode() to save the code size.
*/
template<>
int64_t decode<int64_t>(const ByteType *pBuf, size_t &pSize) {
uint64_t result = 0;
ByteType byte;
unsigned shift = 0;
pSize = 0;
do {
byte = *pBuf;
pBuf++;
pSize++;
result |= (static_cast<uint64_t>(byte & 0x7f) << shift);
shift += 7;
} while (byte & 0x80);
if ((shift < (8 * sizeof(result))) && (byte & 0x40))
result |= ((static_cast<uint64_t>(-1)) << shift);
return result;
}
template<>
int64_t decode<int64_t>(const ByteType *&pBuf) {
uint64_t result = 0;
ByteType byte;
unsigned shift = 0;
do {
byte = *pBuf;
pBuf++;
result |= (static_cast<uint64_t>(byte & 0x7f) << shift);
shift += 7;
} while (byte & 0x80);
if ((shift < (8 * sizeof(result))) && (byte & 0x40))
result |= ((static_cast<uint64_t>(-1)) << shift);
return result;
}
} // namespace of leb128
} // namespace of mcld
| 25.139738 | 80 | 0.521278 | touxiong88 |
02db2d20c68010573dd0c6b7d4ec63c9c7df75c2 | 135 | hxx | C++ | src/Providers/UNIXProviders/CertificateAuthority/UNIX_CertificateAuthority_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | 1 | 2020-10-12T09:00:09.000Z | 2020-10-12T09:00:09.000Z | src/Providers/UNIXProviders/CertificateAuthority/UNIX_CertificateAuthority_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | null | null | null | src/Providers/UNIXProviders/CertificateAuthority/UNIX_CertificateAuthority_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | null | null | null | #ifdef PEGASUS_OS_HPUX
#ifndef __UNIX_CERTIFICATEAUTHORITY_PRIVATE_H
#define __UNIX_CERTIFICATEAUTHORITY_PRIVATE_H
#endif
#endif
| 11.25 | 45 | 0.859259 | brunolauze |
02dc2055b349786bb8ad10b4a80f7ab9db515591 | 1,528 | cpp | C++ | firmware/src/LUTFunction.cpp | BrianBalke/bldc-controller | 0288769a21869b079a17aa79d8df6618bfc3d43a | [
"MIT"
] | 14 | 2019-04-10T07:42:13.000Z | 2019-12-11T08:58:39.000Z | firmware/src/LUTFunction.cpp | BrianBalke/bldc-controller | 0288769a21869b079a17aa79d8df6618bfc3d43a | [
"MIT"
] | 8 | 2020-07-24T06:51:55.000Z | 2021-05-24T04:24:32.000Z | firmware/src/LUTFunction.cpp | BrianBalke/bldc-controller | 0288769a21869b079a17aa79d8df6618bfc3d43a | [
"MIT"
] | 16 | 2020-03-06T20:21:56.000Z | 2022-03-22T16:59:14.000Z | #include "LUTFunction.hpp"
#include <stdint.h>
#include <cmath>
namespace motor_driver {
namespace math {
template <typename T> float LUTFunction<T>::lookup(float arg) const {
float norm_arg = (arg - x_first_) / (x_last_ - x_first_);
float norm_arg_integral = std::floor(norm_arg);
float norm_arg_fraction = norm_arg - norm_arg_integral;
size_t flip_index =
(static_cast<int>(norm_arg_integral) % periodicity_.repetition_count +
periodicity_.repetition_count) %
periodicity_.repetition_count;
switch (periodicity_.repetition_flips[flip_index]) {
case LFFlipType::NONE:
default:
return lookupReduced(norm_arg_fraction);
case LFFlipType::HORIZONTAL:
return lookupReduced(1.0f - norm_arg_fraction);
case LFFlipType::VERTICAL:
return -lookupReduced(norm_arg_fraction);
case LFFlipType::BOTH:
return -lookupReduced(1.0f - norm_arg_fraction);
}
}
template <typename T>
float LUTFunction<T>::lookupReduced(float reduced_arg) const {
if (reduced_arg <= 0.0f) {
return y_[0];
} else if (reduced_arg >= 1.0f) {
return y_[y_len_ - 1];
} else {
float integral = std::floor(reduced_arg * (y_len_ - 1));
float fraction = reduced_arg * (y_len_ - 1) - integral;
size_t index_before = (size_t)integral;
// Linear interpolation.
return (y_[index_before] * (1.0f - fraction) +
y_[index_before + 1] * fraction);
}
}
template class LUTFunction<float>;
template class LUTFunction<int8_t>;
} // namespace math
} // namespace motor_driver
| 28.830189 | 76 | 0.706806 | BrianBalke |
02dcf646b7728ef3218663f118d5154625f77059 | 53,615 | cc | C++ | third_party/blink/renderer/modules/manifest/manifest_parser.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-11-16T13:10:29.000Z | 2021-11-16T13:10:29.000Z | third_party/blink/renderer/modules/manifest/manifest_parser.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | third_party/blink/renderer/modules/manifest/manifest_parser.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/manifest/manifest_parser.h"
#include <string>
#include "base/feature_list.h"
#include "base/strings/stringprintf.h"
#include "net/base/mime_util.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/manifest/manifest_util.h"
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
#include "third_party/blink/public/platform/web_icon_sizes_parser.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/core/css/parser/css_parser.h"
#include "third_party/blink/renderer/modules/manifest/manifest_uma_util.h"
#include "third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.h"
#include "third_party/blink/renderer/platform/json/json_parser.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "url/url_constants.h"
#include "url/url_util.h"
namespace blink {
namespace {
static constexpr char kUrlHandlerWildcardPrefix[] = "%2A.";
// Keep in sync with web_app_origin_association_task.cc.
static wtf_size_t kMaxUrlHandlersSize = 10;
static wtf_size_t kMaxOriginLength = 2000;
bool IsValidMimeType(const String& mime_type) {
if (mime_type.StartsWith('.'))
return true;
return net::ParseMimeTypeWithoutParameter(mime_type.Utf8(), nullptr, nullptr);
}
bool VerifyFiles(const Vector<mojom::blink::ManifestFileFilterPtr>& files) {
for (const auto& file : files) {
for (const auto& accept_type : file->accept) {
if (!IsValidMimeType(accept_type.LowerASCII()))
return false;
}
}
return true;
}
// Determines whether |url| is within scope of |scope|.
bool URLIsWithinScope(const KURL& url, const KURL& scope) {
return SecurityOrigin::AreSameOrigin(url, scope) &&
url.GetPath().StartsWith(scope.GetPath());
}
// This function should be kept in sync with IsHostValidForUrlHandler in
// manifest_mojom_traits.cc.
bool IsHostValidForUrlHandler(String host) {
if (url::HostIsIPAddress(host.Utf8()))
return true;
const size_t registry_length =
net::registry_controlled_domains::PermissiveGetHostRegistryLength(
host.Utf8(),
// Reject unknown registries (registries that don't have any matches
// in effective TLD names).
net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
// Skip matching private registries that allow external users to
// specify sub-domains, e.g. glitch.me, as this is allowed.
net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
// Host cannot be a TLD or invalid.
if (registry_length == 0 || registry_length == std::string::npos ||
registry_length >= host.length()) {
return false;
}
return true;
}
static bool IsCrLfOrTabChar(UChar c) {
return c == '\n' || c == '\r' || c == '\t';
}
} // anonymous namespace
ManifestParser::ManifestParser(const String& data,
const KURL& manifest_url,
const KURL& document_url,
const FeatureContext* feature_context)
: data_(data),
manifest_url_(manifest_url),
document_url_(document_url),
feature_context_(feature_context),
failed_(false) {}
ManifestParser::~ManifestParser() {}
bool ManifestParser::Parse() {
JSONParseError error;
bool has_comments = false;
std::unique_ptr<JSONValue> root = ParseJSON(data_, &error, &has_comments);
manifest_ = mojom::blink::Manifest::New();
if (!root) {
AddErrorInfo(error.message, true, error.line, error.column);
ManifestUmaUtil::ParseFailed();
failed_ = true;
return false;
}
std::unique_ptr<JSONObject> root_object = JSONObject::From(std::move(root));
if (!root_object) {
AddErrorInfo("root element must be a valid JSON object.", true);
ManifestUmaUtil::ParseFailed();
failed_ = true;
return false;
}
manifest_->name = ParseName(root_object.get());
manifest_->short_name = ParseShortName(root_object.get());
manifest_->description = ParseDescription(root_object.get());
manifest_->start_url = ParseStartURL(root_object.get());
manifest_->id = ParseId(root_object.get(), manifest_->start_url);
manifest_->scope = ParseScope(root_object.get(), manifest_->start_url);
manifest_->display = ParseDisplay(root_object.get());
manifest_->display_override = ParseDisplayOverride(root_object.get());
manifest_->orientation = ParseOrientation(root_object.get());
manifest_->icons = ParseIcons(root_object.get());
manifest_->screenshots = ParseScreenshots(root_object.get());
auto share_target = ParseShareTarget(root_object.get());
if (share_target.has_value())
manifest_->share_target = std::move(*share_target);
manifest_->file_handlers = ParseFileHandlers(root_object.get());
manifest_->protocol_handlers = ParseProtocolHandlers(root_object.get());
manifest_->url_handlers = ParseUrlHandlers(root_object.get());
manifest_->note_taking = ParseNoteTaking(root_object.get());
manifest_->related_applications = ParseRelatedApplications(root_object.get());
manifest_->prefer_related_applications =
ParsePreferRelatedApplications(root_object.get());
absl::optional<RGBA32> theme_color = ParseThemeColor(root_object.get());
manifest_->has_theme_color = theme_color.has_value();
if (manifest_->has_theme_color)
manifest_->theme_color = *theme_color;
absl::optional<RGBA32> background_color =
ParseBackgroundColor(root_object.get());
manifest_->has_background_color = background_color.has_value();
if (manifest_->has_background_color)
manifest_->background_color = *background_color;
manifest_->gcm_sender_id = ParseGCMSenderID(root_object.get());
manifest_->shortcuts = ParseShortcuts(root_object.get());
manifest_->capture_links = ParseCaptureLinks(root_object.get());
if (base::FeatureList::IsEnabled(
blink::features::kWebAppEnableIsolatedStorage)) {
manifest_->isolated_storage = ParseIsolatedStorage(root_object.get());
}
manifest_->launch_handler = ParseLaunchHandler(root_object.get());
if (RuntimeEnabledFeatures::WebAppTranslationsEnabled(feature_context_)) {
manifest_->translations = ParseTranslations(root_object.get());
}
ManifestUmaUtil::ParseSucceeded(manifest_);
return has_comments;
}
const mojom::blink::ManifestPtr& ManifestParser::manifest() const {
return manifest_;
}
void ManifestParser::TakeErrors(
Vector<mojom::blink::ManifestErrorPtr>* errors) {
errors->clear();
errors->swap(errors_);
}
bool ManifestParser::failed() const {
return failed_;
}
bool ManifestParser::ParseBoolean(const JSONObject* object,
const String& key,
bool default_value) {
JSONValue* json_value = object->Get(key);
if (!json_value)
return default_value;
bool value;
if (!json_value->AsBoolean(&value)) {
AddErrorInfo("property '" + key + "' ignored, type " + "boolean expected.");
return default_value;
}
return value;
}
absl::optional<String> ManifestParser::ParseString(const JSONObject* object,
const String& key,
TrimType trim) {
JSONValue* json_value = object->Get(key);
if (!json_value)
return absl::nullopt;
String value;
if (!json_value->AsString(&value) || value.IsNull()) {
AddErrorInfo("property '" + key + "' ignored, type " + "string expected.");
return absl::nullopt;
}
if (trim == Trim)
value = value.StripWhiteSpace();
return value;
}
absl::optional<String> ManifestParser::ParseStringForMember(
const JSONObject* object,
const String& member_name,
const String& key,
bool required,
TrimType trim) {
JSONValue* json_value = object->Get(key);
if (!json_value) {
if (required) {
AddErrorInfo("property '" + key + "' of '" + member_name +
"' not present.");
}
return absl::nullopt;
}
String value;
if (!json_value->AsString(&value)) {
AddErrorInfo("property '" + key + "' of '" + member_name +
"' ignored, type string expected.");
return absl::nullopt;
}
if (trim == TrimType::Trim)
value = value.StripWhiteSpace();
if (value == "") {
AddErrorInfo("property '" + key + "' of '" + member_name +
"' is an empty string.");
if (required)
return absl::nullopt;
}
return value;
}
absl::optional<RGBA32> ManifestParser::ParseColor(const JSONObject* object,
const String& key) {
absl::optional<String> parsed_color = ParseString(object, key, Trim);
if (!parsed_color.has_value())
return absl::nullopt;
Color color;
if (!CSSParser::ParseColor(color, *parsed_color, true)) {
AddErrorInfo("property '" + key + "' ignored, '" + *parsed_color +
"' is not a " + "valid color.");
return absl::nullopt;
}
return color.Rgb();
}
KURL ManifestParser::ParseURL(const JSONObject* object,
const String& key,
const KURL& base_url,
ParseURLRestrictions origin_restriction,
bool ignore_empty_string) {
absl::optional<String> url_str = ParseString(object, key, NoTrim);
if (!url_str.has_value())
return KURL();
if (ignore_empty_string && url_str.value() == "")
return KURL();
KURL resolved = KURL(base_url, *url_str);
if (!resolved.IsValid()) {
AddErrorInfo("property '" + key + "' ignored, URL is invalid.");
return KURL();
}
switch (origin_restriction) {
case ParseURLRestrictions::kNoRestrictions:
return resolved;
case ParseURLRestrictions::kSameOriginOnly:
if (!SecurityOrigin::AreSameOrigin(resolved, document_url_)) {
AddErrorInfo("property '" + key +
"' ignored, should be same origin as document.");
return KURL();
}
return resolved;
case ParseURLRestrictions::kWithinScope:
if (!URLIsWithinScope(resolved, manifest_->scope)) {
AddErrorInfo("property '" + key +
"' ignored, should be within scope of the manifest.");
return KURL();
}
// Within scope implies same origin as document URL.
DCHECK(SecurityOrigin::AreSameOrigin(resolved, document_url_));
return resolved;
}
NOTREACHED();
return KURL();
}
template <typename Enum>
Enum ManifestParser::ParseFirstValidEnum(const JSONObject* object,
const String& key,
Enum (*parse_enum)(const std::string&),
Enum invalid_value) {
const JSONValue* value = object->Get(key);
if (!value)
return invalid_value;
String string_value;
if (value->AsString(&string_value)) {
Enum enum_value = parse_enum(string_value.Utf8());
if (enum_value == invalid_value) {
AddErrorInfo(key + " value '" + string_value +
"' ignored, unknown value.");
}
return enum_value;
}
const JSONArray* list = JSONArray::Cast(value);
if (!list) {
AddErrorInfo("property '" + key +
"' ignored, type string or array of strings expected.");
return invalid_value;
}
for (wtf_size_t i = 0; i < list->size(); ++i) {
const JSONValue* item = list->at(i);
if (!item->AsString(&string_value)) {
AddErrorInfo(key + " value '" + item->ToJSONString() +
"' ignored, string expected.");
continue;
}
Enum enum_value = parse_enum(string_value.Utf8());
if (enum_value != invalid_value)
return enum_value;
AddErrorInfo(key + " value '" + string_value + "' ignored, unknown value.");
}
return invalid_value;
}
String ManifestParser::ParseName(const JSONObject* object) {
absl::optional<String> name = ParseString(object, "name", Trim);
if (name.has_value()) {
name = name->RemoveCharacters(IsCrLfOrTabChar);
if (name->length() == 0)
name = absl::nullopt;
}
return name.has_value() ? *name : String();
}
String ManifestParser::ParseShortName(const JSONObject* object) {
absl::optional<String> short_name = ParseString(object, "short_name", Trim);
if (short_name.has_value()) {
short_name = short_name->RemoveCharacters(IsCrLfOrTabChar);
if (short_name->length() == 0)
short_name = absl::nullopt;
}
return short_name.has_value() ? *short_name : String();
}
String ManifestParser::ParseDescription(const JSONObject* object) {
absl::optional<String> description = ParseString(object, "description", Trim);
return description.has_value() ? *description : String();
}
String ManifestParser::ParseId(const JSONObject* object,
const KURL& start_url) {
if (!base::FeatureList::IsEnabled(blink::features::kWebAppEnableManifestId)) {
ManifestUmaUtil::ParseIdResult(
ManifestUmaUtil::ParseIdResultType::kFeatureDisabled);
return String();
}
if (!start_url.IsValid()) {
ManifestUmaUtil::ParseIdResult(
ManifestUmaUtil::ParseIdResultType::kInvalidStartUrl);
return String();
}
KURL start_url_origin = KURL(SecurityOrigin::Create(start_url)->ToString());
KURL id = ParseURL(object, "id", start_url_origin,
ParseURLRestrictions::kSameOriginOnly,
/*ignore_empty_string=*/true);
if (id.IsValid()) {
ManifestUmaUtil::ParseIdResult(
ManifestUmaUtil::ParseIdResultType::kSucceed);
} else {
// If id is not specified, sets to start_url
ManifestUmaUtil::ParseIdResult(
ManifestUmaUtil::ParseIdResultType::kDefaultToStartUrl);
id = start_url;
}
id.RemoveFragmentIdentifier();
// TODO(https://crbug.com/1231765): rename the field to relative_id to reflect
// the actual value.
return id.GetString().Substring(id.PathStart() + 1);
}
KURL ManifestParser::ParseStartURL(const JSONObject* object) {
return ParseURL(object, "start_url", manifest_url_,
ParseURLRestrictions::kSameOriginOnly);
}
KURL ManifestParser::ParseScope(const JSONObject* object,
const KURL& start_url) {
KURL scope = ParseURL(object, "scope", manifest_url_,
ParseURLRestrictions::kNoRestrictions);
// This will change to remove the |document_url_| fallback in the future.
// See https://github.com/w3c/manifest/issues/668.
const KURL& default_value = start_url.IsEmpty() ? document_url_ : start_url;
DCHECK(default_value.IsValid());
if (scope.IsEmpty())
return KURL(default_value.BaseAsString());
if (!URLIsWithinScope(default_value, scope)) {
AddErrorInfo(
"property 'scope' ignored. Start url should be within scope "
"of scope URL.");
return KURL(default_value.BaseAsString());
}
DCHECK(scope.IsValid());
DCHECK(SecurityOrigin::AreSameOrigin(scope, document_url_));
return scope;
}
blink::mojom::DisplayMode ManifestParser::ParseDisplay(
const JSONObject* object) {
absl::optional<String> display = ParseString(object, "display", Trim);
if (!display.has_value())
return blink::mojom::DisplayMode::kUndefined;
blink::mojom::DisplayMode display_enum =
DisplayModeFromString(display->Utf8());
if (display_enum == mojom::blink::DisplayMode::kUndefined) {
AddErrorInfo("unknown 'display' value ignored.");
return display_enum;
}
// Ignore "enhanced" display modes.
if (!IsBasicDisplayMode(display_enum)) {
display_enum = mojom::blink::DisplayMode::kUndefined;
AddErrorInfo("inapplicable 'display' value ignored.");
}
return display_enum;
}
Vector<mojom::blink::DisplayMode> ManifestParser::ParseDisplayOverride(
const JSONObject* object) {
Vector<mojom::blink::DisplayMode> display_override;
JSONValue* json_value = object->Get("display_override");
if (!json_value)
return display_override;
JSONArray* display_override_list = object->GetArray("display_override");
if (!display_override_list) {
AddErrorInfo("property 'display_override' ignored, type array expected.");
return display_override;
}
for (wtf_size_t i = 0; i < display_override_list->size(); ++i) {
String display_enum_string;
// AsString will return an empty string if a type error occurs,
// which will cause DisplayModeFromString to return kUndefined,
// resulting in this entry being ignored.
display_override_list->at(i)->AsString(&display_enum_string);
display_enum_string = display_enum_string.StripWhiteSpace();
mojom::blink::DisplayMode display_enum =
DisplayModeFromString(display_enum_string.Utf8());
if (!RuntimeEnabledFeatures::WebAppWindowControlsOverlayEnabled(
feature_context_) &&
display_enum == mojom::blink::DisplayMode::kWindowControlsOverlay) {
display_enum = mojom::blink::DisplayMode::kUndefined;
}
if (!RuntimeEnabledFeatures::WebAppTabStripEnabled(feature_context_) &&
display_enum == mojom::blink::DisplayMode::kTabbed) {
display_enum = mojom::blink::DisplayMode::kUndefined;
}
if (display_enum != mojom::blink::DisplayMode::kUndefined)
display_override.push_back(display_enum);
}
return display_override;
}
device::mojom::blink::ScreenOrientationLockType
ManifestParser::ParseOrientation(const JSONObject* object) {
absl::optional<String> orientation = ParseString(object, "orientation", Trim);
if (!orientation.has_value())
return device::mojom::blink::ScreenOrientationLockType::DEFAULT;
device::mojom::blink::ScreenOrientationLockType orientation_enum =
WebScreenOrientationLockTypeFromString(orientation->Utf8());
if (orientation_enum ==
device::mojom::blink::ScreenOrientationLockType::DEFAULT)
AddErrorInfo("unknown 'orientation' value ignored.");
return orientation_enum;
}
KURL ManifestParser::ParseIconSrc(const JSONObject* icon) {
return ParseURL(icon, "src", manifest_url_,
ParseURLRestrictions::kNoRestrictions);
}
String ManifestParser::ParseIconType(const JSONObject* icon) {
absl::optional<String> type = ParseString(icon, "type", Trim);
return type.has_value() ? *type : String("");
}
Vector<gfx::Size> ManifestParser::ParseIconSizes(const JSONObject* icon) {
absl::optional<String> sizes_str = ParseString(icon, "sizes", NoTrim);
if (!sizes_str.has_value())
return Vector<gfx::Size>();
WebVector<gfx::Size> web_sizes =
WebIconSizesParser::ParseIconSizes(WebString(*sizes_str));
Vector<gfx::Size> sizes;
for (auto& size : web_sizes)
sizes.push_back(size);
if (sizes.IsEmpty())
AddErrorInfo("found icon with no valid size.");
return sizes;
}
absl::optional<Vector<mojom::blink::ManifestImageResource::Purpose>>
ManifestParser::ParseIconPurpose(const JSONObject* icon) {
absl::optional<String> purpose_str = ParseString(icon, "purpose", NoTrim);
Vector<mojom::blink::ManifestImageResource::Purpose> purposes;
if (!purpose_str.has_value()) {
purposes.push_back(mojom::blink::ManifestImageResource::Purpose::ANY);
return purposes;
}
Vector<String> keywords;
purpose_str.value().Split(/*separator=*/" ", /*allow_empty_entries=*/false,
keywords);
// "any" is the default if there are no other keywords.
if (keywords.IsEmpty()) {
purposes.push_back(mojom::blink::ManifestImageResource::Purpose::ANY);
return purposes;
}
bool unrecognised_purpose = false;
for (auto& keyword : keywords) {
keyword = keyword.StripWhiteSpace();
if (keyword.IsEmpty())
continue;
if (EqualIgnoringASCIICase(keyword, "any")) {
purposes.push_back(mojom::blink::ManifestImageResource::Purpose::ANY);
} else if (EqualIgnoringASCIICase(keyword, "monochrome")) {
purposes.push_back(
mojom::blink::ManifestImageResource::Purpose::MONOCHROME);
} else if (EqualIgnoringASCIICase(keyword, "maskable")) {
purposes.push_back(
mojom::blink::ManifestImageResource::Purpose::MASKABLE);
} else {
unrecognised_purpose = true;
}
}
// This implies there was at least one purpose given, but none recognised.
// Instead of defaulting to "any" (which would not be future proof),
// invalidate the whole icon.
if (purposes.IsEmpty()) {
AddErrorInfo("found icon with no valid purpose; ignoring it.");
return absl::nullopt;
}
if (unrecognised_purpose) {
AddErrorInfo(
"found icon with one or more invalid purposes; those purposes are "
"ignored.");
}
return purposes;
}
Vector<mojom::blink::ManifestImageResourcePtr> ManifestParser::ParseIcons(
const JSONObject* object) {
return ParseImageResource("icons", object);
}
Vector<mojom::blink::ManifestImageResourcePtr> ManifestParser::ParseScreenshots(
const JSONObject* object) {
return ParseImageResource("screenshots", object);
}
Vector<mojom::blink::ManifestImageResourcePtr>
ManifestParser::ParseImageResource(const String& key,
const JSONObject* object) {
Vector<mojom::blink::ManifestImageResourcePtr> icons;
JSONValue* json_value = object->Get(key);
if (!json_value)
return icons;
JSONArray* icons_list = object->GetArray(key);
if (!icons_list) {
AddErrorInfo("property '" + key + "' ignored, type array expected.");
return icons;
}
for (wtf_size_t i = 0; i < icons_list->size(); ++i) {
JSONObject* icon_object = JSONObject::Cast(icons_list->at(i));
if (!icon_object)
continue;
auto icon = mojom::blink::ManifestImageResource::New();
icon->src = ParseIconSrc(icon_object);
// An icon MUST have a valid src. If it does not, it MUST be ignored.
if (!icon->src.IsValid())
continue;
icon->type = ParseIconType(icon_object);
icon->sizes = ParseIconSizes(icon_object);
auto purpose = ParseIconPurpose(icon_object);
if (!purpose)
continue;
icon->purpose = std::move(*purpose);
icons.push_back(std::move(icon));
}
return icons;
}
String ManifestParser::ParseShortcutName(const JSONObject* shortcut) {
absl::optional<String> name =
ParseStringForMember(shortcut, "shortcut", "name", true, Trim);
return name.has_value() ? *name : String();
}
String ManifestParser::ParseShortcutShortName(const JSONObject* shortcut) {
absl::optional<String> short_name =
ParseStringForMember(shortcut, "shortcut", "short_name", false, Trim);
return short_name.has_value() ? *short_name : String();
}
String ManifestParser::ParseShortcutDescription(const JSONObject* shortcut) {
absl::optional<String> description =
ParseStringForMember(shortcut, "shortcut", "description", false, Trim);
return description.has_value() ? *description : String();
}
KURL ManifestParser::ParseShortcutUrl(const JSONObject* shortcut) {
KURL shortcut_url = ParseURL(shortcut, "url", manifest_url_,
ParseURLRestrictions::kWithinScope);
if (shortcut_url.IsNull())
AddErrorInfo("property 'url' of 'shortcut' not present.");
return shortcut_url;
}
Vector<mojom::blink::ManifestShortcutItemPtr> ManifestParser::ParseShortcuts(
const JSONObject* object) {
Vector<mojom::blink::ManifestShortcutItemPtr> shortcuts;
JSONValue* json_value = object->Get("shortcuts");
if (!json_value)
return shortcuts;
JSONArray* shortcuts_list = object->GetArray("shortcuts");
if (!shortcuts_list) {
AddErrorInfo("property 'shortcuts' ignored, type array expected.");
return shortcuts;
}
for (wtf_size_t i = 0; i < shortcuts_list->size(); ++i) {
JSONObject* shortcut_object = JSONObject::Cast(shortcuts_list->at(i));
if (!shortcut_object)
continue;
auto shortcut = mojom::blink::ManifestShortcutItem::New();
shortcut->url = ParseShortcutUrl(shortcut_object);
// A shortcut MUST have a valid url. If it does not, it MUST be ignored.
if (!shortcut->url.IsValid())
continue;
// A shortcut MUST have a valid name. If it does not, it MUST be ignored.
shortcut->name = ParseShortcutName(shortcut_object);
if (shortcut->name == String())
continue;
shortcut->short_name = ParseShortcutShortName(shortcut_object);
shortcut->description = ParseShortcutDescription(shortcut_object);
auto icons = ParseIcons(shortcut_object);
if (!icons.IsEmpty())
shortcut->icons = std::move(icons);
shortcuts.push_back(std::move(shortcut));
}
return shortcuts;
}
String ManifestParser::ParseFileFilterName(const JSONObject* file) {
if (!file->Get("name")) {
AddErrorInfo("property 'name' missing.");
return String("");
}
String value;
if (!file->GetString("name", &value)) {
AddErrorInfo("property 'name' ignored, type string expected.");
return String("");
}
return value;
}
Vector<String> ManifestParser::ParseFileFilterAccept(const JSONObject* object) {
Vector<String> accept_types;
if (!object->Get("accept"))
return accept_types;
String accept_str;
if (object->GetString("accept", &accept_str)) {
accept_types.push_back(accept_str);
return accept_types;
}
JSONArray* accept_list = object->GetArray("accept");
if (!accept_list) {
// 'accept' property is the wrong type. Returning an empty vector here
// causes the 'files' entry to be discarded.
AddErrorInfo("property 'accept' ignored, type array or string expected.");
return accept_types;
}
for (wtf_size_t i = 0; i < accept_list->size(); ++i) {
JSONValue* accept_value = accept_list->at(i);
String accept_string;
if (!accept_value || !accept_value->AsString(&accept_string)) {
// A particular 'accept' entry is invalid - just drop that one entry.
AddErrorInfo("'accept' entry ignored, expected to be of type string.");
continue;
}
accept_types.push_back(accept_string);
}
return accept_types;
}
Vector<mojom::blink::ManifestFileFilterPtr> ManifestParser::ParseTargetFiles(
const String& key,
const JSONObject* from) {
Vector<mojom::blink::ManifestFileFilterPtr> files;
if (!from->Get(key))
return files;
JSONArray* file_list = from->GetArray(key);
if (!file_list) {
// https://wicg.github.io/web-share-target/level-2/#share_target-member
// step 5 indicates that the 'files' attribute is allowed to be a single
// (non-array) FileFilter.
const JSONObject* file_object = from->GetJSONObject(key);
if (!file_object) {
AddErrorInfo(
"property 'files' ignored, type array or FileFilter expected.");
return files;
}
ParseFileFilter(file_object, &files);
return files;
}
for (wtf_size_t i = 0; i < file_list->size(); ++i) {
const JSONObject* file_object = JSONObject::Cast(file_list->at(i));
if (!file_object) {
AddErrorInfo("files must be a sequence of non-empty file entries.");
continue;
}
ParseFileFilter(file_object, &files);
}
return files;
}
void ManifestParser::ParseFileFilter(
const JSONObject* file_object,
Vector<mojom::blink::ManifestFileFilterPtr>* files) {
auto file = mojom::blink::ManifestFileFilter::New();
file->name = ParseFileFilterName(file_object);
if (file->name.IsEmpty()) {
// https://wicg.github.io/web-share-target/level-2/#share_target-member
// step 7.1 requires that we invalidate this FileFilter if 'name' is an
// empty string. We also invalidate if 'name' is undefined or not a
// string.
return;
}
file->accept = ParseFileFilterAccept(file_object);
if (file->accept.IsEmpty())
return;
files->push_back(std::move(file));
}
absl::optional<mojom::blink::ManifestShareTarget::Method>
ManifestParser::ParseShareTargetMethod(const JSONObject* share_target_object) {
if (!share_target_object->Get("method")) {
AddErrorInfo(
"Method should be set to either GET or POST. It currently defaults to "
"GET.");
return mojom::blink::ManifestShareTarget::Method::kGet;
}
String value;
if (!share_target_object->GetString("method", &value))
return absl::nullopt;
String method = value.UpperASCII();
if (method == "GET")
return mojom::blink::ManifestShareTarget::Method::kGet;
if (method == "POST")
return mojom::blink::ManifestShareTarget::Method::kPost;
return absl::nullopt;
}
absl::optional<mojom::blink::ManifestShareTarget::Enctype>
ManifestParser::ParseShareTargetEnctype(const JSONObject* share_target_object) {
if (!share_target_object->Get("enctype")) {
AddErrorInfo(
"Enctype should be set to either application/x-www-form-urlencoded or "
"multipart/form-data. It currently defaults to "
"application/x-www-form-urlencoded");
return mojom::blink::ManifestShareTarget::Enctype::kFormUrlEncoded;
}
String value;
if (!share_target_object->GetString("enctype", &value))
return absl::nullopt;
String enctype = value.LowerASCII();
if (enctype == "application/x-www-form-urlencoded")
return mojom::blink::ManifestShareTarget::Enctype::kFormUrlEncoded;
if (enctype == "multipart/form-data")
return mojom::blink::ManifestShareTarget::Enctype::kMultipartFormData;
return absl::nullopt;
}
mojom::blink::ManifestShareTargetParamsPtr
ManifestParser::ParseShareTargetParams(const JSONObject* share_target_params) {
auto params = mojom::blink::ManifestShareTargetParams::New();
// NOTE: These are key names for query parameters, which are filled with share
// data. As such, |params.url| is just a string.
absl::optional<String> text = ParseString(share_target_params, "text", Trim);
params->text = text.has_value() ? *text : String();
absl::optional<String> title =
ParseString(share_target_params, "title", Trim);
params->title = title.has_value() ? *title : String();
absl::optional<String> url = ParseString(share_target_params, "url", Trim);
params->url = url.has_value() ? *url : String();
auto files = ParseTargetFiles("files", share_target_params);
if (!files.IsEmpty())
params->files = std::move(files);
return params;
}
absl::optional<mojom::blink::ManifestShareTargetPtr>
ManifestParser::ParseShareTarget(const JSONObject* object) {
const JSONObject* share_target_object = object->GetJSONObject("share_target");
if (!share_target_object)
return absl::nullopt;
auto share_target = mojom::blink::ManifestShareTarget::New();
share_target->action = ParseURL(share_target_object, "action", manifest_url_,
ParseURLRestrictions::kWithinScope);
if (!share_target->action.IsValid()) {
AddErrorInfo(
"property 'share_target' ignored. Property 'action' is "
"invalid.");
return absl::nullopt;
}
auto method = ParseShareTargetMethod(share_target_object);
auto enctype = ParseShareTargetEnctype(share_target_object);
const JSONObject* share_target_params_object =
share_target_object->GetJSONObject("params");
if (!share_target_params_object) {
AddErrorInfo(
"property 'share_target' ignored. Property 'params' type "
"dictionary expected.");
return absl::nullopt;
}
share_target->params = ParseShareTargetParams(share_target_params_object);
if (!method.has_value()) {
AddErrorInfo(
"invalid method. Allowed methods are:"
"GET and POST.");
return absl::nullopt;
}
share_target->method = method.value();
if (!enctype.has_value()) {
AddErrorInfo(
"invalid enctype. Allowed enctypes are:"
"application/x-www-form-urlencoded and multipart/form-data.");
return absl::nullopt;
}
share_target->enctype = enctype.value();
if (share_target->method == mojom::blink::ManifestShareTarget::Method::kGet) {
if (share_target->enctype ==
mojom::blink::ManifestShareTarget::Enctype::kMultipartFormData) {
AddErrorInfo(
"invalid enctype for GET method. Only "
"application/x-www-form-urlencoded is allowed.");
return absl::nullopt;
}
}
if (share_target->params->files.has_value()) {
if (share_target->method !=
mojom::blink::ManifestShareTarget::Method::kPost ||
share_target->enctype !=
mojom::blink::ManifestShareTarget::Enctype::kMultipartFormData) {
AddErrorInfo("files are only supported with multipart/form-data POST.");
return absl::nullopt;
}
}
if (share_target->params->files.has_value() &&
!VerifyFiles(*share_target->params->files)) {
AddErrorInfo("invalid mime type inside files.");
return absl::nullopt;
}
return share_target;
}
Vector<mojom::blink::ManifestFileHandlerPtr> ManifestParser::ParseFileHandlers(
const JSONObject* object) {
if (!object->Get("file_handlers"))
return {};
JSONArray* entry_array = object->GetArray("file_handlers");
if (!entry_array) {
AddErrorInfo("property 'file_handlers' ignored, type array expected.");
return {};
}
Vector<mojom::blink::ManifestFileHandlerPtr> result;
for (wtf_size_t i = 0; i < entry_array->size(); ++i) {
JSONObject* json_entry = JSONObject::Cast(entry_array->at(i));
if (!json_entry) {
AddErrorInfo("FileHandler ignored, type object expected.");
continue;
}
absl::optional<mojom::blink::ManifestFileHandlerPtr> entry =
ParseFileHandler(json_entry);
if (!entry)
continue;
result.push_back(std::move(entry.value()));
}
return result;
}
absl::optional<mojom::blink::ManifestFileHandlerPtr>
ManifestParser::ParseFileHandler(const JSONObject* file_handler) {
mojom::blink::ManifestFileHandlerPtr entry =
mojom::blink::ManifestFileHandler::New();
entry->action = ParseURL(file_handler, "action", manifest_url_,
ParseURLRestrictions::kWithinScope);
if (!entry->action.IsValid()) {
AddErrorInfo("FileHandler ignored. Property 'action' is invalid.");
return absl::nullopt;
}
entry->name = ParseString(file_handler, "name", Trim).value_or("");
const bool feature_enabled =
base::FeatureList::IsEnabled(blink::features::kFileHandlingIcons) ||
RuntimeEnabledFeatures::FileHandlingIconsEnabled(feature_context_);
if (feature_enabled) {
entry->icons = ParseIcons(file_handler);
}
entry->accept = ParseFileHandlerAccept(file_handler->GetJSONObject("accept"));
if (entry->accept.IsEmpty()) {
AddErrorInfo("FileHandler ignored. Property 'accept' is invalid.");
return absl::nullopt;
}
return entry;
}
HashMap<String, Vector<String>> ManifestParser::ParseFileHandlerAccept(
const JSONObject* accept) {
HashMap<String, Vector<String>> result;
if (!accept)
return result;
for (wtf_size_t i = 0; i < accept->size(); ++i) {
JSONObject::Entry entry = accept->at(i);
// Validate the MIME type.
String& mimetype = entry.first;
std::string top_level_mime_type;
if (!net::ParseMimeTypeWithoutParameter(mimetype.Utf8(),
&top_level_mime_type, nullptr) ||
!net::IsValidTopLevelMimeType(top_level_mime_type)) {
AddErrorInfo("invalid MIME type: " + mimetype);
continue;
}
Vector<String> extensions;
String extension;
JSONArray* extensions_array = JSONArray::Cast(entry.second);
if (extensions_array) {
for (wtf_size_t j = 0; j < extensions_array->size(); ++j) {
JSONValue* value = extensions_array->at(j);
if (!value->AsString(&extension)) {
AddErrorInfo(
"property 'accept' file extension ignored, type string "
"expected.");
continue;
}
if (!ParseFileHandlerAcceptExtension(value, &extension)) {
// Errors are added by ParseFileHandlerAcceptExtension.
continue;
}
extensions.push_back(extension);
}
} else if (ParseFileHandlerAcceptExtension(entry.second, &extension)) {
extensions.push_back(extension);
} else {
// Parsing errors will already have been added.
continue;
}
result.Set(mimetype, std::move(extensions));
}
return result;
}
bool ManifestParser::ParseFileHandlerAcceptExtension(const JSONValue* extension,
String* output) {
if (!extension->AsString(output)) {
AddErrorInfo(
"property 'accept' type ignored. File extensions must be type array or "
"type string.");
return false;
}
if (!output->StartsWith(".")) {
AddErrorInfo(
"property 'accept' file extension ignored, must start with a '.'.");
return false;
}
return true;
}
Vector<mojom::blink::ManifestProtocolHandlerPtr>
ManifestParser::ParseProtocolHandlers(const JSONObject* from) {
Vector<mojom::blink::ManifestProtocolHandlerPtr> protocols;
const bool feature_enabled =
base::FeatureList::IsEnabled(
blink::features::kWebAppEnableProtocolHandlers) ||
RuntimeEnabledFeatures::ParseUrlProtocolHandlerEnabled(feature_context_);
if (!feature_enabled || !from->Get("protocol_handlers"))
return protocols;
JSONArray* protocol_list = from->GetArray("protocol_handlers");
if (!protocol_list) {
AddErrorInfo("property 'protocol_handlers' ignored, type array expected.");
return protocols;
}
for (wtf_size_t i = 0; i < protocol_list->size(); ++i) {
const JSONObject* protocol_object = JSONObject::Cast(protocol_list->at(i));
if (!protocol_object) {
AddErrorInfo("protocol_handlers entry ignored, type object expected.");
continue;
}
absl::optional<mojom::blink::ManifestProtocolHandlerPtr> protocol =
ParseProtocolHandler(protocol_object);
if (!protocol)
continue;
protocols.push_back(std::move(protocol.value()));
}
return protocols;
}
absl::optional<mojom::blink::ManifestProtocolHandlerPtr>
ManifestParser::ParseProtocolHandler(const JSONObject* object) {
DCHECK(
base::FeatureList::IsEnabled(
blink::features::kWebAppEnableProtocolHandlers) ||
RuntimeEnabledFeatures::ParseUrlProtocolHandlerEnabled(feature_context_));
if (!object->Get("protocol")) {
AddErrorInfo(
"protocol_handlers entry ignored, required property 'protocol' is "
"missing.");
return absl::nullopt;
}
auto protocol_handler = mojom::blink::ManifestProtocolHandler::New();
absl::optional<String> protocol = ParseString(object, "protocol", Trim);
String error_message;
bool is_valid_protocol = protocol.has_value();
if (is_valid_protocol &&
!VerifyCustomHandlerScheme(protocol.value(), error_message,
ProtocolHandlerSecurityLevel::kStrict)) {
AddErrorInfo(error_message);
is_valid_protocol = false;
}
if (!is_valid_protocol) {
AddErrorInfo(
"protocol_handlers entry ignored, required property 'protocol' is "
"invalid.");
return absl::nullopt;
}
protocol_handler->protocol = protocol.value();
if (!object->Get("url")) {
AddErrorInfo(
"protocol_handlers entry ignored, required property 'url' is missing.");
return absl::nullopt;
}
protocol_handler->url = ParseURL(object, "url", manifest_url_,
ParseURLRestrictions::kWithinScope);
bool is_valid_url = protocol_handler->url.IsValid();
if (is_valid_url) {
const char kToken[] = "%s";
String user_url = protocol_handler->url.GetString();
String tokenless_url = protocol_handler->url.GetString();
tokenless_url.Remove(user_url.Find(kToken), base::size(kToken) - 1);
KURL full_url(manifest_url_, tokenless_url);
if (!VerifyCustomHandlerURLSyntax(full_url, manifest_url_, user_url,
error_message)) {
AddErrorInfo(error_message);
is_valid_url = false;
}
}
if (!is_valid_url) {
AddErrorInfo(
"protocol_handlers entry ignored, required property 'url' is invalid.");
return absl::nullopt;
}
return std::move(protocol_handler);
}
Vector<mojom::blink::ManifestUrlHandlerPtr> ManifestParser::ParseUrlHandlers(
const JSONObject* from) {
Vector<mojom::blink::ManifestUrlHandlerPtr> url_handlers;
const bool feature_enabled =
base::FeatureList::IsEnabled(blink::features::kWebAppEnableUrlHandlers) ||
RuntimeEnabledFeatures::WebAppUrlHandlingEnabled(feature_context_);
if (!feature_enabled || !from->Get("url_handlers")) {
return url_handlers;
}
JSONArray* handlers_list = from->GetArray("url_handlers");
if (!handlers_list) {
AddErrorInfo("property 'url_handlers' ignored, type array expected.");
return url_handlers;
}
for (wtf_size_t i = 0; i < handlers_list->size(); ++i) {
if (i == kMaxUrlHandlersSize) {
AddErrorInfo("property 'url_handlers' contains more than " +
String::Number(kMaxUrlHandlersSize) +
" valid elements, only the first " +
String::Number(kMaxUrlHandlersSize) + " are parsed.");
break;
}
const JSONObject* handler_object = JSONObject::Cast(handlers_list->at(i));
if (!handler_object) {
AddErrorInfo("url_handlers entry ignored, type object expected.");
continue;
}
absl::optional<mojom::blink::ManifestUrlHandlerPtr> url_handler =
ParseUrlHandler(handler_object);
if (!url_handler) {
continue;
}
url_handlers.push_back(std::move(url_handler.value()));
}
return url_handlers;
}
absl::optional<mojom::blink::ManifestUrlHandlerPtr>
ManifestParser::ParseUrlHandler(const JSONObject* object) {
DCHECK(
base::FeatureList::IsEnabled(blink::features::kWebAppEnableUrlHandlers) ||
RuntimeEnabledFeatures::WebAppUrlHandlingEnabled(feature_context_));
if (!object->Get("origin")) {
AddErrorInfo(
"url_handlers entry ignored, required property 'origin' is missing.");
return absl::nullopt;
}
const absl::optional<String> origin_string =
ParseString(object, "origin", Trim);
if (!origin_string.has_value()) {
AddErrorInfo(
"url_handlers entry ignored, required property 'origin' is invalid.");
return absl::nullopt;
}
// TODO(crbug.com/1072058): pre-process for input without scheme.
// (eg. example.com instead of https://example.com) because we can always
// assume the use of https for URL handling. Remove this TODO if we decide
// to require fully specified https scheme in this origin input.
if (origin_string->length() > kMaxOriginLength) {
AddErrorInfo(
"url_handlers entry ignored, 'origin' exceeds maximum character length "
"of " +
String::Number(kMaxOriginLength) + " .");
return absl::nullopt;
}
auto origin = SecurityOrigin::CreateFromString(*origin_string);
if (!origin || origin->IsOpaque()) {
AddErrorInfo(
"url_handlers entry ignored, required property 'origin' is invalid.");
return absl::nullopt;
}
if (origin->Protocol() != url::kHttpsScheme) {
AddErrorInfo(
"url_handlers entry ignored, required property 'origin' must use the "
"https scheme.");
return absl::nullopt;
}
String host = origin->Host();
auto url_handler = mojom::blink::ManifestUrlHandler::New();
// Check for wildcard *.
if (host.StartsWith(kUrlHandlerWildcardPrefix)) {
url_handler->has_origin_wildcard = true;
// Trim the wildcard prefix to get the effective host. Minus one to exclude
// the length of the null terminator.
host = host.Substring(sizeof(kUrlHandlerWildcardPrefix) - 1);
} else {
url_handler->has_origin_wildcard = false;
}
bool host_valid = IsHostValidForUrlHandler(host);
if (!host_valid) {
AddErrorInfo(
"url_handlers entry ignored, domain of required property 'origin' is "
"invalid.");
return absl::nullopt;
}
if (url_handler->has_origin_wildcard) {
origin = SecurityOrigin::CreateFromValidTuple(origin->Protocol(), host,
origin->Port());
if (!origin_string.has_value()) {
AddErrorInfo(
"url_handlers entry ignored, required property 'origin' is invalid.");
return absl::nullopt;
}
}
url_handler->origin = origin;
return std::move(url_handler);
}
KURL ManifestParser::ParseNoteTakingNewNoteUrl(const JSONObject* note_taking) {
if (!note_taking->Get("new_note_url")) {
return KURL();
}
KURL new_note_url = ParseURL(note_taking, "new_note_url", manifest_url_,
ParseURLRestrictions::kWithinScope);
if (!new_note_url.IsValid()) {
// Error already reported by ParseURL.
return KURL();
}
return new_note_url;
}
mojom::blink::ManifestNoteTakingPtr ManifestParser::ParseNoteTaking(
const JSONObject* manifest) {
if (!manifest->Get("note_taking")) {
return nullptr;
}
const JSONObject* note_taking_object = manifest->GetJSONObject("note_taking");
if (!note_taking_object) {
AddErrorInfo("property 'note_taking' ignored, type object expected.");
return nullptr;
}
auto note_taking = mojom::blink::ManifestNoteTaking::New();
note_taking->new_note_url = ParseNoteTakingNewNoteUrl(note_taking_object);
return note_taking;
}
String ManifestParser::ParseRelatedApplicationPlatform(
const JSONObject* application) {
absl::optional<String> platform = ParseString(application, "platform", Trim);
return platform.has_value() ? *platform : String();
}
absl::optional<KURL> ManifestParser::ParseRelatedApplicationURL(
const JSONObject* application) {
return ParseURL(application, "url", manifest_url_,
ParseURLRestrictions::kNoRestrictions);
}
String ManifestParser::ParseRelatedApplicationId(
const JSONObject* application) {
absl::optional<String> id = ParseString(application, "id", Trim);
return id.has_value() ? *id : String();
}
Vector<mojom::blink::ManifestRelatedApplicationPtr>
ManifestParser::ParseRelatedApplications(const JSONObject* object) {
Vector<mojom::blink::ManifestRelatedApplicationPtr> applications;
JSONValue* value = object->Get("related_applications");
if (!value)
return applications;
JSONArray* applications_list = object->GetArray("related_applications");
if (!applications_list) {
AddErrorInfo(
"property 'related_applications' ignored,"
" type array expected.");
return applications;
}
for (wtf_size_t i = 0; i < applications_list->size(); ++i) {
const JSONObject* application_object =
JSONObject::Cast(applications_list->at(i));
if (!application_object)
continue;
auto application = mojom::blink::ManifestRelatedApplication::New();
application->platform = ParseRelatedApplicationPlatform(application_object);
// "If platform is undefined, move onto the next item if any are left."
if (application->platform.IsEmpty()) {
AddErrorInfo(
"'platform' is a required field, related application"
" ignored.");
continue;
}
application->id = ParseRelatedApplicationId(application_object);
application->url = ParseRelatedApplicationURL(application_object);
// "If both id and url are undefined, move onto the next item if any are
// left."
if ((!application->url.has_value() || !application->url->IsValid()) &&
application->id.IsEmpty()) {
AddErrorInfo(
"one of 'url' or 'id' is required, related application"
" ignored.");
continue;
}
applications.push_back(std::move(application));
}
return applications;
}
bool ManifestParser::ParsePreferRelatedApplications(const JSONObject* object) {
return ParseBoolean(object, "prefer_related_applications", false);
}
absl::optional<RGBA32> ManifestParser::ParseThemeColor(
const JSONObject* object) {
return ParseColor(object, "theme_color");
}
absl::optional<RGBA32> ManifestParser::ParseBackgroundColor(
const JSONObject* object) {
return ParseColor(object, "background_color");
}
String ManifestParser::ParseGCMSenderID(const JSONObject* object) {
absl::optional<String> gcm_sender_id =
ParseString(object, "gcm_sender_id", Trim);
return gcm_sender_id.has_value() ? *gcm_sender_id : String();
}
mojom::blink::CaptureLinks ManifestParser::ParseCaptureLinks(
const JSONObject* object) {
if (!RuntimeEnabledFeatures::WebAppLinkCapturingEnabled(feature_context_))
return mojom::blink::CaptureLinks::kUndefined;
return ParseFirstValidEnum<mojom::blink::CaptureLinks>(
object, "capture_links", &CaptureLinksFromString,
/*invalid_value=*/mojom::blink::CaptureLinks::kUndefined);
}
bool ManifestParser::ParseIsolatedStorage(const JSONObject* object) {
bool is_storage_isolated = ParseBoolean(object, "isolated_storage", false);
if (is_storage_isolated && manifest_->scope.GetPath() != "/") {
AddErrorInfo("Isolated storage is only supported with a scope of \"/\".");
return false;
}
return is_storage_isolated;
}
mojom::blink::ManifestLaunchHandlerPtr ManifestParser::ParseLaunchHandler(
const JSONObject* object) {
using RouteTo = mojom::blink::ManifestLaunchHandler::RouteTo;
using NavigateExistingClient =
mojom::blink::ManifestLaunchHandler::NavigateExistingClient;
if (!RuntimeEnabledFeatures::WebAppLaunchHandlerEnabled(feature_context_))
return nullptr;
const JSONValue* launch_handler_value = object->Get("launch_handler");
if (!launch_handler_value)
return nullptr;
const JSONObject* launch_handler_object =
JSONObject::Cast(launch_handler_value);
if (!launch_handler_object) {
AddErrorInfo("launch_handler value ignored, object expected.");
return nullptr;
}
RouteTo route_to = ParseFirstValidEnum<absl::optional<RouteTo>>(
launch_handler_object, "route_to", &RouteToFromString,
/*invalid_value=*/absl::nullopt)
.value_or(RouteTo::kAuto);
NavigateExistingClient navigate_existing_client =
ParseFirstValidEnum<absl::optional<NavigateExistingClient>>(
launch_handler_object, "navigate_existing_client",
&NavigateExistingClientFromString, /*invalid_value=*/absl::nullopt)
.value_or(NavigateExistingClient::kAlways);
return mojom::blink::ManifestLaunchHandler::New(route_to,
navigate_existing_client);
}
HashMap<String, mojom::blink::ManifestTranslationItemPtr>
ManifestParser::ParseTranslations(const JSONObject* object) {
HashMap<String, mojom::blink::ManifestTranslationItemPtr> result;
if (!object->Get("translations"))
return result;
JSONObject* translations_map = object->GetJSONObject("translations");
if (!translations_map) {
AddErrorInfo("property 'translations' ignored, object expected.");
return result;
}
for (wtf_size_t i = 0; i < translations_map->size(); ++i) {
JSONObject::Entry entry = translations_map->at(i);
String locale = entry.first;
if (locale == "") {
AddErrorInfo("skipping translation, non-empty locale string expected.");
continue;
}
JSONObject* translation = JSONObject::Cast(entry.second);
if (!translation) {
AddErrorInfo("skipping translation, object expected.");
continue;
}
auto translation_item = mojom::blink::ManifestTranslationItem::New();
absl::optional<String> name =
ParseStringForMember(translation, "translations", "name", false, Trim);
translation_item->name =
name.has_value() && name->length() != 0 ? *name : String();
absl::optional<String> short_name = ParseStringForMember(
translation, "translations", "short_name", false, Trim);
translation_item->short_name =
short_name.has_value() && short_name->length() != 0 ? *short_name
: String();
absl::optional<String> description = ParseStringForMember(
translation, "translations", "description", false, Trim);
translation_item->description =
description.has_value() && description->length() != 0 ? *description
: String();
// A translation may be specified for any combination of translatable fields
// in the manifest. If no translations are supplied, we skip this item.
if (!translation_item->name && !translation_item->short_name &&
!translation_item->description) {
continue;
}
result.Set(locale, std::move(translation_item));
}
return result;
}
void ManifestParser::AddErrorInfo(const String& error_msg,
bool critical,
int error_line,
int error_column) {
mojom::blink::ManifestErrorPtr error = mojom::blink::ManifestError::New(
error_msg, critical, error_line, error_column);
errors_.push_back(std::move(error));
}
} // namespace blink
| 34.36859 | 93 | 0.685405 | zealoussnow |
02de07040b0226dffadcc518590d25af474dd846 | 11,185 | cpp | C++ | third_party/7z/CPP/7zip/Compress/Rar1Decoder.cpp | VirtualLib/juice | 3d5912059f3a80ec1fef5c5031a395578904fe9c | [
"MIT"
] | 8 | 2019-08-22T01:33:07.000Z | 2022-03-06T11:21:26.000Z | third_party/7z/CPP/7zip/Compress/Rar1Decoder.cpp | VirtualLib/juice | 3d5912059f3a80ec1fef5c5031a395578904fe9c | [
"MIT"
] | 1 | 2020-07-02T16:05:19.000Z | 2020-07-03T08:25:44.000Z | third_party/7z/CPP/7zip/Compress/Rar1Decoder.cpp | VirtualLib/juice | 3d5912059f3a80ec1fef5c5031a395578904fe9c | [
"MIT"
] | 1 | 2021-02-28T10:19:00.000Z | 2021-02-28T10:19:00.000Z | // Rar1Decoder.cpp
// According to unRAR license, this code may not be used to develop
// a program that creates RAR archives
#include "StdAfx.h"
#include "Rar1Decoder.h"
namespace NCompress {
namespace NRar1 {
static const unsigned kNumBits = 12;
static const Byte kShortLen1[16 * 3] =
{
0,0xa0,0xd0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xc0,0x80,0x90,0x98,0x9c,0xb0,0,
1,3,4,4,5,6,7,8,8,4,4,5,6,6,0,0,
1,4,4,4,5,6,7,8,8,4,4,5,6,6,4,0
};
static const Byte kShortLen2[16 * 3] =
{
0,0x40,0x60,0xa0,0xd0,0xe0,0xf0,0xf8,0xfc,0xc0,0x80,0x90,0x98,0x9c,0xb0,0,
2,3,3,3,4,4,5,6,6,4,4,5,6,6,0,0,
2,3,3,4,4,4,5,6,6,4,4,5,6,6,4,0
};
static const Byte PosL1[kNumBits + 1] = { 0,0,2,1,2,2,4,5,4,4,8,0,224 };
static const Byte PosL2[kNumBits + 1] = { 0,0,0,5,2,2,4,5,4,4,8,2,220 };
static const Byte PosHf0[kNumBits + 1] = { 0,0,0,0,8,8,8,9,0,0,0,0,224 };
static const Byte PosHf1[kNumBits + 1] = { 0,0,0,0,0,4,40,16,16,4,0,47,130 };
static const Byte PosHf2[kNumBits + 1] = { 0,0,0,0,0,2,5,46,64,116,24,0,0 };
static const Byte PosHf3[kNumBits + 1] = { 0,0,0,0,0,0,2,14,202,33,6,0,0 };
static const Byte PosHf4[kNumBits + 1] = { 0,0,0,0,0,0,0,0,255,2,0,0,0 };
static const UInt32 kHistorySize = (1 << 16);
CDecoder::CDecoder():
_isSolid(false),
_solidAllowed(false)
{ }
UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numBits); }
HRESULT CDecoder::CopyBlock(UInt32 distance, UInt32 len)
{
if (len == 0)
return S_FALSE;
if (m_UnpackSize < len)
return S_FALSE;
m_UnpackSize -= len;
return m_OutWindowStream.CopyBlock(distance, len) ? S_OK : S_FALSE;
}
UInt32 CDecoder::DecodeNum(const Byte *numTab)
{
/*
{
// we can check that tables are correct
UInt32 sum = 0;
for (unsigned i = 0; i <= kNumBits; i++)
sum += ((UInt32)numTab[i] << (kNumBits - i));
if (sum != (1 << kNumBits))
throw 111;
}
*/
UInt32 val = m_InBitStream.GetValue(kNumBits);
UInt32 sum = 0;
unsigned i = 2;
for (;;)
{
UInt32 num = numTab[i];
UInt32 cur = num << (kNumBits - i);
if (val < cur)
break;
i++;
val -= cur;
sum += num;
}
m_InBitStream.MovePos(i);
return ((val >> (kNumBits - i)) + sum);
}
HRESULT CDecoder::ShortLZ()
{
NumHuf = 0;
if (LCount == 2)
{
if (ReadBits(1))
return CopyBlock(LastDist, LastLength);
LCount = 0;
}
UInt32 bitField = m_InBitStream.GetValue(8);
UInt32 len, dist;
{
const Byte *xors = (AvrLn1 < 37) ? kShortLen1 : kShortLen2;
const Byte *lens = xors + 16 + Buf60;
for (len = 0; ((bitField ^ xors[len]) >> (8 - lens[len])) != 0; len++);
m_InBitStream.MovePos(lens[len]);
}
if (len >= 9)
{
if (len == 9)
{
LCount++;
return CopyBlock(LastDist, LastLength);
}
LCount = 0;
if (len == 14)
{
len = DecodeNum(PosL2) + 5;
dist = 0x8000 + ReadBits(15) - 1;
LastLength = len;
LastDist = dist;
return CopyBlock(dist, len);
}
UInt32 saveLen = len;
dist = m_RepDists[(m_RepDistPtr - (len - 9)) & 3];
len = DecodeNum(PosL1);
if (len == 0xff && saveLen == 10)
{
Buf60 ^= 16;
return S_OK;
}
if (dist >= 256)
{
len++;
if (dist >= MaxDist3 - 1)
len++;
}
}
else
{
LCount = 0;
AvrLn1 += len;
AvrLn1 -= AvrLn1 >> 4;
unsigned distancePlace = DecodeNum(PosHf2) & 0xff;
dist = ChSetA[distancePlace];
if (distancePlace != 0)
{
PlaceA[dist]--;
UInt32 lastDistance = ChSetA[(size_t)distancePlace - 1];
PlaceA[lastDistance]++;
ChSetA[distancePlace] = lastDistance;
ChSetA[(size_t)distancePlace - 1] = dist;
}
}
m_RepDists[m_RepDistPtr++] = dist;
m_RepDistPtr &= 3;
len += 2;
LastLength = len;
LastDist = dist;
return CopyBlock(dist, len);
}
HRESULT CDecoder::LongLZ()
{
UInt32 len;
UInt32 dist;
UInt32 distancePlace, newDistancePlace;
UInt32 oldAvr2, oldAvr3;
NumHuf = 0;
Nlzb += 16;
if (Nlzb > 0xff)
{
Nlzb = 0x90;
Nhfb >>= 1;
}
oldAvr2 = AvrLn2;
if (AvrLn2 >= 64)
len = DecodeNum(AvrLn2 < 122 ? PosL1 : PosL2);
else
{
UInt32 bitField = m_InBitStream.GetValue(16);
if (bitField < 0x100)
{
len = bitField;
m_InBitStream.MovePos(16);
}
else
{
for (len = 0; ((bitField << len) & 0x8000) == 0; len++);
m_InBitStream.MovePos(len + 1);
}
}
AvrLn2 += len;
AvrLn2 -= AvrLn2 >> 5;
{
const Byte *tab;
if (AvrPlcB >= 0x2900) tab = PosHf2;
else if (AvrPlcB >= 0x0700) tab = PosHf1;
else tab = PosHf0;
distancePlace = DecodeNum(tab); // [0, 256]
}
AvrPlcB += distancePlace;
AvrPlcB -= AvrPlcB >> 8;
distancePlace &= 0xff;
for (;;)
{
dist = ChSetB[distancePlace];
newDistancePlace = NToPlB[dist++ & 0xff]++;
if (dist & 0xff)
break;
CorrHuff(ChSetB,NToPlB);
}
ChSetB[distancePlace] = ChSetB[newDistancePlace];
ChSetB[newDistancePlace] = dist;
dist = ((dist & 0xff00) >> 1) | ReadBits(7);
oldAvr3 = AvrLn3;
if (len != 1 && len != 4)
if (len == 0 && dist <= MaxDist3)
{
AvrLn3++;
AvrLn3 -= AvrLn3 >> 8;
}
else if (AvrLn3 > 0)
AvrLn3--;
len += 3;
if (dist >= MaxDist3)
len++;
if (dist <= 256)
len += 8;
if (oldAvr3 > 0xb0 || AvrPlc >= 0x2a00 && oldAvr2 < 0x40)
MaxDist3 = 0x7f00;
else
MaxDist3 = 0x2001;
m_RepDists[m_RepDistPtr++] = --dist;
m_RepDistPtr &= 3;
LastLength = len;
LastDist = dist;
return CopyBlock(dist, len);
}
HRESULT CDecoder::HuffDecode()
{
UInt32 curByte, newBytePlace;
UInt32 len;
UInt32 dist;
unsigned bytePlace;
{
const Byte *tab;
if (AvrPlc >= 0x7600) tab = PosHf4;
else if (AvrPlc >= 0x5e00) tab = PosHf3;
else if (AvrPlc >= 0x3600) tab = PosHf2;
else if (AvrPlc >= 0x0e00) tab = PosHf1;
else tab = PosHf0;
bytePlace = DecodeNum(tab); // [0, 256]
}
if (StMode)
{
if (bytePlace == 0)
{
if (ReadBits(1))
{
NumHuf = 0;
StMode = false;
return S_OK;
}
len = ReadBits(1) + 3;
dist = DecodeNum(PosHf2);
dist = (dist << 5) | ReadBits(5);
if (dist == 0)
return S_FALSE;
return CopyBlock(dist - 1, len);
}
bytePlace--; // bytePlace is [0, 255]
}
else if (NumHuf++ >= 16 && FlagsCnt == 0)
StMode = true;
bytePlace &= 0xff;
AvrPlc += bytePlace;
AvrPlc -= AvrPlc >> 8;
Nhfb += 16;
if (Nhfb > 0xff)
{
Nhfb = 0x90;
Nlzb >>= 1;
}
m_UnpackSize--;
m_OutWindowStream.PutByte((Byte)(ChSet[bytePlace] >> 8));
for (;;)
{
curByte = ChSet[bytePlace];
newBytePlace = NToPl[curByte++ & 0xff]++;
if ((curByte & 0xff) <= 0xa1)
break;
CorrHuff(ChSet, NToPl);
}
ChSet[bytePlace] = ChSet[newBytePlace];
ChSet[newBytePlace] = curByte;
return S_OK;
}
void CDecoder::GetFlagsBuf()
{
UInt32 flags, newFlagsPlace;
UInt32 flagsPlace = DecodeNum(PosHf2); // [0, 256]
if (flagsPlace >= ARRAY_SIZE(ChSetC))
return;
for (;;)
{
flags = ChSetC[flagsPlace];
FlagBuf = flags >> 8;
newFlagsPlace = NToPlC[flags++ & 0xff]++;
if ((flags & 0xff) != 0)
break;
CorrHuff(ChSetC, NToPlC);
}
ChSetC[flagsPlace] = ChSetC[newFlagsPlace];
ChSetC[newFlagsPlace] = flags;
}
void CDecoder::CorrHuff(UInt32 *CharSet,UInt32 *NumToPlace)
{
int i;
for (i = 7; i >= 0; i--)
for (int j = 0; j < 32; j++, CharSet++)
*CharSet = (*CharSet & ~0xff) | i;
memset(NumToPlace, 0, sizeof(NToPl));
for (i = 6; i >= 0; i--)
NumToPlace[i] = (7 - i) * 32;
}
HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo * /* progress */)
{
if (!inSize || !outSize)
return E_INVALIDARG;
if (_isSolid && !_solidAllowed)
return S_FALSE;
_solidAllowed = false;
if (!m_OutWindowStream.Create(kHistorySize))
return E_OUTOFMEMORY;
if (!m_InBitStream.Create(1 << 20))
return E_OUTOFMEMORY;
m_UnpackSize = *outSize;
m_OutWindowStream.SetStream(outStream);
m_OutWindowStream.Init(_isSolid);
m_InBitStream.SetStream(inStream);
m_InBitStream.Init();
// InitData
FlagsCnt = 0;
FlagBuf = 0;
StMode = false;
LCount = 0;
if (!_isSolid)
{
AvrPlcB = AvrLn1 = AvrLn2 = AvrLn3 = NumHuf = Buf60 = 0;
AvrPlc = 0x3500;
MaxDist3 = 0x2001;
Nhfb = Nlzb = 0x80;
{
// InitStructures
for (int i = 0; i < kNumRepDists; i++)
m_RepDists[i] = 0;
m_RepDistPtr = 0;
LastLength = 0;
LastDist = 0;
}
// InitHuff
for (UInt32 i = 0; i < 256; i++)
{
Place[i] = PlaceA[i] = PlaceB[i] = i;
UInt32 c = (~i + 1) & 0xff;
PlaceC[i] = c;
ChSet[i] = ChSetB[i] = i << 8;
ChSetA[i] = i;
ChSetC[i] = c << 8;
}
memset(NToPl, 0, sizeof(NToPl));
memset(NToPlB, 0, sizeof(NToPlB));
memset(NToPlC, 0, sizeof(NToPlC));
CorrHuff(ChSetB, NToPlB);
}
if (m_UnpackSize > 0)
{
GetFlagsBuf();
FlagsCnt = 8;
}
while (m_UnpackSize != 0)
{
if (!StMode)
{
if (--FlagsCnt < 0)
{
GetFlagsBuf();
FlagsCnt = 7;
}
if (FlagBuf & 0x80)
{
FlagBuf <<= 1;
if (Nlzb > Nhfb)
{
RINOK(LongLZ());
continue;
}
}
else
{
FlagBuf <<= 1;
if (--FlagsCnt < 0)
{
GetFlagsBuf();
FlagsCnt = 7;
}
if ((FlagBuf & 0x80) == 0)
{
FlagBuf <<= 1;
RINOK(ShortLZ());
continue;
}
FlagBuf <<= 1;
if (Nlzb <= Nhfb)
{
RINOK(LongLZ());
continue;
}
}
}
RINOK(HuffDecode());
}
_solidAllowed = true;
return m_OutWindowStream.Flush();
}
STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const CInBufferException &e) { return e.ErrorCode; }
catch(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
{
if (size < 1)
return E_INVALIDARG;
_isSolid = ((data[0] & 1) != 0);
return S_OK;
}
}}
| 21.634429 | 92 | 0.534645 | VirtualLib |
02e1573b9440bf259520e82979dbafa8e3864373 | 54,742 | cc | C++ | src/bin/perfdhcp/command_options.cc | piskyscan/kea | 72c0a679a1101aada8d22c98abf7bde615fa7a11 | [
"Apache-2.0"
] | null | null | null | src/bin/perfdhcp/command_options.cc | piskyscan/kea | 72c0a679a1101aada8d22c98abf7bde615fa7a11 | [
"Apache-2.0"
] | null | null | null | src/bin/perfdhcp/command_options.cc | piskyscan/kea | 72c0a679a1101aada8d22c98abf7bde615fa7a11 | [
"Apache-2.0"
] | null | null | null | // Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <perfdhcp/command_options.h>
#include <exceptions/exceptions.h>
#include <dhcp/iface_mgr.h>
#include <dhcp/duid.h>
#include <dhcp/option.h>
#include <cfgrpt/config_report.h>
#include <util/encode/hex.h>
#include <asiolink/io_error.h>
#include <boost/lexical_cast.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fstream>
#include <thread>
#include <getopt.h>
#ifdef HAVE_OPTRESET
extern int optreset;
#endif
using namespace std;
using namespace isc;
using namespace isc::dhcp;
namespace isc {
namespace perfdhcp {
// Refer to config_report so it will be embedded in the binary
const char* const* perfdhcp_config_report = isc::detail::config_report;
CommandOptions::LeaseType::LeaseType()
: type_(ADDRESS) {
}
CommandOptions::LeaseType::LeaseType(const Type lease_type)
: type_(lease_type) {
}
bool
CommandOptions::LeaseType::is(const Type lease_type) const {
return (lease_type == type_);
}
bool
CommandOptions::LeaseType::includes(const Type lease_type) const {
return (is(ADDRESS_AND_PREFIX) || (lease_type == type_));
}
void
CommandOptions::LeaseType::set(const Type lease_type) {
type_ = lease_type;
}
void
CommandOptions::LeaseType::fromCommandLine(const std::string& cmd_line_arg) {
if (cmd_line_arg == "address-only") {
type_ = ADDRESS;
} else if (cmd_line_arg == "prefix-only") {
type_ = PREFIX;
} else if (cmd_line_arg == "address-and-prefix") {
type_ = ADDRESS_AND_PREFIX;
} else {
isc_throw(isc::InvalidParameter, "value of lease-type: -e<lease-type>,"
" must be one of the following: 'address-only' or"
" 'prefix-only'");
}
}
std::string
CommandOptions::LeaseType::toText() const {
switch (type_) {
case ADDRESS:
return ("address-only (IA_NA option added to the client's request)");
case PREFIX:
return ("prefix-only (IA_PD option added to the client's request)");
case ADDRESS_AND_PREFIX:
return ("address-and-prefix (Both IA_NA and IA_PD options added to the"
" client's request)");
default:
isc_throw(Unexpected, "internal error: undefined lease type code when"
" returning textual representation of the lease type");
}
}
void
CommandOptions::reset() {
// Default mac address used in DHCP messages
// if -b mac=<mac-address> was not specified
uint8_t mac[6] = { 0x0, 0xC, 0x1, 0x2, 0x3, 0x4 };
// Default packet drop time if -D<drop-time> parameter
// was not specified
double dt[2] = { 1., 1. };
// We don't use constructor initialization list because we
// will need to reset all members many times to perform unit tests
ipversion_ = 0;
exchange_mode_ = DORA_SARR;
lease_type_.set(LeaseType::ADDRESS);
rate_ = 0;
renew_rate_ = 0;
release_rate_ = 0;
report_delay_ = 0;
clean_report_ = false;
clean_report_separator_ = "";
clients_num_ = 0;
mac_template_.assign(mac, mac + 6);
duid_template_.clear();
base_.clear();
addr_unique_ = false;
mac_list_file_.clear();
mac_list_.clear();
giaddr_list_file_.clear();
giaddr_list_.clear();
multi_subnet_ = false;
num_request_.clear();
exit_wait_time_ = 0;
period_ = 0;
wait_for_elapsed_time_ = -1;
increased_elapsed_time_ = -1;
drop_time_set_ = 0;
drop_time_.assign(dt, dt + 2);
max_drop_.clear();
max_pdrop_.clear();
localname_.clear();
is_interface_ = false;
preload_ = 0;
local_port_ = 0;
remote_port_ = 0;
seeded_ = false;
seed_ = 0;
broadcast_ = false;
rapid_commit_ = false;
use_first_ = false;
template_file_.clear();
rnd_offset_.clear();
xid_offset_.clear();
elp_offset_ = -1;
sid_offset_ = -1;
rip_offset_ = -1;
diags_.clear();
wrapped_.clear();
server_name_.clear();
v6_relay_encapsulation_level_ = 0;
generateDuidTemplate();
extra_opts_.clear();
if (std::thread::hardware_concurrency() == 1) {
single_thread_mode_ = true;
} else {
single_thread_mode_ = false;
}
scenario_ = Scenario::BASIC;
}
bool
CommandOptions::parse(int argc, char** const argv, bool print_cmd_line) {
// Reset internal variables used by getopt
// to eliminate undefined behavior when
// parsing different command lines multiple times
#ifdef __GLIBC__
// Warning: non-portable code. This is due to a bug in glibc's
// getopt() which keeps internal state about an old argument vector
// (argc, argv) from last call and tries to scan them when a new
// argument vector (argc, argv) is passed. As the old vector may not
// be main()'s arguments, but heap allocated and may have been freed
// since, this becomes a use after free and results in random
// behavior. According to the NOTES section in glibc getopt()'s
// manpage, setting optind=0 resets getopt()'s state. Though this is
// not required in our usage of getopt(), the bug still happens
// unless we set optind=0.
//
// Setting optind=0 is non-portable code.
optind = 0;
#else
optind = 1;
#endif
// optreset is declared on BSD systems and is used to reset internal
// state of getopt(). When parsing command line arguments multiple
// times with getopt() the optreset must be set to 1 every time before
// parsing starts. Failing to do so will result in random behavior of
// getopt().
#ifdef HAVE_OPTRESET
optreset = 1;
#endif
opterr = 0;
// Reset values of class members
reset();
// Informs if program has been run with 'h' or 'v' option.
bool help_or_version_mode = initialize(argc, argv, print_cmd_line);
if (!help_or_version_mode) {
validate();
}
return (help_or_version_mode);
}
const int LONG_OPT_SCENARIO = 300;
bool
CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
int opt = 0; // Subsequent options returned by getopt()
std::string drop_arg; // Value of -D<value>argument
size_t percent_loc = 0; // Location of % sign in -D<value>
double drop_percent = 0; // % value (1..100) in -D<value%>
int num_drops = 0; // Max number of drops specified in -D<value>
int num_req = 0; // Max number of dropped
// requests in -n<max-drops>
int offset_arg = 0; // Temporary variable holding offset arguments
std::string sarg; // Temporary variable for string args
std::ostringstream stream;
stream << "perfdhcp";
int num_mac_list_files = 0;
int num_subnet_list_files = 0;
struct option long_options[] = {
{"scenario", required_argument, 0, LONG_OPT_SCENARIO},
{0, 0, 0, 0}
};
// In this section we collect argument values from command line
// they will be tuned and validated elsewhere
while((opt = getopt_long(argc, argv,
"huv46A:r:t:R:b:n:p:d:D:l:P:a:L:N:M:s:iBc1"
"J:T:X:O:o:E:S:I:x:W:w:e:f:F:g:C:y:Y:",
long_options, NULL)) != -1) {
stream << " -" << static_cast<char>(opt);
if (optarg) {
stream << " " << optarg;
}
switch (opt) {
case '1':
use_first_ = true;
break;
// Simulate DHCPv6 relayed traffic.
case 'A':
// @todo: At the moment we only support simulating a single relay
// agent. In the future we should extend it to up to 32.
// See comment in https://github.com/isc-projects/kea/pull/22#issuecomment-243405600
v6_relay_encapsulation_level_ =
static_cast<uint8_t>(positiveInteger("-A<encapsulation-level> must"
" be a positive integer"));
if (v6_relay_encapsulation_level_ != 1) {
isc_throw(isc::InvalidParameter, "-A only supports 1 at the moment.");
}
break;
case 'u':
addr_unique_ = true;
break;
case '4':
check(ipversion_ == 6, "IP version already set to 6");
ipversion_ = 4;
break;
case '6':
check(ipversion_ == 4, "IP version already set to 4");
ipversion_ = 6;
break;
case 'b':
check(base_.size() > 3, "-b<value> already specified,"
" unexpected occurrence of 5th -b<value>");
base_.push_back(optarg);
decodeBase(base_.back());
break;
case 'B':
broadcast_ = true;
break;
case 'c':
rapid_commit_ = true;
break;
case 'C':
clean_report_ = true;
clean_report_separator_ = optarg;
break;
case 'd':
check(drop_time_set_ > 1,
"maximum number of drops already specified, "
"unexpected 3rd occurrence of -d<value>");
try {
drop_time_[drop_time_set_] =
boost::lexical_cast<double>(optarg);
} catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter,
"value of drop time: -d<value>"
" must be positive number");
}
check(drop_time_[drop_time_set_] <= 0.,
"drop-time must be a positive number");
drop_time_set_ = true;
break;
case 'D':
drop_arg = std::string(optarg);
percent_loc = drop_arg.find('%');
check(max_pdrop_.size() > 1 || max_drop_.size() > 1,
"values of maximum drops: -D<value> already "
"specified, unexpected 3rd occurrence of -D<value>");
if ((percent_loc) != std::string::npos) {
try {
drop_percent =
boost::lexical_cast<double>(drop_arg.substr(0, percent_loc));
} catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter,
"value of drop percentage: -D<value%>"
" must be 0..100");
}
check((drop_percent <= 0) || (drop_percent >= 100),
"value of drop percentage: -D<value%> must be 0..100");
max_pdrop_.push_back(drop_percent);
} else {
num_drops = positiveInteger("value of max drops number:"
" -D<value> must be a positive integer");
max_drop_.push_back(num_drops);
}
break;
case 'e':
initLeaseType();
break;
case 'E':
elp_offset_ = nonNegativeInteger("value of time-offset: -E<value>"
" must not be a negative integer");
break;
case 'f':
renew_rate_ = positiveInteger("value of the renew rate: -f<renew-rate>"
" must be a positive integer");
break;
case 'F':
release_rate_ = positiveInteger("value of the release rate:"
" -F<release-rate> must be a"
" positive integer");
break;
case 'g': {
auto optarg_text = std::string(optarg);
if (optarg_text == "single") {
single_thread_mode_ = true;
} else if (optarg_text == "multi") {
single_thread_mode_ = false;
} else {
isc_throw(InvalidParameter, "value of thread mode (-g) '" << optarg << "' is wrong - should be '-g single' or '-g multi'");
}
break;
}
case 'h':
usage();
return (true);
case 'i':
exchange_mode_ = DO_SA;
break;
case 'I':
rip_offset_ = positiveInteger("value of ip address offset:"
" -I<value> must be a"
" positive integer");
break;
case 'J':
check(num_subnet_list_files >= 1, "only one -J option can be specified");
num_subnet_list_files++;
giaddr_list_file_ = std::string(optarg);
loadGiaddr();
break;
case 'l':
localname_ = std::string(optarg);
initIsInterface();
break;
case 'L':
local_port_ = nonNegativeInteger("value of local port:"
" -L<value> must not be a"
" negative integer");
check(local_port_ >
static_cast<int>(std::numeric_limits<uint16_t>::max()),
"local-port must be lower than " +
boost::lexical_cast<std::string>(std::numeric_limits<uint16_t>::max()));
break;
case 'N':
remote_port_ = nonNegativeInteger("value of remote port:"
" -L<value> must not be a"
" negative integer");
check(remote_port_ >
static_cast<int>(std::numeric_limits<uint16_t>::max()),
"remote-port must be lower than " +
boost::lexical_cast<std::string>(std::numeric_limits<uint16_t>::max()));
break;
case 'M':
check(num_mac_list_files >= 1, "only one -M option can be specified");
num_mac_list_files++;
mac_list_file_ = std::string(optarg);
loadMacs();
break;
case 'W':
exit_wait_time_ = nonNegativeInteger("value of exist wait time: "
"-W<value> must not be a "
"negative integer");
break;
case 'n':
num_req = positiveInteger("value of num-request:"
" -n<value> must be a positive integer");
if (num_request_.size() >= 2) {
isc_throw(isc::InvalidParameter,
"value of maximum number of requests: -n<value> "
"already specified, unexpected 3rd occurrence"
" of -n<value>");
}
num_request_.push_back(num_req);
break;
case 'O':
if (rnd_offset_.size() < 2) {
offset_arg = positiveInteger("value of random offset: "
"-O<value> must be greater than 3");
} else {
isc_throw(isc::InvalidParameter,
"random offsets already specified,"
" unexpected 3rd occurrence of -O<value>");
}
check(offset_arg < 3, "value of random random-offset:"
" -O<value> must be greater than 3 ");
rnd_offset_.push_back(offset_arg);
break;
case 'o': {
// we must know how to contruct the option: whether it's v4 or v6.
check( (ipversion_ != 4) && (ipversion_ != 6),
"-4 or -6 must be explicitly specified before -o is used.");
// custom option (expected format: code,hexstring)
std::string opt_text = std::string(optarg);
size_t coma_loc = opt_text.find(',');
check(coma_loc == std::string::npos,
"-o option must provide option code, a coma and hexstring for"
" the option content, e.g. -o60,646f63736973 for sending option"
" 60 (class-id) with the value 'docsis'");
int code = 0;
// Try to parse the option code
try {
code = boost::lexical_cast<int>(opt_text.substr(0,coma_loc));
check(code <= 0, "Option code can't be negative");
} catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, "Invalid option code specified for "
"-o option, expected format: -o<integer>,<hexstring>");
}
// Now try to interpret the hexstring
opt_text = opt_text.substr(coma_loc + 1);
std::vector<uint8_t> bin;
try {
isc::util::encode::decodeHex(opt_text, bin);
} catch (const BadValue& e) {
isc_throw(InvalidParameter, "Error during encoding option -o:"
<< e.what());
}
// Create and remember the option.
OptionPtr opt(new Option(ipversion_ == 4 ? Option::V4 : Option::V6,
code, bin));
extra_opts_.insert(make_pair(code, opt));
break;
}
case 'p':
period_ = positiveInteger("value of test period:"
" -p<value> must be a positive integer");
break;
case 'P':
preload_ = nonNegativeInteger("number of preload packets:"
" -P<value> must not be "
"a negative integer");
break;
case 'r':
rate_ = positiveInteger("value of rate:"
" -r<value> must be a positive integer");
break;
case 'R':
initClientsNum();
break;
case 's':
seed_ = static_cast<unsigned int>
(nonNegativeInteger("value of seed:"
" -s <seed> must be non-negative integer"));
seeded_ = seed_ > 0 ? true : false;
break;
case 'S':
sid_offset_ = positiveInteger("value of server id offset:"
" -S<value> must be a"
" positive integer");
break;
case 't':
report_delay_ = positiveInteger("value of report delay:"
" -t<value> must be a"
" positive integer");
break;
case 'T':
if (template_file_.size() < 2) {
sarg = nonEmptyString("template file name not specified,"
" expected -T<filename>");
template_file_.push_back(sarg);
} else {
isc_throw(isc::InvalidParameter,
"template files are already specified,"
" unexpected 3rd -T<filename> occurrence");
}
break;
case 'v':
version();
return (true);
case 'w':
wrapped_ = nonEmptyString("command for wrapped mode:"
" -w<command> must be specified");
break;
case 'x':
diags_ = nonEmptyString("value of diagnostics selectors:"
" -x<value> must be specified");
break;
case 'X':
if (xid_offset_.size() < 2) {
offset_arg = positiveInteger("value of transaction id:"
" -X<value> must be a"
" positive integer");
} else {
isc_throw(isc::InvalidParameter,
"transaction ids already specified,"
" unexpected 3rd -X<value> occurrence");
}
xid_offset_.push_back(offset_arg);
break;
case 'Y':
wait_for_elapsed_time_ = nonNegativeInteger("value of time:"
" -Y<value> must be a non negative integer");
break;
case 'y':
increased_elapsed_time_ = positiveInteger("value of time:"
" -y<value> must be a positive integer");
break;
case LONG_OPT_SCENARIO: {
auto optarg_text = std::string(optarg);
if (optarg_text == "basic") {
scenario_ = Scenario::BASIC;
} else if (optarg_text == "avalanche") {
scenario_ = Scenario::AVALANCHE;
} else {
isc_throw(InvalidParameter, "scenario value '" << optarg << "' is wrong - should be 'basic' or 'avalanche'");
}
break;
}
default:
isc_throw(isc::InvalidParameter, "wrong command line option");
}
}
// If the IP version was not specified in the
// command line, assume IPv4.
if (ipversion_ == 0) {
ipversion_ = 4;
}
// If template packet files specified for both DISCOVER/SOLICIT
// and REQUEST/REPLY exchanges make sure we have transaction id
// and random duid offsets for both exchanges. We will duplicate
// value specified as -X<value> and -R<value> for second
// exchange if user did not specified otherwise.
if (template_file_.size() > 1) {
if (xid_offset_.size() == 1) {
xid_offset_.push_back(xid_offset_[0]);
}
if (rnd_offset_.size() == 1) {
rnd_offset_.push_back(rnd_offset_[0]);
}
}
// Get server argument
// NoteFF02::1:2 and FF02::1:3 are defined in RFC 8415 as
// All_DHCP_Relay_Agents_and_Servers and All_DHCP_Servers
// addresses
check(optind < argc -1, "extra arguments?");
if (optind == argc - 1) {
server_name_ = argv[optind];
stream << " " << server_name_;
// Decode special cases
if ((ipversion_ == 4) && (server_name_.compare("all") == 0)) {
broadcast_ = true;
// Use broadcast address as server name.
server_name_ = DHCP_IPV4_BROADCAST_ADDRESS;
} else if ((ipversion_ == 6) && (server_name_.compare("all") == 0)) {
server_name_ = ALL_DHCP_RELAY_AGENTS_AND_SERVERS;
} else if ((ipversion_ == 6) &&
(server_name_.compare("servers") == 0)) {
server_name_ = ALL_DHCP_SERVERS;
}
}
if (!getCleanReport()) {
if (print_cmd_line) {
std::cout << "Running: " << stream.str() << std::endl;
}
if (scenario_ == Scenario::BASIC) {
std::cout << "Scenario: basic." << std::endl;
} else if (scenario_ == Scenario::AVALANCHE) {
std::cout << "Scenario: avalanche." << std::endl;
}
if (!isSingleThreaded()) {
std::cout << "Multi-thread mode enabled." << std::endl;
}
}
// Handle the local '-l' address/interface
if (!localname_.empty()) {
if (server_name_.empty()) {
if (is_interface_ && (ipversion_ == 4)) {
broadcast_ = true;
server_name_ = DHCP_IPV4_BROADCAST_ADDRESS;
} else if (is_interface_ && (ipversion_ == 6)) {
server_name_ = ALL_DHCP_RELAY_AGENTS_AND_SERVERS;
}
}
}
if (server_name_.empty()) {
isc_throw(InvalidParameter,
"without an interface, server is required");
}
// If DUID is not specified from command line we need to
// generate one.
if (duid_template_.empty()) {
generateDuidTemplate();
}
return (false);
}
void
CommandOptions::initClientsNum() {
const std::string errmsg =
"value of -R <value> must be non-negative integer";
try {
// Declare clients_num as as 64-bit signed value to
// be able to detect negative values provided
// by user. We would not detect negative values
// if we casted directly to unsigned value.
long long clients_num = boost::lexical_cast<long long>(optarg);
check(clients_num < 0, errmsg);
clients_num_ = boost::lexical_cast<uint32_t>(optarg);
} catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter, errmsg);
}
}
void
CommandOptions::initIsInterface() {
is_interface_ = false;
if (!localname_.empty()) {
dhcp::IfaceMgr& iface_mgr = dhcp::IfaceMgr::instance();
if (iface_mgr.getIface(localname_) != NULL) {
is_interface_ = true;
}
}
}
void
CommandOptions::decodeBase(const std::string& base) {
std::string b(base);
boost::algorithm::to_lower(b);
// Currently we only support mac and duid
if ((b.substr(0, 4) == "mac=") || (b.substr(0, 6) == "ether=")) {
decodeMacBase(b);
} else if (b.substr(0, 5) == "duid=") {
decodeDuid(b);
} else {
isc_throw(isc::InvalidParameter,
"base value not provided as -b<value>,"
" expected -b mac=<mac> or -b duid=<duid>");
}
}
void
CommandOptions::decodeMacBase(const std::string& base) {
// Strip string from mac=
size_t found = base.find('=');
static const char* errmsg = "expected -b<base> format for"
" mac address is -b mac=00::0C::01::02::03::04 or"
" -b mac=00:0C:01:02:03:04";
check(found == std::string::npos, errmsg);
// Decode mac address to vector of uint8_t
std::istringstream s1(base.substr(found + 1));
std::string token;
mac_template_.clear();
// Get pieces of MAC address separated with : (or even ::)
while (std::getline(s1, token, ':')) {
// Convert token to byte value using std::istringstream
if (token.length() > 0) {
unsigned int ui = 0;
try {
// Do actual conversion
ui = convertHexString(token);
} catch (const isc::InvalidParameter&) {
isc_throw(isc::InvalidParameter,
"invalid characters in MAC provided");
}
// If conversion succeeded store byte value
mac_template_.push_back(ui);
}
}
// MAC address must consist of 6 octets, otherwise it is invalid
check(mac_template_.size() != 6, errmsg);
}
void
CommandOptions::decodeDuid(const std::string& base) {
// Strip argument from duid=
std::vector<uint8_t> duid_template;
size_t found = base.find('=');
check(found == std::string::npos, "expected -b<base>"
" format for duid is -b duid=<duid>");
std::string b = base.substr(found + 1);
// DUID must have even number of digits and must not be longer than 64 bytes
check(b.length() & 1, "odd number of hexadecimal digits in duid");
check(b.length() > 128, "duid too large");
check(b.length() == 0, "no duid specified");
// Turn pairs of hexadecimal digits into vector of octets
for (size_t i = 0; i < b.length(); i += 2) {
unsigned int ui = 0;
try {
// Do actual conversion
ui = convertHexString(b.substr(i, 2));
} catch (const isc::InvalidParameter&) {
isc_throw(isc::InvalidParameter,
"invalid characters in DUID provided,"
" expected hex digits");
}
duid_template.push_back(static_cast<uint8_t>(ui));
}
// @todo Get rid of this limitation when we manage add support
// for DUIDs other than LLT. Shorter DUIDs may be useful for
// server testing purposes.
check(duid_template.size() < 6, "DUID must be at least 6 octets long");
// Assign the new duid only if successfully generated.
std::swap(duid_template, duid_template_);
}
void
CommandOptions::generateDuidTemplate() {
using namespace boost::posix_time;
// Duid template will be most likely generated only once but
// it is ok if it is called more then once so we simply
// regenerate it and discard previous value.
duid_template_.clear();
const uint8_t duid_template_len = 14;
duid_template_.resize(duid_template_len);
// The first four octets consist of DUID LLT and hardware type.
duid_template_[0] = static_cast<uint8_t>(static_cast<uint16_t>(isc::dhcp::DUID::DUID_LLT) >> 8);
duid_template_[1] = static_cast<uint8_t>(static_cast<uint16_t>(isc::dhcp::DUID::DUID_LLT) & 0xff);
duid_template_[2] = HWTYPE_ETHERNET >> 8;
duid_template_[3] = HWTYPE_ETHERNET & 0xff;
// As described in RFC 8415: 'the time value is the time
// that the DUID is generated represented in seconds
// since midnight (UTC), January 1, 2000, modulo 2^32.'
ptime now = microsec_clock::universal_time();
ptime duid_epoch(from_iso_string("20000101T000000"));
time_period period(duid_epoch, now);
uint32_t duration_sec = htonl(period.length().total_seconds());
memcpy(&duid_template_[4], &duration_sec, 4);
// Set link layer address (6 octets). This value may be
// randomized before sending a packet to simulate different
// clients.
memcpy(&duid_template_[8], &mac_template_[0], 6);
}
uint8_t
CommandOptions::convertHexString(const std::string& text) const {
unsigned int ui = 0;
// First, check if we are dealing with hexadecimal digits only
for (size_t i = 0; i < text.length(); ++i) {
if (!std::isxdigit(text[i])) {
isc_throw(isc::InvalidParameter,
"The following digit: " << text[i] << " in "
<< text << "is not hexadecimal");
}
}
// If we are here, we have valid string to convert to octet
std::istringstream text_stream(text);
text_stream >> std::hex >> ui >> std::dec;
// Check if for some reason we have overflow - this should never happen!
if (ui > 0xFF) {
isc_throw(isc::InvalidParameter, "Can't convert more than"
" two hex digits to byte");
}
return ui;
}
bool CommandOptions::validateIP(const std::string& line) {
try {
asiolink::IOAddress ip_address_ = isc::asiolink::IOAddress(line);
// let's silence not used warning
(void) ip_address_;
} catch (const isc::asiolink::IOError& e) {
return (true);
}
giaddr_list_.push_back(line);
multi_subnet_ = true;
return (false);
}
void CommandOptions::loadGiaddr() {
std::string line;
std::ifstream infile(giaddr_list_file_.c_str());
size_t cnt = 0;
while (std::getline(infile, line)) {
cnt++;
stringstream tmp;
tmp << "invalid address in line: "<< cnt;
check(validateIP(line), tmp.str());
}
}
void CommandOptions::loadMacs() {
std::string line;
std::ifstream infile(mac_list_file_.c_str());
size_t cnt = 0;
while (std::getline(infile, line)) {
cnt++;
stringstream tmp;
tmp << "invalid mac in input line " << cnt;
// Let's print more meaningful error that contains line with error.
check(decodeMacString(line), tmp.str());
}
}
bool CommandOptions::decodeMacString(const std::string& line) {
// decode mac string into a vector of uint8_t returns true in case of error.
std::istringstream s(line);
std::string token;
std::vector<uint8_t> mac;
while(std::getline(s, token, ':')) {
// Convert token to byte value using std::istringstream
if (token.length() > 0) {
unsigned int ui = 0;
try {
// Do actual conversion
ui = convertHexString(token);
} catch (const isc::InvalidParameter&) {
return (true);
}
// If conversion succeeded store byte value
mac.push_back(ui);
}
}
mac_list_.push_back(mac);
return (false);
}
void
CommandOptions::validate() {
check((getIpVersion() != 4) && (isBroadcast() != 0),
"-B is not compatible with IPv6 (-6)");
check((getIpVersion() != 6) && (isRapidCommit() != 0),
"-6 (IPv6) must be set to use -c");
check(getIpVersion() == 4 && isUseRelayedV6(),
"Can't use -4 with -A, it's a V6 only option.");
check((getIpVersion() != 6) && (getReleaseRate() != 0),
"-F<release-rate> may be used with -6 (IPv6) only");
check((getExchangeMode() == DO_SA) && (getNumRequests().size() > 1),
"second -n<num-request> is not compatible with -i");
check((getIpVersion() == 4) && !getLeaseType().is(LeaseType::ADDRESS),
"-6 option must be used if lease type other than '-e address-only'"
" is specified");
check(!getTemplateFiles().empty() &&
!getLeaseType().is(LeaseType::ADDRESS),
"template files may be only used with '-e address-only'");
check((getExchangeMode() == DO_SA) && (getDropTime()[1] != 1.),
"second -d<drop-time> is not compatible with -i");
check((getExchangeMode() == DO_SA) &&
((getMaxDrop().size() > 1) || (getMaxDropPercentage().size() > 1)),
"second -D<max-drop> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (isUseFirst()),
"-1 is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getTemplateFiles().size() > 1),
"second -T<template-file> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getTransactionIdOffset().size() > 1),
"second -X<xid-offset> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getRandomOffset().size() > 1),
"second -O<random-offset is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getElapsedTimeOffset() >= 0),
"-E<time-offset> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getServerIdOffset() >= 0),
"-S<srvid-offset> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getRequestedIpOffset() >= 0),
"-I<ip-offset> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getRenewRate() != 0),
"-f<renew-rate> is not compatible with -i");
check((getExchangeMode() == DO_SA) && (getReleaseRate() != 0),
"-F<release-rate> is not compatible with -i");
check((getExchangeMode() != DO_SA) && (isRapidCommit() != 0),
"-i must be set to use -c");
check((getRate() != 0) && (getRenewRate() + getReleaseRate() > getRate()),
"The sum of Renew rate (-f<renew-rate>) and Release rate"
" (-F<release-rate>) must not be greater than the exchange"
" rate specified as -r<rate>");
check((getRate() == 0) && (getRenewRate() != 0),
"Renew rate specified as -f<renew-rate> must not be specified"
" when -r<rate> parameter is not specified");
check((getRate() == 0) && (getReleaseRate() != 0),
"Release rate specified as -F<release-rate> must not be specified"
" when -r<rate> parameter is not specified");
check((getTemplateFiles().size() < getTransactionIdOffset().size()),
"-T<template-file> must be set to use -X<xid-offset>");
check((getTemplateFiles().size() < getRandomOffset().size()),
"-T<template-file> must be set to use -O<random-offset>");
check((getTemplateFiles().size() < 2) && (getElapsedTimeOffset() >= 0),
"second/request -T<template-file> must be set to use -E<time-offset>");
check((getTemplateFiles().size() < 2) && (getServerIdOffset() >= 0),
"second/request -T<template-file> must be set to "
"use -S<srvid-offset>");
check((getTemplateFiles().size() < 2) && (getRequestedIpOffset() >= 0),
"second/request -T<template-file> must be set to "
"use -I<ip-offset>");
check((!getMacListFile().empty() && base_.size() > 0),
"Can't use -b with -M option");
check((getWaitForElapsedTime() == -1 && getIncreaseElapsedTime() != -1),
"Option -y can't be used without -Y");
check((getWaitForElapsedTime() != -1 && getIncreaseElapsedTime() == -1),
"Option -Y can't be used without -y");
auto nthreads = std::thread::hardware_concurrency();
if (nthreads == 1 && isSingleThreaded() == false) {
std::cout << "WARNING: Currently system can run only 1 thread in parallel." << std::endl
<< "WARNING: Better results are achieved when run in single-threaded mode." << std::endl
<< "WARNING: To switch use -g single option." << std::endl;
} else if (nthreads > 1 && isSingleThreaded()) {
std::cout << "WARNING: Currently system can run more than 1 thread in parallel." << std::endl
<< "WARNING: Better results are achieved when run in multi-threaded mode." << std::endl
<< "WARNING: To switch use -g multi option." << std::endl;
}
if (scenario_ == Scenario::AVALANCHE) {
check(getClientsNum() <= 0,
"in case of avalanche scenario number\nof clients must be specified"
" using -R option explicitly");
// in case of AVALANCHE drops ie. long responses should not be observed by perfdhcp
double dt[2] = { 1000.0, 1000.0 };
drop_time_.assign(dt, dt + 2);
if (drop_time_set_) {
std::cout << "INFO: in avalanche scenario drop time is ignored" << std::endl;
}
}
}
void
CommandOptions::check(bool condition, const std::string& errmsg) const {
// The same could have been done with macro or just if statement but
// we prefer functions to macros here
std::ostringstream stream;
stream << errmsg << "\n";
if (condition) {
isc_throw(isc::InvalidParameter, errmsg);
}
}
int
CommandOptions::positiveInteger(const std::string& errmsg) const {
try {
int value = boost::lexical_cast<int>(optarg);
check(value <= 0, errmsg);
return (value);
} catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, errmsg);
}
}
int
CommandOptions::nonNegativeInteger(const std::string& errmsg) const {
try {
int value = boost::lexical_cast<int>(optarg);
check(value < 0, errmsg);
return (value);
} catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, errmsg);
}
}
std::string
CommandOptions::nonEmptyString(const std::string& errmsg) const {
std::string sarg = optarg;
if (sarg.length() == 0) {
isc_throw(isc::InvalidParameter, errmsg);
}
return sarg;
}
void
CommandOptions::initLeaseType() {
std::string lease_type_arg = optarg;
lease_type_.fromCommandLine(lease_type_arg);
}
void
CommandOptions::printCommandLine() const {
std::cout << "IPv" << static_cast<int>(ipversion_) << std::endl;
if (exchange_mode_ == DO_SA) {
if (ipversion_ == 4) {
std::cout << "DISCOVER-OFFER only" << std::endl;
} else {
std::cout << "SOLICIT-ADVERTISE only" << std::endl;
}
}
std::cout << "lease-type=" << getLeaseType().toText() << std::endl;
if (rate_ != 0) {
std::cout << "rate[1/s]=" << rate_ << std::endl;
}
if (getRenewRate() != 0) {
std::cout << "renew-rate[1/s]=" << getRenewRate() << std::endl;
}
if (getReleaseRate() != 0) {
std::cout << "release-rate[1/s]=" << getReleaseRate() << std::endl;
}
if (report_delay_ != 0) {
std::cout << "report[s]=" << report_delay_ << std::endl;
}
if (clients_num_ != 0) {
std::cout << "clients=" << clients_num_ << std::endl;
}
for (size_t i = 0; i < base_.size(); ++i) {
std::cout << "base[" << i << "]=" << base_[i] << std::endl;
}
for (size_t i = 0; i < num_request_.size(); ++i) {
std::cout << "num-request[" << i << "]=" << num_request_[i] << std::endl;
}
if (period_ != 0) {
std::cout << "test-period=" << period_ << std::endl;
}
for (size_t i = 0; i < drop_time_.size(); ++i) {
std::cout << "drop-time[" << i << "]=" << drop_time_[i] << std::endl;
}
for (size_t i = 0; i < max_drop_.size(); ++i) {
std::cout << "max-drop{" << i << "]=" << max_drop_[i] << std::endl;
}
for (size_t i = 0; i < max_pdrop_.size(); ++i) {
std::cout << "max-pdrop{" << i << "]=" << max_pdrop_[i] << std::endl;
}
if (preload_ != 0) {
std::cout << "preload=" << preload_ << std::endl;
}
if (getLocalPort() != 0) {
std::cout << "local-port=" << local_port_ << std::endl;
}
if (getRemotePort() != 0) {
std::cout << "remote-port=" << remote_port_ << std::endl;
}
if (seeded_) {
std::cout << "seed=" << seed_ << std::endl;
}
if (broadcast_) {
std::cout << "broadcast" << std::endl;
}
if (rapid_commit_) {
std::cout << "rapid-commit" << std::endl;
}
if (use_first_) {
std::cout << "use-first" << std::endl;
}
if (!mac_list_file_.empty()) {
std::cout << "mac-list-file=" << mac_list_file_ << std::endl;
}
for (size_t i = 0; i < template_file_.size(); ++i) {
std::cout << "template-file[" << i << "]=" << template_file_[i] << std::endl;
}
for (size_t i = 0; i < xid_offset_.size(); ++i) {
std::cout << "xid-offset[" << i << "]=" << xid_offset_[i] << std::endl;
}
if (elp_offset_ != 0) {
std::cout << "elp-offset=" << elp_offset_ << std::endl;
}
for (size_t i = 0; i < rnd_offset_.size(); ++i) {
std::cout << "rnd-offset[" << i << "]=" << rnd_offset_[i] << std::endl;
}
if (sid_offset_ != 0) {
std::cout << "sid-offset=" << sid_offset_ << std::endl;
}
if (rip_offset_ != 0) {
std::cout << "rip-offset=" << rip_offset_ << std::endl;
}
if (!diags_.empty()) {
std::cout << "diagnostic-selectors=" << diags_ << std::endl;
}
if (!wrapped_.empty()) {
std::cout << "wrapped=" << wrapped_ << std::endl;
}
if (!localname_.empty()) {
if (is_interface_) {
std::cout << "interface=" << localname_ << std::endl;
} else {
std::cout << "local-addr=" << localname_ << std::endl;
}
}
if (!server_name_.empty()) {
std::cout << "server=" << server_name_ << std::endl;
}
if (single_thread_mode_) {
std::cout << "single-thread-mode" << std::endl;
} else {
std::cout << "multi-thread-mode" << std::endl;
}
}
void
CommandOptions::usage() const {
std::cout <<
"perfdhcp [-huv] [-4|-6] [-A<encapsulation-level>] [-e<lease-type>]\n"
" [-r<rate>] [-f<renew-rate>]\n"
" [-F<release-rate>] [-t<report>] [-C<separator>] [-R<range>]\n"
" [-b<base>] [-n<num-request>] [-p<test-period>] [-d<drop-time>]\n"
" [-D<max-drop>] [-l<local-addr|interface>] [-P<preload>]\n"
" [-L<local-port>] [-N<remote-port>]\n"
" [-o<code,hexstring>] [-s<seed>] [-i] [-B] [-W<late-exit-delay>]\n"
" [-c] [-1] [-M<mac-list-file>] [-T<template-file>]\n"
" [-X<xid-offset>] [-O<random-offset] [-E<time-offset>]\n"
" [-S<srvid-offset>] [-I<ip-offset>] [-x<diagnostic-selector>]\n"
" [-w<wrapped>] [server]\n"
"\n"
"The [server] argument is the name/address of the DHCP server to\n"
"contact. For DHCPv4 operation, exchanges are initiated by\n"
"transmitting a DHCP DISCOVER to this address.\n"
"\n"
"For DHCPv6 operation, exchanges are initiated by transmitting a DHCP\n"
"SOLICIT to this address. In the DHCPv6 case, the special name 'all'\n"
"can be used to refer to All_DHCP_Relay_Agents_and_Servers (the\n"
"multicast address FF02::1:2), or the special name 'servers' to refer\n"
"to All_DHCP_Servers (the multicast address FF05::1:3). The [server]\n"
"argument is optional only in the case that -l is used to specify an\n"
"interface, in which case [server] defaults to 'all'.\n"
"\n"
"The default is to perform a single 4-way exchange, effectively pinging\n"
"the server.\n"
"The -r option is used to set up a performance test, without\n"
"it exchanges are initiated as fast as possible.\n"
"The other scenario is an avalanche which is selected by\n"
"--scenario avalanche. It first sends as many Discovery or Solicit\n"
"messages as request in -R option then back off mechanism is used for\n"
"each simulated client until all requests are answered. At the end\n"
"time of whole scenario is reported.\n"
"\n"
"Options:\n"
"-1: Take the server-ID option from the first received message.\n"
"-4: DHCPv4 operation (default). This is incompatible with the -6 option.\n"
"-6: DHCPv6 operation. This is incompatible with the -4 option.\n"
"-u: Enable checking address uniqueness. Lease valid lifetime\n"
" should not be shorter than test duration.\n"
"-b<base>: The base mac, duid, IP, etc, used to simulate different\n"
" clients. This can be specified multiple times, each instance is\n"
" in the <type>=<value> form, for instance:\n"
" (and default) mac=00:0c:01:02:03:04.\n"
"-d<drop-time>: Specify the time after which a request is treated as\n"
" having been lost. The value is given in seconds and may contain a\n"
" fractional component. The default is 1 second.\n"
"-e<lease-type>: A type of lease being requested from the server. It\n"
" may be one of the following: address-only, prefix-only or\n"
" address-and-prefix. The address-only indicates that the regular\n"
" address (v4 or v6) will be requested. The prefix-only indicates\n"
" that the IPv6 prefix will be requested. The address-and-prefix\n"
" indicates that both IPv6 address and prefix will be requested.\n"
" The '-e prefix-only' and -'e address-and-prefix' must not be\n"
" used with -4.\n"
"-E<time-offset>: Offset of the (DHCPv4) secs field / (DHCPv6)\n"
" elapsed-time option in the (second/request) template.\n"
" The value 0 disables it.\n"
"-f<renew-rate>: Rate at which DHCPv4 or DHCPv6 renew requests are sent\n"
" to a server. This value is only valid when used in conjunction\n"
" with the exchange rate (given by -r<rate>). Furthermore the sum of\n"
" this value and the release-rate (given by -F<rate) must be equal\n"
" to or less than the exchange rate.\n"
"-g: Select thread mode: 'single' or 'multi'. In multi-thread mode packets\n"
" are received in separate thread. This allows better utilisation of CPUs.\n"
" If more than 1 CPU is present then multi-thread mode is the default,\n"
" otherwise single-thread is the default.\n"
"-h: Print this help.\n"
"-i: Do only the initial part of an exchange: DO or SA, depending on\n"
" whether -6 is given.\n"
"-I<ip-offset>: Offset of the (DHCPv4) IP address in the requested-IP\n"
" option / (DHCPv6) IA_NA option in the (second/request) template.\n"
"-J<giaddr-list-file>: Text file that include multiple addresses.\n"
" If provided perfdhcp will choose randomly one of addresses for each\n"
" exchange.\n"
"-l<local-addr|interface>: For DHCPv4 operation, specify the local\n"
" hostname/address to use when communicating with the server. By\n"
" default, the interface address through which traffic would\n"
" normally be routed to the server is used.\n"
" For DHCPv6 operation, specify the name of the network interface\n"
" via which exchanges are initiated.\n"
"-L<local-port>: Specify the local port to use\n"
" (the value 0 means to use the default).\n"
"-M<mac-list-file>: A text file containing a list of MAC addresses,\n"
" one per line. If provided, a MAC address will be chosen randomly\n"
" from this list for every new exchange. In the DHCPv6 case, MAC\n"
" addresses are used to generate DUID-LLs. This parameter must not be\n"
" used in conjunction with the -b parameter.\n"
"-N<remote-port>: Specify the remote port to use\n"
" (the value 0 means to use the default).\n"
"-o<code,hexstring>: Send custom option with the specified code and the\n"
" specified buffer in hexstring format.\n"
"-O<random-offset>: Offset of the last octet to randomize in the template.\n"
"-P<preload>: Initiate first <preload> exchanges back to back at startup.\n"
"-r<rate>: Initiate <rate> DORA/SARR (or if -i is given, DO/SA)\n"
" exchanges per second. A periodic report is generated showing the\n"
" number of exchanges which were not completed, as well as the\n"
" average response latency. The program continues until\n"
" interrupted, at which point a final report is generated.\n"
"-R<range>: Specify how many different clients are used. With 1\n"
" (the default), all requests seem to come from the same client.\n"
"-s<seed>: Specify the seed for randomization, making it repeatable.\n"
"--scenario <name>: where name is 'basic' (default) or 'avalanche'.\n"
"-S<srvid-offset>: Offset of the server-ID option in the\n"
" (second/request) template.\n"
"-T<template-file>: The name of a file containing the template to use\n"
" as a stream of hexadecimal digits.\n"
"-v: Report the version number of this program.\n"
"-W<time>: Specifies exit-wait-time parameter, that makes perfdhcp wait\n"
" for <time> us after an exit condition has been met to receive all\n"
" packets without sending any new packets. Expressed in microseconds.\n"
"-w<wrapped>: Command to call with start/stop at the beginning/end of\n"
" the program.\n"
"-x<diagnostic-selector>: Include extended diagnostics in the output.\n"
" <diagnostic-selector> is a string of single-keywords specifying\n"
" the operations for which verbose output is desired. The selector\n"
" keyletters are:\n"
" * 'a': print the decoded command line arguments\n"
" * 'e': print the exit reason\n"
" * 'i': print rate processing details\n"
" * 's': print first server-id\n"
" * 't': when finished, print timers of all successful exchanges\n"
" * 'T': when finished, print templates\n"
"-X<xid-offset>: Transaction ID (aka. xid) offset in the template.\n"
"-Y<time>: time in seconds after which perfdhcp will start sending\n"
" messages with increased elapsed time option.\n"
"-y<time>: period of time in seconds in which perfdhcp will be sending\n"
" messages with increased elapsed time option.\n"
"DHCPv4 only options:\n"
"-B: Force broadcast handling.\n"
"\n"
"DHCPv6 only options:\n"
"-c: Add a rapid commit option (exchanges will be SA).\n"
"-F<release-rate>: Rate at which IPv6 Release requests are sent to\n"
" a server. This value is only valid when used in conjunction with\n"
" the exchange rate (given by -r<rate>). Furthermore the sum of\n"
" this value and the renew-rate (given by -f<rate) must be equal\n"
" to or less than the exchange rate.\n"
"-A<encapsulation-level>: Specifies that relayed traffic must be\n"
" generated. The argument specifies the level of encapsulation, i.e.\n"
" how many relay agents are simulated. Currently the only supported\n"
" <encapsulation-level> value is 1, which means that the generated\n"
" traffic is an equivalent of the traffic passing through a single\n"
" relay agent.\n"
"\n"
"The remaining options are typically used in conjunction with -r:\n"
"\n"
"-D<max-drop>: Abort the test immediately if max-drop requests have\n"
" been dropped. max-drop must be a positive integer. If max-drop\n"
" includes the suffix '%', it specifies a maximum percentage of\n"
" requests that may be dropped before abort. In this case, testing\n"
" of the threshold begins after 10 requests have been expected to\n"
" be received.\n"
"-n<num-request>: Initiate <num-request> transactions. No report is\n"
" generated until all transactions have been initiated/waited-for,\n"
" after which a report is generated and the program terminates.\n"
"-p<test-period>: Send requests for the given test period, which is\n"
" specified in the same manner as -d. This can be used as an\n"
" alternative to -n, or both options can be given, in which case the\n"
" testing is completed when either limit is reached.\n"
"-t<report>: Delay in seconds between two periodic reports.\n"
"-C<separator>: Output reduced, an argument is a separator for periodic\n"
" (-t) reports generated in easy parsable mode. Data output won't be\n"
" changed, remain identical as in -t option.\n"
"\n"
"Errors:\n"
"- tooshort: received a too short message\n"
"- orphans: received a message which doesn't match an exchange\n"
" (duplicate, late or not related)\n"
"- locallimit: reached to local system limits when sending a message.\n"
"\n"
"Exit status:\n"
"The exit status is:\n"
"0 on complete success.\n"
"1 for a general error.\n"
"2 if an error is found in the command line arguments.\n"
"3 if there are no general failures in operation, but one or more\n"
" exchanges are not successfully completed.\n";
}
void
CommandOptions::version() const {
std::cout << "VERSION: " << VERSION << std::endl;
}
} // namespace perfdhcp
} // namespace isc
| 40.370206 | 139 | 0.564101 | piskyscan |
02e35b35354239e1a7ac3fa5e1e1a8095133d691 | 2,841 | cpp | C++ | app/rtkget_qt/getoptdlg.cpp | mws-rmain/RTKLIB | 3cd1f799b04da433f29473332c250b0518aa762c | [
"BSD-2-Clause"
] | 2 | 2021-11-06T07:23:27.000Z | 2021-11-07T14:29:21.000Z | app/rtkget_qt/getoptdlg.cpp | mws-rmain/RTKLIB | 3cd1f799b04da433f29473332c250b0518aa762c | [
"BSD-2-Clause"
] | null | null | null | app/rtkget_qt/getoptdlg.cpp | mws-rmain/RTKLIB | 3cd1f799b04da433f29473332c250b0518aa762c | [
"BSD-2-Clause"
] | 3 | 2020-09-28T02:42:26.000Z | 2020-09-28T09:01:08.000Z | //---------------------------------------------------------------------------
#include "getoptdlg.h"
#include "getmain.h"
#include <QFileDialog>
#include <QShowEvent>
#include <QIntValidator>
#include <QCompleter>
#include <QFileSystemModel>
extern MainForm *mainForm;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
DownOptDialog::DownOptDialog(QWidget* parent)
: QDialog(parent)
{
setupUi(this);
QCompleter *fileCompleter=new QCompleter(this);
QFileSystemModel *fileModel=new QFileSystemModel(fileCompleter);
fileModel->setRootPath("");
fileCompleter->setModel(fileModel);
UrlFile->setCompleter(fileCompleter);
LogFile->setCompleter(fileCompleter);
connect(BtnCancel,SIGNAL(clicked(bool)),this,SLOT(reject()));
connect(BtnLogFile,SIGNAL(clicked(bool)),this,SLOT(BtnLogFileClick()));
connect(BtnOk,SIGNAL(clicked(bool)),this,SLOT(BtnOkClick()));
connect(BtnUrlFile,SIGNAL(clicked(bool)),this,SLOT(BtnUrlFileClick()));
NCol->setValidator(new QIntValidator(0,9999));
}
//---------------------------------------------------------------------------
void DownOptDialog::BtnUrlFileClick()
{
UrlFile->setText(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this,tr("GNSS Data URL File"))));
}
//---------------------------------------------------------------------------
void DownOptDialog::BtnLogFileClick()
{
LogFile->setText(QDir::toNativeSeparators(QFileDialog::getSaveFileName(this,tr("Download Log File"))));
}
//---------------------------------------------------------------------------
void DownOptDialog::showEvent(QShowEvent *event)
{
if (event->spontaneous()) return;
HoldErr ->setChecked(mainForm->HoldErr);
HoldList ->setChecked(mainForm->HoldList);
NCol ->setText(QString::number(mainForm->NCol));
Proxy ->setText(mainForm->ProxyAddr);
UrlFile ->setText(mainForm->UrlFile);
LogFile ->setText(mainForm->LogFile);
LogAppend->setChecked(mainForm->LogAppend);
DateFormat->setCurrentIndex(mainForm->DateFormat);
TraceLevel->setCurrentIndex(mainForm->TraceLevel);
}
//---------------------------------------------------------------------------
void DownOptDialog::BtnOkClick()
{
mainForm->HoldErr =HoldErr ->isChecked();
mainForm->HoldList =HoldList ->isChecked();
mainForm->NCol =NCol ->text().toInt();
mainForm->ProxyAddr=Proxy ->text();
mainForm->UrlFile =UrlFile ->text();
mainForm->LogFile =LogFile ->text();
mainForm->LogAppend=LogAppend->isChecked();
mainForm->DateFormat=DateFormat->currentIndex();
mainForm->TraceLevel=TraceLevel->currentIndex();
accept();
}
//---------------------------------------------------------------------------
| 36.423077 | 108 | 0.55931 | mws-rmain |
02e51ae1940317f8e02b1331ef02dc27354018cb | 2,358 | hpp | C++ | include/Aether/utils/SDL2_gfx_ext.hpp | NightYoshi370/Aether | 87d2b81f5d3143e39c363a9c81c195d440d7a4e8 | [
"MIT"
] | 9 | 2020-05-06T20:23:22.000Z | 2022-01-19T10:37:46.000Z | include/Aether/utils/SDL2_gfx_ext.hpp | NightYoshi370/Aether | 87d2b81f5d3143e39c363a9c81c195d440d7a4e8 | [
"MIT"
] | 11 | 2020-03-22T03:40:50.000Z | 2020-06-09T00:53:13.000Z | include/Aether/utils/SDL2_gfx_ext.hpp | NightYoshi370/Aether | 87d2b81f5d3143e39c363a9c81c195d440d7a4e8 | [
"MIT"
] | 6 | 2020-05-03T06:59:36.000Z | 2020-07-15T04:21:59.000Z | #ifndef SDL2_GFX_EXT
#define SDL2_GFX_EXT
#include <SDL2/SDL.h>
int thickEllipseRGBA(SDL_Renderer * renderer, Sint16 xc, Sint16 yc, Sint16 xr, Sint16 yr, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 thick);
int thickArcRGBA(SDL_Renderer * renderer, Sint16 xc, Sint16 yc, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 thick);
int thickCircleRGBA(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Uint8 thick);
int thickEllipseColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color, Uint8 thick);
int thickArcColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 thick);
int thickCircleColor(SDL_Renderer * renderer, Sint16 x, Sint16 y, Sint16 rad, Uint32 color, Uint8 thick);
int aaFilledEllipseRGBA(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaFilledEllipseColor(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, Uint32 color);
int aaFilledPolygonRGBA(SDL_Renderer * renderer, const double * vx, const double * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaFilledPolygonColor(SDL_Renderer * renderer, const double * vx, const double * vy, int n, Uint32 color);
int aaFilledPieRGBA(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, float start, float end, Uint32 chord, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaFilledPieColor(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, float start, float end, Uint32 chord, Uint32 color);
int aaArcRGBA(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, float start, float end, float thick, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaArcColor(SDL_Renderer * renderer, float cx, float cy, float rx, float ry, float start, float end, float thick, Uint32 color);
int aaBezierRGBA(SDL_Renderer * renderer, double *x, double *y, int n, int s, float thick, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaBezierColor(SDL_Renderer * renderer, double *x, double *y, int n, int s, float thick, int color);
int aaFilledPolyBezierRGBA(SDL_Renderer * renderer, double *x, double *y, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int aaFilledPolyBezierColor(SDL_Renderer * renderer, double *x, double *y, int n, int s, int color);
#endif | 94.32 | 159 | 0.751484 | NightYoshi370 |
02e636df583bd7fd127a07153f3b4695dc27f1d2 | 2,933 | cpp | C++ | CinemaMaps.cpp | Natan-holanda/POO-UFC | c2a856695f3f1070ade028f70b6fcf9e1018d482 | [
"MIT"
] | null | null | null | CinemaMaps.cpp | Natan-holanda/POO-UFC | c2a856695f3f1070ade028f70b6fcf9e1018d482 | [
"MIT"
] | null | null | null | CinemaMaps.cpp | Natan-holanda/POO-UFC | c2a856695f3f1070ade028f70b6fcf9e1018d482 | [
"MIT"
] | null | null | null | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
class Cliente {
std::string nome;
int id;
int pos;
public :
Cliente (std::string nome = "", int id = 0, int pos = 0) {
this->nome = nome;
this->id = id;
this->pos = pos;
}
std::string getNome() {
return nome;
}
int getId() {
return id;
}
int getPos() {
return pos;
}
void setNome(std::string nome) {
this->nome = nome;
}
void setId(int id) {
this->id = id;
}
void setPos(int pos) {
this->pos = pos;
}
std::string toString() {
std::string texto{this->nome + ":" + std::to_string(this->id) + ":" + std::to_string(this->pos) + " "};
return texto;
}
};
class Cinema {
map <int, Cliente> cadeiras;
public:
Cinema (int capacidade = 0) {
for(int i = 0; i < capacidade; i++) {
cadeiras[i] = Cliente("", 0, i);
}
}
void init(int capacidade) {
for (int i = 0; i < capacidade; i++)
{
cadeiras[i] = Cliente("", 0, i);
}
}
void reservar(Cliente cliente) {
auto it = cadeiras.find(cliente.getPos());
if(it->second.getNome() == "") {
cadeiras[cliente.getPos()] = cliente;
} else {
cout << "fail : cadeira ocupada" << endl;
}
}
void cancelar(string name) {
for(auto it = cadeiras.begin(); it != cadeiras.end(); it++) {
if(it->second.getNome() == name) {
cadeiras[it->first] = Cliente("", 0, it->first);
return;
}
}
cout << "fail : cliente nao esta no cinema" << endl;
}
void imprimir() {
cout << "[";
for(auto it = cadeiras.begin(); it != cadeiras.end(); it++) {
if(it->second.getNome() != "") {
cout << it->second.toString();
}else{
cout << "- ";
}
}
cout << "]" << endl;
}
};
int main() {
Cinema cinema;
Cliente cliente;
while (true) {
string line;
getline(cin, line);
stringstream ss(line);
string command;
ss >> command;
if(command == "reservar") {
string nome;
int id;
int pos;
ss >> nome >> id >> pos;
cliente = Cliente(nome, id, pos);
cinema.reservar(cliente);
} else if(command == "cancelar") {
string nome;
ss >> nome;
cinema.cancelar(nome);
} else if(command == "show") {
cinema.imprimir();
} else if(command == "end") {
break;
}else if(command == "init") {
int capacidade;
ss >> capacidade;
cinema.init(capacidade);
}
}
} | 25.068376 | 111 | 0.458575 | Natan-holanda |
02e7d5d02e81380481cac3ffe38520d690fe2867 | 2,799 | hpp | C++ | rest-server/src/services/logger_interface.hpp | OS-WASABI/CADG | b214edff82d4238e51569a42a6bdfab6806d768f | [
"BSD-3-Clause"
] | null | null | null | rest-server/src/services/logger_interface.hpp | OS-WASABI/CADG | b214edff82d4238e51569a42a6bdfab6806d768f | [
"BSD-3-Clause"
] | 22 | 2018-10-26T17:30:24.000Z | 2019-04-15T23:38:18.000Z | rest-server/src/services/logger_interface.hpp | OS-WASABI/CADG | b214edff82d4238e51569a42a6bdfab6806d768f | [
"BSD-3-Clause"
] | 1 | 2019-03-23T16:02:17.000Z | 2019-03-23T16:02:17.000Z | /// An interface logging.
/**
* This defines the interface for a logger. A logger handles general application
* logging as well as network logging.
*
* Copyright 2018 Vaniya Agrawal, Ross Arcemont, Kristofer Hoadley, Shawn Hulce, Michael McCulley
*
* @file logger_interface.hpp
* @authors Kristofer Hoadley
* @date November, 2018
*/
#ifndef LOGGER_INTERFACE_H
#define LOGGER_INTERFACE_H
#include <string>
#include <vector>
#include <cpprest/http_msg.h>
#include <cpprest/http_listener.h>
using namespace web;
using namespace http;
namespace cadg_rest {
/**
* LoggerInterface defines several ways to log information, as well as netowrk activity.
* This interface must be defines in an inheriting class.
*/
class LoggerInterface {
public:
/// Generic log method.
/**
* @param log_level the log level [ALL, DEBUG, INFO, WARN, ERR, FATAL, OFF].
* @param message what to log.
*/
virtual void Log(int log_level, std::string message) = 0;
/// Generic log method for logging method calls.
/**
* For use within a calling method of a calling class.
* @param log_level The log level [ALL, DEBUG, INFO, WARN, ERR, FATAL, OFF].
* @param message The message to log.
* @param calling_class The class that is calling the method.
* @param calling_method The method that is being called.
*/
virtual void Log(int log_level, std::string message, std::string calling_class,
std::string calling_method) = 0;
/// Generic log method for logging method calls.
/**
* For use within a calling method (that contains arguments) within a calling class.
*
* @param log_level The log level [ALL, DEBUG, INFO, WARN, ERR, FATAL, OFF].
* @param message The message to log.
* @param calling_class The class that is calling the method.
* @param calling_method The method that is being called.
* @param args The method arguments.
*
*/
virtual void Log(int log_level, std::string message, std::string calling_class,
std::string calling_method, std::vector<std::string> args) = 0;
/// Generic log method for logging method calls.
/**
* For use within an http endpoint
* @param message The http request message to log.
* @param endpoint The http request endpoint url to log.
* @param verbosity How much detail to log, higher is more. Currently only
* verbosity of 0 and 1 are defined.
*/
virtual void LogNetworkActivity(http_request message, std::string endpoint, int verbosity = 0) = 0;
/**
* Set the logging level.
* @param log_level the log level [ALL, DEBUG, INFO, WARN, ERR, FATAL, OFF]
*/
virtual void LogLevel(int log_level) = 0;
};
}
#endif // LOGGER_INTERFACE_H
| 37.824324 | 103 | 0.674169 | OS-WASABI |
02ea0b29a0cc34befee3e8e9b63b5e3ff4a7ed27 | 1,267 | hpp | C++ | infra/stream/LimitedInputStream.hpp | oguzcanphilips/embeddedinfralib | f1b083d61a34d123d34ab7cd51267377aa2f7855 | [
"Unlicense"
] | 1 | 2021-05-18T07:21:59.000Z | 2021-05-18T07:21:59.000Z | infra/stream/LimitedInputStream.hpp | oguzcanphilips/embeddedinfralib | f1b083d61a34d123d34ab7cd51267377aa2f7855 | [
"Unlicense"
] | null | null | null | infra/stream/LimitedInputStream.hpp | oguzcanphilips/embeddedinfralib | f1b083d61a34d123d34ab7cd51267377aa2f7855 | [
"Unlicense"
] | null | null | null | #ifndef INFRA_LIMITED_INPUT_STREAM_HPP
#define INFRA_LIMITED_INPUT_STREAM_HPP
#include "infra/stream/InputStream.hpp"
namespace infra
{
class LimitedStreamReader
: public StreamReader
{
public:
LimitedStreamReader(StreamReader& input, uint32_t length);
LimitedStreamReader(const LimitedStreamReader& other);
public:
virtual void Extract(ByteRange range, StreamErrorPolicy& errorPolicy) override;
virtual uint8_t Peek(StreamErrorPolicy& errorPolicy) override;
virtual ConstByteRange ExtractContiguousRange(std::size_t max) override;
virtual ConstByteRange PeekContiguousRange(std::size_t start) override;
virtual bool Empty() const override;
virtual std::size_t Available() const override;
private:
StreamReader& input;
uint32_t length;
};
class LimitedTextInputStream
: public TextInputStream::WithReader<LimitedStreamReader>
{
public:
using TextInputStream::WithReader<LimitedStreamReader>::WithReader;
};
class LimitedDataInputStream
: public DataInputStream::WithReader<LimitedStreamReader>
{
public:
using DataInputStream::WithReader<LimitedStreamReader>::WithReader;
};
}
#endif
| 28.795455 | 87 | 0.719021 | oguzcanphilips |
02eb0c24bccfa926ae99a65c1b81051a05d09128 | 5,145 | hpp | C++ | include/memoria/core/types/typehash.hpp | victor-smirnov/memoria | c36a957c63532176b042b411b1646c536e71a658 | [
"BSL-1.0",
"Apache-2.0",
"OLDAP-2.8",
"BSD-3-Clause"
] | 2 | 2021-07-30T16:54:24.000Z | 2021-09-08T15:48:17.000Z | include/memoria/core/types/typehash.hpp | victor-smirnov/memoria | c36a957c63532176b042b411b1646c536e71a658 | [
"BSL-1.0",
"Apache-2.0",
"OLDAP-2.8",
"BSD-3-Clause"
] | null | null | null | include/memoria/core/types/typehash.hpp | victor-smirnov/memoria | c36a957c63532176b042b411b1646c536e71a658 | [
"BSL-1.0",
"Apache-2.0",
"OLDAP-2.8",
"BSD-3-Clause"
] | 2 | 2020-03-14T15:15:25.000Z | 2020-06-15T11:26:56.000Z |
// Copyright 2011 Victor Smirnov
//
// 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.
#pragma once
#include <memoria/core/types.hpp>
#include <memoria/core/types/typelist.hpp>
#include <memoria/core/tools/bitmap.hpp>
#include <memoria/core/types/static_md5.hpp>
#include <tuple>
namespace memoria {
static constexpr uint8_t SHORT_TYPEHASH_LENGTH_BASE = 250;
struct TypeHashes {
enum {SCALAR = 1, ARRAY, CONST_VALUE};
};
// Type Code value 0 means 'no code'
template <> struct TypeHash<int8_t>: UInt64Value<1> {};
template <> struct TypeHash<uint8_t>: UInt64Value<2> {};
template <> struct TypeHash<int16_t>: UInt64Value<3> {};
template <> struct TypeHash<uint16_t>: UInt64Value<4> {};
template <> struct TypeHash<int32_t>: UInt64Value<5> {};
template <> struct TypeHash<uint32_t>: UInt64Value<6> {};
template <> struct TypeHash<int64_t>: UInt64Value<7> {};
template <> struct TypeHash<uint64_t>: UInt64Value<8> {};
template <> struct TypeHash<float>: UInt64Value<9> {};
template <> struct TypeHash<double>: UInt64Value<10> {};
template <> struct TypeHash<void>: UInt64Value<11> {};
// Core datatypes: 20 - 39
// LinkedData: 40 - 44
// Reserved for Linked Data : 250 - 255
template <
template <typename> class Profile,
typename T
>
struct TypeHash<Profile<T>> {
// FIXME need template assigning unique code to the each profile level
using VList = UInt64List<100, TypeHash<T>::Value>;
static constexpr uint64_t Value = md5::Md5Sum<VList>::Type::Value64;
};
template <uint64_t Base, uint64_t ... Values>
static constexpr uint64_t HashHelper = md5::Md5Sum<UInt64List<Base, Values...>>::Type::Value64;
template <typename T, T V>
struct TypeHash<ConstValue<T, V>> {
static const uint64_t Value = HashHelper<TypeHashV<T>, TypeHashes::CONST_VALUE, V>;
};
template <typename T, size_t Size>
struct TypeHash<T[Size]> {
static const uint64_t Value = HashHelper<TypeHashV<T>, TypeHashes::ARRAY, Size>;
};
template <typename Key, typename Value>
struct TypeHash<CowMap<Key, Value>>: UInt64Value<
HashHelper<1104, TypeHashV<Key>, TypeHashV<Value>>
> {};
template <typename T, Granularity gr>
struct TypeHash<VLen<gr, T>>: UInt64Value<
HashHelper<1113, TypeHashV<T>, static_cast<uint64_t>(gr)>
> {};
template <> struct TypeHash<Root>: UInt64Value<1400> {};
template <int32_t BitsPerSymbol, bool Dense>
struct TypeHash<Sequence<BitsPerSymbol, Dense>>: UInt64Value<HashHelper<1500, BitsPerSymbol, Dense>> {};
template <typename T, Indexed sr>
struct TypeHash<FLabel<T, sr> >: UInt64Value<HashHelper<1610, (uint64_t)sr>> {};
template <int32_t BitsPerSymbol>
struct TypeHash<FBLabel<BitsPerSymbol>>: UInt64Value<HashHelper<1620, BitsPerSymbol>> {};
template <typename T, Indexed sr, Granularity gr>
struct TypeHash<VLabel<T, gr, sr> >: UInt64Value<HashHelper<1630, (uint64_t)sr, (uint64_t)gr>> {};
template <typename... LabelDescriptors>
struct TypeHash<LabeledTree<LabelDescriptors...>> {
private:
using ValueList = typename TypeToValueList<TypeList<LabelDescriptors...>>::Type;
using TaggedValueList = MergeValueLists<UInt64Value<1600>, ValueList>;
public:
static const uint64_t Value = md5::Md5Sum<TaggedValueList>::Type::Value64;
};
template <typename... LabelDescriptors>
struct TypeHash<LabeledTree<TypeList<LabelDescriptors...>>>: TypeHash<LabeledTree<LabelDescriptors...>> {};
template <typename CtrName>
struct TypeHash<CtrWrapper<CtrName>>: UInt32Value<HashHelper<1700, TypeHashV<CtrName>>> {};
template <>
struct TypeHash<WT>: UInt64Value<1800> {};
template <>
struct TypeHash<VTree>: UInt64Value<1900> {};
template <typename... List>
struct TypeHash<TypeList<List...>> {
private:
using ValueList = typename TypeToValueList<TypeList<List...>>::Type;
using TaggedValueList = MergeValueLists<UInt64Value<2000>, ValueList>;
public:
static const uint64_t Value = md5::Md5Sum<TaggedValueList>::Result::Value64;
};
template <typename... List>
struct TypeHash<std::tuple<List...>> {
private:
using ValueList = typename TypeToValueList<TypeList<List...>>::Type;
using TaggedValueList = MergeValueLists<UInt64Value<2001>, ValueList>;
public:
static const uint64_t Value = md5::Md5Sum<TaggedValueList>::Result::Value64;
};
template <typename Key, typename Value>
struct TypeHash<Table<Key, Value, PackedDataTypeSize::FIXED>>: UInt64Value <
HashHelper<3098, TypeHashV<Key>, TypeHashV<Value>>
> {};
template <typename Key, typename Value>
struct TypeHash<Table<Key, Value, PackedDataTypeSize::VARIABLE>>: UInt64Value <
HashHelper<3099, TypeHashV<Key>, TypeHashV<Value>>
> {};
}
| 29.067797 | 107 | 0.727114 | victor-smirnov |
02ee7972294d1553333cb4cf01e0c191fd4dbac0 | 1,328 | cpp | C++ | Ouroboros/Source/oMemory/memcmp4.cpp | jiangzhu1212/oooii | fc00ff81e74adaafd9c98ba7c055f55d95a36e3b | [
"MIT"
] | null | null | null | Ouroboros/Source/oMemory/memcmp4.cpp | jiangzhu1212/oooii | fc00ff81e74adaafd9c98ba7c055f55d95a36e3b | [
"MIT"
] | null | null | null | Ouroboros/Source/oMemory/memcmp4.cpp | jiangzhu1212/oooii | fc00ff81e74adaafd9c98ba7c055f55d95a36e3b | [
"MIT"
] | null | null | null | // Copyright (c) 2014 Antony Arciuolo. See License.txt regarding use.
#include "memduff.h"
namespace ouro {
bool memcmp4(const void* mem, long value, size_t bytes)
{
// Compares a run of memory against a constant value.
// this compares a full int value rather than a char value.
// First move mem up to long alignment
const int32_t* body;
const int8_t* prefix, *postfix;
size_t prefix_nbytes, postfix_nbytes;
detail::init_duffs_device_pointers_const(mem, bytes, &prefix, &prefix_nbytes, &body, &postfix, &postfix_nbytes);
byte_swizzle32 s;
s.as_int = value;
// Duff's device up to alignment: http://en.wikipedia.org/wiki/Duff's_device
switch (prefix_nbytes)
{
case 3: if (*prefix++ != s.as_char[3]) return false;
case 2: if (*prefix++ != s.as_char[2]) return false;
case 1: if (*prefix++ != s.as_char[1]) return false;
default: break;
}
// Do aligned assignment
while (body < (int32_t*)postfix)
if (*body++ != value)
return false;
// Duff's device final bytes: http://en.wikipedia.org/wiki/Duff's_device
switch (postfix_nbytes)
{
case 3: if (*postfix++ != s.as_char[3]) return false;
case 2: if (*postfix++ != s.as_char[2]) return false;
case 1: if (*postfix++ != s.as_char[1]) return false;
default: break;
}
return true;
}
}
| 27.102041 | 114 | 0.662651 | jiangzhu1212 |
02f2e7dd765e5691574e3565a1b326eb34d7fed5 | 32,806 | cc | C++ | base/message_loop/message_pump_win.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2020-12-22T05:48:31.000Z | 2022-02-08T19:49:49.000Z | base/message_loop/message_pump_win.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 4 | 2020-05-22T18:36:43.000Z | 2021-05-19T10:20:23.000Z | base/message_loop/message_pump_win.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-12-06T11:48:16.000Z | 2021-09-16T04:44:47.000Z | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/message_loop/message_pump_win.h"
#include <algorithm>
#include <cstdint>
#include <type_traits>
#include "base/bind.h"
#include "base/debug/alias.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/ranges.h"
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/base_tracing.h"
#include "base/tracing_buildflags.h"
#if BUILDFLAG(ENABLE_BASE_TRACING)
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_message_pump.pbzero.h"
#endif // BUILDFLAG(ENABLE_BASE_TRACING)
namespace base {
namespace {
enum MessageLoopProblems {
MESSAGE_POST_ERROR,
COMPLETION_POST_ERROR,
SET_TIMER_ERROR,
RECEIVED_WM_QUIT_ERROR,
MESSAGE_LOOP_PROBLEM_MAX,
};
// Returns the number of milliseconds before |next_task_time|, clamped between
// zero and the biggest DWORD value (or INFINITE if |next_task_time.is_max()|).
// Optionally, a recent value of Now() may be passed in to avoid resampling it.
DWORD GetSleepTimeoutMs(TimeTicks next_task_time,
TimeTicks recent_now = TimeTicks()) {
// Shouldn't need to sleep or install a timer when there's pending immediate
// work.
DCHECK(!next_task_time.is_null());
if (next_task_time.is_max())
return INFINITE;
auto now = recent_now.is_null() ? TimeTicks::Now() : recent_now;
auto timeout_ms = (next_task_time - now).InMillisecondsRoundedUp();
// A saturated_cast with an unsigned destination automatically clamps negative
// values at zero.
static_assert(!std::is_signed<DWORD>::value, "DWORD is unexpectedly signed");
return saturated_cast<DWORD>(timeout_ms);
}
} // namespace
// Message sent to get an additional time slice for pumping (processing) another
// task (a series of such messages creates a continuous task pump).
static const int kMsgHaveWork = WM_USER + 1;
//-----------------------------------------------------------------------------
// MessagePumpWin public:
MessagePumpWin::MessagePumpWin() = default;
MessagePumpWin::~MessagePumpWin() = default;
void MessagePumpWin::Run(Delegate* delegate) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
RunState s;
s.delegate = delegate;
s.should_quit = false;
s.run_depth = state_ ? state_->run_depth + 1 : 1;
RunState* previous_state = state_;
state_ = &s;
DoRunLoop();
state_ = previous_state;
}
void MessagePumpWin::Quit() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
DCHECK(state_);
state_->should_quit = true;
}
//-----------------------------------------------------------------------------
// MessagePumpForUI public:
MessagePumpForUI::MessagePumpForUI() {
bool succeeded = message_window_.Create(
BindRepeating(&MessagePumpForUI::MessageCallback, Unretained(this)));
DCHECK(succeeded);
}
MessagePumpForUI::~MessagePumpForUI() = default;
void MessagePumpForUI::ScheduleWork() {
// This is the only MessagePumpForUI method which can be called outside of
// |bound_thread_|.
bool not_scheduled = false;
if (!work_scheduled_.compare_exchange_strong(not_scheduled, true))
return; // Someone else continued the pumping.
// Make sure the MessagePump does some work for us.
const BOOL ret = ::PostMessage(message_window_.hwnd(), kMsgHaveWork, 0, 0);
if (ret)
return; // There was room in the Window Message queue.
// We have failed to insert a have-work message, so there is a chance that we
// will starve tasks/timers while sitting in a nested run loop. Nested
// loops only look at Windows Message queues, and don't look at *our* task
// queues, etc., so we might not get a time slice in such. :-(
// We could abort here, but the fear is that this failure mode is plausibly
// common (queue is full, of about 2000 messages), so we'll do a near-graceful
// recovery. Nested loops are pretty transient (we think), so this will
// probably be recoverable.
// Clarify that we didn't really insert.
work_scheduled_ = false;
UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem", MESSAGE_POST_ERROR,
MESSAGE_LOOP_PROBLEM_MAX);
TRACE_EVENT_INSTANT0("base", "Chrome.MessageLoopProblem.MESSAGE_POST_ERROR",
TRACE_EVENT_SCOPE_THREAD);
}
void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// Since this is always called from |bound_thread_|, there is almost always
// nothing to do as the loop is already running. When the loop becomes idle,
// it will typically WaitForWork() in DoRunLoop() with the timeout provided by
// DoWork(). The only alternative to this is entering a native nested loop
// (e.g. modal dialog) under a ScopedNestableTaskAllower, in which case
// HandleWorkMessage() will be invoked when the system picks up kMsgHaveWork
// and it will ScheduleNativeTimer() if it's out of immediate work. However,
// in that alternate scenario : it's possible for a Windows native task (e.g.
// https://docs.microsoft.com/en-us/windows/desktop/winmsg/using-hooks) to
// wake the native nested loop and PostDelayedTask() to the current thread
// from it. This is the only case where we must install/adjust the native
// timer from ScheduleDelayedWork() because if we don't, the native loop will
// go back to sleep, unaware of the new |delayed_work_time|.
// See MessageLoopTest.PostDelayedTaskFromSystemPump for an example.
// TODO(gab): This could potentially be replaced by a ForegroundIdleProc hook
// if Windows ends up being the only platform requiring ScheduleDelayedWork().
if (in_native_loop_ && !work_scheduled_) {
// TODO(gab): Consider passing a NextWorkInfo object to ScheduleDelayedWork
// to take advantage of |recent_now| here too.
ScheduleNativeTimer({delayed_work_time, TimeTicks::Now()});
}
}
void MessagePumpForUI::EnableWmQuit() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
enable_wm_quit_ = true;
}
void MessagePumpForUI::AddObserver(Observer* observer) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
observers_.AddObserver(observer);
}
void MessagePumpForUI::RemoveObserver(Observer* observer) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
observers_.RemoveObserver(observer);
}
//-----------------------------------------------------------------------------
// MessagePumpForUI private:
bool MessagePumpForUI::MessageCallback(
UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
switch (message) {
case kMsgHaveWork:
HandleWorkMessage();
break;
case WM_TIMER:
if (wparam == reinterpret_cast<UINT_PTR>(this))
HandleTimerMessage();
break;
}
return false;
}
void MessagePumpForUI::DoRunLoop() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// IF this was just a simple PeekMessage() loop (servicing all possible work
// queues), then Windows would try to achieve the following order according
// to MSDN documentation about PeekMessage with no filter):
// * Sent messages
// * Posted messages
// * Sent messages (again)
// * WM_PAINT messages
// * WM_TIMER messages
//
// Summary: none of the above classes is starved, and sent messages has twice
// the chance of being processed (i.e., reduced service time).
for (;;) {
// If we do any work, we may create more messages etc., and more work may
// possibly be waiting in another task group. When we (for example)
// ProcessNextWindowsMessage(), there is a good chance there are still more
// messages waiting. On the other hand, when any of these methods return
// having done no work, then it is pretty unlikely that calling them again
// quickly will find any work to do. Finally, if they all say they had no
// work, then it is a good time to consider sleeping (waiting) for more
// work.
in_native_loop_ = false;
bool more_work_is_plausible = ProcessNextWindowsMessage();
in_native_loop_ = false;
if (state_->should_quit)
break;
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
in_native_loop_ = false;
more_work_is_plausible |= next_work_info.is_immediate();
if (state_->should_quit)
break;
if (installed_native_timer_) {
// As described in ScheduleNativeTimer(), the native timer is only
// installed and needed while in a nested native loop. If it is installed,
// it means the above work entered such a loop. Having now resumed, the
// native timer is no longer needed.
KillNativeTimer();
}
if (more_work_is_plausible)
continue;
more_work_is_plausible = state_->delegate->DoIdleWork();
// DoIdleWork() shouldn't end up in native nested loops and thus shouldn't
// have any chance of reinstalling a native timer.
DCHECK(!in_native_loop_);
DCHECK(!installed_native_timer_);
if (state_->should_quit)
break;
if (more_work_is_plausible)
continue;
WaitForWork(next_work_info);
}
}
void MessagePumpForUI::WaitForWork(Delegate::NextWorkInfo next_work_info) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// Wait until a message is available, up to the time needed by the timer
// manager to fire the next set of timers.
DWORD wait_flags = MWMO_INPUTAVAILABLE;
for (DWORD delay = GetSleepTimeoutMs(next_work_info.delayed_run_time,
next_work_info.recent_now);
delay != 0; delay = GetSleepTimeoutMs(next_work_info.delayed_run_time)) {
state_->delegate->BeforeWait();
// Tell the optimizer to retain these values to simplify analyzing hangs.
base::debug::Alias(&delay);
base::debug::Alias(&wait_flags);
DWORD result = MsgWaitForMultipleObjectsEx(0, nullptr, delay, QS_ALLINPUT,
wait_flags);
if (WAIT_OBJECT_0 == result) {
// A WM_* message is available.
// If a parent child relationship exists between windows across threads
// then their thread inputs are implicitly attached.
// This causes the MsgWaitForMultipleObjectsEx API to return indicating
// that messages are ready for processing (Specifically, mouse messages
// intended for the child window may appear if the child window has
// capture).
// The subsequent PeekMessages call may fail to return any messages thus
// causing us to enter a tight loop at times.
// The code below is a workaround to give the child window
// some time to process its input messages by looping back to
// MsgWaitForMultipleObjectsEx above when there are no messages for the
// current thread.
// As in ProcessNextWindowsMessage().
auto scoped_do_native_work = state_->delegate->BeginNativeWork();
{
TRACE_EVENT0("base", "MessagePumpForUI::WaitForWork GetQueueStatus");
if (HIWORD(::GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE)
return;
}
{
MSG msg;
TRACE_EVENT0("base", "MessagePumpForUI::WaitForWork PeekMessage");
if (::PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE))
return;
}
// We know there are no more messages for this thread because PeekMessage
// has returned false. Reset |wait_flags| so that we wait for a *new*
// message.
wait_flags = 0;
}
DCHECK_NE(WAIT_FAILED, result) << GetLastError();
}
}
void MessagePumpForUI::HandleWorkMessage() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// The kMsgHaveWork message was consumed by a native loop, we must assume
// we're in one until DoRunLoop() gets control back.
in_native_loop_ = true;
// If we are being called outside of the context of Run, then don't try to do
// any work. This could correspond to a MessageBox call or something of that
// sort.
if (!state_) {
// Since we handled a kMsgHaveWork message, we must still update this flag.
work_scheduled_ = false;
return;
}
// Let whatever would have run had we not been putting messages in the queue
// run now. This is an attempt to make our dummy message not starve other
// messages that may be in the Windows message queue.
ProcessPumpReplacementMessage();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
if (next_work_info.is_immediate()) {
ScheduleWork();
} else {
state_->delegate->BeforeWait();
ScheduleNativeTimer(next_work_info);
}
}
void MessagePumpForUI::HandleTimerMessage() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// ::KillTimer doesn't remove pending WM_TIMER messages from the queue,
// explicitly ignore the last WM_TIMER message in that case to avoid handling
// work from here when DoRunLoop() is active (which could result in scheduling
// work from two places at once). Note: we're still fine in the event that a
// second native nested loop is entered before such a dead WM_TIMER message is
// discarded because ::SetTimer merely resets the timer if invoked twice with
// the same id.
if (!installed_native_timer_)
return;
// We only need to fire once per specific delay, another timer may be
// scheduled below but we're done with this one.
KillNativeTimer();
// If we are being called outside of the context of Run, then don't do
// anything. This could correspond to a MessageBox call or something of
// that sort.
if (!state_)
return;
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
if (next_work_info.is_immediate()) {
ScheduleWork();
} else {
state_->delegate->BeforeWait();
ScheduleNativeTimer(next_work_info);
}
}
void MessagePumpForUI::ScheduleNativeTimer(
Delegate::NextWorkInfo next_work_info) {
DCHECK(!next_work_info.is_immediate());
DCHECK(in_native_loop_);
// Do not redundantly set the same native timer again if it was already set.
// This can happen when a nested native loop goes idle with pending delayed
// tasks, then gets woken up by an immediate task, and goes back to idle with
// the same pending delay. No need to kill the native timer if there is
// already one but the |delayed_run_time| has changed as ::SetTimer reuses the
// same id and will replace and reset the existing timer.
if (installed_native_timer_ &&
*installed_native_timer_ == next_work_info.delayed_run_time) {
return;
}
if (next_work_info.delayed_run_time.is_max())
return;
// We do not use native Windows timers in general as they have a poor, 10ms,
// granularity. Instead we rely on MsgWaitForMultipleObjectsEx's
// high-resolution timeout to sleep without timers in WaitForWork(). However,
// when entering a nested native ::GetMessage() loop (e.g. native modal
// windows) under a ScopedNestableTaskAllower, we have to rely on a native
// timer when HandleWorkMessage() runs out of immediate work. Since
// ScopedNestableTaskAllower invokes ScheduleWork() : we are guaranteed that
// HandleWorkMessage() will be called after entering a nested native loop that
// should process application tasks. But once HandleWorkMessage() is out of
// immediate work, ::SetTimer() is used to guarantee we are invoked again
// should the next delayed task expire before the nested native loop ends. The
// native timer being unnecessary once we return to our DoRunLoop(), we
// ::KillTimer when it resumes (nested native loops should be rare so we're
// not worried about ::SetTimer<=>::KillTimer churn).
// TODO(gab): The long-standing legacy dependency on the behavior of
// ScopedNestableTaskAllower is unfortunate, would be nice to make this a
// MessagePump concept (instead of requiring impls to invoke ScheduleWork()
// one-way and no-op DoWork() the other way).
UINT delay_msec = strict_cast<UINT>(GetSleepTimeoutMs(
next_work_info.delayed_run_time, next_work_info.recent_now));
if (delay_msec == 0) {
ScheduleWork();
} else {
// TODO(gab): ::SetTimer()'s documentation claims it does this for us.
// Consider removing this safety net.
delay_msec = ClampToRange(delay_msec, UINT(USER_TIMER_MINIMUM),
UINT(USER_TIMER_MAXIMUM));
// Tell the optimizer to retain the delay to simplify analyzing hangs.
base::debug::Alias(&delay_msec);
const UINT_PTR ret =
::SetTimer(message_window_.hwnd(), reinterpret_cast<UINT_PTR>(this),
delay_msec, nullptr);
if (ret) {
installed_native_timer_ = next_work_info.delayed_run_time;
return;
}
// This error is likely similar to MESSAGE_POST_ERROR (i.e. native queue is
// full). Since we only use ScheduleNativeTimer() in native nested loops
// this likely means this pump will not be given a chance to run application
// tasks until the nested loop completes.
UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem", SET_TIMER_ERROR,
MESSAGE_LOOP_PROBLEM_MAX);
TRACE_EVENT_INSTANT0("base", "Chrome.MessageLoopProblem.SET_TIMER_ERROR",
TRACE_EVENT_SCOPE_THREAD);
}
}
void MessagePumpForUI::KillNativeTimer() {
DCHECK(installed_native_timer_);
const bool success =
::KillTimer(message_window_.hwnd(), reinterpret_cast<UINT_PTR>(this));
DPCHECK(success);
installed_native_timer_.reset();
}
bool MessagePumpForUI::ProcessNextWindowsMessage() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
MSG msg;
bool has_msg = false;
bool more_work_is_plausible = false;
{
// ::PeekMessage() may process sent and/or internal messages (regardless of
// |had_messages| as ::GetQueueStatus() is an optimistic check that may
// racily have missed an incoming event -- it doesn't hurt to have empty
// internal units of work when ::PeekMessage turns out to be a no-op).
// Instantiate |scoped_do_native_work| ahead of GetQueueStatus() so that
// trace events it emits fully outscope GetQueueStatus' events
// (GetQueueStatus() itself not being expected to do work; it's fine to use
// only on ScopedDoNativeWork for both calls -- we trace them independently
// just in case internal work stalls).
auto scoped_do_native_work = state_->delegate->BeginNativeWork();
{
// Individually trace ::GetQueueStatus and ::PeekMessage because sampling
// profiler is hinting that we're spending a surprising amount of time
// with these on top of the stack. Tracing will be able to tell us whether
// this is a bias of sampling profiler (e.g. kernel takes ::GetQueueStatus
// as an opportunity to swap threads and is more likely to schedule the
// sampling profiler's thread while the sampled thread is swapped out on
// this frame).
TRACE_EVENT0(
"base", "MessagePumpForUI::ProcessNextWindowsMessage GetQueueStatus");
DWORD queue_status = ::GetQueueStatus(QS_SENDMESSAGE);
// If there are sent messages in the queue then PeekMessage internally
// dispatches the message and returns false. We return true in this case
// to ensure that the message loop peeks again instead of calling
// MsgWaitForMultipleObjectsEx.
if (HIWORD(queue_status) & QS_SENDMESSAGE)
more_work_is_plausible = true;
}
{
// PeekMessage can run a message if there are sent messages, trace that
// and emit the boolean param to see if it ever janks independently (ref.
// comment on GetQueueStatus).
TRACE_EVENT(
"base", "MessagePumpForUI::ProcessNextWindowsMessage PeekMessage",
[&](perfetto::EventContext ctx) {
perfetto::protos::pbzero::ChromeMessagePump* msg_pump_data =
ctx.event()->set_chrome_message_pump();
msg_pump_data->set_sent_messages_in_queue(more_work_is_plausible);
});
has_msg = ::PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) != FALSE;
}
}
if (has_msg)
more_work_is_plausible |= ProcessMessageHelper(msg);
return more_work_is_plausible;
}
bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
TRACE_EVENT1("base,toplevel", "MessagePumpForUI::ProcessMessageHelper",
"message", msg.message);
if (msg.message == WM_QUIT) {
// WM_QUIT is the standard way to exit a ::GetMessage() loop. Our
// MessageLoop has its own quit mechanism, so WM_QUIT should only terminate
// it if |enable_wm_quit_| is explicitly set (and is generally unexpected
// otherwise).
if (enable_wm_quit_) {
state_->should_quit = true;
return false;
}
UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem",
RECEIVED_WM_QUIT_ERROR, MESSAGE_LOOP_PROBLEM_MAX);
return true;
}
// While running our main message pump, we discard kMsgHaveWork messages.
if (msg.message == kMsgHaveWork && msg.hwnd == message_window_.hwnd())
return ProcessPumpReplacementMessage();
auto scoped_do_native_work = state_->delegate->BeginNativeWork();
for (Observer& observer : observers_)
observer.WillDispatchMSG(msg);
::TranslateMessage(&msg);
::DispatchMessage(&msg);
for (Observer& observer : observers_)
observer.DidDispatchMSG(msg);
return true;
}
bool MessagePumpForUI::ProcessPumpReplacementMessage() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// When we encounter a kMsgHaveWork message, this method is called to peek and
// process a replacement message. The goal is to make the kMsgHaveWork as non-
// intrusive as possible, even though a continuous stream of such messages are
// posted. This method carefully peeks a message while there is no chance for
// a kMsgHaveWork to be pending, then resets the |have_work_| flag (allowing a
// replacement kMsgHaveWork to possibly be posted), and finally dispatches
// that peeked replacement. Note that the re-post of kMsgHaveWork may be
// asynchronous to this thread!!
MSG msg;
bool have_message = false;
{
// ::PeekMessage may process internal events. Consider it native work.
auto scoped_do_native_work = state_->delegate->BeginNativeWork();
TRACE_EVENT0("base",
"MessagePumpForUI::ProcessPumpReplacementMessage PeekMessage");
// The system headers don't define PM_QS_ALLEVENTS; it's equivalent to
// PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE. i.e., anything but
// QS_SENDMESSAGE.
// Since we're looking to replace our kMsgHaveWork posted message, we can
// ignore sent messages (which never compete with posted messages in the
// initial PeekMessage call).
constexpr auto PM_QS_ALLEVENTS = QS_ALLEVENTS << 16;
static_assert(
PM_QS_ALLEVENTS == (PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE), "");
static_assert((PM_QS_ALLEVENTS & PM_QS_SENDMESSAGE) == 0, "");
have_message = ::PeekMessage(&msg, nullptr, 0, 0,
PM_REMOVE | PM_QS_ALLEVENTS) != FALSE;
}
// Expect no message or a message different than kMsgHaveWork.
DCHECK(!have_message || kMsgHaveWork != msg.message ||
msg.hwnd != message_window_.hwnd());
// Since we discarded a kMsgHaveWork message, we must update the flag.
DCHECK(work_scheduled_);
work_scheduled_ = false;
// We don't need a special time slice if we didn't |have_message| to process.
if (!have_message)
return false;
if (msg.message == WM_QUIT) {
// If we're in a nested ::GetMessage() loop then we must let that loop see
// the WM_QUIT in order for it to exit. If we're in DoRunLoop then the re-
// posted WM_QUIT will be either ignored, or handled, by
// ProcessMessageHelper() called directly from ProcessNextWindowsMessage().
::PostQuitMessage(static_cast<int>(msg.wParam));
// Note: we *must not* ScheduleWork() here as WM_QUIT is a low-priority
// message on Windows (it is only returned by ::PeekMessage() when idle) :
// https://blogs.msdn.microsoft.com/oldnewthing/20051104-33/?p=33453. As
// such posting a kMsgHaveWork message via ScheduleWork() would cause an
// infinite loop (kMsgHaveWork message handled first means we end up here
// again and repost WM_QUIT+ScheduleWork() again, etc.). Not leaving a
// kMsgHaveWork message behind however is also problematic as unwinding
// multiple layers of nested ::GetMessage() loops can result in starving
// application tasks. TODO(https://crbug.com/890016) : Fix this.
// The return value is mostly irrelevant but return true like we would after
// processing a QuitClosure() task.
return true;
} else if (msg.message == WM_TIMER &&
msg.wParam == reinterpret_cast<UINT_PTR>(this)) {
// This happens when a native nested loop invokes HandleWorkMessage() =>
// ProcessPumpReplacementMessage() which finds the WM_TIMER message
// installed by ScheduleNativeTimer(). That message needs to be handled
// directly as handing it off to ProcessMessageHelper() below would cause an
// unnecessary ScopedDoNativeWork which may incorrectly lead the Delegate's
// heuristics to conclude that the DoWork() in HandleTimerMessage() is
// nested inside a native task. It's also safe to skip the below
// ScheduleWork() as it is not mandatory before invoking DoWork() and
// HandleTimerMessage() handles re-installing the necessary followup
// messages.
HandleTimerMessage();
return true;
}
// Guarantee we'll get another time slice in the case where we go into native
// windows code. This ScheduleWork() may hurt performance a tiny bit when
// tasks appear very infrequently, but when the event queue is busy, the
// kMsgHaveWork events get (percentage wise) rarer and rarer.
ScheduleWork();
return ProcessMessageHelper(msg);
}
//-----------------------------------------------------------------------------
// MessagePumpForIO public:
MessagePumpForIO::IOContext::IOContext() {
memset(&overlapped, 0, sizeof(overlapped));
}
MessagePumpForIO::IOHandler::IOHandler(const Location& from_here)
: io_handler_location_(from_here) {}
MessagePumpForIO::IOHandler::~IOHandler() = default;
MessagePumpForIO::MessagePumpForIO() {
port_.Set(::CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr,
reinterpret_cast<ULONG_PTR>(nullptr), 1));
DCHECK(port_.IsValid());
}
MessagePumpForIO::~MessagePumpForIO() = default;
void MessagePumpForIO::ScheduleWork() {
// This is the only MessagePumpForIO method which can be called outside of
// |bound_thread_|.
bool not_scheduled = false;
if (!work_scheduled_.compare_exchange_strong(not_scheduled, true))
return; // Someone else continued the pumping.
// Make sure the MessagePump does some work for us.
const BOOL ret = ::PostQueuedCompletionStatus(
port_.Get(), 0, reinterpret_cast<ULONG_PTR>(this),
reinterpret_cast<OVERLAPPED*>(this));
if (ret)
return; // Post worked perfectly.
// See comment in MessagePumpForUI::ScheduleWork() for this error recovery.
work_scheduled_ = false; // Clarify that we didn't succeed.
UMA_HISTOGRAM_ENUMERATION("Chrome.MessageLoopProblem", COMPLETION_POST_ERROR,
MESSAGE_LOOP_PROBLEM_MAX);
TRACE_EVENT_INSTANT0("base",
"Chrome.MessageLoopProblem.COMPLETION_POST_ERROR",
TRACE_EVENT_SCOPE_THREAD);
}
void MessagePumpForIO::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// Since this is always called from |bound_thread_|, there is nothing to do as
// the loop is already running. It will WaitForWork() in
// DoRunLoop() with the correct timeout when it's out of immediate tasks.
}
HRESULT MessagePumpForIO::RegisterIOHandler(HANDLE file_handle,
IOHandler* handler) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
HANDLE port = ::CreateIoCompletionPort(
file_handle, port_.Get(), reinterpret_cast<ULONG_PTR>(handler), 1);
return (port != nullptr) ? S_OK : HRESULT_FROM_WIN32(GetLastError());
}
bool MessagePumpForIO::RegisterJobObject(HANDLE job_handle,
IOHandler* handler) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
JOBOBJECT_ASSOCIATE_COMPLETION_PORT info;
info.CompletionKey = handler;
info.CompletionPort = port_.Get();
return ::SetInformationJobObject(job_handle,
JobObjectAssociateCompletionPortInformation,
&info, sizeof(info)) != FALSE;
}
//-----------------------------------------------------------------------------
// MessagePumpForIO private:
void MessagePumpForIO::DoRunLoop() {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
for (;;) {
// If we do any work, we may create more messages etc., and more work may
// possibly be waiting in another task group. When we (for example)
// WaitForIOCompletion(), there is a good chance there are still more
// messages waiting. On the other hand, when any of these methods return
// having done no work, then it is pretty unlikely that calling them
// again quickly will find any work to do. Finally, if they all say they
// had no work, then it is a good time to consider sleeping (waiting) for
// more work.
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
bool more_work_is_plausible = next_work_info.is_immediate();
if (state_->should_quit)
break;
state_->delegate->BeforeWait();
more_work_is_plausible |= WaitForIOCompletion(0);
if (state_->should_quit)
break;
if (more_work_is_plausible)
continue;
more_work_is_plausible = state_->delegate->DoIdleWork();
if (state_->should_quit)
break;
if (more_work_is_plausible)
continue;
state_->delegate->BeforeWait();
WaitForWork(next_work_info);
}
}
// Wait until IO completes, up to the time needed by the timer manager to fire
// the next set of timers.
void MessagePumpForIO::WaitForWork(Delegate::NextWorkInfo next_work_info) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
// We do not support nested IO message loops. This is to avoid messy
// recursion problems.
DCHECK_EQ(1, state_->run_depth) << "Cannot nest an IO message loop!";
DWORD timeout = GetSleepTimeoutMs(next_work_info.delayed_run_time,
next_work_info.recent_now);
// Tell the optimizer to retain these values to simplify analyzing hangs.
base::debug::Alias(&timeout);
WaitForIOCompletion(timeout);
}
bool MessagePumpForIO::WaitForIOCompletion(DWORD timeout) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
IOItem item;
if (!GetIOItem(timeout, &item))
return false;
if (ProcessInternalIOItem(item))
return true;
TRACE_EVENT(
"base,toplevel", "IOHandler::OnIOCompleted",
[&](perfetto::EventContext ctx) {
ctx.event()->set_chrome_message_pump()->set_io_handler_location_iid(
base::trace_event::InternedSourceLocation::Get(
&ctx, base::trace_event::TraceSourceLocation(
item.handler->io_handler_location())));
});
Delegate::ScopedDoNativeWork scoped_do_native_work(
state_->delegate->BeginNativeWork());
item.handler->OnIOCompleted(item.context, item.bytes_transfered, item.error);
return true;
}
// Asks the OS for another IO completion result.
bool MessagePumpForIO::GetIOItem(DWORD timeout, IOItem* item) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
memset(item, 0, sizeof(*item));
ULONG_PTR key = reinterpret_cast<ULONG_PTR>(nullptr);
OVERLAPPED* overlapped = nullptr;
if (!::GetQueuedCompletionStatus(port_.Get(), &item->bytes_transfered, &key,
&overlapped, timeout)) {
if (!overlapped)
return false; // Nothing in the queue.
item->error = GetLastError();
item->bytes_transfered = 0;
}
item->handler = reinterpret_cast<IOHandler*>(key);
item->context = reinterpret_cast<IOContext*>(overlapped);
return true;
}
bool MessagePumpForIO::ProcessInternalIOItem(const IOItem& item) {
DCHECK_CALLED_ON_VALID_THREAD(bound_thread_);
if (reinterpret_cast<void*>(this) == reinterpret_cast<void*>(item.context) &&
reinterpret_cast<void*>(this) == reinterpret_cast<void*>(item.handler)) {
// This is our internal completion.
DCHECK(!item.bytes_transfered);
work_scheduled_ = false;
return true;
}
return false;
}
} // namespace base
| 39.668682 | 94 | 0.703652 | blockspacer |
02f6134e7c0329203cce9b5369b63d189093b5ad | 50,126 | cpp | C++ | LAVFilters/decoder/LAVVideo/decoders/dxva2dec.cpp | lcmftianci/licodeanalysis | 62e2722eba1b75ef82f7c1328585873d08bb41cc | [
"Apache-2.0"
] | 2 | 2019-11-17T14:01:21.000Z | 2019-12-24T14:29:45.000Z | LAVFilters/decoder/LAVVideo/decoders/dxva2dec.cpp | lcmftianci/licodeanalysis | 62e2722eba1b75ef82f7c1328585873d08bb41cc | [
"Apache-2.0"
] | null | null | null | LAVFilters/decoder/LAVVideo/decoders/dxva2dec.cpp | lcmftianci/licodeanalysis | 62e2722eba1b75ef82f7c1328585873d08bb41cc | [
"Apache-2.0"
] | 3 | 2019-08-28T14:37:01.000Z | 2020-06-17T16:46:32.000Z | /*
* Copyright (C) 2011-2019 Hendrik Leppkes
* http://www.1f0.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Basic concept based on VLC DXVA2 decoder, licensed under GPLv2
*/
#include "stdafx.h"
#include "dxva2dec.h"
#include "dxva2/dxva_common.h"
#include "dxva2/DXVA2SurfaceAllocator.h"
#include "moreuuids.h"
#include "Media.h"
#include <Shlwapi.h>
#include <dxva2api.h>
#include <evr.h>
#include "libavcodec/dxva2.h"
#include "gpu_memcpy_sse4.h"
#include <ppl.h>
////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////
ILAVDecoder *CreateDecoderDXVA2() {
return new CDecDXVA2();
}
ILAVDecoder *CreateDecoderDXVA2Native() {
CDecDXVA2 *dec = new CDecDXVA2();
dec->SetNativeMode(TRUE);
return dec;
}
HRESULT VerifyD3D9Device(DWORD & dwIndex, DWORD dwDeviceId)
{
HRESULT hr = S_OK;
IDirect3D9 * pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if (!pD3D)
return E_FAIL;
D3DADAPTER_IDENTIFIER9 d3dai = { 0 };
// Check the combination of adapter and device id
hr = pD3D->GetAdapterIdentifier(dwIndex, 0, &d3dai);
if (hr == D3D_OK && d3dai.DeviceId == dwDeviceId)
goto done;
// find an adapter with the specified device id
for (UINT i = 0; i < pD3D->GetAdapterCount(); i++) {
hr = pD3D->GetAdapterIdentifier(i, 0, &d3dai);
if (hr == D3D_OK && d3dai.DeviceId == dwDeviceId) {
dwIndex = i;
goto done;
}
}
// fail otherwise
hr = E_FAIL;
done:
SafeRelease(&pD3D);
return hr;
}
// List of PCI Device ID of ATI cards with UVD or UVD+ decoding block.
static DWORD UVDDeviceID [] = {
0x94C7, // ATI Radeon HD 2350
0x94C1, // ATI Radeon HD 2400 XT
0x94CC, // ATI Radeon HD 2400 Series
0x958A, // ATI Radeon HD 2600 X2 Series
0x9588, // ATI Radeon HD 2600 XT
0x9405, // ATI Radeon HD 2900 GT
0x9400, // ATI Radeon HD 2900 XT
0x9611, // ATI Radeon 3100 Graphics
0x9610, // ATI Radeon HD 3200 Graphics
0x9614, // ATI Radeon HD 3300 Graphics
0x95C0, // ATI Radeon HD 3400 Series (and others)
0x95C5, // ATI Radeon HD 3400 Series (and others)
0x95C4, // ATI Radeon HD 3400 Series (and others)
0x94C3, // ATI Radeon HD 3410
0x9589, // ATI Radeon HD 3600 Series (and others)
0x9598, // ATI Radeon HD 3600 Series (and others)
0x9591, // ATI Radeon HD 3600 Series (and others)
0x9501, // ATI Radeon HD 3800 Series (and others)
0x9505, // ATI Radeon HD 3800 Series (and others)
0x9507, // ATI Radeon HD 3830
0x9513, // ATI Radeon HD 3850 X2
0x950F, // ATI Radeon HD 3850 X2
0x0000
};
static int IsAMDUVD(DWORD dwDeviceId)
{
for (int i = 0; UVDDeviceID[i] != 0; i++) {
if (UVDDeviceID[i] == dwDeviceId)
return 1;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// DXVA2 decoder implementation
////////////////////////////////////////////////////////////////////////////////
static void (*CopyFrameNV12)(const BYTE *pSourceData, BYTE *pY, BYTE *pUV, size_t surfaceHeight, size_t imageHeight, size_t pitch) = nullptr;
static void CopyFrameNV12_fallback(const BYTE *pSourceData, BYTE *pY, BYTE *pUV, size_t surfaceHeight, size_t imageHeight, size_t pitch)
{
const size_t size = imageHeight * pitch;
memcpy(pY, pSourceData, size);
memcpy(pUV, pSourceData + (surfaceHeight * pitch), size >> 1);
}
static void CopyFrameNV12_fallback_MT(const BYTE *pSourceData, BYTE *pY, BYTE *pUV, size_t surfaceHeight, size_t imageHeight, size_t pitch)
{
const size_t halfSize = (imageHeight * pitch) >> 1;
Concurrency::parallel_for(0, 3, [&](int i) {
if (i < 2)
memcpy(pY + (halfSize * i), pSourceData + (halfSize * i), halfSize);
else
memcpy(pUV, pSourceData + (surfaceHeight * pitch), halfSize);
});
}
static void CopyFrameNV12_SSE4(const BYTE *pSourceData, BYTE *pY, BYTE *pUV, size_t surfaceHeight, size_t imageHeight, size_t pitch)
{
const size_t size = imageHeight * pitch;
gpu_memcpy(pY, pSourceData, size);
gpu_memcpy(pUV, pSourceData + (surfaceHeight * pitch), size >> 1);
}
static void CopyFrameNV12_SSE4_MT(const BYTE *pSourceData, BYTE *pY, BYTE *pUV, size_t surfaceHeight, size_t imageHeight, size_t pitch)
{
const size_t halfSize = (imageHeight * pitch) >> 1;
Concurrency::parallel_for(0, 3, [&](int i) {
if (i < 2)
gpu_memcpy(pY + (halfSize * i), pSourceData + (halfSize * i), halfSize);
else
gpu_memcpy(pUV, pSourceData + (surfaceHeight * pitch), halfSize);
});
}
CDecDXVA2::CDecDXVA2(void)
: CDecAvcodec()
{
ZeroMemory(&dx, sizeof(dx));
ZeroMemory(&m_pSurfaces, sizeof(m_pSurfaces));
ZeroMemory(&m_pRawSurface, sizeof(m_pRawSurface));
ZeroMemory(&m_FrameQueue, sizeof(m_FrameQueue));
ZeroMemory(&m_DXVAVideoDecoderConfig, sizeof(m_DXVAVideoDecoderConfig));
}
CDecDXVA2::~CDecDXVA2(void)
{
DestroyDecoder(true);
if (m_pDXVA2Allocator)
m_pDXVA2Allocator->DecoderDestruct();
}
STDMETHODIMP CDecDXVA2::DestroyDecoder(bool bFull, bool bNoAVCodec)
{
for (int i = 0; i < DXVA2_QUEUE_SURFACES; i++) {
ReleaseFrame(&m_FrameQueue[i]);
}
m_pCallback->ReleaseAllDXVAResources();
for (int i = 0; i < m_NumSurfaces; i++) {
SafeRelease(&m_pSurfaces[i].d3d);
}
m_NumSurfaces = 0;
SafeRelease(&m_pDecoder);
if (!bNoAVCodec) {
CDecAvcodec::DestroyDecoder();
}
if (bFull) {
FreeD3DResources();
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::FreeD3DResources()
{
SafeRelease(&m_pDXVADecoderService);
if (m_pD3DDevMngr && m_hDevice != INVALID_HANDLE_VALUE)
m_pD3DDevMngr->CloseDeviceHandle(m_hDevice);
m_hDevice = INVALID_HANDLE_VALUE;
SafeRelease(&m_pD3DDevMngr);
SafeRelease(&m_pD3DDev);
SafeRelease(&m_pD3D);
if (dx.d3dlib) {
FreeLibrary(dx.d3dlib);
dx.d3dlib = nullptr;
}
if (dx.dxva2lib) {
FreeLibrary(dx.dxva2lib);
dx.dxva2lib = nullptr;
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::InitAllocator(IMemAllocator **ppAlloc)
{
HRESULT hr = S_OK;
if (!m_bNative)
return E_NOTIMPL;
m_pDXVA2Allocator = new CDXVA2SurfaceAllocator(this, &hr);
if (!m_pDXVA2Allocator) {
return E_OUTOFMEMORY;
}
if (FAILED(hr)) {
SAFE_DELETE(m_pDXVA2Allocator);
return hr;
}
return m_pDXVA2Allocator->QueryInterface(__uuidof(IMemAllocator), (void **)ppAlloc);
}
STDMETHODIMP CDecDXVA2::PostConnect(IPin *pPin)
{
HRESULT hr = S_OK;
if (!m_bNative && m_pD3DDevMngr)
return S_OK;
DbgLog((LOG_TRACE, 10, L"CDecDXVA2::PostConnect()"));
IMFGetService *pGetService = nullptr;
hr = pPin->QueryInterface(__uuidof(IMFGetService), (void**)&pGetService);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> IMFGetService not available"));
goto done;
}
// Release old D3D resources, we're about to re-init
m_pCallback->ReleaseAllDXVAResources();
FreeD3DResources();
// Get the Direct3D device manager.
hr = pGetService->GetService(MR_VIDEO_ACCELERATION_SERVICE, __uuidof(IDirect3DDeviceManager9), (void**)&m_pD3DDevMngr);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> D3D Device Manager not available"));
goto done;
}
hr = SetD3DDeviceManager(m_pD3DDevMngr);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> Setting D3D Device Manager failed"));
goto done;
}
if (m_bNative) {
if (!m_pDecoder) {
// If this is the first call, re-align surfaces, as the requirements may only be known now
m_dwSurfaceWidth = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_width);
m_dwSurfaceHeight = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_height);
}
CMediaType mt = m_pCallback->GetOutputMediaType();
if ( (m_eSurfaceFormat == FOURCC_NV12 && mt.subtype != MEDIASUBTYPE_NV12)
|| (m_eSurfaceFormat == FOURCC_P010 && mt.subtype != MEDIASUBTYPE_P010)
|| (m_eSurfaceFormat == FOURCC_P016 && mt.subtype != MEDIASUBTYPE_P016)) {
DbgLog((LOG_ERROR, 10, L"-> Connection is not the appropriate pixel format for DXVA2 Native"));
hr = E_FAIL;
goto done;
}
hr = DXVA2NotifyEVR();
}
done:
SafeRelease(&pGetService);
if (FAILED(hr)) {
FreeD3DResources();
}
return hr;
}
HRESULT CDecDXVA2::DXVA2NotifyEVR()
{
HRESULT hr = S_OK;
IMFGetService *pGetService = nullptr;
IDirectXVideoMemoryConfiguration *pVideoConfig = nullptr;
hr = m_pCallback->GetOutputPin()->GetConnected()->QueryInterface(&pGetService);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> IMFGetService not available"));
goto done;
}
// Configure EVR for receiving DXVA2 samples
hr = pGetService->GetService(MR_VIDEO_ACCELERATION_SERVICE, __uuidof(IDirectXVideoMemoryConfiguration), (void**)&pVideoConfig);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> IDirectXVideoMemoryConfiguration not available"));
goto done;
}
// Notify the EVR about the format we're sending
DXVA2_SurfaceType surfaceType;
for (DWORD iTypeIndex = 0; ; iTypeIndex++) {
hr = pVideoConfig->GetAvailableSurfaceTypeByIndex(iTypeIndex, &surfaceType);
if (FAILED(hr)) {
hr = S_OK;
break;
}
if (surfaceType == DXVA2_SurfaceType_DecoderRenderTarget) {
hr = pVideoConfig->SetSurfaceType(DXVA2_SurfaceType_DecoderRenderTarget);
break;
}
}
done:
SafeRelease(&pGetService);
SafeRelease(&pVideoConfig);
return hr;
}
STDMETHODIMP CDecDXVA2::LoadDXVA2Functions()
{
// Load D3D9 library
dx.d3dlib = LoadLibrary(L"d3d9.dll");
if (dx.d3dlib == nullptr) {
DbgLog((LOG_TRACE, 10, L"-> Loading d3d9.dll failed"));
return E_FAIL;
}
dx.direct3DCreate9Ex = (pDirect3DCreate9Ex *)GetProcAddress(dx.d3dlib, "Direct3DCreate9Ex");
// Load DXVA2 library
dx.dxva2lib = LoadLibrary(L"dxva2.dll");
if (dx.dxva2lib == nullptr) {
DbgLog((LOG_TRACE, 10, L"-> Loading dxva2.dll failed"));
return E_FAIL;
}
dx.createDeviceManager = (pCreateDeviceManager9 *)GetProcAddress(dx.dxva2lib, "DXVA2CreateDirect3DDeviceManager9");
if (dx.createDeviceManager == nullptr) {
DbgLog((LOG_TRACE, 10, L"-> DXVA2CreateDirect3DDeviceManager9 unavailable"));
return E_FAIL;
}
return S_OK;
}
#define VEND_ID_ATI 0x1002
#define VEND_ID_NVIDIA 0x10DE
#define VEND_ID_INTEL 0x8086
static const struct {
unsigned id;
char name[32];
} vendors [] = {
{ VEND_ID_ATI, "ATI" },
{ VEND_ID_NVIDIA, "NVIDIA" },
{ VEND_ID_INTEL, "Intel" },
{ 0, "" }
};
HRESULT CDecDXVA2::CreateD3DDeviceManager(IDirect3DDevice9 *pDevice, UINT *pReset, IDirect3DDeviceManager9 **ppManager)
{
UINT resetToken = 0;
IDirect3DDeviceManager9 *pD3DManager = nullptr;
HRESULT hr = dx.createDeviceManager(&resetToken, &pD3DManager);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> DXVA2CreateDirect3DDeviceManager9 failed"));
goto done;
}
hr = pD3DManager->ResetDevice(pDevice, resetToken);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> ResetDevice failed"));
goto done;
}
*ppManager = pD3DManager;
(*ppManager)->AddRef();
*pReset = resetToken;
done:
SafeRelease(&pD3DManager);
return hr;
}
HRESULT CDecDXVA2::CreateDXVAVideoService(IDirect3DDeviceManager9 *pManager, IDirectXVideoDecoderService **ppService)
{
HRESULT hr = S_OK;
IDirectXVideoDecoderService *pService = nullptr;
hr = pManager->OpenDeviceHandle(&m_hDevice);
if (FAILED(hr)) {
m_hDevice = INVALID_HANDLE_VALUE;
DbgLog((LOG_ERROR, 10, L"-> OpenDeviceHandle failed"));
goto done;
}
hr = pManager->GetVideoService(m_hDevice, IID_IDirectXVideoDecoderService, (void**)&pService);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> Acquiring VideoDecoderService failed"));
goto done;
}
(*ppService) = pService;
done:
return hr;
}
HRESULT CDecDXVA2::FindVideoServiceConversion(AVCodecID codec, int profile, GUID *input, D3DFORMAT *output)
{
HRESULT hr = S_OK;
UINT count = 0;
GUID *input_list = nullptr;
/* Gather the format supported by the decoder */
hr = m_pDXVADecoderService->GetDecoderDeviceGuids(&count, &input_list);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> GetDecoderDeviceGuids failed with hr: %X", hr));
goto done;
}
DbgLog((LOG_TRACE, 10, L"-> Enumerating supported DXVA2 modes (count: %d)", count));
for(unsigned i = 0; i < count; i++) {
const GUID *g = &input_list[i];
const dxva_mode_t *mode = get_dxva_mode_from_guid(g);
if (mode) {
DbgLog((LOG_TRACE, 10, L" -> %S", mode->name));
} else {
DbgLog((LOG_TRACE, 10, L" -> Unknown GUID (%s)", WStringFromGUID(*g).c_str()));
}
}
/* Iterate over our priority list */
for (unsigned i = 0; dxva_modes[i].name; i++) {
const dxva_mode_t *mode = &dxva_modes[i];
if (!check_dxva_mode_compatibility(mode, codec, profile))
continue;
BOOL supported = FALSE;
for (const GUID *g = &input_list[0]; !supported && g < &input_list[count]; g++) {
supported = IsEqualGUID(*mode->guid, *g);
}
if (!supported)
continue;
DbgLog((LOG_TRACE, 10, L"-> Trying to use '%S'", mode->name));
UINT out_count = 0;
D3DFORMAT *out_list = nullptr;
hr = m_pDXVADecoderService->GetDecoderRenderTargets(*mode->guid, &out_count, &out_list);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Retrieving render targets failed with hr: %X", hr));
continue;
}
BOOL matchingFormat = FALSE;
D3DFORMAT format = D3DFMT_UNKNOWN;
DbgLog((LOG_TRACE, 10, L"-> Enumerating render targets (count: %d)", out_count));
for (unsigned j = 0; j < out_count; j++) {
const D3DFORMAT f = out_list[j];
DbgLog((LOG_TRACE, 10, L" -> %d is supported (%4.4S)", f, (const char *)&f));
if (mode->high_bit_depth && (f == FOURCC_P010 || f == FOURCC_P016)) {
matchingFormat = TRUE;
format = f;
} else if (!mode->high_bit_depth && f == FOURCC_NV12) {
matchingFormat = TRUE;
format = f;
}
}
if (matchingFormat) {
DbgLog((LOG_TRACE, 10, L"-> Found matching output format, finished setup"));
*input = *mode->guid;
*output = format;
SAFE_CO_FREE(out_list);
SAFE_CO_FREE(input_list);
return S_OK;
}
SAFE_CO_FREE(out_list);
}
done:
SAFE_CO_FREE(input_list);
return E_FAIL;
}
HRESULT CDecDXVA2::InitD3DAdapterIdentifier(UINT lAdapter)
{
ASSERT(m_pD3D);
D3DADAPTER_IDENTIFIER9 d3dai = { 0 };
HRESULT hr = m_pD3D->GetAdapterIdentifier(lAdapter, 0, &d3dai);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Querying of adapter identifier %d failed with hr: %X", lAdapter, hr));
return E_FAIL;
}
const char *vendor = "Unknown";
for (int i = 0; vendors[i].id != 0; i++) {
if (vendors[i].id == d3dai.VendorId) {
vendor = vendors[i].name;
break;
}
}
DbgLog((LOG_TRACE, 10, L"-> Running on adapter %d, %S, vendor 0x%04X(%S), device 0x%04X", lAdapter, d3dai.Description, d3dai.VendorId, vendor, d3dai.DeviceId));
m_dwVendorId = d3dai.VendorId;
m_dwDeviceId = d3dai.DeviceId;
return S_OK;
}
/**
* This function is only called in non-native mode
* Its responsibility is to initialize D3D, create a device and a device manager
* and call SetD3DDeviceManager with it.
*/
HRESULT CDecDXVA2::InitD3D(UINT lAdapter)
{
HRESULT hr = S_OK;
m_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if (!m_pD3D) {
DbgLog((LOG_ERROR, 10, L"-> Failed to acquire IDirect3D9"));
return E_FAIL;
}
// populate the adapter identifier values
hr = InitD3DAdapterIdentifier(lAdapter);
// if the requested adapter failed, try again
if (FAILED(hr) && lAdapter != D3DADAPTER_DEFAULT) {
lAdapter = D3DADAPTER_DEFAULT;
hr = InitD3DAdapterIdentifier(lAdapter);
}
if (FAILED(hr)) {
return hr;
}
D3DPRESENT_PARAMETERS d3dpp = { 0 };
D3DDISPLAYMODE d3ddm = { 0 };
m_pD3D->GetAdapterDisplayMode(lAdapter, &d3ddm);
d3dpp.Windowed = TRUE;
d3dpp.BackBufferWidth = 640;
d3dpp.BackBufferHeight = 480;
d3dpp.BackBufferCount = 0;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
hr = m_pD3D->CreateDevice(lAdapter, D3DDEVTYPE_HAL, GetShellWindow(), D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, &d3dpp, &m_pD3DDev);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of device failed with hr: %X", hr));
return E_FAIL;
}
return S_OK;
}
HRESULT CDecDXVA2::InitD3DEx(UINT lAdapter)
{
HRESULT hr = S_OK;
if (dx.direct3DCreate9Ex == nullptr) {
DbgLog((LOG_ERROR, 10, L"-> Direct3DCreate9Ex not available"));
return E_NOINTERFACE;
}
IDirect3D9Ex *pD3D9Ex = nullptr;
hr = dx.direct3DCreate9Ex(D3D_SDK_VERSION, &pD3D9Ex);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"-> Failed to acquire IDirect3D9Ex"));
return E_NOINTERFACE;
}
m_pD3D = dynamic_cast<IDirect3D9*>(pD3D9Ex);
// populate the adapter identifier values
hr = InitD3DAdapterIdentifier(lAdapter);
// if the requested adapter failed, try again
if (FAILED(hr) && lAdapter != D3DADAPTER_DEFAULT) {
lAdapter = D3DADAPTER_DEFAULT;
hr = InitD3DAdapterIdentifier(lAdapter);
}
if (FAILED(hr)) {
SafeRelease(&m_pD3D);
return hr;
}
D3DPRESENT_PARAMETERS d3dpp = { 0 };
D3DDISPLAYMODEEX d3ddm = { 0 };
d3ddm.Size = sizeof(D3DDISPLAYMODEEX);
pD3D9Ex->GetAdapterDisplayModeEx(lAdapter, &d3ddm, NULL);
d3dpp.Windowed = TRUE;
d3dpp.BackBufferWidth = 640;
d3dpp.BackBufferHeight = 480;
d3dpp.BackBufferCount = 0;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
IDirect3DDevice9Ex *pD3D9DeviceEx = nullptr;
hr = pD3D9Ex->CreateDeviceEx(lAdapter, D3DDEVTYPE_HAL, GetShellWindow(), D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, &d3dpp, NULL, &pD3D9DeviceEx);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of device failed with hr: %X", hr));
SafeRelease(&m_pD3D);
return E_FAIL;
}
m_pD3DDev = dynamic_cast<IDirect3DDevice9*>(pD3D9DeviceEx);
return S_OK;
}
HRESULT CDecDXVA2::RetrieveVendorId(IDirect3DDeviceManager9 *pDevManager)
{
HANDLE hDevice = 0;
IDirect3D9 *pD3D = nullptr;
IDirect3DDevice9 *pDevice = nullptr;
HRESULT hr = pDevManager->OpenDeviceHandle(&hDevice);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to open device handle with hr: %X", hr));
goto done;
}
hr = pDevManager->LockDevice(hDevice, &pDevice, TRUE);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to lock device with hr: %X", hr));
goto done;
}
hr = pDevice->GetDirect3D(&pD3D);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get D3D object hr: %X", hr));
goto done;
}
D3DDEVICE_CREATION_PARAMETERS devParams;
hr = pDevice->GetCreationParameters(&devParams);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get device creation params hr: %X", hr));
goto done;
}
D3DADAPTER_IDENTIFIER9 adIdentifier;
hr = pD3D->GetAdapterIdentifier(devParams.AdapterOrdinal, 0, &adIdentifier);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Failed to get adapter identified hr: %X", hr));
goto done;
}
m_dwVendorId = adIdentifier.VendorId;
m_dwDeviceId = adIdentifier.DeviceId;
memcpy(m_cDeviceName, adIdentifier.Description, sizeof(m_cDeviceName));
done:
SafeRelease(&pD3D);
SafeRelease(&pDevice);
if (hDevice && hDevice != INVALID_HANDLE_VALUE) {
pDevManager->UnlockDevice(hDevice, FALSE);
pDevManager->CloseDeviceHandle(hDevice);
}
return hr;
}
HRESULT CDecDXVA2::CheckHWCompatConditions(GUID decoderGuid)
{
if (m_dwSurfaceWidth == 0 || m_dwSurfaceHeight == 0)
return E_UNEXPECTED;
int width_mbs = m_dwSurfaceWidth / 16;
int height_mbs = m_dwSurfaceHeight / 16;
int max_ref_frames_dpb41 = min(11, 32768 / (width_mbs * height_mbs));
if (m_dwVendorId == VEND_ID_ATI) {
if (IsAMDUVD(m_dwDeviceId)) {
if (m_pAVCtx->codec_id == AV_CODEC_ID_H264 && m_pAVCtx->refs > max_ref_frames_dpb41) {
DbgLog((LOG_TRACE, 10, L"-> Too many reference frames for AMD UVD/UVD+ H.264 decoder"));
return E_FAIL;
} else if ((m_pAVCtx->codec_id == AV_CODEC_ID_VC1 || m_pAVCtx->codec_id == AV_CODEC_ID_MPEG2VIDEO) && (m_dwSurfaceWidth > 1920 || m_dwSurfaceHeight > 1200)) {
DbgLog((LOG_TRACE, 10, L"-> VC-1 Resolutions above FullHD are not supported by the UVD/UVD+ decoder"));
return E_FAIL;
} else if (m_pAVCtx->codec_id == AV_CODEC_ID_WMV3) {
DbgLog((LOG_TRACE, 10, L"-> AMD UVD/UVD+ is currently not compatible with WMV3"));
return E_FAIL;
}
}
} else if (m_dwVendorId == VEND_ID_INTEL) {
if (decoderGuid == DXVADDI_Intel_ModeH264_E && m_pAVCtx->codec_id == AV_CODEC_ID_H264 && m_pAVCtx->refs > max_ref_frames_dpb41) {
DbgLog((LOG_TRACE, 10, L"-> Too many reference frames for Intel H.264 decoder implementation"));
return E_FAIL;
}
}
return S_OK;
}
/**
* Called from both native and non-native mode
* Initialize all the common DXVA2 interfaces and device handles
*/
HRESULT CDecDXVA2::SetD3DDeviceManager(IDirect3DDeviceManager9 *pDevManager)
{
HRESULT hr = S_OK;
ASSERT(pDevManager);
m_pD3DDevMngr = pDevManager;
RetrieveVendorId(pDevManager);
// This should really be null here, but since we're overwriting it, make sure its actually released
SafeRelease(&m_pDXVADecoderService);
hr = CreateDXVAVideoService(m_pD3DDevMngr, &m_pDXVADecoderService);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of DXVA2 Decoder Service failed with hr: %X", hr));
goto done;
}
// If the decoder was initialized already, check if we can use this device
if (m_pAVCtx) {
DbgLog((LOG_TRACE, 10, L"-> Checking hardware for format support..."));
GUID input = GUID_NULL;
D3DFORMAT output;
hr = FindVideoServiceConversion(m_pAVCtx->codec_id, m_pAVCtx->profile, &input, &output);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> No decoder device available that can decode codec '%S' to a matching output", avcodec_get_name(m_pAVCtx->codec_id)));
goto done;
}
m_eSurfaceFormat = output;
if (FAILED(CheckHWCompatConditions(input))) {
hr = E_FAIL;
goto done;
}
DXVA2_VideoDesc desc;
ZeroMemory(&desc, sizeof(desc));
desc.SampleWidth = m_dwSurfaceWidth;
desc.SampleHeight = m_dwSurfaceHeight;
desc.Format = output;
DXVA2_ConfigPictureDecode config;
hr = FindDecoderConfiguration(input, &desc, &config);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> No decoder configuration available for codec '%S'", avcodec_get_name(m_pAVCtx->codec_id)));
goto done;
}
LPDIRECT3DSURFACE9 pSurfaces[DXVA2_MAX_SURFACES] = {0};
UINT numSurfaces = max(config.ConfigMinRenderTargetBuffCount, 1);
hr = m_pDXVADecoderService->CreateSurface(m_dwSurfaceWidth, m_dwSurfaceHeight, numSurfaces, output, D3DPOOL_DEFAULT, 0, DXVA2_VideoDecoderRenderTarget, pSurfaces, nullptr);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of surfaces failed with hr: %X", hr));
goto done;
}
IDirectXVideoDecoder *decoder = nullptr;
hr = m_pDXVADecoderService->CreateVideoDecoder(input, &desc, &config, pSurfaces, numSurfaces, &decoder);
// Release resources, decoder and surfaces
SafeRelease(&decoder);
int i = DXVA2_MAX_SURFACES;
while (i > 0) {
SafeRelease(&pSurfaces[--i]);
}
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of decoder failed with hr: %X", hr));
goto done;
}
}
done:
return hr;
}
// ILAVDecoder
STDMETHODIMP CDecDXVA2::Init()
{
DbgLog((LOG_TRACE, 10, L"CDecDXVA2::Init(): Trying to open DXVA2 decoder"));
HRESULT hr = S_OK;
// Initialize all D3D interfaces in non-native mode
if (!m_bNative) {
// load DLLs and functions
if (FAILED(hr = LoadDXVA2Functions())) {
DbgLog((LOG_ERROR, 10, L"-> Failed to load DXVA2 DLL functions"));
return E_FAIL;
}
// determin the adapter the user requested
UINT lAdapter = m_pSettings->GetHWAccelDeviceIndex(HWAccel_DXVA2CopyBack, nullptr);
if (lAdapter == LAVHWACCEL_DEVICE_DEFAULT)
lAdapter = D3DADAPTER_DEFAULT;
DWORD dwDeviceIndex = m_pCallback->GetGPUDeviceIndex();
if (dwDeviceIndex != DWORD_MAX) {
lAdapter = (UINT)dwDeviceIndex;
}
// initialize D3D
hr = InitD3DEx(lAdapter);
if (hr == E_NOINTERFACE) {
// D3D9Ex failed, try plain D3D
hr = InitD3D(lAdapter);
}
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> D3D Initialization failed with hr: %X", hr));
return hr;
}
// create device manager for the device
hr = CreateD3DDeviceManager(m_pD3DDev, &m_pD3DResetToken, &m_pD3DDevMngr);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of Device manager failed with hr: %X", hr));
return E_FAIL;
}
// set it as the active device manager
hr = SetD3DDeviceManager(m_pD3DDevMngr);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> SetD3DDeviceManager failed with hr: %X", hr));
return E_FAIL;
}
if (CopyFrameNV12 == nullptr) {
int cpu_flags = av_get_cpu_flags();
if (cpu_flags & AV_CPU_FLAG_SSE4) {
DbgLog((LOG_TRACE, 10, L"-> Using SSE4 frame copy"));
if (m_dwVendorId == VEND_ID_INTEL)
CopyFrameNV12 = CopyFrameNV12_SSE4_MT;
else
CopyFrameNV12 = CopyFrameNV12_SSE4;
} else {
DbgLog((LOG_TRACE, 10, L"-> Using fallback frame copy"));
if (m_dwVendorId == VEND_ID_INTEL)
CopyFrameNV12 = CopyFrameNV12_fallback_MT;
else
CopyFrameNV12 = CopyFrameNV12_fallback;
}
}
}
// Init the ffmpeg parts
// This is our main software decoder, unable to fail!
CDecAvcodec::Init();
return S_OK;
}
STDMETHODIMP CDecDXVA2::InitDecoder(AVCodecID codec, const CMediaType *pmt)
{
HRESULT hr = S_OK;
DbgLog((LOG_TRACE, 10, L"CDecDXVA2::InitDecoder(): Initializing DXVA2 decoder"));
// Hack-ish check to avoid re-creating the full decoder when only the aspect ratio changes.
// Re-creating the DXVA2 decoder can lead to issues like missing frames or a several second delay
if (m_pDecoder) {
CMediaType mediaTypeCheck = m_MediaType;
if (mediaTypeCheck.formattype == FORMAT_VideoInfo2 && pmt->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2 *vih2Old = (VIDEOINFOHEADER2 *)mediaTypeCheck.Format();
VIDEOINFOHEADER2 *vih2New = (VIDEOINFOHEADER2 *)pmt->Format();
vih2Old->dwPictAspectRatioX = vih2New->dwPictAspectRatioX;
vih2Old->dwPictAspectRatioY = vih2New->dwPictAspectRatioY;
if (mediaTypeCheck == *pmt) {
DbgLog((LOG_TRACE, 10, L"-> Skipping re-init because media type is unchanged."));
m_MediaType = *pmt;
// flush the decoder so we can resume decoding properly (before a re-init, EndOfStream would be called, making this necessary)
avcodec_flush_buffers(m_pAVCtx);
return S_OK;
}
}
}
DestroyDecoder(false);
m_DisplayDelay = DXVA2_QUEUE_SURFACES;
// Intel GPUs don't like the display and performance goes way down, so disable it.
if (m_dwVendorId == VEND_ID_INTEL)
m_DisplayDelay = 0;
// Reduce display delay for DVD decoding for lower decode latency
if (m_pCallback->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_DVD)
m_DisplayDelay /= 2;
m_bFailHWDecode = FALSE;
DbgLog((LOG_TRACE, 10, L"-> Creation of DXVA2 decoder successfull, initializing ffmpeg"));
hr = CDecAvcodec::InitDecoder(codec, pmt);
if (FAILED(hr)) {
return hr;
}
// If we have a DXVA Decoder, check if its capable
// If we don't have one yet, it may be handed to us later, and compat is checked at that point
GUID input = GUID_NULL;
D3DFORMAT output = D3DFMT_UNKNOWN;
if (m_pDXVADecoderService) {
hr = FindVideoServiceConversion(codec, m_pAVCtx->profile, &input, &output);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> No decoder device available that can decode codec '%S' to a matching output", avcodec_get_name(codec)));
return E_FAIL;
}
} else {
bool bHighBitdepth = (m_pAVCtx->codec_id == AV_CODEC_ID_HEVC && (m_pAVCtx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 || m_pAVCtx->profile == FF_PROFILE_HEVC_MAIN_10))
|| (m_pAVCtx->codec_id == AV_CODEC_ID_VP9 && (m_pAVCtx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 || m_pAVCtx->profile == FF_PROFILE_VP9_2));
if (bHighBitdepth)
output = (D3DFORMAT)FOURCC_P010;
else
output = (D3DFORMAT)FOURCC_NV12;
}
if (check_dxva_codec_profile(m_pAVCtx->codec_id, m_pAVCtx->pix_fmt, m_pAVCtx->profile, AV_PIX_FMT_DXVA2_VLD))
{
DbgLog((LOG_TRACE, 10, L"-> Incompatible profile detected, falling back to software decoding"));
return E_FAIL;
}
m_dwSurfaceWidth = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_width);
m_dwSurfaceHeight = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_height);
m_eSurfaceFormat = output;
m_DecoderPixelFormat = m_pAVCtx->sw_pix_fmt;
if (FAILED(CheckHWCompatConditions(input))) {
return E_FAIL;
}
m_MediaType = *pmt;
return S_OK;
}
STDMETHODIMP_(long) CDecDXVA2::GetBufferCount(long *pMaxBuffers)
{
long buffers = 0;
// Native decoding should use 16 buffers to enable seamless codec changes
if (m_bNative)
buffers = 16;
else {
// Buffers based on max ref frames
if (m_nCodecId == AV_CODEC_ID_H264 || m_nCodecId == AV_CODEC_ID_HEVC)
buffers = 16;
else
buffers = 2;
}
// 4 extra buffers for handling and safety
buffers += 4;
if (!m_bNative) {
buffers += m_DisplayDelay;
}
if (m_pCallback->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_DVD) {
buffers += 4;
}
if (pMaxBuffers)
{
// cap at 127, because it needs to fit into the 7-bit DXVA structs
*pMaxBuffers = 127;
// VC-1 and VP9 decoding has stricter requirements (decoding flickers otherwise)
if (m_nCodecId == AV_CODEC_ID_VC1 || m_nCodecId == AV_CODEC_ID_VP9)
*pMaxBuffers = 32;
}
return buffers;
}
HRESULT CDecDXVA2::FindDecoderConfiguration(const GUID &input, const DXVA2_VideoDesc *pDesc, DXVA2_ConfigPictureDecode *pConfig)
{
CheckPointer(pConfig, E_INVALIDARG);
CheckPointer(pDesc, E_INVALIDARG);
HRESULT hr = S_OK;
UINT cfg_count = 0;
DXVA2_ConfigPictureDecode *cfg_list = nullptr;
hr = m_pDXVADecoderService->GetDecoderConfigurations(input, pDesc, nullptr, &cfg_count, &cfg_list);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> GetDecoderConfigurations failed with hr: %X", hr));
return E_FAIL;
}
DbgLog((LOG_TRACE, 10, L"-> We got %d decoder configurations", cfg_count));
int best_score = 0;
DXVA2_ConfigPictureDecode best_cfg;
for (unsigned i = 0; i < cfg_count; i++) {
DXVA2_ConfigPictureDecode *cfg = &cfg_list[i];
int score;
if (cfg->ConfigBitstreamRaw == 1)
score = 1;
else if (m_pAVCtx->codec_id == AV_CODEC_ID_H264 && cfg->ConfigBitstreamRaw == 2)
score = 2;
else
continue;
if (IsEqualGUID(cfg->guidConfigBitstreamEncryption, DXVA2_NoEncrypt))
score += 16;
if (score > best_score) {
best_score = score;
best_cfg = *cfg;
}
}
SAFE_CO_FREE(cfg_list);
if (best_score <= 0) {
DbgLog((LOG_TRACE, 10, L"-> No matching configuration available"));
return E_FAIL;
}
*pConfig = best_cfg;
return S_OK;
}
HRESULT CDecDXVA2::CreateDXVA2Decoder(int nSurfaces, IDirect3DSurface9 **ppSurfaces)
{
DbgLog((LOG_TRACE, 10, L"-> CDecDXVA2::CreateDXVA2Decoder"));
HRESULT hr = S_OK;
LPDIRECT3DSURFACE9 pSurfaces[DXVA2_MAX_SURFACES];
if (!m_pDXVADecoderService)
return E_FAIL;
DestroyDecoder(false, true);
GUID input = GUID_NULL;
D3DFORMAT output;
FindVideoServiceConversion(m_pAVCtx->codec_id, m_pAVCtx->profile, &input, &output);
if (!nSurfaces) {
m_dwSurfaceWidth = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_width);
m_dwSurfaceHeight = dxva_align_dimensions(m_pAVCtx->codec_id, m_pAVCtx->coded_height);
m_eSurfaceFormat = output;
m_DecoderPixelFormat = m_pAVCtx->sw_pix_fmt;
m_NumSurfaces = GetBufferCount();
hr = m_pDXVADecoderService->CreateSurface(m_dwSurfaceWidth, m_dwSurfaceHeight, m_NumSurfaces - 1, output, D3DPOOL_DEFAULT, 0, DXVA2_VideoDecoderRenderTarget, pSurfaces, nullptr);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> Creation of surfaces failed with hr: %X", hr));
m_NumSurfaces = 0;
return E_FAIL;
}
ppSurfaces = pSurfaces;
} else {
m_NumSurfaces = nSurfaces;
for (int i = 0; i < m_NumSurfaces; i++) {
ppSurfaces[i]->AddRef();
}
}
if (m_NumSurfaces <= 0) {
DbgLog((LOG_TRACE, 10, L"-> No surfaces? No good!"));
return E_FAIL;
}
// get the device, for ColorFill() to init the surfaces in black
IDirect3DDevice9 *pDev = nullptr;
ppSurfaces[0]->GetDevice(&pDev);
for (int i = 0; i < m_NumSurfaces; i++) {
m_pSurfaces[i].index = i;
m_pSurfaces[i].d3d = ppSurfaces[i];
m_pSurfaces[i].age = UINT64_MAX;
m_pSurfaces[i].used = false;
// fill the surface in black, to avoid the "green screen" in case the first frame fails to decode.
if (pDev) pDev->ColorFill(ppSurfaces[i], NULL, D3DCOLOR_XYUV(0, 128, 128));
}
// and done with the device
SafeRelease(&pDev);
DbgLog((LOG_TRACE, 10, L"-> Successfully created %d surfaces (%dx%d)", m_NumSurfaces, m_dwSurfaceWidth, m_dwSurfaceHeight));
DXVA2_VideoDesc desc;
ZeroMemory(&desc, sizeof(desc));
desc.SampleWidth = m_dwSurfaceWidth;
desc.SampleHeight = m_dwSurfaceHeight;
desc.Format = output;
hr = FindDecoderConfiguration(input, &desc, &m_DXVAVideoDecoderConfig);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> FindDecoderConfiguration failed with hr: %X", hr));
return hr;
}
IDirectXVideoDecoder *decoder = nullptr;
hr = m_pDXVADecoderService->CreateVideoDecoder(input, &desc, &m_DXVAVideoDecoderConfig, ppSurfaces, m_NumSurfaces, &decoder);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"-> CreateVideoDecoder failed with hr: %X", hr));
return E_FAIL;
}
m_pDecoder = decoder;
m_guidDecoderDevice = input;
/* fill hwaccel_context */
FillHWContext((dxva_context *)m_pAVCtx->hwaccel_context);
memset(m_pRawSurface, 0, sizeof(m_pRawSurface));
for (int i = 0; i < m_NumSurfaces; i++) {
m_pRawSurface[i] = m_pSurfaces[i].d3d;
}
return S_OK;
}
HRESULT CDecDXVA2::FillHWContext(dxva_context *ctx)
{
ctx->cfg = &m_DXVAVideoDecoderConfig;
ctx->decoder = m_pDecoder;
ctx->surface = m_pRawSurface;
ctx->surface_count = m_NumSurfaces;
if (m_dwVendorId == VEND_ID_INTEL && m_guidDecoderDevice == DXVADDI_Intel_ModeH264_E)
ctx->workaround = FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
else if (m_dwVendorId == VEND_ID_ATI && IsAMDUVD(m_dwDeviceId))
ctx->workaround = FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG;
else
ctx->workaround = 0;
return S_OK;
}
enum AVPixelFormat CDecDXVA2::get_dxva2_format(struct AVCodecContext *c, const enum AVPixelFormat * pix_fmts)
{
CDecDXVA2 *pDec = (CDecDXVA2 *)c->opaque;
const enum AVPixelFormat *p;
for (p = pix_fmts; *p != -1; p++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
if (!desc || !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
break;
if (*p == AV_PIX_FMT_DXVA2_VLD) {
HRESULT hr = pDec->ReInitDXVA2Decoder(c);
if (FAILED(hr)) {
pDec->m_bFailHWDecode = TRUE;
continue;
} else {
break;
}
}
}
return *p;
}
typedef struct SurfaceWrapper {
LPDIRECT3DSURFACE9 surface;
IMediaSample *sample;
CDecDXVA2 *pDec;
IDirectXVideoDecoder *pDXDecoder;
} SurfaceWrapper;
void CDecDXVA2::free_dxva2_buffer(void *opaque, uint8_t *data)
{
SurfaceWrapper *sw = (SurfaceWrapper *)opaque;
CDecDXVA2 *pDec = sw->pDec;
LPDIRECT3DSURFACE9 pSurface = sw->surface;
for (int i = 0; i < pDec->m_NumSurfaces; i++) {
if (pDec->m_pSurfaces[i].d3d == pSurface) {
pDec->m_pSurfaces[i].used = false;
break;
}
}
SafeRelease(&pSurface);
SafeRelease(&sw->pDXDecoder);
SafeRelease(&sw->sample);
delete sw;
}
HRESULT CDecDXVA2::ReInitDXVA2Decoder(AVCodecContext *c)
{
HRESULT hr = S_OK;
// Don't allow decoder creation during first init
if (m_bInInit)
return S_FALSE;
if (!m_pDecoder || dxva_align_dimensions(c->codec_id, c->coded_width) != m_dwSurfaceWidth || dxva_align_dimensions(c->codec_id, c->coded_height) != m_dwSurfaceHeight || m_DecoderPixelFormat != c->sw_pix_fmt) {
DbgLog((LOG_TRACE, 10, L"No DXVA2 Decoder or image dimensions changed -> Re-Allocating resources"));
if (!m_pDecoder && m_bNative && !m_pDXVA2Allocator) {
ASSERT(0);
hr = E_FAIL;
} else if (m_bNative) {
// shortcut to update only the Decoder Pixel Format if needed
if (m_pDecoder && m_DecoderPixelFormat == AV_PIX_FMT_NONE && m_DecoderPixelFormat != c->sw_pix_fmt) {
GUID input; D3DFORMAT output;
FindVideoServiceConversion(c->codec_id, c->profile, &input, &output);
if (output == m_eSurfaceFormat) {
m_DecoderPixelFormat = c->sw_pix_fmt;
return ReInitDXVA2Decoder(c);
}
}
avcodec_flush_buffers(c);
m_dwSurfaceWidth = dxva_align_dimensions(c->codec_id, c->coded_width);
m_dwSurfaceHeight = dxva_align_dimensions(c->codec_id, c->coded_height);
m_DecoderPixelFormat = c->sw_pix_fmt;
GUID input;
FindVideoServiceConversion(c->codec_id, c->profile, &input, &m_eSurfaceFormat);
// Re-Commit the allocator (creates surfaces and new decoder)
hr = m_pDXVA2Allocator->Decommit();
if (m_pDXVA2Allocator->DecommitInProgress()) {
DbgLog((LOG_TRACE, 10, L"WARNING! DXVA2 Allocator is still busy, trying to flush downstream"));
m_pCallback->ReleaseAllDXVAResources();
m_pCallback->GetOutputPin()->GetConnected()->BeginFlush();
m_pCallback->GetOutputPin()->GetConnected()->EndFlush();
if (m_pDXVA2Allocator->DecommitInProgress()) {
DbgLog((LOG_TRACE, 10, L"WARNING! Flush had no effect, decommit of the allocator still not complete"));
} else {
DbgLog((LOG_TRACE, 10, L"Flush was successfull, decommit completed!"));
}
}
hr = m_pDXVA2Allocator->Commit();
} else if (!m_bNative) {
FlushDisplayQueue(TRUE);
hr = CreateDXVA2Decoder();
}
}
return hr;
}
int CDecDXVA2::get_dxva2_buffer(struct AVCodecContext *c, AVFrame *pic, int flags)
{
CDecDXVA2 *pDec = (CDecDXVA2 *)c->opaque;
IMediaSample *pSample = nullptr;
HRESULT hr = S_OK;
if (pic->format != AV_PIX_FMT_DXVA2_VLD ||
(c->codec_id == AV_CODEC_ID_H264 && !H264_CHECK_PROFILE(c->profile)) ||
(c->codec_id == AV_CODEC_ID_HEVC && !HEVC_CHECK_PROFILE(c->profile)) ||
(c->codec_id == AV_CODEC_ID_VP9 && !VP9_CHECK_PROFILE(c->profile))) {
DbgLog((LOG_ERROR, 10, L"DXVA2 buffer request, but not dxva2 pixfmt or unsupported profile"));
pDec->m_bFailHWDecode = TRUE;
return -1;
}
hr = pDec->ReInitDXVA2Decoder(c);
if (FAILED(hr)) {
pDec->m_bFailHWDecode = TRUE;
return -1;
}
if (FAILED(pDec->m_pD3DDevMngr->TestDevice(pDec->m_hDevice))) {
DbgLog((LOG_ERROR, 10, L"Device Lost"));
}
int i;
if (pDec->m_bNative) {
if (!pDec->m_pDXVA2Allocator)
return -1;
hr = pDec->m_pDXVA2Allocator->GetBuffer(&pSample, nullptr, nullptr, 0);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"DXVA2Allocator returned error, hr: 0x%x", hr));
return -1;
}
ILAVDXVA2Sample *pLavDXVA2 = nullptr;
hr = pSample->QueryInterface(&pLavDXVA2);
if (FAILED(hr)) {
DbgLog((LOG_ERROR, 10, L"Sample is no LAV DXVA2 sample?????"));
SafeRelease(&pSample);
return -1;
}
i = pLavDXVA2->GetDXSurfaceId();
SafeRelease(&pLavDXVA2);
} else {
int old, old_unused;
for (i = 0, old = 0, old_unused = -1; i < pDec->m_NumSurfaces; i++) {
d3d_surface_t *surface = &pDec->m_pSurfaces[i];
if (!surface->used && (old_unused == -1 || surface->age < pDec->m_pSurfaces[old_unused].age))
old_unused = i;
if (surface->age < pDec->m_pSurfaces[old].age)
old = i;
}
if (old_unused == -1) {
DbgLog((LOG_TRACE, 10, L"No free surface, using oldest"));
i = old;
} else {
i = old_unused;
}
}
LPDIRECT3DSURFACE9 pSurface = pDec->m_pSurfaces[i].d3d;
if (!pSurface) {
DbgLog((LOG_ERROR, 10, L"There is a sample, but no D3D Surace? WTF?"));
SafeRelease(&pSample);
return -1;
}
pDec->m_pSurfaces[i].age = pDec->m_CurrentSurfaceAge++;
pDec->m_pSurfaces[i].used = true;
memset(pic->data, 0, sizeof(pic->data));
memset(pic->linesize, 0, sizeof(pic->linesize));
memset(pic->buf, 0, sizeof(pic->buf));
pic->data[0] = pic->data[3] = (uint8_t *)pSurface;
pic->data[4] = (uint8_t *)pSample;
SurfaceWrapper *surfaceWrapper = new SurfaceWrapper();
surfaceWrapper->pDec = pDec;
surfaceWrapper->sample = pSample;
surfaceWrapper->surface = pSurface;
surfaceWrapper->surface->AddRef();
surfaceWrapper->pDXDecoder = pDec->m_pDecoder;
surfaceWrapper->pDXDecoder->AddRef();
pic->buf[0] = av_buffer_create(nullptr, 0, free_dxva2_buffer, surfaceWrapper, 0);
return 0;
}
HRESULT CDecDXVA2::AdditionaDecoderInit()
{
/* Create ffmpeg dxva_context, but only fill it if we have a decoder already. */
dxva_context *ctx = (dxva_context *)av_mallocz(sizeof(dxva_context));
if (m_pDecoder) {
FillHWContext(ctx);
}
m_pAVCtx->thread_count = 1;
m_pAVCtx->hwaccel_context = ctx;
m_pAVCtx->get_format = get_dxva2_format;
m_pAVCtx->get_buffer2 = get_dxva2_buffer;
m_pAVCtx->opaque = this;
m_pAVCtx->slice_flags |= SLICE_FLAG_ALLOW_FIELD;
// disable error conealment in hwaccel mode, it doesn't work either way
m_pAVCtx->error_concealment = 0;
av_opt_set_int(m_pAVCtx, "enable_er", 0, AV_OPT_SEARCH_CHILDREN);
return S_OK;
}
HRESULT CDecDXVA2::PostDecode()
{
if (m_bFailHWDecode) {
DbgLog((LOG_TRACE, 10, L"::PostDecode(): HW Decoder failed, falling back to software decoding"));
return E_FAIL;
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::FlushFromAllocator()
{
if (m_pAVCtx && avcodec_is_open(m_pAVCtx))
avcodec_flush_buffers(m_pAVCtx);
FlushDisplayQueue(FALSE);
return S_OK;
}
STDMETHODIMP CDecDXVA2::Flush()
{
CDecAvcodec::Flush();
FlushDisplayQueue(FALSE);
#ifdef DEBUG
int used = 0;
for (int i = 0; i < m_NumSurfaces; i++) {
d3d_surface_t *s = &m_pSurfaces[i];
if (s->used) {
used++;
}
}
if (used > 0) {
DbgLog((LOG_TRACE, 10, L"WARNING! %d frames still in use after flush", used));
}
#endif
// This solves an issue with corruption after seeks on AMD systems, see JIRA LAV-5
if (m_dwVendorId == VEND_ID_ATI && m_nCodecId == AV_CODEC_ID_H264 && m_pDecoder) {
if (m_bNative && m_pDXVA2Allocator) {
// The allocator needs to be locked because flushes can happen async to other graph events
// and in the worst case the allocator is decommited while we're using it.
CAutoLock allocatorLock(m_pDXVA2Allocator);
if (m_pDXVA2Allocator->IsCommited())
CreateDXVA2Decoder(m_NumSurfaces, m_pRawSurface);
} else if(!m_bNative)
CreateDXVA2Decoder();
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::FlushDisplayQueue(BOOL bDeliver)
{
for (int i=0; i < m_DisplayDelay; ++i) {
if (m_FrameQueue[m_FrameQueuePosition]) {
if (bDeliver) {
DeliverDXVA2Frame(m_FrameQueue[m_FrameQueuePosition]);
m_FrameQueue[m_FrameQueuePosition] = nullptr;
} else {
ReleaseFrame(&m_FrameQueue[m_FrameQueuePosition]);
}
}
m_FrameQueuePosition = (m_FrameQueuePosition + 1) % m_DisplayDelay;
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::EndOfStream()
{
CDecAvcodec::EndOfStream();
// Flush display queue
FlushDisplayQueue(TRUE);
return S_OK;
}
HRESULT CDecDXVA2::HandleDXVA2Frame(LAVFrame *pFrame)
{
if (pFrame->flags & LAV_FRAME_FLAG_FLUSH) {
if (!m_bNative) {
FlushDisplayQueue(TRUE);
}
Deliver(pFrame);
return S_OK;
}
if (m_bNative || m_DisplayDelay == 0) {
DeliverDXVA2Frame(pFrame);
} else {
LAVFrame *pQueuedFrame = m_FrameQueue[m_FrameQueuePosition];
m_FrameQueue[m_FrameQueuePosition] = pFrame;
m_FrameQueuePosition = (m_FrameQueuePosition + 1) % m_DisplayDelay;
if (pQueuedFrame) {
DeliverDXVA2Frame(pQueuedFrame);
}
}
return S_OK;
}
HRESULT CDecDXVA2::DeliverDXVA2Frame(LAVFrame *pFrame)
{
if (m_bNative) {
if (!pFrame->data[0] || !pFrame->data[3]) {
DbgLog((LOG_ERROR, 10, L"No sample or surface for DXVA2 frame?!?!"));
ReleaseFrame(&pFrame);
return S_FALSE;
}
GetPixelFormat(&pFrame->format, &pFrame->bpp);
Deliver(pFrame);
} else {
if (m_bDirect) {
DeliverDirect(pFrame);
} else {
if (CopyFrame(pFrame))
Deliver(pFrame);
else
ReleaseFrame(&pFrame);
}
}
return S_OK;
}
STDMETHODIMP CDecDXVA2::GetPixelFormat(LAVPixelFormat *pPix, int *pBpp)
{
// Output is always NV12 or P010
if (pPix) {
if (m_bNative)
*pPix = LAVPixFmt_DXVA2;
else
*pPix = (m_eSurfaceFormat == FOURCC_P010 || m_eSurfaceFormat == FOURCC_P016) ? LAVPixFmt_P016 : LAVPixFmt_NV12;
}
if (pBpp)
*pBpp = (m_eSurfaceFormat == FOURCC_P016) ? 16 : ((m_eSurfaceFormat == FOURCC_P010) ? 10 : 8);
return S_OK;
}
__forceinline bool CDecDXVA2::CopyFrame(LAVFrame *pFrame)
{
HRESULT hr;
LPDIRECT3DSURFACE9 pSurface = (LPDIRECT3DSURFACE9)pFrame->data[3];
GetPixelFormat(&pFrame->format, &pFrame->bpp);
D3DSURFACE_DESC surfaceDesc;
pSurface->GetDesc(&surfaceDesc);
D3DLOCKED_RECT LockedRect;
hr = pSurface->LockRect(&LockedRect, nullptr, D3DLOCK_READONLY);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"pSurface->LockRect failed (hr: %X)", hr));
return false;
}
// Store AVFrame-based buffers, and reset pFrame
LAVFrame tmpFrame = *pFrame;
pFrame->destruct = nullptr;
pFrame->priv_data = nullptr;
// side-data shall not be copied to tmpFrame
tmpFrame.side_data = nullptr;
tmpFrame.side_data_count = 0;
// Allocate memory buffers
hr = AllocLAVFrameBuffers(pFrame, (pFrame->format == LAVPixFmt_P016) ? (LockedRect.Pitch >> 1) : LockedRect.Pitch);
if (FAILED(hr)) {
pSurface->UnlockRect();
*pFrame = tmpFrame;
return false;
}
// Copy surface onto memory buffers
CopyFrameNV12((BYTE *)LockedRect.pBits, pFrame->data[0], pFrame->data[1], surfaceDesc.Height, pFrame->height, LockedRect.Pitch);
pSurface->UnlockRect();
// Free AVFrame based buffers, now that we're done
FreeLAVFrameBuffers(&tmpFrame);
return true;
}
static bool direct_lock(LAVFrame * pFrame, LAVDirectBuffer *pBuffer)
{
ASSERT(pFrame && pBuffer);
HRESULT hr;
LPDIRECT3DSURFACE9 pSurface = (LPDIRECT3DSURFACE9)pFrame->data[3];
D3DSURFACE_DESC surfaceDesc;
pSurface->GetDesc(&surfaceDesc);
D3DLOCKED_RECT LockedRect;
hr = pSurface->LockRect(&LockedRect, nullptr, D3DLOCK_READONLY);
if (FAILED(hr)) {
DbgLog((LOG_TRACE, 10, L"pSurface->LockRect failed (hr: %X)", hr));
return false;
}
memset(pBuffer, 0, sizeof(*pBuffer));
pBuffer->data[0] = (BYTE *)LockedRect.pBits;
pBuffer->data[1] = pBuffer->data[0] + surfaceDesc.Height * LockedRect.Pitch;
pBuffer->stride[0] = LockedRect.Pitch;
pBuffer->stride[1] = LockedRect.Pitch;
return true;
}
static void direct_unlock(LAVFrame * pFrame)
{
ASSERT(pFrame);
LPDIRECT3DSURFACE9 pSurface = (LPDIRECT3DSURFACE9)pFrame->data[3];
pSurface->UnlockRect();
}
bool CDecDXVA2::DeliverDirect(LAVFrame *pFrame)
{
GetPixelFormat(&pFrame->format, &pFrame->bpp);
pFrame->direct = true;
pFrame->direct_lock = direct_lock;
pFrame->direct_unlock = direct_unlock;
Deliver(pFrame);
return true;
}
STDMETHODIMP_(DWORD) CDecDXVA2::GetHWAccelNumDevices()
{
if (m_bNative)
return 0;
if (!m_pD3D)
return 0;
return m_pD3D->GetAdapterCount();
}
STDMETHODIMP CDecDXVA2::GetHWAccelDeviceInfo(DWORD dwIndex, BSTR *pstrDeviceName, DWORD *dwDeviceIdentifier)
{
if (m_bNative)
return E_UNEXPECTED;
if (!m_pD3D)
return E_NOINTERFACE;
D3DADAPTER_IDENTIFIER9 d3dai = { 0 };
HRESULT err = m_pD3D->GetAdapterIdentifier(dwIndex, 0, &d3dai);
if (err != D3D_OK)
return E_INVALIDARG;
if (pstrDeviceName) {
int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, d3dai.Description, -1, nullptr, 0);
if (len == 0)
return E_FAIL;
*pstrDeviceName = SysAllocStringLen(nullptr, len);
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, d3dai.Description, -1, *pstrDeviceName, len);
}
if (dwDeviceIdentifier)
*dwDeviceIdentifier = d3dai.DeviceId;
return S_OK;
}
STDMETHODIMP CDecDXVA2::GetHWAccelActiveDevice(BSTR *pstrDeviceName)
{
CheckPointer(pstrDeviceName, E_POINTER);
if (strlen(m_cDeviceName) == 0)
return E_UNEXPECTED;
int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, m_cDeviceName, -1, nullptr, 0);
if (len == 0)
return E_FAIL;
*pstrDeviceName = SysAllocStringLen(nullptr, len);
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, m_cDeviceName, -1, *pstrDeviceName, len);
return S_OK;
}
| 29.961745 | 211 | 0.677353 | lcmftianci |
02f6a8f9b10969bde216f003eec631b6db4be7fe | 4,637 | cpp | C++ | src/JSEUILabel.cpp | imzcy/JavaScriptExecutable | 723a13f433aafad84faa609f62955ce826063c66 | [
"MIT"
] | 3 | 2015-03-18T03:12:27.000Z | 2020-11-19T10:40:12.000Z | src/JSEUILabel.cpp | imzcy/JavaScriptExecutable | 723a13f433aafad84faa609f62955ce826063c66 | [
"MIT"
] | null | null | null | src/JSEUILabel.cpp | imzcy/JavaScriptExecutable | 723a13f433aafad84faa609f62955ce826063c66 | [
"MIT"
] | null | null | null | #include "JSE.h"
#include "JSEUILabel.h"
using namespace v8;
namespace JSE { namespace UI {
void JSEUILabel::SetMethods(Isolate *&isolate, Handle<FunctionTemplate> &tpl)
{
tpl->SetClassName(String::NewFromUtf8(isolate, "Label"));
JSE_UI_SET_ACCESSOR(tpl, "left", Get_left, Set_left);
JSE_UI_SET_ACCESSOR(tpl, "top", Get_top, Set_top);
JSE_UI_SET_ACCESSOR(tpl, "width", Get_width, Set_width);
JSE_UI_SET_ACCESSOR(tpl, "height", Get_height, Set_height);
JSE_UI_SET_ACCESSOR(tpl, "visible", Get_visible, Set_visible);
JSE_UI_SET_ACCESSOR(tpl, "text", Get_text, Set_text);
}
void JSEUILabel::SetEvents(JSEUILabel *self, JSEUILabelImpl *selfImpl)
{
//JSE_UI_SET_EVENTS(self, On_click(), selfImpl, clicked());
connect(selfImpl, SIGNAL(clicked()), self, SLOT(On_click()));
}
void JSEUILabel::Set_left(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
int left = value->Int32Value();
labelImpl->move(left, labelImpl->pos().y());
info.GetReturnValue().Set(left);
}
void JSEUILabel::Get_left(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
info.GetReturnValue().Set(labelImpl->pos().x());
}
void JSEUILabel::Set_top(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
int top = value->Int32Value();
labelImpl->move(labelImpl->pos().x(), top);
info.GetReturnValue().Set(top);
}
void JSEUILabel::Get_top(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
info.GetReturnValue().Set(labelImpl->pos().y());
}
void JSEUILabel::Set_width(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
int width = value->Int32Value();
labelImpl->resize(width, labelImpl->size().height());
}
void JSEUILabel::Get_width(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
info.GetReturnValue().Set(labelImpl->size().width());
}
void JSEUILabel::Set_height(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
int height = value->Int32Value();
labelImpl->resize(labelImpl->size().width(), height);
}
void JSEUILabel::Get_height(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
info.GetReturnValue().Set(labelImpl->size().height());
}
void JSEUILabel::Set_visible(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
bool visible = value->BooleanValue();
if (visible)
{
labelImpl->show();
}
else
{
labelImpl->hide();
}
}
void JSEUILabel::Get_visible(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
info.GetReturnValue().Set(labelImpl->isVisible());
}
void JSEUILabel::Set_text(Local<String> prop, Local<Value> value, const PropertyCallbackInfo<void> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
labelImpl->setText(*String::Utf8Value(value->ToString()));
}
void JSEUILabel::Get_text(Local<String> prop, const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
JSEUILabelImpl *labelImpl = GetImpl(info);
std::string labelText = labelImpl->text().toStdString();
info.GetReturnValue().Set(String::NewFromUtf8(isolate, labelText.c_str()));
}
}} | 27.276471 | 108 | 0.704119 | imzcy |
02f7deae038905e176a07113de95cd7fd55d963d | 3,260 | cc | C++ | src/libxtp/grids/regular_grid.cc | rubengerritsen/xtp | af4db53ca99853280d0e2ddc7f3c41bce8ae6e91 | [
"Apache-2.0"
] | null | null | null | src/libxtp/grids/regular_grid.cc | rubengerritsen/xtp | af4db53ca99853280d0e2ddc7f3c41bce8ae6e91 | [
"Apache-2.0"
] | null | null | null | src/libxtp/grids/regular_grid.cc | rubengerritsen/xtp | af4db53ca99853280d0e2ddc7f3c41bce8ae6e91 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2009-2020 The VOTCA Development Team
* (http://www.votca.org)
*
* 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.
*
*/
// Local VOTCA includes
#include "votca/xtp/regular_grid.h"
#include "votca/xtp/qmmolecule.h"
#include "votca/xtp/radial_euler_maclaurin_rule.h"
#include "votca/xtp/sphere_lebedev_rule.h"
namespace votca {
namespace xtp {
void Regular_Grid::GridSetup(const Eigen::Array3d& stepsizes,
const Eigen::Array3d& padding,
const QMMolecule& atoms, const AOBasis& basis) {
std::pair<Eigen::Vector3d, Eigen::Vector3d> extension =
atoms.CalcSpatialMinMax();
Eigen::Array3d min = extension.first.array();
Eigen::Array3d max = extension.second.array();
Eigen::Array3d doublesteps = (max - min + 2 * padding) / stepsizes + 1.0;
Eigen::Array<votca::Index, 3, 1> steps = (doublesteps.ceil()).cast<Index>();
// needed to symmetrize grid around molecule
Eigen::Array3d padding_sym =
(doublesteps - steps.cast<double>()) * stepsizes * 0.5 + padding;
GridSetup(steps, padding_sym, atoms, basis);
}
void Regular_Grid::GridSetup(const Eigen::Array<Index, 3, 1>& steps,
const Eigen::Array3d& padding,
const QMMolecule& atoms, const AOBasis& basis) {
std::pair<Eigen::Vector3d, Eigen::Vector3d> extension =
atoms.CalcSpatialMinMax();
Eigen::Array3d min = extension.first.array();
Eigen::Array3d max = extension.second.array();
startingpoint_ = min - padding;
stepsizes_ = (max - min + 2 * padding) / (steps - 1).cast<double>();
steps_ = steps;
const Index gridboxsize = 500;
GridBox gridbox;
for (Index i = 0; i < steps.x(); i++) {
double x = startingpoint_.x() + double(i) * stepsizes_.x();
for (Index j = 0; j < steps.y(); j++) {
double y = startingpoint_.y() + double(j) * stepsizes_.y();
for (Index k = 0; k < steps.z(); k++) {
double z = startingpoint_.z() + double(k) * stepsizes_.z();
GridContainers::Cartesian_gridpoint point;
point.grid_weight = 1.0;
point.grid_pos = Eigen::Vector3d(x, y, z);
gridbox.addGridPoint(point);
if (gridbox.size() == gridboxsize) {
grid_boxes_.push_back(gridbox);
gridbox = GridBox();
}
}
}
}
if (gridbox.size() > 0) {
grid_boxes_.push_back(gridbox);
}
#pragma omp parallel for
for (Index i = 0; i < getBoxesSize(); i++) {
grid_boxes_[i].FindSignificantShells(basis);
grid_boxes_[i].PrepareForIntegration();
}
totalgridsize_ = 0;
for (auto& box : grid_boxes_) {
totalgridsize_ += box.size();
}
}
} // namespace xtp
} // namespace votca
| 34.680851 | 78 | 0.636503 | rubengerritsen |
02f8bbc0d7d583e213b9f02c8795387551ab968b | 929 | cpp | C++ | 0138. Copy List with Random Pointer/solution_o1.cpp | Pluto-Zy/LeetCode | 3bb39fc5c000b344fd8727883b095943bd29c247 | [
"MIT"
] | null | null | null | 0138. Copy List with Random Pointer/solution_o1.cpp | Pluto-Zy/LeetCode | 3bb39fc5c000b344fd8727883b095943bd29c247 | [
"MIT"
] | null | null | null | 0138. Copy List with Random Pointer/solution_o1.cpp | Pluto-Zy/LeetCode | 3bb39fc5c000b344fd8727883b095943bd29c247 | [
"MIT"
] | null | null | null | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head) {
if (!head)
return nullptr;
// 在每个节点后复制一个新节点
for (Node* cur = head; cur; cur = cur->next->next) {
Node* temp = new Node(cur->val);
temp->next = cur->next;
cur->next = temp;
}
// 连接 random 指针
for (Node* cur = head; cur; cur = cur->next->next) {
cur->next->random = cur->random ? cur->random->next : nullptr;
}
// 剥离结果
Node* result = new Node(0);
for (Node* cur = head, *result_head = result; cur; cur = cur->next, result_head = result_head->next) {
result_head->next = cur->next;
cur->next = cur->next->next;
result_head->next->next = nullptr;
}
return result->next;
}
}; | 22.658537 | 106 | 0.543595 | Pluto-Zy |
02fc52df9f9d4341ec35fa32645fab1aab4fd47a | 5,956 | cpp | C++ | src/cbb/power_of_2.test.cpp | connorsmacd/Cbb | 494a8d822b1d7ac19b3714439d9bcdcb2e5079d7 | [
"MIT"
] | null | null | null | src/cbb/power_of_2.test.cpp | connorsmacd/Cbb | 494a8d822b1d7ac19b3714439d9bcdcb2e5079d7 | [
"MIT"
] | null | null | null | src/cbb/power_of_2.test.cpp | connorsmacd/Cbb | 494a8d822b1d7ac19b3714439d9bcdcb2e5079d7 | [
"MIT"
] | null | null | null | #define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <cbb/power_of_2_constants.hpp>
using namespace cbb;
using namespace ieme::fraction_literals;
TEST_CASE("power_of_2 construction", "[power_of_2]")
{
SECTION("default") { STATIC_REQUIRE(power_of_2().get_exponent() == 0); }
SECTION("from exponent")
{
STATIC_REQUIRE(power_of_2(power_of_2::from_exponent, -2).get_exponent()
== -2);
}
SECTION("from fraction")
{
SECTION("> 1")
{
STATIC_REQUIRE(power_of_2(fraction(8)).get_exponent() == 3);
}
SECTION("1")
{
STATIC_REQUIRE(power_of_2(fraction(1)).get_exponent() == 0);
}
SECTION("< 1")
{
STATIC_REQUIRE(power_of_2(1 / 16_fr).get_exponent() == -4);
}
}
}
TEST_CASE("power_of_2::get_value", "[power_of_2]")
{
STATIC_REQUIRE(numbers::one_8th.get_value() == 1 / 8_fr);
STATIC_REQUIRE(numbers::_1.get_value() == 1);
STATIC_REQUIRE(numbers::_32.get_value() == 32);
}
TEST_CASE("power_of_2 comparison operators", "[power_of_2]")
{
SECTION("equality")
{
STATIC_REQUIRE(numbers::one_half == numbers::one_half);
STATIC_REQUIRE_FALSE(numbers::one_half != numbers::one_half);
STATIC_REQUIRE(numbers::one_half == 1 / 2_fr);
STATIC_REQUIRE_FALSE(numbers::one_half != 1 / 2_fr);
STATIC_REQUIRE(1 / 2_fr == numbers::one_half);
STATIC_REQUIRE_FALSE(1 / 2_fr != numbers::one_half);
STATIC_REQUIRE(numbers::_4 == 4);
STATIC_REQUIRE_FALSE(numbers::_4 != 4);
STATIC_REQUIRE(4 == numbers::_4);
STATIC_REQUIRE_FALSE(4 != numbers::_4);
STATIC_REQUIRE_FALSE(numbers::one_half == numbers::one_quarter);
STATIC_REQUIRE(numbers::one_half != numbers::one_quarter);
STATIC_REQUIRE_FALSE(numbers::one_half == 1 / 3_fr);
STATIC_REQUIRE(numbers::one_half != 1 / 3_fr);
STATIC_REQUIRE_FALSE(1 / 3_fr == numbers::one_half);
STATIC_REQUIRE(1 / 3_fr != numbers::one_half);
STATIC_REQUIRE_FALSE(numbers::_4 == 5);
STATIC_REQUIRE(numbers::_4 != 5);
STATIC_REQUIRE_FALSE(-2 == numbers::_4);
STATIC_REQUIRE(-2 != numbers::_4);
}
SECTION("order")
{
STATIC_REQUIRE_FALSE(numbers::one_16th < numbers::one_16th);
STATIC_REQUIRE(numbers::one_16th <= numbers::one_16th);
STATIC_REQUIRE_FALSE(numbers::one_16th > numbers::one_16th);
STATIC_REQUIRE(numbers::one_16th >= numbers::one_16th);
STATIC_REQUIRE_FALSE(numbers::one_16th < 1 / 16_fr);
STATIC_REQUIRE(numbers::one_16th <= 1 / 16_fr);
STATIC_REQUIRE_FALSE(numbers::one_16th > 1 / 16_fr);
STATIC_REQUIRE(numbers::one_16th >= 1 / 16_fr);
STATIC_REQUIRE_FALSE(1 / 16_fr < numbers::one_16th);
STATIC_REQUIRE(1 / 16_fr <= numbers::one_16th);
STATIC_REQUIRE_FALSE(1 / 16_fr > numbers::one_16th);
STATIC_REQUIRE(1 / 16_fr >= numbers::one_16th);
STATIC_REQUIRE(numbers::one_16th < numbers::one_8th);
STATIC_REQUIRE(numbers::one_16th <= numbers::one_8th);
STATIC_REQUIRE_FALSE(numbers::one_16th > numbers::one_8th);
STATIC_REQUIRE_FALSE(numbers::one_16th >= numbers::one_8th);
STATIC_REQUIRE(numbers::one_16th < 1 / 15_fr);
STATIC_REQUIRE(numbers::one_16th <= 1 / 15_fr);
STATIC_REQUIRE_FALSE(numbers::one_16th > 1 / 15_fr);
STATIC_REQUIRE_FALSE(numbers::one_16th >= 1 / 15_fr);
STATIC_REQUIRE(1 / 9_fr < numbers::one_8th);
STATIC_REQUIRE(1 / 9_fr <= numbers::one_8th);
STATIC_REQUIRE_FALSE(1 / 9_fr > numbers::one_8th);
STATIC_REQUIRE_FALSE(1 / 9_fr >= numbers::one_8th);
STATIC_REQUIRE_FALSE(numbers::one_8th < numbers::one_16th);
STATIC_REQUIRE_FALSE(numbers::one_8th <= numbers::one_16th);
STATIC_REQUIRE(numbers::one_8th > numbers::one_16th);
STATIC_REQUIRE(numbers::one_8th >= numbers::one_16th);
STATIC_REQUIRE_FALSE(numbers::one_8th < 1 / 9_fr);
STATIC_REQUIRE_FALSE(numbers::one_8th <= 1 / 9_fr);
STATIC_REQUIRE(numbers::one_8th > 1 / 9_fr);
STATIC_REQUIRE(numbers::one_8th >= 1 / 9_fr);
STATIC_REQUIRE_FALSE(1 / 15_fr < numbers::one_16th);
STATIC_REQUIRE_FALSE(1 / 15_fr <= numbers::one_16th);
STATIC_REQUIRE(1 / 15_fr > numbers::one_16th);
STATIC_REQUIRE(1 / 15_fr >= numbers::one_16th);
}
}
TEST_CASE("power_of_2 arithmetic operators", "[power_of_2]")
{
SECTION("unary operator+") { STATIC_REQUIRE(+numbers::_2 == numbers::_2); }
SECTION("unary operator-") { STATIC_REQUIRE(-numbers::one_8th == -1 / 8_fr); }
SECTION("binary operator+")
{
STATIC_REQUIRE(numbers::one_8th + numbers::one_half == 5 / 8_fr);
STATIC_REQUIRE(numbers::one_8th + 3 / 4_fr == 7 / 8_fr);
STATIC_REQUIRE(1 / 4_fr + numbers::one_8th == 3 / 8_fr);
}
SECTION("binary operator-")
{
STATIC_REQUIRE(numbers::one_half - numbers::one_8th == 3 / 8_fr);
STATIC_REQUIRE(numbers::one_8th - 1 / 3_fr == -5 / 24_fr);
STATIC_REQUIRE(1 / 4_fr - numbers::_1 == -3 / 4_fr);
}
SECTION("operator*")
{
STATIC_REQUIRE(numbers::_16 * numbers::one_quarter == numbers::_4);
STATIC_REQUIRE(numbers::_16 * 1 / 3_fr == 16 / 3_fr);
STATIC_REQUIRE(1 / 5_fr * numbers::one_half == 1 / 10_fr);
}
SECTION("operator/")
{
STATIC_REQUIRE(numbers::_16 / numbers::one_half == numbers::_32);
STATIC_REQUIRE(numbers::_8 / (1 / 3_fr) == 24);
STATIC_REQUIRE(1 / 5_fr / numbers::one_quarter == 4 / 5_fr);
}
SECTION("operator%")
{
STATIC_REQUIRE(numbers::_8 % numbers::_2 == 0);
STATIC_REQUIRE(numbers::one_8th % numbers::_4 == numbers::one_8th);
STATIC_REQUIRE(numbers::_8 % (3 / 7_fr) == 2 / 7_fr);
STATIC_REQUIRE(3 / 11_fr % numbers::one_16th == 1 / 44_fr);
}
SECTION("operator*=")
{
static constexpr auto p = [&]() {
auto p = numbers::one_half;
p *= numbers::_8;
return p;
}();
STATIC_REQUIRE(p == numbers::_4);
}
SECTION("operator/=")
{
static constexpr auto p = [&]() {
auto p = numbers::_8;
p /= numbers::_2;
return p;
}();
STATIC_REQUIRE(p == numbers::_4);
}
}
| 30.860104 | 80 | 0.660678 | connorsmacd |
02fdd9d7db3de78875bf306b76b89691409e5d26 | 4,504 | cpp | C++ | sdk_core/src/third_party/FastCRC/FastCRCsw.cpp | elapidae/Livox-SDK | c51d62ab2a6ce7dd8efb059da6600b755ea75a39 | [
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause"
] | 345 | 2019-01-16T02:19:08.000Z | 2022-03-27T14:23:04.000Z | sdk_core/src/third_party/FastCRC/FastCRCsw.cpp | elapidae/Livox-SDK | c51d62ab2a6ce7dd8efb059da6600b755ea75a39 | [
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause"
] | 152 | 2019-01-31T06:53:01.000Z | 2022-03-30T18:34:02.000Z | sdk_core/src/third_party/FastCRC/FastCRCsw.cpp | elapidae/Livox-SDK | c51d62ab2a6ce7dd8efb059da6600b755ea75a39 | [
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause"
] | 171 | 2019-01-24T09:54:32.000Z | 2022-03-25T22:18:55.000Z | /* FastCRC library code is placed under the MIT license
* Copyright (c) 2014,2015,2016 Frank Bosing
*
* 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.
*/
//
// Thanks to:
// - Catalogue of parametrised CRC algorithms, CRC RevEng
// http://reveng.sourceforge.net/crc-catalogue/
//
// - Danjel McGougan (CRC-Table-Generator)
//
//
// modify from FastCRC library @ 2018/11/20
//
#include "../include/third_party/FastCRC/FastCRC.h"
#include "FastCRC_tables.hpp"
// ================= 16-BIT CRC ===================
/** Constructor
*/
FastCRC16::FastCRC16(uint16_t seed) {
seed_ = seed;
}
#define crc_n4(crc, data, table) crc ^= data; \
crc = (table[(crc & 0xff) + 0x300]) ^ \
(table[((crc >> 8) & 0xff) + 0x200]) ^ \
(table[((data >> 16) & 0xff) + 0x100]) ^ \
(table[data >> 24]);
/** MCRF4XX
* equivalent to _crc_ccitt_update() in crc16.h from avr_libc
* @param data Pointer to Data
* @param datalen Length of Data
* @return CRC value
*/
uint16_t FastCRC16::mcrf4xx_calc(const uint8_t *data, uint16_t len) {
uint16_t crc = seed_;
while (((uintptr_t)data & 3) && len) {
crc = (crc >> 8) ^ crc_table_mcrf4xx[(crc & 0xff) ^ *data++];
len--;
}
while (len >= 16) {
len -= 16;
crc_n4(crc, ((uint32_t *)data)[0], crc_table_mcrf4xx);
crc_n4(crc, ((uint32_t *)data)[1], crc_table_mcrf4xx);
crc_n4(crc, ((uint32_t *)data)[2], crc_table_mcrf4xx);
crc_n4(crc, ((uint32_t *)data)[3], crc_table_mcrf4xx);
data += 16;
}
while (len--) {
crc = (crc >> 8) ^ crc_table_mcrf4xx[(crc & 0xff) ^ *data++];
}
//seed = crc;
return crc;
}
// ================= 32-BIT CRC ===================
/** Constructor
*/
FastCRC32::FastCRC32(uint32_t seed) {
seed_ = seed;
}
#define crc_n4d(crc, data, table) crc ^= data; \
crc = (table[(crc & 0xff) + 0x300]) ^ \
(table[((crc >> 8) & 0xff) + 0x200]) ^ \
(table[((crc >> 16) & 0xff) + 0x100]) ^ \
(table[(crc >> 24) & 0xff]);
#define crcsm_n4d(crc, data, table) crc ^= data; \
crc = (crc >> 8) ^ (table[crc & 0xff]); \
crc = (crc >> 8) ^ (table[crc & 0xff]); \
crc = (crc >> 8) ^ (table[crc & 0xff]); \
crc = (crc >> 8) ^ (table[crc & 0xff]);
/** CRC32
* Alias CRC-32/ADCCP, PKZIP, Ethernet, 802.3
* @param data Pointer to Data
* @param datalen Length of Data
* @return CRC value
*/
#if CRC_BIGTABLES
#define CRC_TABLE_CRC32 crc_table_crc32_big
#else
#define CRC_TABLE_CRC32 crc_table_crc32
#endif
uint32_t FastCRC32::crc32_calc(const uint8_t *data, uint16_t len) {
uint32_t crc = seed_^0xffffffff;
while (((uintptr_t)data & 3) && len) {
crc = (crc >> 8) ^ CRC_TABLE_CRC32[(crc & 0xff) ^ *data++];
len--;
}
while (len >= 16) {
len -= 16;
#if CRC_BIGTABLES
crc_n4d(crc, ((uint32_t *)data)[0], CRC_TABLE_CRC32);
crc_n4d(crc, ((uint32_t *)data)[1], CRC_TABLE_CRC32);
crc_n4d(crc, ((uint32_t *)data)[2], CRC_TABLE_CRC32);
crc_n4d(crc, ((uint32_t *)data)[3], CRC_TABLE_CRC32);
#else
crcsm_n4d(crc, ((uint32_t *)data)[0], CRC_TABLE_CRC32);
crcsm_n4d(crc, ((uint32_t *)data)[1], CRC_TABLE_CRC32);
crcsm_n4d(crc, ((uint32_t *)data)[2], CRC_TABLE_CRC32);
crcsm_n4d(crc, ((uint32_t *)data)[3], CRC_TABLE_CRC32);
#endif
data += 16;
}
while (len--) {
crc = (crc >> 8) ^ CRC_TABLE_CRC32[(crc & 0xff) ^ *data++];
}
//seed = crc;
crc ^= 0xffffffff;
return crc;
}
| 29.058065 | 73 | 0.620337 | elapidae |
f301d325055aa027df3128f876c75b953d67701e | 13,341 | cpp | C++ | zodiacgraph/plug.cpp | IEEM-HsKA/Automotive-Security-Threat-Modelling-Tool | e3b2ea5a188b11aaa4bb329edcc0d3d1b47ae07b | [
"MIT"
] | 1 | 2021-12-08T13:27:22.000Z | 2021-12-08T13:27:22.000Z | zodiacgraph/plug.cpp | IEEM-HsKA/Automotive-Security-Threat-Modelling-Tool | e3b2ea5a188b11aaa4bb329edcc0d3d1b47ae07b | [
"MIT"
] | null | null | null | zodiacgraph/plug.cpp | IEEM-HsKA/Automotive-Security-Threat-Modelling-Tool | e3b2ea5a188b11aaa4bb329edcc0d3d1b47ae07b | [
"MIT"
] | null | null | null | #include "plug.h"
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QtMath> // for M_PI, qRadiansToDegrees
#include "drawedge.h"
#include "node.h"
#include "perimeter.h"
#include "plugedge.h"
#include "pluglabel.h"
#include "scene.h"
#include "utils.h"
static QGraphicsItem *getRootItemOf(QGraphicsItem *item);
namespace zodiac {
qreal Plug::s_width = 12.;
QColor Plug::s_inColor = QColor("#728872");
QColor Plug::s_outColor = QColor("#887272");
QColor Plug::s_highlightColor = QColor("#d1d7db");
bool Plug::s_toggleNodeExpansionOnEdgeCreation = true;
Qt::MouseButton Plug::s_drawEdgeButton = Qt::LeftButton;
Node *Plug::s_dragTargetNode = nullptr;
Plug *Plug::s_dragTargetPlug = nullptr;
Plug *Plug::s_edgeDrawingPlug = nullptr;
Plug::Plug(Node *parent, const QString &name, PlugDirection direction)
: QGraphicsObject(parent), m_name(name), m_direction(direction),
m_node(parent), m_arclength(0.1), m_normal(QVector2D(1., 0.)),
m_shape(QPainterPath()), m_isHighlighted(false),
m_edges(QSet<PlugEdge *>()), m_label(nullptr),
m_connectedPlugs(QSet<Plug *>()) {
// the perimeter needs to stack behind the node core
setFlag(ItemStacksBehindParent);
setCacheMode(DeviceCoordinateCache);
// the plug doesn't do anything with them, but needs to be enabled so they get
// send up to the node
setAcceptHoverEvents(true);
// only becomes visible as the node core expands
setVisible(false);
// create a label for this plug
m_label = new PlugLabel(this);
// initialize the members of this plug with default values
setHighlight(false);
}
void Plug::addEdge(PlugEdge *edge) {
// make sure the edge actually connects to this plug
Plug *startPlug = edge->getStartPlug();
Plug *endPlug = edge->getEndPlug();
bool isValid =
(((startPlug == this) || (endPlug == this)) // edge contains this plug
&& (!m_edges.contains(edge)) // edge is not already connected
&& (!m_connectedPlugs.contains(
startPlug)) // other plug is not already connected
&& (!m_connectedPlugs.contains(endPlug)) // " - "
&& (m_direction == PlugDirection::IN
? m_edges.count() == 0
: true)); // if incoming, not yet connected
#ifdef QT_DEBUG
Q_ASSERT(isValid);
#else
if (!isValid) {
return;
}
#endif
// store the edge and the other plug
m_edges.insert(edge);
if (startPlug == this) {
m_connectedPlugs.insert(endPlug);
} else {
m_connectedPlugs.insert(startPlug);
}
}
void Plug::removeEdge(PlugEdge *edge) {
#ifdef QT_DEBUG
Q_ASSERT(m_edges.contains(edge));
#else
if (!m_edges.contains(edge)) {
return;
}
#endif
// remove the edge
m_edges.remove(edge);
// remove the plug
Plug *startPlug = edge->getStartPlug();
Plug *endPlug = edge->getEndPlug();
if (m_connectedPlugs.contains(startPlug)) {
m_connectedPlugs.remove(startPlug);
} else {
Q_ASSERT(m_connectedPlugs.contains(endPlug));
m_connectedPlugs.remove(endPlug);
}
}
void Plug::defineShape(QVector2D normal, qreal arclength) {
// return early, if nothing has changed
if (qFuzzyCompare(normal.x(), m_normal.x()) &&
qFuzzyCompare(normal.y(), m_normal.y()) &&
qFuzzyCompare(arclength, m_arclength)) {
return;
}
m_normal = normal;
m_arclength = qAbs(arclength);
updateShape();
}
void Plug::updateEdges() const {
foreach (PlugEdge *edge, m_edges) { edge->plugHasChanged(); }
}
void Plug::updateExpansion(qreal expansion) {
// use visibility toggle to adjust edge stretch if necessary
setVisible(expansion != 0.0);
// update position
qreal targetDistance = m_node->getPerimeterRadius() -
(m_direction == PlugDirection::IN ? s_width : 0.);
QPointF pos = (m_normal * expansion * targetDistance).toPointF();
setPos(pos);
// update label tranparency
m_label->setOpacity(expansion);
// update any connected edges
updateEdges();
}
void Plug::setHighlight(bool highlight) {
m_isHighlighted = highlight;
m_label->setHighlight(highlight);
update();
}
QVector2D Plug::getTargetNormal() const {
// reset and return early, if there are no plugs to target
if (m_connectedPlugs.isEmpty()) {
return QVector2D(0, 0);
}
// get the average direction to all connected plugs (plus their respective
// normal)
QVector2D averageDirection(0, 0);
QVector2D thisPos(m_node->scenePos());
for (Plug *plug : m_connectedPlugs) {
QVector2D otherPos(plug->scenePos());
otherPos += plug->m_normal * plug->getNode()->getPerimeterRadius();
averageDirection += (otherPos - thisPos).normalized();
}
return averageDirection.normalized();
}
void Plug::aquireDrawEdge() {
#ifdef QT_DEBUG
Q_ASSERT(s_edgeDrawingPlug == nullptr);
#else
if (s_edgeDrawingPlug != nullptr) {
return;
}
#endif
s_edgeDrawingPlug = this;
m_node->getScene()->getDrawEdge()->setReverse(m_direction ==
PlugDirection::IN);
}
void Plug::advanceDrawEdge(const QPointF &scenePos) {
// due to some weird Qt event handling race conditions, this function is very
// occassionaly called on a Plug that is no longer the edge drawing plug. in
// this case, simply ignore the call.
if (s_edgeDrawingPlug != this) {
Q_ASSERT(s_edgeDrawingPlug == nullptr);
return;
}
// make sure the draw edge is visible as soon as the mouse moves (but no
// sooner)
DrawEdge *drawEdge = m_node->getScene()->getDrawEdge();
drawEdge->setVisible(true);
// find the topmost node under the mouse cursor
Node *targetNode = nullptr;
QGraphicsItem *plugNode =
parentItem(); // the parent item of this plug is always its node
for (QGraphicsItem *currentItem : scene()->items(scenePos)) {
QGraphicsItem *rootItem = getRootItemOf(currentItem);
if ((!rootItem) || (rootItem == plugNode)) {
continue;
}
targetNode = qobject_cast<Node *>(rootItem->toGraphicsObject());
if (targetNode) {
break;
}
}
// if we found a node and if it is not already the dragTargetNode, collapse
// the old node and expand the current
if (targetNode) {
bool isDrawingReverse = drawEdge->isReversed();
if (s_dragTargetNode != targetNode) {
if (s_dragTargetNode) {
s_dragTargetNode->softResetExpansion();
}
s_dragTargetNode = targetNode;
targetNode->softSetExpansion(isDrawingReverse ? NodeExpansion::OUT
: NodeExpansion::IN);
}
// highlight the closest plug
Plug *closestPlug = targetNode->getClosestPlugTo(
targetNode->mapFromScene(scenePos),
isDrawingReverse ? PlugDirection::OUT : PlugDirection::IN);
if (closestPlug) {
if ((closestPlug != this) && (s_dragTargetPlug != closestPlug)) {
closestPlug->setHighlight(true);
if (s_dragTargetPlug) {
s_dragTargetPlug->setHighlight(false);
}
s_dragTargetPlug = closestPlug;
}
// reset the target plug, if the node item has none
} else if (s_dragTargetPlug) {
s_dragTargetPlug->setHighlight(false);
s_dragTargetPlug = nullptr;
}
// if you found none but there is still an active dragTargetNode, collapse
// it
} else if (s_dragTargetNode) {
s_dragTargetNode->softResetExpansion();
s_dragTargetNode = nullptr;
// also reset the target plug
if (s_dragTargetPlug) {
s_dragTargetPlug->setHighlight(false);
s_dragTargetPlug = nullptr;
}
}
// update the draw edge
drawEdge->fromPlugToPoint(this, scenePos);
}
void Plug::releaseDrawEdge() {
// due to some weird Qt event handling race conditions, this function is very
// occassionaly called on a Plug that is no longer the edge drawing plug. in
// this case, simply ignore the call.
if (s_edgeDrawingPlug != this) {
Q_ASSERT(s_edgeDrawingPlug == nullptr);
return;
}
// if requested, expand the outgoing plugs of the target node if there is any
if (s_toggleNodeExpansionOnEdgeCreation && s_dragTargetNode) {
s_dragTargetNode->softSetExpansion(NodeExpansion::OUT);
}
// release the draw edge
Scene *nodeScene = m_node->getScene();
DrawEdge *drawEdge = nodeScene->getDrawEdge();
drawEdge->setVisible(false);
s_edgeDrawingPlug = nullptr;
s_dragTargetNode = nullptr;
// if there is a plug targeted at the moment of release, add an edge
if (s_dragTargetPlug) {
if (drawEdge->isReversed()) {
nodeScene->createEdge(s_dragTargetPlug, this);
} else {
nodeScene->createEdge(this, s_dragTargetPlug);
}
s_dragTargetPlug->setHighlight(false);
s_dragTargetPlug = nullptr;
}
}
void Plug::updateEdgeLabels() {
for (PlugEdge *edge : m_edges) {
edge->updateLabelText();
}
}
void Plug::updateStyle() {
updateShape();
m_label->updateStyle();
update();
}
qreal Plug::getArrangementPriority() {
qreal factor = 0.;
for (Plug *connectedPlug : m_connectedPlugs) {
factor += connectedPlug->getEdgeCount();
}
factor *= 0.5;
return factor + getEdgeCount();
}
QRectF Plug::boundingRect() const { return m_shape.boundingRect(); }
void Plug::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget * /* widget */) {
painter->setClipRect(option->exposedRect);
// define the pen to draw this plug
QBrush brush(Qt::SolidPattern);
if (m_isHighlighted) {
brush.setColor(s_highlightColor);
} else {
if (m_direction == PlugDirection::IN) {
brush.setColor(s_inColor);
} else {
brush.setColor(s_outColor);
}
}
// draw the plug
painter->setPen(Qt::NoPen);
painter->setBrush(brush);
painter->drawPath(m_shape);
}
QPainterPath Plug::shape() const { return m_shape; }
void Plug::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
// only highlight, if this is not a connected, incoming plug
if (mayReceiveInput()) {
setHighlight(true);
}
QGraphicsObject::hoverEnterEvent(event);
}
void Plug::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
setHighlight(false);
QGraphicsObject::hoverLeaveEvent(event);
}
void Plug::mousePressEvent(QGraphicsSceneMouseEvent *event) {
// only react to the draw edge button and only if this is not a connected
// incoming plug
if ((event->buttons() & s_drawEdgeButton) && mayReceiveInput()) {
aquireDrawEdge();
event->accept();
}
}
void Plug::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
advanceDrawEdge(event->scenePos());
return QGraphicsObject::mouseMoveEvent(event);
}
void Plug::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
releaseDrawEdge();
return QGraphicsItem::mouseReleaseEvent(event);
}
void Plug::setName(const QString &name) {
if (name == m_name) {
return;
}
m_name = name;
updateEdgeLabels();
updateStyle();
emit plugRenamed(m_name);
}
void Plug::updateShape() {
prepareGeometryChange();
// update the path traced by the plug
// the path is created in-place, meaning it does not need to be rotated
// as it turns out, rotating stuff (especially with labels attached that also
// rotate) is a MAYOR performance killer
qreal perimeterRadius = m_node->getPerimeterRadius() -
(m_direction == PlugDirection::IN ? s_width : 0.);
qreal arclength = qRadiansToDegrees(m_arclength);
qreal arcpos = qRadiansToDegrees(atan2(-m_normal.y(), m_normal.x()));
QPointF rectOffset =
QPointF(-m_normal.x() * perimeterRadius, -m_normal.y() * perimeterRadius);
QRectF outsideRect = quadrat(perimeterRadius + (s_width / 2.));
outsideRect.translate(rectOffset);
QRectF insideRect = quadrat(perimeterRadius - (s_width / 2.));
insideRect.translate(rectOffset);
QPainterPath path;
path.arcMoveTo(outsideRect, arcpos + (arclength / 2.));
path.arcTo(outsideRect, arcpos + (arclength / 2.), -arclength);
path.arcTo(insideRect, arcpos - (arclength / 2.), 0.);
path.arcTo(insideRect, arcpos - (arclength / 2.), arclength);
path.closeSubpath();
path = path.simplified();
m_shape.swap(path);
m_label->updateShape();
}
bool Plug::mayReceiveInput() {
const NodeExpansion nodeState = m_node->getExpansionState();
if (m_direction == PlugDirection::IN) {
return ((m_edges.count() == 0) && ((nodeState == NodeExpansion::IN) ||
(nodeState == NodeExpansion::BOTH)));
} else {
return ((nodeState == NodeExpansion::OUT) ||
(nodeState == NodeExpansion::BOTH));
}
}
} // namespace zodiac
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// HELPER
//
///
/// \brief Finds the root item in the ancestry of this item
///
/// Ignores items that do not accept hover events.
///
/// \param [in] item Item for which to search to root item.
///
/// \return The pointer to the root item of the one given or the
/// null pointer.
///
static QGraphicsItem *getRootItemOf(QGraphicsItem *item) {
for (QGraphicsItem *childItem = item; childItem != nullptr;
childItem = childItem->parentItem()) {
if (childItem->acceptHoverEvents()) {
item = childItem;
} else { // do not traverse past items that do not accept mouse hover events
// (like labels)
return nullptr;
}
}
return item;
}
| 29.580931 | 99 | 0.673188 | IEEM-HsKA |
f3042e91410e62719a0f494a6f58c2247191ffe1 | 2,007 | hpp | C++ | ext/src/javax/swing/Action.hpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | ext/src/javax/swing/Action.hpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | ext/src/javax/swing/Action.hpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | // Generated from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar
#pragma once
#include <fwd-POI.hpp>
#include <java/beans/fwd-POI.hpp>
#include <java/lang/fwd-POI.hpp>
#include <javax/swing/fwd-POI.hpp>
#include <java/awt/event/ActionListener.hpp>
struct javax::swing::Action
: public virtual ::java::awt::event::ActionListener
{
private:
static ::java::lang::String* ACCELERATOR_KEY_;
static ::java::lang::String* ACTION_COMMAND_KEY_;
static ::java::lang::String* DEFAULT_;
static ::java::lang::String* DISPLAYED_MNEMONIC_INDEX_KEY_;
static ::java::lang::String* LARGE_ICON_KEY_;
static ::java::lang::String* LONG_DESCRIPTION_;
static ::java::lang::String* MNEMONIC_KEY_;
static ::java::lang::String* NAME_;
static ::java::lang::String* SELECTED_KEY_;
static ::java::lang::String* SHORT_DESCRIPTION_;
static ::java::lang::String* SMALL_ICON_;
public:
virtual void addPropertyChangeListener(::java::beans::PropertyChangeListener* listener) = 0;
virtual ::java::lang::Object* getValue(::java::lang::String* key) = 0;
virtual bool isEnabled() = 0;
virtual void putValue(::java::lang::String* key, ::java::lang::Object* value) = 0;
virtual void removePropertyChangeListener(::java::beans::PropertyChangeListener* listener) = 0;
virtual void setEnabled(bool b) = 0;
// Generated
static ::java::lang::Class *class_();
static ::java::lang::String*& ACCELERATOR_KEY();
static ::java::lang::String*& ACTION_COMMAND_KEY();
static ::java::lang::String*& DEFAULT();
static ::java::lang::String*& DISPLAYED_MNEMONIC_INDEX_KEY();
static ::java::lang::String*& LARGE_ICON_KEY();
static ::java::lang::String*& LONG_DESCRIPTION();
static ::java::lang::String*& MNEMONIC_KEY();
static ::java::lang::String*& NAME();
static ::java::lang::String*& SELECTED_KEY();
static ::java::lang::String*& SHORT_DESCRIPTION();
static ::java::lang::String*& SMALL_ICON();
};
| 39.352941 | 99 | 0.691081 | pebble2015 |
f3054f24f5c217346d346593114e97f462aee9fb | 327 | cpp | C++ | contains-duplicate/contains-duplicate.cpp | deb-dutta-01/Leetcode_Practise | 3c577e0eb8fb1ce6b145e19083372b2989143f0d | [
"Apache-2.0"
] | null | null | null | contains-duplicate/contains-duplicate.cpp | deb-dutta-01/Leetcode_Practise | 3c577e0eb8fb1ce6b145e19083372b2989143f0d | [
"Apache-2.0"
] | null | null | null | contains-duplicate/contains-duplicate.cpp | deb-dutta-01/Leetcode_Practise | 3c577e0eb8fb1ce6b145e19083372b2989143f0d | [
"Apache-2.0"
] | null | null | null | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_set<int> res;
for(int num:nums){
if(res.find(num) == res.end()){
res.insert(num);
}
else
return true;
}
return false;
}
}; | 20.4375 | 47 | 0.428135 | deb-dutta-01 |
f3056323c7da80c5632d6798e7657bc4eafb2e40 | 3,895 | hpp | C++ | ql/methods/finitedifferences/operators/triplebandlinearop.hpp | autoantwort/QuantLib | 3261dde01de1b9c7ceb6c0cd1a2920da6e38eb3c | [
"BSD-3-Clause"
] | 1 | 2021-02-27T22:25:54.000Z | 2021-02-27T22:25:54.000Z | ql/methods/finitedifferences/operators/triplebandlinearop.hpp | autoantwort/QuantLib | 3261dde01de1b9c7ceb6c0cd1a2920da6e38eb3c | [
"BSD-3-Clause"
] | 16 | 2020-11-23T08:00:31.000Z | 2022-03-28T07:57:41.000Z | ql/methods/finitedifferences/operators/triplebandlinearop.hpp | fabianfh/QuantLib | 44230ddeb91629015ff6ff9aa079b07912dd2002 | [
"BSD-3-Clause"
] | 1 | 2016-11-01T13:51:45.000Z | 2016-11-01T13:51:45.000Z | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2008 Andreas Gaida
Copyright (C) 2008 Ralph Schreyer
Copyright (C) 2008 Klaus Spanderen
Copyright (C) 2014 Johannes Göttker-Schnetmann
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
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 license for more details.
*/
/*! \file triplebandlinearop.hpp
\brief general triple band linear operator
*/
#ifndef quantlib_triple_band_linear_op_hpp
#define quantlib_triple_band_linear_op_hpp
#include <ql/methods/finitedifferences/operators/fdmlinearop.hpp>
#if !defined(QL_USE_STD_UNIQUE_PTR)
#include <boost/shared_array.hpp>
#endif
#include <memory>
namespace QuantLib {
class FdmMesher;
class TripleBandLinearOp : public FdmLinearOp {
public:
TripleBandLinearOp(Size direction,
const ext::shared_ptr<FdmMesher>& mesher);
TripleBandLinearOp(const TripleBandLinearOp& m);
TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT;
#ifdef QL_USE_DISPOSABLE
TripleBandLinearOp(const Disposable<TripleBandLinearOp>& m);
#endif
TripleBandLinearOp& operator=(const TripleBandLinearOp& m);
TripleBandLinearOp& operator=(TripleBandLinearOp&& m) QL_NOEXCEPT;
#ifdef QL_USE_DISPOSABLE
TripleBandLinearOp& operator=(const Disposable<TripleBandLinearOp>& m);
#endif
Disposable<Array> apply(const Array& r) const override;
Disposable<Array> solve_splitting(const Array& r, Real a,
Real b = 1.0) const;
Disposable<TripleBandLinearOp> mult(const Array& u) const;
// interpret u as the diagonal of a diagonal matrix, multiplied on LHS
Disposable<TripleBandLinearOp> multR(const Array& u) const;
// interpret u as the diagonal of a diagonal matrix, multiplied on RHS
Disposable<TripleBandLinearOp> add(const TripleBandLinearOp& m) const;
Disposable<TripleBandLinearOp> add(const Array& u) const;
// some very basic linear algebra routines
void axpyb(const Array& a, const TripleBandLinearOp& x,
const TripleBandLinearOp& y, const Array& b);
void swap(TripleBandLinearOp& m);
#if !defined(QL_NO_UBLAS_SUPPORT)
Disposable<SparseMatrix> toMatrix() const override;
#endif
protected:
TripleBandLinearOp() = default;
Size direction_;
#if !defined(QL_USE_STD_UNIQUE_PTR)
boost::shared_array<Size> i0_, i2_;
boost::shared_array<Size> reverseIndex_;
boost::shared_array<Real> lower_, diag_, upper_;
#else
std::unique_ptr<Size[]> i0_, i2_;
std::unique_ptr<Size[]> reverseIndex_;
std::unique_ptr<Real[]> lower_, diag_, upper_;
#endif
ext::shared_ptr<FdmMesher> mesher_;
};
inline TripleBandLinearOp::TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT {
swap(m);
}
inline TripleBandLinearOp& TripleBandLinearOp::operator=(const TripleBandLinearOp& m) {
TripleBandLinearOp tmp(m);
swap(tmp);
return *this;
}
inline TripleBandLinearOp& TripleBandLinearOp::operator=(TripleBandLinearOp&& m) QL_NOEXCEPT {
swap(m);
return *this;
}
}
#endif
| 34.469027 | 98 | 0.691913 | autoantwort |
f305fe08d9bca25526b9ca438afbff6c37ddddea | 650 | cpp | C++ | src/errors.cpp | miniriley2012/flags | 3f001f16100e66bbd9aa4a07661900466318f972 | [
"MIT"
] | null | null | null | src/errors.cpp | miniriley2012/flags | 3f001f16100e66bbd9aa4a07661900466318f972 | [
"MIT"
] | null | null | null | src/errors.cpp | miniriley2012/flags | 3f001f16100e66bbd9aa4a07661900466318f972 | [
"MIT"
] | null | null | null | //
// Created by Riley Quinn on 6/14/20.
//
#include "flags/errors.hpp"
std::string flags::errors::make_option_error_str(const option_error err, const std::string &option_name) {
switch (err) {
case undefined: {
return "Undefined option '" + option_name + "'.";
}
case missing_value:
return "Missing value for '" + option_name + "'.";
case missing_required:
return "Missing required option '" + option_name + "'.";
case validation_error:
return "Validation failed for '" + option_name + "'.";
default:
return "undefined error";
}
}
| 29.545455 | 106 | 0.58 | miniriley2012 |
f307086c0b7891029d7533d424657dcc26b150b8 | 2,257 | cpp | C++ | Roguelike/Code/Game/PursueBehavior.cpp | cugone/Roguelike | 0f53a1ae2a37e683773c1707ce4aeb056973af13 | [
"MIT"
] | null | null | null | Roguelike/Code/Game/PursueBehavior.cpp | cugone/Roguelike | 0f53a1ae2a37e683773c1707ce4aeb056973af13 | [
"MIT"
] | 4 | 2021-05-04T03:21:49.000Z | 2021-10-06T05:21:24.000Z | Roguelike/Code/Game/PursueBehavior.cpp | cugone/Roguelike | 0f53a1ae2a37e683773c1707ce4aeb056973af13 | [
"MIT"
] | 2 | 2020-01-19T00:50:34.000Z | 2021-04-01T07:51:02.000Z | #include "Game/PursueBehavior.hpp"
#include "Engine/Math/MathUtils.hpp"
#include "Game/Actor.hpp"
#include "Game/Command.hpp"
#include "Game/RestCommand.hpp"
#include "Game/MoveCommand.hpp"
#include "Game/MoveNorthCommand.hpp"
#include "Game/MoveSouthCommand.hpp"
#include "Game/MoveEastCommand.hpp"
#include "Game/MoveWestCommand.hpp"
#include "Game/MoveNorthEastCommand.hpp"
#include "Game/MoveNorthWestCommand.hpp"
#include "Game/MoveSouthEastCommand.hpp"
#include "Game/MoveSouthWestCommand.hpp"
#include "Game/Map.hpp"
#include "Game/Pathfinder.hpp"
PursueBehavior::PursueBehavior() noexcept
: PursueBehavior(nullptr)
{}
PursueBehavior::PursueBehavior(Actor* target) noexcept
: Behavior(target)
{
SetName("pursue");
SetTarget(target);
}
void PursueBehavior::InitializePathfinding() {
auto* target = GetTarget();
if(target) {
pather = target->map->GetPathfinder();
pather->Initialize(IntVector2{target->map->CalcMaxDimensions()});
}
}
void PursueBehavior::SetTarget(Actor* target) noexcept {
Behavior::SetTarget(target);
InitializePathfinding();
}
void PursueBehavior::Act(Actor* actor) noexcept {
const auto viable = [this, actor](const IntVector2& a)->bool {
const auto coords = IntVector3{a, 0};
const auto* map = actor->map;
return map->IsTilePassable(coords);
};
const auto h = [](const IntVector2& a, const IntVector2& b) {
return MathUtils::CalculateManhattanDistance(a, b);
};
const auto d = [this](const IntVector2& a, const IntVector2& b) {
const auto va = Vector2{a} + Vector2{0.5f, 0.5f};
const auto vb = Vector2{b} + Vector2{0.5f, 0.5f};
return MathUtils::CalcDistance(va, vb);
};
const auto& my_loc = actor->GetPosition();
const auto& target_loc = GetTarget()->GetPosition();
pather->AStar(my_loc, target_loc, viable, h, d);
const auto path = pather->GetResult();
for(auto& node : path) {
const auto coords = IntVector3{node->coords, 0};
const auto* amap = actor->map;
auto* tile = amap->GetTile(coords);
if(tile) {
tile->color = Rgba::White;
}
}
}
float PursueBehavior::CalculateUtility() noexcept {
return 0.0f;
}
| 28.935897 | 73 | 0.671245 | cugone |
f30996556ecddf8e348c2fe2bbfb2caa636bfef6 | 3,200 | cpp | C++ | util/scanner_sim/servescanner.cpp | cdla/murfi2 | 45dba5eb90e7f573f01706a50e584265f0f8ffa7 | [
"Apache-2.0"
] | 7 | 2015-02-10T17:00:49.000Z | 2021-07-27T22:09:43.000Z | util/scanner_sim/servescanner.cpp | cdla/murfi2 | 45dba5eb90e7f573f01706a50e584265f0f8ffa7 | [
"Apache-2.0"
] | 11 | 2015-02-22T19:15:53.000Z | 2021-08-04T17:26:18.000Z | util/scanner_sim/servescanner.cpp | cdla/murfi2 | 45dba5eb90e7f573f01706a50e584265f0f8ffa7 | [
"Apache-2.0"
] | 8 | 2015-07-06T22:31:51.000Z | 2019-04-22T21:22:07.000Z |
#include"ace/SOCK_Stream.h"
#include"ace/SOCK_Connector.h"
#include"ace/SOCK_Stream.h"
#include<iostream>
#include<cstring>
#include<cstdio>
#include"../../src/io/RtExternalSenderImageInfo.h"
using namespace std;
// noise proerties
bool noise = false;
unsigned short max_noise = 50;
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int num2send = argc > 1 ? atoi(argv[1]) : -1;
char *data = (char*) calloc(EXTERNALSENDERSIZEOF,1);
FILE* fp = fopen("scan_dat.hdr","rb");
fread(data, EXTERNALSENDERSIZEOF, 1, fp);
fclose(fp);
// make the image info to send
RtExternalImageInfo *ei = new RtExternalImageInfo(data, EXTERNALSENDERSIZEOF);
char *send = (char*) calloc(EXTERNALSENDERSIZEOF,1);
// make the test data to send
// int i, numPix = ei->nCol * ei->nLin,
// imageDataSize = numPix * sizeof(unsigned short);
// unsigned short *img = new unsigned short[numPix];
// fp = fopen("scanner_testimg.dat","rb");
// fread(img, sizeof(unsigned short), ei->nCol * ei->nLin, fp);
// fclose(fp);
// unsigned short *imgnoisy = new unsigned short[numPix];
int i;
delete ei;
// Local server address.
ACE_INET_Addr my_addr ( argc > 2 ? atoi(argv[2]) : 15000,
argc > 1 ? argv[1] : "localhost");
// Data transfer object.
ACE_SOCK_Stream stream;
// Initialize the connector.
ACE_SOCK_Connector connector;
// keep making new connections
int numImg = 20;
for(i = 1; (num2send < 0 || i <= num2send)
&& connector.connect (stream, my_addr) != -1; i++) {
char fn[100];
sprintf(fn,"testimg/img%05d.dat",(i-1)%numImg+1);
//sprintf(fn,"testimg/img00001.dat",(i-1)%numImg+1);
//sprintf(fn,"scanner_testimg.dat");
cout << "loading image " << fn << " to send" << endl;
fp = fopen(fn,"rb");
int w, h, c;
fread(&w, sizeof(int), 1, fp);
fread(&h, sizeof(int), 1, fp);
fread(&c, sizeof(int), 1, fp);
int numPix = w*h,
imageDataSize = numPix * sizeof(unsigned short);
unsigned short *img = new unsigned short[numPix];
unsigned short *imgnoisy = new unsigned short[numPix];
fread(img, sizeof(unsigned short), w*h, fp);
fclose(fp);
ei = new RtExternalImageInfo(data, EXTERNALSENDERSIZEOF);
ei->nCol = h;
ei->nLin = w;
ei->iAcquisitionNumber = i;
cout << "sending img " << ei->iAcquisitionNumber << endl;
send = ei->convertToScannerDataArray();
//data = ei.convertToScannerDataArray();
cout << "sending info of size " << ei->iSizeOfRtExternalImageInfo << endl;
stream.send_n (send, ei->iSizeOfRtExternalImageInfo);
//free(data);
cout << "sending img of size " << imageDataSize << endl;
// add some noise to the image
if(noise) {
memcpy(imgnoisy, img, sizeof(unsigned short)* ei->nCol * ei->nLin);
for(int i = 0; i < ei->nCol * ei->nLin; i++) {
unsigned short val;
while (max_noise <= (val = rand() / (RAND_MAX/max_noise)));
imgnoisy[i] = imgnoisy[i] + val;
}
stream.send_n (imgnoisy, imageDataSize);
}
else {
stream.send_n (img, imageDataSize);
}
usleep(2000000);
stream.close();
delete ei;
delete img;
delete imgnoisy;
}
free(data);
free(send);
return 0;
}
| 25.19685 | 80 | 0.633125 | cdla |
f30ab6821b9bacb341deb9e33549570028efce01 | 21,145 | cc | C++ | media/cast/net/pacing/paced_sender_unittest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-11-16T13:10:29.000Z | 2021-11-16T13:10:29.000Z | media/cast/net/pacing/paced_sender_unittest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | media/cast/net/pacing/paced_sender_unittest.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include "base/big_endian.h"
#include "base/containers/circular_deque.h"
#include "base/test/simple_test_tick_clock.h"
#include "media/base/fake_single_thread_task_runner.h"
#include "media/cast/net/pacing/paced_sender.h"
#include "testing/gmock/include/gmock/gmock.h"
using testing::_;
namespace media {
namespace cast {
namespace {
const uint8_t kValue = 123;
const size_t kSize1 = 101;
const size_t kSize2 = 102;
const size_t kSize3 = 103;
const size_t kSize4 = 104;
const size_t kNackSize = 105;
const int64_t kStartMillisecond = INT64_C(12345678900000);
const uint32_t kVideoSsrc = 0x1234;
const uint32_t kAudioSsrc = 0x5678;
const uint32_t kVideoFrameRtpTimestamp = 12345;
const uint32_t kAudioFrameRtpTimestamp = 23456;
// RTCP packets don't really have a packet ID. However, the bytes where
// TestPacketSender checks for the ID should be set to 31611, so we'll just
// check that.
const uint16_t kRtcpPacketIdMagic = UINT16_C(31611);
class TestPacketSender : public PacketTransport {
public:
TestPacketSender() : bytes_sent_(0) {}
TestPacketSender(const TestPacketSender&) = delete;
TestPacketSender& operator=(const TestPacketSender&) = delete;
bool SendPacket(PacketRef packet, base::OnceClosure cb) final {
EXPECT_FALSE(expected_packet_sizes_.empty());
size_t expected_packet_size = expected_packet_sizes_.front();
expected_packet_sizes_.pop_front();
EXPECT_EQ(expected_packet_size, packet->data.size());
bytes_sent_ += packet->data.size();
// Parse for the packet ID and confirm it is the next one we expect.
EXPECT_LE(kSize1, packet->data.size());
base::BigEndianReader reader(reinterpret_cast<char*>(&packet->data[0]),
packet->data.size());
bool success = reader.Skip(14);
uint16_t packet_id = 0xffff;
success &= reader.ReadU16(&packet_id);
EXPECT_TRUE(success);
const uint16_t expected_packet_id = expected_packet_ids_.front();
expected_packet_ids_.pop_front();
EXPECT_EQ(expected_packet_id, packet_id);
return true;
}
int64_t GetBytesSent() final { return bytes_sent_; }
void StartReceiving(PacketReceiverCallbackWithStatus packet_receiver) final {}
void StopReceiving() final {}
void AddExpectedSizesAndPacketIds(int packet_size,
uint16_t first_packet_id,
int sequence_length) {
for (int i = 0; i < sequence_length; ++i) {
expected_packet_sizes_.push_back(packet_size);
expected_packet_ids_.push_back(first_packet_id++);
}
}
bool expecting_nothing_else() const { return expected_packet_sizes_.empty(); }
private:
base::circular_deque<int> expected_packet_sizes_;
base::circular_deque<uint16_t> expected_packet_ids_;
int64_t bytes_sent_;
};
class PacedSenderTest : public ::testing::Test {
public:
PacedSenderTest(const PacedSenderTest&) = delete;
PacedSenderTest& operator=(const PacedSenderTest&) = delete;
protected:
PacedSenderTest() {
testing_clock_.Advance(base::Milliseconds(kStartMillisecond));
task_runner_ = new FakeSingleThreadTaskRunner(&testing_clock_);
paced_sender_ = std::make_unique<PacedSender>(
kTargetBurstSize, kMaxBurstSize, &testing_clock_, &packet_events_,
&mock_transport_, task_runner_);
paced_sender_->RegisterSsrc(kAudioSsrc, true);
paced_sender_->RegisterSsrc(kVideoSsrc, false);
}
static void UpdateCastTransportStatus(CastTransportStatus status) {
NOTREACHED();
}
SendPacketVector CreateSendPacketVector(size_t packet_size,
int num_of_packets_in_frame,
bool audio) {
DCHECK_GE(packet_size, 12u);
SendPacketVector packets;
base::TimeTicks frame_tick = testing_clock_.NowTicks();
// Advance the clock so that we don't get the same |frame_tick|
// next time this function is called.
testing_clock_.Advance(base::Milliseconds(1));
for (int i = 0; i < num_of_packets_in_frame; ++i) {
PacketKey key(frame_tick, audio ? kAudioSsrc : kVideoSsrc,
FrameId::first(), i);
PacketRef packet(new base::RefCountedData<Packet>);
packet->data.resize(packet_size, kValue);
// Fill-in packet header fields to test the header parsing (for populating
// the logging events).
base::BigEndianWriter writer(reinterpret_cast<char*>(&packet->data[0]),
packet_size);
bool success = writer.Skip(4);
success &= writer.WriteU32(audio ? kAudioFrameRtpTimestamp
: kVideoFrameRtpTimestamp);
success &= writer.WriteU32(audio ? kAudioSsrc : kVideoSsrc);
success &= writer.Skip(2);
success &= writer.WriteU16(i);
success &= writer.WriteU16(num_of_packets_in_frame - 1);
CHECK(success);
packets.push_back(std::make_pair(key, packet));
}
return packets;
}
void SendWithoutBursting(const SendPacketVector& packets) {
const size_t kBatchSize = 10;
for (size_t i = 0; i < packets.size(); i += kBatchSize) {
const SendPacketVector next_batch(
packets.begin() + i,
packets.begin() + i + std::min(packets.size() - i, kBatchSize));
ASSERT_TRUE(paced_sender_->SendPackets(next_batch));
testing_clock_.Advance(base::Milliseconds(10));
task_runner_->RunTasks();
}
}
// Use this function to drain the packet list in PacedSender without having
// to test the pacing implementation details.
bool RunUntilEmpty(int max_tries) {
for (int i = 0; i < max_tries; i++) {
testing_clock_.Advance(base::Milliseconds(10));
task_runner_->RunTasks();
if (mock_transport_.expecting_nothing_else())
return true;
}
return mock_transport_.expecting_nothing_else();
}
std::vector<PacketEvent> packet_events_;
base::SimpleTestTickClock testing_clock_;
TestPacketSender mock_transport_;
scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
std::unique_ptr<PacedSender> paced_sender_;
};
} // namespace
TEST_F(PacedSenderTest, PassThroughRtcp) {
SendPacketVector packets = CreateSendPacketVector(kSize1, 1, true);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->SendPackets(packets));
EXPECT_TRUE(paced_sender_->ResendPackets(packets, DedupInfo()));
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, kRtcpPacketIdMagic, 1);
Packet tmp(kSize2, kValue);
EXPECT_TRUE(
paced_sender_->SendRtcpPacket(1, new base::RefCountedData<Packet>(tmp)));
}
TEST_F(PacedSenderTest, BasicPace) {
int num_of_packets = 27;
SendPacketVector packets =
CreateSendPacketVector(kSize1, num_of_packets, false);
const base::TimeTicks earliest_event_timestamp = testing_clock_.NowTicks();
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 10);
EXPECT_TRUE(paced_sender_->SendPackets(packets));
// Check that we get the next burst.
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(10), 10);
base::TimeDelta timeout = base::Milliseconds(10);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// If we call process too early make sure we don't send any packets.
timeout = base::Milliseconds(5);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// Check that we get the next burst.
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(20), 7);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// Check that we don't get any more packets.
EXPECT_TRUE(RunUntilEmpty(3));
const base::TimeTicks latest_event_timestamp = testing_clock_.NowTicks();
// Check that packet logging events match expected values.
EXPECT_EQ(num_of_packets, static_cast<int>(packet_events_.size()));
uint16_t expected_packet_id = 0;
for (const PacketEvent& e : packet_events_) {
ASSERT_LE(earliest_event_timestamp, e.timestamp);
ASSERT_GE(latest_event_timestamp, e.timestamp);
ASSERT_EQ(PACKET_SENT_TO_NETWORK, e.type);
ASSERT_EQ(VIDEO_EVENT, e.media_type);
ASSERT_EQ(kVideoFrameRtpTimestamp, e.rtp_timestamp.lower_32_bits());
ASSERT_EQ(num_of_packets - 1, e.max_packet_id);
ASSERT_EQ(expected_packet_id++, e.packet_id);
ASSERT_EQ(kSize1, e.size);
}
}
TEST_F(PacedSenderTest, PaceWithNack) {
// Testing what happen when we get multiple NACK requests for a fully lost
// frames just as we sent the first packets in a frame.
int num_of_packets_in_frame = 12;
int num_of_packets_in_nack = 12;
SendPacketVector nack_packets =
CreateSendPacketVector(kNackSize, num_of_packets_in_nack, false);
SendPacketVector first_frame_packets =
CreateSendPacketVector(kSize1, num_of_packets_in_frame, false);
SendPacketVector second_frame_packets =
CreateSendPacketVector(kSize2, num_of_packets_in_frame, true);
// Check that the first burst of the frame go out on the wire.
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 10);
EXPECT_TRUE(paced_sender_->SendPackets(first_frame_packets));
// Add first NACK request.
EXPECT_TRUE(paced_sender_->ResendPackets(nack_packets, DedupInfo()));
// Check that we get the first NACK burst.
mock_transport_.AddExpectedSizesAndPacketIds(kNackSize, UINT16_C(0), 10);
base::TimeDelta timeout = base::Milliseconds(10);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// Add second NACK request.
EXPECT_TRUE(paced_sender_->ResendPackets(nack_packets, DedupInfo()));
// Check that we get the next NACK burst.
mock_transport_.AddExpectedSizesAndPacketIds(kNackSize, UINT16_C(10), 2);
mock_transport_.AddExpectedSizesAndPacketIds(kNackSize, UINT16_C(0), 8);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// End of NACK plus two packets from the oldest frame.
// Note that two of the NACKs have been de-duped.
mock_transport_.AddExpectedSizesAndPacketIds(kNackSize, UINT16_C(8), 2);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(10), 2);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// Add second frame.
// Make sure we don't delay the second frame due to the previous packets.
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(0), 10);
EXPECT_TRUE(paced_sender_->SendPackets(second_frame_packets));
// Last packets of frame 2.
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(10), 2);
testing_clock_.Advance(timeout);
task_runner_->RunTasks();
// No more packets.
EXPECT_TRUE(RunUntilEmpty(5));
int expected_video_network_event_count = num_of_packets_in_frame;
int expected_video_retransmitted_event_count = 2 * num_of_packets_in_nack;
expected_video_retransmitted_event_count -= 2; // 2 packets deduped
int expected_audio_network_event_count = num_of_packets_in_frame;
EXPECT_EQ(expected_video_network_event_count +
expected_video_retransmitted_event_count +
expected_audio_network_event_count,
static_cast<int>(packet_events_.size()));
int audio_network_event_count = 0;
int video_network_event_count = 0;
int video_retransmitted_event_count = 0;
for (const PacketEvent& e : packet_events_) {
if (e.type == PACKET_SENT_TO_NETWORK) {
if (e.media_type == VIDEO_EVENT)
video_network_event_count++;
else
audio_network_event_count++;
} else if (e.type == PACKET_RETRANSMITTED) {
if (e.media_type == VIDEO_EVENT)
video_retransmitted_event_count++;
} else {
FAIL() << "Got unexpected event type " << CastLoggingToString(e.type);
}
}
EXPECT_EQ(expected_audio_network_event_count, audio_network_event_count);
EXPECT_EQ(expected_video_network_event_count, video_network_event_count);
EXPECT_EQ(expected_video_retransmitted_event_count,
video_retransmitted_event_count);
}
TEST_F(PacedSenderTest, PaceWith60fps) {
// Testing what happen when we get multiple NACK requests for a fully lost
// frames just as we sent the first packets in a frame.
int num_of_packets_in_frame = 17;
SendPacketVector first_frame_packets =
CreateSendPacketVector(kSize1, num_of_packets_in_frame, false);
SendPacketVector second_frame_packets =
CreateSendPacketVector(kSize2, num_of_packets_in_frame, false);
SendPacketVector third_frame_packets =
CreateSendPacketVector(kSize3, num_of_packets_in_frame, false);
SendPacketVector fourth_frame_packets =
CreateSendPacketVector(kSize4, num_of_packets_in_frame, false);
base::TimeDelta timeout_10ms = base::Milliseconds(10);
// Check that the first burst of the frame go out on the wire.
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 10);
EXPECT_TRUE(paced_sender_->SendPackets(first_frame_packets));
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(10), 7);
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
testing_clock_.Advance(base::Milliseconds(6));
// Add second frame, after 16 ms.
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(0), 3);
EXPECT_TRUE(paced_sender_->SendPackets(second_frame_packets));
testing_clock_.Advance(base::Milliseconds(4));
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(3), 10);
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(13), 4);
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
testing_clock_.Advance(base::Milliseconds(3));
// Add third frame, after 33 ms.
mock_transport_.AddExpectedSizesAndPacketIds(kSize3, UINT16_C(0), 6);
EXPECT_TRUE(paced_sender_->SendPackets(third_frame_packets));
mock_transport_.AddExpectedSizesAndPacketIds(kSize3, UINT16_C(6), 10);
testing_clock_.Advance(base::Milliseconds(7));
task_runner_->RunTasks();
// Add fourth frame, after 50 ms.
EXPECT_TRUE(paced_sender_->SendPackets(fourth_frame_packets));
mock_transport_.AddExpectedSizesAndPacketIds(kSize3, UINT16_C(16), 1);
mock_transport_.AddExpectedSizesAndPacketIds(kSize4, UINT16_C(0), 9);
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
mock_transport_.AddExpectedSizesAndPacketIds(kSize4, UINT16_C(9), 8);
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
testing_clock_.Advance(timeout_10ms);
task_runner_->RunTasks();
// No more packets.
EXPECT_TRUE(RunUntilEmpty(5));
}
TEST_F(PacedSenderTest, SendPriority) {
// Actual order to the network is:
// 1. Video packets x 10.
// 2. RTCP packet x 1.
// 3. Audio packet x 1.
// 4. Video retransmission packet x 10.
// 5. Video packet x 10.
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(0), 10);
mock_transport_.AddExpectedSizesAndPacketIds(kSize3, kRtcpPacketIdMagic, 1);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
mock_transport_.AddExpectedSizesAndPacketIds(kSize4, UINT16_C(0), 10);
mock_transport_.AddExpectedSizesAndPacketIds(kSize2, UINT16_C(10), 10);
paced_sender_->RegisterPrioritySsrc(kAudioSsrc);
// Retransmission packets with the earlier timestamp.
SendPacketVector resend_packets = CreateSendPacketVector(kSize4, 10, false);
testing_clock_.Advance(base::Milliseconds(10));
// Send 20 normal video packets. Only 10 will be sent in this
// call, the rest will be sitting in the queue waiting for pacing.
EXPECT_TRUE(
paced_sender_->SendPackets(CreateSendPacketVector(kSize2, 20, false)));
testing_clock_.Advance(base::Milliseconds(10));
// Send normal audio packet. This is queued and will be sent
// earlier than video packets.
EXPECT_TRUE(
paced_sender_->SendPackets(CreateSendPacketVector(kSize1, 1, true)));
// Send RTCP packet. This is queued and will be sent first.
EXPECT_TRUE(paced_sender_->SendRtcpPacket(
kVideoSsrc, new base::RefCountedData<Packet>(Packet(kSize3, kValue))));
// Resend video packets. This is queued and will be sent
// earlier than normal video packets.
EXPECT_TRUE(paced_sender_->ResendPackets(resend_packets, DedupInfo()));
// Roll the clock. Queued packets will be sent in this order:
// 1. RTCP packet x 1.
// 2. Audio packet x 1.
// 3. Video retransmission packet x 10.
// 4. Video packet x 10.
task_runner_->RunTasks();
EXPECT_TRUE(RunUntilEmpty(4));
}
TEST_F(PacedSenderTest, GetLastByteSent) {
SendPacketVector packets1 = CreateSendPacketVector(kSize1, 1, true);
SendPacketVector packets2 = CreateSendPacketVector(kSize1, 1, false);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->SendPackets(packets1));
EXPECT_EQ(static_cast<int64_t>(kSize1),
paced_sender_->GetLastByteSentForPacket(packets1[0].first));
EXPECT_EQ(static_cast<int64_t>(kSize1),
paced_sender_->GetLastByteSentForSsrc(kAudioSsrc));
EXPECT_EQ(0, paced_sender_->GetLastByteSentForSsrc(kVideoSsrc));
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->SendPackets(packets2));
EXPECT_EQ(static_cast<int64_t>(2 * kSize1),
paced_sender_->GetLastByteSentForPacket(packets2[0].first));
EXPECT_EQ(static_cast<int64_t>(kSize1),
paced_sender_->GetLastByteSentForSsrc(kAudioSsrc));
EXPECT_EQ(static_cast<int64_t>(2 * kSize1),
paced_sender_->GetLastByteSentForSsrc(kVideoSsrc));
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->ResendPackets(packets1, DedupInfo()));
EXPECT_EQ(static_cast<int64_t>(3 * kSize1),
paced_sender_->GetLastByteSentForPacket(packets1[0].first));
EXPECT_EQ(static_cast<int64_t>(3 * kSize1),
paced_sender_->GetLastByteSentForSsrc(kAudioSsrc));
EXPECT_EQ(static_cast<int64_t>(2 * kSize1),
paced_sender_->GetLastByteSentForSsrc(kVideoSsrc));
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->ResendPackets(packets2, DedupInfo()));
EXPECT_EQ(static_cast<int64_t>(4 * kSize1),
paced_sender_->GetLastByteSentForPacket(packets2[0].first));
EXPECT_EQ(static_cast<int64_t>(3 * kSize1),
paced_sender_->GetLastByteSentForSsrc(kAudioSsrc));
EXPECT_EQ(static_cast<int64_t>(4 * kSize1),
paced_sender_->GetLastByteSentForSsrc(kVideoSsrc));
}
TEST_F(PacedSenderTest, DedupWithResendInterval) {
SendPacketVector packets = CreateSendPacketVector(kSize1, 1, true);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->SendPackets(packets));
testing_clock_.Advance(base::Milliseconds(10));
DedupInfo dedup_info;
dedup_info.resend_interval = base::Milliseconds(20);
// This packet will not be sent.
EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info));
EXPECT_EQ(static_cast<int64_t>(kSize1), mock_transport_.GetBytesSent());
dedup_info.resend_interval = base::Milliseconds(5);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 1);
EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info));
EXPECT_EQ(static_cast<int64_t>(2 * kSize1), mock_transport_.GetBytesSent());
}
TEST_F(PacedSenderTest, AllPacketsInSameFrameAreResentFairly) {
const int kNumPackets = 400;
SendPacketVector packets = CreateSendPacketVector(kSize1, kNumPackets, false);
// Send a large frame (400 packets, yeah!). Confirm that the paced sender
// sends each packet in the frame exactly once.
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0),
kNumPackets);
SendWithoutBursting(packets);
ASSERT_TRUE(mock_transport_.expecting_nothing_else());
// Resend packets 2 and 3. Confirm that the paced sender sends them. Then,
// resend all of the first 10 packets. The paced sender should send packets
// 0, 1, and 4 through 9 first, and then 2 and 3.
SendPacketVector couple_of_packets;
couple_of_packets.push_back(packets[2]);
couple_of_packets.push_back(packets[3]);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(2), 2);
SendWithoutBursting(couple_of_packets);
ASSERT_TRUE(mock_transport_.expecting_nothing_else());
SendPacketVector first_ten_packets;
for (size_t i = 0; i < 10; ++i)
first_ten_packets.push_back(packets[i]);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(0), 2);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(4), 6);
mock_transport_.AddExpectedSizesAndPacketIds(kSize1, UINT16_C(2), 2);
SendWithoutBursting(first_ten_packets);
ASSERT_TRUE(mock_transport_.expecting_nothing_else());
}
} // namespace cast
} // namespace media
| 39.157407 | 80 | 0.745188 | zealoussnow |
f30d097d8f4efc7f6f03b5c7ebba090089f4f309 | 8,176 | hpp | C++ | deps/boost/include/boost/hana/lazy.hpp | kindlychung/mediasoup-sfu-cpp | f69d2f48f7edbf4f0c57244280a47bea985f39cf | [
"Apache-2.0"
] | 995 | 2018-06-22T10:39:18.000Z | 2022-03-25T01:22:14.000Z | deps/boost/include/boost/hana/lazy.hpp | kindlychung/mediasoup-sfu-cpp | f69d2f48f7edbf4f0c57244280a47bea985f39cf | [
"Apache-2.0"
] | 32 | 2018-06-23T14:19:37.000Z | 2022-03-29T10:20:37.000Z | deps/boost/include/boost/hana/lazy.hpp | kindlychung/mediasoup-sfu-cpp | f69d2f48f7edbf4f0c57244280a47bea985f39cf | [
"Apache-2.0"
] | 172 | 2018-06-22T11:12:00.000Z | 2022-03-29T07:44:33.000Z | /*!
@file
Defines `boost::hana::lazy`.
@copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_LAZY_HPP
#define BOOST_HANA_LAZY_HPP
#include <boost/hana/fwd/lazy.hpp>
#include <boost/hana/basic_tuple.hpp>
#include <boost/hana/config.hpp>
#include <boost/hana/core/make.hpp>
#include <boost/hana/detail/decay.hpp>
#include <boost/hana/detail/operators/adl.hpp>
#include <boost/hana/detail/operators/monad.hpp>
#include <boost/hana/functional/apply.hpp>
#include <boost/hana/functional/compose.hpp>
#include <boost/hana/functional/on.hpp>
#include <boost/hana/fwd/ap.hpp>
#include <boost/hana/fwd/duplicate.hpp>
#include <boost/hana/fwd/eval.hpp>
#include <boost/hana/fwd/extend.hpp>
#include <boost/hana/fwd/extract.hpp>
#include <boost/hana/fwd/flatten.hpp>
#include <boost/hana/fwd/lift.hpp>
#include <boost/hana/fwd/transform.hpp>
#include <cstddef>
#include <type_traits>
#include <utility>
BOOST_HANA_NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
// lazy
//////////////////////////////////////////////////////////////////////////
template <typename Indices, typename F, typename ...Args>
struct lazy_apply_t;
namespace detail { struct lazy_secret { }; }
template <std::size_t ...n, typename F, typename ...Args>
struct lazy_apply_t<std::index_sequence<n...>, F, Args...>
: detail::operators::adl<>
{
template <typename ...T>
constexpr lazy_apply_t(detail::lazy_secret, T&& ...t)
: storage_{static_cast<T&&>(t)...}
{ }
basic_tuple<F, Args...> storage_;
using hana_tag = lazy_tag;
};
template <typename X>
struct lazy_value_t : detail::operators::adl<> {
template <typename Y>
constexpr lazy_value_t(detail::lazy_secret, Y&& y)
: storage_{static_cast<Y&&>(y)}
{ }
basic_tuple<X> storage_;
using hana_tag = lazy_tag;
// If this is called, we assume that `X` is in fact a function.
template <typename ...Args>
constexpr lazy_apply_t<
std::make_index_sequence<sizeof...(Args)>,
X, typename detail::decay<Args>::type...
> operator()(Args&& ...args) const& {
return {detail::lazy_secret{},
hana::at_c<0>(storage_), static_cast<Args&&>(args)...};
}
template <typename ...Args>
constexpr lazy_apply_t<
std::make_index_sequence<sizeof...(Args)>,
X, typename detail::decay<Args>::type...
> operator()(Args&& ...args) && {
return {detail::lazy_secret{},
static_cast<X&&>(hana::at_c<0>(storage_)),
static_cast<Args&&>(args)...
};
}
};
//////////////////////////////////////////////////////////////////////////
// make<lazy_tag>
//////////////////////////////////////////////////////////////////////////
template <>
struct make_impl<lazy_tag> {
template <typename X>
static constexpr lazy_value_t<typename detail::decay<X>::type> apply(X&& x) {
return {detail::lazy_secret{}, static_cast<X&&>(x)};
}
};
//////////////////////////////////////////////////////////////////////////
// Operators
//////////////////////////////////////////////////////////////////////////
namespace detail {
template <>
struct monad_operators<lazy_tag> { static constexpr bool value = true; };
}
//////////////////////////////////////////////////////////////////////////
// eval for lazy_tag
//////////////////////////////////////////////////////////////////////////
template <>
struct eval_impl<lazy_tag> {
// lazy_apply_t
template <std::size_t ...n, typename F, typename ...Args>
static constexpr decltype(auto)
apply(lazy_apply_t<std::index_sequence<n...>, F, Args...> const& expr) {
return hana::at_c<0>(expr.storage_)(
hana::at_c<n+1>(expr.storage_)...
);
}
template <std::size_t ...n, typename F, typename ...Args>
static constexpr decltype(auto)
apply(lazy_apply_t<std::index_sequence<n...>, F, Args...>& expr) {
return hana::at_c<0>(expr.storage_)(
hana::at_c<n+1>(expr.storage_)...
);
}
template <std::size_t ...n, typename F, typename ...Args>
static constexpr decltype(auto)
apply(lazy_apply_t<std::index_sequence<n...>, F, Args...>&& expr) {
return static_cast<F&&>(hana::at_c<0>(expr.storage_))(
static_cast<Args&&>(hana::at_c<n+1>(expr.storage_))...
);
}
// lazy_value_t
template <typename X>
static constexpr X const& apply(lazy_value_t<X> const& expr)
{ return hana::at_c<0>(expr.storage_); }
template <typename X>
static constexpr X& apply(lazy_value_t<X>& expr)
{ return hana::at_c<0>(expr.storage_); }
template <typename X>
static constexpr X apply(lazy_value_t<X>&& expr)
{ return static_cast<X&&>(hana::at_c<0>(expr.storage_)); }
};
//////////////////////////////////////////////////////////////////////////
// Functor
//////////////////////////////////////////////////////////////////////////
template <>
struct transform_impl<lazy_tag> {
template <typename Expr, typename F>
static constexpr auto apply(Expr&& expr, F&& f) {
return hana::make_lazy(hana::compose(static_cast<F&&>(f), hana::eval))(
static_cast<Expr&&>(expr)
);
}
};
//////////////////////////////////////////////////////////////////////////
// Applicative
//////////////////////////////////////////////////////////////////////////
template <>
struct lift_impl<lazy_tag> {
template <typename X>
static constexpr lazy_value_t<typename detail::decay<X>::type>
apply(X&& x) {
return {detail::lazy_secret{}, static_cast<X&&>(x)};
}
};
template <>
struct ap_impl<lazy_tag> {
template <typename F, typename X>
static constexpr decltype(auto) apply(F&& f, X&& x) {
return hana::make_lazy(hana::on(hana::apply, hana::eval))(
static_cast<F&&>(f), static_cast<X&&>(x)
);
}
};
//////////////////////////////////////////////////////////////////////////
// Monad
//////////////////////////////////////////////////////////////////////////
template <>
struct flatten_impl<lazy_tag> {
template <typename Expr>
static constexpr decltype(auto) apply(Expr&& expr) {
return hana::make_lazy(hana::compose(hana::eval, hana::eval))(
static_cast<Expr&&>(expr)
);
}
};
//////////////////////////////////////////////////////////////////////////
// Comonad
//////////////////////////////////////////////////////////////////////////
template <>
struct extract_impl<lazy_tag> {
template <typename Expr>
static constexpr decltype(auto) apply(Expr&& expr)
{ return hana::eval(static_cast<Expr&&>(expr)); }
};
template <>
struct duplicate_impl<lazy_tag> {
template <typename Expr>
static constexpr decltype(auto) apply(Expr&& expr)
{ return hana::make_lazy(static_cast<Expr&&>(expr)); }
};
template <>
struct extend_impl<lazy_tag> {
template <typename Expr, typename F>
static constexpr decltype(auto) apply(Expr&& expr, F&& f) {
return hana::make_lazy(static_cast<F&&>(f))(static_cast<Expr&&>(expr));
}
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_LAZY_HPP
| 35.547826 | 86 | 0.481898 | kindlychung |
f30d9ac3cad16ec92c2833349edb4f175231e7b3 | 984 | hpp | C++ | modules/core/src/Slot/gmSlotInputList.hpp | GraphMIC/GraphMIC | 8fc2aeb0143ee1292c6757f010fc9e8c68823e2b | [
"BSD-3-Clause"
] | 43 | 2016-04-11T11:34:05.000Z | 2022-03-31T03:37:57.000Z | modules/core/src/Slot/gmSlotInputList.hpp | kevinlq/GraphMIC | 8fc2aeb0143ee1292c6757f010fc9e8c68823e2b | [
"BSD-3-Clause"
] | 1 | 2016-05-17T12:58:16.000Z | 2016-05-17T12:58:16.000Z | modules/core/src/Slot/gmSlotInputList.hpp | kevinlq/GraphMIC | 8fc2aeb0143ee1292c6757f010fc9e8c68823e2b | [
"BSD-3-Clause"
] | 14 | 2016-05-13T20:23:16.000Z | 2021-12-20T10:33:19.000Z | #pragma once
#include <QAbstractListModel>
namespace gm
{
namespace Slot
{
class InputBase;
class GM_CORE_EXPORT InputList : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles
{
Slot = Qt::UserRole + 1,
};
private:
QList<InputBase*> m_slots;
QHash<QString, InputBase*> m_slotMap;
public:
InputList();
auto getSlots() -> QList<InputBase*>;
auto addSlot(InputBase*) -> void;
auto getSlot(const QString&) -> InputBase*;
auto removeSlot(const QString&) -> void;
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int;
auto data(const QModelIndex &index, int role) const -> QVariant;
auto roleNames() const -> QHash<int, QByteArray>;
auto moveToMain() -> void;
~InputList();
};
}
}
| 27.333333 | 82 | 0.521341 | GraphMIC |
f3128b4eb981ed891d063c8c1a187bf0ebc33e66 | 1,492 | cpp | C++ | Wrappers/C/Testing/main.cpp | gregmedlock/roadrunnerwork | 11f18f78ef3e381bc59c546a8d5e3ed46d8ab596 | [
"Apache-2.0"
] | null | null | null | Wrappers/C/Testing/main.cpp | gregmedlock/roadrunnerwork | 11f18f78ef3e381bc59c546a8d5e3ed46d8ab596 | [
"Apache-2.0"
] | null | null | null | Wrappers/C/Testing/main.cpp | gregmedlock/roadrunnerwork | 11f18f78ef3e381bc59c546a8d5e3ed46d8ab596 | [
"Apache-2.0"
] | null | null | null | #include <iostream>
#include <fstream>
#include "rrLogger.h"
#include "rrUtils.h"
#include "UnitTest++.h"
#include "XmlTestReporter.h"
#include "TestReporterStdOut.h"
using namespace std;
using namespace rr;
using namespace UnitTest;
int main(int argc, char* argv[])
{
string outFolder;
string reportFile("c_api_tests.xml");
if(argc > 1)
{
char* path = argv[1];
outFolder = argv[1];
reportFile = JoinPath(outFolder, reportFile);
if(!FolderExists(outFolder))
{
return -1;
}
}
fstream aFile;
aFile.open(reportFile.c_str(), ios::out);
if(!aFile)
{
return -1;
}
XmlTestReporter reporter1(aFile);
TestRunner runner1(reporter1);
runner1.RunTestsIf(Test::GetTestList(), "Base", True(), 0);
runner1.RunTestsIf(Test::GetTestList(), "SteadyState", True(), 0);
runner1.Finish();//Made finish public in order to merge result from different test suites
// DeferredTestReporter::DeferredTestResultList list = reporter1.GetResults();
// DeferredTestReporter::DeferredTestResultList::iterator iter;
// for(iter = list.begin(); iter != list.end(); iter++)
// {
// DeferredTestResult& res = (*iter);
// cout<<res.suiteName<<" "<<endl;
// }
return 0;
}
#if defined(CG_IDE)
#pragma comment(lib, "rr_c_api.lib")
#pragma comment(lib, "roadrunner-static.lib")
#pragma comment(lib, "unit_test-static.lib")
#endif
| 23.68254 | 94 | 0.628686 | gregmedlock |
f314a4ce2b04e7ebe935165e14b5e2cc73bf4a5a | 1,239 | cpp | C++ | test/unit/scaled_int/rounding/elastic/int.cpp | JuanluMorales/cnl | fb0ad2be9315471809bea58643c8c90729644cd7 | [
"BSL-1.0"
] | 523 | 2017-07-27T02:43:25.000Z | 2022-03-24T21:27:22.000Z | test/unit/scaled_int/rounding/elastic/int.cpp | JuanluMorales/cnl | fb0ad2be9315471809bea58643c8c90729644cd7 | [
"BSL-1.0"
] | 377 | 2017-07-28T04:09:46.000Z | 2022-03-19T12:20:11.000Z | test/unit/scaled_int/rounding/elastic/int.cpp | JuanluMorales/cnl | fb0ad2be9315471809bea58643c8c90729644cd7 | [
"BSL-1.0"
] | 63 | 2017-08-16T14:43:40.000Z | 2022-03-21T16:07:02.000Z |
// Copyright John McFarlane 2015 - 2016.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file ../../LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <cnl/_impl/config.h>
#include <cnl/elastic_integer.h>
#include <cnl/rounding_integer.h>
#include <cnl/scaled_integer.h>
#include <string>
#include <gtest/gtest.h>
namespace {
template<int Digits, int Exponent>
using scaled_integer_rounding_elastic_integer = cnl::scaled_integer<
cnl::rounding_integer<cnl::elastic_integer<Digits>>, cnl::power<Exponent>>;
TEST(scaled_integer_rounding_elastic_integer, to_chars) // NOLINT
{
auto expected = std::string{"25.25"};
auto actual = std::string{
cnl::to_chars_static(scaled_integer_rounding_elastic_integer<24, -20>{25.25}).chars.data()};
ASSERT_EQ(expected, actual);
}
#if defined(CNL_IOSTREAMS_ENABLED)
TEST(scaled_integer_rounding_elastic_integer, ostream) // NOLINT
{
testing::internal::CaptureStdout();
std::cout << scaled_integer_rounding_elastic_integer<24, -20>{25.25};
ASSERT_EQ("25.25", testing::internal::GetCapturedStdout());
}
#endif
}
| 32.605263 | 108 | 0.687651 | JuanluMorales |
f317bf26c62298afacd2d8b80beba4b56eba5d40 | 9,281 | cpp | C++ | GTE/Samples/Geometrics/ConformalMapping/ConformalMappingWindow3.cpp | tranthaiphi/GeometricTools | 451e412a0715dbb4fcafbe486ca33d84a404b78d | [
"BSL-1.0"
] | 452 | 2020-09-16T02:23:30.000Z | 2022-03-27T23:11:38.000Z | GTE/Samples/Geometrics/ConformalMapping/ConformalMappingWindow3.cpp | tranthaiphi/GeometricTools | 451e412a0715dbb4fcafbe486ca33d84a404b78d | [
"BSL-1.0"
] | 34 | 2020-10-11T03:56:17.000Z | 2022-03-04T17:29:34.000Z | GTE/Samples/Geometrics/ConformalMapping/ConformalMappingWindow3.cpp | tranthaiphi/GeometricTools | 451e412a0715dbb4fcafbe486ca33d84a404b78d | [
"BSL-1.0"
] | 91 | 2020-09-28T16:59:40.000Z | 2022-03-25T16:20:06.000Z | // David Eberly, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2021
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Version: 4.0.2019.08.13
#include "ConformalMappingWindow3.h"
#include <Graphics/VertexColorEffect.h>
#include <Mathematics/ConformalMapGenus0.h>
#include <Mathematics/MeshCurvature.h>
ConformalMappingWindow3::ConformalMappingWindow3(Parameters& parameters)
:
Window3(parameters),
mExtreme(10.0f)
{
if (!SetEnvironment())
{
parameters.created = false;
return;
}
mEngine->SetClearColor({ 0.4f, 0.5f, 0.6f, 1.0f });
mWireState = std::make_shared<RasterizerState>();
mWireState->fillMode = RasterizerState::FILL_WIREFRAME;
InitializeCamera(60.0f, GetAspectRatio(), 0.1f, 100.0f, 0.01f, 0.01f,
{ 0.0f, 0.0f, -6.5f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f });
CreateScene();
mPVWMatrices.Update();
}
void ConformalMappingWindow3::OnIdle()
{
mTimer.Measure();
if (mCameraRig.Move())
{
mPVWMatrices.Update();
}
mEngine->ClearBuffers();
mEngine->Draw(mMesh);
mEngine->Draw(mSphere);
mEngine->Draw(8, mYSize - 8, { 0.0f, 0.0f, 0.0f, 1.0f }, mTimer.GetFPS());
mEngine->DisplayColorBuffer(0);
mTimer.UpdateFrameCount();
}
bool ConformalMappingWindow3::OnCharPress(unsigned char key, int x, int y)
{
switch (key)
{
case 'w':
if (mEngine->GetRasterizerState() == mWireState)
{
mEngine->SetDefaultRasterizerState();
}
else
{
mEngine->SetRasterizerState(mWireState);
}
return true;
case 'm':
// Rotate only the brain mesh.
mTrackBall.Set(mMeshNode);
mTrackBall.Update();
return true;
case 's':
// Rotate only the sphere mesh.
mTrackBall.Set(mSphereNode);
mTrackBall.Update();
return true;
case 'b':
// Rotate both the brain and sphere meshes simultaneously.
mTrackBall.Set(mScene);
mTrackBall.Update();
return true;
}
return Window3::OnCharPress(key, x, y);
}
bool ConformalMappingWindow3::SetEnvironment()
{
std::string path = GetGTEPath();
if (path == "")
{
return false;
}
mEnvironment.Insert(path + "/Samples/Data/");
if (mEnvironment.GetPath("Brain_V4098_T8192.binary") == "")
{
LogError("Cannot find file Brain_V4098_T8192.binary");
return false;
}
return true;
}
void ConformalMappingWindow3::LoadBrain(std::vector<Vector3<float>>& positions,
std::vector<Vector4<float>>& colors, std::vector<unsigned int>& indices)
{
// Load the brain mesh, which has the topology of a sphere.
unsigned int const numPositions = NUM_BRAIN_VERTICES;
unsigned int const numTriangles = NUM_BRAIN_TRIANGLES;
positions.resize(numPositions);
colors.resize(numPositions);
indices.resize(3 * numTriangles);
std::string path = mEnvironment.GetPath("Brain_V4098_T8192.binary");
std::ifstream input(path, std::ios::binary);
input.read((char*)positions.data(), positions.size() * sizeof(positions[0]));
input.read((char*)indices.data(), indices.size() * sizeof(indices[0]));
input.close();
// Scale the data to the cube [-10,10]^3 for numerical preconditioning
// of the conformal mapping.
float minValue = positions[0][0], maxValue = minValue;
for (unsigned int i = 0; i < numPositions; ++i)
{
auto const& position = positions[i];
for (int j = 0; j < 3; ++j)
{
if (position[j] < minValue)
{
minValue = position[j];
}
else if (position[j] > maxValue)
{
maxValue = position[j];
}
}
}
float halfRange = 0.5f * (maxValue - minValue);
float mult = mExtreme / halfRange;
for (unsigned int i = 0; i < numPositions; ++i)
{
auto& position = positions[i];
for (int j = 0; j < 3; ++j)
{
position[j] = -mExtreme + mult * (position[j] - minValue);
}
}
// Assign vertex colors according to mean curvature.
MeshCurvature<float>mc;
mc(positions, indices, 1e-06f);
auto const& minCurvatures = mc.GetMinCurvatures();
auto const& maxCurvatures = mc.GetMaxCurvatures();
std::vector<float> meanCurvatures(numPositions);
float minMeanCurvature = minCurvatures[0] + maxCurvatures[0];
float maxMeanCurvature = minMeanCurvature;
for (unsigned int i = 0; i < numPositions; ++i)
{
meanCurvatures[i] = minCurvatures[i] + maxCurvatures[i];
if (meanCurvatures[i] < minMeanCurvature)
{
minMeanCurvature = meanCurvatures[i];
}
else if (meanCurvatures[i] > maxMeanCurvature)
{
maxMeanCurvature = meanCurvatures[i];
}
}
for (unsigned int i = 0; i < numPositions; ++i)
{
auto& color = colors[i];
if (meanCurvatures[i] > 0.0f)
{
color[0] = 0.5f * (1.0f + meanCurvatures[i] / maxMeanCurvature);
color[1] = color[0];
color[2] = 0.0f;
}
else if (meanCurvatures[i] < 0.0f)
{
color[0] = 0.0f;
color[1] = 0.0f;
color[2] = 0.5f * (1.0f - meanCurvatures[i] / minMeanCurvature);
}
else
{
color[0] = 0.0f;
color[1] = 0.0f;
color[2] = 0.0f;
}
color[3] = 1.0f;
}
}
void ConformalMappingWindow3::CreateScene()
{
// Load and preprocess the brain data set.
std::vector<Vector3<float>> positions;
std::vector<Vector4<float>> colors;
std::vector<unsigned int> indices;
LoadBrain(positions, colors, indices);
// Create the brain mesh.
VertexFormat vformat;
vformat.Bind(VA_POSITION, DF_R32G32B32_FLOAT, 0);
vformat.Bind(VA_COLOR, DF_R32G32B32A32_FLOAT, 0);
auto vbuffer = std::make_shared<VertexBuffer>(vformat, NUM_BRAIN_VERTICES);
auto vertices = vbuffer->Get<Vertex>();
for (int i = 0; i < NUM_BRAIN_VERTICES; ++i)
{
vertices[i].position = positions[i];
vertices[i].color = colors[i];
}
auto ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, NUM_BRAIN_TRIANGLES, sizeof(unsigned int));
std::memcpy(ibuffer->GetData(), indices.data(), ibuffer->GetNumBytes());
auto effect = std::make_shared<VertexColorEffect>(mProgramFactory);
mMesh = std::make_shared<Visual>(vbuffer, ibuffer, effect);
mMesh->UpdateModelBound();
mPVWMatrices.Subscribe(mMesh->worldTransform, effect->GetPVWMatrixConstant());
// Select the first triangle as the puncture triangle and use red
// vertex colors for it.
int punctureTriangle = 100;
Vector4<float> red{ 1.0f, 0.0f, 0.0f, 1.0f };
vertices[indices[3 * punctureTriangle + 0]].color = red;
vertices[indices[3 * punctureTriangle + 1]].color = red;
vertices[indices[3 * punctureTriangle + 2]].color = red;
// Conformally map the mesh to a sphere.
ConformalMapGenus0<float> cm;
cm(NUM_BRAIN_VERTICES, positions.data(), NUM_BRAIN_TRIANGLES,
ibuffer->Get<int>(), punctureTriangle);
auto const& sphereCoordinates = cm.GetSphereCoordinates();
vbuffer = std::make_shared<VertexBuffer>(vformat, NUM_BRAIN_VERTICES);
vertices = vbuffer->Get<Vertex>();
for (int i = 0; i < NUM_BRAIN_VERTICES; ++i)
{
vertices[i].position = sphereCoordinates[i];
vertices[i].color = colors[i];
}
vertices[indices[3 * punctureTriangle + 0]].color = red;
vertices[indices[3 * punctureTriangle + 1]].color = red;
vertices[indices[3 * punctureTriangle + 2]].color = red;
effect = std::make_shared<VertexColorEffect>(mProgramFactory);
mSphere = std::make_shared<Visual>(vbuffer, ibuffer, effect);
mSphere->UpdateModelBound();
mPVWMatrices.Subscribe(mSphere->worldTransform, effect->GetPVWMatrixConstant());
// Create a subtree for the mesh. This allows for the trackball to
// manipulate only the mesh.
mScene = std::make_shared<Node>();
mMeshNode = std::make_shared<Node>();
mMeshNode->localTransform.SetTranslation(2.0f, 0.0f, 0.0f);
mMeshNode->localTransform.SetUniformScale(1.0f / mExtreme);
auto meshParent = std::make_shared<Node>();
meshParent->localTransform.SetTranslation(-mMesh->modelBound.GetCenter());
// Create a subtree for the sphere. This allows for the trackball to
// manipulate only the sphere.
mSphereNode = std::make_shared<Node>();
mSphereNode->localTransform.SetTranslation(-2.0f, 0.0f, 0.0f);
auto sphereParent = std::make_shared<Node>();
sphereParent->localTransform.SetTranslation(-mSphere->modelBound.GetCenter());
// Create the scene graph. The trackball manipulates the entire scene
// graph initially.
mScene->AttachChild(mMeshNode);
mScene->AttachChild(mSphereNode);
mMeshNode->AttachChild(meshParent);
meshParent->AttachChild(mMesh);
mSphereNode->AttachChild(sphereParent);
sphereParent->AttachChild(mSphere);
mTrackBall.Set(mScene);
mTrackBall.Update();
}
| 32.911348 | 104 | 0.631721 | tranthaiphi |
f318d8d41b0c5473d3d34297caca397328155695 | 2,898 | cc | C++ | depends/dbcommon/src/dbcommon/function/arith-func.cc | YangHao666666/hawq | 10cff8350f1ba806c6fec64eb67e0e6f6f24786c | [
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 1 | 2020-05-11T01:39:13.000Z | 2020-05-11T01:39:13.000Z | depends/dbcommon/src/dbcommon/function/arith-func.cc | YangHao666666/hawq | 10cff8350f1ba806c6fec64eb67e0e6f6f24786c | [
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 1 | 2021-03-01T02:57:26.000Z | 2021-03-01T02:57:26.000Z | depends/dbcommon/src/dbcommon/function/arith-func.cc | YangHao666666/hawq | 10cff8350f1ba806c6fec64eb67e0e6f6f24786c | [
"Artistic-1.0-Perl",
"ISC",
"bzip2-1.0.5",
"TCL",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"PostgreSQL",
"BSD-3-Clause"
] | 1 | 2020-05-03T07:29:21.000Z | 2020-05-03T07:29:21.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "dbcommon/function/arith-cmp-func.cg.h"
#include <cassert>
#include <cmath>
#include "dbcommon/common/vector.h"
#include "dbcommon/common/vector/decimal-vector.h"
#include "dbcommon/common/vector/variable-length-vector.h"
#include "dbcommon/function/arithmetic-function.h"
#include "dbcommon/utils/macro.h"
// clang-format off
// [[[cog
#if false
from cog import out, outl
import sys, os
python_path = os.path.dirname(cog.inFile) + "/../python"
python_path = os.path.abspath(python_path)
sys.path.append(python_path)
from code_generator import *
cog.outl("""
/*
* DO NOT EDIT!"
* This file is generated from : %s
*/
""" % cog.inFile)
#endif
// ]]]
// [[[end]]]
namespace dbcommon {
// [[[cog
#if false
def generate_function_with_rettype_def(optype, opmap, ltypemap, rtypemap) :
for op_key in opmap:
for ta in ltypemap:
for tb in rtypemap:
rettype = get_func_return_type(ta, tb, op_key)
is_div = "false"
is_needof = "false"
if opmap[op_key].name == "div":
is_div = "true"
if (opmap[op_key].name == "add" or opmap[op_key].name == "sub" or opmap[op_key].name == "mul") and (rettype.symbol == "int16_t" or rettype.symbol == "int32_t" or rettype.symbol == "int64_t" or rettype.symbol == "float" or rettype.symbol == "double"):
is_needof = "true"
cog.outl("""
Datum %(t1)s_%(op)s_%(t2)s(Datum *params, uint64_t size) {
return type1_op_type2<%(t1_type)s, std::%(function_obj)s<%(rt_type)s>, %(t2_type)s, %(rt_type)s, %(is_div)s, %(is_needof)s>(params, size);
}
""" % {'t1': ltypemap[ta].name,'t1_type':ltypemap[ta].symbol, 'op': opmap[op_key].name, 'opsym': opmap[op_key].symbol, 't2': rtypemap[tb].name, 't2_type': rtypemap[tb].symbol, 'rt_type': rettype.symbol,
'function_obj': opmap[op_key].functionobj, 'is_div': is_div , 'is_needof': is_needof
})
#endif
// ]]]
// [[[end]]]
// [[[cog
#if false
cog.outl("//%s:%d" % (cog.inFile,cog.firstLineNum))
generate_function_with_rettype_def("ArithOp", ARITH_OP, NUMERIC_TYPES, NUMERIC_TYPES)
#endif
// ]]]
// [[[end]]]
} // namespace dbcommon
| 33.310345 | 258 | 0.687716 | YangHao666666 |
f318f5cc1e8c211864502d9b9fe50847e1a62e6b | 2,319 | cpp | C++ | 06. Functions/08. pass_by_reference.cpp | ManthanUgemuge/Deep-Dive-in-CPP-Abdul-Bari | 36aacdca116628264724cc2624d64fcb1e0c1148 | [
"MIT"
] | 1 | 2022-02-15T21:11:42.000Z | 2022-02-15T21:11:42.000Z | 06. Functions/08. pass_by_reference.cpp | ManthanUgemuge/Deep-Dive-in-CPP-Abdul-Bari | 36aacdca116628264724cc2624d64fcb1e0c1148 | [
"MIT"
] | null | null | null | 06. Functions/08. pass_by_reference.cpp | ManthanUgemuge/Deep-Dive-in-CPP-Abdul-Bari | 36aacdca116628264724cc2624d64fcb1e0c1148 | [
"MIT"
] | null | null | null | #include <iostream>
using namespace std;
void swap(int &a, int &b)
{
int temp;
temp = a;
a = b;
b = temp;
}
int main()
{
int x = 10, y = 20;
cout << "Value of actual parameters x and y before swap(x,y) :\nx = " << x << "\ty = " << y << endl;
cout << "Address of actual parameters x and y before swap(x,y) :\nx = " << &x << "\ty = " << &y << endl;
swap(x, y);
cout << "Output of actual parameters after swap(x,y) :\nx = " << x << "\ty = " << y << endl; // Aww yeah! Swap happens.
cout << "Address of actual parameters x and y after swap(x,y) :\nx = " << &x << "\ty = " << &y << endl;
return 0;
}
/*
References are nickname to a variable and has to be initialized at the declaration time and can't be null.
We do very minor changes to the code and it is almost same as if it was call by value code.
We do not make any changes where we call the function inside main.
Instead in the function definition we take in int &a i.e. reference variables instead of int variables.
Syntax is same as call by value only at the definition of the function we use & ampersand.
In call by reference changes can be done to actual parameters.
Due to & being used i.e. reference variables being taken in function definition when we pass x and y inside main
to the function new activation record is not created instead x and y are also identified by the name a and b at memory
&x and &y.
When we use call by reference what happens at machine code generation phase is that where we call swap function
inside the main there machine code of swap function will be copied. Machine code of function will be copied
inside the main function at the place of function call. It becomes part of main function and as a result during
call by reference even if it seems another function directly modifying main function in reality before that happens
another function becomes a part of main function.
Temp is also created in the activation record of the main function itself and will be there as long as the swap
funcion code is being executed.
Use call by reference when you want actual parameters to be modified.
Loops inside call by references can lead to warnings as perfect copying of code by compiler might not happen.
Using call by reference makes the function being called as in-line function.
*/
| 48.3125 | 123 | 0.718413 | ManthanUgemuge |
f31931228d23b8001fc847cc9f10645b5df7d98d | 2,309 | cpp | C++ | xiaoV/src/base/qtmudprecvvoice.cpp | bianshifeng/QtRobot | c3353f71c6cf6a820b74bad11deafb99236fde84 | [
"MIT"
] | null | null | null | xiaoV/src/base/qtmudprecvvoice.cpp | bianshifeng/QtRobot | c3353f71c6cf6a820b74bad11deafb99236fde84 | [
"MIT"
] | null | null | null | xiaoV/src/base/qtmudprecvvoice.cpp | bianshifeng/QtRobot | c3353f71c6cf6a820b74bad11deafb99236fde84 | [
"MIT"
] | null | null | null | #include "qtmudprecvvoice.h"
#include <QThread>
#include <QCoreApplication>
QTmUDPRecvVoice::QTmUDPRecvVoice(QObject *parent) : QObject(parent)
{
m_bStartRecvData = false;
connect(&m_connectTimer,SIGNAL(timeout()),this,SLOT(slot_timer()));
}
bool QTmUDPRecvVoice::init(qint32 nPort)
{
qDebug()<<"init udp socket";
m_nPort = nPort;
m_nTimeOut = 0;
m_UDPsocket.bind(QHostAddress::Any,nPort,QAbstractSocket::ShareAddress|QAbstractSocket::ReuseAddressHint);
connect(&m_UDPsocket,SIGNAL(readyRead()),this,SLOT(slot_RecvPackage()));
// connect(&m_UDPsocket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(slot_error(QAbstractSocket::SocketError)));
// connect(&m_UDPsocket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(slot_stateChanged(QAbstractSocket::SocketState)));
return true;
}
void QTmUDPRecvVoice::uninit()
{
qDebug()<<"uninit udp socket";
m_nTimeOut = 0;
m_UDPsocket.abort();
disconnect(&m_UDPsocket,SIGNAL(readyRead()),this,SLOT(slot_RecvPackage()));
}
void QTmUDPRecvVoice::slot_RecvPackage()
{
m_bStartRecvData = true;
if(!m_connectTimer.isActive())
m_connectTimer.start(1000);
QByteArray fullPackage;
QByteArray voiceBuf;
while (m_UDPsocket.hasPendingDatagrams())
{
fullPackage.resize(m_UDPsocket.pendingDatagramSize());
m_UDPsocket.readDatagram(fullPackage.data(), fullPackage.size());
voiceBuf = m_Package.parse_full_package_audio(fullPackage);
emit signal_RecvData(voiceBuf,(qint32)voiceBuf.length());
//QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
// QThread::usleep(10);
}
}
void QTmUDPRecvVoice::slot_error(QAbstractSocket::SocketError socketError)
{
qDebug()<<"socket error!!"<<socketError;
}
void QTmUDPRecvVoice::slot_stateChanged(QAbstractSocket::SocketState socketState)
{
qDebug()<<"socket state changed!"<<socketState;
}
void QTmUDPRecvVoice::slot_timer()
{
if(m_bStartRecvData)
{
m_bStartRecvData = false;
m_nTimeOut = 0;
}
else if(!m_bStartRecvData)
{
m_nTimeOut++;
if(m_nTimeOut >= 5)
{
//5秒内无数据,停止监听
m_connectTimer.stop();
uninit();
//重启监听
init(m_nPort);
}
}
}
| 28.158537 | 138 | 0.686444 | bianshifeng |
f31a2ea069e70de1e74bb77c693af7f5d5aaad49 | 758 | cpp | C++ | TOI16/Camp-1/Grader [S] 2019/famous/famous.cpp | mrmuffinnxz/TOI-preparation | 85a7d5b70d7fc661950bbb5de66a6885a835e755 | [
"MIT"
] | null | null | null | TOI16/Camp-1/Grader [S] 2019/famous/famous.cpp | mrmuffinnxz/TOI-preparation | 85a7d5b70d7fc661950bbb5de66a6885a835e755 | [
"MIT"
] | null | null | null | TOI16/Camp-1/Grader [S] 2019/famous/famous.cpp | mrmuffinnxz/TOI-preparation | 85a7d5b70d7fc661950bbb5de66a6885a835e755 | [
"MIT"
] | null | null | null | #include<iostream>
#include<vector>
#include<list>
using namespace std;
int social()
{
int n,m,k;
cin>>n>>m>>k;
vector<vector<int> > vec(n,vector<int>(n, 0));
list<int> famous;
int x,y;
for(int i=0;i<m;i++)
{
cin>>x>>y;
x--; y--;
vec[x][y]=1;
vec[y][x]=1;
}
for(int i=0;i<n;i++)
{
int fol=0;
for(int j=0;j<n;j++)
if(vec[i][j]==1) fol++;
if(fol>=k) famous.push_back(i);
}
vector<bool> con(n,false);
int ans=0;
while(!famous.empty())
{
int temp=famous.front();
famous.pop_front();
for(int i=0;i<n;i++)
if(vec[i][temp]==1&&!con[i])
{
ans++;
con[i]=true;
}
}
return ans;
}
int main()
{
int c;
cin>>c;
int ans[c];
for(int i=0;i<c;i++)
ans[i]=social();
for(int i=0;i<c;i++)
cout<<ans[i]<<endl;
}
| 14.301887 | 47 | 0.532982 | mrmuffinnxz |
f31c701b28f88b65ab044546809d12467e81e9bf | 8,208 | cpp | C++ | Source/bindings/core/v8/PageScriptDebugServer.cpp | prepare/Blink_only_permissive_lic_files | 8b3acc51c7ae8b074d2e2b610d0d9295d9a1ecb4 | [
"BSD-3-Clause"
] | null | null | null | Source/bindings/core/v8/PageScriptDebugServer.cpp | prepare/Blink_only_permissive_lic_files | 8b3acc51c7ae8b074d2e2b610d0d9295d9a1ecb4 | [
"BSD-3-Clause"
] | null | null | null | Source/bindings/core/v8/PageScriptDebugServer.cpp | prepare/Blink_only_permissive_lic_files | 8b3acc51c7ae8b074d2e2b610d0d9295d9a1ecb4 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "bindings/core/v8/PageScriptDebugServer.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8ScriptRunner.h"
#include "bindings/core/v8/WindowProxy.h"
#include "core/frame/FrameConsole.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/inspector/ScriptDebugListener.h"
#include "core/page/Page.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/StdLibExtras.h"
#include "wtf/TemporaryChange.h"
#include "wtf/ThreadingPrimitives.h"
#include "wtf/text/StringBuilder.h"
namespace blink {
static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Local<v8::Context> context)
{
return toLocalFrame(toFrameIfNotDetached(context));
}
PageScriptDebugServer* PageScriptDebugServer::s_instance = nullptr;
PageScriptDebugServer::PageScriptDebugServer(PassOwnPtr<ClientMessageLoop> clientMessageLoop, v8::Isolate* isolate)
: ScriptDebugServer(isolate)
, m_clientMessageLoop(clientMessageLoop)
, m_pausedFrame(nullptr)
{
MutexLocker locker(creationMutex());
ASSERT(!s_instance);
s_instance = this;
}
PageScriptDebugServer::~PageScriptDebugServer()
{
MutexLocker locker(creationMutex());
ASSERT(s_instance == this);
s_instance = nullptr;
}
Mutex& PageScriptDebugServer::creationMutex()
{
AtomicallyInitializedStaticReference(Mutex, mutex, (new Mutex));
return mutex;
}
DEFINE_TRACE(PageScriptDebugServer)
{
#if ENABLE(OILPAN)
visitor->trace(m_listenersMap);
visitor->trace(m_pausedFrame);
#endif
ScriptDebugServer::trace(visitor);
}
void PageScriptDebugServer::setContextDebugData(v8::Local<v8::Context> context, const String& type, int contextDebugId)
{
String debugData = "[" + type + "," + String::number(contextDebugId) + "]";
ScriptDebugServer::setContextDebugData(context, debugData);
}
void PageScriptDebugServer::addListener(ScriptDebugListener* listener, LocalFrame* localFrameRoot, int contextDebugId)
{
ASSERT(localFrameRoot == localFrameRoot->localFrameRoot());
ScriptController& scriptController = localFrameRoot->script();
if (!scriptController.canExecuteScripts(NotAboutToExecuteScript))
return;
if (m_listenersMap.isEmpty())
enable();
m_listenersMap.set(localFrameRoot, listener);
String contextDataSubstring = "," + String::number(contextDebugId) + "]";
reportCompiledScripts(contextDataSubstring, listener);
}
void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, LocalFrame* localFrame)
{
if (!m_listenersMap.contains(localFrame))
return;
if (m_pausedFrame == localFrame)
continueProgram();
m_listenersMap.remove(localFrame);
if (m_listenersMap.isEmpty())
disable();
}
PageScriptDebugServer* PageScriptDebugServer::instance()
{
ASSERT(isMainThread());
return s_instance;
}
void PageScriptDebugServer::interruptMainThreadAndRun(PassOwnPtr<Task> task)
{
MutexLocker locker(creationMutex());
if (s_instance)
s_instance->interruptAndRun(task);
}
void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String& expression, const String& sourceURL, bool persistScript, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace)
{
ExecutionContext* executionContext = scriptState->executionContext();
RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame());
ScriptDebugServer::compileScript(scriptState, expression, sourceURL, persistScript, scriptId, exceptionDetailsText, lineNumber, columnNumber, stackTrace);
if (!scriptId->isNull())
m_compiledScriptURLs.set(*scriptId, sourceURL);
}
void PageScriptDebugServer::clearCompiledScripts()
{
ScriptDebugServer::clearCompiledScripts();
m_compiledScriptURLs.clear();
}
void PageScriptDebugServer::runScript(ScriptState* scriptState, const String& scriptId, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace)
{
String sourceURL = m_compiledScriptURLs.take(scriptId);
ExecutionContext* executionContext = scriptState->executionContext();
LocalFrame* frame = toDocument(executionContext)->frame();
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript", "data", InspectorEvaluateScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt()));
InspectorInstrumentationCookie cookie;
if (frame)
cookie = InspectorInstrumentation::willEvaluateScript(frame, sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt());
RefPtrWillBeRawPtr<LocalFrame> protect(frame);
ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, exceptionDetailsText, lineNumber, columnNumber, stackTrace);
if (frame)
InspectorInstrumentation::didEvaluateScript(cookie);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
}
ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Local<v8::Context> context)
{
v8::HandleScope scope(context->GetIsolate());
LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context);
if (!frame)
return 0;
return m_listenersMap.get(frame->localFrameRoot());
}
void PageScriptDebugServer::runMessageLoopOnPause(v8::Local<v8::Context> context)
{
v8::HandleScope scope(context->GetIsolate());
LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context);
m_pausedFrame = frame->localFrameRoot();
// Wait for continue or step command.
m_clientMessageLoop->run(m_pausedFrame);
// The listener may have been removed in the nested loop.
if (ScriptDebugListener* listener = m_listenersMap.get(m_pausedFrame))
listener->didContinue();
m_pausedFrame = 0;
}
void PageScriptDebugServer::quitMessageLoopOnPause()
{
m_clientMessageLoop->quitNow();
}
void PageScriptDebugServer::muteWarningsAndDeprecations()
{
FrameConsole::mute();
UseCounter::muteForInspector();
}
void PageScriptDebugServer::unmuteWarningsAndDeprecations()
{
FrameConsole::unmute();
UseCounter::unmuteForInspector();
}
} // namespace blink
| 37.140271 | 271 | 0.766326 | prepare |
f31cc9af2c3e6b9b69ab7e2eb9da1b00e442a37e | 16,903 | cpp | C++ | folly/net/TcpInfo.cpp | Aoikiseki/folly | df3633c731d08bab0173039a050a30853fb47212 | [
"Apache-2.0"
] | 19,046 | 2015-01-01T17:01:10.000Z | 2022-03-31T23:01:43.000Z | folly/net/TcpInfo.cpp | Aoikiseki/folly | df3633c731d08bab0173039a050a30853fb47212 | [
"Apache-2.0"
] | 1,493 | 2015-01-11T15:47:13.000Z | 2022-03-28T18:13:58.000Z | folly/net/TcpInfo.cpp | Aoikiseki/folly | df3633c731d08bab0173039a050a30853fb47212 | [
"Apache-2.0"
] | 4,818 | 2015-01-01T12:28:16.000Z | 2022-03-31T16:22:10.000Z | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <glog/logging.h>
#include <folly/net/TcpInfo.h>
#include <folly/portability/Sockets.h>
#if defined(__linux__)
#include <linux/sockios.h>
#include <sys/ioctl.h>
#endif
namespace folly {
namespace {
constexpr std::array<
folly::StringPiece,
static_cast<std::underlying_type_t<TcpInfo::CongestionControlName>>(
TcpInfo::CongestionControlName::NumCcTypes)>
kCcNames{
"UNKNOWN",
"CUBIC",
"BIC",
"DCTCP",
"DCTCP_RENO",
"BBR",
"RENO",
"DCTCP_CUBIC",
"VEGAS"};
static_assert(
kCcNames.size() ==
static_cast<std::underlying_type_t<TcpInfo::CongestionControlName>>(
TcpInfo::CongestionControlName::NumCcTypes),
"kCcNames and folly::TcpInfo::CongestionControlName should have "
"the same number of values");
} // namespace
using ms = std::chrono::milliseconds;
using us = std::chrono::microseconds;
TcpInfo::IoctlDispatcher* TcpInfo::IoctlDispatcher::getDefaultInstance() {
static TcpInfo::IoctlDispatcher dispatcher = {};
return &dispatcher;
}
int TcpInfo::IoctlDispatcher::ioctl(int fd, unsigned long request, void* argp) {
#if defined(__linux__)
return ::ioctl(fd, request, argp);
#else
return -1; // no cross platform for ioctl operations
#endif
}
Expected<TcpInfo, std::errc> TcpInfo::initFromFd(
const NetworkSocket& fd,
const TcpInfo::LookupOptions& options,
netops::Dispatcher& netopsDispatcher,
IoctlDispatcher& ioctlDispatcher) {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::makeUnexpected(std::errc::invalid_argument);
#else
if (NetworkSocket() == fd) {
return folly::makeUnexpected(std::errc::invalid_argument);
}
// try to get TCP_INFO
TcpInfo info = {};
socklen_t len = sizeof(TcpInfo::tcp_info);
auto ret = netopsDispatcher.getsockopt(
fd,
IPPROTO_TCP,
folly::detail::tcp_info_sock_opt,
(void*)&info.tcpInfo,
&len);
if (ret < 0) {
int errnoCopy = errno;
VLOG(4) << "Error calling getsockopt(): " << folly::errnoStr(errnoCopy);
return folly::makeUnexpected(static_cast<std::errc>(errnoCopy));
}
info.tcpInfoBytesRead = len;
// if enabled, try to get information about the congestion control algo
if (options.getCcInfo) {
initCcInfoFromFd(fd, info, netopsDispatcher);
}
// if enabled, try to get memory buffers
if (options.getMemInfo) {
initMemInfoFromFd(fd, info, ioctlDispatcher);
}
return info;
#endif
}
/**
*
* Accessor definitions.
*
*/
Optional<std::chrono::microseconds> TcpInfo::minrtt() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
const auto ptr = getFieldAsPtr(&tcp_info::tcpi_min_rtt);
return (ptr) ? us(*CHECK_NOTNULL(ptr)) : folly::Optional<us>();
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<std::chrono::microseconds> TcpInfo::srtt() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
const auto ptr = getFieldAsPtr(&tcp_info::tcpi_rtt);
return (ptr) ? us(*CHECK_NOTNULL(ptr)) // __linux__ stores in us
: folly::Optional<us>();
#elif defined(__APPLE__)
const auto ptr = getFieldAsPtr(&tcp_info::tcpi_srtt);
return (ptr) ? us(ms(*CHECK_NOTNULL(ptr))) // __APPLE__ stores in ms
: folly::Optional<us>();
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bytesSent() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_bytes_sent);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_txbytes);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bytesReceived() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_bytes_received);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_rxbytes);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bytesRetransmitted() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_bytes_retrans);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_txretransmitbytes);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bytesNotSent() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_notsent_bytes);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bytesAcked() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_bytes_acked);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsSent() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_segs_out);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_txpackets);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsWithDataSent() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_data_segs_out);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsReceived() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_segs_in);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_rxpackets);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsWithDataReceived() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_data_segs_in);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsRetransmitted() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_total_retrans);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_txretransmitpackets);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::packetsInFlight() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
// tcp_packets_in_flight is defined in kernel as:
// (tp->packets_out - tcp_left_out(tp) + tp->retrans_out)
//
// tcp_left_out is defined as:
// (tp->sacked_out + tp->lost_out)
//
// mapping from tcp_info fields to tcp_sock fields:
// info->tcpi_unacked = tp->packets_out;
// info->tcpi_retrans = tp->retrans_out;
// info->tcpi_sacked = tp->sacked_out;
// info->tcpi_lost = tp->lost_out;
const auto packetsOutOpt = getFieldAsOptUInt64(&tcp_info::tcpi_unacked);
const auto retransOutOpt = getFieldAsOptUInt64(&tcp_info::tcpi_retrans);
const auto sackedOutOpt = getFieldAsOptUInt64(&tcp_info::tcpi_sacked);
const auto lostOutOpt = getFieldAsOptUInt64(&tcp_info::tcpi_lost);
if (packetsOutOpt && retransOutOpt && sackedOutOpt && lostOutOpt) {
return (*packetsOutOpt - (*sackedOutOpt + *lostOutOpt) + *retransOutOpt);
}
return folly::none;
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::cwndInPackets() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_snd_cwnd);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_snd_cwnd);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::cwndInBytes() const {
const auto cwndInPacketsOpt = cwndInPackets();
const auto mssOpt = mss();
if (cwndInPacketsOpt && mssOpt) {
return cwndInPacketsOpt.value() * mssOpt.value();
}
return folly::none;
}
Optional<uint64_t> TcpInfo::ssthresh() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_snd_ssthresh);
#elif defined(__APPLE__)
return getFieldAsOptUInt64(&tcp_info::tcpi_snd_ssthresh);
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::mss() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return tcpInfo.tcpi_snd_mss;
#elif defined(__APPLE__)
return tcpInfo.tcpi_maxseg;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::deliveryRateBitsPerSecond() const {
return bytesPerSecondToBitsPerSecond(deliveryRateBytesPerSecond());
}
Optional<uint64_t> TcpInfo::deliveryRateBytesPerSecond() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&tcp_info::tcpi_delivery_rate);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<bool> TcpInfo::deliveryRateAppLimited() const {
#ifndef FOLLY_HAVE_TCP_INFO
return folly::none;
#elif defined(__linux__)
// have to check if delivery rate is available for two reasons
// (1) can't use getTcpInfoFieldAsPtr on bit-field
// (2) tcpi_delivery_rate_app_limited was added in earlier part of tcp_info
// to take advantage of 1-byte gap; must check if we have the delivery
// rate field to determine if the app limited field is available
if (deliveryRateBytesPerSecond().has_value()) {
return tcpInfo.tcpi_delivery_rate_app_limited;
}
return folly::none;
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<std::string> TcpInfo::ccNameRaw() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
return maybeCcNameRaw;
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<TcpInfo::CongestionControlName> TcpInfo::ccNameEnum() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
return maybeCcEnum;
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<folly::StringPiece> TcpInfo::ccNameEnumAsStr() const {
const auto maybeCcNameEnum = ccNameEnum();
if (!maybeCcNameEnum.has_value()) {
return folly::none;
}
const auto ccEnumAsInt =
static_cast<std::underlying_type_t<CongestionControlName>>(
maybeCcNameEnum.value());
CHECK_GE(
static_cast<std::underlying_type_t<TcpInfo::CongestionControlName>>(
TcpInfo::CongestionControlName::NumCcTypes),
ccEnumAsInt);
CHECK_GE(kCcNames.size(), ccEnumAsInt);
return kCcNames[ccEnumAsInt];
}
Optional<uint64_t> TcpInfo::bbrBwBitsPerSecond() const {
return bytesPerSecondToBitsPerSecond(bbrBwBytesPerSecond());
}
Optional<uint64_t> TcpInfo::bbrBwBytesPerSecond() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
auto bbrBwLoOpt =
getFieldAsOptUInt64(&folly::TcpInfo::tcp_bbr_info::bbr_bw_lo);
auto bbrBwHiOpt =
getFieldAsOptUInt64(&folly::TcpInfo::tcp_bbr_info::bbr_bw_hi);
if (bbrBwLoOpt && bbrBwHiOpt) {
return ((int64_t)*bbrBwHiOpt << 32) + *bbrBwLoOpt;
}
return folly::none;
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<std::chrono::microseconds> TcpInfo::bbrMinrtt() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
auto opt = getFieldAsOptUInt64(&folly::TcpInfo::tcp_bbr_info::bbr_min_rtt);
return (opt) ? us(*opt) : folly::Optional<us>();
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bbrPacingGain() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&folly::TcpInfo::tcp_bbr_info::bbr_pacing_gain);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<uint64_t> TcpInfo::bbrCwndGain() const {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return folly::none;
#elif defined(__linux__)
return getFieldAsOptUInt64(&folly::TcpInfo::tcp_bbr_info::bbr_cwnd_gain);
#elif defined(__APPLE__)
return folly::none;
#else
return folly::none;
#endif
}
Optional<size_t> TcpInfo::sendBufInUseBytes() const {
return maybeSendBufInUseBytes;
}
Optional<size_t> TcpInfo::recvBufInUseBytes() const {
return maybeRecvBufInUseBytes;
}
void TcpInfo::initCcInfoFromFd(
const NetworkSocket& fd,
TcpInfo& wrappedInfo,
netops::Dispatcher& netopsDispatcher) {
#ifndef FOLLY_HAVE_TCP_CC_INFO
return; // platform not supported
#elif defined(__linux__)
if (NetworkSocket() == fd) {
return;
}
// identification strings returned by Linux Kernel for TCP_CONGESTION
static constexpr auto kLinuxCcNameStrReno = "reno";
static constexpr auto kLinuxCcNameStrCubic = "cubic";
static constexpr auto kLinuxCcNameStrBic = "bic";
static constexpr auto kLinuxCcNameStrBbr = "bbr";
static constexpr auto kLinuxCcNameStrVegas = "vegas";
static constexpr auto kLinuxCcNameStrDctcp = "dctcp";
static constexpr auto kLinuxCcNameStrDctcpReno = "dctcp_reno";
static constexpr auto kLinuxCcNameStrDctcpCubic = "dctcp_cubic";
std::array<char, (unsigned int)kLinuxTcpCaNameMax> tcpCongestion{{0}};
socklen_t optlen = tcpCongestion.size();
if (netopsDispatcher.getsockopt(
fd, IPPROTO_TCP, TCP_CONGESTION, tcpCongestion.data(), &optlen) < 0) {
VLOG(4) << "Error calling getsockopt(): " << folly::errnoStr(errno);
return;
}
{
auto ccStr = std::string(tcpCongestion.data());
if (ccStr == kLinuxCcNameStrReno) {
wrappedInfo.maybeCcEnum = CongestionControlName::RENO;
} else if (ccStr == kLinuxCcNameStrCubic) {
wrappedInfo.maybeCcEnum = CongestionControlName::CUBIC;
} else if (ccStr == kLinuxCcNameStrBic) {
wrappedInfo.maybeCcEnum = CongestionControlName::BIC;
} else if (ccStr == kLinuxCcNameStrBbr) {
wrappedInfo.maybeCcEnum = CongestionControlName::BBR;
} else if (ccStr == kLinuxCcNameStrVegas) {
wrappedInfo.maybeCcEnum = CongestionControlName::VEGAS;
} else if (ccStr == kLinuxCcNameStrDctcp) {
wrappedInfo.maybeCcEnum = CongestionControlName::DCTCP;
} else if (ccStr == kLinuxCcNameStrDctcpReno) {
wrappedInfo.maybeCcEnum = CongestionControlName::DCTCP_RENO;
} else if (ccStr == kLinuxCcNameStrDctcpCubic) {
wrappedInfo.maybeCcEnum = CongestionControlName::DCTCP_CUBIC;
} else {
wrappedInfo.maybeCcEnum = CongestionControlName::UNKNOWN;
}
wrappedInfo.maybeCcNameRaw.emplace(std::move(ccStr));
}
// get TCP_CC_INFO if supported for the congestion control algorithm
switch (wrappedInfo.maybeCcEnum.value_or(CongestionControlName::UNKNOWN)) {
case CongestionControlName::UNKNOWN:
case CongestionControlName::RENO:
case CongestionControlName::CUBIC:
case CongestionControlName::BIC:
return; // no TCP_CC_INFO for these congestion controls, exit out
case CongestionControlName::BBR:
case CongestionControlName::VEGAS:
case CongestionControlName::DCTCP:
case CongestionControlName::DCTCP_RENO:
case CongestionControlName::DCTCP_CUBIC:
break; // supported, proceed
case CongestionControlName::NumCcTypes:
LOG(FATAL) << "CongestionControlName::NumCcTypes is not a valid CC type";
}
tcp_cc_info ccInfo = {};
socklen_t len = sizeof(tcp_cc_info);
const int ret = netopsDispatcher.getsockopt(
fd, IPPROTO_TCP, TCP_CC_INFO, (void*)&ccInfo, &len);
if (ret < 0) {
int errnoCopy = errno;
VLOG(4) << "Error calling getsockopt(): " << folly::errnoStr(errnoCopy);
return;
}
wrappedInfo.maybeCcInfo = ccInfo;
wrappedInfo.tcpCcInfoBytesRead = len;
#else
return;
#endif
}
void TcpInfo::initMemInfoFromFd(
const NetworkSocket& fd,
TcpInfo& wrappedInfo,
IoctlDispatcher& ioctlDispatcher) {
#if defined(__linux__)
if (NetworkSocket() == fd) {
return;
}
size_t val = 0;
if (ioctlDispatcher.ioctl(fd.toFd(), SIOCOUTQ, &val) == 0) {
wrappedInfo.maybeSendBufInUseBytes = val;
}
if (ioctlDispatcher.ioctl(fd.toFd(), SIOCINQ, &val) == 0) {
wrappedInfo.maybeRecvBufInUseBytes = val;
}
#endif
}
} // namespace folly
| 28.649153 | 80 | 0.734308 | Aoikiseki |
f31d22c24146abcfa94858a786060e27daf2220c | 3,369 | hxx | C++ | main/xmloff/inc/XMLBasicExportFilter.hxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/xmloff/inc/XMLBasicExportFilter.hxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/xmloff/inc/XMLBasicExportFilter.hxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.000Z | /**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _XMLOFF_XMLBASICEXPORTFILTER_HXX
#define _XMLOFF_XMLBASICEXPORTFILTER_HXX
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <cppuhelper/implbase1.hxx>
// =============================================================================
// class XMLBasicExportFilter
// =============================================================================
typedef ::cppu::WeakImplHelper1<
::com::sun::star::xml::sax::XDocumentHandler > XMLBasicExportFilter_BASE;
class XMLBasicExportFilter : public XMLBasicExportFilter_BASE
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
public:
XMLBasicExportFilter(
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rxHandler );
virtual ~XMLBasicExportFilter();
// XDocumentHandler
virtual void SAL_CALL startDocument()
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL endDocument()
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL startElement( const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL endElement( const ::rtl::OUString& aName )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL characters( const ::rtl::OUString& aChars )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
};
#endif // _XMLOFF_XMLBASICEXPORTFILTER_HXX
| 48.826087 | 136 | 0.64856 | Grosskopf |
f31f8ab0fb06f8dc72dfcefe3fe18cc450c766e3 | 668 | cpp | C++ | test/pre_reserch/plag_original_codes/05_045_plag.cpp | xryuseix/SA-Plag | 167f7a2b2fa81ff00fd5263772a74c2c5c61941d | [
"MIT"
] | 13 | 2021-01-20T19:53:16.000Z | 2021-11-14T16:30:32.000Z | test/training_data/plag_original_codes/05_045_plag.cpp | xryuseix/SA-Plag | 167f7a2b2fa81ff00fd5263772a74c2c5c61941d | [
"MIT"
] | null | null | null | test/training_data/plag_original_codes/05_045_plag.cpp | xryuseix/SA-Plag | 167f7a2b2fa81ff00fd5263772a74c2c5c61941d | [
"MIT"
] | null | null | null | // 引用元 : https://atcoder.jp/contests/abc121/submissions/12412105
// 得点 : 300
// コード長 : 553
// 実行時間 : 77
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ll = long long ;
using ld=long double;
using d= double;
int main() {
int n,m;
cin>>n>>m;
vector<pair<ll,ll>> p(n);
for(int i=0;i<n;i++){
cin>>p[i].first>>p[i].second;
}
sort(p.begin(),p.end());
lli ans=0;
for(int i=0;i<n;i++){
if(m>=p[i].second){
ans+=p[i].first*p[i].second;
m-=p[i].second;
}
else if(m<p[i].second){
ans+=m*p[i].first;
m=0;
}
}
cout<<ans;
return 0;
}
| 18.054054 | 65 | 0.505988 | xryuseix |
f32194a350b7d3d0fed543ada2d1803f2e7d326b | 1,290 | hpp | C++ | Sources/Graphics/DrawBMP/example/cube3d.hpp | wurui1994/test | 027cef75f98dbb252b322113dacd4a9a6997d84f | [
"MIT"
] | 27 | 2017-12-19T09:15:36.000Z | 2021-07-30T13:02:00.000Z | Sources/Graphics/DrawBMP/example/cube3d.hpp | wurui1994/test | 027cef75f98dbb252b322113dacd4a9a6997d84f | [
"MIT"
] | null | null | null | Sources/Graphics/DrawBMP/example/cube3d.hpp | wurui1994/test | 027cef75f98dbb252b322113dacd4a9a6997d84f | [
"MIT"
] | 29 | 2018-04-10T13:25:54.000Z | 2021-12-24T01:51:03.000Z | //No ZBuffer
double a[]= {
-100,-100,100,
100,-100,100,
100,100,100,
-100,100,100,
};//前
double b[]= {
-100,-100,-100,
100,-100,-100,
100,100,-100,
-100,100,-100,
};//后
double c[]= {
-100,-100,-100,
100,-100,-100,
100,-100,100,
-100,-100,100,
};//下
double d[]= {
-100,100,-100,
100,100,-100,
100,100,100,
-100,100,100,
};//上
double e[]= {
-100,-100,-100,
-100,100,-100,
-100,100,100,
-100,-100,100,
};//左
double f[]= {
100,-100,-100,
100,100,-100,
100,100,100,
100,-100,100,
};//右
PointArray ptsa=eval(a,Length(a));
PointArray ptsb=eval(b,Length(b));
PointArray ptsc=eval(c,Length(c));
PointArray ptsd=eval(d,Length(d));
PointArray ptse=eval(e,Length(e));
PointArray ptsf=eval(f,Length(f));
void cube3d(Image img,vector3 v)
{
//
img.SetColor(0,255,255);
ptsa=Rotate(ptsa,v,0.1);
img.FillRect3d(ptsa);
//
img.SetColor(255,0,255);
ptsb=Rotate(ptsb,v,0.1);
img.FillRect3d(ptsb);
//
img.SetColor(255,255,0);
ptsc=Rotate(ptsc,v,0.1);
img.FillRect3d(ptsc);
//
img.SetColor(255,0,0);
ptsd=Rotate(ptsd,v,0.1);
img.FillRect3d(ptsd);
//
img.SetColor(0,255,0);
ptse=Rotate(ptse,v,0.1);
img.FillRect3d(ptse);
//
img.SetColor(0,0,255);
ptsf=Rotate(ptsf,v,0.1);
img.FillRect3d(ptsf);
}
| 18.169014 | 35 | 0.589922 | wurui1994 |
f32355e03839a83bad7d9187cc78a14aea1ec7af | 11,113 | cc | C++ | components/pdf/browser/pdf_web_contents_helper.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-11-16T13:10:29.000Z | 2021-11-16T13:10:29.000Z | components/pdf/browser/pdf_web_contents_helper.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | components/pdf/browser/pdf_web_contents_helper.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include <utility>
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "components/pdf/browser/pdf_web_contents_helper_client.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/referrer_type_converters.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "ui/base/pointer/touch_editing_controller.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
namespace pdf {
// static
void PDFWebContentsHelper::CreateForWebContentsWithClient(
content::WebContents* contents,
std::unique_ptr<PDFWebContentsHelperClient> client) {
if (FromWebContents(contents))
return;
contents->SetUserData(
UserDataKey(),
base::WrapUnique(new PDFWebContentsHelper(contents, std::move(client))));
}
// static
void PDFWebContentsHelper::BindPdfService(
mojo::PendingAssociatedReceiver<mojom::PdfService> pdf_service,
content::RenderFrameHost* rfh) {
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
if (!web_contents)
return;
auto* pdf_helper = PDFWebContentsHelper::FromWebContents(web_contents);
if (!pdf_helper)
return;
pdf_helper->pdf_service_receivers_.Bind(rfh, std::move(pdf_service));
}
PDFWebContentsHelper::PDFWebContentsHelper(
content::WebContents* web_contents,
std::unique_ptr<PDFWebContentsHelperClient> client)
: web_contents_(web_contents),
pdf_service_receivers_(web_contents, this),
client_(std::move(client)) {}
PDFWebContentsHelper::~PDFWebContentsHelper() {
if (!touch_selection_controller_client_manager_)
return;
// PDFWebContentsHelperTest overrides TouchSelectionControllerClientManager
// to mock it and GetTouchSelectionController() returns nullptr in that case.
// This check prevents the tests from failing in that condition.
ui::TouchSelectionController* touch_selection_controller =
touch_selection_controller_client_manager_->GetTouchSelectionController();
if (touch_selection_controller)
touch_selection_controller->HideAndDisallowShowingAutomatically();
touch_selection_controller_client_manager_->InvalidateClient(this);
touch_selection_controller_client_manager_->RemoveObserver(this);
}
void PDFWebContentsHelper::SetListener(
mojo::PendingRemote<mojom::PdfListener> listener) {
remote_pdf_client_.reset();
remote_pdf_client_.Bind(std::move(listener));
}
gfx::PointF PDFWebContentsHelper::ConvertHelper(const gfx::PointF& point_f,
float scale) const {
gfx::PointF origin_f;
content::RenderWidgetHostView* view =
web_contents_->GetRenderWidgetHostView();
if (view) {
origin_f = view->TransformPointToRootCoordSpaceF(gfx::PointF());
origin_f.Scale(scale);
}
return gfx::PointF(point_f.x() + origin_f.x(), point_f.y() + origin_f.y());
}
gfx::PointF PDFWebContentsHelper::ConvertFromRoot(
const gfx::PointF& point_f) const {
return ConvertHelper(point_f, -1.f);
}
gfx::PointF PDFWebContentsHelper::ConvertToRoot(
const gfx::PointF& point_f) const {
return ConvertHelper(point_f, +1.f);
}
void PDFWebContentsHelper::SelectionChanged(const gfx::PointF& left,
int32_t left_height,
const gfx::PointF& right,
int32_t right_height) {
selection_left_ = left;
selection_left_height_ = left_height;
selection_right_ = right;
selection_right_height_ = right_height;
DidScroll();
}
void PDFWebContentsHelper::SetPluginCanSave(bool can_save) {
client_->SetPluginCanSave(web_contents_, can_save);
}
void PDFWebContentsHelper::GetPdfFindInPage(GetPdfFindInPageCallback callback) {
if (!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned)) {
NOTREACHED();
return;
}
if (!find_factory_remote_) {
web_contents_->GetMainFrame()
->GetRemoteAssociatedInterfaces()
->GetInterface(&find_factory_remote_);
}
find_factory_remote_->GetPdfFindInPage(std::move(callback));
}
void PDFWebContentsHelper::DidScroll() {
if (!touch_selection_controller_client_manager_)
InitTouchSelectionClientManager();
if (touch_selection_controller_client_manager_) {
gfx::SelectionBound start;
gfx::SelectionBound end;
start.SetEdgeStart(ConvertToRoot(selection_left_));
start.SetEdgeEnd(ConvertToRoot(gfx::PointF(
selection_left_.x(), selection_left_.y() + selection_left_height_)));
end.SetEdgeStart(ConvertToRoot(selection_right_));
end.SetEdgeEnd(ConvertToRoot(gfx::PointF(
selection_right_.x(), selection_right_.y() + selection_right_height_)));
// TouchSelectionControllerClientAura needs these visible edges of selection
// to show the quick menu and context menu. Set the visible edges by the
// edges of |start| and |end|.
start.SetVisibleEdge(start.edge_start(), start.edge_end());
end.SetVisibleEdge(end.edge_start(), end.edge_end());
// Don't do left/right comparison after setting type.
// TODO(wjmaclean): When PDFium supports editing, we'll need to detect
// start == end as *either* no selection, or an insertion point.
has_selection_ = start != end;
start.set_visible(has_selection_);
end.set_visible(has_selection_);
start.set_type(has_selection_ ? gfx::SelectionBound::LEFT
: gfx::SelectionBound::EMPTY);
end.set_type(has_selection_ ? gfx::SelectionBound::RIGHT
: gfx::SelectionBound::EMPTY);
touch_selection_controller_client_manager_->UpdateClientSelectionBounds(
start, end, this, this);
}
}
bool PDFWebContentsHelper::SupportsAnimation() const {
return false;
}
void PDFWebContentsHelper::MoveCaret(const gfx::PointF& position) {
if (!remote_pdf_client_)
return;
remote_pdf_client_->SetCaretPosition(ConvertFromRoot(position));
}
void PDFWebContentsHelper::MoveRangeSelectionExtent(const gfx::PointF& extent) {
if (!remote_pdf_client_)
return;
remote_pdf_client_->MoveRangeSelectionExtent(ConvertFromRoot(extent));
}
void PDFWebContentsHelper::SelectBetweenCoordinates(const gfx::PointF& base,
const gfx::PointF& extent) {
if (!remote_pdf_client_)
return;
remote_pdf_client_->SetSelectionBounds(ConvertFromRoot(base),
ConvertFromRoot(extent));
}
void PDFWebContentsHelper::OnSelectionEvent(ui::SelectionEventType event) {
// Should be handled by `TouchSelectionControllerClientAura`.
NOTREACHED();
}
void PDFWebContentsHelper::OnDragUpdate(
const ui::TouchSelectionDraggable::Type type,
const gfx::PointF& position) {
// Should be handled by `TouchSelectionControllerClientAura`.
NOTREACHED();
}
std::unique_ptr<ui::TouchHandleDrawable>
PDFWebContentsHelper::CreateDrawable() {
// We can return null here, as the manager will look after this.
return nullptr;
}
void PDFWebContentsHelper::OnManagerWillDestroy(
content::TouchSelectionControllerClientManager* manager) {
DCHECK_EQ(touch_selection_controller_client_manager_, manager);
manager->RemoveObserver(this);
touch_selection_controller_client_manager_ = nullptr;
}
bool PDFWebContentsHelper::IsCommandIdEnabled(int command_id) const {
// TODO(wjmaclean|dsinclair): Make PDFium send readability information in the
// selection changed message?
bool readable = true;
switch (command_id) {
case ui::TouchEditable::kCopy:
return readable && has_selection_;
// TODO(wjmaclean): add logic for cut/paste as the information required
// from PDFium becomes available.
}
return false;
}
void PDFWebContentsHelper::ExecuteCommand(int command_id, int event_flags) {
// TODO(wjmaclean, dsinclair): Need to communicate to PDFium to accept
// cut/paste commands.
switch (command_id) {
case ui::TouchEditable::kCopy:
web_contents_->Copy();
break;
}
}
void PDFWebContentsHelper::RunContextMenu() {
content::RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame();
if (!focused_frame)
return;
content::RenderWidgetHost* widget = focused_frame->GetRenderWidgetHost();
if (!widget || !widget->GetView())
return;
if (!touch_selection_controller_client_manager_)
InitTouchSelectionClientManager();
if (!touch_selection_controller_client_manager_)
return;
ui::TouchSelectionController* touch_selection_controller =
touch_selection_controller_client_manager_->GetTouchSelectionController();
gfx::RectF anchor_rect =
touch_selection_controller->GetVisibleRectBetweenBounds();
gfx::PointF anchor_point =
gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y());
gfx::PointF origin =
widget->GetView()->TransformPointToRootCoordSpaceF(gfx::PointF());
anchor_point.Offset(-origin.x(), -origin.y());
widget->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point),
ui::MENU_SOURCE_TOUCH_EDIT_MENU);
// Hide selection handles after getting rect-between-bounds from touch
// selection controller; otherwise, rect would be empty and the above
// calculations would be invalid.
touch_selection_controller->HideAndDisallowShowingAutomatically();
}
bool PDFWebContentsHelper::ShouldShowQuickMenu() {
return false;
}
std::u16string PDFWebContentsHelper::GetSelectedText() {
return std::u16string();
}
void PDFWebContentsHelper::InitTouchSelectionClientManager() {
content::RenderWidgetHostView* view =
web_contents_->GetRenderWidgetHostView();
if (!view)
return;
touch_selection_controller_client_manager_ =
view->GetTouchSelectionControllerClientManager();
if (!touch_selection_controller_client_manager_)
return;
touch_selection_controller_client_manager_->AddObserver(this);
}
void PDFWebContentsHelper::HasUnsupportedFeature() {
client_->OnPDFHasUnsupportedFeature(web_contents_);
}
void PDFWebContentsHelper::SaveUrlAs(const GURL& url,
network::mojom::ReferrerPolicy policy) {
client_->OnSaveURL(web_contents_);
content::RenderFrameHost* rfh = web_contents_->GetOuterWebContentsFrame();
if (!rfh)
return;
content::Referrer referrer(url, policy);
referrer = content::Referrer::SanitizeForRequest(url, referrer);
web_contents_->SaveFrame(url, referrer, rfh);
}
void PDFWebContentsHelper::UpdateContentRestrictions(
int32_t content_restrictions) {
client_->UpdateContentRestrictions(web_contents_, content_restrictions);
}
WEB_CONTENTS_USER_DATA_KEY_IMPL(PDFWebContentsHelper);
} // namespace pdf
| 34.619938 | 96 | 0.739944 | zealoussnow |
f32468a1a872663e2cbb24395756fcc4acba7944 | 616,154 | cpp | C++ | tests/cuda2.2/tests/Particles/radixsort_kernel.cu.cpp | florianjacob/gpuocelot | fa63920ee7c5f9a86e264cd8acd4264657cbd190 | [
"BSD-3-Clause"
] | 221 | 2015-03-29T02:05:49.000Z | 2022-03-25T01:45:36.000Z | tests/cuda2.2/tests/Particles/radixsort_kernel.cu.cpp | mprevot/gpuocelot | d9277ef05a110e941aef77031382d0260ff115ef | [
"BSD-3-Clause"
] | 106 | 2015-03-29T01:28:42.000Z | 2022-02-15T19:38:23.000Z | tests/cuda2.2/tests/Particles/radixsort_kernel.cu.cpp | mprevot/gpuocelot | d9277ef05a110e941aef77031382d0260ff115ef | [
"BSD-3-Clause"
] | 83 | 2015-07-10T23:09:57.000Z | 2022-03-25T03:01:00.000Z | # 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.cpp"
# 1 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
# 46 "/usr/local/cuda/bin/../include/device_types.h"
# 149 "/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h" 3
typedef long ptrdiff_t;
# 211 "/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h" 3
typedef unsigned long size_t;
# 1 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 1 3
# 69 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 3
# 1 "/usr/local/cuda/bin/../include/builtin_types.h" 1 3
# 42 "/usr/local/cuda/bin/../include/builtin_types.h" 3
# 1 "/usr/local/cuda/bin/../include/device_types.h" 1 3
# 46 "/usr/local/cuda/bin/../include/device_types.h" 3
enum cudaRoundMode
{
cudaRoundNearest,
cudaRoundZero,
cudaRoundPosInf,
cudaRoundMinInf
};
# 43 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 1 "/usr/local/cuda/bin/../include/driver_types.h" 1 3
# 96 "/usr/local/cuda/bin/../include/driver_types.h" 3
enum cudaError
{
cudaSuccess = 0,
cudaErrorMissingConfiguration = 1,
cudaErrorMemoryAllocation = 2,
cudaErrorInitializationError = 3,
# 131 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorLaunchFailure = 4,
# 140 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorPriorLaunchFailure = 5,
# 150 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorLaunchTimeout = 6,
# 159 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorLaunchOutOfResources = 7,
cudaErrorInvalidDeviceFunction = 8,
# 174 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorInvalidConfiguration = 9,
cudaErrorInvalidDevice = 10,
cudaErrorInvalidValue = 11,
cudaErrorInvalidPitchValue = 12,
cudaErrorInvalidSymbol = 13,
cudaErrorMapBufferObjectFailed = 14,
cudaErrorUnmapBufferObjectFailed = 15,
cudaErrorInvalidHostPointer = 16,
cudaErrorInvalidDevicePointer = 17,
cudaErrorInvalidTexture = 18,
cudaErrorInvalidTextureBinding = 19,
cudaErrorInvalidChannelDescriptor = 20,
cudaErrorInvalidMemcpyDirection = 21,
# 255 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorAddressOfConstant = 22,
# 264 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorTextureFetchFailed = 23,
# 273 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorTextureNotBound = 24,
# 282 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorSynchronizationError = 25,
cudaErrorInvalidFilterSetting = 26,
cudaErrorInvalidNormSetting = 27,
cudaErrorMixedDeviceExecution = 28,
cudaErrorCudartUnloading = 29,
cudaErrorUnknown = 30,
cudaErrorNotYetImplemented = 31,
# 330 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorMemoryValueTooLarge = 32,
cudaErrorInvalidResourceHandle = 33,
cudaErrorNotReady = 34,
cudaErrorInsufficientDriver = 35,
# 365 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorSetOnActiveProcess = 36,
cudaErrorInvalidSurface = 37,
cudaErrorNoDevice = 38,
cudaErrorECCUncorrectable = 39,
cudaErrorSharedObjectSymbolNotFound = 40,
cudaErrorSharedObjectInitFailed = 41,
cudaErrorUnsupportedLimit = 42,
cudaErrorDuplicateVariableName = 43,
cudaErrorDuplicateTextureName = 44,
cudaErrorDuplicateSurfaceName = 45,
# 426 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorDevicesUnavailable = 46,
cudaErrorInvalidKernelImage = 47,
cudaErrorNoKernelImageForDevice = 48,
# 448 "/usr/local/cuda/bin/../include/driver_types.h" 3
cudaErrorIncompatibleDriverContext = 49,
cudaErrorStartupFailure = 0x7f,
cudaErrorApiFailureBase = 10000
};
enum cudaChannelFormatKind
{
cudaChannelFormatKindSigned = 0,
cudaChannelFormatKindUnsigned = 1,
cudaChannelFormatKindFloat = 2,
cudaChannelFormatKindNone = 3
};
struct cudaChannelFormatDesc
{
int x;
int y;
int z;
int w;
enum cudaChannelFormatKind f;
};
struct cudaArray;
enum cudaMemcpyKind
{
cudaMemcpyHostToHost = 0,
cudaMemcpyHostToDevice = 1,
cudaMemcpyDeviceToHost = 2,
cudaMemcpyDeviceToDevice = 3
};
struct cudaPitchedPtr
{
void *ptr;
size_t pitch;
size_t xsize;
size_t ysize;
};
struct cudaExtent
{
size_t width;
size_t height;
size_t depth;
};
struct cudaPos
{
size_t x;
size_t y;
size_t z;
};
struct cudaMemcpy3DParms
{
struct cudaArray *srcArray;
struct cudaPos srcPos;
struct cudaPitchedPtr srcPtr;
struct cudaArray *dstArray;
struct cudaPos dstPos;
struct cudaPitchedPtr dstPtr;
struct cudaExtent extent;
enum cudaMemcpyKind kind;
};
struct cudaGraphicsResource;
enum cudaGraphicsRegisterFlags
{
cudaGraphicsRegisterFlagsNone = 0
};
enum cudaGraphicsMapFlags
{
cudaGraphicsMapFlagsNone = 0,
cudaGraphicsMapFlagsReadOnly = 1,
cudaGraphicsMapFlagsWriteDiscard = 2
};
enum cudaGraphicsCubeFace {
cudaGraphicsCubeFacePositiveX = 0x00,
cudaGraphicsCubeFaceNegativeX = 0x01,
cudaGraphicsCubeFacePositiveY = 0x02,
cudaGraphicsCubeFaceNegativeY = 0x03,
cudaGraphicsCubeFacePositiveZ = 0x04,
cudaGraphicsCubeFaceNegativeZ = 0x05
};
struct cudaFuncAttributes
{
size_t sharedSizeBytes;
size_t constSizeBytes;
size_t localSizeBytes;
int maxThreadsPerBlock;
int numRegs;
int ptxVersion;
int binaryVersion;
int __cudaReserved[6];
};
enum cudaFuncCache
{
cudaFuncCachePreferNone = 0,
cudaFuncCachePreferShared = 1,
cudaFuncCachePreferL1 = 2
};
enum cudaComputeMode
{
cudaComputeModeDefault = 0,
cudaComputeModeExclusive = 1,
cudaComputeModeProhibited = 2
};
enum cudaLimit
{
cudaLimitStackSize = 0x00,
cudaLimitPrintfFifoSize = 0x01,
cudaLimitMallocHeapSize = 0x02
};
struct cudaDeviceProp
{
char name[256];
size_t totalGlobalMem;
size_t sharedMemPerBlock;
int regsPerBlock;
int warpSize;
size_t memPitch;
int maxThreadsPerBlock;
int maxThreadsDim[3];
int maxGridSize[3];
int clockRate;
size_t totalConstMem;
int major;
int minor;
size_t textureAlignment;
int deviceOverlap;
int multiProcessorCount;
int kernelExecTimeoutEnabled;
int integrated;
int canMapHostMemory;
int computeMode;
int maxTexture1D;
int maxTexture2D[2];
int maxTexture3D[3];
int maxTexture2DArray[3];
size_t surfaceAlignment;
int concurrentKernels;
int ECCEnabled;
int pciBusID;
int pciDeviceID;
int tccDriver;
int __cudaReserved[21];
};
# 768 "/usr/local/cuda/bin/../include/driver_types.h" 3
typedef enum cudaError cudaError_t;
typedef struct CUstream_st *cudaStream_t;
typedef struct CUevent_st *cudaEvent_t;
typedef struct cudaGraphicsResource *cudaGraphicsResource_t;
typedef struct CUuuid_st cudaUUID_t;
# 44 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 1 "/usr/local/cuda/bin/../include/surface_types.h" 1 3
# 63 "/usr/local/cuda/bin/../include/surface_types.h" 3
enum cudaSurfaceBoundaryMode
{
cudaBoundaryModeZero = 0,
cudaBoundaryModeClamp = 1,
cudaBoundaryModeTrap = 2
};
enum cudaSurfaceFormatMode
{
cudaFormatModeForced = 0,
cudaFormatModeAuto = 1
};
struct surfaceReference
{
struct cudaChannelFormatDesc channelDesc;
};
# 45 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 1 "/usr/local/cuda/bin/../include/texture_types.h" 1 3
# 63 "/usr/local/cuda/bin/../include/texture_types.h" 3
enum cudaTextureAddressMode
{
cudaAddressModeWrap = 0,
cudaAddressModeClamp = 1,
cudaAddressModeMirror = 2,
cudaAddressModeBorder = 3
};
enum cudaTextureFilterMode
{
cudaFilterModePoint = 0,
cudaFilterModeLinear = 1
};
enum cudaTextureReadMode
{
cudaReadModeElementType = 0,
cudaReadModeNormalizedFloat = 1
};
struct textureReference
{
int normalized;
enum cudaTextureFilterMode filterMode;
enum cudaTextureAddressMode addressMode[3];
struct cudaChannelFormatDesc channelDesc;
int __cudaReserved[16];
};
# 46 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 1 "/usr/local/cuda/bin/../include/vector_types.h" 1 3
# 45 "/usr/local/cuda/bin/../include/vector_types.h" 3
# 1 "/usr/local/cuda/bin/../include/builtin_types.h" 1 3
# 46 "/usr/local/cuda/bin/../include/builtin_types.h" 3
# 1 "/usr/local/cuda/bin/../include/vector_types.h" 1 3
# 46 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 46 "/usr/local/cuda/bin/../include/vector_types.h" 2 3
# 1 "/usr/local/cuda/bin/../include/host_defines.h" 1 3
# 47 "/usr/local/cuda/bin/../include/vector_types.h" 2 3
# 75 "/usr/local/cuda/bin/../include/vector_types.h" 3
struct char1
{
signed char x;
};
struct uchar1
{
unsigned char x;
};
struct __attribute__((aligned(2))) char2
{
signed char x, y;
};
struct __attribute__((aligned(2))) uchar2
{
unsigned char x, y;
};
struct char3
{
signed char x, y, z;
};
struct uchar3
{
unsigned char x, y, z;
};
struct __attribute__((aligned(4))) char4
{
signed char x, y, z, w;
};
struct __attribute__((aligned(4))) uchar4
{
unsigned char x, y, z, w;
};
struct short1
{
short x;
};
struct ushort1
{
unsigned short x;
};
struct __attribute__((aligned(4))) short2
{
short x, y;
};
struct __attribute__((aligned(4))) ushort2
{
unsigned short x, y;
};
struct short3
{
short x, y, z;
};
struct ushort3
{
unsigned short x, y, z;
};
struct __attribute__((aligned(8))) short4 { short x; short y; short z; short w; };
struct __attribute__((aligned(8))) ushort4 { unsigned short x; unsigned short y; unsigned short z; unsigned short w; };
struct int1
{
int x;
};
struct uint1
{
unsigned int x;
};
struct __attribute__((aligned(8))) int2 { int x; int y; };
struct __attribute__((aligned(8))) uint2 { unsigned int x; unsigned int y; };
struct int3
{
int x, y, z;
};
struct uint3
{
unsigned int x, y, z;
};
struct __attribute__((aligned(16))) int4
{
int x, y, z, w;
};
struct __attribute__((aligned(16))) uint4
{
unsigned int x, y, z, w;
};
struct long1
{
long int x;
};
struct ulong1
{
unsigned long x;
};
# 229 "/usr/local/cuda/bin/../include/vector_types.h" 3
struct __attribute__((aligned(2*sizeof(long int)))) long2
{
long int x, y;
};
struct __attribute__((aligned(2*sizeof(unsigned long int)))) ulong2
{
unsigned long int x, y;
};
struct long3
{
long int x, y, z;
};
struct ulong3
{
unsigned long int x, y, z;
};
struct __attribute__((aligned(16))) long4
{
long int x, y, z, w;
};
struct __attribute__((aligned(16))) ulong4
{
unsigned long int x, y, z, w;
};
struct float1
{
float x;
};
struct __attribute__((aligned(8))) float2 { float x; float y; };
struct float3
{
float x, y, z;
};
struct __attribute__((aligned(16))) float4
{
float x, y, z, w;
};
struct longlong1
{
long long int x;
};
struct ulonglong1
{
unsigned long long int x;
};
struct __attribute__((aligned(16))) longlong2
{
long long int x, y;
};
struct __attribute__((aligned(16))) ulonglong2
{
unsigned long long int x, y;
};
struct longlong3
{
long long int x, y, z;
};
struct ulonglong3
{
unsigned long long int x, y, z;
};
struct __attribute__((aligned(16))) longlong4
{
long long int x, y, z ,w;
};
struct __attribute__((aligned(16))) ulonglong4
{
unsigned long long int x, y, z, w;
};
struct double1
{
double x;
};
struct __attribute__((aligned(16))) double2
{
double x, y;
};
struct double3
{
double x, y, z;
};
struct __attribute__((aligned(16))) double4
{
double x, y, z, w;
};
# 366 "/usr/local/cuda/bin/../include/vector_types.h" 3
typedef struct char1 char1;
typedef struct uchar1 uchar1;
typedef struct char2 char2;
typedef struct uchar2 uchar2;
typedef struct char3 char3;
typedef struct uchar3 uchar3;
typedef struct char4 char4;
typedef struct uchar4 uchar4;
typedef struct short1 short1;
typedef struct ushort1 ushort1;
typedef struct short2 short2;
typedef struct ushort2 ushort2;
typedef struct short3 short3;
typedef struct ushort3 ushort3;
typedef struct short4 short4;
typedef struct ushort4 ushort4;
typedef struct int1 int1;
typedef struct uint1 uint1;
typedef struct int2 int2;
typedef struct uint2 uint2;
typedef struct int3 int3;
typedef struct uint3 uint3;
typedef struct int4 int4;
typedef struct uint4 uint4;
typedef struct long1 long1;
typedef struct ulong1 ulong1;
typedef struct long2 long2;
typedef struct ulong2 ulong2;
typedef struct long3 long3;
typedef struct ulong3 ulong3;
typedef struct long4 long4;
typedef struct ulong4 ulong4;
typedef struct float1 float1;
typedef struct float2 float2;
typedef struct float3 float3;
typedef struct float4 float4;
typedef struct longlong1 longlong1;
typedef struct ulonglong1 ulonglong1;
typedef struct longlong2 longlong2;
typedef struct ulonglong2 ulonglong2;
typedef struct longlong3 longlong3;
typedef struct ulonglong3 ulonglong3;
typedef struct longlong4 longlong4;
typedef struct ulonglong4 ulonglong4;
typedef struct double1 double1;
typedef struct double2 double2;
typedef struct double3 double3;
typedef struct double4 double4;
# 469 "/usr/local/cuda/bin/../include/vector_types.h" 3
struct dim3
{
unsigned int x, y, z;
dim3(unsigned int vx = 1, unsigned int vy = 1, unsigned int vz = 1) : x(vx), y(vy), z(vz) {}
dim3(uint3 v) : x(v.x), y(v.y), z(v.z) {}
operator uint3(void) { uint3 t; t.x = x; t.y = y; t.z = z; return t; }
};
typedef struct dim3 dim3;
# 46 "/usr/local/cuda/bin/../include/builtin_types.h" 2 3
# 70 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 2 3
# 1 "/usr/local/cuda/bin/../include/crt/storage_class.h" 1 3
# 71 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 2 3
# 213 "/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h" 2 3
# 96 "/usr/local/cuda/bin/../include/driver_types.h"
# 466 "/usr/local/cuda/bin/../include/driver_types.h"
# 478 "/usr/local/cuda/bin/../include/driver_types.h"
# 491 "/usr/local/cuda/bin/../include/driver_types.h"
# 497 "/usr/local/cuda/bin/../include/driver_types.h"
# 510 "/usr/local/cuda/bin/../include/driver_types.h"
# 523 "/usr/local/cuda/bin/../include/driver_types.h"
# 535 "/usr/local/cuda/bin/../include/driver_types.h"
# 546 "/usr/local/cuda/bin/../include/driver_types.h"
# 564 "/usr/local/cuda/bin/../include/driver_types.h"
# 570 "/usr/local/cuda/bin/../include/driver_types.h"
# 579 "/usr/local/cuda/bin/../include/driver_types.h"
# 590 "/usr/local/cuda/bin/../include/driver_types.h"
# 603 "/usr/local/cuda/bin/../include/driver_types.h"
# 656 "/usr/local/cuda/bin/../include/driver_types.h"
# 667 "/usr/local/cuda/bin/../include/driver_types.h"
# 678 "/usr/local/cuda/bin/../include/driver_types.h"
# 689 "/usr/local/cuda/bin/../include/driver_types.h"
# 768 "/usr/local/cuda/bin/../include/driver_types.h"
# 774 "/usr/local/cuda/bin/../include/driver_types.h"
# 780 "/usr/local/cuda/bin/../include/driver_types.h"
# 786 "/usr/local/cuda/bin/../include/driver_types.h"
# 792 "/usr/local/cuda/bin/../include/driver_types.h"
# 63 "/usr/local/cuda/bin/../include/surface_types.h"
# 74 "/usr/local/cuda/bin/../include/surface_types.h"
# 84 "/usr/local/cuda/bin/../include/surface_types.h"
# 63 "/usr/local/cuda/bin/../include/texture_types.h"
# 75 "/usr/local/cuda/bin/../include/texture_types.h"
# 85 "/usr/local/cuda/bin/../include/texture_types.h"
# 95 "/usr/local/cuda/bin/../include/texture_types.h"
# 75 "/usr/local/cuda/bin/../include/vector_types.h"
# 81 "/usr/local/cuda/bin/../include/vector_types.h"
# 87 "/usr/local/cuda/bin/../include/vector_types.h"
# 93 "/usr/local/cuda/bin/../include/vector_types.h"
# 99 "/usr/local/cuda/bin/../include/vector_types.h"
# 105 "/usr/local/cuda/bin/../include/vector_types.h"
# 111 "/usr/local/cuda/bin/../include/vector_types.h"
# 117 "/usr/local/cuda/bin/../include/vector_types.h"
# 123 "/usr/local/cuda/bin/../include/vector_types.h"
# 129 "/usr/local/cuda/bin/../include/vector_types.h"
# 135 "/usr/local/cuda/bin/../include/vector_types.h"
# 141 "/usr/local/cuda/bin/../include/vector_types.h"
# 147 "/usr/local/cuda/bin/../include/vector_types.h"
# 153 "/usr/local/cuda/bin/../include/vector_types.h"
# 159 "/usr/local/cuda/bin/../include/vector_types.h"
# 162 "/usr/local/cuda/bin/../include/vector_types.h"
# 165 "/usr/local/cuda/bin/../include/vector_types.h"
# 171 "/usr/local/cuda/bin/../include/vector_types.h"
# 177 "/usr/local/cuda/bin/../include/vector_types.h"
# 180 "/usr/local/cuda/bin/../include/vector_types.h"
# 183 "/usr/local/cuda/bin/../include/vector_types.h"
# 189 "/usr/local/cuda/bin/../include/vector_types.h"
# 195 "/usr/local/cuda/bin/../include/vector_types.h"
# 201 "/usr/local/cuda/bin/../include/vector_types.h"
# 207 "/usr/local/cuda/bin/../include/vector_types.h"
# 213 "/usr/local/cuda/bin/../include/vector_types.h"
# 229 "/usr/local/cuda/bin/../include/vector_types.h"
# 235 "/usr/local/cuda/bin/../include/vector_types.h"
# 243 "/usr/local/cuda/bin/../include/vector_types.h"
# 249 "/usr/local/cuda/bin/../include/vector_types.h"
# 255 "/usr/local/cuda/bin/../include/vector_types.h"
# 261 "/usr/local/cuda/bin/../include/vector_types.h"
# 267 "/usr/local/cuda/bin/../include/vector_types.h"
# 273 "/usr/local/cuda/bin/../include/vector_types.h"
# 276 "/usr/local/cuda/bin/../include/vector_types.h"
# 282 "/usr/local/cuda/bin/../include/vector_types.h"
# 288 "/usr/local/cuda/bin/../include/vector_types.h"
# 294 "/usr/local/cuda/bin/../include/vector_types.h"
# 300 "/usr/local/cuda/bin/../include/vector_types.h"
# 306 "/usr/local/cuda/bin/../include/vector_types.h"
# 312 "/usr/local/cuda/bin/../include/vector_types.h"
# 318 "/usr/local/cuda/bin/../include/vector_types.h"
# 324 "/usr/local/cuda/bin/../include/vector_types.h"
# 330 "/usr/local/cuda/bin/../include/vector_types.h"
# 336 "/usr/local/cuda/bin/../include/vector_types.h"
# 342 "/usr/local/cuda/bin/../include/vector_types.h"
# 348 "/usr/local/cuda/bin/../include/vector_types.h"
# 354 "/usr/local/cuda/bin/../include/vector_types.h"
# 366 "/usr/local/cuda/bin/../include/vector_types.h"
# 368 "/usr/local/cuda/bin/../include/vector_types.h"
# 370 "/usr/local/cuda/bin/../include/vector_types.h"
# 372 "/usr/local/cuda/bin/../include/vector_types.h"
# 374 "/usr/local/cuda/bin/../include/vector_types.h"
# 376 "/usr/local/cuda/bin/../include/vector_types.h"
# 378 "/usr/local/cuda/bin/../include/vector_types.h"
# 380 "/usr/local/cuda/bin/../include/vector_types.h"
# 382 "/usr/local/cuda/bin/../include/vector_types.h"
# 384 "/usr/local/cuda/bin/../include/vector_types.h"
# 386 "/usr/local/cuda/bin/../include/vector_types.h"
# 388 "/usr/local/cuda/bin/../include/vector_types.h"
# 390 "/usr/local/cuda/bin/../include/vector_types.h"
# 392 "/usr/local/cuda/bin/../include/vector_types.h"
# 394 "/usr/local/cuda/bin/../include/vector_types.h"
# 396 "/usr/local/cuda/bin/../include/vector_types.h"
# 398 "/usr/local/cuda/bin/../include/vector_types.h"
# 400 "/usr/local/cuda/bin/../include/vector_types.h"
# 402 "/usr/local/cuda/bin/../include/vector_types.h"
# 404 "/usr/local/cuda/bin/../include/vector_types.h"
# 406 "/usr/local/cuda/bin/../include/vector_types.h"
# 408 "/usr/local/cuda/bin/../include/vector_types.h"
# 410 "/usr/local/cuda/bin/../include/vector_types.h"
# 412 "/usr/local/cuda/bin/../include/vector_types.h"
# 414 "/usr/local/cuda/bin/../include/vector_types.h"
# 416 "/usr/local/cuda/bin/../include/vector_types.h"
# 418 "/usr/local/cuda/bin/../include/vector_types.h"
# 420 "/usr/local/cuda/bin/../include/vector_types.h"
# 422 "/usr/local/cuda/bin/../include/vector_types.h"
# 424 "/usr/local/cuda/bin/../include/vector_types.h"
# 426 "/usr/local/cuda/bin/../include/vector_types.h"
# 428 "/usr/local/cuda/bin/../include/vector_types.h"
# 430 "/usr/local/cuda/bin/../include/vector_types.h"
# 432 "/usr/local/cuda/bin/../include/vector_types.h"
# 434 "/usr/local/cuda/bin/../include/vector_types.h"
# 436 "/usr/local/cuda/bin/../include/vector_types.h"
# 438 "/usr/local/cuda/bin/../include/vector_types.h"
# 440 "/usr/local/cuda/bin/../include/vector_types.h"
# 442 "/usr/local/cuda/bin/../include/vector_types.h"
# 444 "/usr/local/cuda/bin/../include/vector_types.h"
# 446 "/usr/local/cuda/bin/../include/vector_types.h"
# 448 "/usr/local/cuda/bin/../include/vector_types.h"
# 450 "/usr/local/cuda/bin/../include/vector_types.h"
# 452 "/usr/local/cuda/bin/../include/vector_types.h"
# 454 "/usr/local/cuda/bin/../include/vector_types.h"
# 456 "/usr/local/cuda/bin/../include/vector_types.h"
# 458 "/usr/local/cuda/bin/../include/vector_types.h"
# 460 "/usr/local/cuda/bin/../include/vector_types.h"
# 469 "/usr/local/cuda/bin/../include/vector_types.h"
# 480 "/usr/local/cuda/bin/../include/vector_types.h"
# 115 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadExit();
# 131 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadSynchronize();
# 183 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadSetLimit(cudaLimit, size_t);
# 207 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadGetLimit(size_t *, cudaLimit);
# 237 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadGetCacheConfig(cudaFuncCache *);
# 278 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaThreadSetCacheConfig(cudaFuncCache);
# 330 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetLastError();
# 373 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaPeekAtLastError();
# 387 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" const char *cudaGetErrorString(cudaError_t);
# 418 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetDeviceCount(int *);
# 536 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetDeviceProperties(cudaDeviceProp *, int);
# 555 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaChooseDevice(int *, const cudaDeviceProp *);
# 579 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetDevice(int);
# 597 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetDevice(int *);
# 626 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetValidDevices(int *, int);
# 677 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetDeviceFlags(unsigned);
# 703 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaStreamCreate(cudaStream_t *);
# 719 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaStreamDestroy(cudaStream_t);
# 753 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaStreamWaitEvent(cudaStream_t, cudaEvent_t, unsigned);
# 771 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaStreamSynchronize(cudaStream_t);
# 789 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaStreamQuery(cudaStream_t);
# 821 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventCreate(cudaEvent_t *);
# 852 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventCreateWithFlags(cudaEvent_t *, unsigned);
# 885 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventRecord(cudaEvent_t, cudaStream_t = 0);
# 914 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventQuery(cudaEvent_t);
# 946 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventSynchronize(cudaEvent_t);
# 966 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventDestroy(cudaEvent_t);
# 1007 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaEventElapsedTime(float *, cudaEvent_t, cudaEvent_t);
# 1046 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaConfigureCall(dim3, dim3, size_t = (0), cudaStream_t = 0);
# 1073 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetupArgument(const void *, size_t, size_t);
# 1119 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaFuncSetCacheConfig(const char *, cudaFuncCache);
# 1154 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaLaunch(const char *);
# 1187 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaFuncGetAttributes(cudaFuncAttributes *, const char *);
# 1209 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetDoubleForDevice(double *);
# 1231 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaSetDoubleForHost(double *);
# 1263 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMalloc(void **, size_t);
# 1292 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMallocHost(void **, size_t);
# 1331 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMallocPitch(void **, size_t *, size_t, size_t);
# 1370 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMallocArray(cudaArray **, const cudaChannelFormatDesc *, size_t, size_t = (0), unsigned = (0));
# 1394 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaFree(void *);
# 1414 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaFreeHost(void *);
# 1436 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaFreeArray(cudaArray *);
# 1495 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaHostAlloc(void **, size_t, unsigned);
# 1522 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaHostGetDevicePointer(void **, void *, unsigned);
# 1541 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaHostGetFlags(unsigned *, void *);
# 1576 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMalloc3D(cudaPitchedPtr *, cudaExtent);
# 1626 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMalloc3DArray(cudaArray **, const cudaChannelFormatDesc *, cudaExtent, unsigned = (0));
# 1723 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms *);
# 1828 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms *, cudaStream_t = 0);
# 1847 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemGetInfo(size_t *, size_t *);
# 1880 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy(void *, const void *, size_t, cudaMemcpyKind);
# 1913 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyToArray(cudaArray *, size_t, size_t, const void *, size_t, cudaMemcpyKind);
# 1946 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyFromArray(void *, const cudaArray *, size_t, size_t, size_t, cudaMemcpyKind);
# 1981 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyArrayToArray(cudaArray *, size_t, size_t, const cudaArray *, size_t, size_t, size_t, cudaMemcpyKind = cudaMemcpyDeviceToDevice);
# 2023 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2D(void *, size_t, const void *, size_t, size_t, size_t, cudaMemcpyKind);
# 2064 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DToArray(cudaArray *, size_t, size_t, const void *, size_t, size_t, size_t, cudaMemcpyKind);
# 2105 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DFromArray(void *, size_t, const cudaArray *, size_t, size_t, size_t, size_t, cudaMemcpyKind);
# 2144 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DArrayToArray(cudaArray *, size_t, size_t, const cudaArray *, size_t, size_t, size_t, size_t, cudaMemcpyKind = cudaMemcpyDeviceToDevice);
# 2179 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyToSymbol(const char *, const void *, size_t, size_t = (0), cudaMemcpyKind = cudaMemcpyHostToDevice);
# 2213 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyFromSymbol(void *, const char *, size_t, size_t = (0), cudaMemcpyKind = cudaMemcpyDeviceToHost);
# 2256 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyAsync(void *, const void *, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2298 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyToArrayAsync(cudaArray *, size_t, size_t, const void *, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2340 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyFromArrayAsync(void *, const cudaArray *, size_t, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2391 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DAsync(void *, size_t, const void *, size_t, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2441 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DToArrayAsync(cudaArray *, size_t, size_t, const void *, size_t, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2491 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpy2DFromArrayAsync(void *, size_t, const cudaArray *, size_t, size_t, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2535 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyToSymbolAsync(const char *, const void *, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2578 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemcpyFromSymbolAsync(void *, const char *, size_t, size_t, cudaMemcpyKind, cudaStream_t = 0);
# 2600 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemset(void *, int, size_t);
# 2626 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemset2D(void *, size_t, int, size_t, size_t);
# 2665 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemset3D(cudaPitchedPtr, int, cudaExtent);
# 2692 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemsetAsync(void *, int, size_t, cudaStream_t = 0);
# 2724 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemset2DAsync(void *, size_t, int, size_t, size_t, cudaStream_t = 0);
# 2769 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaMemset3DAsync(cudaPitchedPtr, int, cudaExtent, cudaStream_t = 0);
# 2796 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetSymbolAddress(void **, const char *);
# 2819 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetSymbolSize(size_t *, const char *);
# 2865 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t);
# 2897 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t, unsigned);
# 2932 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsMapResources(int, cudaGraphicsResource_t *, cudaStream_t = 0);
# 2963 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsUnmapResources(int, cudaGraphicsResource_t *, cudaStream_t = 0);
# 2992 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsResourceGetMappedPointer(void **, size_t *, cudaGraphicsResource_t);
# 3026 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray **, cudaGraphicsResource_t, unsigned, unsigned);
# 3059 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc *, const cudaArray *);
# 3094 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaChannelFormatDesc cudaCreateChannelDesc(int, int, int, int, cudaChannelFormatKind);
# 3136 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaBindTexture(size_t *, const textureReference *, const void *, const cudaChannelFormatDesc *, size_t = (((2147483647) * 2U) + 1U));
# 3179 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaBindTexture2D(size_t *, const textureReference *, const void *, const cudaChannelFormatDesc *, size_t, size_t, size_t);
# 3207 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaBindTextureToArray(const textureReference *, const cudaArray *, const cudaChannelFormatDesc *);
# 3228 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaUnbindTexture(const textureReference *);
# 3253 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetTextureAlignmentOffset(size_t *, const textureReference *);
# 3277 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetTextureReference(const textureReference **, const char *);
# 3310 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaBindSurfaceToArray(const surfaceReference *, const cudaArray *, const cudaChannelFormatDesc *);
# 3328 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetSurfaceReference(const surfaceReference **, const char *);
# 3355 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaDriverGetVersion(int *);
# 3372 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaRuntimeGetVersion(int *);
# 3377 "/usr/local/cuda/bin/../include/cuda_runtime_api.h"
extern "C" cudaError_t cudaGetExportTable(const void **, const cudaUUID_t *);
# 93 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template< class T> inline cudaChannelFormatDesc cudaCreateChannelDesc()
# 94 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 95 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone);
# 96 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 98 "/usr/local/cuda/bin/../include/channel_descriptor.h"
static inline cudaChannelFormatDesc cudaCreateChannelDescHalf()
# 99 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 100 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 102 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
# 103 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 105 "/usr/local/cuda/bin/../include/channel_descriptor.h"
static inline cudaChannelFormatDesc cudaCreateChannelDescHalf1()
# 106 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 107 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 109 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
# 110 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 112 "/usr/local/cuda/bin/../include/channel_descriptor.h"
static inline cudaChannelFormatDesc cudaCreateChannelDescHalf2()
# 113 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 114 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 116 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
# 117 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 119 "/usr/local/cuda/bin/../include/channel_descriptor.h"
static inline cudaChannelFormatDesc cudaCreateChannelDescHalf4()
# 120 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 121 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 123 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
# 124 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 126 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< char> ()
# 127 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 128 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(char)) * 8);
# 133 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 135 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 137 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< signed char> ()
# 138 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 139 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(signed char)) * 8);
# 141 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 142 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 144 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< unsigned char> ()
# 145 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 146 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned char)) * 8);
# 148 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 149 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 151 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< char1> ()
# 152 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 153 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(signed char)) * 8);
# 155 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 156 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 158 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uchar1> ()
# 159 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 160 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned char)) * 8);
# 162 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 163 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 165 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< char2> ()
# 166 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 167 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(signed char)) * 8);
# 169 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
# 170 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 172 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uchar2> ()
# 173 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 174 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned char)) * 8);
# 176 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
# 177 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 179 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< char4> ()
# 180 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 181 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(signed char)) * 8);
# 183 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
# 184 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 186 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uchar4> ()
# 187 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 188 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned char)) * 8);
# 190 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
# 191 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 193 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< short> ()
# 194 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 195 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(short)) * 8);
# 197 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 198 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 200 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< unsigned short> ()
# 201 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 202 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 204 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 205 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 207 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< short1> ()
# 208 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 209 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(short)) * 8);
# 211 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 212 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 214 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< ushort1> ()
# 215 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 216 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 218 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 219 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 221 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< short2> ()
# 222 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 223 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(short)) * 8);
# 225 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
# 226 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 228 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< ushort2> ()
# 229 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 230 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 232 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
# 233 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 235 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< short4> ()
# 236 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 237 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(short)) * 8);
# 239 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
# 240 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 242 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< ushort4> ()
# 243 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 244 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned short)) * 8);
# 246 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
# 247 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 249 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< int> ()
# 250 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 251 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(int)) * 8);
# 253 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 254 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 256 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< unsigned> ()
# 257 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 258 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned)) * 8);
# 260 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 261 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 263 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< int1> ()
# 264 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 265 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(int)) * 8);
# 267 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
# 268 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 270 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uint1> ()
# 271 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 272 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned)) * 8);
# 274 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
# 275 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 277 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< int2> ()
# 278 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 279 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(int)) * 8);
# 281 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
# 282 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 284 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uint2> ()
# 285 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 286 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned)) * 8);
# 288 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
# 289 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 291 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< int4> ()
# 292 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 293 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(int)) * 8);
# 295 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
# 296 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 298 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< uint4> ()
# 299 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 300 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(unsigned)) * 8);
# 302 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
# 303 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 365 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< float> ()
# 366 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 367 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(float)) * 8);
# 369 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
# 370 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 372 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< float1> ()
# 373 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 374 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(float)) * 8);
# 376 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
# 377 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 379 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< float2> ()
# 380 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 381 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(float)) * 8);
# 383 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
# 384 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 386 "/usr/local/cuda/bin/../include/channel_descriptor.h"
template<> inline cudaChannelFormatDesc cudaCreateChannelDesc< float4> ()
# 387 "/usr/local/cuda/bin/../include/channel_descriptor.h"
{
# 388 "/usr/local/cuda/bin/../include/channel_descriptor.h"
int e = (((int)sizeof(float)) * 8);
# 390 "/usr/local/cuda/bin/../include/channel_descriptor.h"
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
# 391 "/usr/local/cuda/bin/../include/channel_descriptor.h"
}
# 65 "/usr/local/cuda/bin/../include/driver_functions.h"
static inline cudaPitchedPtr make_cudaPitchedPtr(void *d, size_t p, size_t xsz, size_t ysz)
# 66 "/usr/local/cuda/bin/../include/driver_functions.h"
{
# 67 "/usr/local/cuda/bin/../include/driver_functions.h"
cudaPitchedPtr s;
# 69 "/usr/local/cuda/bin/../include/driver_functions.h"
(s.ptr) = d;
# 70 "/usr/local/cuda/bin/../include/driver_functions.h"
(s.pitch) = p;
# 71 "/usr/local/cuda/bin/../include/driver_functions.h"
(s.xsize) = xsz;
# 72 "/usr/local/cuda/bin/../include/driver_functions.h"
(s.ysize) = ysz;
# 74 "/usr/local/cuda/bin/../include/driver_functions.h"
return s;
# 75 "/usr/local/cuda/bin/../include/driver_functions.h"
}
# 92 "/usr/local/cuda/bin/../include/driver_functions.h"
static inline cudaPos make_cudaPos(size_t x, size_t y, size_t z)
# 93 "/usr/local/cuda/bin/../include/driver_functions.h"
{
# 94 "/usr/local/cuda/bin/../include/driver_functions.h"
cudaPos p;
# 96 "/usr/local/cuda/bin/../include/driver_functions.h"
(p.x) = x;
# 97 "/usr/local/cuda/bin/../include/driver_functions.h"
(p.y) = y;
# 98 "/usr/local/cuda/bin/../include/driver_functions.h"
(p.z) = z;
# 100 "/usr/local/cuda/bin/../include/driver_functions.h"
return p;
# 101 "/usr/local/cuda/bin/../include/driver_functions.h"
}
# 118 "/usr/local/cuda/bin/../include/driver_functions.h"
static inline cudaExtent make_cudaExtent(size_t w, size_t h, size_t d)
# 119 "/usr/local/cuda/bin/../include/driver_functions.h"
{
# 120 "/usr/local/cuda/bin/../include/driver_functions.h"
cudaExtent e;
# 122 "/usr/local/cuda/bin/../include/driver_functions.h"
(e.width) = w;
# 123 "/usr/local/cuda/bin/../include/driver_functions.h"
(e.height) = h;
# 124 "/usr/local/cuda/bin/../include/driver_functions.h"
(e.depth) = d;
# 126 "/usr/local/cuda/bin/../include/driver_functions.h"
return e;
# 127 "/usr/local/cuda/bin/../include/driver_functions.h"
}
# 55 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline char1 make_char1(signed char x)
# 56 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 57 "/usr/local/cuda/bin/../include/vector_functions.h"
char1 t; (t.x) = x; return t;
# 58 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 60 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uchar1 make_uchar1(unsigned char x)
# 61 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 62 "/usr/local/cuda/bin/../include/vector_functions.h"
uchar1 t; (t.x) = x; return t;
# 63 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 65 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline char2 make_char2(signed char x, signed char y)
# 66 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 67 "/usr/local/cuda/bin/../include/vector_functions.h"
char2 t; (t.x) = x; (t.y) = y; return t;
# 68 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 70 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uchar2 make_uchar2(unsigned char x, unsigned char y)
# 71 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 72 "/usr/local/cuda/bin/../include/vector_functions.h"
uchar2 t; (t.x) = x; (t.y) = y; return t;
# 73 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 75 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline char3 make_char3(signed char x, signed char y, signed char z)
# 76 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 77 "/usr/local/cuda/bin/../include/vector_functions.h"
char3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 78 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 80 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uchar3 make_uchar3(unsigned char x, unsigned char y, unsigned char z)
# 81 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 82 "/usr/local/cuda/bin/../include/vector_functions.h"
uchar3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 83 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 85 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline char4 make_char4(signed char x, signed char y, signed char z, signed char w)
# 86 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 87 "/usr/local/cuda/bin/../include/vector_functions.h"
char4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 88 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 90 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uchar4 make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w)
# 91 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 92 "/usr/local/cuda/bin/../include/vector_functions.h"
uchar4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 93 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 95 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline short1 make_short1(short x)
# 96 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 97 "/usr/local/cuda/bin/../include/vector_functions.h"
short1 t; (t.x) = x; return t;
# 98 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 100 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ushort1 make_ushort1(unsigned short x)
# 101 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 102 "/usr/local/cuda/bin/../include/vector_functions.h"
ushort1 t; (t.x) = x; return t;
# 103 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 105 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline short2 make_short2(short x, short y)
# 106 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 107 "/usr/local/cuda/bin/../include/vector_functions.h"
short2 t; (t.x) = x; (t.y) = y; return t;
# 108 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 110 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ushort2 make_ushort2(unsigned short x, unsigned short y)
# 111 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 112 "/usr/local/cuda/bin/../include/vector_functions.h"
ushort2 t; (t.x) = x; (t.y) = y; return t;
# 113 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 115 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline short3 make_short3(short x, short y, short z)
# 116 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 117 "/usr/local/cuda/bin/../include/vector_functions.h"
short3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 118 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 120 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ushort3 make_ushort3(unsigned short x, unsigned short y, unsigned short z)
# 121 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 122 "/usr/local/cuda/bin/../include/vector_functions.h"
ushort3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 123 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 125 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline short4 make_short4(short x, short y, short z, short w)
# 126 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 127 "/usr/local/cuda/bin/../include/vector_functions.h"
short4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 128 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 130 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ushort4 make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
# 131 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 132 "/usr/local/cuda/bin/../include/vector_functions.h"
ushort4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 133 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 135 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline int1 make_int1(int x)
# 136 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 137 "/usr/local/cuda/bin/../include/vector_functions.h"
int1 t; (t.x) = x; return t;
# 138 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 140 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uint1 make_uint1(unsigned x)
# 141 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 142 "/usr/local/cuda/bin/../include/vector_functions.h"
uint1 t; (t.x) = x; return t;
# 143 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 145 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline int2 make_int2(int x, int y)
# 146 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 147 "/usr/local/cuda/bin/../include/vector_functions.h"
int2 t; (t.x) = x; (t.y) = y; return t;
# 148 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 150 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uint2 make_uint2(unsigned x, unsigned y)
# 151 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 152 "/usr/local/cuda/bin/../include/vector_functions.h"
uint2 t; (t.x) = x; (t.y) = y; return t;
# 153 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 155 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline int3 make_int3(int x, int y, int z)
# 156 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 157 "/usr/local/cuda/bin/../include/vector_functions.h"
int3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 158 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 160 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uint3 make_uint3(unsigned x, unsigned y, unsigned z)
# 161 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 162 "/usr/local/cuda/bin/../include/vector_functions.h"
uint3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 163 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 165 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline int4 make_int4(int x, int y, int z, int w)
# 166 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 167 "/usr/local/cuda/bin/../include/vector_functions.h"
int4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 168 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 170 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline uint4 make_uint4(unsigned x, unsigned y, unsigned z, unsigned w)
# 171 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 172 "/usr/local/cuda/bin/../include/vector_functions.h"
uint4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 173 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 175 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline long1 make_long1(long x)
# 176 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 177 "/usr/local/cuda/bin/../include/vector_functions.h"
long1 t; (t.x) = x; return t;
# 178 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 180 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulong1 make_ulong1(unsigned long x)
# 181 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 182 "/usr/local/cuda/bin/../include/vector_functions.h"
ulong1 t; (t.x) = x; return t;
# 183 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 185 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline long2 make_long2(long x, long y)
# 186 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 187 "/usr/local/cuda/bin/../include/vector_functions.h"
long2 t; (t.x) = x; (t.y) = y; return t;
# 188 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 190 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulong2 make_ulong2(unsigned long x, unsigned long y)
# 191 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 192 "/usr/local/cuda/bin/../include/vector_functions.h"
ulong2 t; (t.x) = x; (t.y) = y; return t;
# 193 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 195 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline long3 make_long3(long x, long y, long z)
# 196 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 197 "/usr/local/cuda/bin/../include/vector_functions.h"
long3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 198 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 200 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulong3 make_ulong3(unsigned long x, unsigned long y, unsigned long z)
# 201 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 202 "/usr/local/cuda/bin/../include/vector_functions.h"
ulong3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 203 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 205 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline long4 make_long4(long x, long y, long z, long w)
# 206 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 207 "/usr/local/cuda/bin/../include/vector_functions.h"
long4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 208 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 210 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulong4 make_ulong4(unsigned long x, unsigned long y, unsigned long z, unsigned long w)
# 211 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 212 "/usr/local/cuda/bin/../include/vector_functions.h"
ulong4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 213 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 215 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline float1 make_float1(float x)
# 216 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 217 "/usr/local/cuda/bin/../include/vector_functions.h"
float1 t; (t.x) = x; return t;
# 218 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 220 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline float2 make_float2(float x, float y)
# 221 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 222 "/usr/local/cuda/bin/../include/vector_functions.h"
float2 t; (t.x) = x; (t.y) = y; return t;
# 223 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 225 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline float3 make_float3(float x, float y, float z)
# 226 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 227 "/usr/local/cuda/bin/../include/vector_functions.h"
float3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 228 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 230 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline float4 make_float4(float x, float y, float z, float w)
# 231 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 232 "/usr/local/cuda/bin/../include/vector_functions.h"
float4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 233 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 235 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline longlong1 make_longlong1(long long x)
# 236 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 237 "/usr/local/cuda/bin/../include/vector_functions.h"
longlong1 t; (t.x) = x; return t;
# 238 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 240 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulonglong1 make_ulonglong1(unsigned long long x)
# 241 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 242 "/usr/local/cuda/bin/../include/vector_functions.h"
ulonglong1 t; (t.x) = x; return t;
# 243 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 245 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline longlong2 make_longlong2(long long x, long long y)
# 246 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 247 "/usr/local/cuda/bin/../include/vector_functions.h"
longlong2 t; (t.x) = x; (t.y) = y; return t;
# 248 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 250 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulonglong2 make_ulonglong2(unsigned long long x, unsigned long long y)
# 251 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 252 "/usr/local/cuda/bin/../include/vector_functions.h"
ulonglong2 t; (t.x) = x; (t.y) = y; return t;
# 253 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 255 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline longlong3 make_longlong3(long long x, long long y, long long z)
# 256 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 257 "/usr/local/cuda/bin/../include/vector_functions.h"
longlong3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 258 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 260 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulonglong3 make_ulonglong3(unsigned long long x, unsigned long long y, unsigned long long z)
# 261 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 262 "/usr/local/cuda/bin/../include/vector_functions.h"
ulonglong3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 263 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 265 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline longlong4 make_longlong4(long long x, long long y, long long z, long long w)
# 266 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 267 "/usr/local/cuda/bin/../include/vector_functions.h"
longlong4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 268 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 270 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline ulonglong4 make_ulonglong4(unsigned long long x, unsigned long long y, unsigned long long z, unsigned long long w)
# 271 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 272 "/usr/local/cuda/bin/../include/vector_functions.h"
ulonglong4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 273 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 275 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline double1 make_double1(double x)
# 276 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 277 "/usr/local/cuda/bin/../include/vector_functions.h"
double1 t; (t.x) = x; return t;
# 278 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 280 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline double2 make_double2(double x, double y)
# 281 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 282 "/usr/local/cuda/bin/../include/vector_functions.h"
double2 t; (t.x) = x; (t.y) = y; return t;
# 283 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 285 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline double3 make_double3(double x, double y, double z)
# 286 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 287 "/usr/local/cuda/bin/../include/vector_functions.h"
double3 t; (t.x) = x; (t.y) = y; (t.z) = z; return t;
# 288 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 290 "/usr/local/cuda/bin/../include/vector_functions.h"
static inline double4 make_double4(double x, double y, double z, double w)
# 291 "/usr/local/cuda/bin/../include/vector_functions.h"
{
# 292 "/usr/local/cuda/bin/../include/vector_functions.h"
double4 t; (t.x) = x; (t.y) = y; (t.z) = z; (t.w) = w; return t;
# 293 "/usr/local/cuda/bin/../include/vector_functions.h"
}
# 44 "/usr/include/string.h" 3
extern "C" __attribute__((weak)) void *memcpy(void *__restrict__, const void *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 49 "/usr/include/string.h" 3
extern "C" void *memmove(void *, const void *, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 57 "/usr/include/string.h" 3
extern "C" void *memccpy(void *__restrict__, const void *__restrict__, int, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 65 "/usr/include/string.h" 3
extern "C" __attribute__((weak)) void *memset(void *, int, size_t) throw() __attribute__((nonnull(1)));
# 68 "/usr/include/string.h" 3
extern "C" int memcmp(const void *, const void *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 75 "/usr/include/string.h" 3
extern void *memchr(void *, int, size_t) throw() __asm__("memchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 77 "/usr/include/string.h" 3
extern const void *memchr(const void *, int, size_t) throw() __asm__("memchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 104 "/usr/include/string.h" 3
void *rawmemchr(void *, int) throw() __asm__("rawmemchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 106 "/usr/include/string.h" 3
const void *rawmemchr(const void *, int) throw() __asm__("rawmemchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 115 "/usr/include/string.h" 3
void *memrchr(void *, int, size_t) throw() __asm__("memrchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 117 "/usr/include/string.h" 3
const void *memrchr(const void *, int, size_t) throw() __asm__("memrchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 128 "/usr/include/string.h" 3
extern "C" char *strcpy(char *__restrict__, const char *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 131 "/usr/include/string.h" 3
extern "C" char *strncpy(char *__restrict__, const char *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 136 "/usr/include/string.h" 3
extern "C" char *strcat(char *__restrict__, const char *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 139 "/usr/include/string.h" 3
extern "C" char *strncat(char *__restrict__, const char *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 143 "/usr/include/string.h" 3
extern "C" int strcmp(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 146 "/usr/include/string.h" 3
extern "C" int strncmp(const char *, const char *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 150 "/usr/include/string.h" 3
extern "C" int strcoll(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 153 "/usr/include/string.h" 3
extern "C" size_t strxfrm(char *__restrict__, const char *__restrict__, size_t) throw() __attribute__((nonnull(2)));
# 40 "/usr/include/xlocale.h" 3
extern "C" { typedef
# 28 "/usr/include/xlocale.h" 3
struct __locale_struct {
# 31 "/usr/include/xlocale.h" 3
struct __locale_data *__locales[13];
# 34 "/usr/include/xlocale.h" 3
const unsigned short *__ctype_b;
# 35 "/usr/include/xlocale.h" 3
const int *__ctype_tolower;
# 36 "/usr/include/xlocale.h" 3
const int *__ctype_toupper;
# 39 "/usr/include/xlocale.h" 3
const char *__names[13];
# 40 "/usr/include/xlocale.h" 3
} *__locale_t; }
# 43 "/usr/include/xlocale.h" 3
extern "C" { typedef __locale_t locale_t; }
# 165 "/usr/include/string.h" 3
extern "C" int strcoll_l(const char *, const char *, __locale_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2))) __attribute__((nonnull(3)));
# 168 "/usr/include/string.h" 3
extern "C" size_t strxfrm_l(char *, const char *, size_t, __locale_t) throw() __attribute__((nonnull(2))) __attribute__((nonnull(4)));
# 175 "/usr/include/string.h" 3
extern "C" char *strdup(const char *) throw() __attribute__((__malloc__)) __attribute__((nonnull(1)));
# 183 "/usr/include/string.h" 3
extern "C" char *strndup(const char *, size_t) throw() __attribute__((__malloc__)) __attribute__((nonnull(1)));
# 215 "/usr/include/string.h" 3
extern char *strchr(char *, int) throw() __asm__("strchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 217 "/usr/include/string.h" 3
extern const char *strchr(const char *, int) throw() __asm__("strchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 242 "/usr/include/string.h" 3
extern char *strrchr(char *, int) throw() __asm__("strrchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 244 "/usr/include/string.h" 3
extern const char *strrchr(const char *, int) throw() __asm__("strrchr") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 271 "/usr/include/string.h" 3
char *strchrnul(char *, int) throw() __asm__("strchrnul") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 273 "/usr/include/string.h" 3
const char *strchrnul(const char *, int) throw() __asm__("strchrnul") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 284 "/usr/include/string.h" 3
extern "C" size_t strcspn(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 288 "/usr/include/string.h" 3
extern "C" size_t strspn(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 294 "/usr/include/string.h" 3
extern char *strpbrk(char *, const char *) throw() __asm__("strpbrk") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 296 "/usr/include/string.h" 3
extern const char *strpbrk(const char *, const char *) throw() __asm__("strpbrk") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 321 "/usr/include/string.h" 3
extern char *strstr(char *, const char *) throw() __asm__("strstr") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 323 "/usr/include/string.h" 3
extern const char *strstr(const char *, const char *) throw() __asm__("strstr") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 348 "/usr/include/string.h" 3
extern "C" char *strtok(char *__restrict__, const char *__restrict__) throw() __attribute__((nonnull(2)));
# 354 "/usr/include/string.h" 3
extern "C" char *__strtok_r(char *__restrict__, const char *__restrict__, char **__restrict__) throw() __attribute__((nonnull(2))) __attribute__((nonnull(3)));
# 359 "/usr/include/string.h" 3
extern "C" char *strtok_r(char *__restrict__, const char *__restrict__, char **__restrict__) throw() __attribute__((nonnull(2))) __attribute__((nonnull(3)));
# 367 "/usr/include/string.h" 3
char *strcasestr(char *, const char *) throw() __asm__("strcasestr") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 369 "/usr/include/string.h" 3
const char *strcasestr(const char *, const char *) throw() __asm__("strcasestr") __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 382 "/usr/include/string.h" 3
extern "C" void *memmem(const void *, size_t, const void *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(3)));
# 388 "/usr/include/string.h" 3
extern "C" void *__mempcpy(void *__restrict__, const void *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 391 "/usr/include/string.h" 3
extern "C" void *mempcpy(void *__restrict__, const void *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 399 "/usr/include/string.h" 3
extern "C" size_t strlen(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 406 "/usr/include/string.h" 3
extern "C" size_t strnlen(const char *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 413 "/usr/include/string.h" 3
extern "C" char *strerror(int) throw();
# 438 "/usr/include/string.h" 3
extern "C" char *strerror_r(int, char *, size_t) throw() __attribute__((nonnull(2)));
# 445 "/usr/include/string.h" 3
extern "C" char *strerror_l(int, __locale_t) throw();
# 451 "/usr/include/string.h" 3
extern "C" void __bzero(void *, size_t) throw() __attribute__((nonnull(1)));
# 455 "/usr/include/string.h" 3
extern "C" void bcopy(const void *, void *, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 459 "/usr/include/string.h" 3
extern "C" void bzero(void *, size_t) throw() __attribute__((nonnull(1)));
# 462 "/usr/include/string.h" 3
extern "C" int bcmp(const void *, const void *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 469 "/usr/include/string.h" 3
extern char *index(char *, int) throw() __asm__("index") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 471 "/usr/include/string.h" 3
extern const char *index(const char *, int) throw() __asm__("index") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 497 "/usr/include/string.h" 3
extern char *rindex(char *, int) throw() __asm__("rindex") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 499 "/usr/include/string.h" 3
extern const char *rindex(const char *, int) throw() __asm__("rindex") __attribute__((__pure__)) __attribute__((nonnull(1)));
# 523 "/usr/include/string.h" 3
extern "C" int ffs(int) throw() __attribute__((__const__));
# 528 "/usr/include/string.h" 3
extern "C" int ffsl(long) throw() __attribute__((__const__));
# 530 "/usr/include/string.h" 3
extern "C" int ffsll(long long) throw() __attribute__((__const__));
# 536 "/usr/include/string.h" 3
extern "C" int strcasecmp(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 540 "/usr/include/string.h" 3
extern "C" int strncasecmp(const char *, const char *, size_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 547 "/usr/include/string.h" 3
extern "C" int strcasecmp_l(const char *, const char *, __locale_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2))) __attribute__((nonnull(3)));
# 551 "/usr/include/string.h" 3
extern "C" int strncasecmp_l(const char *, const char *, size_t, __locale_t) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2))) __attribute__((nonnull(4)));
# 559 "/usr/include/string.h" 3
extern "C" char *strsep(char **__restrict__, const char *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 566 "/usr/include/string.h" 3
extern "C" char *strsignal(int) throw();
# 569 "/usr/include/string.h" 3
extern "C" char *__stpcpy(char *__restrict__, const char *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 571 "/usr/include/string.h" 3
extern "C" char *stpcpy(char *__restrict__, const char *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 576 "/usr/include/string.h" 3
extern "C" char *__stpncpy(char *__restrict__, const char *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 579 "/usr/include/string.h" 3
extern "C" char *stpncpy(char *__restrict__, const char *__restrict__, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 586 "/usr/include/string.h" 3
extern "C" int strverscmp(const char *, const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 590 "/usr/include/string.h" 3
extern "C" char *strfry(char *) throw() __attribute__((nonnull(1)));
# 593 "/usr/include/string.h" 3
extern "C" void *memfrob(void *, size_t) throw() __attribute__((nonnull(1)));
# 601 "/usr/include/string.h" 3
char *basename(char *) throw() __asm__("basename") __attribute__((nonnull(1)));
# 603 "/usr/include/string.h" 3
const char *basename(const char *) throw() __asm__("basename") __attribute__((nonnull(1)));
# 31 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned char __u_char; }
# 32 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned short __u_short; }
# 33 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __u_int; }
# 34 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __u_long; }
# 37 "/usr/include/bits/types.h" 3
extern "C" { typedef signed char __int8_t; }
# 38 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned char __uint8_t; }
# 39 "/usr/include/bits/types.h" 3
extern "C" { typedef signed short __int16_t; }
# 40 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned short __uint16_t; }
# 41 "/usr/include/bits/types.h" 3
extern "C" { typedef signed int __int32_t; }
# 42 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __uint32_t; }
# 44 "/usr/include/bits/types.h" 3
extern "C" { typedef signed long __int64_t; }
# 45 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __uint64_t; }
# 53 "/usr/include/bits/types.h" 3
extern "C" { typedef long __quad_t; }
# 54 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __u_quad_t; }
# 134 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __dev_t; }
# 135 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __uid_t; }
# 136 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __gid_t; }
# 137 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __ino_t; }
# 138 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __ino64_t; }
# 139 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __mode_t; }
# 140 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __nlink_t; }
# 141 "/usr/include/bits/types.h" 3
extern "C" { typedef long __off_t; }
# 142 "/usr/include/bits/types.h" 3
extern "C" { typedef long __off64_t; }
# 143 "/usr/include/bits/types.h" 3
extern "C" { typedef int __pid_t; }
# 144 "/usr/include/bits/types.h" 3
extern "C" { typedef struct { int __val[2]; } __fsid_t; }
# 145 "/usr/include/bits/types.h" 3
extern "C" { typedef long __clock_t; }
# 146 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __rlim_t; }
# 147 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __rlim64_t; }
# 148 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __id_t; }
# 149 "/usr/include/bits/types.h" 3
extern "C" { typedef long __time_t; }
# 150 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __useconds_t; }
# 151 "/usr/include/bits/types.h" 3
extern "C" { typedef long __suseconds_t; }
# 153 "/usr/include/bits/types.h" 3
extern "C" { typedef int __daddr_t; }
# 154 "/usr/include/bits/types.h" 3
extern "C" { typedef long __swblk_t; }
# 155 "/usr/include/bits/types.h" 3
extern "C" { typedef int __key_t; }
# 158 "/usr/include/bits/types.h" 3
extern "C" { typedef int __clockid_t; }
# 161 "/usr/include/bits/types.h" 3
extern "C" { typedef void *__timer_t; }
# 164 "/usr/include/bits/types.h" 3
extern "C" { typedef long __blksize_t; }
# 169 "/usr/include/bits/types.h" 3
extern "C" { typedef long __blkcnt_t; }
# 170 "/usr/include/bits/types.h" 3
extern "C" { typedef long __blkcnt64_t; }
# 173 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __fsblkcnt_t; }
# 174 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __fsblkcnt64_t; }
# 177 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __fsfilcnt_t; }
# 178 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned long __fsfilcnt64_t; }
# 180 "/usr/include/bits/types.h" 3
extern "C" { typedef long __ssize_t; }
# 184 "/usr/include/bits/types.h" 3
extern "C" { typedef __off64_t __loff_t; }
# 185 "/usr/include/bits/types.h" 3
extern "C" { typedef __quad_t *__qaddr_t; }
# 186 "/usr/include/bits/types.h" 3
extern "C" { typedef char *__caddr_t; }
# 189 "/usr/include/bits/types.h" 3
extern "C" { typedef long __intptr_t; }
# 192 "/usr/include/bits/types.h" 3
extern "C" { typedef unsigned __socklen_t; }
# 60 "/usr/include/time.h" 3
extern "C" { typedef __clock_t clock_t; }
# 76 "/usr/include/time.h" 3
extern "C" { typedef __time_t time_t; }
# 92 "/usr/include/time.h" 3
extern "C" { typedef __clockid_t clockid_t; }
# 104 "/usr/include/time.h" 3
extern "C" { typedef __timer_t timer_t; }
# 120 "/usr/include/time.h" 3
extern "C" { struct timespec {
# 122 "/usr/include/time.h" 3
__time_t tv_sec;
# 123 "/usr/include/time.h" 3
long tv_nsec;
# 124 "/usr/include/time.h" 3
}; }
# 133 "/usr/include/time.h" 3
extern "C" { struct tm {
# 135 "/usr/include/time.h" 3
int tm_sec;
# 136 "/usr/include/time.h" 3
int tm_min;
# 137 "/usr/include/time.h" 3
int tm_hour;
# 138 "/usr/include/time.h" 3
int tm_mday;
# 139 "/usr/include/time.h" 3
int tm_mon;
# 140 "/usr/include/time.h" 3
int tm_year;
# 141 "/usr/include/time.h" 3
int tm_wday;
# 142 "/usr/include/time.h" 3
int tm_yday;
# 143 "/usr/include/time.h" 3
int tm_isdst;
# 146 "/usr/include/time.h" 3
long tm_gmtoff;
# 147 "/usr/include/time.h" 3
const char *tm_zone;
# 152 "/usr/include/time.h" 3
}; }
# 161 "/usr/include/time.h" 3
extern "C" { struct itimerspec {
# 163 "/usr/include/time.h" 3
timespec it_interval;
# 164 "/usr/include/time.h" 3
timespec it_value;
# 165 "/usr/include/time.h" 3
}; }
# 168 "/usr/include/time.h" 3
struct sigevent;
# 174 "/usr/include/time.h" 3
extern "C" { typedef __pid_t pid_t; }
# 183 "/usr/include/time.h" 3
extern "C" __attribute__((weak)) clock_t clock() throw();
# 186 "/usr/include/time.h" 3
extern "C" time_t time(time_t *) throw();
# 189 "/usr/include/time.h" 3
extern "C" double difftime(time_t, time_t) throw() __attribute__((__const__));
# 193 "/usr/include/time.h" 3
extern "C" time_t mktime(tm *) throw();
# 199 "/usr/include/time.h" 3
extern "C" size_t strftime(char *__restrict__, size_t, const char *__restrict__, const tm *__restrict__) throw();
# 207 "/usr/include/time.h" 3
extern "C" char *strptime(const char *__restrict__, const char *__restrict__, tm *) throw();
# 217 "/usr/include/time.h" 3
extern "C" size_t strftime_l(char *__restrict__, size_t, const char *__restrict__, const tm *__restrict__, __locale_t) throw();
# 224 "/usr/include/time.h" 3
extern "C" char *strptime_l(const char *__restrict__, const char *__restrict__, tm *, __locale_t) throw();
# 233 "/usr/include/time.h" 3
extern "C" tm *gmtime(const time_t *) throw();
# 237 "/usr/include/time.h" 3
extern "C" tm *localtime(const time_t *) throw();
# 243 "/usr/include/time.h" 3
extern "C" tm *gmtime_r(const time_t *__restrict__, tm *__restrict__) throw();
# 248 "/usr/include/time.h" 3
extern "C" tm *localtime_r(const time_t *__restrict__, tm *__restrict__) throw();
# 255 "/usr/include/time.h" 3
extern "C" char *asctime(const tm *) throw();
# 258 "/usr/include/time.h" 3
extern "C" char *ctime(const time_t *) throw();
# 266 "/usr/include/time.h" 3
extern "C" char *asctime_r(const tm *__restrict__, char *__restrict__) throw();
# 270 "/usr/include/time.h" 3
extern "C" char *ctime_r(const time_t *__restrict__, char *__restrict__) throw();
# 276 "/usr/include/time.h" 3
extern "C" { extern char *__tzname[2]; }
# 277 "/usr/include/time.h" 3
extern "C" { extern int __daylight; }
# 278 "/usr/include/time.h" 3
extern "C" { extern long __timezone; }
# 283 "/usr/include/time.h" 3
extern "C" { extern char *tzname[2]; }
# 287 "/usr/include/time.h" 3
extern "C" void tzset() throw();
# 291 "/usr/include/time.h" 3
extern "C" { extern int daylight; }
# 292 "/usr/include/time.h" 3
extern "C" { extern long timezone; }
# 298 "/usr/include/time.h" 3
extern "C" int stime(const time_t *) throw();
# 313 "/usr/include/time.h" 3
extern "C" time_t timegm(tm *) throw();
# 316 "/usr/include/time.h" 3
extern "C" time_t timelocal(tm *) throw();
# 319 "/usr/include/time.h" 3
extern "C" int dysize(int) throw() __attribute__((__const__));
# 328 "/usr/include/time.h" 3
extern "C" int nanosleep(const timespec *, timespec *);
# 333 "/usr/include/time.h" 3
extern "C" int clock_getres(clockid_t, timespec *) throw();
# 336 "/usr/include/time.h" 3
extern "C" int clock_gettime(clockid_t, timespec *) throw();
# 339 "/usr/include/time.h" 3
extern "C" int clock_settime(clockid_t, const timespec *) throw();
# 347 "/usr/include/time.h" 3
extern "C" int clock_nanosleep(clockid_t, int, const timespec *, timespec *);
# 352 "/usr/include/time.h" 3
extern "C" int clock_getcpuclockid(pid_t, clockid_t *) throw();
# 357 "/usr/include/time.h" 3
extern "C" int timer_create(clockid_t, sigevent *__restrict__, timer_t *__restrict__) throw();
# 362 "/usr/include/time.h" 3
extern "C" int timer_delete(timer_t) throw();
# 365 "/usr/include/time.h" 3
extern "C" int timer_settime(timer_t, int, const itimerspec *__restrict__, itimerspec *__restrict__) throw();
# 370 "/usr/include/time.h" 3
extern "C" int timer_gettime(timer_t, itimerspec *) throw();
# 374 "/usr/include/time.h" 3
extern "C" int timer_getoverrun(timer_t) throw();
# 390 "/usr/include/time.h" 3
extern "C" { extern int getdate_err; }
# 399 "/usr/include/time.h" 3
extern "C" tm *getdate(const char *);
# 413 "/usr/include/time.h" 3
extern "C" int getdate_r(const char *__restrict__, tm *__restrict__);
# 57 "/usr/local/cuda/bin/../include/common_functions.h"
extern "C" __attribute__((weak)) clock_t clock() throw();
# 59 "/usr/local/cuda/bin/../include/common_functions.h"
extern "C" __attribute__((weak)) void *memset(void *, int, size_t) throw() __attribute__((nonnull(1)));
# 61 "/usr/local/cuda/bin/../include/common_functions.h"
extern "C" __attribute__((weak)) void *memcpy(void *, const void *, size_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 66 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int abs(int) throw() __attribute__((__const__));
# 68 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long labs(long) throw() __attribute__((__const__));
# 70 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llabs(long long) throw() __attribute__((__const__));
# 72 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fabs(double) throw() __attribute__((__const__));
# 74 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fabsf(float) throw() __attribute__((__const__));
# 77 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int min(int, int);
# 79 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) unsigned umin(unsigned, unsigned);
# 81 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llmin(long long, long long);
# 83 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) unsigned long long ullmin(unsigned long long, unsigned long long);
# 85 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fminf(float, float) throw();
# 87 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fmin(double, double) throw();
# 90 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int max(int, int);
# 92 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) unsigned umax(unsigned, unsigned);
# 94 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llmax(long long, long long);
# 96 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) unsigned long long ullmax(unsigned long long, unsigned long long);
# 98 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fmaxf(float, float) throw();
# 100 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fmax(double, double) throw();
# 103 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double sin(double) throw();
# 105 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float sinf(float) throw();
# 108 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double cos(double) throw();
# 110 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float cosf(float) throw();
# 113 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) void sincos(double, double *, double *) throw();
# 115 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) void sincosf(float, float *, float *) throw();
# 118 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double tan(double) throw();
# 120 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float tanf(float) throw();
# 123 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double sqrt(double) throw();
# 125 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float sqrtf(float) throw();
# 128 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double rsqrt(double);
# 130 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float rsqrtf(float);
# 133 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double exp2(double) throw();
# 135 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float exp2f(float) throw();
# 138 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double exp10(double) throw();
# 140 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float exp10f(float) throw();
# 143 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double expm1(double) throw();
# 145 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float expm1f(float) throw();
# 148 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double log2(double) throw();
# 150 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float log2f(float) throw();
# 153 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double log10(double) throw();
# 155 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float log10f(float) throw();
# 158 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double log(double) throw();
# 160 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float logf(float) throw();
# 163 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double log1p(double) throw();
# 165 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float log1pf(float) throw();
# 168 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double floor(double) throw() __attribute__((__const__));
# 170 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float floorf(float) throw() __attribute__((__const__));
# 173 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double exp(double) throw();
# 175 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float expf(float) throw();
# 178 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double cosh(double) throw();
# 180 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float coshf(float) throw();
# 183 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double sinh(double) throw();
# 185 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float sinhf(float) throw();
# 188 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double tanh(double) throw();
# 190 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float tanhf(float) throw();
# 193 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double acosh(double) throw();
# 195 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float acoshf(float) throw();
# 198 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double asinh(double) throw();
# 200 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float asinhf(float) throw();
# 203 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double atanh(double) throw();
# 205 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float atanhf(float) throw();
# 208 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double ldexp(double, int) throw();
# 210 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float ldexpf(float, int) throw();
# 213 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double logb(double) throw();
# 215 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float logbf(float) throw();
# 218 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int ilogb(double) throw();
# 220 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int ilogbf(float) throw();
# 223 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double scalbn(double, int) throw();
# 225 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float scalbnf(float, int) throw();
# 228 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double scalbln(double, long) throw();
# 230 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float scalblnf(float, long) throw();
# 233 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double frexp(double, int *) throw();
# 235 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float frexpf(float, int *) throw();
# 238 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double round(double) throw() __attribute__((__const__));
# 240 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float roundf(float) throw() __attribute__((__const__));
# 243 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long lround(double) throw();
# 245 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long lroundf(float) throw();
# 248 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llround(double) throw();
# 250 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llroundf(float) throw();
# 253 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double rint(double) throw();
# 255 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float rintf(float) throw();
# 258 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long lrint(double) throw();
# 260 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long lrintf(float) throw();
# 263 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llrint(double) throw();
# 265 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) long long llrintf(float) throw();
# 268 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double nearbyint(double) throw();
# 270 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float nearbyintf(float) throw();
# 273 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double ceil(double) throw() __attribute__((__const__));
# 275 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float ceilf(float) throw() __attribute__((__const__));
# 278 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double trunc(double) throw() __attribute__((__const__));
# 280 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float truncf(float) throw() __attribute__((__const__));
# 283 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fdim(double, double) throw();
# 285 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fdimf(float, float) throw();
# 288 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double atan2(double, double) throw();
# 290 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float atan2f(float, float) throw();
# 293 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double atan(double) throw();
# 295 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float atanf(float) throw();
# 298 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double asin(double) throw();
# 300 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float asinf(float) throw();
# 303 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double acos(double) throw();
# 305 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float acosf(float) throw();
# 308 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double hypot(double, double) throw();
# 310 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float hypotf(float, float) throw();
# 313 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double cbrt(double) throw();
# 315 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float cbrtf(float) throw();
# 318 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double rcbrt(double);
# 320 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float rcbrtf(float);
# 323 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double sinpi(double);
# 325 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float sinpif(float);
# 328 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double pow(double, double) throw();
# 330 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float powf(float, float) throw();
# 333 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double modf(double, double *) throw();
# 335 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float modff(float, float *) throw();
# 338 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fmod(double, double) throw();
# 340 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fmodf(float, float) throw();
# 343 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double remainder(double, double) throw();
# 345 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float remainderf(float, float) throw();
# 348 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double remquo(double, double, int *) throw();
# 350 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float remquof(float, float, int *) throw();
# 353 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double erf(double) throw();
# 355 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float erff(float) throw();
# 358 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double erfinv(double);
# 360 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float erfinvf(float);
# 363 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double erfc(double) throw();
# 365 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float erfcf(float) throw();
# 368 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double erfcinv(double);
# 370 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float erfcinvf(float);
# 373 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double lgamma(double) throw();
# 375 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float lgammaf(float) throw();
# 378 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double tgamma(double) throw();
# 380 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float tgammaf(float) throw();
# 383 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double copysign(double, double) throw() __attribute__((__const__));
# 385 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float copysignf(float, float) throw() __attribute__((__const__));
# 388 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double nextafter(double, double) throw() __attribute__((__const__));
# 390 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float nextafterf(float, float) throw() __attribute__((__const__));
# 393 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double nan(const char *) throw() __attribute__((__const__));
# 395 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float nanf(const char *) throw() __attribute__((__const__));
# 398 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isinf(double) throw() __attribute__((__const__));
# 400 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isinff(float) throw() __attribute__((__const__));
# 403 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isnan(double) throw() __attribute__((__const__));
# 405 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isnanf(float) throw() __attribute__((__const__));
# 419 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __finite(double) throw() __attribute__((__const__));
# 421 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __finitef(float) throw() __attribute__((__const__));
# 423 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __signbit(double) throw() __attribute__((__const__));
# 428 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __signbitf(float) throw() __attribute__((__const__));
# 431 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) double fma(double, double, double) throw();
# 433 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) float fmaf(float, float, float) throw();
# 441 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __signbitl(long double) throw() __attribute__((__const__));
# 443 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isinfl(long double) throw() __attribute__((__const__));
# 445 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __isnanl(long double) throw() __attribute__((__const__));
# 455 "/usr/local/cuda/bin/../include/math_functions.h"
extern "C" __attribute__((weak)) int __finitel(long double) throw() __attribute__((__const__));
# 31 "/usr/include/bits/mathdef.h" 3
extern "C" { typedef float float_t; }
# 32 "/usr/include/bits/mathdef.h" 3
extern "C" { typedef double double_t; }
# 55 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double acos(double) throw(); extern "C" double __acos(double) throw();
# 57 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double asin(double) throw(); extern "C" double __asin(double) throw();
# 59 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double atan(double) throw(); extern "C" double __atan(double) throw();
# 61 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double atan2(double, double) throw(); extern "C" double __atan2(double, double) throw();
# 64 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double cos(double) throw(); extern "C" double __cos(double) throw();
# 66 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double sin(double) throw(); extern "C" double __sin(double) throw();
# 68 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double tan(double) throw(); extern "C" double __tan(double) throw();
# 73 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double cosh(double) throw(); extern "C" double __cosh(double) throw();
# 75 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double sinh(double) throw(); extern "C" double __sinh(double) throw();
# 77 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double tanh(double) throw(); extern "C" double __tanh(double) throw();
# 82 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) void sincos(double, double *, double *) throw(); extern "C" void __sincos(double, double *, double *) throw();
# 89 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double acosh(double) throw(); extern "C" double __acosh(double) throw();
# 91 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double asinh(double) throw(); extern "C" double __asinh(double) throw();
# 93 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double atanh(double) throw(); extern "C" double __atanh(double) throw();
# 101 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double exp(double) throw(); extern "C" double __exp(double) throw();
# 104 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double frexp(double, int *) throw(); extern "C" double __frexp(double, int *) throw();
# 107 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double ldexp(double, int) throw(); extern "C" double __ldexp(double, int) throw();
# 110 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double log(double) throw(); extern "C" double __log(double) throw();
# 113 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double log10(double) throw(); extern "C" double __log10(double) throw();
# 116 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double modf(double, double *) throw(); extern "C" double __modf(double, double *) throw();
# 121 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double exp10(double) throw(); extern "C" double __exp10(double) throw();
# 123 "/usr/include/bits/mathcalls.h" 3
extern "C" double pow10(double) throw(); extern "C" double __pow10(double) throw();
# 129 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double expm1(double) throw(); extern "C" double __expm1(double) throw();
# 132 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double log1p(double) throw(); extern "C" double __log1p(double) throw();
# 135 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double logb(double) throw(); extern "C" double __logb(double) throw();
# 142 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double exp2(double) throw(); extern "C" double __exp2(double) throw();
# 145 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double log2(double) throw(); extern "C" double __log2(double) throw();
# 154 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double pow(double, double) throw(); extern "C" double __pow(double, double) throw();
# 157 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double sqrt(double) throw(); extern "C" double __sqrt(double) throw();
# 163 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double hypot(double, double) throw(); extern "C" double __hypot(double, double) throw();
# 170 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double cbrt(double) throw(); extern "C" double __cbrt(double) throw();
# 179 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double ceil(double) throw() __attribute__((__const__)); extern "C" double __ceil(double) throw() __attribute__((__const__));
# 182 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fabs(double) throw() __attribute__((__const__)); extern "C" double __fabs(double) throw() __attribute__((__const__));
# 185 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double floor(double) throw() __attribute__((__const__)); extern "C" double __floor(double) throw() __attribute__((__const__));
# 188 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fmod(double, double) throw(); extern "C" double __fmod(double, double) throw();
# 193 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isinf(double) throw() __attribute__((__const__));
# 196 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __finite(double) throw() __attribute__((__const__));
# 202 "/usr/include/bits/mathcalls.h" 3
extern "C" int isinf(double) throw() __attribute__((__const__));
# 205 "/usr/include/bits/mathcalls.h" 3
extern "C" int finite(double) throw() __attribute__((__const__));
# 208 "/usr/include/bits/mathcalls.h" 3
extern "C" double drem(double, double) throw(); extern "C" double __drem(double, double) throw();
# 212 "/usr/include/bits/mathcalls.h" 3
extern "C" double significand(double) throw(); extern "C" double __significand(double) throw();
# 218 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double copysign(double, double) throw() __attribute__((__const__)); extern "C" double __copysign(double, double) throw() __attribute__((__const__));
# 225 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double nan(const char *) throw() __attribute__((__const__)); extern "C" double __nan(const char *) throw() __attribute__((__const__));
# 231 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isnan(double) throw() __attribute__((__const__));
# 235 "/usr/include/bits/mathcalls.h" 3
extern "C" int isnan(double) throw() __attribute__((__const__));
# 238 "/usr/include/bits/mathcalls.h" 3
extern "C" double j0(double) throw(); extern "C" double __j0(double) throw();
# 239 "/usr/include/bits/mathcalls.h" 3
extern "C" double j1(double) throw(); extern "C" double __j1(double) throw();
# 240 "/usr/include/bits/mathcalls.h" 3
extern "C" double jn(int, double) throw(); extern "C" double __jn(int, double) throw();
# 241 "/usr/include/bits/mathcalls.h" 3
extern "C" double y0(double) throw(); extern "C" double __y0(double) throw();
# 242 "/usr/include/bits/mathcalls.h" 3
extern "C" double y1(double) throw(); extern "C" double __y1(double) throw();
# 243 "/usr/include/bits/mathcalls.h" 3
extern "C" double yn(int, double) throw(); extern "C" double __yn(int, double) throw();
# 250 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double erf(double) throw(); extern "C" double __erf(double) throw();
# 251 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double erfc(double) throw(); extern "C" double __erfc(double) throw();
# 252 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double lgamma(double) throw(); extern "C" double __lgamma(double) throw();
# 259 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double tgamma(double) throw(); extern "C" double __tgamma(double) throw();
# 265 "/usr/include/bits/mathcalls.h" 3
extern "C" double gamma(double) throw(); extern "C" double __gamma(double) throw();
# 272 "/usr/include/bits/mathcalls.h" 3
extern "C" double lgamma_r(double, int *) throw(); extern "C" double __lgamma_r(double, int *) throw();
# 280 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double rint(double) throw(); extern "C" double __rint(double) throw();
# 283 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double nextafter(double, double) throw() __attribute__((__const__)); extern "C" double __nextafter(double, double) throw() __attribute__((__const__));
# 285 "/usr/include/bits/mathcalls.h" 3
extern "C" double nexttoward(double, long double) throw() __attribute__((__const__)); extern "C" double __nexttoward(double, long double) throw() __attribute__((__const__));
# 289 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double remainder(double, double) throw(); extern "C" double __remainder(double, double) throw();
# 293 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double scalbn(double, int) throw(); extern "C" double __scalbn(double, int) throw();
# 297 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int ilogb(double) throw(); extern "C" int __ilogb(double) throw();
# 302 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double scalbln(double, long) throw(); extern "C" double __scalbln(double, long) throw();
# 306 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double nearbyint(double) throw(); extern "C" double __nearbyint(double) throw();
# 310 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double round(double) throw() __attribute__((__const__)); extern "C" double __round(double) throw() __attribute__((__const__));
# 314 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double trunc(double) throw() __attribute__((__const__)); extern "C" double __trunc(double) throw() __attribute__((__const__));
# 319 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double remquo(double, double, int *) throw(); extern "C" double __remquo(double, double, int *) throw();
# 326 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long lrint(double) throw(); extern "C" long __lrint(double) throw();
# 327 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long long llrint(double) throw(); extern "C" long long __llrint(double) throw();
# 331 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long lround(double) throw(); extern "C" long __lround(double) throw();
# 332 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long long llround(double) throw(); extern "C" long long __llround(double) throw();
# 336 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fdim(double, double) throw(); extern "C" double __fdim(double, double) throw();
# 339 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fmax(double, double) throw(); extern "C" double __fmax(double, double) throw();
# 342 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fmin(double, double) throw(); extern "C" double __fmin(double, double) throw();
# 346 "/usr/include/bits/mathcalls.h" 3
extern "C" int __fpclassify(double) throw() __attribute__((__const__));
# 350 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __signbit(double) throw() __attribute__((__const__));
# 355 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) double fma(double, double, double) throw(); extern "C" double __fma(double, double, double) throw();
# 364 "/usr/include/bits/mathcalls.h" 3
extern "C" double scalb(double, double) throw(); extern "C" double __scalb(double, double) throw();
# 55 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float acosf(float) throw(); extern "C" float __acosf(float) throw();
# 57 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float asinf(float) throw(); extern "C" float __asinf(float) throw();
# 59 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float atanf(float) throw(); extern "C" float __atanf(float) throw();
# 61 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float atan2f(float, float) throw(); extern "C" float __atan2f(float, float) throw();
# 64 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float cosf(float) throw();
# 66 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float sinf(float) throw();
# 68 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float tanf(float) throw();
# 73 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float coshf(float) throw(); extern "C" float __coshf(float) throw();
# 75 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float sinhf(float) throw(); extern "C" float __sinhf(float) throw();
# 77 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float tanhf(float) throw(); extern "C" float __tanhf(float) throw();
# 82 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) void sincosf(float, float *, float *) throw();
# 89 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float acoshf(float) throw(); extern "C" float __acoshf(float) throw();
# 91 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float asinhf(float) throw(); extern "C" float __asinhf(float) throw();
# 93 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float atanhf(float) throw(); extern "C" float __atanhf(float) throw();
# 101 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float expf(float) throw();
# 104 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float frexpf(float, int *) throw(); extern "C" float __frexpf(float, int *) throw();
# 107 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float ldexpf(float, int) throw(); extern "C" float __ldexpf(float, int) throw();
# 110 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float logf(float) throw();
# 113 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float log10f(float) throw();
# 116 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float modff(float, float *) throw(); extern "C" float __modff(float, float *) throw();
# 121 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float exp10f(float) throw();
# 123 "/usr/include/bits/mathcalls.h" 3
extern "C" float pow10f(float) throw(); extern "C" float __pow10f(float) throw();
# 129 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float expm1f(float) throw(); extern "C" float __expm1f(float) throw();
# 132 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float log1pf(float) throw(); extern "C" float __log1pf(float) throw();
# 135 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float logbf(float) throw(); extern "C" float __logbf(float) throw();
# 142 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float exp2f(float) throw(); extern "C" float __exp2f(float) throw();
# 145 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float log2f(float) throw();
# 154 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float powf(float, float) throw();
# 157 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float sqrtf(float) throw(); extern "C" float __sqrtf(float) throw();
# 163 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float hypotf(float, float) throw(); extern "C" float __hypotf(float, float) throw();
# 170 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float cbrtf(float) throw(); extern "C" float __cbrtf(float) throw();
# 179 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float ceilf(float) throw() __attribute__((__const__)); extern "C" float __ceilf(float) throw() __attribute__((__const__));
# 182 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fabsf(float) throw() __attribute__((__const__)); extern "C" float __fabsf(float) throw() __attribute__((__const__));
# 185 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float floorf(float) throw() __attribute__((__const__)); extern "C" float __floorf(float) throw() __attribute__((__const__));
# 188 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fmodf(float, float) throw(); extern "C" float __fmodf(float, float) throw();
# 193 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isinff(float) throw() __attribute__((__const__));
# 196 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __finitef(float) throw() __attribute__((__const__));
# 202 "/usr/include/bits/mathcalls.h" 3
extern "C" int isinff(float) throw() __attribute__((__const__));
# 205 "/usr/include/bits/mathcalls.h" 3
extern "C" int finitef(float) throw() __attribute__((__const__));
# 208 "/usr/include/bits/mathcalls.h" 3
extern "C" float dremf(float, float) throw(); extern "C" float __dremf(float, float) throw();
# 212 "/usr/include/bits/mathcalls.h" 3
extern "C" float significandf(float) throw(); extern "C" float __significandf(float) throw();
# 218 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float copysignf(float, float) throw() __attribute__((__const__)); extern "C" float __copysignf(float, float) throw() __attribute__((__const__));
# 225 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float nanf(const char *) throw() __attribute__((__const__)); extern "C" float __nanf(const char *) throw() __attribute__((__const__));
# 231 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isnanf(float) throw() __attribute__((__const__));
# 235 "/usr/include/bits/mathcalls.h" 3
extern "C" int isnanf(float) throw() __attribute__((__const__));
# 238 "/usr/include/bits/mathcalls.h" 3
extern "C" float j0f(float) throw(); extern "C" float __j0f(float) throw();
# 239 "/usr/include/bits/mathcalls.h" 3
extern "C" float j1f(float) throw(); extern "C" float __j1f(float) throw();
# 240 "/usr/include/bits/mathcalls.h" 3
extern "C" float jnf(int, float) throw(); extern "C" float __jnf(int, float) throw();
# 241 "/usr/include/bits/mathcalls.h" 3
extern "C" float y0f(float) throw(); extern "C" float __y0f(float) throw();
# 242 "/usr/include/bits/mathcalls.h" 3
extern "C" float y1f(float) throw(); extern "C" float __y1f(float) throw();
# 243 "/usr/include/bits/mathcalls.h" 3
extern "C" float ynf(int, float) throw(); extern "C" float __ynf(int, float) throw();
# 250 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float erff(float) throw(); extern "C" float __erff(float) throw();
# 251 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float erfcf(float) throw(); extern "C" float __erfcf(float) throw();
# 252 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float lgammaf(float) throw(); extern "C" float __lgammaf(float) throw();
# 259 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float tgammaf(float) throw(); extern "C" float __tgammaf(float) throw();
# 265 "/usr/include/bits/mathcalls.h" 3
extern "C" float gammaf(float) throw(); extern "C" float __gammaf(float) throw();
# 272 "/usr/include/bits/mathcalls.h" 3
extern "C" float lgammaf_r(float, int *) throw(); extern "C" float __lgammaf_r(float, int *) throw();
# 280 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float rintf(float) throw(); extern "C" float __rintf(float) throw();
# 283 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float nextafterf(float, float) throw() __attribute__((__const__)); extern "C" float __nextafterf(float, float) throw() __attribute__((__const__));
# 285 "/usr/include/bits/mathcalls.h" 3
extern "C" float nexttowardf(float, long double) throw() __attribute__((__const__)); extern "C" float __nexttowardf(float, long double) throw() __attribute__((__const__));
# 289 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float remainderf(float, float) throw(); extern "C" float __remainderf(float, float) throw();
# 293 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float scalbnf(float, int) throw(); extern "C" float __scalbnf(float, int) throw();
# 297 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int ilogbf(float) throw(); extern "C" int __ilogbf(float) throw();
# 302 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float scalblnf(float, long) throw(); extern "C" float __scalblnf(float, long) throw();
# 306 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float nearbyintf(float) throw(); extern "C" float __nearbyintf(float) throw();
# 310 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float roundf(float) throw() __attribute__((__const__)); extern "C" float __roundf(float) throw() __attribute__((__const__));
# 314 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float truncf(float) throw() __attribute__((__const__)); extern "C" float __truncf(float) throw() __attribute__((__const__));
# 319 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float remquof(float, float, int *) throw(); extern "C" float __remquof(float, float, int *) throw();
# 326 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long lrintf(float) throw(); extern "C" long __lrintf(float) throw();
# 327 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long long llrintf(float) throw(); extern "C" long long __llrintf(float) throw();
# 331 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long lroundf(float) throw(); extern "C" long __lroundf(float) throw();
# 332 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) long long llroundf(float) throw(); extern "C" long long __llroundf(float) throw();
# 336 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fdimf(float, float) throw(); extern "C" float __fdimf(float, float) throw();
# 339 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fmaxf(float, float) throw(); extern "C" float __fmaxf(float, float) throw();
# 342 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fminf(float, float) throw(); extern "C" float __fminf(float, float) throw();
# 346 "/usr/include/bits/mathcalls.h" 3
extern "C" int __fpclassifyf(float) throw() __attribute__((__const__));
# 350 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __signbitf(float) throw() __attribute__((__const__));
# 355 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) float fmaf(float, float, float) throw(); extern "C" float __fmaf(float, float, float) throw();
# 364 "/usr/include/bits/mathcalls.h" 3
extern "C" float scalbf(float, float) throw(); extern "C" float __scalbf(float, float) throw();
# 55 "/usr/include/bits/mathcalls.h" 3
extern "C" long double acosl(long double) throw(); extern "C" long double __acosl(long double) throw();
# 57 "/usr/include/bits/mathcalls.h" 3
extern "C" long double asinl(long double) throw(); extern "C" long double __asinl(long double) throw();
# 59 "/usr/include/bits/mathcalls.h" 3
extern "C" long double atanl(long double) throw(); extern "C" long double __atanl(long double) throw();
# 61 "/usr/include/bits/mathcalls.h" 3
extern "C" long double atan2l(long double, long double) throw(); extern "C" long double __atan2l(long double, long double) throw();
# 64 "/usr/include/bits/mathcalls.h" 3
extern "C" long double cosl(long double) throw(); extern "C" long double __cosl(long double) throw();
# 66 "/usr/include/bits/mathcalls.h" 3
extern "C" long double sinl(long double) throw(); extern "C" long double __sinl(long double) throw();
# 68 "/usr/include/bits/mathcalls.h" 3
extern "C" long double tanl(long double) throw(); extern "C" long double __tanl(long double) throw();
# 73 "/usr/include/bits/mathcalls.h" 3
extern "C" long double coshl(long double) throw(); extern "C" long double __coshl(long double) throw();
# 75 "/usr/include/bits/mathcalls.h" 3
extern "C" long double sinhl(long double) throw(); extern "C" long double __sinhl(long double) throw();
# 77 "/usr/include/bits/mathcalls.h" 3
extern "C" long double tanhl(long double) throw(); extern "C" long double __tanhl(long double) throw();
# 82 "/usr/include/bits/mathcalls.h" 3
extern "C" void sincosl(long double, long double *, long double *) throw(); extern "C" void __sincosl(long double, long double *, long double *) throw();
# 89 "/usr/include/bits/mathcalls.h" 3
extern "C" long double acoshl(long double) throw(); extern "C" long double __acoshl(long double) throw();
# 91 "/usr/include/bits/mathcalls.h" 3
extern "C" long double asinhl(long double) throw(); extern "C" long double __asinhl(long double) throw();
# 93 "/usr/include/bits/mathcalls.h" 3
extern "C" long double atanhl(long double) throw(); extern "C" long double __atanhl(long double) throw();
# 101 "/usr/include/bits/mathcalls.h" 3
extern "C" long double expl(long double) throw(); extern "C" long double __expl(long double) throw();
# 104 "/usr/include/bits/mathcalls.h" 3
extern "C" long double frexpl(long double, int *) throw(); extern "C" long double __frexpl(long double, int *) throw();
# 107 "/usr/include/bits/mathcalls.h" 3
extern "C" long double ldexpl(long double, int) throw(); extern "C" long double __ldexpl(long double, int) throw();
# 110 "/usr/include/bits/mathcalls.h" 3
extern "C" long double logl(long double) throw(); extern "C" long double __logl(long double) throw();
# 113 "/usr/include/bits/mathcalls.h" 3
extern "C" long double log10l(long double) throw(); extern "C" long double __log10l(long double) throw();
# 116 "/usr/include/bits/mathcalls.h" 3
extern "C" long double modfl(long double, long double *) throw(); extern "C" long double __modfl(long double, long double *) throw();
# 121 "/usr/include/bits/mathcalls.h" 3
extern "C" long double exp10l(long double) throw(); extern "C" long double __exp10l(long double) throw();
# 123 "/usr/include/bits/mathcalls.h" 3
extern "C" long double pow10l(long double) throw(); extern "C" long double __pow10l(long double) throw();
# 129 "/usr/include/bits/mathcalls.h" 3
extern "C" long double expm1l(long double) throw(); extern "C" long double __expm1l(long double) throw();
# 132 "/usr/include/bits/mathcalls.h" 3
extern "C" long double log1pl(long double) throw(); extern "C" long double __log1pl(long double) throw();
# 135 "/usr/include/bits/mathcalls.h" 3
extern "C" long double logbl(long double) throw(); extern "C" long double __logbl(long double) throw();
# 142 "/usr/include/bits/mathcalls.h" 3
extern "C" long double exp2l(long double) throw(); extern "C" long double __exp2l(long double) throw();
# 145 "/usr/include/bits/mathcalls.h" 3
extern "C" long double log2l(long double) throw(); extern "C" long double __log2l(long double) throw();
# 154 "/usr/include/bits/mathcalls.h" 3
extern "C" long double powl(long double, long double) throw(); extern "C" long double __powl(long double, long double) throw();
# 157 "/usr/include/bits/mathcalls.h" 3
extern "C" long double sqrtl(long double) throw(); extern "C" long double __sqrtl(long double) throw();
# 163 "/usr/include/bits/mathcalls.h" 3
extern "C" long double hypotl(long double, long double) throw(); extern "C" long double __hypotl(long double, long double) throw();
# 170 "/usr/include/bits/mathcalls.h" 3
extern "C" long double cbrtl(long double) throw(); extern "C" long double __cbrtl(long double) throw();
# 179 "/usr/include/bits/mathcalls.h" 3
extern "C" long double ceill(long double) throw() __attribute__((__const__)); extern "C" long double __ceill(long double) throw() __attribute__((__const__));
# 182 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fabsl(long double) throw() __attribute__((__const__)); extern "C" long double __fabsl(long double) throw() __attribute__((__const__));
# 185 "/usr/include/bits/mathcalls.h" 3
extern "C" long double floorl(long double) throw() __attribute__((__const__)); extern "C" long double __floorl(long double) throw() __attribute__((__const__));
# 188 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fmodl(long double, long double) throw(); extern "C" long double __fmodl(long double, long double) throw();
# 193 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isinfl(long double) throw() __attribute__((__const__));
# 196 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __finitel(long double) throw() __attribute__((__const__));
# 202 "/usr/include/bits/mathcalls.h" 3
extern "C" int isinfl(long double) throw() __attribute__((__const__));
# 205 "/usr/include/bits/mathcalls.h" 3
extern "C" int finitel(long double) throw() __attribute__((__const__));
# 208 "/usr/include/bits/mathcalls.h" 3
extern "C" long double dreml(long double, long double) throw(); extern "C" long double __dreml(long double, long double) throw();
# 212 "/usr/include/bits/mathcalls.h" 3
extern "C" long double significandl(long double) throw(); extern "C" long double __significandl(long double) throw();
# 218 "/usr/include/bits/mathcalls.h" 3
extern "C" long double copysignl(long double, long double) throw() __attribute__((__const__)); extern "C" long double __copysignl(long double, long double) throw() __attribute__((__const__));
# 225 "/usr/include/bits/mathcalls.h" 3
extern "C" long double nanl(const char *) throw() __attribute__((__const__)); extern "C" long double __nanl(const char *) throw() __attribute__((__const__));
# 231 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __isnanl(long double) throw() __attribute__((__const__));
# 235 "/usr/include/bits/mathcalls.h" 3
extern "C" int isnanl(long double) throw() __attribute__((__const__));
# 238 "/usr/include/bits/mathcalls.h" 3
extern "C" long double j0l(long double) throw(); extern "C" long double __j0l(long double) throw();
# 239 "/usr/include/bits/mathcalls.h" 3
extern "C" long double j1l(long double) throw(); extern "C" long double __j1l(long double) throw();
# 240 "/usr/include/bits/mathcalls.h" 3
extern "C" long double jnl(int, long double) throw(); extern "C" long double __jnl(int, long double) throw();
# 241 "/usr/include/bits/mathcalls.h" 3
extern "C" long double y0l(long double) throw(); extern "C" long double __y0l(long double) throw();
# 242 "/usr/include/bits/mathcalls.h" 3
extern "C" long double y1l(long double) throw(); extern "C" long double __y1l(long double) throw();
# 243 "/usr/include/bits/mathcalls.h" 3
extern "C" long double ynl(int, long double) throw(); extern "C" long double __ynl(int, long double) throw();
# 250 "/usr/include/bits/mathcalls.h" 3
extern "C" long double erfl(long double) throw(); extern "C" long double __erfl(long double) throw();
# 251 "/usr/include/bits/mathcalls.h" 3
extern "C" long double erfcl(long double) throw(); extern "C" long double __erfcl(long double) throw();
# 252 "/usr/include/bits/mathcalls.h" 3
extern "C" long double lgammal(long double) throw(); extern "C" long double __lgammal(long double) throw();
# 259 "/usr/include/bits/mathcalls.h" 3
extern "C" long double tgammal(long double) throw(); extern "C" long double __tgammal(long double) throw();
# 265 "/usr/include/bits/mathcalls.h" 3
extern "C" long double gammal(long double) throw(); extern "C" long double __gammal(long double) throw();
# 272 "/usr/include/bits/mathcalls.h" 3
extern "C" long double lgammal_r(long double, int *) throw(); extern "C" long double __lgammal_r(long double, int *) throw();
# 280 "/usr/include/bits/mathcalls.h" 3
extern "C" long double rintl(long double) throw(); extern "C" long double __rintl(long double) throw();
# 283 "/usr/include/bits/mathcalls.h" 3
extern "C" long double nextafterl(long double, long double) throw() __attribute__((__const__)); extern "C" long double __nextafterl(long double, long double) throw() __attribute__((__const__));
# 285 "/usr/include/bits/mathcalls.h" 3
extern "C" long double nexttowardl(long double, long double) throw() __attribute__((__const__)); extern "C" long double __nexttowardl(long double, long double) throw() __attribute__((__const__));
# 289 "/usr/include/bits/mathcalls.h" 3
extern "C" long double remainderl(long double, long double) throw(); extern "C" long double __remainderl(long double, long double) throw();
# 293 "/usr/include/bits/mathcalls.h" 3
extern "C" long double scalbnl(long double, int) throw(); extern "C" long double __scalbnl(long double, int) throw();
# 297 "/usr/include/bits/mathcalls.h" 3
extern "C" int ilogbl(long double) throw(); extern "C" int __ilogbl(long double) throw();
# 302 "/usr/include/bits/mathcalls.h" 3
extern "C" long double scalblnl(long double, long) throw(); extern "C" long double __scalblnl(long double, long) throw();
# 306 "/usr/include/bits/mathcalls.h" 3
extern "C" long double nearbyintl(long double) throw(); extern "C" long double __nearbyintl(long double) throw();
# 310 "/usr/include/bits/mathcalls.h" 3
extern "C" long double roundl(long double) throw() __attribute__((__const__)); extern "C" long double __roundl(long double) throw() __attribute__((__const__));
# 314 "/usr/include/bits/mathcalls.h" 3
extern "C" long double truncl(long double) throw() __attribute__((__const__)); extern "C" long double __truncl(long double) throw() __attribute__((__const__));
# 319 "/usr/include/bits/mathcalls.h" 3
extern "C" long double remquol(long double, long double, int *) throw(); extern "C" long double __remquol(long double, long double, int *) throw();
# 326 "/usr/include/bits/mathcalls.h" 3
extern "C" long lrintl(long double) throw(); extern "C" long __lrintl(long double) throw();
# 327 "/usr/include/bits/mathcalls.h" 3
extern "C" long long llrintl(long double) throw(); extern "C" long long __llrintl(long double) throw();
# 331 "/usr/include/bits/mathcalls.h" 3
extern "C" long lroundl(long double) throw(); extern "C" long __lroundl(long double) throw();
# 332 "/usr/include/bits/mathcalls.h" 3
extern "C" long long llroundl(long double) throw(); extern "C" long long __llroundl(long double) throw();
# 336 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fdiml(long double, long double) throw(); extern "C" long double __fdiml(long double, long double) throw();
# 339 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fmaxl(long double, long double) throw(); extern "C" long double __fmaxl(long double, long double) throw();
# 342 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fminl(long double, long double) throw(); extern "C" long double __fminl(long double, long double) throw();
# 346 "/usr/include/bits/mathcalls.h" 3
extern "C" int __fpclassifyl(long double) throw() __attribute__((__const__));
# 350 "/usr/include/bits/mathcalls.h" 3
extern "C" __attribute__((weak)) int __signbitl(long double) throw() __attribute__((__const__));
# 355 "/usr/include/bits/mathcalls.h" 3
extern "C" long double fmal(long double, long double, long double) throw(); extern "C" long double __fmal(long double, long double, long double) throw();
# 364 "/usr/include/bits/mathcalls.h" 3
extern "C" long double scalbl(long double, long double) throw(); extern "C" long double __scalbl(long double, long double) throw();
# 161 "/usr/include/math.h" 3
extern "C" { extern int signgam; }
# 203 "/usr/include/math.h" 3
enum {
# 204 "/usr/include/math.h" 3
FP_NAN,
# 206 "/usr/include/math.h" 3
FP_INFINITE,
# 208 "/usr/include/math.h" 3
FP_ZERO,
# 210 "/usr/include/math.h" 3
FP_SUBNORMAL,
# 212 "/usr/include/math.h" 3
FP_NORMAL
# 214 "/usr/include/math.h" 3
};
# 302 "/usr/include/math.h" 3
extern "C" { typedef
# 296 "/usr/include/math.h" 3
enum {
# 297 "/usr/include/math.h" 3
_IEEE_ = (-1),
# 298 "/usr/include/math.h" 3
_SVID_ = 0,
# 299 "/usr/include/math.h" 3
_XOPEN_,
# 300 "/usr/include/math.h" 3
_POSIX_,
# 301 "/usr/include/math.h" 3
_ISOC_
# 302 "/usr/include/math.h" 3
} _LIB_VERSION_TYPE; }
# 307 "/usr/include/math.h" 3
extern "C" { extern _LIB_VERSION_TYPE _LIB_VERSION; }
# 318 "/usr/include/math.h" 3
extern "C" { struct __exception {
# 323 "/usr/include/math.h" 3
int type;
# 324 "/usr/include/math.h" 3
char *name;
# 325 "/usr/include/math.h" 3
double arg1;
# 326 "/usr/include/math.h" 3
double arg2;
# 327 "/usr/include/math.h" 3
double retval;
# 328 "/usr/include/math.h" 3
}; }
# 331 "/usr/include/math.h" 3
extern "C" int matherr(__exception *) throw();
# 67 "/usr/include/bits/waitstatus.h" 3
extern "C" { union wait {
# 69 "/usr/include/bits/waitstatus.h" 3
int w_status;
# 71 "/usr/include/bits/waitstatus.h" 3
struct {
# 73 "/usr/include/bits/waitstatus.h" 3
unsigned __w_termsig:7;
# 74 "/usr/include/bits/waitstatus.h" 3
unsigned __w_coredump:1;
# 75 "/usr/include/bits/waitstatus.h" 3
unsigned __w_retcode:8;
# 76 "/usr/include/bits/waitstatus.h" 3
unsigned:16;
# 84 "/usr/include/bits/waitstatus.h" 3
} __wait_terminated;
# 86 "/usr/include/bits/waitstatus.h" 3
struct {
# 88 "/usr/include/bits/waitstatus.h" 3
unsigned __w_stopval:8;
# 89 "/usr/include/bits/waitstatus.h" 3
unsigned __w_stopsig:8;
# 90 "/usr/include/bits/waitstatus.h" 3
unsigned:16;
# 97 "/usr/include/bits/waitstatus.h" 3
} __wait_stopped;
# 98 "/usr/include/bits/waitstatus.h" 3
}; }
# 102 "/usr/include/stdlib.h" 3
extern "C" { typedef
# 99 "/usr/include/stdlib.h" 3
struct {
# 100 "/usr/include/stdlib.h" 3
int quot;
# 101 "/usr/include/stdlib.h" 3
int rem;
# 102 "/usr/include/stdlib.h" 3
} div_t; }
# 110 "/usr/include/stdlib.h" 3
extern "C" { typedef
# 107 "/usr/include/stdlib.h" 3
struct {
# 108 "/usr/include/stdlib.h" 3
long quot;
# 109 "/usr/include/stdlib.h" 3
long rem;
# 110 "/usr/include/stdlib.h" 3
} ldiv_t; }
# 122 "/usr/include/stdlib.h" 3
extern "C" { typedef
# 119 "/usr/include/stdlib.h" 3
struct {
# 120 "/usr/include/stdlib.h" 3
long long quot;
# 121 "/usr/include/stdlib.h" 3
long long rem;
# 122 "/usr/include/stdlib.h" 3
} lldiv_t; }
# 140 "/usr/include/stdlib.h" 3
extern "C" size_t __ctype_get_mb_cur_max() throw();
# 145 "/usr/include/stdlib.h" 3
extern "C" double atof(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 148 "/usr/include/stdlib.h" 3
extern "C" int atoi(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 151 "/usr/include/stdlib.h" 3
extern "C" long atol(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 158 "/usr/include/stdlib.h" 3
extern "C" long long atoll(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 165 "/usr/include/stdlib.h" 3
extern "C" double strtod(const char *__restrict__, char **__restrict__) throw() __attribute__((nonnull(1)));
# 173 "/usr/include/stdlib.h" 3
extern "C" float strtof(const char *__restrict__, char **__restrict__) throw() __attribute__((nonnull(1)));
# 176 "/usr/include/stdlib.h" 3
extern "C" long double strtold(const char *__restrict__, char **__restrict__) throw() __attribute__((nonnull(1)));
# 184 "/usr/include/stdlib.h" 3
extern "C" long strtol(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 188 "/usr/include/stdlib.h" 3
extern "C" unsigned long strtoul(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 196 "/usr/include/stdlib.h" 3
extern "C" long long strtoq(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 201 "/usr/include/stdlib.h" 3
extern "C" unsigned long long strtouq(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 210 "/usr/include/stdlib.h" 3
extern "C" long long strtoll(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 215 "/usr/include/stdlib.h" 3
extern "C" unsigned long long strtoull(const char *__restrict__, char **__restrict__, int) throw() __attribute__((nonnull(1)));
# 240 "/usr/include/stdlib.h" 3
extern "C" long strtol_l(const char *__restrict__, char **__restrict__, int, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 244 "/usr/include/stdlib.h" 3
extern "C" unsigned long strtoul_l(const char *__restrict__, char **__restrict__, int, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 250 "/usr/include/stdlib.h" 3
extern "C" long long strtoll_l(const char *__restrict__, char **__restrict__, int, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 256 "/usr/include/stdlib.h" 3
extern "C" unsigned long long strtoull_l(const char *__restrict__, char **__restrict__, int, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 261 "/usr/include/stdlib.h" 3
extern "C" double strtod_l(const char *__restrict__, char **__restrict__, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(3)));
# 265 "/usr/include/stdlib.h" 3
extern "C" float strtof_l(const char *__restrict__, char **__restrict__, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(3)));
# 269 "/usr/include/stdlib.h" 3
extern "C" long double strtold_l(const char *__restrict__, char **__restrict__, __locale_t) throw() __attribute__((nonnull(1))) __attribute__((nonnull(3)));
# 311 "/usr/include/stdlib.h" 3
extern "C" char *l64a(long) throw();
# 314 "/usr/include/stdlib.h" 3
extern "C" long a64l(const char *) throw() __attribute__((__pure__)) __attribute__((nonnull(1)));
# 34 "/usr/include/sys/types.h" 3
extern "C" { typedef __u_char u_char; }
# 35 "/usr/include/sys/types.h" 3
extern "C" { typedef __u_short u_short; }
# 36 "/usr/include/sys/types.h" 3
extern "C" { typedef __u_int u_int; }
# 37 "/usr/include/sys/types.h" 3
extern "C" { typedef __u_long u_long; }
# 38 "/usr/include/sys/types.h" 3
extern "C" { typedef __quad_t quad_t; }
# 39 "/usr/include/sys/types.h" 3
extern "C" { typedef __u_quad_t u_quad_t; }
# 40 "/usr/include/sys/types.h" 3
extern "C" { typedef __fsid_t fsid_t; }
# 45 "/usr/include/sys/types.h" 3
extern "C" { typedef __loff_t loff_t; }
# 49 "/usr/include/sys/types.h" 3
extern "C" { typedef __ino_t ino_t; }
# 56 "/usr/include/sys/types.h" 3
extern "C" { typedef __ino64_t ino64_t; }
# 61 "/usr/include/sys/types.h" 3
extern "C" { typedef __dev_t dev_t; }
# 66 "/usr/include/sys/types.h" 3
extern "C" { typedef __gid_t gid_t; }
# 71 "/usr/include/sys/types.h" 3
extern "C" { typedef __mode_t mode_t; }
# 76 "/usr/include/sys/types.h" 3
extern "C" { typedef __nlink_t nlink_t; }
# 81 "/usr/include/sys/types.h" 3
extern "C" { typedef __uid_t uid_t; }
# 87 "/usr/include/sys/types.h" 3
extern "C" { typedef __off_t off_t; }
# 94 "/usr/include/sys/types.h" 3
extern "C" { typedef __off64_t off64_t; }
# 105 "/usr/include/sys/types.h" 3
extern "C" { typedef __id_t id_t; }
# 110 "/usr/include/sys/types.h" 3
extern "C" { typedef __ssize_t ssize_t; }
# 116 "/usr/include/sys/types.h" 3
extern "C" { typedef __daddr_t daddr_t; }
# 117 "/usr/include/sys/types.h" 3
extern "C" { typedef __caddr_t caddr_t; }
# 123 "/usr/include/sys/types.h" 3
extern "C" { typedef __key_t key_t; }
# 137 "/usr/include/sys/types.h" 3
extern "C" { typedef __useconds_t useconds_t; }
# 141 "/usr/include/sys/types.h" 3
extern "C" { typedef __suseconds_t suseconds_t; }
# 151 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned long ulong; }
# 152 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned short ushort; }
# 153 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned uint; }
# 195 "/usr/include/sys/types.h" 3
extern "C" { typedef signed char int8_t; }
# 196 "/usr/include/sys/types.h" 3
extern "C" { typedef short int16_t; }
# 197 "/usr/include/sys/types.h" 3
extern "C" { typedef int int32_t; }
# 198 "/usr/include/sys/types.h" 3
extern "C" { typedef long int64_t; }
# 201 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned char u_int8_t; }
# 202 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned short u_int16_t; }
# 203 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned u_int32_t; }
# 204 "/usr/include/sys/types.h" 3
extern "C" { typedef unsigned long u_int64_t; }
# 206 "/usr/include/sys/types.h" 3
extern "C" { typedef int register_t; }
# 24 "/usr/include/bits/sigset.h" 3
extern "C" { typedef int __sig_atomic_t; }
# 32 "/usr/include/bits/sigset.h" 3
extern "C" { typedef
# 30 "/usr/include/bits/sigset.h" 3
struct {
# 31 "/usr/include/bits/sigset.h" 3
unsigned long __val[((1024) / ((8) * sizeof(unsigned long)))];
# 32 "/usr/include/bits/sigset.h" 3
} __sigset_t; }
# 38 "/usr/include/sys/select.h" 3
extern "C" { typedef __sigset_t sigset_t; }
# 75 "/usr/include/bits/time.h" 3
extern "C" { struct timeval {
# 77 "/usr/include/bits/time.h" 3
__time_t tv_sec;
# 78 "/usr/include/bits/time.h" 3
__suseconds_t tv_usec;
# 79 "/usr/include/bits/time.h" 3
}; }
# 55 "/usr/include/sys/select.h" 3
extern "C" { typedef long __fd_mask; }
# 78 "/usr/include/sys/select.h" 3
extern "C" { typedef
# 68 "/usr/include/sys/select.h" 3
struct {
# 72 "/usr/include/sys/select.h" 3
__fd_mask fds_bits[(1024 / (8 * ((int)sizeof(__fd_mask))))];
# 78 "/usr/include/sys/select.h" 3
} fd_set; }
# 85 "/usr/include/sys/select.h" 3
extern "C" { typedef __fd_mask fd_mask; }
# 109 "/usr/include/sys/select.h" 3
extern "C" int select(int, fd_set *__restrict__, fd_set *__restrict__, fd_set *__restrict__, timeval *__restrict__);
# 121 "/usr/include/sys/select.h" 3
extern "C" int pselect(int, fd_set *__restrict__, fd_set *__restrict__, fd_set *__restrict__, const timespec *__restrict__, const __sigset_t *__restrict__);
# 31 "/usr/include/sys/sysmacros.h" 3
extern "C" unsigned gnu_dev_major(unsigned long long) throw();
# 34 "/usr/include/sys/sysmacros.h" 3
extern "C" unsigned gnu_dev_minor(unsigned long long) throw();
# 37 "/usr/include/sys/sysmacros.h" 3
extern "C" unsigned long long gnu_dev_makedev(unsigned, unsigned) throw();
# 229 "/usr/include/sys/types.h" 3
extern "C" { typedef __blksize_t blksize_t; }
# 236 "/usr/include/sys/types.h" 3
extern "C" { typedef __blkcnt_t blkcnt_t; }
# 240 "/usr/include/sys/types.h" 3
extern "C" { typedef __fsblkcnt_t fsblkcnt_t; }
# 244 "/usr/include/sys/types.h" 3
extern "C" { typedef __fsfilcnt_t fsfilcnt_t; }
# 263 "/usr/include/sys/types.h" 3
extern "C" { typedef __blkcnt64_t blkcnt64_t; }
# 264 "/usr/include/sys/types.h" 3
extern "C" { typedef __fsblkcnt64_t fsblkcnt64_t; }
# 265 "/usr/include/sys/types.h" 3
extern "C" { typedef __fsfilcnt64_t fsfilcnt64_t; }
# 50 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef unsigned long pthread_t; }
# 57 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 54 "/usr/include/bits/pthreadtypes.h" 3
union {
# 55 "/usr/include/bits/pthreadtypes.h" 3
char __size[56];
# 56 "/usr/include/bits/pthreadtypes.h" 3
long __align;
# 57 "/usr/include/bits/pthreadtypes.h" 3
} pthread_attr_t; }
# 65 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 61 "/usr/include/bits/pthreadtypes.h" 3
struct __pthread_internal_list {
# 63 "/usr/include/bits/pthreadtypes.h" 3
__pthread_internal_list *__prev;
# 64 "/usr/include/bits/pthreadtypes.h" 3
__pthread_internal_list *__next;
# 65 "/usr/include/bits/pthreadtypes.h" 3
} __pthread_list_t; }
# 104 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 77 "/usr/include/bits/pthreadtypes.h" 3
union {
# 78 "/usr/include/bits/pthreadtypes.h" 3
struct __pthread_mutex_s {
# 80 "/usr/include/bits/pthreadtypes.h" 3
int __lock;
# 81 "/usr/include/bits/pthreadtypes.h" 3
unsigned __count;
# 82 "/usr/include/bits/pthreadtypes.h" 3
int __owner;
# 84 "/usr/include/bits/pthreadtypes.h" 3
unsigned __nusers;
# 88 "/usr/include/bits/pthreadtypes.h" 3
int __kind;
# 90 "/usr/include/bits/pthreadtypes.h" 3
int __spins;
# 91 "/usr/include/bits/pthreadtypes.h" 3
__pthread_list_t __list;
# 101 "/usr/include/bits/pthreadtypes.h" 3
} __data;
# 102 "/usr/include/bits/pthreadtypes.h" 3
char __size[40];
# 103 "/usr/include/bits/pthreadtypes.h" 3
long __align;
# 104 "/usr/include/bits/pthreadtypes.h" 3
} pthread_mutex_t; }
# 110 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 107 "/usr/include/bits/pthreadtypes.h" 3
union {
# 108 "/usr/include/bits/pthreadtypes.h" 3
char __size[4];
# 109 "/usr/include/bits/pthreadtypes.h" 3
int __align;
# 110 "/usr/include/bits/pthreadtypes.h" 3
} pthread_mutexattr_t; }
# 130 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 116 "/usr/include/bits/pthreadtypes.h" 3
union {
# 118 "/usr/include/bits/pthreadtypes.h" 3
struct {
# 119 "/usr/include/bits/pthreadtypes.h" 3
int __lock;
# 120 "/usr/include/bits/pthreadtypes.h" 3
unsigned __futex;
# 121 "/usr/include/bits/pthreadtypes.h" 3
__extension__ unsigned long long __total_seq;
# 122 "/usr/include/bits/pthreadtypes.h" 3
__extension__ unsigned long long __wakeup_seq;
# 123 "/usr/include/bits/pthreadtypes.h" 3
__extension__ unsigned long long __woken_seq;
# 124 "/usr/include/bits/pthreadtypes.h" 3
void *__mutex;
# 125 "/usr/include/bits/pthreadtypes.h" 3
unsigned __nwaiters;
# 126 "/usr/include/bits/pthreadtypes.h" 3
unsigned __broadcast_seq;
# 127 "/usr/include/bits/pthreadtypes.h" 3
} __data;
# 128 "/usr/include/bits/pthreadtypes.h" 3
char __size[48];
# 129 "/usr/include/bits/pthreadtypes.h" 3
__extension__ long long __align;
# 130 "/usr/include/bits/pthreadtypes.h" 3
} pthread_cond_t; }
# 136 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 133 "/usr/include/bits/pthreadtypes.h" 3
union {
# 134 "/usr/include/bits/pthreadtypes.h" 3
char __size[4];
# 135 "/usr/include/bits/pthreadtypes.h" 3
int __align;
# 136 "/usr/include/bits/pthreadtypes.h" 3
} pthread_condattr_t; }
# 140 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef unsigned pthread_key_t; }
# 144 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef int pthread_once_t; }
# 189 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 151 "/usr/include/bits/pthreadtypes.h" 3
union {
# 154 "/usr/include/bits/pthreadtypes.h" 3
struct {
# 155 "/usr/include/bits/pthreadtypes.h" 3
int __lock;
# 156 "/usr/include/bits/pthreadtypes.h" 3
unsigned __nr_readers;
# 157 "/usr/include/bits/pthreadtypes.h" 3
unsigned __readers_wakeup;
# 158 "/usr/include/bits/pthreadtypes.h" 3
unsigned __writer_wakeup;
# 159 "/usr/include/bits/pthreadtypes.h" 3
unsigned __nr_readers_queued;
# 160 "/usr/include/bits/pthreadtypes.h" 3
unsigned __nr_writers_queued;
# 161 "/usr/include/bits/pthreadtypes.h" 3
int __writer;
# 162 "/usr/include/bits/pthreadtypes.h" 3
int __shared;
# 163 "/usr/include/bits/pthreadtypes.h" 3
unsigned long __pad1;
# 164 "/usr/include/bits/pthreadtypes.h" 3
unsigned long __pad2;
# 167 "/usr/include/bits/pthreadtypes.h" 3
unsigned __flags;
# 168 "/usr/include/bits/pthreadtypes.h" 3
} __data;
# 187 "/usr/include/bits/pthreadtypes.h" 3
char __size[56];
# 188 "/usr/include/bits/pthreadtypes.h" 3
long __align;
# 189 "/usr/include/bits/pthreadtypes.h" 3
} pthread_rwlock_t; }
# 195 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 192 "/usr/include/bits/pthreadtypes.h" 3
union {
# 193 "/usr/include/bits/pthreadtypes.h" 3
char __size[8];
# 194 "/usr/include/bits/pthreadtypes.h" 3
long __align;
# 195 "/usr/include/bits/pthreadtypes.h" 3
} pthread_rwlockattr_t; }
# 201 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef volatile int pthread_spinlock_t; }
# 210 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 207 "/usr/include/bits/pthreadtypes.h" 3
union {
# 208 "/usr/include/bits/pthreadtypes.h" 3
char __size[32];
# 209 "/usr/include/bits/pthreadtypes.h" 3
long __align;
# 210 "/usr/include/bits/pthreadtypes.h" 3
} pthread_barrier_t; }
# 216 "/usr/include/bits/pthreadtypes.h" 3
extern "C" { typedef
# 213 "/usr/include/bits/pthreadtypes.h" 3
union {
# 214 "/usr/include/bits/pthreadtypes.h" 3
char __size[4];
# 215 "/usr/include/bits/pthreadtypes.h" 3
int __align;
# 216 "/usr/include/bits/pthreadtypes.h" 3
} pthread_barrierattr_t; }
# 327 "/usr/include/stdlib.h" 3
extern "C" long random() throw();
# 330 "/usr/include/stdlib.h" 3
extern "C" void srandom(unsigned) throw();
# 336 "/usr/include/stdlib.h" 3
extern "C" char *initstate(unsigned, char *, size_t) throw() __attribute__((nonnull(2)));
# 341 "/usr/include/stdlib.h" 3
extern "C" char *setstate(char *) throw() __attribute__((nonnull(1)));
# 349 "/usr/include/stdlib.h" 3
extern "C" { struct random_data {
# 351 "/usr/include/stdlib.h" 3
int32_t *fptr;
# 352 "/usr/include/stdlib.h" 3
int32_t *rptr;
# 353 "/usr/include/stdlib.h" 3
int32_t *state;
# 354 "/usr/include/stdlib.h" 3
int rand_type;
# 355 "/usr/include/stdlib.h" 3
int rand_deg;
# 356 "/usr/include/stdlib.h" 3
int rand_sep;
# 357 "/usr/include/stdlib.h" 3
int32_t *end_ptr;
# 358 "/usr/include/stdlib.h" 3
}; }
# 360 "/usr/include/stdlib.h" 3
extern "C" int random_r(random_data *__restrict__, int32_t *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 363 "/usr/include/stdlib.h" 3
extern "C" int srandom_r(unsigned, random_data *) throw() __attribute__((nonnull(2)));
# 366 "/usr/include/stdlib.h" 3
extern "C" int initstate_r(unsigned, char *__restrict__, size_t, random_data *__restrict__) throw() __attribute__((nonnull(2))) __attribute__((nonnull(4)));
# 371 "/usr/include/stdlib.h" 3
extern "C" int setstate_r(char *__restrict__, random_data *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 380 "/usr/include/stdlib.h" 3
extern "C" int rand() throw();
# 382 "/usr/include/stdlib.h" 3
extern "C" void srand(unsigned) throw();
# 387 "/usr/include/stdlib.h" 3
extern "C" int rand_r(unsigned *) throw();
# 395 "/usr/include/stdlib.h" 3
extern "C" double drand48() throw();
# 396 "/usr/include/stdlib.h" 3
extern "C" double erand48(unsigned short [3]) throw() __attribute__((nonnull(1)));
# 399 "/usr/include/stdlib.h" 3
extern "C" long lrand48() throw();
# 400 "/usr/include/stdlib.h" 3
extern "C" long nrand48(unsigned short [3]) throw() __attribute__((nonnull(1)));
# 404 "/usr/include/stdlib.h" 3
extern "C" long mrand48() throw();
# 405 "/usr/include/stdlib.h" 3
extern "C" long jrand48(unsigned short [3]) throw() __attribute__((nonnull(1)));
# 409 "/usr/include/stdlib.h" 3
extern "C" void srand48(long) throw();
# 410 "/usr/include/stdlib.h" 3
extern "C" unsigned short *seed48(unsigned short [3]) throw() __attribute__((nonnull(1)));
# 412 "/usr/include/stdlib.h" 3
extern "C" void lcong48(unsigned short [7]) throw() __attribute__((nonnull(1)));
# 418 "/usr/include/stdlib.h" 3
extern "C" { struct drand48_data {
# 420 "/usr/include/stdlib.h" 3
unsigned short __x[3];
# 421 "/usr/include/stdlib.h" 3
unsigned short __old_x[3];
# 422 "/usr/include/stdlib.h" 3
unsigned short __c;
# 423 "/usr/include/stdlib.h" 3
unsigned short __init;
# 424 "/usr/include/stdlib.h" 3
unsigned long long __a;
# 425 "/usr/include/stdlib.h" 3
}; }
# 428 "/usr/include/stdlib.h" 3
extern "C" int drand48_r(drand48_data *__restrict__, double *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 430 "/usr/include/stdlib.h" 3
extern "C" int erand48_r(unsigned short [3], drand48_data *__restrict__, double *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 435 "/usr/include/stdlib.h" 3
extern "C" int lrand48_r(drand48_data *__restrict__, long *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 438 "/usr/include/stdlib.h" 3
extern "C" int nrand48_r(unsigned short [3], drand48_data *__restrict__, long *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 444 "/usr/include/stdlib.h" 3
extern "C" int mrand48_r(drand48_data *__restrict__, long *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 447 "/usr/include/stdlib.h" 3
extern "C" int jrand48_r(unsigned short [3], drand48_data *__restrict__, long *__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 453 "/usr/include/stdlib.h" 3
extern "C" int srand48_r(long, drand48_data *) throw() __attribute__((nonnull(2)));
# 456 "/usr/include/stdlib.h" 3
extern "C" int seed48_r(unsigned short [3], drand48_data *) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 459 "/usr/include/stdlib.h" 3
extern "C" int lcong48_r(unsigned short [7], drand48_data *) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2)));
# 471 "/usr/include/stdlib.h" 3
extern "C" void *malloc(size_t) throw() __attribute__((__malloc__));
# 473 "/usr/include/stdlib.h" 3
extern "C" void *calloc(size_t, size_t) throw() __attribute__((__malloc__));
# 485 "/usr/include/stdlib.h" 3
extern "C" void *realloc(void *, size_t) throw() __attribute__((__warn_unused_result__));
# 488 "/usr/include/stdlib.h" 3
extern "C" void free(void *) throw();
# 493 "/usr/include/stdlib.h" 3
extern "C" void cfree(void *) throw();
# 33 "/usr/include/alloca.h" 3
extern "C" void *alloca(size_t) throw();
# 503 "/usr/include/stdlib.h" 3
extern "C" void *valloc(size_t) throw() __attribute__((__malloc__));
# 508 "/usr/include/stdlib.h" 3
extern "C" int posix_memalign(void **, size_t, size_t) throw() __attribute__((nonnull(1)));
# 514 "/usr/include/stdlib.h" 3
extern "C" void abort() throw() __attribute__((__noreturn__));
# 518 "/usr/include/stdlib.h" 3
extern "C" int atexit(void (*)(void)) throw() __attribute__((nonnull(1)));
# 525 "/usr/include/stdlib.h" 3
int at_quick_exit(void (*)(void)) throw() __asm__("at_quick_exit") __attribute__((nonnull(1)));
# 536 "/usr/include/stdlib.h" 3
extern "C" int on_exit(void (*)(int, void *), void *) throw() __attribute__((nonnull(1)));
# 544 "/usr/include/stdlib.h" 3
extern "C" void exit(int) throw() __attribute__((__noreturn__));
# 552 "/usr/include/stdlib.h" 3
extern "C" void quick_exit(int) throw() __attribute__((__noreturn__));
# 560 "/usr/include/stdlib.h" 3
extern "C" void _Exit(int) throw() __attribute__((__noreturn__));
# 567 "/usr/include/stdlib.h" 3
extern "C" char *getenv(const char *) throw() __attribute__((nonnull(1)));
# 572 "/usr/include/stdlib.h" 3
extern "C" char *__secure_getenv(const char *) throw() __attribute__((nonnull(1)));
# 579 "/usr/include/stdlib.h" 3
extern "C" int putenv(char *) throw() __attribute__((nonnull(1)));
# 585 "/usr/include/stdlib.h" 3
extern "C" int setenv(const char *, const char *, int) throw() __attribute__((nonnull(2)));
# 589 "/usr/include/stdlib.h" 3
extern "C" int unsetenv(const char *) throw() __attribute__((nonnull(1)));
# 596 "/usr/include/stdlib.h" 3
extern "C" int clearenv() throw();
# 606 "/usr/include/stdlib.h" 3
extern "C" char *mktemp(char *) throw() __attribute__((nonnull(1)));
# 620 "/usr/include/stdlib.h" 3
extern "C" int mkstemp(char *) __attribute__((nonnull(1)));
# 630 "/usr/include/stdlib.h" 3
extern "C" int mkstemp64(char *) __attribute__((nonnull(1)));
# 642 "/usr/include/stdlib.h" 3
extern "C" int mkstemps(char *, int) __attribute__((nonnull(1)));
# 652 "/usr/include/stdlib.h" 3
extern "C" int mkstemps64(char *, int) __attribute__((nonnull(1)));
# 663 "/usr/include/stdlib.h" 3
extern "C" char *mkdtemp(char *) throw() __attribute__((nonnull(1)));
# 674 "/usr/include/stdlib.h" 3
extern "C" int mkostemp(char *, int) __attribute__((nonnull(1)));
# 684 "/usr/include/stdlib.h" 3
extern "C" int mkostemp64(char *, int) __attribute__((nonnull(1)));
# 694 "/usr/include/stdlib.h" 3
extern "C" int mkostemps(char *, int, int) __attribute__((nonnull(1)));
# 706 "/usr/include/stdlib.h" 3
extern "C" int mkostemps64(char *, int, int) __attribute__((nonnull(1)));
# 717 "/usr/include/stdlib.h" 3
extern "C" int system(const char *);
# 724 "/usr/include/stdlib.h" 3
extern "C" char *canonicalize_file_name(const char *) throw() __attribute__((nonnull(1)));
# 734 "/usr/include/stdlib.h" 3
extern "C" char *realpath(const char *__restrict__, char *__restrict__) throw();
# 742 "/usr/include/stdlib.h" 3
extern "C" { typedef int (*__compar_fn_t)(const void *, const void *); }
# 745 "/usr/include/stdlib.h" 3
extern "C" { typedef __compar_fn_t comparison_fn_t; }
# 749 "/usr/include/stdlib.h" 3
extern "C" { typedef int (*__compar_d_fn_t)(const void *, const void *, void *); }
# 755 "/usr/include/stdlib.h" 3
extern "C" void *bsearch(const void *, const void *, size_t, size_t, __compar_fn_t) __attribute__((nonnull(1))) __attribute__((nonnull(2))) __attribute__((nonnull(5)));
# 761 "/usr/include/stdlib.h" 3
extern "C" void qsort(void *, size_t, size_t, __compar_fn_t) __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 764 "/usr/include/stdlib.h" 3
extern "C" void qsort_r(void *, size_t, size_t, __compar_d_fn_t, void *) __attribute__((nonnull(1))) __attribute__((nonnull(4)));
# 771 "/usr/include/stdlib.h" 3
extern "C" __attribute__((weak)) int abs(int) throw() __attribute__((__const__));
# 772 "/usr/include/stdlib.h" 3
extern "C" __attribute__((weak)) long labs(long) throw() __attribute__((__const__));
# 776 "/usr/include/stdlib.h" 3
extern "C" __attribute__((weak)) long long llabs(long long) throw() __attribute__((__const__));
# 785 "/usr/include/stdlib.h" 3
extern "C" div_t div(int, int) throw() __attribute__((__const__));
# 787 "/usr/include/stdlib.h" 3
extern "C" ldiv_t ldiv(long, long) throw() __attribute__((__const__));
# 793 "/usr/include/stdlib.h" 3
extern "C" lldiv_t lldiv(long long, long long) throw() __attribute__((__const__));
# 808 "/usr/include/stdlib.h" 3
extern "C" char *ecvt(double, int, int *__restrict__, int *__restrict__) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4)));
# 814 "/usr/include/stdlib.h" 3
extern "C" char *fcvt(double, int, int *__restrict__, int *__restrict__) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4)));
# 820 "/usr/include/stdlib.h" 3
extern "C" char *gcvt(double, int, char *) throw() __attribute__((nonnull(3)));
# 826 "/usr/include/stdlib.h" 3
extern "C" char *qecvt(long double, int, int *__restrict__, int *__restrict__) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4)));
# 829 "/usr/include/stdlib.h" 3
extern "C" char *qfcvt(long double, int, int *__restrict__, int *__restrict__) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4)));
# 832 "/usr/include/stdlib.h" 3
extern "C" char *qgcvt(long double, int, char *) throw() __attribute__((nonnull(3)));
# 838 "/usr/include/stdlib.h" 3
extern "C" int ecvt_r(double, int, int *__restrict__, int *__restrict__, char *__restrict__, size_t) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4))) __attribute__((nonnull(5)));
# 841 "/usr/include/stdlib.h" 3
extern "C" int fcvt_r(double, int, int *__restrict__, int *__restrict__, char *__restrict__, size_t) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4))) __attribute__((nonnull(5)));
# 845 "/usr/include/stdlib.h" 3
extern "C" int qecvt_r(long double, int, int *__restrict__, int *__restrict__, char *__restrict__, size_t) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4))) __attribute__((nonnull(5)));
# 849 "/usr/include/stdlib.h" 3
extern "C" int qfcvt_r(long double, int, int *__restrict__, int *__restrict__, char *__restrict__, size_t) throw() __attribute__((nonnull(3))) __attribute__((nonnull(4))) __attribute__((nonnull(5)));
# 860 "/usr/include/stdlib.h" 3
extern "C" int mblen(const char *, size_t) throw();
# 863 "/usr/include/stdlib.h" 3
extern "C" int mbtowc(wchar_t *__restrict__, const char *__restrict__, size_t) throw();
# 867 "/usr/include/stdlib.h" 3
extern "C" int wctomb(char *, wchar_t) throw();
# 871 "/usr/include/stdlib.h" 3
extern "C" size_t mbstowcs(wchar_t *__restrict__, const char *__restrict__, size_t) throw();
# 874 "/usr/include/stdlib.h" 3
extern "C" size_t wcstombs(char *__restrict__, const wchar_t *__restrict__, size_t) throw();
# 885 "/usr/include/stdlib.h" 3
extern "C" int rpmatch(const char *) throw() __attribute__((nonnull(1)));
# 896 "/usr/include/stdlib.h" 3
extern "C" int getsubopt(char **__restrict__, char *const *__restrict__, char **__restrict__) throw() __attribute__((nonnull(1))) __attribute__((nonnull(2))) __attribute__((nonnull(3)));
# 905 "/usr/include/stdlib.h" 3
extern "C" void setkey(const char *) throw() __attribute__((nonnull(1)));
# 913 "/usr/include/stdlib.h" 3
extern "C" int posix_openpt(int);
# 921 "/usr/include/stdlib.h" 3
extern "C" int grantpt(int) throw();
# 925 "/usr/include/stdlib.h" 3
extern "C" int unlockpt(int) throw();
# 930 "/usr/include/stdlib.h" 3
extern "C" char *ptsname(int) throw();
# 937 "/usr/include/stdlib.h" 3
extern "C" int ptsname_r(int, char *, size_t) throw() __attribute__((nonnull(2)));
# 941 "/usr/include/stdlib.h" 3
extern "C" int getpt();
# 948 "/usr/include/stdlib.h" 3
extern "C" int getloadavg(double [], int) throw() __attribute__((nonnull(1)));
# 69 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
namespace __gnu_cxx __attribute__((visibility("default"))) {
# 71 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Iterator, class _Container> class __normal_iterator;
# 74 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
}
# 76 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
namespace std __attribute__((visibility("default"))) {
# 78 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __true_type { };
# 79 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __false_type { };
# 81 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< bool __T0>
# 82 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __truth_type {
# 83 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type; };
# 86 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __truth_type< true> {
# 87 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type; };
# 91 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Sp, class _Tp>
# 92 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __traitor {
# 94 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = (((bool)_Sp::__value) || ((bool)_Tp::__value))};
# 95 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef typename __truth_type< __value> ::__type __type;
# 96 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 99 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class , class >
# 100 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __are_same {
# 102 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 103 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 104 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 106 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 107 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __are_same< _Tp, _Tp> {
# 109 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 110 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 111 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 114 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 115 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_void {
# 117 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 118 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 119 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 122 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_void< void> {
# 124 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 125 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 126 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 131 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 132 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_integer {
# 134 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 135 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 136 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 142 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< bool> {
# 144 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 145 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 146 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 149 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< char> {
# 151 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 152 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 153 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 156 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< signed char> {
# 158 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 159 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 160 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 163 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< unsigned char> {
# 165 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 166 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 167 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 171 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< wchar_t> {
# 173 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 174 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 175 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 195 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< short> {
# 197 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 198 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 199 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 202 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< unsigned short> {
# 204 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 205 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 206 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 209 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< int> {
# 211 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 212 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 213 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 216 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< unsigned> {
# 218 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 219 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 220 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 223 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< long> {
# 225 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 226 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 227 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 230 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< unsigned long> {
# 232 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 233 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 234 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 237 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< long long> {
# 239 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 240 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 241 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 244 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_integer< unsigned long long> {
# 246 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 247 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 248 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 253 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 254 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_floating {
# 256 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 257 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 258 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 262 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_floating< float> {
# 264 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 265 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 266 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 269 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_floating< double> {
# 271 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 272 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 273 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 276 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_floating< long double> {
# 278 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 279 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 280 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 285 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 286 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_pointer {
# 288 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 289 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 290 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 292 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 293 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_pointer< _Tp *> {
# 295 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 296 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 297 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 302 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 303 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_normal_iterator {
# 305 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 306 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 307 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 309 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Iterator, class _Container>
# 310 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_normal_iterator< __gnu_cxx::__normal_iterator< _Iterator, _Container> > {
# 313 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 314 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 315 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 320 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 321 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_arithmetic : public __traitor< __is_integer< _Tp> , __is_floating< _Tp> > {
# 323 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 328 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 329 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_fundamental : public __traitor< __is_void< _Tp> , __is_arithmetic< _Tp> > {
# 331 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 336 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 337 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_scalar : public __traitor< __is_arithmetic< _Tp> , __is_pointer< _Tp> > {
# 339 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 344 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 345 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_char {
# 347 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 348 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 349 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 352 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_char< char> {
# 354 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 355 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 356 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 360 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_char< wchar_t> {
# 362 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 363 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 364 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 367 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 368 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_byte {
# 370 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 371 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 372 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 375 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_byte< char> {
# 377 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 378 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 379 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 382 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_byte< signed char> {
# 384 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 385 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 386 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 389 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template<> struct __is_byte< unsigned char> {
# 391 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value = 1};
# 392 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __true_type __type;
# 393 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 398 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
template< class _Tp>
# 399 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
struct __is_move_iterator {
# 401 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
enum { __value};
# 402 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
typedef __false_type __type;
# 403 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
};
# 417 "/usr/include/c++/4.4/bits/cpp_type_traits.h" 3
}
# 37 "/usr/include/c++/4.4/ext/type_traits.h" 3
namespace __gnu_cxx __attribute__((visibility("default"))) {
# 40 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< bool __T1, class >
# 41 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __enable_if {
# 42 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 44 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp>
# 45 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __enable_if< true, _Tp> {
# 46 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef _Tp __type; };
# 50 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< bool _Cond, class _Iftrue, class _Iffalse>
# 51 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __conditional_type {
# 52 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef _Iftrue __type; };
# 54 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Iftrue, class _Iffalse>
# 55 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __conditional_type< false, _Iftrue, _Iffalse> {
# 56 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef _Iffalse __type; };
# 60 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp>
# 61 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __add_unsigned {
# 64 "/usr/include/c++/4.4/ext/type_traits.h" 3
private: typedef __enable_if< std::__is_integer< _Tp> ::__value, _Tp> __if_type;
# 67 "/usr/include/c++/4.4/ext/type_traits.h" 3
public: typedef typename __enable_if< std::__is_integer< _Tp> ::__value, _Tp> ::__type __type;
# 68 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 71 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< char> {
# 72 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned char __type; };
# 75 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< signed char> {
# 76 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned char __type; };
# 79 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< short> {
# 80 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned short __type; };
# 83 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< int> {
# 84 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned __type; };
# 87 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< long> {
# 88 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned long __type; };
# 91 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< long long> {
# 92 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef unsigned long long __type; };
# 96 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< bool> ;
# 99 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __add_unsigned< wchar_t> ;
# 103 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp>
# 104 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __remove_unsigned {
# 107 "/usr/include/c++/4.4/ext/type_traits.h" 3
private: typedef __enable_if< std::__is_integer< _Tp> ::__value, _Tp> __if_type;
# 110 "/usr/include/c++/4.4/ext/type_traits.h" 3
public: typedef typename __enable_if< std::__is_integer< _Tp> ::__value, _Tp> ::__type __type;
# 111 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 114 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< char> {
# 115 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef signed char __type; };
# 118 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< unsigned char> {
# 119 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef signed char __type; };
# 122 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< unsigned short> {
# 123 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef short __type; };
# 126 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< unsigned> {
# 127 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef int __type; };
# 130 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< unsigned long> {
# 131 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef long __type; };
# 134 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< unsigned long long> {
# 135 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef long long __type; };
# 139 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< bool> ;
# 142 "/usr/include/c++/4.4/ext/type_traits.h" 3
template<> struct __remove_unsigned< wchar_t> ;
# 146 "/usr/include/c++/4.4/ext/type_traits.h" 3
template < typename _Type >
inline bool
__is_null_pointer ( _Type * __ptr )
{ return __ptr == 0; }
# 151 "/usr/include/c++/4.4/ext/type_traits.h" 3
template < typename _Type >
inline bool
__is_null_pointer ( _Type )
{ return false; }
# 158 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp, bool __T2 = std::__is_integer< _Tp> ::__value>
# 159 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __promote {
# 160 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef double __type; };
# 162 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp>
# 163 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __promote< _Tp, false> {
# 164 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef _Tp __type; };
# 166 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp, class _Up>
# 167 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __promote_2 {
# 170 "/usr/include/c++/4.4/ext/type_traits.h" 3
private: typedef typename __promote< _Tp, std::__is_integer< _Tp> ::__value> ::__type __type1;
# 171 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Up, std::__is_integer< _Up> ::__value> ::__type __type2;
# 174 "/usr/include/c++/4.4/ext/type_traits.h" 3
public: typedef __typeof__(__type1() + __type2()) __type;
# 175 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 177 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp, class _Up, class _Vp>
# 178 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __promote_3 {
# 181 "/usr/include/c++/4.4/ext/type_traits.h" 3
private: typedef typename __promote< _Tp, std::__is_integer< _Tp> ::__value> ::__type __type1;
# 182 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Up, std::__is_integer< _Up> ::__value> ::__type __type2;
# 183 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Vp, std::__is_integer< _Vp> ::__value> ::__type __type3;
# 186 "/usr/include/c++/4.4/ext/type_traits.h" 3
public: typedef __typeof__((__type1() + __type2()) + __type3()) __type;
# 187 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 189 "/usr/include/c++/4.4/ext/type_traits.h" 3
template< class _Tp, class _Up, class _Vp, class _Wp>
# 190 "/usr/include/c++/4.4/ext/type_traits.h" 3
struct __promote_4 {
# 193 "/usr/include/c++/4.4/ext/type_traits.h" 3
private: typedef typename __promote< _Tp, std::__is_integer< _Tp> ::__value> ::__type __type1;
# 194 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Up, std::__is_integer< _Up> ::__value> ::__type __type2;
# 195 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Vp, std::__is_integer< _Vp> ::__value> ::__type __type3;
# 196 "/usr/include/c++/4.4/ext/type_traits.h" 3
typedef typename __promote< _Wp, std::__is_integer< _Wp> ::__value> ::__type __type4;
# 199 "/usr/include/c++/4.4/ext/type_traits.h" 3
public: typedef __typeof__(((__type1() + __type2()) + __type3()) + __type4()) __type;
# 200 "/usr/include/c++/4.4/ext/type_traits.h" 3
};
# 202 "/usr/include/c++/4.4/ext/type_traits.h" 3
}
# 77 "/usr/include/c++/4.4/cmath" 3
namespace std __attribute__((visibility("default"))) {
# 81 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
_Tp __cmath_power ( _Tp, unsigned int );
# 84 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline _Tp
__pow_helper ( _Tp __x, int __n )
{
return __n < 0
? _Tp ( 1 ) / __cmath_power ( __x, - __n )
: __cmath_power ( __x, __n );
}
# 94 "/usr/include/c++/4.4/cmath" 3
inline double abs(double __x)
# 95 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fabs(__x); }
# 98 "/usr/include/c++/4.4/cmath" 3
inline float abs(float __x)
# 99 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fabsf(__x); }
# 102 "/usr/include/c++/4.4/cmath" 3
inline long double abs(long double __x)
# 103 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fabsl(__x); }
# 105 "/usr/include/c++/4.4/cmath" 3
using ::acos;
# 108 "/usr/include/c++/4.4/cmath" 3
inline float acos(float __x)
# 109 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_acosf(__x); }
# 112 "/usr/include/c++/4.4/cmath" 3
inline long double acos(long double __x)
# 113 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_acosl(__x); }
# 115 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
acos ( _Tp __x )
{ return __builtin_acos ( __x ); }
# 121 "/usr/include/c++/4.4/cmath" 3
using ::asin;
# 124 "/usr/include/c++/4.4/cmath" 3
inline float asin(float __x)
# 125 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_asinf(__x); }
# 128 "/usr/include/c++/4.4/cmath" 3
inline long double asin(long double __x)
# 129 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_asinl(__x); }
# 131 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
asin ( _Tp __x )
{ return __builtin_asin ( __x ); }
# 137 "/usr/include/c++/4.4/cmath" 3
using ::atan;
# 140 "/usr/include/c++/4.4/cmath" 3
inline float atan(float __x)
# 141 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_atanf(__x); }
# 144 "/usr/include/c++/4.4/cmath" 3
inline long double atan(long double __x)
# 145 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_atanl(__x); }
# 147 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
atan ( _Tp __x )
{ return __builtin_atan ( __x ); }
# 153 "/usr/include/c++/4.4/cmath" 3
using ::atan2;
# 156 "/usr/include/c++/4.4/cmath" 3
inline float atan2(float __y, float __x)
# 157 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_atan2f(__y, __x); }
# 160 "/usr/include/c++/4.4/cmath" 3
inline long double atan2(long double __y, long double __x)
# 161 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_atan2l(__y, __x); }
# 163 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp, typename _Up >
inline
typename __gnu_cxx :: __promote_2 <
typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value
&& __is_arithmetic < _Up > :: __value,
_Tp > :: __type, _Up > :: __type
atan2 ( _Tp __y, _Up __x )
{
typedef typename __gnu_cxx :: __promote_2 < _Tp, _Up > :: __type __type;
return atan2 ( __type ( __y ), __type ( __x ) );
}
# 175 "/usr/include/c++/4.4/cmath" 3
using ::ceil;
# 178 "/usr/include/c++/4.4/cmath" 3
inline float ceil(float __x)
# 179 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_ceilf(__x); }
# 182 "/usr/include/c++/4.4/cmath" 3
inline long double ceil(long double __x)
# 183 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_ceill(__x); }
# 185 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
ceil ( _Tp __x )
{ return __builtin_ceil ( __x ); }
# 191 "/usr/include/c++/4.4/cmath" 3
using ::cos;
# 194 "/usr/include/c++/4.4/cmath" 3
inline float cos(float __x)
# 195 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_cosf(__x); }
# 198 "/usr/include/c++/4.4/cmath" 3
inline long double cos(long double __x)
# 199 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_cosl(__x); }
# 201 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
cos ( _Tp __x )
{ return __builtin_cos ( __x ); }
# 207 "/usr/include/c++/4.4/cmath" 3
using ::cosh;
# 210 "/usr/include/c++/4.4/cmath" 3
inline float cosh(float __x)
# 211 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_coshf(__x); }
# 214 "/usr/include/c++/4.4/cmath" 3
inline long double cosh(long double __x)
# 215 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_coshl(__x); }
# 217 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
cosh ( _Tp __x )
{ return __builtin_cosh ( __x ); }
# 223 "/usr/include/c++/4.4/cmath" 3
using ::exp;
# 226 "/usr/include/c++/4.4/cmath" 3
inline float exp(float __x)
# 227 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_expf(__x); }
# 230 "/usr/include/c++/4.4/cmath" 3
inline long double exp(long double __x)
# 231 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_expl(__x); }
# 233 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
exp ( _Tp __x )
{ return __builtin_exp ( __x ); }
# 239 "/usr/include/c++/4.4/cmath" 3
using ::fabs;
# 242 "/usr/include/c++/4.4/cmath" 3
inline float fabs(float __x)
# 243 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fabsf(__x); }
# 246 "/usr/include/c++/4.4/cmath" 3
inline long double fabs(long double __x)
# 247 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fabsl(__x); }
# 249 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
fabs ( _Tp __x )
{ return __builtin_fabs ( __x ); }
# 255 "/usr/include/c++/4.4/cmath" 3
using ::floor;
# 258 "/usr/include/c++/4.4/cmath" 3
inline float floor(float __x)
# 259 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_floorf(__x); }
# 262 "/usr/include/c++/4.4/cmath" 3
inline long double floor(long double __x)
# 263 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_floorl(__x); }
# 265 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
floor ( _Tp __x )
{ return __builtin_floor ( __x ); }
# 271 "/usr/include/c++/4.4/cmath" 3
using ::fmod;
# 274 "/usr/include/c++/4.4/cmath" 3
inline float fmod(float __x, float __y)
# 275 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fmodf(__x, __y); }
# 278 "/usr/include/c++/4.4/cmath" 3
inline long double fmod(long double __x, long double __y)
# 279 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_fmodl(__x, __y); }
# 281 "/usr/include/c++/4.4/cmath" 3
using ::frexp;
# 284 "/usr/include/c++/4.4/cmath" 3
inline float frexp(float __x, int *__exp)
# 285 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_frexpf(__x, __exp); }
# 288 "/usr/include/c++/4.4/cmath" 3
inline long double frexp(long double __x, int *__exp)
# 289 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_frexpl(__x, __exp); }
# 291 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
frexp ( _Tp __x, int * __exp )
{ return __builtin_frexp ( __x, __exp ); }
# 297 "/usr/include/c++/4.4/cmath" 3
using ::ldexp;
# 300 "/usr/include/c++/4.4/cmath" 3
inline float ldexp(float __x, int __exp)
# 301 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_ldexpf(__x, __exp); }
# 304 "/usr/include/c++/4.4/cmath" 3
inline long double ldexp(long double __x, int __exp)
# 305 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_ldexpl(__x, __exp); }
# 307 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
ldexp ( _Tp __x, int __exp )
{ return __builtin_ldexp ( __x, __exp ); }
# 313 "/usr/include/c++/4.4/cmath" 3
using ::log;
# 316 "/usr/include/c++/4.4/cmath" 3
inline float log(float __x)
# 317 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_logf(__x); }
# 320 "/usr/include/c++/4.4/cmath" 3
inline long double log(long double __x)
# 321 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_logl(__x); }
# 323 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
log ( _Tp __x )
{ return __builtin_log ( __x ); }
# 329 "/usr/include/c++/4.4/cmath" 3
using ::log10;
# 332 "/usr/include/c++/4.4/cmath" 3
inline float log10(float __x)
# 333 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_log10f(__x); }
# 336 "/usr/include/c++/4.4/cmath" 3
inline long double log10(long double __x)
# 337 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_log10l(__x); }
# 339 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
log10 ( _Tp __x )
{ return __builtin_log10 ( __x ); }
# 345 "/usr/include/c++/4.4/cmath" 3
using ::modf;
# 348 "/usr/include/c++/4.4/cmath" 3
inline float modf(float __x, float *__iptr)
# 349 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_modff(__x, __iptr); }
# 352 "/usr/include/c++/4.4/cmath" 3
inline long double modf(long double __x, long double *__iptr)
# 353 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_modfl(__x, __iptr); }
# 355 "/usr/include/c++/4.4/cmath" 3
using ::pow;
# 358 "/usr/include/c++/4.4/cmath" 3
inline float pow(float __x, float __y)
# 359 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_powf(__x, __y); }
# 362 "/usr/include/c++/4.4/cmath" 3
inline long double pow(long double __x, long double __y)
# 363 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_powl(__x, __y); }
# 369 "/usr/include/c++/4.4/cmath" 3
inline double pow(double __x, int __i)
# 370 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_powi(__x, __i); }
# 373 "/usr/include/c++/4.4/cmath" 3
inline float pow(float __x, int __n)
# 374 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_powif(__x, __n); }
# 377 "/usr/include/c++/4.4/cmath" 3
inline long double pow(long double __x, int __n)
# 378 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_powil(__x, __n); }
# 381 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp, typename _Up >
inline
typename __gnu_cxx :: __promote_2 <
typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value
&& __is_arithmetic < _Up > :: __value,
_Tp > :: __type, _Up > :: __type
pow ( _Tp __x, _Up __y )
{
typedef typename __gnu_cxx :: __promote_2 < _Tp, _Up > :: __type __type;
return pow ( __type ( __x ), __type ( __y ) );
}
# 393 "/usr/include/c++/4.4/cmath" 3
using ::sin;
# 396 "/usr/include/c++/4.4/cmath" 3
inline float sin(float __x)
# 397 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sinf(__x); }
# 400 "/usr/include/c++/4.4/cmath" 3
inline long double sin(long double __x)
# 401 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sinl(__x); }
# 403 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
sin ( _Tp __x )
{ return __builtin_sin ( __x ); }
# 409 "/usr/include/c++/4.4/cmath" 3
using ::sinh;
# 412 "/usr/include/c++/4.4/cmath" 3
inline float sinh(float __x)
# 413 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sinhf(__x); }
# 416 "/usr/include/c++/4.4/cmath" 3
inline long double sinh(long double __x)
# 417 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sinhl(__x); }
# 419 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
sinh ( _Tp __x )
{ return __builtin_sinh ( __x ); }
# 425 "/usr/include/c++/4.4/cmath" 3
using ::sqrt;
# 428 "/usr/include/c++/4.4/cmath" 3
inline float sqrt(float __x)
# 429 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sqrtf(__x); }
# 432 "/usr/include/c++/4.4/cmath" 3
inline long double sqrt(long double __x)
# 433 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_sqrtl(__x); }
# 435 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
sqrt ( _Tp __x )
{ return __builtin_sqrt ( __x ); }
# 441 "/usr/include/c++/4.4/cmath" 3
using ::tan;
# 444 "/usr/include/c++/4.4/cmath" 3
inline float tan(float __x)
# 445 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_tanf(__x); }
# 448 "/usr/include/c++/4.4/cmath" 3
inline long double tan(long double __x)
# 449 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_tanl(__x); }
# 451 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
tan ( _Tp __x )
{ return __builtin_tan ( __x ); }
# 457 "/usr/include/c++/4.4/cmath" 3
using ::tanh;
# 460 "/usr/include/c++/4.4/cmath" 3
inline float tanh(float __x)
# 461 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_tanhf(__x); }
# 464 "/usr/include/c++/4.4/cmath" 3
inline long double tanh(long double __x)
# 465 "/usr/include/c++/4.4/cmath" 3
{ return __builtin_tanhl(__x); }
# 467 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_integer < _Tp > :: __value,
double > :: __type
tanh ( _Tp __x )
{ return __builtin_tanh ( __x ); }
# 473 "/usr/include/c++/4.4/cmath" 3
}
# 492 "/usr/include/c++/4.4/cmath" 3
namespace std __attribute__((visibility("default"))) {
# 494 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
fpclassify ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_fpclassify ( FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO, __type ( __f ) );
}
# 504 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isfinite ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isfinite ( __type ( __f ) );
}
# 513 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isinf ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isinf ( __type ( __f ) );
}
# 522 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isnan ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isnan ( __type ( __f ) );
}
# 531 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isnormal ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isnormal ( __type ( __f ) );
}
# 540 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
signbit ( _Tp __f )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_signbit ( __type ( __f ) );
}
# 549 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isgreater ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isgreater ( __type ( __f1 ), __type ( __f2 ) );
}
# 558 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isgreaterequal ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isgreaterequal ( __type ( __f1 ), __type ( __f2 ) );
}
# 567 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isless ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isless ( __type ( __f1 ), __type ( __f2 ) );
}
# 576 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
islessequal ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_islessequal ( __type ( __f1 ), __type ( __f2 ) );
}
# 585 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
islessgreater ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_islessgreater ( __type ( __f1 ), __type ( __f2 ) );
}
# 594 "/usr/include/c++/4.4/cmath" 3
template < typename _Tp >
inline typename __gnu_cxx :: __enable_if < __is_arithmetic < _Tp > :: __value,
int > :: __type
isunordered ( _Tp __f1, _Tp __f2 )
{
typedef typename __gnu_cxx :: __promote < _Tp > :: __type __type;
return __builtin_isunordered ( __type ( __f1 ), __type ( __f2 ) );
}
# 603 "/usr/include/c++/4.4/cmath" 3
}
# 35 "/usr/include/c++/4.4/bits/cmath.tcc" 3
namespace std __attribute__((visibility("default"))) {
# 37 "/usr/include/c++/4.4/bits/cmath.tcc" 3
template < typename _Tp >
inline _Tp
__cmath_power ( _Tp __x, unsigned int __n )
{
_Tp __y = __n % 2 ? __x : _Tp ( 1 );
while ( __n >>= 1 )
{
__x = __x * __x;
if ( __n % 2 )
__y = __y * __x;
}
return __y;
}
# 53 "/usr/include/c++/4.4/bits/cmath.tcc" 3
}
# 49 "/usr/include/c++/4.4/cstddef" 3
namespace std __attribute__((visibility("default"))) {
# 51 "/usr/include/c++/4.4/cstddef" 3
using ::ptrdiff_t;
# 52 "/usr/include/c++/4.4/cstddef" 3
using ::size_t;
# 54 "/usr/include/c++/4.4/cstddef" 3
}
# 100 "/usr/include/c++/4.4/cstdlib" 3
namespace std __attribute__((visibility("default"))) {
# 102 "/usr/include/c++/4.4/cstdlib" 3
using ::div_t;
# 103 "/usr/include/c++/4.4/cstdlib" 3
using ::ldiv_t;
# 105 "/usr/include/c++/4.4/cstdlib" 3
using ::abort;
# 106 "/usr/include/c++/4.4/cstdlib" 3
using ::abs;
# 107 "/usr/include/c++/4.4/cstdlib" 3
using ::atexit;
# 108 "/usr/include/c++/4.4/cstdlib" 3
using ::atof;
# 109 "/usr/include/c++/4.4/cstdlib" 3
using ::atoi;
# 110 "/usr/include/c++/4.4/cstdlib" 3
using ::atol;
# 111 "/usr/include/c++/4.4/cstdlib" 3
using ::bsearch;
# 112 "/usr/include/c++/4.4/cstdlib" 3
using ::calloc;
# 113 "/usr/include/c++/4.4/cstdlib" 3
using ::div;
# 114 "/usr/include/c++/4.4/cstdlib" 3
using ::exit;
# 115 "/usr/include/c++/4.4/cstdlib" 3
using ::free;
# 116 "/usr/include/c++/4.4/cstdlib" 3
using ::getenv;
# 117 "/usr/include/c++/4.4/cstdlib" 3
using ::labs;
# 118 "/usr/include/c++/4.4/cstdlib" 3
using ::ldiv;
# 119 "/usr/include/c++/4.4/cstdlib" 3
using ::malloc;
# 121 "/usr/include/c++/4.4/cstdlib" 3
using ::mblen;
# 122 "/usr/include/c++/4.4/cstdlib" 3
using ::mbstowcs;
# 123 "/usr/include/c++/4.4/cstdlib" 3
using ::mbtowc;
# 125 "/usr/include/c++/4.4/cstdlib" 3
using ::qsort;
# 126 "/usr/include/c++/4.4/cstdlib" 3
using ::rand;
# 127 "/usr/include/c++/4.4/cstdlib" 3
using ::realloc;
# 128 "/usr/include/c++/4.4/cstdlib" 3
using ::srand;
# 129 "/usr/include/c++/4.4/cstdlib" 3
using ::strtod;
# 130 "/usr/include/c++/4.4/cstdlib" 3
using ::strtol;
# 131 "/usr/include/c++/4.4/cstdlib" 3
using ::strtoul;
# 132 "/usr/include/c++/4.4/cstdlib" 3
using ::system;
# 134 "/usr/include/c++/4.4/cstdlib" 3
using ::wcstombs;
# 135 "/usr/include/c++/4.4/cstdlib" 3
using ::wctomb;
# 139 "/usr/include/c++/4.4/cstdlib" 3
inline long abs(long __i) { return labs(__i); }
# 142 "/usr/include/c++/4.4/cstdlib" 3
inline ldiv_t div(long __i, long __j) { return ldiv(__i, __j); }
# 144 "/usr/include/c++/4.4/cstdlib" 3
}
# 157 "/usr/include/c++/4.4/cstdlib" 3
namespace __gnu_cxx __attribute__((visibility("default"))) {
# 160 "/usr/include/c++/4.4/cstdlib" 3
using ::lldiv_t;
# 166 "/usr/include/c++/4.4/cstdlib" 3
using ::_Exit;
# 170 "/usr/include/c++/4.4/cstdlib" 3
inline long long abs(long long __x) { return (__x >= (0)) ? __x : (-__x); }
# 173 "/usr/include/c++/4.4/cstdlib" 3
using ::llabs;
# 176 "/usr/include/c++/4.4/cstdlib" 3
inline lldiv_t div(long long __n, long long __d)
# 177 "/usr/include/c++/4.4/cstdlib" 3
{ lldiv_t __q; (__q.quot) = (__n / __d); (__q.rem) = (__n % __d); return __q; }
# 179 "/usr/include/c++/4.4/cstdlib" 3
using ::lldiv;
# 190 "/usr/include/c++/4.4/cstdlib" 3
using ::atoll;
# 191 "/usr/include/c++/4.4/cstdlib" 3
using ::strtoll;
# 192 "/usr/include/c++/4.4/cstdlib" 3
using ::strtoull;
# 194 "/usr/include/c++/4.4/cstdlib" 3
using ::strtof;
# 195 "/usr/include/c++/4.4/cstdlib" 3
using ::strtold;
# 197 "/usr/include/c++/4.4/cstdlib" 3
}
# 199 "/usr/include/c++/4.4/cstdlib" 3
namespace std __attribute__((visibility("default"))) {
# 202 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::lldiv_t;
# 204 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::_Exit;
# 205 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::abs;
# 207 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::llabs;
# 208 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::div;
# 209 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::lldiv;
# 211 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::atoll;
# 212 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::strtof;
# 213 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::strtoll;
# 214 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::strtoull;
# 215 "/usr/include/c++/4.4/cstdlib" 3
using __gnu_cxx::strtold;
# 217 "/usr/include/c++/4.4/cstdlib" 3
}
# 497 "/usr/local/cuda/bin/../include/math_functions.h"
namespace __gnu_cxx {
# 499 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline long long abs(long long) __attribute__((visibility("default")));
# 500 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 502 "/usr/local/cuda/bin/../include/math_functions.h"
namespace std {
# 504 "/usr/local/cuda/bin/../include/math_functions.h"
template< class T> extern inline T __pow_helper(T, int);
# 505 "/usr/local/cuda/bin/../include/math_functions.h"
template< class T> extern inline T __cmath_power(T, unsigned);
# 506 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 508 "/usr/local/cuda/bin/../include/math_functions.h"
using std::abs;
# 509 "/usr/local/cuda/bin/../include/math_functions.h"
using std::fabs;
# 510 "/usr/local/cuda/bin/../include/math_functions.h"
using std::ceil;
# 511 "/usr/local/cuda/bin/../include/math_functions.h"
using std::floor;
# 512 "/usr/local/cuda/bin/../include/math_functions.h"
using std::sqrt;
# 513 "/usr/local/cuda/bin/../include/math_functions.h"
using std::pow;
# 514 "/usr/local/cuda/bin/../include/math_functions.h"
using std::log;
# 515 "/usr/local/cuda/bin/../include/math_functions.h"
using std::log10;
# 516 "/usr/local/cuda/bin/../include/math_functions.h"
using std::fmod;
# 517 "/usr/local/cuda/bin/../include/math_functions.h"
using std::modf;
# 518 "/usr/local/cuda/bin/../include/math_functions.h"
using std::exp;
# 519 "/usr/local/cuda/bin/../include/math_functions.h"
using std::frexp;
# 520 "/usr/local/cuda/bin/../include/math_functions.h"
using std::ldexp;
# 521 "/usr/local/cuda/bin/../include/math_functions.h"
using std::asin;
# 522 "/usr/local/cuda/bin/../include/math_functions.h"
using std::sin;
# 523 "/usr/local/cuda/bin/../include/math_functions.h"
using std::sinh;
# 524 "/usr/local/cuda/bin/../include/math_functions.h"
using std::acos;
# 525 "/usr/local/cuda/bin/../include/math_functions.h"
using std::cos;
# 526 "/usr/local/cuda/bin/../include/math_functions.h"
using std::cosh;
# 527 "/usr/local/cuda/bin/../include/math_functions.h"
using std::atan;
# 528 "/usr/local/cuda/bin/../include/math_functions.h"
using std::atan2;
# 529 "/usr/local/cuda/bin/../include/math_functions.h"
using std::tan;
# 530 "/usr/local/cuda/bin/../include/math_functions.h"
using std::tanh;
# 584 "/usr/local/cuda/bin/../include/math_functions.h"
namespace std {
# 587 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline long abs(long) __attribute__((visibility("default")));
# 588 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float abs(float) __attribute__((visibility("default")));
# 589 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline double abs(double) __attribute__((visibility("default")));
# 590 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float fabs(float) __attribute__((visibility("default")));
# 591 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float ceil(float) __attribute__((visibility("default")));
# 592 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float floor(float) __attribute__((visibility("default")));
# 593 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float sqrt(float) __attribute__((visibility("default")));
# 594 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float pow(float, float) __attribute__((visibility("default")));
# 595 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float pow(float, int) __attribute__((visibility("default")));
# 596 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline double pow(double, int) __attribute__((visibility("default")));
# 597 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float log(float) __attribute__((visibility("default")));
# 598 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float log10(float) __attribute__((visibility("default")));
# 599 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float fmod(float, float) __attribute__((visibility("default")));
# 600 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float modf(float, float *) __attribute__((visibility("default")));
# 601 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float exp(float) __attribute__((visibility("default")));
# 602 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float frexp(float, int *) __attribute__((visibility("default")));
# 603 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float ldexp(float, int) __attribute__((visibility("default")));
# 604 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float asin(float) __attribute__((visibility("default")));
# 605 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float sin(float) __attribute__((visibility("default")));
# 606 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float sinh(float) __attribute__((visibility("default")));
# 607 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float acos(float) __attribute__((visibility("default")));
# 608 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float cos(float) __attribute__((visibility("default")));
# 609 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float cosh(float) __attribute__((visibility("default")));
# 610 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float atan(float) __attribute__((visibility("default")));
# 611 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float atan2(float, float) __attribute__((visibility("default")));
# 612 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float tan(float) __attribute__((visibility("default")));
# 613 "/usr/local/cuda/bin/../include/math_functions.h"
extern inline float tanh(float) __attribute__((visibility("default")));
# 616 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 619 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float logb(float a)
# 620 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 621 "/usr/local/cuda/bin/../include/math_functions.h"
return logbf(a);
# 622 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 624 "/usr/local/cuda/bin/../include/math_functions.h"
static inline int ilogb(float a)
# 625 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 626 "/usr/local/cuda/bin/../include/math_functions.h"
return ilogbf(a);
# 627 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 629 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float scalbn(float a, int b)
# 630 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 631 "/usr/local/cuda/bin/../include/math_functions.h"
return scalbnf(a, b);
# 632 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 634 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float scalbln(float a, long b)
# 635 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 636 "/usr/local/cuda/bin/../include/math_functions.h"
return scalblnf(a, b);
# 637 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 639 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float exp2(float a)
# 640 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 641 "/usr/local/cuda/bin/../include/math_functions.h"
return exp2f(a);
# 642 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 644 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float exp10(float a)
# 645 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 646 "/usr/local/cuda/bin/../include/math_functions.h"
return exp10f(a);
# 647 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 649 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float expm1(float a)
# 650 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 651 "/usr/local/cuda/bin/../include/math_functions.h"
return expm1f(a);
# 652 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 654 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float log2(float a)
# 655 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 656 "/usr/local/cuda/bin/../include/math_functions.h"
return log2f(a);
# 657 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 659 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float log1p(float a)
# 660 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 661 "/usr/local/cuda/bin/../include/math_functions.h"
return log1pf(a);
# 662 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 664 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float rsqrt(float a)
# 665 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 666 "/usr/local/cuda/bin/../include/math_functions.h"
return rsqrtf(a);
# 667 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 669 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float acosh(float a)
# 670 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 671 "/usr/local/cuda/bin/../include/math_functions.h"
return acoshf(a);
# 672 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 674 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float asinh(float a)
# 675 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 676 "/usr/local/cuda/bin/../include/math_functions.h"
return asinhf(a);
# 677 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 679 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float atanh(float a)
# 680 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 681 "/usr/local/cuda/bin/../include/math_functions.h"
return atanhf(a);
# 682 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 684 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float hypot(float a, float b)
# 685 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 686 "/usr/local/cuda/bin/../include/math_functions.h"
return hypotf(a, b);
# 687 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 689 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float cbrt(float a)
# 690 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 691 "/usr/local/cuda/bin/../include/math_functions.h"
return cbrtf(a);
# 692 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 694 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float rcbrt(float a)
# 695 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 696 "/usr/local/cuda/bin/../include/math_functions.h"
return rcbrtf(a);
# 697 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 699 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float sinpi(float a)
# 700 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 701 "/usr/local/cuda/bin/../include/math_functions.h"
return sinpif(a);
# 702 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 704 "/usr/local/cuda/bin/../include/math_functions.h"
static inline void sincos(float a, float *sptr, float *cptr)
# 705 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 706 "/usr/local/cuda/bin/../include/math_functions.h"
sincosf(a, sptr, cptr);
# 707 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 709 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float erf(float a)
# 710 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 711 "/usr/local/cuda/bin/../include/math_functions.h"
return erff(a);
# 712 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 714 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float erfinv(float a)
# 715 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 716 "/usr/local/cuda/bin/../include/math_functions.h"
return erfinvf(a);
# 717 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 719 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float erfc(float a)
# 720 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 721 "/usr/local/cuda/bin/../include/math_functions.h"
return erfcf(a);
# 722 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 724 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float erfcinv(float a)
# 725 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 726 "/usr/local/cuda/bin/../include/math_functions.h"
return erfcinvf(a);
# 727 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 729 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float lgamma(float a)
# 730 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 731 "/usr/local/cuda/bin/../include/math_functions.h"
return lgammaf(a);
# 732 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 734 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float tgamma(float a)
# 735 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 736 "/usr/local/cuda/bin/../include/math_functions.h"
return tgammaf(a);
# 737 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 739 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float copysign(float a, float b)
# 740 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 741 "/usr/local/cuda/bin/../include/math_functions.h"
return copysignf(a, b);
# 742 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 744 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double copysign(double a, float b)
# 745 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 746 "/usr/local/cuda/bin/../include/math_functions.h"
return copysign(a, (double)b);
# 747 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 749 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float copysign(float a, double b)
# 750 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 751 "/usr/local/cuda/bin/../include/math_functions.h"
return copysignf(a, (float)b);
# 752 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 754 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float nextafter(float a, float b)
# 755 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 756 "/usr/local/cuda/bin/../include/math_functions.h"
return nextafterf(a, b);
# 757 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 759 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float remainder(float a, float b)
# 760 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 761 "/usr/local/cuda/bin/../include/math_functions.h"
return remainderf(a, b);
# 762 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 764 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float remquo(float a, float b, int *quo)
# 765 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 766 "/usr/local/cuda/bin/../include/math_functions.h"
return remquof(a, b, quo);
# 767 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 769 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float round(float a)
# 770 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 771 "/usr/local/cuda/bin/../include/math_functions.h"
return roundf(a);
# 772 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 774 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long lround(float a)
# 775 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 776 "/usr/local/cuda/bin/../include/math_functions.h"
return lroundf(a);
# 777 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 779 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long long llround(float a)
# 780 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 781 "/usr/local/cuda/bin/../include/math_functions.h"
return llroundf(a);
# 782 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 784 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float trunc(float a)
# 785 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 786 "/usr/local/cuda/bin/../include/math_functions.h"
return truncf(a);
# 787 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 789 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float rint(float a)
# 790 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 791 "/usr/local/cuda/bin/../include/math_functions.h"
return rintf(a);
# 792 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 794 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long lrint(float a)
# 795 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 796 "/usr/local/cuda/bin/../include/math_functions.h"
return lrintf(a);
# 797 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 799 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long long llrint(float a)
# 800 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 801 "/usr/local/cuda/bin/../include/math_functions.h"
return llrintf(a);
# 802 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 804 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float nearbyint(float a)
# 805 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 806 "/usr/local/cuda/bin/../include/math_functions.h"
return nearbyintf(a);
# 807 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 809 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float fdim(float a, float b)
# 810 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 811 "/usr/local/cuda/bin/../include/math_functions.h"
return fdimf(a, b);
# 812 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 814 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float fma(float a, float b, float c)
# 815 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 816 "/usr/local/cuda/bin/../include/math_functions.h"
return fmaf(a, b, c);
# 817 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 819 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float fmax(float a, float b)
# 820 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 821 "/usr/local/cuda/bin/../include/math_functions.h"
return fmaxf(a, b);
# 822 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 824 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float fmin(float a, float b)
# 825 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 826 "/usr/local/cuda/bin/../include/math_functions.h"
return fminf(a, b);
# 827 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 829 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned min(unsigned a, unsigned b)
# 830 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 831 "/usr/local/cuda/bin/../include/math_functions.h"
return umin(a, b);
# 832 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 834 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned min(int a, unsigned b)
# 835 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 836 "/usr/local/cuda/bin/../include/math_functions.h"
return umin((unsigned)a, b);
# 837 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 839 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned min(unsigned a, int b)
# 840 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 841 "/usr/local/cuda/bin/../include/math_functions.h"
return umin(a, (unsigned)b);
# 842 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 844 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long long min(long long a, long long b)
# 845 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 846 "/usr/local/cuda/bin/../include/math_functions.h"
return llmin(a, b);
# 847 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 849 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long min(unsigned long long a, unsigned long long b)
# 850 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 851 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmin(a, b);
# 852 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 854 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long min(long long a, unsigned long long b)
# 855 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 856 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmin((unsigned long long)a, b);
# 857 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 859 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long min(unsigned long long a, long long b)
# 860 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 861 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmin(a, (unsigned long long)b);
# 862 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 864 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float min(float a, float b)
# 865 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 866 "/usr/local/cuda/bin/../include/math_functions.h"
return fminf(a, b);
# 867 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 869 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double min(double a, double b)
# 870 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 871 "/usr/local/cuda/bin/../include/math_functions.h"
return fmin(a, b);
# 872 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 874 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double min(float a, double b)
# 875 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 876 "/usr/local/cuda/bin/../include/math_functions.h"
return fmin((double)a, b);
# 877 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 879 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double min(double a, float b)
# 880 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 881 "/usr/local/cuda/bin/../include/math_functions.h"
return fmin(a, (double)b);
# 882 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 884 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned max(unsigned a, unsigned b)
# 885 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 886 "/usr/local/cuda/bin/../include/math_functions.h"
return umax(a, b);
# 887 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 889 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned max(int a, unsigned b)
# 890 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 891 "/usr/local/cuda/bin/../include/math_functions.h"
return umax((unsigned)a, b);
# 892 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 894 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned max(unsigned a, int b)
# 895 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 896 "/usr/local/cuda/bin/../include/math_functions.h"
return umax(a, (unsigned)b);
# 897 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 899 "/usr/local/cuda/bin/../include/math_functions.h"
static inline long long max(long long a, long long b)
# 900 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 901 "/usr/local/cuda/bin/../include/math_functions.h"
return llmax(a, b);
# 902 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 904 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long max(unsigned long long a, unsigned long long b)
# 905 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 906 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmax(a, b);
# 907 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 909 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long max(long long a, unsigned long long b)
# 910 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 911 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmax((unsigned long long)a, b);
# 912 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 914 "/usr/local/cuda/bin/../include/math_functions.h"
static inline unsigned long long max(unsigned long long a, long long b)
# 915 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 916 "/usr/local/cuda/bin/../include/math_functions.h"
return ullmax(a, (unsigned long long)b);
# 917 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 919 "/usr/local/cuda/bin/../include/math_functions.h"
static inline float max(float a, float b)
# 920 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 921 "/usr/local/cuda/bin/../include/math_functions.h"
return fmaxf(a, b);
# 922 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 924 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double max(double a, double b)
# 925 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 926 "/usr/local/cuda/bin/../include/math_functions.h"
return fmax(a, b);
# 927 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 929 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double max(float a, double b)
# 930 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 931 "/usr/local/cuda/bin/../include/math_functions.h"
return fmax((double)a, b);
# 932 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 934 "/usr/local/cuda/bin/../include/math_functions.h"
static inline double max(double a, float b)
# 935 "/usr/local/cuda/bin/../include/math_functions.h"
{
# 936 "/usr/local/cuda/bin/../include/math_functions.h"
return fmax(a, (double)b);
# 937 "/usr/local/cuda/bin/../include/math_functions.h"
}
# 60 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
template< class T, int dim = 1>
# 61 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
struct surface : public surfaceReference {
# 63 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
surface()
# 64 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
{
# 65 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
(channelDesc) = cudaCreateChannelDesc< T> ();
# 66 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
}
# 68 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
surface(cudaChannelFormatDesc desc)
# 69 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
{
# 70 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
(channelDesc) = desc;
# 71 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
}
# 72 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
};
# 75 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
template< int dim>
# 76 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
struct surface< void, dim> : public surfaceReference {
# 78 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
surface()
# 79 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
{
# 80 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
(channelDesc) = cudaCreateChannelDesc< void> ();
# 81 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
}
# 82 "/usr/local/cuda/bin/../include/cuda_surface_types.h"
};
# 60 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
template< class T, int dim = 1, cudaTextureReadMode mode = cudaReadModeElementType>
# 61 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
struct texture : public textureReference {
# 63 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
texture(int norm = 0, cudaTextureFilterMode
# 64 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
fMode = cudaFilterModePoint, cudaTextureAddressMode
# 65 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
aMode = cudaAddressModeClamp)
# 66 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
{
# 67 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(normalized) = norm;
# 68 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(filterMode) = fMode;
# 69 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[0]) = aMode;
# 70 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[1]) = aMode;
# 71 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[2]) = aMode;
# 72 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(channelDesc) = cudaCreateChannelDesc< T> ();
# 73 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
}
# 75 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
texture(int norm, cudaTextureFilterMode
# 76 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
fMode, cudaTextureAddressMode
# 77 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
aMode, cudaChannelFormatDesc
# 78 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
desc)
# 79 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
{
# 80 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(normalized) = norm;
# 81 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(filterMode) = fMode;
# 82 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[0]) = aMode;
# 83 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[1]) = aMode;
# 84 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
((addressMode)[2]) = aMode;
# 85 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
(channelDesc) = desc;
# 86 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
}
# 87 "/usr/local/cuda/bin/../include/cuda_texture_types.h"
};
# 324 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline int mulhi(int a, int b)
# 325 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 327 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 329 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned mulhi(unsigned a, unsigned b)
# 330 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 332 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 334 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned mulhi(int a, unsigned b)
# 335 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 337 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 339 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned mulhi(unsigned a, int b)
# 340 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 342 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 344 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline long long mul64hi(long long a, long long b)
# 345 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 347 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 349 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned long long mul64hi(unsigned long long a, unsigned long long b)
# 350 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 352 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 354 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned long long mul64hi(long long a, unsigned long long b)
# 355 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 357 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 359 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned long long mul64hi(unsigned long long a, long long b)
# 360 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 362 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 364 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline int float_as_int(float a)
# 365 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 367 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 369 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline float int_as_float(int a)
# 370 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 372 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 374 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline float saturate(float a)
# 375 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 377 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 379 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline int mul24(int a, int b)
# 380 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 382 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 384 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned umul24(unsigned a, unsigned b)
# 385 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 387 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 389 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline void trap()
# 390 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 392 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 394 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline void brkpt(int c)
# 395 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 397 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 399 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline void syncthreads()
# 400 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 402 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 404 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline void prof_trigger(int e)
# 405 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 422 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 424 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline void threadfence(bool global = true)
# 425 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 427 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 429 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline int float2int(float a, cudaRoundMode mode = cudaRoundZero)
# 430 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 435 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 437 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline unsigned float2uint(float a, cudaRoundMode mode = cudaRoundZero)
# 438 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 443 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 445 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline float int2float(int a, cudaRoundMode mode = cudaRoundNearest)
# 446 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 451 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 453 "/usr/local/cuda/bin/../include/device_functions.h"
__attribute__((unused)) static inline float uint2float(unsigned a, cudaRoundMode mode = cudaRoundNearest)
# 454 "/usr/local/cuda/bin/../include/device_functions.h"
{int volatile ___ = 1;
# 459 "/usr/local/cuda/bin/../include/device_functions.h"
exit(___);}
# 102 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicAdd(int *address, int val)
# 103 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 105 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 107 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicAdd(unsigned *address, unsigned val)
# 108 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 110 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 112 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicSub(int *address, int val)
# 113 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 115 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 117 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicSub(unsigned *address, unsigned val)
# 118 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 120 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 122 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicExch(int *address, int val)
# 123 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 125 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 127 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicExch(unsigned *address, unsigned val)
# 128 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 130 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 132 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline float atomicExch(float *address, float val)
# 133 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 135 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 137 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicMin(int *address, int val)
# 138 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 140 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 142 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicMin(unsigned *address, unsigned val)
# 143 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 145 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 147 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicMax(int *address, int val)
# 148 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 150 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 152 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicMax(unsigned *address, unsigned val)
# 153 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 155 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 157 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicInc(unsigned *address, unsigned val)
# 158 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 160 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 162 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicDec(unsigned *address, unsigned val)
# 163 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 165 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 167 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicAnd(int *address, int val)
# 168 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 170 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 172 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicAnd(unsigned *address, unsigned val)
# 173 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 175 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 177 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicOr(int *address, int val)
# 178 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 180 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 182 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicOr(unsigned *address, unsigned val)
# 183 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 185 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 187 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicXor(int *address, int val)
# 188 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 190 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 192 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicXor(unsigned *address, unsigned val)
# 193 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 195 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 197 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline int atomicCAS(int *address, int compare, int val)
# 198 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 200 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 202 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
__attribute__((unused)) static inline unsigned atomicCAS(unsigned *address, unsigned compare, unsigned val)
# 203 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
{int volatile ___ = 1;
# 205 "/usr/local/cuda/bin/../include/sm_11_atomic_functions.h"
exit(___);}
# 75 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
__attribute__((unused)) static inline unsigned long long atomicAdd(unsigned long long *address, unsigned long long val)
# 76 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
{int volatile ___ = 1;
# 78 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
exit(___);}
# 80 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
__attribute__((unused)) static inline unsigned long long atomicExch(unsigned long long *address, unsigned long long val)
# 81 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
{int volatile ___ = 1;
# 83 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
exit(___);}
# 85 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
__attribute__((unused)) static inline unsigned long long atomicCAS(unsigned long long *address, unsigned long long compare, unsigned long long val)
# 86 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
{int volatile ___ = 1;
# 88 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
exit(___);}
# 90 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
__attribute__((unused)) static inline bool any(bool cond)
# 91 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
{int volatile ___ = 1;
# 93 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
exit(___);}
# 95 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
__attribute__((unused)) static inline bool all(bool cond)
# 96 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
{int volatile ___ = 1;
# 98 "/usr/local/cuda/bin/../include/sm_12_atomic_functions.h"
exit(___);}
# 170 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double fma(double a, double b, double c, cudaRoundMode mode)
# 171 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 176 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 178 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double dmul(double a, double b, cudaRoundMode mode = cudaRoundNearest)
# 179 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 184 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 186 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double dadd(double a, double b, cudaRoundMode mode = cudaRoundNearest)
# 187 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 192 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 194 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline int double2int(double a, cudaRoundMode mode = cudaRoundZero)
# 195 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 200 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 202 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline unsigned double2uint(double a, cudaRoundMode mode = cudaRoundZero)
# 203 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 208 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 210 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline long long double2ll(double a, cudaRoundMode mode = cudaRoundZero)
# 211 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 216 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 218 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline unsigned long long double2ull(double a, cudaRoundMode mode = cudaRoundZero)
# 219 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 224 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 226 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double ll2double(long long a, cudaRoundMode mode = cudaRoundNearest)
# 227 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 232 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 234 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double ull2double(unsigned long long a, cudaRoundMode mode = cudaRoundNearest)
# 235 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 240 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 242 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double int2double(int a, cudaRoundMode mode = cudaRoundNearest)
# 243 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 245 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 247 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double uint2double(unsigned a, cudaRoundMode mode = cudaRoundNearest)
# 248 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 250 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 252 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
__attribute__((unused)) static inline double float2double(float a, cudaRoundMode mode = cudaRoundNearest)
# 253 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
{int volatile ___ = 1;
# 255 "/usr/local/cuda/bin/../include/sm_13_double_functions.h"
exit(___);}
# 66 "/usr/local/cuda/bin/../include/sm_20_atomic_functions.h"
__attribute__((unused)) static inline float atomicAdd(float *address, float val)
# 67 "/usr/local/cuda/bin/../include/sm_20_atomic_functions.h"
{int volatile ___ = 1;
# 69 "/usr/local/cuda/bin/../include/sm_20_atomic_functions.h"
exit(___);}
# 124 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
__attribute__((unused)) static inline unsigned ballot(bool pred)
# 125 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
{int volatile ___ = 1;
# 127 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
exit(___);}
# 129 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
__attribute__((unused)) static inline int syncthreads_count(bool pred)
# 130 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
{int volatile ___ = 1;
# 132 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
exit(___);}
# 134 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
__attribute__((unused)) static inline bool syncthreads_and(bool pred)
# 135 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
{int volatile ___ = 1;
# 137 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
exit(___);}
# 139 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
__attribute__((unused)) static inline bool syncthreads_or(bool pred)
# 140 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
{int volatile ___ = 1;
# 142 "/usr/local/cuda/bin/../include/sm_20_intrinsics.h"
exit(___);}
# 97 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 98 "/usr/local/cuda/bin/../include/surface_functions.h"
surf1Dread(T *res, surface< void, 1> surf, int x, int s, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 99 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 106 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 108 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline T
# 109 "/usr/local/cuda/bin/../include/surface_functions.h"
surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 110 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 116 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 118 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 119 "/usr/local/cuda/bin/../include/surface_functions.h"
surf1Dread(T *res, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 120 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 122 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 125 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 126 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 128 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 131 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline signed char surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 132 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 134 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 137 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned char surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 138 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 140 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 143 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 144 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 146 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 149 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 150 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 152 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 155 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 156 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 160 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 163 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 164 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 166 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 169 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 170 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 174 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 177 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 178 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 180 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 183 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 184 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 186 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 189 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned short surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 190 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 192 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 195 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 196 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 198 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 201 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 202 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 204 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 207 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 208 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 212 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 215 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 216 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 218 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 221 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 222 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 226 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 229 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 230 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 232 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 235 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 236 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 238 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 241 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 242 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 244 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 247 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 248 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 250 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 253 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 254 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 256 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 259 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 260 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 264 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 267 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 268 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 270 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 273 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 274 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 278 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 281 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 282 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 284 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 287 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline long long surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 288 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 290 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 293 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned long long surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 294 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 296 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 299 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline longlong1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 300 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 302 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 305 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ulonglong1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 306 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 308 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 311 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline longlong2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 312 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 316 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 319 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ulonglong2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 320 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 322 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 385 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 386 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 388 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 391 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float1 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 392 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 394 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 397 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float2 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 398 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 402 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 405 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float4 surf1Dread(surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode)
# 406 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 410 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 457 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 458 "/usr/local/cuda/bin/../include/surface_functions.h"
surf2Dread(T *res, surface< void, 2> surf, int x, int y, int s, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 459 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 466 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 468 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline T
# 469 "/usr/local/cuda/bin/../include/surface_functions.h"
surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 470 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 476 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 478 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 479 "/usr/local/cuda/bin/../include/surface_functions.h"
surf2Dread(T *res, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 480 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 482 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 485 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 486 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 488 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 491 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline signed char surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 492 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 494 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 497 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned char surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 498 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 500 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 503 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 504 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 506 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 509 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 510 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 512 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 515 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 516 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 520 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 523 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 524 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 526 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 529 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline char4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 530 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 534 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 537 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uchar4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 538 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 540 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 543 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 544 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 546 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 549 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned short surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 550 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 552 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 555 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 556 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 558 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 561 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 562 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 564 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 567 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 568 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 572 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 575 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 576 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 578 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 581 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline short4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 582 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 586 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 589 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ushort4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 590 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 592 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 595 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 596 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 598 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 601 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 602 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 604 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 607 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 608 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 610 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 613 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 614 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 616 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 619 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 620 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 624 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 627 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 628 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 630 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 633 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline int4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 634 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 638 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 641 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline uint4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 642 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 644 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 647 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline long long surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 648 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 650 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 653 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline unsigned long long surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 654 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 656 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 659 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline longlong1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 660 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 662 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 665 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ulonglong1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 666 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 668 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 671 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline longlong2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 672 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 676 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 679 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline ulonglong2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 680 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 682 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 745 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 746 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 748 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 751 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float1 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 752 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 754 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 757 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float2 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 758 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 762 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 765 "/usr/local/cuda/bin/../include/surface_functions.h"
template<> __attribute__((unused)) inline float4 surf2Dread(surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode)
# 766 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 770 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 817 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 818 "/usr/local/cuda/bin/../include/surface_functions.h"
surf1Dwrite(T val, surface< void, 1> surf, int x, int s, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 819 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 837 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 839 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 840 "/usr/local/cuda/bin/../include/surface_functions.h"
surf1Dwrite(T val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 841 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 843 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 846 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(char val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 847 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 849 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 851 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(signed char val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 852 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 854 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 856 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(unsigned char val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 857 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 859 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 861 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(char1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 862 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 864 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 866 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uchar1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 867 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 869 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 871 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(char2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 872 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 874 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 876 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uchar2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 877 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 879 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 881 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(char4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 882 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 884 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 886 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uchar4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 887 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 889 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 891 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(short val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 892 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 894 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 896 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(unsigned short val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 897 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 899 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 901 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(short1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 902 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 904 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 906 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(ushort1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 907 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 909 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 911 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(short2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 912 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 914 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 916 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(ushort2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 917 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 919 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 921 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(short4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 922 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 924 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 926 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(ushort4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 927 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 929 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 931 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(int val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 932 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 934 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 936 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(unsigned val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 937 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 939 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 941 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(int1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 942 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 944 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 946 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uint1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 947 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 949 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 951 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(int2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 952 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 954 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 956 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uint2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 957 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 959 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 961 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(int4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 962 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 964 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 966 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(uint4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 967 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 969 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 971 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(long long val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 972 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 974 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 976 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(unsigned long long val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 977 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 979 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 981 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(longlong1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 982 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 984 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 986 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(ulonglong1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 987 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 989 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 991 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(longlong2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 992 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 994 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 996 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(ulonglong2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 997 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 999 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1045 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(float val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1046 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1048 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1050 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(float1 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1051 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1053 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1055 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(float2 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1056 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1058 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1060 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf1Dwrite(float4 val, surface< void, 1> surf, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1061 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1063 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1110 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 1111 "/usr/local/cuda/bin/../include/surface_functions.h"
surf2Dwrite(T val, surface< void, 2> surf, int x, int y, int s, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1112 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1130 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1132 "/usr/local/cuda/bin/../include/surface_functions.h"
template< class T> __attribute__((unused)) static inline void
# 1133 "/usr/local/cuda/bin/../include/surface_functions.h"
surf2Dwrite(T val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1134 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1136 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1139 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(char val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1140 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1142 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1144 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(signed char val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1145 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1147 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1149 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(unsigned char val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1150 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1152 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1154 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(char1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1155 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1157 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1159 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uchar1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1160 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1162 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1164 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(char2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1165 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1167 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1169 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uchar2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1170 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1172 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1174 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(char4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1175 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1177 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1179 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uchar4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1180 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1182 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1184 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(short val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1185 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1187 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1189 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(unsigned short val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1190 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1192 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1194 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(short1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1195 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1197 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1199 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(ushort1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1200 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1202 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1204 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(short2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1205 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1207 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1209 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(ushort2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1210 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1212 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1214 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(short4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1215 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1217 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1219 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(ushort4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1220 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1222 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1224 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(int val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1225 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1227 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1229 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(unsigned val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1230 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1232 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1234 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(int1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1235 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1237 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1239 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uint1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1240 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1242 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1244 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(int2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1245 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1247 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1249 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uint2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1250 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1252 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1254 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(int4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1255 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1257 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1259 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(uint4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1260 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1262 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1264 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(long long val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1265 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1267 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1269 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(unsigned long long val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1270 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1272 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1274 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(longlong1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1275 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1277 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1279 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(ulonglong1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1280 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1282 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1284 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(longlong2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1285 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1287 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1289 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(ulonglong2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1290 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1292 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1338 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(float val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1339 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1341 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1343 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(float1 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1344 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1346 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1348 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(float2 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1349 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1351 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 1353 "/usr/local/cuda/bin/../include/surface_functions.h"
__attribute__((unused)) static inline void surf2Dwrite(float4 val, surface< void, 2> surf, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
# 1354 "/usr/local/cuda/bin/../include/surface_functions.h"
{int volatile ___ = 1;
# 1356 "/usr/local/cuda/bin/../include/surface_functions.h"
exit(___);}
# 61 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, cudaTextureReadMode readMode> __attribute__((unused)) extern uint4 __utexfetchi(texture< T, 1, readMode> , int4);
# 63 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, cudaTextureReadMode readMode> __attribute__((unused)) extern int4 __itexfetchi(texture< T, 1, readMode> , int4);
# 65 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, cudaTextureReadMode readMode> __attribute__((unused)) extern float4 __ftexfetchi(texture< T, 1, readMode> , int4);
# 68 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, int dim, cudaTextureReadMode readMode> __attribute__((unused)) extern uint4 __utexfetch(texture< T, dim, readMode> , float4, int = dim);
# 70 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, int dim, cudaTextureReadMode readMode> __attribute__((unused)) extern int4 __itexfetch(texture< T, dim, readMode> , float4, int = dim);
# 72 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< class T, int dim, cudaTextureReadMode readMode> __attribute__((unused)) extern float4 __ftexfetch(texture< T, dim, readMode> , float4, int = dim);
# 80 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char tex1Dfetch(texture< char, 1, cudaReadModeElementType> t, int x)
# 81 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 89 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 91 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline signed char tex1Dfetch(texture< signed char, 1, cudaReadModeElementType> t, int x)
# 92 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 96 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 98 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned char tex1Dfetch(texture< unsigned char, 1, cudaReadModeElementType> t, int x)
# 99 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 103 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 105 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char1 tex1Dfetch(texture< char1, 1, cudaReadModeElementType> t, int x)
# 106 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 110 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 112 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar1 tex1Dfetch(texture< uchar1, 1, cudaReadModeElementType> t, int x)
# 113 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 117 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 119 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char2 tex1Dfetch(texture< char2, 1, cudaReadModeElementType> t, int x)
# 120 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 124 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 126 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar2 tex1Dfetch(texture< uchar2, 1, cudaReadModeElementType> t, int x)
# 127 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 131 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 133 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex1Dfetch(texture< char4, 1, cudaReadModeElementType> t, int x)
# 134 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 138 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 140 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex1Dfetch(texture< uchar4, 1, cudaReadModeElementType> t, int x)
# 141 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 145 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 153 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short tex1Dfetch(texture< short, 1, cudaReadModeElementType> t, int x)
# 154 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 158 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 160 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned short tex1Dfetch(texture< unsigned short, 1, cudaReadModeElementType> t, int x)
# 161 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 165 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 167 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short1 tex1Dfetch(texture< short1, 1, cudaReadModeElementType> t, int x)
# 168 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 172 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 174 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort1 tex1Dfetch(texture< ushort1, 1, cudaReadModeElementType> t, int x)
# 175 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 179 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 181 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short2 tex1Dfetch(texture< short2, 1, cudaReadModeElementType> t, int x)
# 182 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 186 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 188 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort2 tex1Dfetch(texture< ushort2, 1, cudaReadModeElementType> t, int x)
# 189 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 193 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 195 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex1Dfetch(texture< short4, 1, cudaReadModeElementType> t, int x)
# 196 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 200 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 202 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex1Dfetch(texture< ushort4, 1, cudaReadModeElementType> t, int x)
# 203 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 207 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 215 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int tex1Dfetch(texture< int, 1, cudaReadModeElementType> t, int x)
# 216 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 220 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 222 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned tex1Dfetch(texture< unsigned, 1, cudaReadModeElementType> t, int x)
# 223 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 227 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 229 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int1 tex1Dfetch(texture< int1, 1, cudaReadModeElementType> t, int x)
# 230 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 234 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 236 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint1 tex1Dfetch(texture< uint1, 1, cudaReadModeElementType> t, int x)
# 237 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 241 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 243 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int2 tex1Dfetch(texture< int2, 1, cudaReadModeElementType> t, int x)
# 244 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 248 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 250 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint2 tex1Dfetch(texture< uint2, 1, cudaReadModeElementType> t, int x)
# 251 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 255 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 257 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex1Dfetch(texture< int4, 1, cudaReadModeElementType> t, int x)
# 258 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 262 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 264 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex1Dfetch(texture< uint4, 1, cudaReadModeElementType> t, int x)
# 265 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 269 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 343 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< float, 1, cudaReadModeElementType> t, int x)
# 344 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 348 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 350 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1Dfetch(texture< float1, 1, cudaReadModeElementType> t, int x)
# 351 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 355 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 357 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1Dfetch(texture< float2, 1, cudaReadModeElementType> t, int x)
# 358 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 362 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 364 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1Dfetch(texture< float4, 1, cudaReadModeElementType> t, int x)
# 365 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 369 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 377 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< char, 1, cudaReadModeNormalizedFloat> t, int x)
# 378 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 387 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 389 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< signed char, 1, cudaReadModeNormalizedFloat> t, int x)
# 390 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 395 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 397 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< unsigned char, 1, cudaReadModeNormalizedFloat> t, int x)
# 398 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 403 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 405 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1Dfetch(texture< char1, 1, cudaReadModeNormalizedFloat> t, int x)
# 406 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 411 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 413 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1Dfetch(texture< uchar1, 1, cudaReadModeNormalizedFloat> t, int x)
# 414 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 419 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 421 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1Dfetch(texture< char2, 1, cudaReadModeNormalizedFloat> t, int x)
# 422 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 427 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 429 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1Dfetch(texture< uchar2, 1, cudaReadModeNormalizedFloat> t, int x)
# 430 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 435 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 437 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1Dfetch(texture< char4, 1, cudaReadModeNormalizedFloat> t, int x)
# 438 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 443 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 445 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1Dfetch(texture< uchar4, 1, cudaReadModeNormalizedFloat> t, int x)
# 446 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 451 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 459 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< short, 1, cudaReadModeNormalizedFloat> t, int x)
# 460 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 465 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 467 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1Dfetch(texture< unsigned short, 1, cudaReadModeNormalizedFloat> t, int x)
# 468 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 473 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 475 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1Dfetch(texture< short1, 1, cudaReadModeNormalizedFloat> t, int x)
# 476 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 481 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 483 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1Dfetch(texture< ushort1, 1, cudaReadModeNormalizedFloat> t, int x)
# 484 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 489 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 491 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1Dfetch(texture< short2, 1, cudaReadModeNormalizedFloat> t, int x)
# 492 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 497 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 499 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1Dfetch(texture< ushort2, 1, cudaReadModeNormalizedFloat> t, int x)
# 500 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 505 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 507 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1Dfetch(texture< short4, 1, cudaReadModeNormalizedFloat> t, int x)
# 508 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 513 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 515 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1Dfetch(texture< ushort4, 1, cudaReadModeNormalizedFloat> t, int x)
# 516 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 521 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 529 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char tex1D(texture< char, 1, cudaReadModeElementType> t, float x)
# 530 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 538 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 540 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline signed char tex1D(texture< signed char, 1, cudaReadModeElementType> t, float x)
# 541 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 545 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 547 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned char tex1D(texture< unsigned char, 1, cudaReadModeElementType> t, float x)
# 548 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 552 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 554 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char1 tex1D(texture< char1, 1, cudaReadModeElementType> t, float x)
# 555 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 559 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 561 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar1 tex1D(texture< uchar1, 1, cudaReadModeElementType> t, float x)
# 562 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 566 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 568 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char2 tex1D(texture< char2, 1, cudaReadModeElementType> t, float x)
# 569 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 573 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 575 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar2 tex1D(texture< uchar2, 1, cudaReadModeElementType> t, float x)
# 576 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 580 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 582 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex1D(texture< char4, 1, cudaReadModeElementType> t, float x)
# 583 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 587 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 589 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex1D(texture< uchar4, 1, cudaReadModeElementType> t, float x)
# 590 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 594 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 602 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short tex1D(texture< short, 1, cudaReadModeElementType> t, float x)
# 603 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 607 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 609 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned short tex1D(texture< unsigned short, 1, cudaReadModeElementType> t, float x)
# 610 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 614 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 616 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short1 tex1D(texture< short1, 1, cudaReadModeElementType> t, float x)
# 617 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 621 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 623 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort1 tex1D(texture< ushort1, 1, cudaReadModeElementType> t, float x)
# 624 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 628 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 630 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short2 tex1D(texture< short2, 1, cudaReadModeElementType> t, float x)
# 631 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 635 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 637 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort2 tex1D(texture< ushort2, 1, cudaReadModeElementType> t, float x)
# 638 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 642 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 644 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex1D(texture< short4, 1, cudaReadModeElementType> t, float x)
# 645 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 649 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 651 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex1D(texture< ushort4, 1, cudaReadModeElementType> t, float x)
# 652 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 656 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 664 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int tex1D(texture< int, 1, cudaReadModeElementType> t, float x)
# 665 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 669 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 671 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned tex1D(texture< unsigned, 1, cudaReadModeElementType> t, float x)
# 672 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 676 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 678 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int1 tex1D(texture< int1, 1, cudaReadModeElementType> t, float x)
# 679 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 683 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 685 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint1 tex1D(texture< uint1, 1, cudaReadModeElementType> t, float x)
# 686 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 690 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 692 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int2 tex1D(texture< int2, 1, cudaReadModeElementType> t, float x)
# 693 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 697 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 699 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint2 tex1D(texture< uint2, 1, cudaReadModeElementType> t, float x)
# 700 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 704 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 706 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex1D(texture< int4, 1, cudaReadModeElementType> t, float x)
# 707 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 711 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 713 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex1D(texture< uint4, 1, cudaReadModeElementType> t, float x)
# 714 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 718 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 798 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< float, 1, cudaReadModeElementType> t, float x)
# 799 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 803 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 805 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1D(texture< float1, 1, cudaReadModeElementType> t, float x)
# 806 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 810 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 812 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1D(texture< float2, 1, cudaReadModeElementType> t, float x)
# 813 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 817 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 819 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1D(texture< float4, 1, cudaReadModeElementType> t, float x)
# 820 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 824 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 832 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< char, 1, cudaReadModeNormalizedFloat> t, float x)
# 833 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 842 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 844 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< signed char, 1, cudaReadModeNormalizedFloat> t, float x)
# 845 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 850 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 852 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< unsigned char, 1, cudaReadModeNormalizedFloat> t, float x)
# 853 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 858 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 860 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1D(texture< char1, 1, cudaReadModeNormalizedFloat> t, float x)
# 861 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 866 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 868 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1D(texture< uchar1, 1, cudaReadModeNormalizedFloat> t, float x)
# 869 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 874 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 876 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1D(texture< char2, 1, cudaReadModeNormalizedFloat> t, float x)
# 877 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 882 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 884 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1D(texture< uchar2, 1, cudaReadModeNormalizedFloat> t, float x)
# 885 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 890 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 892 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1D(texture< char4, 1, cudaReadModeNormalizedFloat> t, float x)
# 893 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 898 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 900 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1D(texture< uchar4, 1, cudaReadModeNormalizedFloat> t, float x)
# 901 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 906 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 914 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< short, 1, cudaReadModeNormalizedFloat> t, float x)
# 915 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 920 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 922 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex1D(texture< unsigned short, 1, cudaReadModeNormalizedFloat> t, float x)
# 923 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 928 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 930 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1D(texture< short1, 1, cudaReadModeNormalizedFloat> t, float x)
# 931 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 936 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 938 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex1D(texture< ushort1, 1, cudaReadModeNormalizedFloat> t, float x)
# 939 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 944 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 946 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1D(texture< short2, 1, cudaReadModeNormalizedFloat> t, float x)
# 947 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 952 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 954 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex1D(texture< ushort2, 1, cudaReadModeNormalizedFloat> t, float x)
# 955 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 960 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 962 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1D(texture< short4, 1, cudaReadModeNormalizedFloat> t, float x)
# 963 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 968 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 970 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex1D(texture< ushort4, 1, cudaReadModeNormalizedFloat> t, float x)
# 971 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 976 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 984 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char tex2D(texture< char, 2, cudaReadModeElementType> t, float x, float y)
# 985 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 993 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 995 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline signed char tex2D(texture< signed char, 2, cudaReadModeElementType> t, float x, float y)
# 996 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1000 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1002 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned char tex2D(texture< unsigned char, 2, cudaReadModeElementType> t, float x, float y)
# 1003 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1007 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1009 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char1 tex2D(texture< char1, 2, cudaReadModeElementType> t, float x, float y)
# 1010 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1014 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1016 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar1 tex2D(texture< uchar1, 2, cudaReadModeElementType> t, float x, float y)
# 1017 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1021 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1023 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char2 tex2D(texture< char2, 2, cudaReadModeElementType> t, float x, float y)
# 1024 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1028 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1030 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar2 tex2D(texture< uchar2, 2, cudaReadModeElementType> t, float x, float y)
# 1031 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1035 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1037 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2D(texture< char4, 2, cudaReadModeElementType> t, float x, float y)
# 1038 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1042 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1044 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2D(texture< uchar4, 2, cudaReadModeElementType> t, float x, float y)
# 1045 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1049 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1057 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short tex2D(texture< short, 2, cudaReadModeElementType> t, float x, float y)
# 1058 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1062 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1064 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned short tex2D(texture< unsigned short, 2, cudaReadModeElementType> t, float x, float y)
# 1065 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1069 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1071 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short1 tex2D(texture< short1, 2, cudaReadModeElementType> t, float x, float y)
# 1072 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1076 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1078 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort1 tex2D(texture< ushort1, 2, cudaReadModeElementType> t, float x, float y)
# 1079 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1083 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1085 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short2 tex2D(texture< short2, 2, cudaReadModeElementType> t, float x, float y)
# 1086 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1090 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1092 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort2 tex2D(texture< ushort2, 2, cudaReadModeElementType> t, float x, float y)
# 1093 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1097 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1099 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2D(texture< short4, 2, cudaReadModeElementType> t, float x, float y)
# 1100 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1104 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1106 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2D(texture< ushort4, 2, cudaReadModeElementType> t, float x, float y)
# 1107 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1111 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1119 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int tex2D(texture< int, 2, cudaReadModeElementType> t, float x, float y)
# 1120 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1124 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1126 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned tex2D(texture< unsigned, 2, cudaReadModeElementType> t, float x, float y)
# 1127 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1131 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1133 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int1 tex2D(texture< int1, 2, cudaReadModeElementType> t, float x, float y)
# 1134 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1138 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1140 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint1 tex2D(texture< uint1, 2, cudaReadModeElementType> t, float x, float y)
# 1141 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1145 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1147 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int2 tex2D(texture< int2, 2, cudaReadModeElementType> t, float x, float y)
# 1148 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1152 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1154 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint2 tex2D(texture< uint2, 2, cudaReadModeElementType> t, float x, float y)
# 1155 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1159 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1161 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2D(texture< int4, 2, cudaReadModeElementType> t, float x, float y)
# 1162 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1166 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1168 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2D(texture< uint4, 2, cudaReadModeElementType> t, float x, float y)
# 1169 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1173 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1247 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< float, 2, cudaReadModeElementType> t, float x, float y)
# 1248 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1252 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1254 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex2D(texture< float1, 2, cudaReadModeElementType> t, float x, float y)
# 1255 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1259 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1261 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex2D(texture< float2, 2, cudaReadModeElementType> t, float x, float y)
# 1262 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1266 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1268 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2D(texture< float4, 2, cudaReadModeElementType> t, float x, float y)
# 1269 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1273 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1281 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< char, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1282 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1291 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1293 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< signed char, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1294 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1299 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1301 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< unsigned char, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1302 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1307 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1309 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex2D(texture< char1, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1310 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1315 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1317 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex2D(texture< uchar1, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1318 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1323 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1325 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex2D(texture< char2, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1326 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1331 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1333 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex2D(texture< uchar2, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1334 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1339 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1341 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2D(texture< char4, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1342 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1347 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1349 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2D(texture< uchar4, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1350 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1355 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1363 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< short, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1364 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1369 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1371 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex2D(texture< unsigned short, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1372 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1377 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1379 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex2D(texture< short1, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1380 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1385 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1387 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex2D(texture< ushort1, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1388 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1393 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1395 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex2D(texture< short2, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1396 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1401 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1403 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex2D(texture< ushort2, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1404 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1409 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1411 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2D(texture< short4, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1412 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1417 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1419 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2D(texture< ushort4, 2, cudaReadModeNormalizedFloat> t, float x, float y)
# 1420 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1425 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1433 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char tex3D(texture< char, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1434 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1442 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1444 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline signed char tex3D(texture< signed char, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1445 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1449 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1451 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned char tex3D(texture< unsigned char, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1452 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1456 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1458 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char1 tex3D(texture< char1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1459 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1463 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1465 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar1 tex3D(texture< uchar1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1466 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1470 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1472 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char2 tex3D(texture< char2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1473 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1477 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1479 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar2 tex3D(texture< uchar2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1480 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1484 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1486 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex3D(texture< char4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1487 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1491 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1493 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex3D(texture< uchar4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1494 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1498 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1506 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short tex3D(texture< short, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1507 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1511 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1513 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned short tex3D(texture< unsigned short, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1514 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1518 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1520 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short1 tex3D(texture< short1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1521 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1525 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1527 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort1 tex3D(texture< ushort1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1528 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1532 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1534 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short2 tex3D(texture< short2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1535 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1539 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1541 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort2 tex3D(texture< ushort2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1542 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1546 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1548 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex3D(texture< short4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1549 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1553 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1555 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex3D(texture< ushort4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1556 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1560 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1568 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int tex3D(texture< int, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1569 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1573 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1575 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline unsigned tex3D(texture< unsigned, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1576 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1580 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1582 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int1 tex3D(texture< int1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1583 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1587 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1589 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint1 tex3D(texture< uint1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1590 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1594 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1596 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int2 tex3D(texture< int2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1597 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1601 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1603 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint2 tex3D(texture< uint2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1604 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1608 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1610 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex3D(texture< int4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1611 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1615 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1617 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex3D(texture< uint4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1618 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1622 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1696 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< float, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1697 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1701 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1703 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex3D(texture< float1, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1704 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1708 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1710 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex3D(texture< float2, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1711 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1715 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1717 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex3D(texture< float4, 3, cudaReadModeElementType> t, float x, float y, float z)
# 1718 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1722 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1730 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< char, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1731 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1740 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1742 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< signed char, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1743 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1748 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1750 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< unsigned char, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1751 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1756 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1758 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex3D(texture< char1, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1759 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1764 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1766 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex3D(texture< uchar1, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1767 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1772 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1774 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex3D(texture< char2, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1775 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1780 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1782 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex3D(texture< uchar2, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1783 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1788 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1790 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex3D(texture< char4, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1791 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1796 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1798 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex3D(texture< uchar4, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1799 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1804 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1812 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< short, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1813 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1818 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1820 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float tex3D(texture< unsigned short, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1821 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1826 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1828 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex3D(texture< short1, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1829 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1834 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1836 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float1 tex3D(texture< ushort1, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1837 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1842 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1844 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex3D(texture< short2, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1845 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1850 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1852 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float2 tex3D(texture< ushort2, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1853 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1858 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1860 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex3D(texture< short4, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1861 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1866 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1868 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex3D(texture< ushort4, 3, cudaReadModeNormalizedFloat> t, float x, float y, float z)
# 1869 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1874 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1930 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< int comp, class T> __attribute__((unused)) extern int4 __itex2Dgather(texture< T, 2, cudaReadModeElementType> , float2, int = comp);
# 1932 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< int comp, class T> __attribute__((unused)) extern uint4 __utex2Dgather(texture< T, 2, cudaReadModeElementType> , float2, int = comp);
# 1934 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
template< int comp, class T> __attribute__((unused)) extern float4 __ftex2Dgather(texture< T, 2, cudaReadModeElementType> , float2, int = comp);
# 1954 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< char, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1955 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1957 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1959 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< signed char, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1960 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1962 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1964 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2Dgather(texture< unsigned char, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1965 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1967 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1969 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< char1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1970 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1972 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1974 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2Dgather(texture< uchar1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1975 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1977 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1979 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< char2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1980 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1982 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1984 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2Dgather(texture< uchar2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1985 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1987 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1989 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< char3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1990 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1992 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1994 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2Dgather(texture< uchar3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 1995 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 1997 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 1999 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline char4 tex2Dgather(texture< char4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2000 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2002 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2004 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uchar4 tex2Dgather(texture< uchar4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2005 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2007 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2009 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2Dgather(texture< short, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2010 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2012 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2014 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2Dgather(texture< unsigned short, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2015 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2017 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2019 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2Dgather(texture< short1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2020 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2022 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2024 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2Dgather(texture< ushort1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2025 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2027 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2029 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2Dgather(texture< short2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2030 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2032 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2034 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2Dgather(texture< ushort2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2035 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2037 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2039 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2Dgather(texture< short3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2040 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2042 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2044 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2Dgather(texture< ushort3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2045 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2047 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2049 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline short4 tex2Dgather(texture< short4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2050 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2052 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2054 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline ushort4 tex2Dgather(texture< ushort4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2055 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2057 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2059 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2Dgather(texture< int, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2060 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2062 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2064 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2Dgather(texture< unsigned, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2065 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2067 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2069 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2Dgather(texture< int1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2070 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2072 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2074 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2Dgather(texture< uint1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2075 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2077 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2079 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2Dgather(texture< int2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2080 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2082 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2084 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2Dgather(texture< uint2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2085 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2087 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2089 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2Dgather(texture< int3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2090 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2092 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2094 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2Dgather(texture< uint3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2095 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2097 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2099 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline int4 tex2Dgather(texture< int4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2100 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2102 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2104 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline uint4 tex2Dgather(texture< uint4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2105 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2107 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2109 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2Dgather(texture< float, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2110 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2112 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2114 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2Dgather(texture< float1, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2115 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2117 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2119 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2Dgather(texture< float2, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2120 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2122 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2124 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2Dgather(texture< float3, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2125 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2127 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 2129 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
__attribute__((unused)) static inline float4 tex2Dgather(texture< float4, 2, cudaReadModeElementType> t, float x, float y, int comp = 0)
# 2130 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
{int volatile ___ = 1;
# 2132 "/usr/local/cuda/bin/../include/texture_fetch_functions.h"
exit(___);}
# 53 "/usr/local/cuda/bin/../include/device_launch_parameters.h"
extern "C" { extern const uint3 threadIdx; }
# 55 "/usr/local/cuda/bin/../include/device_launch_parameters.h"
extern "C" { extern const uint3 blockIdx; }
# 57 "/usr/local/cuda/bin/../include/device_launch_parameters.h"
extern "C" { extern const dim3 blockDim; }
# 59 "/usr/local/cuda/bin/../include/device_launch_parameters.h"
extern "C" { extern const dim3 gridDim; }
# 61 "/usr/local/cuda/bin/../include/device_launch_parameters.h"
extern "C" { extern const int warpSize; }
# 106 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 107 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaSetupArgument(T
# 108 "/usr/local/cuda/bin/../include/cuda_runtime.h"
arg, size_t
# 109 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset)
# 111 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 112 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaSetupArgument((const void *)(&arg), sizeof(T), offset);
# 113 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 145 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaEventCreate(cudaEvent_t *
# 146 "/usr/local/cuda/bin/../include/cuda_runtime.h"
event, unsigned
# 147 "/usr/local/cuda/bin/../include/cuda_runtime.h"
flags)
# 149 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 150 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaEventCreateWithFlags(event, 0);
# 151 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 208 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaMallocHost(void **
# 209 "/usr/local/cuda/bin/../include/cuda_runtime.h"
ptr, size_t
# 210 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size, unsigned
# 211 "/usr/local/cuda/bin/../include/cuda_runtime.h"
flags)
# 213 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 214 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaHostAlloc(ptr, size, flags);
# 215 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 217 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 218 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaHostAlloc(T **
# 219 "/usr/local/cuda/bin/../include/cuda_runtime.h"
ptr, size_t
# 220 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size, unsigned
# 221 "/usr/local/cuda/bin/../include/cuda_runtime.h"
flags)
# 223 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 224 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaHostAlloc((void **)((void *)ptr), size, flags);
# 225 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 227 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 228 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaHostGetDevicePointer(T **
# 229 "/usr/local/cuda/bin/../include/cuda_runtime.h"
pDevice, void *
# 230 "/usr/local/cuda/bin/../include/cuda_runtime.h"
pHost, unsigned
# 231 "/usr/local/cuda/bin/../include/cuda_runtime.h"
flags)
# 233 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 234 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaHostGetDevicePointer((void **)((void *)pDevice), pHost, flags);
# 235 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 237 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 238 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMalloc(T **
# 239 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, size_t
# 240 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size)
# 242 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 243 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMalloc((void **)((void *)devPtr), size);
# 244 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 246 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 247 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMallocHost(T **
# 248 "/usr/local/cuda/bin/../include/cuda_runtime.h"
ptr, size_t
# 249 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size, unsigned
# 250 "/usr/local/cuda/bin/../include/cuda_runtime.h"
flags = (0))
# 252 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 253 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMallocHost((void **)((void *)ptr), size, flags);
# 254 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 256 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 257 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMallocPitch(T **
# 258 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, size_t *
# 259 "/usr/local/cuda/bin/../include/cuda_runtime.h"
pitch, size_t
# 260 "/usr/local/cuda/bin/../include/cuda_runtime.h"
width, size_t
# 261 "/usr/local/cuda/bin/../include/cuda_runtime.h"
height)
# 263 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 264 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMallocPitch((void **)((void *)devPtr), pitch, width, height);
# 265 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 275 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaMemcpyToSymbol(char *
# 276 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, const void *
# 277 "/usr/local/cuda/bin/../include/cuda_runtime.h"
src, size_t
# 278 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 279 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 280 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyHostToDevice)
# 282 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 283 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyToSymbol((const char *)symbol, src, count, offset, kind);
# 284 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 286 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 287 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMemcpyToSymbol(const T &
# 288 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, const void *
# 289 "/usr/local/cuda/bin/../include/cuda_runtime.h"
src, size_t
# 290 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 291 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 292 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyHostToDevice)
# 294 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 295 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyToSymbol((const char *)(&symbol), src, count, offset, kind);
# 296 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 298 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaMemcpyToSymbolAsync(char *
# 299 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, const void *
# 300 "/usr/local/cuda/bin/../include/cuda_runtime.h"
src, size_t
# 301 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 302 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 303 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyHostToDevice, cudaStream_t
# 304 "/usr/local/cuda/bin/../include/cuda_runtime.h"
stream = 0)
# 306 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 307 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyToSymbolAsync((const char *)symbol, src, count, offset, kind, stream);
# 308 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 310 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 311 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMemcpyToSymbolAsync(const T &
# 312 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, const void *
# 313 "/usr/local/cuda/bin/../include/cuda_runtime.h"
src, size_t
# 314 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 315 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 316 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyHostToDevice, cudaStream_t
# 317 "/usr/local/cuda/bin/../include/cuda_runtime.h"
stream = 0)
# 319 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 320 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyToSymbolAsync((const char *)(&symbol), src, count, offset, kind, stream);
# 321 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 329 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaMemcpyFromSymbol(void *
# 330 "/usr/local/cuda/bin/../include/cuda_runtime.h"
dst, char *
# 331 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, size_t
# 332 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 333 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 334 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyDeviceToHost)
# 336 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 337 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyFromSymbol(dst, (const char *)symbol, count, offset, kind);
# 338 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 340 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 341 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMemcpyFromSymbol(void *
# 342 "/usr/local/cuda/bin/../include/cuda_runtime.h"
dst, const T &
# 343 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, size_t
# 344 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 345 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 346 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyDeviceToHost)
# 348 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 349 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyFromSymbol(dst, (const char *)(&symbol), count, offset, kind);
# 350 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 352 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaMemcpyFromSymbolAsync(void *
# 353 "/usr/local/cuda/bin/../include/cuda_runtime.h"
dst, char *
# 354 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, size_t
# 355 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 356 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 357 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyDeviceToHost, cudaStream_t
# 358 "/usr/local/cuda/bin/../include/cuda_runtime.h"
stream = 0)
# 360 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 361 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyFromSymbolAsync(dst, (const char *)symbol, count, offset, kind, stream);
# 362 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 364 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 365 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaMemcpyFromSymbolAsync(void *
# 366 "/usr/local/cuda/bin/../include/cuda_runtime.h"
dst, const T &
# 367 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol, size_t
# 368 "/usr/local/cuda/bin/../include/cuda_runtime.h"
count, size_t
# 369 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset = (0), cudaMemcpyKind
# 370 "/usr/local/cuda/bin/../include/cuda_runtime.h"
kind = cudaMemcpyDeviceToHost, cudaStream_t
# 371 "/usr/local/cuda/bin/../include/cuda_runtime.h"
stream = 0)
# 373 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 374 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaMemcpyFromSymbolAsync(dst, (const char *)(&symbol), count, offset, kind, stream);
# 375 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 377 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaGetSymbolAddress(void **
# 378 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, char *
# 379 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol)
# 381 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 382 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaGetSymbolAddress(devPtr, (const char *)symbol);
# 383 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 410 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 411 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaGetSymbolAddress(void **
# 412 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, const T &
# 413 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol)
# 415 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 416 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaGetSymbolAddress(devPtr, (const char *)(&symbol));
# 417 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 425 "/usr/local/cuda/bin/../include/cuda_runtime.h"
static inline cudaError_t cudaGetSymbolSize(size_t *
# 426 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size, char *
# 427 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol)
# 429 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 430 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaGetSymbolSize(size, (const char *)symbol);
# 431 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 458 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 459 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaGetSymbolSize(size_t *
# 460 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size, const T &
# 461 "/usr/local/cuda/bin/../include/cuda_runtime.h"
symbol)
# 463 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 464 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaGetSymbolSize(size, (const char *)(&symbol));
# 465 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 507 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 508 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTexture(size_t *
# 509 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset, const texture< T, dim, readMode> &
# 510 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const void *
# 511 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, const cudaChannelFormatDesc &
# 512 "/usr/local/cuda/bin/../include/cuda_runtime.h"
desc, size_t
# 513 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size = (((2147483647) * 2U) + 1U))
# 515 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 516 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindTexture(offset, &tex, devPtr, &desc, size);
# 517 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 552 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 553 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTexture(size_t *
# 554 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset, const texture< T, dim, readMode> &
# 555 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const void *
# 556 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, size_t
# 557 "/usr/local/cuda/bin/../include/cuda_runtime.h"
size = (((2147483647) * 2U) + 1U))
# 559 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 560 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindTexture(offset, tex, devPtr, (tex.channelDesc), size);
# 561 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 608 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 609 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTexture2D(size_t *
# 610 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset, const texture< T, dim, readMode> &
# 611 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const void *
# 612 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, const cudaChannelFormatDesc &
# 613 "/usr/local/cuda/bin/../include/cuda_runtime.h"
desc, size_t
# 614 "/usr/local/cuda/bin/../include/cuda_runtime.h"
width, size_t
# 615 "/usr/local/cuda/bin/../include/cuda_runtime.h"
height, size_t
# 616 "/usr/local/cuda/bin/../include/cuda_runtime.h"
pitch)
# 618 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 619 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindTexture2D(offset, &tex, devPtr, &desc, width, height, pitch);
# 620 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 666 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 667 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTexture2D(size_t *
# 668 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset, const texture< T, dim, readMode> &
# 669 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const void *
# 670 "/usr/local/cuda/bin/../include/cuda_runtime.h"
devPtr, size_t
# 671 "/usr/local/cuda/bin/../include/cuda_runtime.h"
width, size_t
# 672 "/usr/local/cuda/bin/../include/cuda_runtime.h"
height, size_t
# 673 "/usr/local/cuda/bin/../include/cuda_runtime.h"
pitch)
# 675 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 676 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindTexture2D(offset, &tex, devPtr, &(tex.texture< T, dim, readMode> ::channelDesc), width, height, pitch);
# 677 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 708 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 709 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTextureToArray(const texture< T, dim, readMode> &
# 710 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const cudaArray *
# 711 "/usr/local/cuda/bin/../include/cuda_runtime.h"
array, const cudaChannelFormatDesc &
# 712 "/usr/local/cuda/bin/../include/cuda_runtime.h"
desc)
# 714 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 715 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindTextureToArray(&tex, array, &desc);
# 716 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 746 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 747 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindTextureToArray(const texture< T, dim, readMode> &
# 748 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex, const cudaArray *
# 749 "/usr/local/cuda/bin/../include/cuda_runtime.h"
array)
# 751 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 752 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaChannelFormatDesc desc;
# 753 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaError_t err = cudaGetChannelDesc(&desc, array);
# 755 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return (err == (cudaSuccess)) ? cudaBindTextureToArray(tex, array, desc) : err;
# 756 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 785 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 786 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaUnbindTexture(const texture< T, dim, readMode> &
# 787 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex)
# 789 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 790 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaUnbindTexture(&tex);
# 791 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 825 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim, cudaTextureReadMode readMode> inline cudaError_t
# 826 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaGetTextureAlignmentOffset(size_t *
# 827 "/usr/local/cuda/bin/../include/cuda_runtime.h"
offset, const texture< T, dim, readMode> &
# 828 "/usr/local/cuda/bin/../include/cuda_runtime.h"
tex)
# 830 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 831 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaGetTextureAlignmentOffset(offset, &tex);
# 832 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 886 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 887 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaFuncSetCacheConfig(T *
# 888 "/usr/local/cuda/bin/../include/cuda_runtime.h"
func, cudaFuncCache
# 889 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cacheConfig)
# 891 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 892 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaFuncSetCacheConfig((const char *)func, cacheConfig);
# 893 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 930 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 931 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaLaunch(T *
# 932 "/usr/local/cuda/bin/../include/cuda_runtime.h"
entry)
# 934 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 935 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaLaunch((const char *)entry);
# 936 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 970 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T> inline cudaError_t
# 971 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaFuncGetAttributes(cudaFuncAttributes *
# 972 "/usr/local/cuda/bin/../include/cuda_runtime.h"
attr, T *
# 973 "/usr/local/cuda/bin/../include/cuda_runtime.h"
entry)
# 975 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 976 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaFuncGetAttributes(attr, (const char *)entry);
# 977 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 999 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim> inline cudaError_t
# 1000 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindSurfaceToArray(const surface< T, dim> &
# 1001 "/usr/local/cuda/bin/../include/cuda_runtime.h"
surf, const cudaArray *
# 1002 "/usr/local/cuda/bin/../include/cuda_runtime.h"
array, const cudaChannelFormatDesc &
# 1003 "/usr/local/cuda/bin/../include/cuda_runtime.h"
desc)
# 1005 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 1006 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return cudaBindSurfaceToArray(&surf, array, &desc);
# 1007 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 1028 "/usr/local/cuda/bin/../include/cuda_runtime.h"
template< class T, int dim> inline cudaError_t
# 1029 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaBindSurfaceToArray(const surface< T, dim> &
# 1030 "/usr/local/cuda/bin/../include/cuda_runtime.h"
surf, const cudaArray *
# 1031 "/usr/local/cuda/bin/../include/cuda_runtime.h"
array)
# 1033 "/usr/local/cuda/bin/../include/cuda_runtime.h"
{
# 1034 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaChannelFormatDesc desc;
# 1035 "/usr/local/cuda/bin/../include/cuda_runtime.h"
cudaError_t err = cudaGetChannelDesc(&desc, array);
# 1037 "/usr/local/cuda/bin/../include/cuda_runtime.h"
return (err == (cudaSuccess)) ? cudaBindSurfaceToArray(surf, array, desc) : err;
# 1038 "/usr/local/cuda/bin/../include/cuda_runtime.h"
}
# 45 "/usr/include/stdio.h" 3
struct _IO_FILE;
# 49 "/usr/include/stdio.h" 3
extern "C" { typedef _IO_FILE FILE; }
# 65 "/usr/include/stdio.h" 3
extern "C" { typedef _IO_FILE __FILE; }
# 95 "/usr/include/wchar.h" 3
extern "C" { typedef
# 84 "/usr/include/wchar.h" 3
struct {
# 85 "/usr/include/wchar.h" 3
int __count;
# 87 "/usr/include/wchar.h" 3
union {
# 89 "/usr/include/wchar.h" 3
unsigned __wch;
# 93 "/usr/include/wchar.h" 3
char __wchb[4];
# 94 "/usr/include/wchar.h" 3
} __value;
# 95 "/usr/include/wchar.h" 3
} __mbstate_t; }
# 26 "/usr/include/_G_config.h" 3
extern "C" { typedef
# 23 "/usr/include/_G_config.h" 3
struct {
# 24 "/usr/include/_G_config.h" 3
__off_t __pos;
# 25 "/usr/include/_G_config.h" 3
__mbstate_t __state;
# 26 "/usr/include/_G_config.h" 3
} _G_fpos_t; }
# 31 "/usr/include/_G_config.h" 3
extern "C" { typedef
# 28 "/usr/include/_G_config.h" 3
struct {
# 29 "/usr/include/_G_config.h" 3
__off64_t __pos;
# 30 "/usr/include/_G_config.h" 3
__mbstate_t __state;
# 31 "/usr/include/_G_config.h" 3
} _G_fpos64_t; }
# 53 "/usr/include/_G_config.h" 3
extern "C" { typedef short _G_int16_t; }
# 54 "/usr/include/_G_config.h" 3
extern "C" { typedef int _G_int32_t; }
# 55 "/usr/include/_G_config.h" 3
extern "C" { typedef unsigned short _G_uint16_t; }
# 56 "/usr/include/_G_config.h" 3
extern "C" { typedef unsigned _G_uint32_t; }
# 40 "/usr/lib/gcc/i686-linux-gnu/4.4.5/include/va.h" 3
extern "C" { typedef __builtin_va_list __gnuc_va_list; }
# 170 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
# 180 "/usr/include/libio.h" 3
extern "C" { typedef void _IO_lock_t; }
# 186 "/usr/include/libio.h" 3
extern "C" { struct _IO_marker {
# 187 "/usr/include/libio.h" 3
_IO_marker *_next;
# 188 "/usr/include/libio.h" 3
_IO_FILE *_sbuf;
# 192 "/usr/include/libio.h" 3
int _pos;
# 203 "/usr/include/libio.h" 3
}; }
# 206 "/usr/include/libio.h" 3
enum __codecvt_result {
# 208 "/usr/include/libio.h" 3
__codecvt_ok,
# 209 "/usr/include/libio.h" 3
__codecvt_partial,
# 210 "/usr/include/libio.h" 3
__codecvt_error,
# 211 "/usr/include/libio.h" 3
__codecvt_noconv
# 212 "/usr/include/libio.h" 3
};
# 271 "/usr/include/libio.h" 3
extern "C" { struct _IO_FILE {
# 272 "/usr/include/libio.h" 3
int _flags;
# 277 "/usr/include/libio.h" 3
char *_IO_read_ptr;
# 278 "/usr/include/libio.h" 3
char *_IO_read_end;
# 279 "/usr/include/libio.h" 3
char *_IO_read_base;
# 280 "/usr/include/libio.h" 3
char *_IO_write_base;
# 281 "/usr/include/libio.h" 3
char *_IO_write_ptr;
# 282 "/usr/include/libio.h" 3
char *_IO_write_end;
# 283 "/usr/include/libio.h" 3
char *_IO_buf_base;
# 284 "/usr/include/libio.h" 3
char *_IO_buf_end;
# 286 "/usr/include/libio.h" 3
char *_IO_save_base;
# 287 "/usr/include/libio.h" 3
char *_IO_backup_base;
# 288 "/usr/include/libio.h" 3
char *_IO_save_end;
# 290 "/usr/include/libio.h" 3
_IO_marker *_markers;
# 292 "/usr/include/libio.h" 3
_IO_FILE *_chain;
# 294 "/usr/include/libio.h" 3
int _fileno;
# 298 "/usr/include/libio.h" 3
int _flags2;
# 300 "/usr/include/libio.h" 3
__off_t _old_offset;
# 304 "/usr/include/libio.h" 3
unsigned short _cur_column;
# 305 "/usr/include/libio.h" 3
signed char _vtable_offset;
# 306 "/usr/include/libio.h" 3
char _shortbuf[1];
# 310 "/usr/include/libio.h" 3
_IO_lock_t *_lock;
# 319 "/usr/include/libio.h" 3
__off64_t _offset;
# 328 "/usr/include/libio.h" 3
void *__pad1;
# 329 "/usr/include/libio.h" 3
void *__pad2;
# 330 "/usr/include/libio.h" 3
void *__pad3;
# 331 "/usr/include/libio.h" 3
void *__pad4;
# 332 "/usr/include/libio.h" 3
size_t __pad5;
# 334 "/usr/include/libio.h" 3
int _mode;
# 336 "/usr/include/libio.h" 3
char _unused2[((((15) * sizeof(int)) - ((4) * sizeof(void *))) - sizeof(size_t))];
# 338 "/usr/include/libio.h" 3
}; }
# 344 "/usr/include/libio.h" 3
struct _IO_FILE_plus;
# 346 "/usr/include/libio.h" 3
extern "C" { extern _IO_FILE_plus _IO_2_1_stdin_; }
# 347 "/usr/include/libio.h" 3
extern "C" { extern _IO_FILE_plus _IO_2_1_stdout_; }
# 348 "/usr/include/libio.h" 3
extern "C" { extern _IO_FILE_plus _IO_2_1_stderr_; }
# 364 "/usr/include/libio.h" 3
extern "C" { typedef __ssize_t __io_read_fn(void *, char *, size_t); }
# 372 "/usr/include/libio.h" 3
extern "C" { typedef __ssize_t __io_write_fn(void *, const char *, size_t); }
# 381 "/usr/include/libio.h" 3
extern "C" { typedef int __io_seek_fn(void *, __off64_t *, int); }
# 384 "/usr/include/libio.h" 3
extern "C" { typedef int __io_close_fn(void *); }
# 389 "/usr/include/libio.h" 3
extern "C" { typedef __io_read_fn cookie_read_function_t; }
# 390 "/usr/include/libio.h" 3
extern "C" { typedef __io_write_fn cookie_write_function_t; }
# 391 "/usr/include/libio.h" 3
extern "C" { typedef __io_seek_fn cookie_seek_function_t; }
# 392 "/usr/include/libio.h" 3
extern "C" { typedef __io_close_fn cookie_close_function_t; }
# 401 "/usr/include/libio.h" 3
extern "C" { typedef
# 396 "/usr/include/libio.h" 3
struct {
# 397 "/usr/include/libio.h" 3
__io_read_fn *read;
# 398 "/usr/include/libio.h" 3
__io_write_fn *write;
# 399 "/usr/include/libio.h" 3
__io_seek_fn *seek;
# 400 "/usr/include/libio.h" 3
__io_close_fn *close;
# 401 "/usr/include/libio.h" 3
} _IO_cookie_io_functions_t; }
# 402 "/usr/include/libio.h" 3
extern "C" { typedef _IO_cookie_io_functions_t cookie_io_functions_t; }
# 404 "/usr/include/libio.h" 3
struct _IO_cookie_file;
# 407 "/usr/include/libio.h" 3
extern "C" void _IO_cookie_init(_IO_cookie_file *, int, void *, _IO_cookie_io_functions_t);
# 416 "/usr/include/libio.h" 3
extern "C" int __underflow(_IO_FILE *);
# 417 "/usr/include/libio.h" 3
extern "C" int __uflow(_IO_FILE *);
# 418 "/usr/include/libio.h" 3
extern "C" int __overflow(_IO_FILE *, int);
# 460 "/usr/include/libio.h" 3
extern "C" int _IO_getc(_IO_FILE *);
# 461 "/usr/include/libio.h" 3
extern "C" int _IO_putc(int, _IO_FILE *);
# 462 "/usr/include/libio.h" 3
extern "C" int _IO_feof(_IO_FILE *) throw();
# 463 "/usr/include/libio.h" 3
extern "C" int _IO_ferror(_IO_FILE *) throw();
# 465 "/usr/include/libio.h" 3
extern "C" int _IO_peekc_locked(_IO_FILE *);
# 471 "/usr/include/libio.h" 3
extern "C" void _IO_flockfile(_IO_FILE *) throw();
# 472 "/usr/include/libio.h" 3
extern "C" void _IO_funlockfile(_IO_FILE *) throw();
# 473 "/usr/include/libio.h" 3
extern "C" int _IO_ftrylockfile(_IO_FILE *) throw();
# 490 "/usr/include/libio.h" 3
extern "C" int _IO_vfscanf(_IO_FILE *__restrict__, const char *__restrict__, __gnuc_va_list, int *__restrict__);
# 492 "/usr/include/libio.h" 3
extern "C" int _IO_vfprintf(_IO_FILE *__restrict__, const char *__restrict__, __gnuc_va_list);
# 494 "/usr/include/libio.h" 3
extern "C" __ssize_t _IO_padn(_IO_FILE *, int, __ssize_t);
# 495 "/usr/include/libio.h" 3
extern "C" size_t _IO_sgetn(_IO_FILE *, void *, size_t);
# 497 "/usr/include/libio.h" 3
extern "C" __off64_t _IO_seekoff(_IO_FILE *, __off64_t, int, int);
# 498 "/usr/include/libio.h" 3
extern "C" __off64_t _IO_seekpos(_IO_FILE *, __off64_t, int);
# 500 "/usr/include/libio.h" 3
extern "C" void _IO_free_backup_area(_IO_FILE *) throw();
# 80 "/usr/include/stdio.h" 3
extern "C" { typedef __gnuc_va_list va_list; }
# 111 "/usr/include/stdio.h" 3
extern "C" { typedef _G_fpos_t fpos_t; }
# 117 "/usr/include/stdio.h" 3
extern "C" { typedef _G_fpos64_t fpos64_t; }
# 165 "/usr/include/stdio.h" 3
extern "C" { extern _IO_FILE *stdin; }
# 166 "/usr/include/stdio.h" 3
extern "C" { extern _IO_FILE *stdout; }
# 167 "/usr/include/stdio.h" 3
extern "C" { extern _IO_FILE *stderr; }
# 175 "/usr/include/stdio.h" 3
extern "C" int remove(const char *) throw();
# 177 "/usr/include/stdio.h" 3
extern "C" int rename(const char *, const char *) throw();
# 182 "/usr/include/stdio.h" 3
extern "C" int renameat(int, const char *, int, const char *) throw();
# 192 "/usr/include/stdio.h" 3
extern "C" FILE *tmpfile();
# 202 "/usr/include/stdio.h" 3
extern "C" FILE *tmpfile64();
# 206 "/usr/include/stdio.h" 3
extern "C" char *tmpnam(char *) throw();
# 212 "/usr/include/stdio.h" 3
extern "C" char *tmpnam_r(char *) throw();
# 224 "/usr/include/stdio.h" 3
extern "C" char *tempnam(const char *, const char *) throw() __attribute__((__malloc__));
# 234 "/usr/include/stdio.h" 3
extern "C" int fclose(FILE *);
# 239 "/usr/include/stdio.h" 3
extern "C" int fflush(FILE *);
# 249 "/usr/include/stdio.h" 3
extern "C" int fflush_unlocked(FILE *);
# 259 "/usr/include/stdio.h" 3
extern "C" int fcloseall();
# 269 "/usr/include/stdio.h" 3
extern "C" FILE *fopen(const char *__restrict__, const char *__restrict__);
# 275 "/usr/include/stdio.h" 3
extern "C" FILE *freopen(const char *__restrict__, const char *__restrict__, FILE *__restrict__);
# 294 "/usr/include/stdio.h" 3
extern "C" FILE *fopen64(const char *__restrict__, const char *__restrict__);
# 296 "/usr/include/stdio.h" 3
extern "C" FILE *freopen64(const char *__restrict__, const char *__restrict__, FILE *__restrict__);
# 303 "/usr/include/stdio.h" 3
extern "C" FILE *fdopen(int, const char *) throw();
# 309 "/usr/include/stdio.h" 3
extern "C" FILE *fopencookie(void *__restrict__, const char *__restrict__, _IO_cookie_io_functions_t) throw();
# 316 "/usr/include/stdio.h" 3
extern "C" FILE *fmemopen(void *, size_t, const char *) throw();
# 322 "/usr/include/stdio.h" 3
extern "C" FILE *open_memstream(char **, size_t *) throw();
# 329 "/usr/include/stdio.h" 3
extern "C" void setbuf(FILE *__restrict__, char *__restrict__) throw();
# 333 "/usr/include/stdio.h" 3
extern "C" int setvbuf(FILE *__restrict__, char *__restrict__, int, size_t) throw();
# 340 "/usr/include/stdio.h" 3
extern "C" void setbuffer(FILE *__restrict__, char *__restrict__, size_t) throw();
# 344 "/usr/include/stdio.h" 3
extern "C" void setlinebuf(FILE *) throw();
# 353 "/usr/include/stdio.h" 3
extern "C" int fprintf(FILE *__restrict__, const char *__restrict__, ...);
# 359 "/usr/include/stdio.h" 3
extern "C" int printf(const char *__restrict__, ...);
# 361 "/usr/include/stdio.h" 3
extern "C" int sprintf(char *__restrict__, const char *__restrict__, ...) throw();
# 368 "/usr/include/stdio.h" 3
extern "C" int vfprintf(FILE *__restrict__, const char *__restrict__, __gnuc_va_list);
# 374 "/usr/include/stdio.h" 3
extern "C" int vprintf(const char *__restrict__, __gnuc_va_list);
# 376 "/usr/include/stdio.h" 3
extern "C" int vsprintf(char *__restrict__, const char *__restrict__, __gnuc_va_list) throw();
# 383 "/usr/include/stdio.h" 3
extern "C" int snprintf(char *__restrict__, size_t, const char *__restrict__, ...) throw();
# 387 "/usr/include/stdio.h" 3
extern "C" int vsnprintf(char *__restrict__, size_t, const char *__restrict__, __gnuc_va_list) throw();
# 396 "/usr/include/stdio.h" 3
extern "C" int vasprintf(char **__restrict__, const char *__restrict__, __gnuc_va_list) throw();
# 399 "/usr/include/stdio.h" 3
extern "C" int __asprintf(char **__restrict__, const char *__restrict__, ...) throw();
# 402 "/usr/include/stdio.h" 3
extern "C" int asprintf(char **__restrict__, const char *__restrict__, ...) throw();
# 414 "/usr/include/stdio.h" 3
extern "C" int vdprintf(int, const char *__restrict__, __gnuc_va_list);
# 417 "/usr/include/stdio.h" 3
extern "C" int dprintf(int, const char *__restrict__, ...);
# 427 "/usr/include/stdio.h" 3
extern "C" int fscanf(FILE *__restrict__, const char *__restrict__, ...);
# 433 "/usr/include/stdio.h" 3
extern "C" int scanf(const char *__restrict__, ...);
# 435 "/usr/include/stdio.h" 3
extern "C" int sscanf(const char *__restrict__, const char *__restrict__, ...) throw();
# 473 "/usr/include/stdio.h" 3
extern "C" int vfscanf(FILE *__restrict__, const char *__restrict__, __gnuc_va_list);
# 481 "/usr/include/stdio.h" 3
extern "C" int vscanf(const char *__restrict__, __gnuc_va_list);
# 485 "/usr/include/stdio.h" 3
extern "C" int vsscanf(const char *__restrict__, const char *__restrict__, __gnuc_va_list) throw();
# 533 "/usr/include/stdio.h" 3
extern "C" int fgetc(FILE *);
# 534 "/usr/include/stdio.h" 3
extern "C" int getc(FILE *);
# 540 "/usr/include/stdio.h" 3
extern "C" int getchar();
# 552 "/usr/include/stdio.h" 3
extern "C" int getc_unlocked(FILE *);
# 553 "/usr/include/stdio.h" 3
extern "C" int getchar_unlocked();
# 563 "/usr/include/stdio.h" 3
extern "C" int fgetc_unlocked(FILE *);
# 575 "/usr/include/stdio.h" 3
extern "C" int fputc(int, FILE *);
# 576 "/usr/include/stdio.h" 3
extern "C" int putc(int, FILE *);
# 582 "/usr/include/stdio.h" 3
extern "C" int putchar(int);
# 596 "/usr/include/stdio.h" 3
extern "C" int fputc_unlocked(int, FILE *);
# 604 "/usr/include/stdio.h" 3
extern "C" int putc_unlocked(int, FILE *);
# 605 "/usr/include/stdio.h" 3
extern "C" int putchar_unlocked(int);
# 612 "/usr/include/stdio.h" 3
extern "C" int getw(FILE *);
# 615 "/usr/include/stdio.h" 3
extern "C" int putw(int, FILE *);
# 624 "/usr/include/stdio.h" 3
extern "C" char *fgets(char *__restrict__, int, FILE *__restrict__);
# 632 "/usr/include/stdio.h" 3
extern "C" char *gets(char *);
# 642 "/usr/include/stdio.h" 3
extern "C" char *fgets_unlocked(char *__restrict__, int, FILE *__restrict__);
# 658 "/usr/include/stdio.h" 3
extern "C" __ssize_t __getdelim(char **__restrict__, size_t *__restrict__, int, FILE *__restrict__);
# 661 "/usr/include/stdio.h" 3
extern "C" __ssize_t getdelim(char **__restrict__, size_t *__restrict__, int, FILE *__restrict__);
# 671 "/usr/include/stdio.h" 3
extern "C" __ssize_t getline(char **__restrict__, size_t *__restrict__, FILE *__restrict__);
# 682 "/usr/include/stdio.h" 3
extern "C" int fputs(const char *__restrict__, FILE *__restrict__);
# 688 "/usr/include/stdio.h" 3
extern "C" int puts(const char *);
# 695 "/usr/include/stdio.h" 3
extern "C" int ungetc(int, FILE *);
# 702 "/usr/include/stdio.h" 3
extern "C" size_t fread(void *__restrict__, size_t, size_t, FILE *__restrict__);
# 708 "/usr/include/stdio.h" 3
extern "C" size_t fwrite(const void *__restrict__, size_t, size_t, FILE *__restrict__);
# 719 "/usr/include/stdio.h" 3
extern "C" int fputs_unlocked(const char *__restrict__, FILE *__restrict__);
# 730 "/usr/include/stdio.h" 3
extern "C" size_t fread_unlocked(void *__restrict__, size_t, size_t, FILE *__restrict__);
# 732 "/usr/include/stdio.h" 3
extern "C" size_t fwrite_unlocked(const void *__restrict__, size_t, size_t, FILE *__restrict__);
# 742 "/usr/include/stdio.h" 3
extern "C" int fseek(FILE *, long, int);
# 747 "/usr/include/stdio.h" 3
extern "C" long ftell(FILE *);
# 752 "/usr/include/stdio.h" 3
extern "C" void rewind(FILE *);
# 766 "/usr/include/stdio.h" 3
extern "C" int fseeko(FILE *, __off_t, int);
# 771 "/usr/include/stdio.h" 3
extern "C" __off_t ftello(FILE *);
# 791 "/usr/include/stdio.h" 3
extern "C" int fgetpos(FILE *__restrict__, fpos_t *__restrict__);
# 796 "/usr/include/stdio.h" 3
extern "C" int fsetpos(FILE *, const fpos_t *);
# 811 "/usr/include/stdio.h" 3
extern "C" int fseeko64(FILE *, __off64_t, int);
# 812 "/usr/include/stdio.h" 3
extern "C" __off64_t ftello64(FILE *);
# 813 "/usr/include/stdio.h" 3
extern "C" int fgetpos64(FILE *__restrict__, fpos64_t *__restrict__);
# 814 "/usr/include/stdio.h" 3
extern "C" int fsetpos64(FILE *, const fpos64_t *);
# 819 "/usr/include/stdio.h" 3
extern "C" void clearerr(FILE *) throw();
# 821 "/usr/include/stdio.h" 3
extern "C" int feof(FILE *) throw();
# 823 "/usr/include/stdio.h" 3
extern "C" int ferror(FILE *) throw();
# 828 "/usr/include/stdio.h" 3
extern "C" void clearerr_unlocked(FILE *) throw();
# 829 "/usr/include/stdio.h" 3
extern "C" int feof_unlocked(FILE *) throw();
# 830 "/usr/include/stdio.h" 3
extern "C" int ferror_unlocked(FILE *) throw();
# 839 "/usr/include/stdio.h" 3
extern "C" void perror(const char *);
# 27 "/usr/include/bits/sys_errlist.h" 3
extern "C" { extern int sys_nerr; }
# 28 "/usr/include/bits/sys_errlist.h" 3
extern "C" { extern const char *const sys_errlist[]; }
# 31 "/usr/include/bits/sys_errlist.h" 3
extern "C" { extern int _sys_nerr; }
# 32 "/usr/include/bits/sys_errlist.h" 3
extern "C" { extern const char *const _sys_errlist[]; }
# 851 "/usr/include/stdio.h" 3
extern "C" int fileno(FILE *) throw();
# 856 "/usr/include/stdio.h" 3
extern "C" int fileno_unlocked(FILE *) throw();
# 866 "/usr/include/stdio.h" 3
extern "C" FILE *popen(const char *, const char *);
# 872 "/usr/include/stdio.h" 3
extern "C" int pclose(FILE *);
# 878 "/usr/include/stdio.h" 3
extern "C" char *ctermid(char *) throw();
# 884 "/usr/include/stdio.h" 3
extern "C" char *cuserid(char *);
# 889 "/usr/include/stdio.h" 3
struct obstack;
# 892 "/usr/include/stdio.h" 3
extern "C" int obstack_printf(obstack *__restrict__, const char *__restrict__, ...) throw();
# 895 "/usr/include/stdio.h" 3
extern "C" int obstack_vprintf(obstack *__restrict__, const char *__restrict__, __gnuc_va_list) throw();
# 906 "/usr/include/stdio.h" 3
extern "C" void flockfile(FILE *) throw();
# 910 "/usr/include/stdio.h" 3
extern "C" int ftrylockfile(FILE *) throw();
# 913 "/usr/include/stdio.h" 3
extern "C" void funlockfile(FILE *) throw();
# 45 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
extern "C" { typedef unsigned uint; }
# 46 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
extern "C" { typedef unsigned short ushort; }
# 57 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
typedef
# 53 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
struct __attribute__((__aligned__(8))) {
# 54 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
uint key;
# 55 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
uint value;
# 57 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
} KeyValuePair;
# 60 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort.cuh"
extern "C" void RadixSort(KeyValuePair *, KeyValuePair *, uint, uint);
# 44 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int NUM_SMS = 16;
# 45 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int NUM_THREADS_PER_SM = 192;
# 46 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int NUM_THREADS_PER_BLOCK = 64;
# 48 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int NUM_BLOCKS = ((NUM_THREADS_PER_SM / NUM_THREADS_PER_BLOCK) * NUM_SMS);
# 49 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADIX = 8;
# 50 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADICES = (1 << RADIX);
# 51 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADIXMASK = (RADICES - 1);
# 55 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADIXBITS = 32;
# 57 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADIXTHREADS = 16;
# 58 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int RADIXGROUPS = (NUM_THREADS_PER_BLOCK / RADIXTHREADS);
# 59 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int TOTALRADIXGROUPS = (NUM_BLOCKS * RADIXGROUPS);
# 60 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int SORTRADIXGROUPS = (TOTALRADIXGROUPS * RADICES);
# 61 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int GRFELEMENTS = ((NUM_THREADS_PER_BLOCK / RADIXTHREADS) * RADICES);
# 62 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int GRFSIZE = ((GRFELEMENTS) * sizeof(uint));
# 65 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_NUM_THREADS_PER_SM = NUM_THREADS_PER_SM;
# 66 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_NUM_THREADS_PER_BLOCK = PREFIX_NUM_THREADS_PER_SM;
# 67 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_NUM_BLOCKS = ((PREFIX_NUM_THREADS_PER_SM / PREFIX_NUM_THREADS_PER_BLOCK) * NUM_SMS);
# 68 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_BLOCKSIZE = (SORTRADIXGROUPS / PREFIX_NUM_BLOCKS);
# 69 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_GRFELEMENTS = (PREFIX_BLOCKSIZE + (2 * PREFIX_NUM_THREADS_PER_BLOCK));
# 70 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int PREFIX_GRFSIZE = ((PREFIX_GRFELEMENTS) * sizeof(uint));
# 73 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int SHUFFLE_GRFOFFSET = (RADIXGROUPS * RADICES);
# 74 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int SHUFFLE_GRFELEMENTS = (SHUFFLE_GRFOFFSET + PREFIX_NUM_BLOCKS);
# 75 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static const int SHUFFLE_GRFSIZE = ((SHUFFLE_GRFELEMENTS) * sizeof(uint));
# 81 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
uint gRadixSum[(TOTALRADIXGROUPS * RADICES)];
# 82 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static uint dRadixSum[(TOTALRADIXGROUPS * RADICES)];
# 83 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
uint gRadixBlockSum[PREFIX_NUM_BLOCKS];
# 84 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
static uint dRadixBlockSum[PREFIX_NUM_BLOCKS];
# 86 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
__attribute__((unused)) extern uint sRadixSum[];
# 101 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
void RadixSum(KeyValuePair *pData, uint elements, uint elements_rounded_to_3072, uint shift) ;
# 251 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
void RadixPrefixSum() ;
# 374 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
void RadixAddOffsetsAndShuffle(KeyValuePair *pSrc, KeyValuePair *pDst, uint elements, uint elements_rounded_to_3072, int shift) ;
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c"
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c" 1
# 1 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 1
# 91 "/usr/local/cuda/bin/../include/crt/host_runtime.h"
extern "C" {
extern void** __cudaRegisterFatBinary(
void *fatCubin
);
extern void __cudaUnregisterFatBinary(
void **fatCubinHandle
);
extern void __cudaRegisterVar(
void **fatCubinHandle,
char *hostVar,
char *deviceAddress,
const char *deviceName,
int ext,
int size,
int constant,
int global
);
extern void __cudaRegisterTexture(
void **fatCubinHandle,
const struct textureReference *hostVar,
const void **deviceAddress,
const char *deviceName,
int dim,
int norm,
int ext
);
extern void __cudaRegisterSurface(
void **fatCubinHandle,
const struct surfaceReference *hostVar,
const void **deviceAddress,
const char *deviceName,
int dim,
int ext
);
extern void __cudaRegisterFunction(
void **fatCubinHandle,
const char *hostFun,
char *deviceFun,
const char *deviceName,
int thread_limit,
uint3 *tid,
uint3 *bid,
dim3 *bDim,
dim3 *gDim,
int *wSize
);
extern int atexit(void(*)(void)) throw();
}
static void **__cudaFatCubinHandle;
static void __cudaUnregisterBinaryUtil(void)
{
__cudaUnregisterFatBinary(__cudaFatCubinHandle);
}
# 1 "/usr/local/cuda/bin/../include/common_functions.h" 1
# 90 "/usr/local/cuda/bin/../include/common_functions.h"
# 1 "/usr/local/cuda/bin/../include/math_functions.h" 1 3
# 948 "/usr/local/cuda/bin/../include/math_functions.h" 3
# 1 "/usr/local/cuda/bin/../include/math_constants.h" 1 3
# 949 "/usr/local/cuda/bin/../include/math_functions.h" 2 3
# 2973 "/usr/local/cuda/bin/../include/math_functions.h" 3
# 1 "/usr/local/cuda/bin/../include/crt/func_macro.h" 1 3
# 2974 "/usr/local/cuda/bin/../include/math_functions.h" 2 3
# 4683 "/usr/local/cuda/bin/../include/math_functions.h" 3
extern __attribute__((__weak__)) double rsqrt(double a); double rsqrt(double a)
{
return 1.0 / sqrt(a);
}
extern __attribute__((__weak__)) double rcbrt(double a); double rcbrt(double a)
{
double s, t;
if (__isnan(a)) {
return a + a;
}
if (a == 0.0 || __isinf(a)) {
return 1.0 / a;
}
s = fabs(a);
t = exp2(-3.3333333333333333e-1 * log2(s));
t = ((t*t) * (-s*t) + 1.0) * (3.3333333333333333e-1*t) + t;
if (__signbit(a))
{
t = -t;
}
return t;
}
extern __attribute__((__weak__)) double sinpi(double a); double sinpi(double a)
{
int n;
if (__isnan(a)) {
return a + a;
}
if (a == 0.0 || __isinf(a)) {
return sin (a);
}
if (a == floor(a)) {
return ((a / 1.0e308) / 1.0e308) / 1.0e308;
}
a = remquo (a, 0.5, &n);
a = a * 3.1415926535897931e+0;
if (n & 1) {
a = cos (a);
} else {
a = sin (a);
}
if (n & 2) {
a = -a;
}
return a;
}
extern __attribute__((__weak__)) double erfinv(double a); double erfinv(double a)
{
double p, q, t, fa;
volatile union {
double d;
unsigned long long int l;
} cvt;
fa = fabs(a);
if (fa >= 1.0) {
cvt.l = 0xfff8000000000000ull;
t = cvt.d;
if (fa == 1.0) {
t = a * exp(1000.0);
}
} else if (fa >= 0.9375) {
t = log1p(-fa);
t = 1.0 / sqrt(-t);
p = 2.7834010353747001060e-3;
p = p * t + 8.6030097526280260580e-1;
p = p * t + 2.1371214997265515515e+0;
p = p * t + 3.1598519601132090206e+0;
p = p * t + 3.5780402569085996758e+0;
p = p * t + 1.5335297523989890804e+0;
p = p * t + 3.4839207139657522572e-1;
p = p * t + 5.3644861147153648366e-2;
p = p * t + 4.3836709877126095665e-3;
p = p * t + 1.3858518113496718808e-4;
p = p * t + 1.1738352509991666680e-6;
q = t + 2.2859981272422905412e+0;
q = q * t + 4.3859045256449554654e+0;
q = q * t + 4.6632960348736635331e+0;
q = q * t + 3.9846608184671757296e+0;
q = q * t + 1.6068377709719017609e+0;
q = q * t + 3.5609087305900265560e-1;
q = q * t + 5.3963550303200816744e-2;
q = q * t + 4.3873424022706935023e-3;
q = q * t + 1.3858762165532246059e-4;
q = q * t + 1.1738313872397777529e-6;
t = p / (q * t);
if (a < 0.0) t = -t;
} else if (fa >= 0.75) {
t = a * a - .87890625;
p = .21489185007307062000e+0;
p = p * t - .64200071507209448655e+1;
p = p * t + .29631331505876308123e+2;
p = p * t - .47644367129787181803e+2;
p = p * t + .34810057749357500873e+2;
p = p * t - .12954198980646771502e+2;
p = p * t + .25349389220714893917e+1;
p = p * t - .24758242362823355486e+0;
p = p * t + .94897362808681080020e-2;
q = t - .12831383833953226499e+2;
q = q * t + .41409991778428888716e+2;
q = q * t - .53715373448862143349e+2;
q = q * t + .33880176779595142685e+2;
q = q * t - .11315360624238054876e+2;
q = q * t + .20369295047216351160e+1;
q = q * t - .18611650627372178511e+0;
q = q * t + .67544512778850945940e-2;
p = p / q;
t = a * p;
} else {
t = a * a - .5625;
p = - .23886240104308755900e+2;
p = p * t + .45560204272689128170e+3;
p = p * t - .22977467176607144887e+4;
p = p * t + .46631433533434331287e+4;
p = p * t - .43799652308386926161e+4;
p = p * t + .19007153590528134753e+4;
p = p * t - .30786872642313695280e+3;
q = t - .83288327901936570000e+2;
q = q * t + .92741319160935318800e+3;
q = q * t - .35088976383877264098e+4;
q = q * t + .59039348134843665626e+4;
q = q * t - .48481635430048872102e+4;
q = q * t + .18997769186453057810e+4;
q = q * t - .28386514725366621129e+3;
p = p / q;
t = a * p;
}
return t;
}
extern __attribute__((__weak__)) double erfcinv(double a); double erfcinv(double a)
{
double t;
volatile union {
double d;
unsigned long long int l;
} cvt;
if (__isnan(a)) {
return a + a;
}
if (a <= 0.0) {
cvt.l = 0xfff8000000000000ull;
t = cvt.d;
if (a == 0.0) {
t = (1.0 - a) * exp(1000.0);
}
}
else if (a >= 0.0625) {
t = erfinv (1.0 - a);
}
else if (a >= 1e-100) {
double p, q;
t = log(a);
t = 1.0 / sqrt(-t);
p = 2.7834010353747001060e-3;
p = p * t + 8.6030097526280260580e-1;
p = p * t + 2.1371214997265515515e+0;
p = p * t + 3.1598519601132090206e+0;
p = p * t + 3.5780402569085996758e+0;
p = p * t + 1.5335297523989890804e+0;
p = p * t + 3.4839207139657522572e-1;
p = p * t + 5.3644861147153648366e-2;
p = p * t + 4.3836709877126095665e-3;
p = p * t + 1.3858518113496718808e-4;
p = p * t + 1.1738352509991666680e-6;
q = t + 2.2859981272422905412e+0;
q = q * t + 4.3859045256449554654e+0;
q = q * t + 4.6632960348736635331e+0;
q = q * t + 3.9846608184671757296e+0;
q = q * t + 1.6068377709719017609e+0;
q = q * t + 3.5609087305900265560e-1;
q = q * t + 5.3963550303200816744e-2;
q = q * t + 4.3873424022706935023e-3;
q = q * t + 1.3858762165532246059e-4;
q = q * t + 1.1738313872397777529e-6;
t = p / (q * t);
}
else {
double p, q;
t = log(a);
t = 1.0 / sqrt(-t);
p = 6.9952990607058154858e-1;
p = p * t + 1.9507620287580568829e+0;
p = p * t + 8.2810030904462690216e-1;
p = p * t + 1.1279046353630280005e-1;
p = p * t + 6.0537914739162189689e-3;
p = p * t + 1.3714329569665128933e-4;
p = p * t + 1.2964481560643197452e-6;
p = p * t + 4.6156006321345332510e-9;
p = p * t + 4.5344689563209398450e-12;
q = t + 1.5771922386662040546e+0;
q = q * t + 2.1238242087454993542e+0;
q = q * t + 8.4001814918178042919e-1;
q = q * t + 1.1311889334355782065e-1;
q = q * t + 6.0574830550097140404e-3;
q = q * t + 1.3715891988350205065e-4;
q = q * t + 1.2964671850944981713e-6;
q = q * t + 4.6156017600933592558e-9;
q = q * t + 4.5344687377088206783e-12;
t = p / (q * t);
}
return t;
}
extern __attribute__((__weak__)) float rsqrtf(float a); float rsqrtf(float a)
{
return (float)rsqrt((double)a);
}
extern __attribute__((__weak__)) float rcbrtf(float a); float rcbrtf(float a)
{
return (float)rcbrt((double)a);
}
extern __attribute__((__weak__)) float sinpif(float a); float sinpif(float a)
{
return (float)sinpi((double)a);
}
extern __attribute__((__weak__)) float erfinvf(float a); float erfinvf(float a)
{
return (float)erfinv((double)a);
}
extern __attribute__((__weak__)) float erfcinvf(float a); float erfcinvf(float a)
{
return (float)erfcinv((double)a);
}
extern __attribute__((__weak__)) int min(int a, int b); int min(int a, int b)
{
return a < b ? a : b;
}
extern __attribute__((__weak__)) unsigned int umin(unsigned int a, unsigned int b); unsigned int umin(unsigned int a, unsigned int b)
{
return a < b ? a : b;
}
extern __attribute__((__weak__)) long long int llmin(long long int a, long long int b); long long int llmin(long long int a, long long int b)
{
return a < b ? a : b;
}
extern __attribute__((__weak__)) unsigned long long int ullmin(unsigned long long int a, unsigned long long int b); unsigned long long int ullmin(unsigned long long int a, unsigned long long int b)
{
return a < b ? a : b;
}
extern __attribute__((__weak__)) int max(int a, int b); int max(int a, int b)
{
return a > b ? a : b;
}
extern __attribute__((__weak__)) unsigned int umax(unsigned int a, unsigned int b); unsigned int umax(unsigned int a, unsigned int b)
{
return a > b ? a : b;
}
extern __attribute__((__weak__)) long long int llmax(long long int a, long long int b); long long int llmax(long long int a, long long int b)
{
return a > b ? a : b;
}
extern __attribute__((__weak__)) unsigned long long int ullmax(unsigned long long int a, unsigned long long int b); unsigned long long int ullmax(unsigned long long int a, unsigned long long int b)
{
return a > b ? a : b;
}
# 5006 "/usr/local/cuda/bin/../include/math_functions.h" 3
# 1 "/usr/local/cuda/bin/../include/math_functions_dbl_ptx3.h" 1 3
# 5007 "/usr/local/cuda/bin/../include/math_functions.h" 2 3
# 91 "/usr/local/cuda/bin/../include/common_functions.h" 2
# 164 "/usr/local/cuda/bin/../include/crt/host_runtime.h" 2
#pragma pack()
# 2 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c" 2
# 1 "/tmp/tmpxft_00000a86_00000000-3_radixsort_kernel.fatbin.c" 1
# 1 "/usr/local/cuda/bin/../include/__cudaFatFormat.h" 1
# 83 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
extern "C" {
# 97 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef struct {
char* gpuProfileName;
char* cubin;
} __cudaFatCubinEntry;
# 113 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef struct {
char* gpuProfileName;
char* ptx;
} __cudaFatPtxEntry;
# 125 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef struct __cudaFatDebugEntryRec {
char* gpuProfileName;
char* debug;
struct __cudaFatDebugEntryRec *next;
unsigned int size;
} __cudaFatDebugEntry;
typedef struct __cudaFatElfEntryRec {
char* gpuProfileName;
char* elf;
struct __cudaFatElfEntryRec *next;
unsigned int size;
} __cudaFatElfEntry;
typedef enum {
__cudaFatDontSearchFlag = (1 << 0),
__cudaFatDontCacheFlag = (1 << 1),
__cudaFatSassDebugFlag = (1 << 2)
} __cudaFatCudaBinaryFlag;
# 152 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef struct {
char* name;
} __cudaFatSymbol;
# 166 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef struct __cudaFatCudaBinaryRec {
unsigned long magic;
unsigned long version;
unsigned long gpuInfoVersion;
char* key;
char* ident;
char* usageMode;
__cudaFatPtxEntry *ptx;
__cudaFatCubinEntry *cubin;
__cudaFatDebugEntry *debug;
void* debugInfo;
unsigned int flags;
__cudaFatSymbol *exported;
__cudaFatSymbol *imported;
struct __cudaFatCudaBinaryRec *dependends;
unsigned int characteristic;
__cudaFatElfEntry *elf;
} __cudaFatCudaBinary;
# 203 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
typedef enum {
__cudaFatAvoidPTX,
__cudaFatPreferBestCode,
__cudaFatForcePTX
} __cudaFatCompilationPolicy;
# 227 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
void fatGetCubinForGpuWithPolicy( __cudaFatCudaBinary *binary, __cudaFatCompilationPolicy policy, char* gpuName, char* *cubin, char* *dbgInfoFile );
# 240 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
unsigned char fatCheckJitForGpuWithPolicy( __cudaFatCudaBinary *binary, __cudaFatCompilationPolicy policy, char* gpuName, char* *ptx );
# 250 "/usr/local/cuda/bin/../include/__cudaFatFormat.h"
void fatFreeCubin( char* cubin, char* dbgInfoFile );
void __cudaFatFreePTX( char* ptx );
}
# 2 "/tmp/tmpxft_00000a86_00000000-3_radixsort_kernel.fatbin.c" 2
asm(
".section .rodata\n"
".align 32\n"
"__deviceText_$sm_21$:\n"
".quad 0x33010102464c457f,0x0000000000000004,0x0000000100be0002,0x0000000000000000\n"
".quad 0x000000000000254c,0x0000000000000040,0x0038004000140115,0x0001001300400006\n"
".quad 0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0x0000000300000001,0x0000000000000000,0x0000000000000000,0x0000000000000500\n"
".quad 0x000000000000024c,0x0000000000000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x000000030000000b,0x0000000000000000,0x0000000000000000,0x000000000000074c\n"
".quad 0x000000000000007f,0x0000000000000000,0x0000000000000001,0x0000000000000000\n"
".quad 0x0000000200000013,0x0000000000000000,0x0000000000000000,0x00000000000007cb\n"
".quad 0x0000000000000258,0x0000001400000002,0x0000000000000001,0x0000000000000018\n"
".quad 0x00000001000000eb,0x0000000000100006,0x0000000000000000,0x0000000000000a23\n"
".quad 0x0000000000000918,0x1400000b00000003,0x0000000000000004,0x0000000000000000\n"
".quad 0x00000001000001fe,0x0000000000000002,0x0000000000000000,0x000000000000133b\n"
".quad 0x0000000000000034,0x0000000400000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x000000010000010f,0x0000000000000002,0x0000000000000000,0x000000000000136f\n"
".quad 0x0000000000000070,0x0000000400000000,0x0000000000000001,0x0000000000000000\n"
".quad 0x00000001000000b4,0x0000000000100006,0x0000000000000000,0x00000000000013df\n"
".quad 0x0000000000000448,0x0e00000900000003,0x0000000000000004,0x0000000000000000\n"
".quad 0x00000001000001dc,0x0000000000000002,0x0000000000000000,0x0000000000001827\n"
".quad 0x0000000000000020,0x0000000700000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x00000001000001b9,0x0000000000000002,0x0000000000000000,0x0000000000001847\n"
".quad 0x0000000000000004,0x0000000700000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x00000001000000ce,0x0000000000000002,0x0000000000000000,0x000000000000184b\n"
".quad 0x0000000000000018,0x0000000700000000,0x0000000000000001,0x0000000000000000\n"
".quad 0x0000000100000036,0x0000000000100006,0x0000000000000000,0x0000000000001863\n"
".quad 0x0000000000000bb0,0x1500000600000003,0x0000000000000004,0x0000000000000000\n"
".quad 0x0000000100000178,0x0000000000000002,0x0000000000000000,0x0000000000002413\n"
".quad 0x000000000000003c,0x0000000b00000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x0000000100000136,0x0000000000000002,0x0000000000000000,0x000000000000244f\n"
".quad 0x0000000000000008,0x0000000b00000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x000000010000006f,0x0000000000000002,0x0000000000000000,0x0000000000002457\n"
".quad 0x0000000000000084,0x0000000b00000000,0x0000000000000001,0x0000000000000000\n"
".quad 0x000000010000022a,0x0000000000000002,0x0000000000000000,0x00000000000024db\n"
".quad 0x0000000000000008,0x0000000000000000,0x0000000000000008,0x0000000000000000\n"
".quad 0x0000000900000239,0x0000000000000000,0x0000000000000000,0x00000000000024e3\n"
".quad 0x0000000000000020,0x0000000f00000003,0x0000000000000004,0x0000000000000010\n"
".quad 0x000000080000002b,0x0000000000000003,0x0000000000000000,0x0000000000002503\n"
".quad 0x0000000000030040,0x0000000000000000,0x0000000000000004,0x0000000000000000\n"
".quad 0x00000001000000ab,0x0000000000000002,0x0000000000000000,0x0000000000002503\n"
".quad 0x0000000000000048,0x0000000000000000,0x0000000000000001,0x0000000000000000\n"
".quad 0x7472747368732e00,0x747274732e006261,0x746d79732e006261,0x672e766e2e006261\n"
".quad 0x6e692e6c61626f6c,0x672e766e2e007469,0x742e006c61626f6c,0x35325a5f2e747865\n"
".quad 0x6464417869646152,0x417374657366664f,0x6c6666756853646e,0x5679654b32315065\n"
".quad 0x7269615065756c61,0x2e00696a6a5f3053,0x2e6f666e692e766e,0x6964615235325a5f\n"
".quad 0x7366664f64644178,0x6853646e41737465,0x323150656c666675,0x65756c615679654b\n"
".quad 0x6a5f305372696150,0x692e766e2e00696a,0x7865742e006f666e,0x615234315a5f2e74\n"
".quad 0x6966657250786964,0x6e2e00766d755378,0x5f2e6f666e692e76,0x786964615234315a\n"
".quad 0x7553786966657250,0x747865742e00766d,0x69646152385a5f2e,0x4b3231506d755378\n"
".quad 0x5065756c61567965,0x2e006a6a6a726961,0x2e6f666e692e766e,0x7869646152385a5f\n"
".quad 0x654b3231506d7553,0x615065756c615679,0x6e2e006a6a6a7269,0x6174736e6f632e76\n"
".quad 0x325a5f2e3631746e,0x6441786964615235,0x7374657366664f64,0x6666756853646e41\n"
".quad 0x79654b323150656c,0x69615065756c6156,0x00696a6a5f305372,0x736e6f632e766e2e\n"
".quad 0x5a5f2e30746e6174,0x4178696461523532,0x74657366664f6464,0x66756853646e4173\n"
".quad 0x654b323150656c66,0x615065756c615679,0x696a6a5f30537269,0x6e6f632e766e2e00\n"
".quad 0x2e3631746e617473,0x6964615234315a5f,0x5378696665725078,0x2e766e2e00766d75\n"
".quad 0x746e6174736e6f63,0x615234315a5f2e30,0x6966657250786964,0x6e2e00766d755378\n"
".quad 0x6174736e6f632e76,0x52385a5f2e30746e,0x506d755378696461,0x6c615679654b3231\n"
".quad 0x6a6a726961506575,0x6f632e766e2e006a,0x3431746e6174736e,0x766e2e6c65722e00\n"
".quad 0x6e6174736e6f632e,0x325a5f0000343174,0x6441786964615235,0x7374657366664f64\n"
".quad 0x6666756853646e41,0x79654b323150656c,0x69615065756c6156,0x00696a6a5f305372\n"
".quad 0x6964615234315a5f,0x5378696665725078,0x52385a5f00766d75,0x506d755378696461\n"
".quad 0x6c615679654b3231,0x6a6a726961506575,0x786964615264006a,0x6d75536b636f6c42\n"
".quad 0x5378696461526400,0x0000000000006d75,0x0000000000000000,0x0000000000000000\n"
".quad 0x0300000000000000,0x0000000000000100,0x0000000000000000,0x0300000000000000\n"
".quad 0x0000000000000200,0x0000000000000000,0x0300000000000000,0x0000000000000300\n"
".quad 0x0000000000000000,0x0300000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0x0300000000000000,0x0000000000001100,0x0000000000000000,0x0300000000000000\n"
".quad 0x0000000000000b00,0x0000000bb0000000,0x0300000000000000,0x0000000000000e00\n"
".quad 0x0000000000000000,0x0300000000000000,0x0000000000001200,0x0000000000000000\n"
".quad 0x0300000000000000,0x0000000000000700,0x0000000448000000,0x0300000000000000\n"
".quad 0x0000000000000a00,0x0000000000000000,0x0300000000000000,0x0000000000000400\n"
".quad 0x0000000918000000,0x0300000000000000,0x0000000000000600,0x0000000000000000\n"
".quad 0x0300000000000000,0x0000000000000d00,0x0000000000000000,0x0300000000000000\n"
".quad 0x0000000000000c00,0x0000000000000000,0x0300000000000000,0x0000000000000900\n"
".quad 0x0000000000000000,0x0300000000000000,0x0000000000000800,0x0000000000000000\n"
".quad 0x0300000000000000,0x0000000000000500,0x0000000000000000,0x0300000000000000\n"
".quad 0x0000000000000f00,0x0000000000000000,0x0300000000000000,0x0000000000001000\n"
".quad 0x0000000000000000,0x1200000001000000,0x0000000000000b10,0x0000000bb0000000\n"
".quad 0x1200000034000000,0x0000000000000710,0x0000000448000000,0x1200000048000000\n"
".quad 0x0000000000000410,0x0000000918000000,0x1100000066000000,0x0000000000001100\n"
".quad 0x0000000040000000,0x1100000075000000,0x0000000040001100,0x0000030000000000\n"
".quad 0x0400005de4000000,0x0084001c04280044,0x0ffc01dc032c0000,0x03000000071a0ec0\n"
".quad 0x0000009de4600000,0x02a00001e7280000,0x030000dc03400000,0x0008011e034800c0\n"
".quad 0x0ffc31dc036000c0,0x01800021e7198ec0,0x0140000007400000,0x0400209c03600000\n"
".quad 0x00004fdc854800c0,0x030020dc03c90000,0x04004fdc854800c0,0x08004fdc85c90000\n"
".quad 0x0ffc31dc03c90000,0x0c004fdc85198ec0,0x1000411c03c90000,0xfee00001e74800c0\n"
".quad 0x0ffc21dc134003ff,0x00a00021e7198ec0,0x0100209c03400000,0x00004fdc854800c0\n"
".quad 0x0ffc21dc03c90000,0x0400411c03198ec0,0xff600001e74800c0,0x0000001df44003ff\n"
".quad 0x00ffffdc04400000,0xaaac00dde250ee00,0x0094009c041aaaaa,0x0010011c032c0000\n"
".quad 0x00b030dc435800c0,0x0008215e03500040,0x003c009c036000c0,0x001c30dc036800c0\n"
".quad 0x0014419c035800c0,0x1aa0000007480000,0x001831dc03600000,0x0018319c03200400\n"
".quad 0x001871dc03200600,0x1a000001e71b0e00,0x00142bdc03400000,0x00fc21dc03190ec0\n"
".quad 0x001c521c04190e00,0x000423dc03080e00,0x00182bdc03190ec0,0x000825dc03190ec0\n"
".quad 0x001c525c04190ec0,0x000c27dc03080e00,0x001c2bdc03190ec0,0x001029dc03190ec0\n"
".quad 0x001c529c04190ec0,0x00202bdc03080e00,0x001c52dc04190ec0,0x00242bdc03080e00\n"
".quad 0x001c531c04190ec0,0x00282bdc03080e00,0x001c535c04190ec0,0x002c2bdc03080e00\n"
".quad 0x001c539c04190ec0,0x00302bdc03080e00,0x001c53dc04190ec0,0x00342bdc03080e00\n"
".quad 0x001c541c04190ec0,0x00382bdc03080e00,0x001c545c04190ec0,0x003c2bdc03080e00\n"
".quad 0x001c549c04190ec0,0x00a07bdc03080e00,0x008000b5e7188e40,0x00800095e4400000\n"
".quad 0x0020709403280040,0x0093f0d4432005c0,0x0000209485480040,0x00005ddc04840000\n"
".quad 0x00fc00b5e40c0e00,0x00e000b9e7280000,0x00c020d803400000,0x03fc30d803580040\n"
".quad 0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0,0x000534d803c10000\n"
".quad 0x000034d8854800c0,0x00ffffdc04c90000,0x00045ddc0450ee00,0x00e000b9e70c0e00\n"
".quad 0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000\n"
".quad 0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000\n"
".quad 0x00085ddc0450ee00,0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040\n"
".quad 0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0,0x000534d803c10000\n"
".quad 0x000034d8854800c0,0x00ffffdc04c90000,0x000c5ddc0450ee00,0x00e000b9e70c0e00\n"
".quad 0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000\n"
".quad 0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000\n"
".quad 0x00105ddc0450ee00,0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040\n"
".quad 0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0,0x000534d803c10000\n"
".quad 0x000034d8854800c0,0x00ffffdc04c90000,0x00fc8ddc0350ee00,0x00185ddc041a8e00\n"
".quad 0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0\n"
".quad 0x000830da03400000,0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0\n"
".quad 0x00ffffdc04c90000,0x00fc9ddc0350ee00,0x00185ddc041a8e00,0x00e000b9e70c0e00\n"
".quad 0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000\n"
".quad 0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000\n"
".quad 0x00fcaddc0350ee00,0x00185ddc041a8e00,0x00e000b9e70c0e00,0x00c020d803400000\n"
".quad 0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0\n"
".quad 0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000,0x00fcbddc0350ee00\n"
".quad 0x00185ddc041a8e00,0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040\n"
".quad 0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0,0x000534d803c10000\n"
".quad 0x000034d8854800c0,0x00ffffdc04c90000,0x00fccddc0350ee00,0x00185ddc041a8e00\n"
".quad 0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0\n"
".quad 0x000830da03400000,0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0\n"
".quad 0x00ffffdc04c90000,0x00fcdddc0350ee00,0x00185ddc041a8e00,0x00e000b9e70c0e00\n"
".quad 0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000\n"
".quad 0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000\n"
".quad 0x00fceddc0350ee00,0x00185ddc041a8e00,0x00e000b9e70c0e00,0x00c020d803400000\n"
".quad 0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0\n"
".quad 0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000,0x00fcfddc0350ee00\n"
".quad 0x00185ddc041a8e00,0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040\n"
".quad 0x001030d8436800c0,0x000830da03400000,0x000034d8856000c0,0x000534d803c10000\n"
".quad 0x000034d8854800c0,0x00ffffdc04c90000,0x00fd0ddc0350ee00,0x00185ddc041a8e00\n"
".quad 0x00e000b9e70c0e00,0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0\n"
".quad 0x000830da03400000,0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0\n"
".quad 0x00ffffdc04c90000,0x00fd1ddc0350ee00,0x00185ddc041a8e00,0x00e000b9e70c0e00\n"
".quad 0x00c020d803400000,0x03fc30d803580040,0x001030d8436800c0,0x000830da03400000\n"
".quad 0x000034d8856000c0,0x000534d803c10000,0x000034d8854800c0,0x00ffffdc04c90000\n"
".quad 0x00fd2ddc0350ee00,0x00185bdc041a8e00,0x00e000b5e70c0e00,0x00c0209403400000\n"
".quad 0x03fc209403580040,0x00102094436800c0,0x000820d603400000,0x00003094856000c0\n"
".quad 0x0004209403c10000,0x00003094854800c0,0x00ffffdc04c90000,0x004071dc0350ee00\n"
".quad 0x001c6bdc034800c0,0xe9600015e71a0e00,0x000800dc134003ff,0x03fc31dc035800c0\n"
".quad 0x00000001e71a0ec0,0x0008309e03800000,0x0300311c036000c0,0x000c00dc03200ac0\n"
".quad 0x0100219c036800c0,0x0010301c034800c0,0x0ff061dc03480000,0x000830dc03198ec0\n"
".quad 0x02c00021e7480000,0x0280000007400000,0x0008315e03600000,0x0000029de46000c0\n"
".quad 0x0010019c43280078,0x0000521c855000c0,0x0010011c03c10000,0x0400525c852015c0\n"
".quad 0x300001dc03c10000,0x0200209c034800c0,0x001bf15c434800c0,0x020030dc03480000\n"
".quad 0x0010719c034800c0,0x6000001c032015c0,0x001071dc434800c0,0x0100229c035000c0\n"
".quad 0x001ff1dc434800c0,0x0ff0a1dc03480000,0x0000421c85198ec0,0x0000625c85940000\n"
".quad 0xfda00001e7940000,0x0ff021dc134003ff,0x00000021e7198ec0,0x0008309e03800000\n"
".quad 0x0000011de46000c0,0x001000dc43280078,0x0000209c855000c0,0x0010011c03c10000\n"
".quad 0x000ff15c432009c0,0x0000409c85480000,0x0000001de7940000,0x0000000000800000\n"
".quad 0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0x0000000000000000,0x0400000000000000,0x080000000000100c,0x100000000c000000\n"
".quad 0x1100080a04000000,0x0300140020000000,0xff000c1704001419,0x0000100003ffffff\n"
".quad 0xff000c17040011f0,0x00000c0002ffffff,0xff000c17040011f0,0x0000080001ffffff\n"
".quad 0xff000c17040011f0,0x0000000000ffffff,0x9800080d040021f0,0xe400000020002201\n"
".quad 0x042800440400005d,0x432c00000084001c,0x04500040000400dc,0x032c00000094009c\n"
".quad 0x035800c0001c311c,0x035800c00010019c,0x835000c0300020dc,0x034000000010215c\n"
".quad 0x032000c00300411e,0x034800c03000321c,0x072008c00300511c,0x0360000003a00000\n"
".quad 0x036800c0003c015c,0xe4198e00001081dc,0x032800000010025d,0xf4200ac00044615c\n"
".quad 0x0340000000000001,0xe44800c00300419c,0x432800780000029d,0x035000c0001041dc\n"
".quad 0x031a0e00001881dc,0x032015c00010419c,0x436000c00008535e,0xe7480000001ff1dc\n"
".quad 0x0740000001c00021,0x0360000001800000,0x854800c00600925c,0x038400000000629c\n"
".quad 0x854800c00300931c,0x038400000c0062dc,0x031a0e00003081dc,0x434801c01800619c\n"
".quad 0x8548000000fc71dc,0x85c900000000d29c,0x03c900000cc0d2dc,0xe74800c01980d35c\n"
".quad 0x134003fffea00001,0xf41a0e00002481dc,0x8540000000000021,0x958400000000619c\n"
".quad 0x04c900000000d19c,0x0350ee0000ffffdc,0x075000c0004401dc,0x0360000001c00000\n"
".quad 0xe44800c00040719c,0x03280000001c021d,0xe71a0e00001c61dc,0x0340000001200021\n"
".quad 0xe46000c0000872de,0x0328000000fc025d,0x854800c00004821c,0x03c100000000b29c\n"
".quad 0x031a8e00001883dc,0x854800000024a25c,0x03c900000000b25c,0xe74800c00010b2dc\n"
".quad 0xf44003ffff200005,0x044000000000001d,0x0350ee0000ffffdc,0x856000c00008721e\n"
".quad 0x85c1000000f0825c,0x04c900000100825c,0xe250ee0000ffffdc,0x031800000044025d\n"
".quad 0x034800000024729d,0x234800c00040a2dc,0x03198e0000fcb3dc,0x856000c00008a2e6\n"
".quad 0xe4c100000100b2a4,0x0428000000fc0285,0x8550ee0000ffffdc,0x03c10000010082dc\n"
".quad 0x854800000028b29c,0x04c900000100829c,0x0350ee0000ffffdc,0x236000c00004925e\n"
".quad 0xe7198ec032fc93dc,0x034003fffe400005,0x074800fffffc725c,0x2360000001800000\n"
".quad 0x85198e0000fc93dc,0xe4c103fffff08264,0xe728000000fc0245,0x0340000000e00021\n"
".quad 0x854800c0000471dc,0x03c100000000829c,0x031a8e00001871dc,0x854800000024a29c\n"
".quad 0x03c900000000829c,0xe74800c00010821c,0xf44003ffff200001,0x044000000000001d\n"
".quad 0x0350ee0000ffffdc,0x034000c00400219d,0x034800c00004421c,0x035800c00010619c\n"
".quad 0x075000c00300619c,0x0360000003400000,0xf4198e00002061dc,0x0340000000000001\n"
".quad 0xe44800c00300811c,0x432800780000025d,0x035000c0001081dc,0x031a0e00001061dc\n"
".quad 0x032013c00010811c,0x436000c0000852de,0xe7480000001ff15c,0x0740000001c00021\n"
".quad 0x0360000001800000,0x854800c00600821c,0x85c100000000b1dc,0x03c100000cc0b25c\n"
".quad 0x034800c00300829c,0x034800c01980b2dc,0x851a0e00002861dc,0x85940000000041dc\n"
".quad 0x039400000c00425c,0x434801c01800411c,0xe748000000fc515c,0x134003fffea00001\n"
".quad 0xf41a0e00002061dc,0x8540000000000021,0x95c100000000b19c,0x039400000000419c\n"
".quad 0xe71a8e0000fc01dc,0xe280000000000001,0x851800000010015d,0x43c10000cbf3f01c\n"
".quad 0x035000c00010211c,0x43200bb80010219c,0x435000c00010309c,0x034800000013f1dc\n"
".quad 0x43200bb80000311c,0x85480000000bf15c,0x859400000000601c,0xe794000000004fdc\n"
".quad 0x008000000000001d,0x0000000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0xab00000000000000,0x1000080a04aaaaaa,0x0400200000000000,0x200022019800080d\n"
".quad 0x0400005de4000000,0x0084001c04280044,0x00fc01dc032c0000,0x4003ffe0851a8e00\n"
".quad 0x003801dc03c90000,0x00c00081e71a0ec0,0x000800e203400000,0x001000a0436000c0\n"
".quad 0x00103120035000c0,0x00fc216043480178,0x000040a085480000,0x401030a085840000\n"
".quad 0x00ffffdc04c90000,0x003c01dc2350ee00,0x0004009de2198ec0,0x000800dd03180000\n"
".quad 0x00fc33dc23480000,0x00083106031b0000,0x400040c4856000c0,0x00fc00e5e4c10000\n"
".quad 0x00ffffdc04280000,0x008000a1e750ee00,0x0008014203400000,0x40005100856000c0\n"
".quad 0x000c40c003c10000,0x400050c085480000,0x00ffffdc04c90000,0x0004209e0350ee00\n"
".quad 0x003c23dc236000c0,0xfe200005e7198ec0,0x0008011c034003ff,0x000c00dc035800c0\n"
".quad 0x000c41dc436800c0,0x0094009c04400000,0x00c0411c032c0000,0x0ffc71dc232004c0\n"
".quad 0x000c419c431a0ec0,0x0660000007400000,0x00000001f4600000,0x010070dc03400000\n"
".quad 0x0000011de44800c0,0x0010615ce3280078,0x0ffc31dc235000c0,0x0010611ca3198ec0\n"
".quad 0x000870de032009c0,0x0017f15c436000c0,0x04000021e7480000,0x03c0000007400000\n"
".quad 0x0019229ec4600000,0x0000425c851c0000,0x0014a29c43840000,0xc000421c85500040\n"
".quad 0x002ca29c23840000,0x3000631c035800c0,0x002922df844800c0,0x020071dc031c0000\n"
".quad 0x0028b29c234800c0,0x8000411c03308c00,0x003122dec44801c1,0x0008a29e031c0000\n"
".quad 0x0014b2dc436000c0,0x4000a29c85500040,0x002cb2dc23c10000,0x6000619c035800c0\n"
".quad 0x002d235f844800c0,0x00fc515c431c0000,0x002cd2dc23480000,0x0028925c03309800\n"
".quad 0x0008b29e03480000,0x0000325c856000c0,0x0100725c03c90000,0x4000a29c854800c0\n"
".quad 0x0ffc91dc23c10000,0x0028821c03198ec0,0x0400321c85480000,0x080030dc03c90000\n"
".quad 0xfc600001e74800c0,0x0ffc71dc334003ff,0x00000021f4198ec0,0x0000415c85400000\n"
".quad 0x001921dec4840000,0x001471dc431c0000,0x002c711c23500040,0x001121df845800c0\n"
".quad 0x0010711c231c0000,0x0008411e03308c00,0x4000411c856000c0,0x0010511c03c10000\n"
".quad 0x0000311c95480000,0x00ffffdc04c90000,0x00ffffdc0450ee00,0xaaac00dde250ee00\n"
".quad 0x0010011c031aaaaa,0x00d030dc435800c0,0x0010215c43500040,0x003c009c03400000\n"
".quad 0x001c30dc036800c0,0x0014301c035800c0,0x0014315c03200400,0x001401dc03200600\n"
".quad 0x00000001e71b0e00,0x00142bdc23800000,0x00fc21dc23190ec0,0x001c519c04190e00\n"
".quad 0x00182bdc23080e00,0x000423dc23190ec0,0x001c51dc04190ec0,0x000825dc23080e00\n"
".quad 0x001c2bdc23190ec0,0x000c27dc23190ec0,0x001c521c04190ec0,0x001029dc23080e00\n"
".quad 0x00202bdc23190ec0,0x001c525c04190ec0,0x00242bdc23080e00,0x001c531c04190ec0\n"
".quad 0x00282bdc23080e00,0x001c535c04190ec0,0x002c2bdc23080e00,0x001c539c04190ec0\n"
".quad 0x00302bdc23080e00,0x001c53dc04190ec0,0x00342bdc23080e00,0x001c541c04190ec0\n"
".quad 0x00382bdc23080e00,0x001c545c04190ec0,0x003c2bdc23080e00,0x001c549c04190ec0\n"
".quad 0x00c00bdc03080e00,0x008000b5e7188e40,0x00800095e4400000,0x0020029403280040\n"
".quad 0x0093f2d4432005c0,0x0000a094a5480040,0x00005ddc04840000,0x00fc00b5e40c0e00\n"
".quad 0x016000b9e7280000,0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0\n"
".quad 0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000\n"
".quad 0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000\n"
".quad 0x00ffffdc04940000,0x00045ddc0450ee00,0x016000b9e70c0e00,0x00e0229803400000\n"
".quad 0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000,0x00a00299e46000c0\n"
".quad 0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0,0x00b3f2d8434800c0\n"
".quad 0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000,0x00085ddc0450ee00\n"
".quad 0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0\n"
".quad 0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000\n"
".quad 0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000\n"
".quad 0x00ffffdc04940000,0x000c5ddc0450ee00,0x016000b9e70c0e00,0x00e0229803400000\n"
".quad 0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000,0x000132d8856000c0\n"
".quad 0x00a00299e4c10000,0x0004b51803280040,0x0020b298034800c0,0x00013518852015c0\n"
".quad 0x00b3f2d843c90000,0x0000a098a5480040,0x00ffffdc04940000,0x00105ddc0450ee00\n"
".quad 0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0\n"
".quad 0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000\n"
".quad 0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000\n"
".quad 0x00ffffdc04940000,0x00fc6ddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00\n"
".quad 0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000\n"
".quad 0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0\n"
".quad 0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000\n"
".quad 0x00fc7ddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00,0x00e0229803400000\n"
".quad 0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000,0x00a00299e46000c0\n"
".quad 0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0,0x00b3f2d8434800c0\n"
".quad 0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000,0x00fc8ddc0350ee00\n"
".quad 0x00185ddc041a8e00,0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040\n"
".quad 0x0010a298436800c0,0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040\n"
".quad 0x0020b29803c10000,0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040\n"
".quad 0x0000a098a5c90000,0x00ffffdc04940000,0x00fc9ddc0350ee00,0x00185ddc041a8e00\n"
".quad 0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0\n"
".quad 0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000\n"
".quad 0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000\n"
".quad 0x00ffffdc04940000,0x00fccddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00\n"
".quad 0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000\n"
".quad 0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0\n"
".quad 0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000\n"
".quad 0x00fcdddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00,0x00e0229803400000\n"
".quad 0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000,0x000132d8856000c0\n"
".quad 0x00a00299e4c10000,0x0004b51803280040,0x0020b298034800c0,0x00013518852015c0\n"
".quad 0x00b3f2d843c90000,0x0000a098a5480040,0x00ffffdc04940000,0x00fceddc0350ee00\n"
".quad 0x00185ddc041a8e00,0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040\n"
".quad 0x0010a298436800c0,0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040\n"
".quad 0x0020b29803c10000,0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040\n"
".quad 0x0000a098a5c90000,0x00ffffdc04940000,0x00fcfddc0350ee00,0x00185ddc041a8e00\n"
".quad 0x016000b9e70c0e00,0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0\n"
".quad 0x0008a4da03400000,0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000\n"
".quad 0x0004b518032015c0,0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000\n"
".quad 0x00ffffdc04940000,0x00fd0ddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00\n"
".quad 0x00e0229803400000,0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000\n"
".quad 0x00a00299e46000c0,0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0\n"
".quad 0x00b3f2d8434800c0,0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000\n"
".quad 0x00fd1ddc0350ee00,0x00185ddc041a8e00,0x016000b9e70c0e00,0x00e0229803400000\n"
".quad 0x03fca29803580040,0x0010a298436800c0,0x0008a4da03400000,0x00a00299e46000c0\n"
".quad 0x000132d885280040,0x0020b29803c10000,0x0004b518032015c0,0x00b3f2d8434800c0\n"
".quad 0x0001351885480040,0x0000a098a5c90000,0x00ffffdc04940000,0x00fd2ddc0350ee00\n"
".quad 0x00185bdc041a8e00,0x016000b5e70c0e00,0x00e0229403400000,0x03fca29403580040\n"
".quad 0x0010a294436800c0,0x0008a4d603400000,0x00a00295e46000c0,0x000132d485280040\n"
".quad 0x0020b29403c10000,0x0004b514032015c0,0x00b3f2d4434800c0,0x0001351485480040\n"
".quad 0x0000a094a5c90000,0x00ffffdc04940000,0x0040001c0350ee00,0x00140bdc034800c0\n"
".quad 0xe1600015e7188e00,0x0000001de74003ff,0x0000000000800000,0x0000000000000000\n"
".quad 0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000\n"
".quad 0x0000000000000000,0x0100000000000000,0x04aaaaaaab000000,0x080000000000140c\n"
".quad 0x1400000010000000,0x0400000018000000,0x200000000e00080a,0x04001c1903001c00\n"
".quad 0x04ffffffff000c17,0x040011f000001800,0x03ffffffff000c17,0x040011f000001400\n"
".quad 0x02ffffffff000c17,0x040011f000001000,0x01ffffffff000c17,0x040021f000000800\n"
".quad 0x00ffffffff000c17,0x040021f000000000,0x200022019800080d,0x0000000000000000\n"
".quad 0x0000000000000000,0x1800000001000000,0x0000000004000000,0x1700000001000000\n"
".quad 0x1600081204000000,0x0400000000000000,0x0000000016000811,0x1500081204000000\n"
".quad 0x0400000000000000,0x0000000015000811,0x1400081204000000,0x0400000000000000\n"
".quad 0x0000000014000811,0x0000000600000000,0x0000254c00000005,0x0000000000000000\n"
".quad 0x0000000000000000,0x0000015000000000,0x0000015000000000,0x0000000400000000\n"
".quad 0x6000000000000000,0x00000a2300001605,0x0000000000000000,0x0000000000000000\n"
".quad 0x000009bc00000000,0x000009bc00000000,0x0000000400000000,0x6000000000000000\n"
".quad 0x000013df00001505,0x0000000000000000,0x0000000000000000,0x0000048400000000\n"
".quad 0x0000048400000000,0x0000000400000000,0x6000000000000000,0x0000186300001405\n"
".quad 0x0000000000000000,0x0000000000000000,0x00000c7800000000,0x00000c7800000000\n"
".quad 0x0000000400000000,0x0000000100000000,0x000024db00000005,0x0000000000000000\n"
".quad 0x0000000000000000,0x0000002800000000,0x0000002800000000,0x0000000400000000\n"
".quad 0x0000000100000000,0x0000250300000006,0x0000000000000000,0x0000000000000000\n"
".quad 0x0000000000000000,0x0003004000000000,0x0000000400000000,0x0000000000000000\n"
".text");
extern "C" {
extern const unsigned long long __deviceText_$sm_21$[1236];
}
asm(
".section .rodata\n"
".align 32\n"
"__deviceText_$compute_20$:\n"
".quad 0x6f69737265762e09,0x2e090a322e32206e,0x7320746567726174,0x2f2f090a30325f6d\n"
".quad 0x656c69706d6f6320,0x2f20687469772064,0x61636f6c2f727375,0x6f2f616475632f6c\n"
".quad 0x696c2f34366e6570,0x2f090a65622f2f62,0x6e65706f766e202f,0x6220322e33206363\n"
".quad 0x206e6f20746c6975,0x2d39302d30313032,0x2d2f2f090a0a3930,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x43202f2f090a2d2d,0x676e696c69706d6f\n"
".quad 0x6d742f706d742f20,0x3030305f74667870,0x30305f3638613030,0x372d303030303030\n"
".quad 0x6f7378696461725f,0x656e72656b5f7472,0x692e337070632e6c,0x632f706d742f2820\n"
".quad 0x3748652e23494263,0x2f2f090a29757245,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2f2f090a0a2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x202f2f090a2d2d2d,0x3a736e6f6974704f,0x2d2d2d2d2f2f090a\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x0a2d2d2d2d2d2d2d,0x72615420202f2f09\n"
".quad 0x2c7874703a746567,0x5f6d733a41534920,0x69646e45202c3032,0x6c7474696c3a6e61\n"
".quad 0x746e696f50202c65,0x3a657a6953207265,0x20202f2f090a3436,0x74704f2809334f2d\n"
".quad 0x6f6974617a696d69,0x296c6576656c206e,0x672d20202f2f090a,0x6775626544280930\n"
".quad 0x0a296c6576656c20,0x326d2d20202f2f09,0x74726f7065522809,0x726f736976646120\n"
".quad 0x2f2f090a29736569,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d,0x2d2d2d2d2d2d2d2d\n"
".quad 0x662e090a0a2d2d2d,0x3c22093109656c69,0x2d646e616d6d6f63,0x090a223e656e696c\n"
".quad 0x093209656c69662e,0x6d742f706d742f22,0x3030305f74667870,0x30305f3638613030\n"
".quad 0x362d303030303030,0x6f7378696461725f,0x656e72656b5f7472,0x6566616475632e6c\n"
".quad 0x090a227570672e32,0x093309656c69662e,0x6e2f656d6f682f22,0x68632f6c616d726f\n"
".quad 0x672f74756f6b6365,0x746f6c65636f7570,0x702d73747365742f,0x632f312e322d7874\n"
".quad 0x742f322e32616475,0x7261702f73747365,0x722f73656c636974,0x74726f7378696461\n"
".quad 0x2e090a226875632e,0x22093409656c6966,0x62696c2f7273752f,0x3836692f6363672f\n"
".quad 0x2d78756e696c2d36,0x2e342e342f756e67,0x64756c636e692f35,0x6665646474732f65\n"
".quad 0x69662e090a22682e,0x752f22093509656c,0x6c61636f6c2f7273,0x69622f616475632f\n"
".quad 0x636e692f2e2e2f6e,0x7472632f6564756c,0x5f6563697665642f,0x2e656d69746e7572\n"
".quad 0x6c69662e090a2268,0x73752f2209360965,0x2f6c61636f6c2f72,0x6e69622f61647563\n"
".quad 0x6c636e692f2e2e2f,0x74736f682f656475,0x73656e696665645f,0x69662e090a22682e\n"
".quad 0x752f22093709656c,0x6c61636f6c2f7273,0x69622f616475632f,0x636e692f2e2e2f6e\n"
".quad 0x6975622f6564756c,0x7079745f6e69746c,0x2e090a22682e7365,0x22093809656c6966\n"
".quad 0x636f6c2f7273752f,0x2f616475632f6c61,0x692f2e2e2f6e6962,0x642f6564756c636e\n"
".quad 0x79745f6563697665,0x090a22682e736570,0x093909656c69662e,0x6f6c2f7273752f22\n"
".quad 0x616475632f6c6163,0x2f2e2e2f6e69622f,0x2f6564756c636e69,0x745f726576697264\n"
".quad 0x0a22682e73657079,0x3109656c69662e09,0x2f7273752f220930,0x75632f6c61636f6c\n"
".quad 0x2e2f6e69622f6164,0x64756c636e692f2e,0x6361667275732f65,0x2e73657079745f65\n"
".quad 0x6c69662e090a2268,0x752f220931310965,0x6c61636f6c2f7273,0x69622f616475632f\n"
".quad 0x636e692f2e2e2f6e,0x7865742f6564756c,0x7079745f65727574,0x2e090a22682e7365\n"
".quad 0x09323109656c6966,0x6f6c2f7273752f22,0x616475632f6c6163,0x2f2e2e2f6e69622f\n"
".quad 0x2f6564756c636e69,0x745f726f74636576,0x0a22682e73657079,0x3109656c69662e09\n"
".quad 0x2f7273752f220933,0x75632f6c61636f6c,0x2e2f6e69622f6164,0x64756c636e692f2e\n"
".quad 0x6563697665642f65,0x5f68636e75616c5f,0x6574656d61726170,0x2e090a22682e7372\n"
".quad 0x09343109656c6966,0x6f6c2f7273752f22,0x616475632f6c6163,0x2f2e2e2f6e69622f\n"
".quad 0x2f6564756c636e69,0x726f74732f747263,0x73616c635f656761,0x662e090a22682e73\n"
".quad 0x2209353109656c69,0x636e692f7273752f,0x7469622f6564756c,0x2e73657079742f73\n"
".quad 0x6c69662e090a2268,0x752f220936310965,0x756c636e692f7273,0x2e656d69742f6564\n"
".quad 0x6c69662e090a2268,0x682f220937310965,0x6d726f6e2f656d6f,0x6b636568632f6c61\n"
".quad 0x6f7570672f74756f,0x65742f746f6c6563,0x2d7874702d737473,0x616475632f312e32\n"
".quad 0x747365742f322e32,0x6369747261702f73,0x696461722f73656c,0x656b5f74726f7378\n"
".quad 0x2275632e6c656e72,0x09656c69662e090a,0x7273752f22093831,0x632f6c61636f6c2f\n"
".quad 0x2f6e69622f616475,0x756c636e692f2e2e,0x6f6d6d6f632f6564,0x6974636e75665f6e\n"
".quad 0x090a22682e736e6f,0x393109656c69662e,0x6c2f7273752f2209,0x6475632f6c61636f\n"
".quad 0x2e2e2f6e69622f61,0x6564756c636e692f,0x75665f6874616d2f,0x2e736e6f6974636e\n"
".quad 0x6c69662e090a2268,0x752f220930320965,0x6c61636f6c2f7273,0x69622f616475632f\n"
".quad 0x636e692f2e2e2f6e,0x74616d2f6564756c,0x6174736e6f635f68,0x090a22682e73746e\n"
".quad 0x313209656c69662e,0x6c2f7273752f2209,0x6475632f6c61636f,0x2e2e2f6e69622f61\n"
".quad 0x6564756c636e692f,0x5f6563697665642f,0x6e6f6974636e7566,0x662e090a22682e73\n"
".quad 0x2209323209656c69,0x636f6c2f7273752f,0x2f616475632f6c61,0x692f2e2e2f6e6962\n"
".quad 0x732f6564756c636e,0x6f74615f31315f6d,0x636e75665f63696d,0x22682e736e6f6974\n"
".quad 0x09656c69662e090a,0x7273752f22093332,0x632f6c61636f6c2f,0x2f6e69622f616475\n"
".quad 0x756c636e692f2e2e,0x32315f6d732f6564,0x5f63696d6f74615f,0x6e6f6974636e7566\n"
".quad 0x662e090a22682e73,0x2209343209656c69,0x636f6c2f7273752f,0x2f616475632f6c61\n"
".quad 0x692f2e2e2f6e6962,0x732f6564756c636e,0x756f645f33315f6d,0x636e75665f656c62\n"
".quad 0x22682e736e6f6974,0x09656c69662e090a,0x7273752f22093532,0x632f6c61636f6c2f\n"
".quad 0x2f6e69622f616475,0x756c636e692f2e2e,0x30325f6d732f6564,0x5f63696d6f74615f\n"
".quad 0x6e6f6974636e7566,0x662e090a22682e73,0x2209363209656c69,0x636f6c2f7273752f\n"
".quad 0x2f616475632f6c61,0x692f2e2e2f6e6962,0x732f6564756c636e,0x746e695f30325f6d\n"
".quad 0x2e736369736e6972,0x6c69662e090a2268,0x752f220937320965,0x6c61636f6c2f7273\n"
".quad 0x69622f616475632f,0x636e692f2e2e2f6e,0x7275732f6564756c,0x6e75665f65636166\n"
".quad 0x682e736e6f697463,0x656c69662e090a22,0x73752f2209383209,0x2f6c61636f6c2f72\n"
".quad 0x6e69622f61647563,0x6c636e692f2e2e2f,0x747865742f656475,0x637465665f657275\n"
".quad 0x6974636e75665f68,0x090a22682e736e6f,0x393209656c69662e,0x6c2f7273752f2209\n"
".quad 0x6475632f6c61636f,0x2e2e2f6e69622f61,0x6564756c636e692f,0x75665f6874616d2f\n"
".quad 0x5f736e6f6974636e,0x337874705f6c6264,0x652e090a0a22682e,0x732e096e72657478\n"
".quad 0x612e206465726168,0x2e2034206e67696c,0x6964615273203862,0x0a3b5d5b6d755378\n"
".quad 0x6c61626f6c672e09,0x206e67696c612e20,0x52642038622e2034,0x5b6d755378696461\n"
".quad 0x3b5d383036363931,0x72746e652e090a0a,0x646152385a5f2079,0x3231506d75537869\n"
".quad 0x65756c615679654b,0x206a6a6a72696150,0x7261702e09090a28,0x203436752e206d61\n"
".quad 0x6170616475635f5f,0x6152385a5f5f6d72,0x31506d7553786964,0x756c615679654b32\n"
".quad 0x6a6a6a7269615065,0x0a2c61746144705f,0x6d617261702e0909,0x5f5f203233752e20\n"
".quad 0x6d72617061647563,0x69646152385a5f5f,0x4b3231506d755378,0x5065756c61567965\n"
".quad 0x655f6a6a6a726961,0x2c73746e656d656c,0x617261702e09090a,0x5f203233752e206d\n"
".quad 0x726170616475635f,0x646152385a5f5f6d,0x3231506d75537869,0x65756c615679654b\n"
".quad 0x5f6a6a6a72696150,0x73746e656d656c65,0x6465646e756f725f,0x323730335f6f745f\n"
".quad 0x7261702e09090a2c,0x203233752e206d61,0x6170616475635f5f,0x6152385a5f5f6d72\n"
".quad 0x31506d7553786964,0x756c615679654b32,0x6a6a6a7269615065,0x0a2974666968735f\n"
".quad 0x6765722e090a7b09,0x7225203233752e20,0x090a3b3e3838313c,0x36752e206765722e\n"
".quad 0x39343c6472252034,0x6765722e090a3b3e,0x2520646572702e20,0x090a3b3e31343c70\n"
".quad 0x09373109636f6c2e,0x4c240a3009313031,0x5f6e696765625744,0x7869646152385a5f\n"
".quad 0x654b3231506d7553,0x615065756c615679,0x090a3a6a6a6a7269,0x09373109636f6c2e\n"
".quad 0x6d090a3009333031,0x09203233752e766f,0x697425202c317225,0x6f6d090a3b782e64\n"
".quad 0x2509203233732e76,0x3b317225202c3272,0x33752e766f6d090a,0x202c337225092032\n"
".quad 0x73090a3b33323031,0x752e74672e707465,0x2c31702509203233,0x7225202c31722520\n"
".quad 0x31702540090a3b33,0x4c24092061726220,0x383430325f305f74,0x2e766f6d090a3b32\n"
".quad 0x6472250920343675,0x6964615273202c31,0x6d090a3b6d755378,0x09203233752e766f\n"
".quad 0x383031202c347225,0x2e627573090a3b37,0x3572250920323375,0x25202c347225202c\n"
".quad 0x726873090a3b3172,0x722509203233732e,0x202c357225202c36,0x766f6d090a3b3133\n"
".quad 0x722509203233732e,0x090a3b3336202c37,0x203233622e646e61,0x7225202c38722509\n"
".quad 0x0a3b377225202c36,0x3233732e64646109,0x25202c3972250920,0x3b357225202c3872\n"
".quad 0x33732e726873090a,0x2c30317225092032,0x3b36202c39722520,0x36752e747663090a\n"
".quad 0x2509203233752e34,0x317225202c326472,0x772e6c756d090a3b,0x203233752e656469\n"
".quad 0x25202c3364722509,0x090a3b34202c3172,0x203436752e646461,0x25202c3464722509\n"
".quad 0x647225202c316472,0x2e766f6d090a3b33,0x3172250920323373,0x3b30317225202c31\n"
".quad 0x325f305f744c240a,0x2f200a3a34393930,0x203e706f6f6c3c2f,0x646f6220706f6f4c\n"
".quad 0x3120656e696c2079,0x7473656e202c3330,0x7470656420676e69,0x7365202c31203a68\n"
".quad 0x20646574616d6974,0x6f69746172657469,0x6e6b6e75203a736e,0x6f6c2e090a6e776f\n"
".quad 0x3830310937310963,0x2e766f6d090a3009,0x3172250920323375,0x73090a3b30202c32\n"
".quad 0x6465726168732e74,0x255b09203233752e,0x202c5d302b346472,0x61090a3b32317225\n"
".quad 0x09203233752e6464,0x327225202c327225,0x61090a3b3436202c,0x09203436752e6464\n"
".quad 0x7225202c34647225,0x3b363532202c3464,0x33752e766f6d090a,0x2c33317225092032\n"
".quad 0x090a3b3332303120,0x2e656c2e70746573,0x3270250920323375,0x25202c327225202c\n"
".quad 0x2540090a3b333172,0x0920617262203270,0x30325f305f744c24,0x744c240a3b343939\n"
".quad 0x32383430325f305f,0x752e766f6d090a3a,0x3164722509203436,0x786964615273202c\n"
".quad 0x6c2e090a3b6d7553,0x333109373109636f,0x726162090a300936,0x300920636e79732e\n"
".quad 0x622e646e61090a3b,0x3431722509203233,0x31202c317225202c,0x2e726873090a3b35\n"
".quad 0x3172250920323375,0x202c317225202c35,0x2e766f6d090a3b34,0x3172250920323375\n"
".quad 0x6961746325202c36,0x756d090a3b782e64,0x3233752e6f6c2e6c,0x202c373172250920\n"
".quad 0x3b34202c36317225,0x7261702e646c090a,0x09203233752e6d61,0x5f5b202c38317225\n"
".quad 0x726170616475635f,0x646152385a5f5f6d,0x3231506d75537869,0x65756c615679654b\n"
".quad 0x5f6a6a6a72696150,0x73746e656d656c65,0x6465646e756f725f,0x323730335f6f745f\n"
".quad 0x2e766f6d090a3b5d,0x3172250920323375,0x313334312d202c39,0x0a3b353637353536\n"
".quad 0x2e69682e6c756d09,0x3272250920323375,0x2c38317225202c30,0x090a3b3931722520\n"
".quad 0x203233752e726873,0x25202c3132722509,0x0a3b37202c303272,0x3233752e64646109\n"
".quad 0x202c323272250920,0x7225202c35317225,0x6c756d090a3b3731,0x203233752e6f6c2e\n"
".quad 0x25202c3332722509,0x327225202c313272,0x2e646461090a3b32,0x3272250920323375\n"
".quad 0x2c34317225202c34,0x090a3b3332722520,0x203233732e766f6d,0x7225202c32722509\n"
".quad 0x646461090a3b3432,0x722509203233752e,0x31327225202c3532,0x0a3b33327225202c\n"
".quad 0x65672e7074657309,0x702509203233752e,0x2c34327225202c33,0x090a3b3532722520\n"
".quad 0x6172622033702540,0x5f305f744c240920,0x090a3b3630353132,0x203233752e627573\n"
".quad 0x25202c3632722509,0x317225202c313272,0x2e646461090a3b34,0x3272250920323375\n"
".quad 0x2c36327225202c37,0x6873090a3b353120,0x2509203233732e72,0x327225202c383272\n"
".quad 0x090a3b3133202c37,0x203233732e766f6d,0x31202c3932722509,0x2e646e61090a3b35\n"
".quad 0x3372250920323362,0x2c38327225202c30,0x090a3b3932722520,0x203233732e646461\n"
".quad 0x25202c3133722509,0x327225202c303372,0x2e726873090a3b37,0x3372250920323373\n"
".quad 0x2c31337225202c32,0x766f6d090a3b3420,0x722509203233752e,0x090a3b30202c3333\n"
".quad 0x2e71652e70746573,0x3470250920323375,0x202c34317225202c,0x6d090a3b33337225\n"
".quad 0x09203233752e766f,0x3b31202c34337225,0x652e70746573090a,0x2509203233752e71\n"
".quad 0x34317225202c3570,0x0a3b34337225202c,0x3233752e766f6d09,0x202c353372250920\n"
".quad 0x70746573090a3b32,0x203233752e71652e,0x7225202c36702509,0x35337225202c3431\n"
".quad 0x752e766f6d090a3b,0x3633722509203233,0x6573090a3b33202c,0x33752e71652e7074\n"
".quad 0x202c377025092032,0x7225202c34317225,0x766f6d090a3b3633,0x722509203233752e\n"
".quad 0x090a3b34202c3733,0x2e71652e70746573,0x3870250920323375,0x202c34317225202c\n"
".quad 0x6d090a3b37337225,0x09203233752e766f,0x3b35202c38337225,0x652e70746573090a\n"
".quad 0x2509203233752e71,0x34317225202c3970,0x0a3b38337225202c,0x3233752e766f6d09\n"
".quad 0x202c393372250920,0x70746573090a3b36,0x203233752e71652e,0x25202c3031702509\n"
".quad 0x337225202c343172,0x2e766f6d090a3b39,0x3472250920323375,0x73090a3b37202c30\n"
".quad 0x752e71652e707465,0x3131702509203233,0x202c34317225202c,0x6d090a3b30347225\n"
".quad 0x09203233752e766f,0x3b38202c31347225,0x652e70746573090a,0x2509203233752e71\n"
".quad 0x317225202c323170,0x3b31347225202c34,0x33752e766f6d090a,0x2c32347225092032\n"
".quad 0x746573090a3b3920,0x3233752e71652e70,0x202c333170250920,0x7225202c34317225\n"
".quad 0x766f6d090a3b3234,0x722509203233752e,0x0a3b3031202c3334,0x71652e7074657309\n"
".quad 0x702509203233752e,0x34317225202c3431,0x0a3b33347225202c,0x3233752e766f6d09\n"
".quad 0x202c343472250920,0x746573090a3b3131,0x3233752e71652e70,0x202c353170250920\n"
".quad 0x7225202c34317225,0x766f6d090a3b3434,0x722509203233752e,0x0a3b3231202c3534\n"
".quad 0x71652e7074657309,0x702509203233752e,0x34317225202c3631,0x0a3b35347225202c\n"
".quad 0x3233752e766f6d09,0x202c363472250920,0x746573090a3b3331,0x3233752e71652e70\n"
".quad 0x202c373170250920,0x7225202c34317225,0x766f6d090a3b3634,0x722509203233752e\n"
".quad 0x0a3b3431202c3734,0x71652e7074657309,0x702509203233752e,0x34317225202c3831\n"
".quad 0x0a3b37347225202c,0x3233752e766f6d09,0x202c383472250920,0x746573090a3b3531\n"
".quad 0x3233752e71652e70,0x202c393170250920,0x7225202c34317225,0x6c6573090a3b3834\n"
".quad 0x2509203233732e70,0x202c31202c393472,0x0a3b347025202c30,0x33732e706c657309\n"
".quad 0x2c30357225092032,0x25202c30202c3120,0x6c6573090a3b3570,0x2509203233732e70\n"
".quad 0x202c31202c313572,0x0a3b367025202c30,0x33732e706c657309,0x2c32357225092032\n"
".quad 0x25202c30202c3120,0x6c6573090a3b3770,0x2509203233732e70,0x202c31202c333572\n"
".quad 0x0a3b387025202c30,0x33732e706c657309,0x2c34357225092032,0x25202c30202c3120\n"
".quad 0x6c6573090a3b3970,0x2509203233732e70,0x202c31202c353572,0x3b30317025202c30\n"
".quad 0x732e706c6573090a,0x3635722509203233,0x202c30202c31202c,0x73090a3b31317025\n"
".quad 0x203233732e706c65,0x31202c3735722509,0x317025202c30202c,0x706c6573090a3b32\n"
".quad 0x722509203233732e,0x30202c31202c3835,0x0a3b33317025202c,0x33732e706c657309\n"
".quad 0x2c39357225092032,0x25202c30202c3120,0x6573090a3b343170,0x09203233732e706c\n"
".quad 0x2c31202c30367225,0x35317025202c3020,0x2e706c6573090a3b,0x3672250920323373\n"
".quad 0x2c30202c31202c31,0x090a3b3631702520,0x3233732e706c6573,0x202c323672250920\n"
".quad 0x7025202c30202c31,0x6c6573090a3b3731,0x2509203233732e70,0x202c31202c333672\n"
".quad 0x3b38317025202c30,0x732e706c6573090a,0x3436722509203233,0x202c30202c31202c\n"
".quad 0x6c090a3b39317025,0x2e6d617261702e64,0x3672250920323375,0x75635f5f5b202c35\n"
".quad 0x5f5f6d7261706164,0x537869646152385a,0x79654b3231506d75,0x69615065756c6156\n"
".quad 0x656c655f6a6a6a72,0x0a3b5d73746e656d,0x3233732e766f6d09,0x202c363672250920\n"
".quad 0x4c240a3b32337225,0x313032325f305f74,0x6c3c2f2f200a3a38,0x6f6f4c203e706f6f\n"
".quad 0x6c2079646f622070,0x2c36333120656e69,0x676e697473656e20,0x203a687470656420\n"
".quad 0x6d69747365202c31,0x6574692064657461,0x3a736e6f69746172,0x6e776f6e6b6e7520\n"
".quad 0x6c2e70746573090a,0x2509203233752e74,0x327225202c303270,0x0a3b35367225202c\n"
".quad 0x2030327025214009,0x744c240920617262,0x30333532325f305f,0x6f6c3c2f2f200a3b\n"
".quad 0x74726150203e706f,0x706f6f6c20666f20,0x696c2079646f6220,0x202c36333120656e\n"
".quad 0x62616c2064616568,0x744c242064656c65,0x38313032325f305f,0x3109636f6c2e090a\n"
".quad 0x0a30093834310937,0x2e6f6c2e6c756d09,0x3672250920323375,0x202c327225202c37\n"
".quad 0x2e747663090a3b38,0x203233752e343675,0x25202c3564722509,0x646c090a3b373672\n"
".quad 0x752e6d617261702e,0x3664722509203436,0x6475635f5f5b202c,0x5a5f5f6d72617061\n"
".quad 0x7553786964615238,0x5679654b3231506d,0x7269615065756c61,0x746144705f6a6a6a\n"
".quad 0x646461090a3b5d61,0x722509203436752e,0x35647225202c3764,0x0a3b36647225202c\n"
".quad 0x626f6c672e646c09,0x09203233752e6c61,0x255b202c38367225,0x0a3b5d302b376472\n"
".quad 0x696e752e61726209,0x5f305f744c240920,0x240a3b3437323232,0x3532325f305f744c\n"
".quad 0x3c2f2f200a3a3033,0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f\n"
".quad 0x36333120656e696c,0x6c2064616568202c,0x242064656c656261,0x3032325f305f744c\n"
".quad 0x636f6c2e090a3831,0x0930353109373109,0x752e766f6d090a30,0x3836722509203233\n"
".quad 0x744c240a3b30202c,0x34373232325f305f,0x6f6c3c2f2f200a3a,0x74726150203e706f\n"
".quad 0x706f6f6c20666f20,0x696c2079646f6220,0x202c36333120656e,0x62616c2064616568\n"
".quad 0x744c242064656c65,0x38313032325f305f,0x732e706c6573090a,0x3936722509203233\n"
".quad 0x202c30202c31202c,0x61090a3b30327025,0x09203233622e646e,0x7225202c30377225\n"
".quad 0x39347225202c3936,0x752e766f6d090a3b,0x3137722509203233,0x6573090a3b30202c\n"
".quad 0x33732e71652e7074,0x2c31327025092032,0x25202c3037722520,0x2540090a3b313772\n"
".quad 0x2061726220313270,0x325f305f744c2409,0x2f200a3b36383732,0x203e706f6f6c3c2f\n"
".quad 0x20666f2074726150,0x646f6220706f6f6c,0x3120656e696c2079,0x64616568202c3633\n"
".quad 0x64656c6562616c20,0x325f305f744c2420,0x6c2e090a38313032,0x373109373109636f\n"
".quad 0x2e646c090a300933,0x33732e6d61726170,0x2c32377225092032,0x616475635f5f5b20\n"
".quad 0x385a5f5f6d726170,0x6d75537869646152,0x615679654b323150,0x6a7269615065756c\n"
".quad 0x74666968735f6a6a,0x2e726873090a3b5d,0x3772250920323375,0x2c38367225202c33\n"
".quad 0x090a3b3237722520,0x203233622e646e61,0x25202c3437722509,0x353532202c333772\n"
".quad 0x6c2e6c756d090a3b,0x2509203233752e6f,0x377225202c353772,0x61090a3b34202c34\n"
".quad 0x09203233752e6464,0x7225202c36377225,0x35377225202c3531,0x752e747663090a3b\n"
".quad 0x09203233752e3436,0x7225202c38647225,0x6c756d090a3b3637,0x33752e656469772e\n"
".quad 0x2c39647225092032,0x34202c3637722520,0x752e646461090a3b,0x3164722509203436\n"
".quad 0x2c31647225202c30,0x090a3b3964722520,0x65726168732e646c,0x2509203233752e64\n"
".quad 0x72255b202c373772,0x0a3b5d302b303164,0x3233752e64646109,0x202c383772250920\n"
".quad 0x3b31202c37377225,0x6168732e7473090a,0x203233752e646572,0x2b30316472255b09\n"
".quad 0x38377225202c5d30,0x5f305f744c240a3b,0x200a3a3638373232,0x3e706f6f6c3c2f2f\n"
".quad 0x666f207472615020,0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c363331\n"
".quad 0x656c6562616c2064,0x5f305f744c242064,0x2e090a3831303232,0x3109373109636f6c\n"
".quad 0x6162090a30093437,0x0920636e79732e72,0x2e646e61090a3b30,0x3772250920323362\n"
".quad 0x2c39367225202c39,0x090a3b3035722520,0x203233752e766f6d,0x30202c3038722509\n"
".quad 0x2e70746573090a3b,0x09203233732e7165,0x7225202c32327025,0x30387225202c3937\n"
".quad 0x3232702540090a3b,0x4c24092061726220,0x393233325f305f74,0x6c3c2f2f200a3b38\n"
".quad 0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070,0x2c36333120656e69\n"
".quad 0x616c206461656820,0x4c242064656c6562,0x313032325f305f74,0x09636f6c2e090a38\n"
".quad 0x3009363731093731,0x7261702e646c090a,0x09203233732e6d61,0x5f5b202c31387225\n"
".quad 0x726170616475635f,0x646152385a5f5f6d,0x3231506d75537869,0x65756c615679654b\n"
".quad 0x5f6a6a6a72696150,0x0a3b5d7466696873,0x3233752e72687309,0x202c333772250920\n"
".quad 0x7225202c38367225,0x646e61090a3b3138,0x722509203233622e,0x33377225202c3437\n"
".quad 0x090a3b353532202c,0x752e6f6c2e6c756d,0x3537722509203233,0x202c34377225202c\n"
".quad 0x2e646461090a3b34,0x3872250920323375,0x2c35317225202c32,0x090a3b3537722520\n"
".quad 0x2e3436752e747663,0x6472250920323375,0x32387225202c3131,0x772e6c756d090a3b\n"
".quad 0x203233752e656469,0x202c323164722509,0x3b34202c32387225,0x36752e646461090a\n"
".quad 0x3031647225092034,0x202c31647225202c,0x090a3b3231647225,0x65726168732e646c\n"
".quad 0x2509203233752e64,0x72255b202c333872,0x0a3b5d302b303164,0x3233752e64646109\n"
".quad 0x202c343872250920,0x3b31202c33387225,0x6168732e7473090a,0x203233752e646572\n"
".quad 0x2b30316472255b09,0x34387225202c5d30,0x5f305f744c240a3b,0x200a3a3839323332\n"
".quad 0x3e706f6f6c3c2f2f,0x666f207472615020,0x6f6220706f6f6c20,0x20656e696c207964\n"
".quad 0x616568202c363331,0x656c6562616c2064,0x5f305f744c242064,0x2e090a3831303232\n"
".quad 0x3109373109636f6c,0x6162090a30093737,0x0920636e79732e72,0x2e646e61090a3b30\n"
".quad 0x3872250920323362,0x2c39367225202c35,0x090a3b3135722520,0x203233752e766f6d\n"
".quad 0x30202c3638722509,0x2e70746573090a3b,0x09203233732e7165,0x7225202c33327025\n"
".quad 0x36387225202c3538,0x3332702540090a3b,0x4c24092061726220,0x313833325f305f74\n"
".quad 0x6c3c2f2f200a3b30,0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070\n"
".quad 0x2c36333120656e69,0x616c206461656820,0x4c242064656c6562,0x313032325f305f74\n"
".quad 0x09636f6c2e090a38,0x3009393731093731,0x7261702e646c090a,0x09203233732e6d61\n"
".quad 0x5f5b202c37387225,0x726170616475635f,0x646152385a5f5f6d,0x3231506d75537869\n"
".quad 0x65756c615679654b,0x5f6a6a6a72696150,0x0a3b5d7466696873,0x3233752e72687309\n"
".quad 0x202c333772250920,0x7225202c38367225,0x646e61090a3b3738,0x722509203233622e\n"
".quad 0x33377225202c3437,0x090a3b353532202c,0x752e6f6c2e6c756d,0x3537722509203233\n"
".quad 0x202c34377225202c,0x2e646461090a3b34,0x3872250920323375,0x2c35317225202c38\n"
".quad 0x090a3b3537722520,0x2e3436752e747663,0x6472250920323375,0x38387225202c3331\n"
".quad 0x772e6c756d090a3b,0x203233752e656469,0x202c343164722509,0x3b34202c38387225\n"
".quad 0x36752e646461090a,0x3031647225092034,0x202c31647225202c,0x090a3b3431647225\n"
".quad 0x65726168732e646c,0x2509203233752e64,0x72255b202c393872,0x0a3b5d302b303164\n"
".quad 0x3233752e64646109,0x202c303972250920,0x3b31202c39387225,0x6168732e7473090a\n"
".quad 0x203233752e646572,0x2b30316472255b09,0x30397225202c5d30,0x5f305f744c240a3b\n"
".quad 0x200a3a3031383332,0x3e706f6f6c3c2f2f,0x666f207472615020,0x6f6220706f6f6c20\n"
".quad 0x20656e696c207964,0x616568202c363331,0x656c6562616c2064,0x5f305f744c242064\n"
".quad 0x2e090a3831303232,0x3109373109636f6c,0x6162090a30093038,0x0920636e79732e72\n"
".quad 0x2e646e61090a3b30,0x3972250920323362,0x2c39367225202c31,0x090a3b3235722520\n"
".quad 0x203233752e766f6d,0x30202c3239722509,0x2e70746573090a3b,0x09203233732e7165\n"
".quad 0x7225202c34327025,0x32397225202c3139,0x3432702540090a3b,0x4c24092061726220\n"
".quad 0x323334325f305f74,0x6c3c2f2f200a3b32,0x726150203e706f6f,0x6f6f6c20666f2074\n"
".quad 0x6c2079646f622070,0x2c36333120656e69,0x616c206461656820,0x4c242064656c6562\n"
".quad 0x313032325f305f74,0x09636f6c2e090a38,0x3009323831093731,0x7261702e646c090a\n"
".quad 0x09203233732e6d61,0x5f5b202c33397225,0x726170616475635f,0x646152385a5f5f6d\n"
".quad 0x3231506d75537869,0x65756c615679654b,0x5f6a6a6a72696150,0x0a3b5d7466696873\n"
".quad 0x3233752e72687309,0x202c333772250920,0x7225202c38367225,0x646e61090a3b3339\n"
".quad 0x722509203233622e,0x33377225202c3437,0x090a3b353532202c,0x752e6f6c2e6c756d\n"
".quad 0x3537722509203233,0x202c34377225202c,0x2e646461090a3b34,0x3972250920323375\n"
".quad 0x2c35317225202c34,0x090a3b3537722520,0x2e3436752e747663,0x6472250920323375\n"
".quad 0x34397225202c3531,0x772e6c756d090a3b,0x203233752e656469,0x202c363164722509\n"
".quad 0x3b34202c34397225,0x36752e646461090a,0x3031647225092034,0x202c31647225202c\n"
".quad 0x090a3b3631647225,0x65726168732e646c,0x2509203233752e64,0x72255b202c353972\n"
".quad 0x0a3b5d302b303164,0x3233752e64646109,0x202c363972250920,0x3b31202c35397225\n"
".quad 0x6168732e7473090a,0x203233752e646572,0x2b30316472255b09,0x36397225202c5d30\n"
".quad 0x5f305f744c240a3b,0x200a3a3232333432,0x3e706f6f6c3c2f2f,0x666f207472615020\n"
".quad 0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c363331,0x656c6562616c2064\n"
".quad 0x5f305f744c242064,0x2e090a3831303232,0x3109373109636f6c,0x6162090a30093338\n"
".quad 0x0920636e79732e72,0x2e646e61090a3b30,0x3972250920323362,0x2c39367225202c37\n"
".quad 0x090a3b3335722520,0x203233752e766f6d,0x30202c3839722509,0x2e70746573090a3b\n"
".quad 0x09203233732e7165,0x7225202c35327025,0x38397225202c3739,0x3532702540090a3b\n"
".quad 0x4c24092061726220,0x333834325f305f74,0x6c3c2f2f200a3b34,0x726150203e706f6f\n"
".quad 0x6f6f6c20666f2074,0x6c2079646f622070,0x2c36333120656e69,0x616c206461656820\n"
".quad 0x4c242064656c6562,0x313032325f305f74,0x09636f6c2e090a38,0x3009353831093731\n"
".quad 0x7261702e646c090a,0x09203233732e6d61,0x5f5b202c39397225,0x726170616475635f\n"
".quad 0x646152385a5f5f6d,0x3231506d75537869,0x65756c615679654b,0x5f6a6a6a72696150\n"
".quad 0x0a3b5d7466696873,0x3233752e72687309,0x202c333772250920,0x7225202c38367225\n"
".quad 0x646e61090a3b3939,0x722509203233622e,0x33377225202c3437,0x090a3b353532202c\n"
".quad 0x752e6f6c2e6c756d,0x3537722509203233,0x202c34377225202c,0x2e646461090a3b34\n"
".quad 0x3172250920323375,0x35317225202c3030,0x0a3b35377225202c,0x3436752e74766309\n"
".quad 0x722509203233752e,0x317225202c373164,0x6c756d090a3b3030,0x33752e656469772e\n"
".quad 0x3831647225092032,0x2c3030317225202c,0x646461090a3b3420,0x722509203436752e\n"
".quad 0x647225202c303164,0x3831647225202c31,0x68732e646c090a3b,0x3233752e64657261\n"
".quad 0x2c31303172250920,0x2b30316472255b20,0x646461090a3b5d30,0x722509203233752e\n"
".quad 0x317225202c323031,0x090a3b31202c3130,0x65726168732e7473,0x5b09203233752e64\n"
".quad 0x5d302b3031647225,0x3b3230317225202c,0x325f305f744c240a,0x2f200a3a34333834\n"
".quad 0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c,0x3120656e696c2079\n"
".quad 0x64616568202c3633,0x64656c6562616c20,0x325f305f744c2420,0x6c2e090a38313032\n"
".quad 0x383109373109636f,0x726162090a300936,0x300920636e79732e,0x622e646e61090a3b\n"
".quad 0x3031722509203233,0x2c39367225202c33,0x090a3b3435722520,0x203233752e766f6d\n"
".quad 0x202c343031722509,0x70746573090a3b30,0x203233732e71652e,0x25202c3632702509\n"
".quad 0x7225202c33303172,0x2540090a3b343031,0x2061726220363270,0x325f305f744c2409\n"
".quad 0x2f200a3b36343335,0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c\n"
".quad 0x3120656e696c2079,0x64616568202c3633,0x64656c6562616c20,0x325f305f744c2420\n"
".quad 0x6c2e090a38313032,0x383109373109636f,0x2e646c090a300938,0x33732e6d61726170\n"
".quad 0x3530317225092032,0x6475635f5f5b202c,0x5a5f5f6d72617061,0x7553786964615238\n"
".quad 0x5679654b3231506d,0x7269615065756c61,0x666968735f6a6a6a,0x726873090a3b5d74\n"
".quad 0x722509203233752e,0x38367225202c3337,0x3b3530317225202c,0x33622e646e61090a\n"
".quad 0x2c34377225092032,0x32202c3337722520,0x6c756d090a3b3535,0x203233752e6f6c2e\n"
".quad 0x25202c3537722509,0x0a3b34202c343772,0x3233752e64646109,0x2c36303172250920\n"
".quad 0x25202c3531722520,0x7663090a3b353772,0x33752e3436752e74,0x3931647225092032\n"
".quad 0x3b3630317225202c,0x69772e6c756d090a,0x09203233752e6564,0x25202c3032647225\n"
".quad 0x3b34202c36303172,0x36752e646461090a,0x3031647225092034,0x202c31647225202c\n"
".quad 0x090a3b3032647225,0x65726168732e646c,0x2509203233752e64,0x255b202c37303172\n"
".quad 0x3b5d302b30316472,0x33752e646461090a,0x3830317225092032,0x2c3730317225202c\n"
".quad 0x2e7473090a3b3120,0x752e646572616873,0x6472255b09203233,0x25202c5d302b3031\n"
".quad 0x4c240a3b38303172,0x343335325f305f74,0x6c3c2f2f200a3a36,0x726150203e706f6f\n"
".quad 0x6f6f6c20666f2074,0x6c2079646f622070,0x2c36333120656e69,0x616c206461656820\n"
".quad 0x4c242064656c6562,0x313032325f305f74,0x09636f6c2e090a38,0x3009393831093731\n"
".quad 0x79732e726162090a,0x090a3b300920636e,0x203233622e646e61,0x202c393031722509\n"
".quad 0x7225202c39367225,0x766f6d090a3b3535,0x722509203233752e,0x0a3b30202c303131\n"
".quad 0x71652e7074657309,0x702509203233732e,0x30317225202c3732,0x3031317225202c39\n"
".quad 0x3732702540090a3b,0x4c24092061726220,0x353835325f305f74,0x6c3c2f2f200a3b38\n"
".quad 0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070,0x2c36333120656e69\n"
".quad 0x616c206461656820,0x4c242064656c6562,0x313032325f305f74,0x09636f6c2e090a38\n"
".quad 0x3009313931093731,0x7261702e646c090a,0x09203233732e6d61,0x5b202c3131317225\n"
".quad 0x6170616475635f5f,0x6152385a5f5f6d72,0x31506d7553786964,0x756c615679654b32\n"
".quad 0x6a6a6a7269615065,0x3b5d74666968735f,0x33752e726873090a,0x2c33377225092032\n"
".quad 0x25202c3836722520,0x61090a3b31313172,0x09203233622e646e,0x7225202c34377225\n"
".quad 0x3b353532202c3337,0x6f6c2e6c756d090a,0x722509203233752e,0x34377225202c3537\n"
".quad 0x6461090a3b34202c,0x2509203233752e64,0x7225202c32313172,0x35377225202c3531\n"
".quad 0x752e747663090a3b,0x09203233752e3436,0x25202c3132647225,0x6d090a3b32313172\n"
".quad 0x2e656469772e6c75,0x6472250920323375,0x31317225202c3232,0x61090a3b34202c32\n"
".quad 0x09203436752e6464,0x25202c3031647225,0x647225202c316472,0x2e646c090a3b3232\n"
".quad 0x752e646572616873,0x3131722509203233,0x316472255b202c33,0x61090a3b5d302b30\n"
".quad 0x09203233752e6464,0x25202c3431317225,0x3b31202c33313172,0x6168732e7473090a\n"
".quad 0x203233752e646572,0x2b30316472255b09,0x31317225202c5d30,0x305f744c240a3b34\n"
".quad 0x0a3a38353835325f,0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066\n"
".quad 0x656e696c2079646f,0x6568202c36333120,0x6c6562616c206461,0x305f744c24206465\n"
".quad 0x090a38313032325f,0x09373109636f6c2e,0x62090a3009323931,0x20636e79732e7261\n"
".quad 0x646e61090a3b3009,0x722509203233622e,0x367225202c353131,0x3b36357225202c39\n"
".quad 0x33752e766f6d090a,0x3631317225092032,0x6573090a3b30202c,0x33732e71652e7074\n"
".quad 0x2c38327025092032,0x202c353131722520,0x090a3b3631317225,0x7262203832702540\n"
".quad 0x305f744c24092061,0x0a3b30373336325f,0x706f6f6c3c2f2f20,0x6f2074726150203e\n"
".quad 0x6220706f6f6c2066,0x656e696c2079646f,0x6568202c36333120,0x6c6562616c206461\n"
".quad 0x305f744c24206465,0x090a38313032325f,0x09373109636f6c2e,0x6c090a3009343931\n"
".quad 0x2e6d617261702e64,0x3172250920323373,0x635f5f5b202c3731,0x5f6d726170616475\n"
".quad 0x7869646152385a5f,0x654b3231506d7553,0x615065756c615679,0x68735f6a6a6a7269\n"
".quad 0x73090a3b5d746669,0x09203233752e7268,0x7225202c33377225,0x31317225202c3836\n"
".quad 0x2e646e61090a3b37,0x3772250920323362,0x2c33377225202c34,0x6d090a3b35353220\n"
".quad 0x33752e6f6c2e6c75,0x2c35377225092032,0x34202c3437722520,0x752e646461090a3b\n"
".quad 0x3131722509203233,0x2c35317225202c38,0x090a3b3537722520,0x2e3436752e747663\n"
".quad 0x6472250920323375,0x31317225202c3332,0x2e6c756d090a3b38,0x3233752e65646977\n"
".quad 0x2c34326472250920,0x202c383131722520,0x2e646461090a3b34,0x6472250920343675\n"
".quad 0x31647225202c3031,0x3b3432647225202c,0x6168732e646c090a,0x203233752e646572\n"
".quad 0x202c393131722509,0x302b30316472255b,0x2e646461090a3b5d,0x3172250920323375\n"
".quad 0x31317225202c3032,0x73090a3b31202c39,0x6465726168732e74,0x255b09203233752e\n"
".quad 0x2c5d302b30316472,0x0a3b303231722520,0x36325f305f744c24,0x2f2f200a3a303733\n"
".quad 0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f,0x333120656e696c20\n"
".quad 0x2064616568202c36,0x2064656c6562616c,0x32325f305f744c24,0x6f6c2e090a383130\n"
".quad 0x3539310937310963,0x2e726162090a3009,0x3b300920636e7973,0x33622e646e61090a\n"
".quad 0x3132317225092032,0x202c39367225202c,0x6d090a3b37357225,0x09203233752e766f\n"
".quad 0x30202c3232317225,0x2e70746573090a3b,0x09203233732e7165,0x7225202c39327025\n"
".quad 0x317225202c313231,0x702540090a3b3232,0x0920617262203932,0x36325f305f744c24\n"
".quad 0x2f2f200a3b323838,0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f\n"
".quad 0x333120656e696c20,0x2064616568202c36,0x2064656c6562616c,0x32325f305f744c24\n"
".quad 0x6f6c2e090a383130,0x3739310937310963,0x702e646c090a3009,0x3233732e6d617261\n"
".quad 0x2c33323172250920,0x616475635f5f5b20,0x385a5f5f6d726170,0x6d75537869646152\n"
".quad 0x615679654b323150,0x6a7269615065756c,0x74666968735f6a6a,0x2e726873090a3b5d\n"
".quad 0x3772250920323375,0x2c38367225202c33,0x0a3b333231722520,0x3233622e646e6109\n"
".quad 0x202c343772250920,0x3532202c33377225,0x2e6c756d090a3b35,0x09203233752e6f6c\n"
".quad 0x7225202c35377225,0x090a3b34202c3437,0x203233752e646461,0x202c343231722509\n"
".quad 0x7225202c35317225,0x747663090a3b3537,0x3233752e3436752e,0x2c35326472250920\n"
".quad 0x0a3b343231722520,0x6469772e6c756d09,0x2509203233752e65,0x7225202c36326472\n"
".quad 0x0a3b34202c343231,0x3436752e64646109,0x2c30316472250920,0x25202c3164722520\n"
".quad 0x6c090a3b36326472,0x6465726168732e64,0x722509203233752e,0x72255b202c353231\n"
".quad 0x0a3b5d302b303164,0x3233752e64646109,0x2c36323172250920,0x202c353231722520\n"
".quad 0x732e7473090a3b31,0x33752e6465726168,0x316472255b092032,0x7225202c5d302b30\n"
".quad 0x744c240a3b363231,0x32383836325f305f,0x6f6c3c2f2f200a3a,0x74726150203e706f\n"
".quad 0x706f6f6c20666f20,0x696c2079646f6220,0x202c36333120656e,0x62616c2064616568\n"
".quad 0x744c242064656c65,0x38313032325f305f,0x3109636f6c2e090a,0x0a30093839310937\n"
".quad 0x6e79732e72616209,0x61090a3b30092063,0x09203233622e646e,0x25202c3732317225\n"
".quad 0x357225202c393672,0x2e766f6d090a3b38,0x3172250920323375,0x090a3b30202c3832\n"
".quad 0x2e71652e70746573,0x3370250920323373,0x3732317225202c30,0x3b3832317225202c\n"
".quad 0x203033702540090a,0x744c240920617262,0x34393337325f305f,0x6f6c3c2f2f200a3b\n"
".quad 0x74726150203e706f,0x706f6f6c20666f20,0x696c2079646f6220,0x202c36333120656e\n"
".quad 0x62616c2064616568,0x744c242064656c65,0x38313032325f305f,0x3109636f6c2e090a\n"
".quad 0x0a30093030320937,0x617261702e646c09,0x2509203233732e6d,0x5f5b202c39323172\n"
".quad 0x726170616475635f,0x646152385a5f5f6d,0x3231506d75537869,0x65756c615679654b\n"
".quad 0x5f6a6a6a72696150,0x0a3b5d7466696873,0x3233752e72687309,0x202c333772250920\n"
".quad 0x7225202c38367225,0x6e61090a3b393231,0x2509203233622e64,0x377225202c343772\n"
".quad 0x0a3b353532202c33,0x2e6f6c2e6c756d09,0x3772250920323375,0x2c34377225202c35\n"
".quad 0x646461090a3b3420,0x722509203233752e,0x317225202c303331,0x3b35377225202c35\n"
".quad 0x36752e747663090a,0x2509203233752e34,0x7225202c37326472,0x756d090a3b303331\n"
".quad 0x752e656469772e6c,0x3264722509203233,0x3033317225202c38,0x6461090a3b34202c\n"
".quad 0x2509203436752e64,0x7225202c30316472,0x32647225202c3164,0x732e646c090a3b38\n"
".quad 0x33752e6465726168,0x3133317225092032,0x30316472255b202c,0x6461090a3b5d302b\n"
".quad 0x2509203233752e64,0x7225202c32333172,0x0a3b31202c313331,0x726168732e747309\n"
".quad 0x09203233752e6465,0x302b30316472255b,0x3233317225202c5d,0x5f305f744c240a3b\n"
".quad 0x200a3a3439333732,0x3e706f6f6c3c2f2f,0x666f207472615020,0x6f6220706f6f6c20\n"
".quad 0x20656e696c207964,0x616568202c363331,0x656c6562616c2064,0x5f305f744c242064\n"
".quad 0x2e090a3831303232,0x3209373109636f6c,0x6162090a30093130,0x0920636e79732e72\n"
".quad 0x2e646e61090a3b30,0x3172250920323362,0x39367225202c3333,0x0a3b39357225202c\n"
".quad 0x3233752e766f6d09,0x2c34333172250920,0x746573090a3b3020,0x3233732e71652e70\n"
".quad 0x202c313370250920,0x25202c3333317225,0x40090a3b34333172,0x6172622031337025\n"
".quad 0x5f305f744c240920,0x200a3b3630393732,0x3e706f6f6c3c2f2f,0x666f207472615020\n"
".quad 0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c363331,0x656c6562616c2064\n"
".quad 0x5f305f744c242064,0x2e090a3831303232,0x3209373109636f6c,0x646c090a30093330\n"
".quad 0x732e6d617261702e,0x3331722509203233,0x75635f5f5b202c35,0x5f5f6d7261706164\n"
".quad 0x537869646152385a,0x79654b3231506d75,0x69615065756c6156,0x6968735f6a6a6a72\n"
".quad 0x6873090a3b5d7466,0x2509203233752e72,0x367225202c333772,0x3533317225202c38\n"
".quad 0x622e646e61090a3b,0x3437722509203233,0x202c33377225202c,0x756d090a3b353532\n"
".quad 0x3233752e6f6c2e6c,0x202c353772250920,0x3b34202c34377225,0x33752e646461090a\n"
".quad 0x3633317225092032,0x202c35317225202c,0x63090a3b35377225,0x752e3436752e7476\n"
".quad 0x3264722509203233,0x3633317225202c39,0x772e6c756d090a3b,0x203233752e656469\n"
".quad 0x202c303364722509,0x34202c3633317225,0x752e646461090a3b,0x3164722509203436\n"
".quad 0x2c31647225202c30,0x0a3b303364722520,0x726168732e646c09,0x09203233752e6465\n"
".quad 0x5b202c3733317225,0x5d302b3031647225,0x752e646461090a3b,0x3331722509203233\n"
".quad 0x3733317225202c38,0x7473090a3b31202c,0x2e6465726168732e,0x72255b0920323375\n"
".quad 0x202c5d302b303164,0x240a3b3833317225,0x3937325f305f744c,0x3c2f2f200a3a3630\n"
".quad 0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f,0x36333120656e696c\n"
".quad 0x6c2064616568202c,0x242064656c656261,0x3032325f305f744c,0x636f6c2e090a3831\n"
".quad 0x0934303209373109,0x732e726162090a30,0x0a3b300920636e79,0x3233622e646e6109\n"
".quad 0x2c39333172250920,0x25202c3936722520,0x6f6d090a3b303672,0x2509203233752e76\n"
".quad 0x3b30202c30343172,0x652e70746573090a,0x2509203233732e71,0x317225202c323370\n"
".quad 0x34317225202c3933,0x33702540090a3b30,0x2409206172622032,0x3438325f305f744c\n"
".quad 0x3c2f2f200a3b3831,0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f\n"
".quad 0x36333120656e696c,0x6c2064616568202c,0x242064656c656261,0x3032325f305f744c\n"
".quad 0x636f6c2e090a3831,0x0936303209373109,0x61702e646c090a30,0x203233732e6d6172\n"
".quad 0x202c313431722509,0x70616475635f5f5b,0x52385a5f5f6d7261,0x506d755378696461\n"
".quad 0x6c615679654b3231,0x6a6a726961506575,0x5d74666968735f6a,0x752e726873090a3b\n"
".quad 0x3337722509203233,0x202c38367225202c,0x090a3b3134317225,0x203233622e646e61\n"
".quad 0x25202c3437722509,0x353532202c333772,0x6c2e6c756d090a3b,0x2509203233752e6f\n"
".quad 0x377225202c353772,0x61090a3b34202c34,0x09203233752e6464,0x25202c3234317225\n"
".quad 0x377225202c353172,0x2e747663090a3b35,0x203233752e343675,0x202c313364722509\n"
".quad 0x090a3b3234317225,0x656469772e6c756d,0x722509203233752e,0x317225202c323364\n"
".quad 0x090a3b34202c3234,0x203436752e646461,0x202c303164722509,0x7225202c31647225\n"
".quad 0x646c090a3b323364,0x2e6465726168732e,0x3172250920323375,0x6472255b202c3334\n"
".quad 0x090a3b5d302b3031,0x203233752e646461,0x202c343431722509,0x31202c3334317225\n"
".quad 0x68732e7473090a3b,0x3233752e64657261,0x30316472255b0920,0x317225202c5d302b\n"
".quad 0x5f744c240a3b3434,0x3a38313438325f30,0x6f6f6c3c2f2f200a,0x2074726150203e70\n"
".quad 0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3633312065,0x6562616c20646165\n"
".quad 0x5f744c242064656c,0x0a38313032325f30,0x373109636f6c2e09,0x090a300937303209\n"
".quad 0x636e79732e726162,0x6e61090a3b300920,0x2509203233622e64,0x7225202c35343172\n"
".quad 0x31367225202c3936,0x752e766f6d090a3b,0x3431722509203233,0x73090a3b30202c36\n"
".quad 0x732e71652e707465,0x3333702509203233,0x2c3534317225202c,0x0a3b363431722520\n"
".quad 0x6220333370254009,0x5f744c2409206172,0x3b30333938325f30,0x6f6f6c3c2f2f200a\n"
".quad 0x2074726150203e70,0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3633312065\n"
".quad 0x6562616c20646165,0x5f744c242064656c,0x0a38313032325f30,0x373109636f6c2e09\n"
".quad 0x090a300939303209,0x6d617261702e646c,0x722509203233732e,0x5f5f5b202c373431\n"
".quad 0x6d72617061647563,0x69646152385a5f5f,0x4b3231506d755378,0x5065756c61567965\n"
".quad 0x735f6a6a6a726961,0x090a3b5d74666968,0x203233752e726873,0x25202c3337722509\n"
".quad 0x317225202c383672,0x646e61090a3b3734,0x722509203233622e,0x33377225202c3437\n"
".quad 0x090a3b353532202c,0x752e6f6c2e6c756d,0x3537722509203233,0x202c34377225202c\n"
".quad 0x2e646461090a3b34,0x3172250920323375,0x35317225202c3834,0x0a3b35377225202c\n"
".quad 0x3436752e74766309,0x722509203233752e,0x317225202c333364,0x6c756d090a3b3834\n"
".quad 0x33752e656469772e,0x3433647225092032,0x2c3834317225202c,0x646461090a3b3420\n"
".quad 0x722509203436752e,0x647225202c303164,0x3433647225202c31,0x68732e646c090a3b\n"
".quad 0x3233752e64657261,0x2c39343172250920,0x2b30316472255b20,0x646461090a3b5d30\n"
".quad 0x722509203233752e,0x317225202c303531,0x090a3b31202c3934,0x65726168732e7473\n"
".quad 0x5b09203233752e64,0x5d302b3031647225,0x3b3035317225202c,0x325f305f744c240a\n"
".quad 0x2f200a3a30333938,0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c\n"
".quad 0x3120656e696c2079,0x64616568202c3633,0x64656c6562616c20,0x325f305f744c2420\n"
".quad 0x6c2e090a38313032,0x313209373109636f,0x726162090a300930,0x300920636e79732e\n"
".quad 0x622e646e61090a3b,0x3531722509203233,0x2c39367225202c31,0x090a3b3236722520\n"
".quad 0x203233752e766f6d,0x202c323531722509,0x70746573090a3b30,0x203233732e71652e\n"
".quad 0x25202c3433702509,0x7225202c31353172,0x2540090a3b323531,0x2061726220343370\n"
".quad 0x325f305f744c2409,0x2f200a3b32343439,0x203e706f6f6c3c2f,0x20666f2074726150\n"
".quad 0x646f6220706f6f6c,0x3120656e696c2079,0x64616568202c3633,0x64656c6562616c20\n"
".quad 0x325f305f744c2420,0x6c2e090a38313032,0x313209373109636f,0x2e646c090a300932\n"
".quad 0x33732e6d61726170,0x3335317225092032,0x6475635f5f5b202c,0x5a5f5f6d72617061\n"
".quad 0x7553786964615238,0x5679654b3231506d,0x7269615065756c61,0x666968735f6a6a6a\n"
".quad 0x726873090a3b5d74,0x722509203233752e,0x38367225202c3337,0x3b3335317225202c\n"
".quad 0x33622e646e61090a,0x2c34377225092032,0x32202c3337722520,0x6c756d090a3b3535\n"
".quad 0x203233752e6f6c2e,0x25202c3537722509,0x0a3b34202c343772,0x3233752e64646109\n"
".quad 0x2c34353172250920,0x25202c3531722520,0x7663090a3b353772,0x33752e3436752e74\n"
".quad 0x3533647225092032,0x3b3435317225202c,0x69772e6c756d090a,0x09203233752e6564\n"
".quad 0x25202c3633647225,0x3b34202c34353172,0x36752e646461090a,0x3031647225092034\n"
".quad 0x202c31647225202c,0x090a3b3633647225,0x65726168732e646c,0x2509203233752e64\n"
".quad 0x255b202c35353172,0x3b5d302b30316472,0x33752e646461090a,0x3635317225092032\n"
".quad 0x2c3535317225202c,0x2e7473090a3b3120,0x752e646572616873,0x6472255b09203233\n"
".quad 0x25202c5d302b3031,0x4c240a3b36353172,0x343439325f305f74,0x6c3c2f2f200a3a32\n"
".quad 0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070,0x2c36333120656e69\n"
".quad 0x616c206461656820,0x4c242064656c6562,0x313032325f305f74,0x09636f6c2e090a38\n"
".quad 0x3009333132093731,0x79732e726162090a,0x090a3b300920636e,0x203233622e646e61\n"
".quad 0x202c373531722509,0x7225202c39367225,0x766f6d090a3b3336,0x722509203233752e\n"
".quad 0x0a3b30202c383531,0x71652e7074657309,0x702509203233732e,0x35317225202c3533\n"
".quad 0x3835317225202c37,0x3533702540090a3b,0x4c24092061726220,0x353939325f305f74\n"
".quad 0x6c3c2f2f200a3b34,0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070\n"
".quad 0x2c36333120656e69,0x616c206461656820,0x4c242064656c6562,0x313032325f305f74\n"
".quad 0x09636f6c2e090a38,0x3009353132093731,0x7261702e646c090a,0x09203233732e6d61\n"
".quad 0x5b202c3935317225,0x6170616475635f5f,0x6152385a5f5f6d72,0x31506d7553786964\n"
".quad 0x756c615679654b32,0x6a6a6a7269615065,0x3b5d74666968735f,0x33752e726873090a\n"
".quad 0x2c33377225092032,0x25202c3836722520,0x61090a3b39353172,0x09203233622e646e\n"
".quad 0x7225202c34377225,0x3b353532202c3337,0x6f6c2e6c756d090a,0x722509203233752e\n"
".quad 0x34377225202c3537,0x6461090a3b34202c,0x2509203233752e64,0x7225202c30363172\n"
".quad 0x35377225202c3531,0x752e747663090a3b,0x09203233752e3436,0x25202c3733647225\n"
".quad 0x6d090a3b30363172,0x2e656469772e6c75,0x6472250920323375,0x36317225202c3833\n"
".quad 0x61090a3b34202c30,0x09203436752e6464,0x25202c3031647225,0x647225202c316472\n"
".quad 0x2e646c090a3b3833,0x752e646572616873,0x3631722509203233,0x316472255b202c31\n"
".quad 0x61090a3b5d302b30,0x09203233752e6464,0x25202c3236317225,0x3b31202c31363172\n"
".quad 0x6168732e7473090a,0x203233752e646572,0x2b30316472255b09,0x36317225202c5d30\n"
".quad 0x305f744c240a3b32,0x0a3a34353939325f,0x706f6f6c3c2f2f20,0x6f2074726150203e\n"
".quad 0x6220706f6f6c2066,0x656e696c2079646f,0x6568202c36333120,0x6c6562616c206461\n"
".quad 0x305f744c24206465,0x090a38313032325f,0x09373109636f6c2e,0x62090a3009363132\n"
".quad 0x20636e79732e7261,0x646e61090a3b3009,0x722509203233622e,0x367225202c333631\n"
".quad 0x3b34367225202c39,0x33752e766f6d090a,0x3436317225092032,0x6573090a3b30202c\n"
".quad 0x33732e71652e7074,0x2c36337025092032,0x202c333631722520,0x090a3b3436317225\n"
".quad 0x7262203633702540,0x305f744c24092061,0x0a3b36363430335f,0x706f6f6c3c2f2f20\n"
".quad 0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f,0x6568202c36333120\n"
".quad 0x6c6562616c206461,0x305f744c24206465,0x090a38313032325f,0x09373109636f6c2e\n"
".quad 0x6c090a3009383132,0x2e6d617261702e64,0x3172250920323373,0x635f5f5b202c3536\n"
".quad 0x5f6d726170616475,0x7869646152385a5f,0x654b3231506d7553,0x615065756c615679\n"
".quad 0x68735f6a6a6a7269,0x73090a3b5d746669,0x09203233752e7268,0x7225202c33377225\n"
".quad 0x36317225202c3836,0x2e646e61090a3b35,0x3772250920323362,0x2c33377225202c34\n"
".quad 0x6d090a3b35353220,0x33752e6f6c2e6c75,0x2c35377225092032,0x34202c3437722520\n"
".quad 0x752e646461090a3b,0x3631722509203233,0x2c35317225202c36,0x090a3b3537722520\n"
".quad 0x2e3436752e747663,0x6472250920323375,0x36317225202c3933,0x2e6c756d090a3b36\n"
".quad 0x3233752e65646977,0x2c30346472250920,0x202c363631722520,0x2e646461090a3b34\n"
".quad 0x6472250920343675,0x31647225202c3031,0x3b3034647225202c,0x6168732e646c090a\n"
".quad 0x203233752e646572,0x202c373631722509,0x302b30316472255b,0x2e646461090a3b5d\n"
".quad 0x3172250920323375,0x36317225202c3836,0x73090a3b31202c37,0x6465726168732e74\n"
".quad 0x255b09203233752e,0x2c5d302b30316472,0x0a3b383631722520,0x30335f305f744c24\n"
".quad 0x2f2f200a3a363634,0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f\n"
".quad 0x333120656e696c20,0x2064616568202c36,0x2064656c6562616c,0x32325f305f744c24\n"
".quad 0x6f6c2e090a383130,0x3931320937310963,0x2e726162090a3009,0x3b300920636e7973\n"
".quad 0x33752e646461090a,0x202c327225092032,0x3b3631202c327225,0x672e70746573090a\n"
".quad 0x2509203233752e74,0x327225202c373370,0x0a3b327225202c35,0x6220373370254009\n"
".quad 0x5f744c2409206172,0x3b38313032325f30,0x325f305f744c240a,0x2e090a3a36303531\n"
".quad 0x3209373109636f6c,0x6873090a30093833,0x2509203233752e72,0x7225202c39363172\n"
".quad 0x6d090a3b32202c31,0x09203233752e766f,0x32202c3037317225,0x746573090a3b3535\n"
".quad 0x3233752e74672e70,0x202c383370250920,0x25202c3936317225,0x40090a3b30373172\n"
".quad 0x6172622038337025,0x5f305f744c240920,0x090a3b3433323133,0x203233752e766f6d\n"
".quad 0x202c313731722509,0x7573090a3b313732,0x2509203233752e62,0x7225202c32373172\n"
".quad 0x317225202c313731,0x726873090a3b3936,0x722509203233732e,0x317225202c333731\n"
".quad 0x0a3b3133202c3237,0x3233732e766f6d09,0x2c34373172250920,0x6e61090a3b353120\n"
".quad 0x2509203233622e64,0x7225202c35373172,0x317225202c333731,0x646461090a3b3437\n"
".quad 0x722509203233732e,0x317225202c363731,0x37317225202c3537,0x2e726873090a3b32\n"
".quad 0x3172250920323373,0x37317225202c3737,0x61090a3b34202c36,0x09203233622e646e\n"
".quad 0x25202c3837317225,0x090a3b33202c3172,0x752e6f6c2e6c756d,0x3731722509203233\n"
".quad 0x3936317225202c39,0x756d090a3b34202c,0x3233752e6f6c2e6c,0x2c30383172250920\n"
".quad 0x202c393631722520,0x6461090a3b323931,0x2509203233752e64,0x7225202c31383172\n"
".quad 0x317225202c383731,0x646461090a3b3937,0x722509203233752e,0x317225202c323831\n"
".quad 0x3038317225202c37,0x752e646461090a3b,0x3831722509203233,0x3837317225202c33\n"
".quad 0x3b3238317225202c,0x36752e766f6d090a,0x3134647225092034,0x786964615264202c\n"
".quad 0x6f6d090a3b6d7553,0x2509203233732e76,0x7225202c34383172,0x744c240a3b373731\n"
".quad 0x36343731335f305f,0x6f6c3c2f2f200a3a,0x706f6f4c203e706f,0x696c2079646f6220\n"
".quad 0x202c38333220656e,0x20676e697473656e,0x31203a6874706564,0x616d69747365202c\n"
".quad 0x7265746920646574,0x203a736e6f697461,0x0a6e776f6e6b6e75,0x373109636f6c2e09\n"
".quad 0x090a300931343209,0x2e3436752e747663,0x6472250920323375,0x38317225202c3234\n"
".quad 0x2e6c756d090a3b31,0x3233752e65646977,0x2c33346472250920,0x202c313831722520\n"
".quad 0x2e646461090a3b34,0x6472250920343675,0x31647225202c3434,0x3b3334647225202c\n"
".quad 0x6168732e646c090a,0x203233752e646572,0x202c353831722509,0x302b34346472255b\n"
".quad 0x2e747663090a3b5d,0x203233752e343675,0x202c353464722509,0x090a3b3338317225\n"
".quad 0x656469772e6c756d,0x722509203233752e,0x317225202c363464,0x090a3b34202c3338\n"
".quad 0x203436752e646461,0x202c373464722509,0x25202c3134647225,0x73090a3b36346472\n"
".quad 0x6c61626f6c672e74,0x255b09203233752e,0x2c5d302b37346472,0x0a3b353831722520\n"
".quad 0x3233752e64646109,0x2c33383172250920,0x202c333831722520,0x61090a3b32373033\n"
".quad 0x09203233752e6464,0x25202c3937317225,0x3436202c39373172,0x752e646461090a3b\n"
".quad 0x3831722509203233,0x3138317225202c31,0x6d090a3b3436202c,0x09203233752e766f\n"
".quad 0x31202c3638317225,0x6573090a3b303230,0x33752e656c2e7074,0x2c39337025092032\n"
".quad 0x202c393731722520,0x090a3b3638317225,0x7262203933702540,0x305f744c24092061\n"
".quad 0x0a3b36343731335f,0x31335f305f744c24,0x6c2e090a3a343332,0x343209373109636f\n"
".quad 0x697865090a300934,0x6557444c240a3b74,0x6152385a5f5f646e,0x31506d7553786964\n"
".quad 0x756c615679654b32,0x6a6a6a7269615065,0x202f2f207d090a3a,0x7869646152385a5f\n"
".quad 0x654b3231506d7553,0x615065756c615679,0x2e090a6a6a6a7269,0x2e206c61626f6c67\n"
".quad 0x2034206e67696c61,0x646152642038622e,0x536b636f6c427869,0x0a3b5d34365b6d75\n"
".quad 0x7972746e652e090a,0x64615234315a5f20,0x7869666572507869,0x0a7b090a766d7553\n"
".quad 0x752e206765722e09,0x30373c7225203233,0x6765722e090a3b3e,0x7225203436752e20\n"
".quad 0x090a3b3e30333c64,0x72702e206765722e,0x35313c7025206465,0x636f6c2e090a3b3e\n"
".quad 0x0935343209373109,0x656257444c240a30,0x34315a5f5f6e6967,0x6572507869646152\n"
".quad 0x3a766d7553786966,0x3109636f6c2e090a,0x0a30093936320937,0x3233752e766f6d09\n"
".quad 0x25202c3172250920,0x090a3b782e646974,0x203233622e646e61,0x7225202c32722509\n"
".quad 0x090a3b3531202c31,0x203233752e726873,0x7225202c33722509,0x6d090a3b34202c31\n"
".quad 0x33752e6f6c2e6c75,0x202c347225092032,0x3b3731202c337225,0x33752e646461090a\n"
".quad 0x202c357225092032,0x347225202c327225,0x752e766f6d090a3b,0x2c36722509203233\n"
".quad 0x3536313334312d20,0x6d090a3b35363735,0x33752e69682e6c75,0x202c377225092032\n"
".quad 0x367225202c317225,0x752e726873090a3b,0x2c38722509203233,0x3b37202c37722520\n"
".quad 0x33752e766f6d090a,0x202c397225092032,0x782e646961746325,0x6c2e6c756d090a3b\n"
".quad 0x2509203233752e6f,0x397225202c303172,0x6d090a3b3631202c,0x09203233752e766f\n"
".quad 0x312d202c31317225,0x3637353536313334,0x2e6c756d090a3b35,0x09203233752e6968\n"
".quad 0x7225202c32317225,0x3b31317225202c31,0x33752e726873090a,0x2c33317225092032\n"
".quad 0x37202c3231722520,0x6c2e6c756d090a3b,0x2509203233752e6f,0x317225202c343172\n"
".quad 0x0a3b323931202c33,0x3233752e62757309,0x202c353172250920,0x317225202c317225\n"
".quad 0x2e646461090a3b34,0x3172250920323375,0x202c387225202c36,0x6d090a3b30317225\n"
".quad 0x33752e6f6c2e6c75,0x2c37317225092032,0x31202c3631722520,0x646461090a3b3239\n"
".quad 0x722509203233752e,0x35317225202c3831,0x0a3b37317225202c,0x3233732e766f6d09\n"
".quad 0x202c393172250920,0x6d090a3b38317225,0x33752e6f6c2e6c75,0x2c30327225092032\n"
".quad 0x3033202c39722520,0x646461090a3b3237,0x722509203233752e,0x30327225202c3132\n"
".quad 0x0a3b32373033202c,0x656c2e7074657309,0x702509203233752e,0x2c31327225202c31\n"
".quad 0x090a3b3831722520,0x6172622031702540,0x5f315f744c240920,0x6d090a3b32383637\n"
".quad 0x09203436752e766f,0x5264202c31647225,0x3b6d755378696461,0x36752e766f6d090a\n"
".quad 0x2c32647225092034,0x5378696461527320,0x627573090a3b6d75,0x722509203233752e\n"
".quad 0x31327225202c3232,0x0a3b38317225202c,0x3233752e64646109,0x202c333272250920\n"
".quad 0x3931202c32327225,0x2e766f6d090a3b31,0x3272250920323373,0x313334312d202c34\n"
".quad 0x0a3b353637353536,0x3233732e766f6d09,0x202c353272250920,0x70746573090a3b30\n"
".quad 0x203233732e746c2e,0x7225202c32702509,0x35327225202c3332,0x732e736261090a3b\n"
".quad 0x3632722509203233,0x0a3b33327225202c,0x2e69682e6c756d09,0x3272250920323375\n"
".quad 0x2c36327225202c37,0x090a3b3432722520,0x203233732e726873,0x25202c3832722509\n"
".quad 0x0a3b37202c373272,0x7573203270254009,0x2509203233732e62,0x327225202c383272\n"
".quad 0x3b38327225202c35,0x33732e766f6d090a,0x2c39327225092032,0x090a3b3832722520\n"
".quad 0x2e3436752e747663,0x6472250920323375,0x0a3b357225202c33,0x6469772e6c756d09\n"
".quad 0x2509203233752e65,0x357225202c346472,0x6461090a3b34202c,0x2509203436752e64\n"
".quad 0x647225202c356472,0x3b32647225202c34,0x36752e747663090a,0x2509203233752e34\n"
".quad 0x317225202c366472,0x2e6c756d090a3b38,0x3233752e65646977,0x202c376472250920\n"
".quad 0x3b34202c38317225,0x36752e646461090a,0x2c38647225092034,0x25202c3164722520\n"
".quad 0x6f6d090a3b376472,0x2509203233732e76,0x327225202c303372,0x315f744c240a3b39\n"
".quad 0x200a3a343931385f,0x3e706f6f6c3c2f2f,0x6f6220706f6f4c20,0x20656e696c207964\n"
".quad 0x73656e202c393632,0x70656420676e6974,0x65202c31203a6874,0x646574616d697473\n"
".quad 0x6974617265746920,0x6b6e75203a736e6f,0x6c2e090a6e776f6e,0x373209373109636f\n"
".quad 0x2e646c090a300934,0x752e6c61626f6c67,0x3133722509203233,0x2b386472255b202c\n"
".quad 0x2e7473090a3b5d30,0x752e646572616873,0x6472255b09203233,0x7225202c5d302b35\n"
".quad 0x6f6c2e090a3b3133,0x3537320937310963,0x2e646461090a3009,0x6472250920343675\n"
".quad 0x2c35647225202c35,0x61090a3b36313820,0x09203233752e6464,0x7225202c39317225\n"
".quad 0x3b323931202c3931,0x36752e646461090a,0x2c38647225092034,0x37202c3864722520\n"
".quad 0x746573090a3b3836,0x3233752e74672e70,0x25202c3370250920,0x317225202c313272\n"
".quad 0x33702540090a3b39,0x4c24092061726220,0x343931385f315f74,0x5f315f744c240a3b\n"
".quad 0x6d090a3a32383637,0x09203436752e766f,0x5264202c31647225,0x3b6d755378696461\n"
".quad 0x36752e766f6d090a,0x2c32647225092034,0x5378696461527320,0x6f6c2e090a3b6d75\n"
".quad 0x3937320937310963,0x2e726162090a3009,0x3b300920636e7973,0x3109636f6c2e090a\n"
".quad 0x0a30093338320937,0x2e6f6c2e6c756d09,0x3372250920323375,0x202c317225202c32\n"
".quad 0x766f6d090a3b3731,0x722509203233732e,0x32337225202c3333,0x752e646461090a3b\n"
".quad 0x3433722509203233,0x202c32337225202c,0x746573090a3b3631,0x3233752e74672e70\n"
".quad 0x25202c3470250920,0x337225202c343372,0x70252140090a3b32,0x2409206172622034\n"
".quad 0x3037385f315f744c,0x2e747663090a3b36,0x203233732e343673,0x25202c3964722509\n"
".quad 0x756d090a3b323372,0x732e656469772e6c,0x3164722509203233,0x2c32337225202c30\n"
".quad 0x646461090a3b3420,0x722509203436752e,0x647225202c313164,0x3031647225202c32\n"
".quad 0x752e766f6d090a3b,0x3533722509203233,0x744c240a3b30202c,0x3a383132395f315f\n"
".quad 0x6f6f6c3c2f2f200a,0x20706f6f4c203e70,0x6e696c2079646f62,0x6e202c3338322065\n"
".quad 0x6420676e69747365,0x2c31203a68747065,0x6974617265746920,0x0a3631203a736e6f\n"
".quad 0x373109636f6c2e09,0x090a300938383209,0x65726168732e646c,0x2509203233752e64\n"
".quad 0x72255b202c363372,0x0a3b5d302b313164,0x3233752e64646109,0x202c353372250920\n"
".quad 0x7225202c36337225,0x6f6c2e090a3b3533,0x3938320937310963,0x732e7473090a3009\n"
".quad 0x33752e6465726168,0x316472255b092032,0x7225202c5d302b31,0x6f6c2e090a3b3533\n"
".quad 0x3039320937310963,0x2e646461090a3009,0x3372250920323373,0x2c33337225202c33\n"
".quad 0x646461090a3b3120,0x722509203436752e,0x647225202c313164,0x090a3b34202c3131\n"
".quad 0x2e656e2e70746573,0x3570250920323375,0x202c33337225202c,0x40090a3b34337225\n"
".quad 0x2061726220357025,0x395f315f744c2409,0x744c240a3b383132,0x3a363037385f315f\n"
".quad 0x3109636f6c2e090a,0x0a30093239320937,0x6e79732e72616209,0x2e090a3b30092063\n"
".quad 0x3309373109636f6c,0x7663090a30093530,0x33732e3436732e74,0x3231647225092032\n"
".quad 0x0a3b32337225202c,0x6469772e6c756d09,0x2509203233732e65,0x7225202c33316472\n"
".quad 0x090a3b34202c3233,0x203436752e646461,0x202c343164722509,0x7225202c32647225\n"
".quad 0x646c090a3b333164,0x2e6465726168732e,0x3372250920323375,0x316472255b202c37\n"
".quad 0x090a3b5d30362b34,0x65726168732e7473,0x5b09203233752e64,0x34362b3431647225\n"
".quad 0x3b37337225202c5d,0x3109636f6c2e090a,0x0a30093630330937,0x6e79732e72616209\n"
".quad 0x6d090a3b30092063,0x09203233732e766f,0x3731202c38337225,0x5f315f744c240a3b\n"
".quad 0x200a3a3234323031,0x3e706f6f6c3c2f2f,0x6f6220706f6f4c20,0x20656e696c207964\n"
".quad 0x73656e202c363033,0x70656420676e6974,0x65202c31203a6874,0x646574616d697473\n"
".quad 0x6974617265746920,0x6b6e75203a736e6f,0x7573090a6e776f6e,0x2509203233732e62\n"
".quad 0x337225202c393372,0x3b38337225202c32,0x33732e646461090a,0x2c30347225092032\n"
".quad 0x31202c3933722520,0x2e766f6d090a3b36,0x3472250920323375,0x73090a3b30202c31\n"
".quad 0x732e656c2e707465,0x2c36702509203233,0x25202c3034722520,0x2540090a3b313472\n"
".quad 0x0920617262203670,0x30315f315f744c24,0x2f2f200a3b343537,0x50203e706f6f6c3c\n"
".quad 0x6c20666f20747261,0x79646f6220706f6f,0x303320656e696c20,0x2064616568202c36\n"
".quad 0x2064656c6562616c,0x30315f315f744c24,0x6f6c2e090a323432,0x3231330937310963\n"
".quad 0x2e747663090a3009,0x203233732e343673,0x202c353164722509,0x6d090a3b39337225\n"
".quad 0x2e656469772e6c75,0x6472250920323373,0x39337225202c3631,0x6461090a3b34202c\n"
".quad 0x2509203436752e64,0x7225202c37316472,0x31647225202c3264,0x732e646c090a3b36\n"
".quad 0x33752e6465726168,0x2c32347225092032,0x2b37316472255b20,0x7262090a3b5d3436\n"
".quad 0x240920696e752e61,0x3430315f315f744c,0x5f744c240a3b3839,0x3a34353730315f31\n"
".quad 0x6f6f6c3c2f2f200a,0x2074726150203e70,0x20706f6f6c20666f,0x6e696c2079646f62\n"
".quad 0x68202c3630332065,0x6562616c20646165,0x5f744c242064656c,0x0a32343230315f31\n"
".quad 0x3233752e766f6d09,0x202c323472250920,0x315f744c240a3b30,0x0a3a38393430315f\n"
".quad 0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f\n"
".quad 0x6568202c36303320,0x6c6562616c206461,0x315f744c24206465,0x090a32343230315f\n"
".quad 0x09373109636f6c2e,0x62090a3009333133,0x20636e79732e7261,0x6f6c2e090a3b3009\n"
".quad 0x3431330937310963,0x732e646c090a3009,0x33752e6465726168,0x2c33347225092032\n"
".quad 0x2b34316472255b20,0x6461090a3b5d3436,0x2509203233752e64,0x347225202c343472\n"
".quad 0x3b32347225202c33,0x6168732e7473090a,0x203233752e646572,0x2b34316472255b09\n"
".quad 0x347225202c5d3436,0x636f6c2e090a3b34,0x0935313309373109,0x732e726162090a30\n"
".quad 0x0a3b300920636e79,0x373109636f6c2e09,0x090a300936313309,0x732e6f6c2e6c756d\n"
".quad 0x3833722509203233,0x202c38337225202c,0x2e766f6d090a3b32,0x3472250920323375\n"
".quad 0x3b33363233202c35,0x6c2e70746573090a,0x2509203233732e65,0x38337225202c3770\n"
".quad 0x0a3b35347225202c,0x7262203770254009,0x315f744c24092061,0x0a3b32343230315f\n"
".quad 0x373109636f6c2e09,0x090a300935323309,0x203233732e766f6d,0x25202c3333722509\n"
".quad 0x7573090a3b323372,0x2509203233732e62,0x337225202c363472,0x6d090a3b31202c32\n"
".quad 0x09203233752e766f,0x3b30202c37347225,0x6c2e70746573090a,0x2509203233732e65\n"
".quad 0x36347225202c3870,0x0a3b37347225202c,0x7262203870254009,0x315f744c24092061\n"
".quad 0x0a3b32323531315f,0x373109636f6c2e09,0x090a300938323309,0x65726168732e646c\n"
".quad 0x2509203233752e64,0x72255b202c383472,0x3b5d342d2b343164,0x6e752e617262090a\n"
".quad 0x315f744c24092069,0x0a3b36363231315f,0x31315f315f744c24,0x6f6d090a3a323235\n"
".quad 0x2509203233752e76,0x0a3b30202c383472,0x31315f315f744c24,0x2140090a3a363632\n"
".quad 0x2061726220347025,0x315f315f744c2409,0x6d090a3b38373731,0x09203436732e766f\n"
".quad 0x25202c3131647225,0x4c240a3b34316472,0x393232315f315f74,0x6c3c2f2f200a3a30\n"
".quad 0x6f6f4c203e706f6f,0x6c2079646f622070,0x2c38323320656e69,0x676e697473656e20\n"
".quad 0x203a687470656420,0x6172657469202c31,0x31203a736e6f6974,0x09636f6c2e090a36\n"
".quad 0x3009313333093731,0x6168732e646c090a,0x203233752e646572,0x5b202c3934722509\n"
".quad 0x5d302b3131647225,0x752e646461090a3b,0x3035722509203233,0x202c39347225202c\n"
".quad 0x73090a3b38347225,0x6465726168732e74,0x255b09203233752e,0x2c5d302b31316472\n"
".quad 0x090a3b3035722520,0x09373109636f6c2e,0x61090a3009323333,0x09203233732e6464\n"
".quad 0x7225202c33337225,0x090a3b31202c3333,0x203436752e646461,0x202c313164722509\n"
".quad 0x34202c3131647225,0x2e70746573090a3b,0x09203233752e656e,0x337225202c397025\n"
".quad 0x3b34337225202c33,0x622039702540090a,0x5f744c2409206172,0x3b30393232315f31\n"
".quad 0x315f315f744c240a,0x2e090a3a38373731,0x3309373109636f6c,0x6162090a30093433\n"
".quad 0x0920636e79732e72,0x636f6c2e090a3b30,0x0935343309373109,0x752e646461090a30\n"
".quad 0x3135722509203233,0x202c38317225202c,0x2e766f6d090a3b31,0x3172250920323373\n"
".quad 0x3b31357225202c39,0x6f6c2e6c756d090a,0x722509203233752e,0x2c397225202c3235\n"
".quad 0x61090a3b36353220,0x09203233752e6464,0x7225202c33357225,0x3b363532202c3235\n"
".quad 0x33752e726873090a,0x2c34357225092032,0x34202c3335722520,0x6c2e6c756d090a3b\n"
".quad 0x2509203233752e6f,0x357225202c353572,0x0a3b323931202c34,0x656c2e7074657309\n"
".quad 0x702509203233752e,0x35357225202c3031,0x0a3b31357225202c,0x6220303170254009\n"
".quad 0x5f744c2409206172,0x3b32303832315f31,0x33752e627573090a,0x2c36357225092032\n"
".quad 0x25202c3535722520,0x6461090a3b313572,0x2509203233752e64,0x357225202c373572\n"
".quad 0x0a3b313931202c36,0x3233732e766f6d09,0x202c383572250920,0x353536313334312d\n"
".quad 0x6f6d090a3b353637,0x2509203233732e76,0x0a3b30202c393572,0x746c2e7074657309\n"
".quad 0x702509203233732e,0x37357225202c3131,0x0a3b39357225202c,0x3233732e73626109\n"
".quad 0x202c303672250920,0x6d090a3b37357225,0x33752e69682e6c75,0x2c31367225092032\n"
".quad 0x25202c3036722520,0x6873090a3b383572,0x2509203233732e72,0x367225202c323672\n"
".quad 0x40090a3b37202c31,0x6275732031317025,0x722509203233732e,0x39357225202c3236\n"
".quad 0x0a3b32367225202c,0x3233732e766f6d09,0x202c333672250920,0x63090a3b32367225\n"
".quad 0x752e3436752e7476,0x3164722509203233,0x0a3b357225202c38,0x6469772e6c756d09\n"
".quad 0x2509203233752e65,0x7225202c39316472,0x61090a3b34202c35,0x09203436752e6464\n"
".quad 0x7225202c35647225,0x647225202c393164,0x2e747663090a3b32,0x203233752e343675\n"
".quad 0x202c303264722509,0x6d090a3b31357225,0x2e656469772e6c75,0x6472250920323375\n"
".quad 0x31357225202c3132,0x6461090a3b34202c,0x2509203436752e64,0x647225202c386472\n"
".quad 0x3132647225202c31,0x732e766f6d090a3b,0x3436722509203233,0x0a3b33367225202c\n"
".quad 0x33315f315f744c24,0x2f2f200a3a343133,0x4c203e706f6f6c3c,0x79646f6220706f6f\n"
".quad 0x343320656e696c20,0x697473656e202c35,0x687470656420676e,0x747365202c31203a\n"
".quad 0x6920646574616d69,0x6e6f697461726574,0x6f6e6b6e75203a73,0x636f6c2e090a6e77\n"
".quad 0x0938343309373109,0x68732e646c090a30,0x3233752e64657261,0x202c353672250920\n"
".quad 0x5d302b356472255b,0x6c672e7473090a3b,0x3233752e6c61626f,0x2b386472255b0920\n"
".quad 0x35367225202c5d30,0x09636f6c2e090a3b,0x3009303533093731,0x36752e646461090a\n"
".quad 0x2c35647225092034,0x38202c3564722520,0x646461090a3b3631,0x722509203233752e\n"
".quad 0x39317225202c3931,0x090a3b323931202c,0x203436752e646461,0x25202c3864722509\n"
".quad 0x383637202c386472,0x2e70746573090a3b,0x09203233752e7467,0x7225202c32317025\n"
".quad 0x39317225202c3535,0x3231702540090a3b,0x4c24092061726220,0x313333315f315f74\n"
".quad 0x315f744c240a3b34,0x0a3a32303832315f,0x3233752e766f6d09,0x202c363672250920\n"
".quad 0x70746573090a3b30,0x203233752e656e2e,0x25202c3331702509,0x36367225202c3172\n"
".quad 0x3331702540090a3b,0x4c24092061726220,0x323833315f315f74,0x636f6c2e090a3b36\n"
".quad 0x0937353309373109,0x68732e646c090a30,0x3233752e64657261,0x202c373672250920\n"
".quad 0x537869646152735b,0x32353033312b6d75,0x2e766f6d090a3b5d,0x6472250920343675\n"
".quad 0x64615264202c3232,0x536b636f6c427869,0x747663090a3b6d75,0x3233752e3436752e\n"
".quad 0x2c33326472250920,0x6d090a3b39722520,0x2e656469772e6c75,0x6472250920323375\n"
".quad 0x2c397225202c3432,0x646461090a3b3420,0x722509203436752e,0x647225202c353264\n"
".quad 0x32647225202c3232,0x672e7473090a3b34,0x33752e6c61626f6c,0x326472255b092032\n"
".quad 0x7225202c5d302b35,0x6f6c2e090a3b3736,0x3835330937310963,0x2e766f6d090a3009\n"
".quad 0x3672250920323375,0x63090a3b30202c38,0x752e3436752e7476,0x3264722509203233\n"
".quad 0x3b30327225202c36,0x69772e6c756d090a,0x09203233752e6564,0x25202c3732647225\n"
".quad 0x0a3b34202c303272,0x3436752e64646109,0x2c38326472250920,0x25202c3164722520\n"
".quad 0x73090a3b37326472,0x6c61626f6c672e74,0x255b09203233752e,0x2c5d302b38326472\n"
".quad 0x240a3b3836722520,0x3833315f315f744c,0x6f6c2e090a3a3632,0x3036330937310963\n"
".quad 0x74697865090a3009,0x6e6557444c240a3b,0x615234315a5f5f64,0x6966657250786964\n"
".quad 0x090a3a766d755378,0x315a5f202f2f207d,0x7250786964615234,0x766d755378696665\n"
".quad 0x72746e652e090a0a,0x615235325a5f2079,0x664f646441786964,0x646e417374657366\n"
".quad 0x50656c6666756853,0x6c615679654b3231,0x3053726961506575,0x090a2820696a6a5f\n"
".quad 0x206d617261702e09,0x635f5f203436752e,0x5f6d726170616475,0x6964615235325a5f\n"
".quad 0x7366664f64644178,0x6853646e41737465,0x323150656c666675,0x65756c615679654b\n"
".quad 0x6a5f305372696150,0x2c637253705f696a,0x617261702e09090a,0x5f203436752e206d\n"
".quad 0x726170616475635f,0x615235325a5f5f6d,0x664f646441786964,0x646e417374657366\n"
".quad 0x50656c6666756853,0x6c615679654b3231,0x3053726961506575,0x7344705f696a6a5f\n"
".quad 0x61702e09090a2c74,0x3233752e206d6172,0x70616475635f5f20,0x35325a5f5f6d7261\n"
".quad 0x6464417869646152,0x417374657366664f,0x6c6666756853646e,0x5679654b32315065\n"
".quad 0x7269615065756c61,0x655f696a6a5f3053,0x2c73746e656d656c,0x617261702e09090a\n"
".quad 0x5f203233752e206d,0x726170616475635f,0x615235325a5f5f6d,0x664f646441786964\n"
".quad 0x646e417374657366,0x50656c6666756853,0x6c615679654b3231,0x3053726961506575\n"
".quad 0x656c655f696a6a5f,0x6f725f73746e656d,0x6f745f6465646e75,0x090a2c323730335f\n"
".quad 0x206d617261702e09,0x635f5f203233732e,0x5f6d726170616475,0x6964615235325a5f\n"
".quad 0x7366664f64644178,0x6853646e41737465,0x323150656c666675,0x65756c615679654b\n"
".quad 0x6a5f305372696150,0x74666968735f696a,0x722e090a7b090a29,0x203233752e206765\n"
".quad 0x3b3e3833323c7225,0x2e206765722e090a,0x3c64722520343675,0x2e090a3b3e383031\n"
".quad 0x6572702e20676572,0x3e35343c70252064,0x5f5f202f2f090a3b,0x636f6c5f61647563\n"
".quad 0x325f7261765f6c61,0x5f32325f33323538,0x736e6f635f6e6f6e,0x203d2070766b5f74\n"
".quad 0x09636f6c2e090a30,0x3009343733093731,0x67656257444c240a,0x5235325a5f5f6e69\n"
".quad 0x4f64644178696461,0x6e41737465736666,0x656c666675685364,0x615679654b323150\n"
".quad 0x537269615065756c,0x090a3a696a6a5f30,0x203233752e766f6d,0x7425202c31722509\n"
".quad 0x6d090a3b782e6469,0x09203233752e766f,0x0a3b30202c327225,0x656e2e7074657309\n"
".quad 0x702509203233752e,0x202c317225202c31,0x2540090a3b327225,0x0920617262203170\n"
".quad 0x33325f325f744c24,0x6c2e090a3b303138,0x373309373109636f,0x766f6d090a300938\n"
".quad 0x722509203233752e,0x73090a3b30202c33,0x6465726168732e74,0x735b09203233752e\n"
".quad 0x6d75537869646152,0x202c5d363930342b,0x744c240a3b337225,0x30313833325f325f\n"
".quad 0x752e766f6d090a3a,0x2c34722509203233,0x6573090a3b343120,0x33752e74672e7074\n"
".quad 0x202c327025092032,0x347225202c317225,0x2032702540090a3b,0x744c240920617262\n"
".quad 0x32323334325f325f,0x09636f6c2e090a3b,0x3009313833093731,0x36752e766f6d090a\n"
".quad 0x2c31647225092034,0x5378696461527320,0x747663090a3b6d75,0x3233752e3436752e\n"
".quad 0x202c326472250920,0x756d090a3b317225,0x752e656469772e6c,0x3364722509203233\n"
".quad 0x34202c317225202c,0x752e766f6d090a3b,0x3464722509203436,0x786964615264202c\n"
".quad 0x6d75536b636f6c42,0x752e646461090a3b,0x3564722509203436,0x202c33647225202c\n"
".quad 0x6c090a3b34647225,0x6c61626f6c672e64,0x722509203233752e,0x356472255b202c35\n"
".quad 0x6461090a3b5d302b,0x2509203436752e64,0x647225202c366472,0x3b31647225202c33\n"
".quad 0x6168732e7473090a,0x203233752e646572,0x342b366472255b09,0x7225202c5d303031\n"
".quad 0x325f744c240a3b35,0x0a3a32323334325f,0x3436752e766f6d09,0x202c316472250920\n"
".quad 0x7553786964615273,0x636f6c2e090a3b6d,0x0932383309373109,0x732e726162090a30\n"
".quad 0x0a3b300920636e79,0x3233732e766f6d09,0x31202c3672250920,0x70746573090a3b35\n"
".quad 0x203233732e656c2e,0x7225202c33702509,0x0a3b367225202c31,0x33732e706c657309\n"
".quad 0x202c377225092032,0x7025202c30202c31,0x2e766f6d090a3b33,0x3872250920323373\n"
".quad 0x744c240a3b31202c,0x36343335325f325f,0x6f6c3c2f2f200a3a,0x706f6f4c203e706f\n"
".quad 0x696c2079646f6220,0x202c32383320656e,0x20676e697473656e,0x31203a6874706564\n"
".quad 0x616d69747365202c,0x7265746920646574,0x203a736e6f697461,0x0a6e776f6e6b6e75\n"
".quad 0x3233732e62757309,0x25202c3972250920,0x3b387225202c3172,0x33732e766f6d090a\n"
".quad 0x2c30317225092032,0x746573090a3b3020,0x2e3233752e65672e,0x3172250920323373\n"
".quad 0x202c397225202c31,0x6e090a3b30317225,0x09203233732e6765,0x7225202c32317225\n"
".quad 0x646e61090a3b3131,0x722509203233622e,0x32317225202c3331,0x090a3b377225202c\n"
".quad 0x203233752e766f6d,0x30202c3431722509,0x2e70746573090a3b,0x09203233732e7165\n"
".quad 0x317225202c347025,0x3b34317225202c33,0x622034702540090a,0x5f744c2409206172\n"
".quad 0x3b38353835325f32,0x6f6f6c3c2f2f200a,0x2074726150203e70,0x20706f6f6c20666f\n"
".quad 0x6e696c2079646f62,0x68202c3238332065,0x6562616c20646165,0x5f744c242064656c\n"
".quad 0x0a36343335325f32,0x373109636f6c2e09,0x090a300930393309,0x2e3436732e747663\n"
".quad 0x6472250920323373,0x0a3b397225202c37,0x6469772e6c756d09,0x2509203233732e65\n"
".quad 0x397225202c386472,0x6461090a3b34202c,0x2509203436752e64,0x647225202c396472\n"
".quad 0x3b38647225202c31,0x6168732e646c090a,0x203233752e646572,0x5b202c3531722509\n"
".quad 0x3930342b39647225,0x617262090a3b5d36,0x4c240920696e752e,0x303635325f325f74\n"
".quad 0x325f744c240a3b32,0x0a3a38353835325f,0x706f6f6c3c2f2f20,0x6f2074726150203e\n"
".quad 0x6220706f6f6c2066,0x656e696c2079646f,0x6568202c32383320,0x6c6562616c206461\n"
".quad 0x325f744c24206465,0x090a36343335325f,0x203233752e766f6d,0x30202c3531722509\n"
".quad 0x5f325f744c240a3b,0x200a3a3230363532,0x3e706f6f6c3c2f2f,0x666f207472615020\n"
".quad 0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c323833,0x656c6562616c2064\n"
".quad 0x5f325f744c242064,0x2e090a3634333532,0x3309373109636f6c,0x6162090a30093139\n"
".quad 0x0920636e79732e72,0x70252140090a3b30,0x2409206172622033,0x3136325f325f744c\n"
".quad 0x3c2f2f200a3b3431,0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f\n"
".quad 0x32383320656e696c,0x6c2064616568202c,0x242064656c656261,0x3335325f325f744c\n"
".quad 0x636f6c2e090a3634,0x0933393309373109,0x732e747663090a30,0x09203233732e3436\n"
".quad 0x25202c3031647225,0x6c756d090a3b3172,0x33732e656469772e,0x3131647225092032\n"
".quad 0x34202c317225202c,0x752e646461090a3b,0x3164722509203436,0x2c31647225202c32\n"
".quad 0x0a3b313164722520,0x726168732e646c09,0x09203233752e6465,0x255b202c36317225\n"
".quad 0x3930342b32316472,0x646461090a3b5d36,0x722509203233752e,0x36317225202c3731\n"
".quad 0x0a3b35317225202c,0x726168732e747309,0x09203233752e6465,0x342b32316472255b\n"
".quad 0x7225202c5d363930,0x5f744c240a3b3731,0x3a34313136325f32,0x6f6f6c3c2f2f200a\n"
".quad 0x2074726150203e70,0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3238332065\n"
".quad 0x6562616c20646165,0x5f744c242064656c,0x0a36343335325f32,0x373109636f6c2e09\n"
".quad 0x090a300934393309,0x636e79732e726162,0x6c2e090a3b300920,0x393309373109636f\n"
".quad 0x6c756d090a300935,0x203233732e6f6c2e,0x7225202c38722509,0x6d090a3b32202c38\n"
".quad 0x09203233752e766f,0x3531202c38317225,0x2e70746573090a3b,0x09203233732e656c\n"
".quad 0x387225202c357025,0x0a3b38317225202c,0x7262203570254009,0x325f744c24092061\n"
".quad 0x0a3b36343335325f,0x373109636f6c2e09,0x090a300939303409,0x203233622e646e61\n"
".quad 0x25202c3931722509,0x090a3b33202c3172,0x203233752e726873,0x25202c3032722509\n"
".quad 0x090a3b32202c3172,0x203233752e766f6d,0x25202c3132722509,0x3b782e6469617463\n"
".quad 0x6f6c2e6c756d090a,0x722509203233752e,0x30327225202c3232,0x61090a3b3834202c\n"
".quad 0x09203233752e6464,0x7225202c33327225,0x32327225202c3132,0x6c2e6c756d090a3b\n"
".quad 0x2509203233752e6f,0x327225202c343272,0x61090a3b34202c33,0x09203233752e6464\n"
".quad 0x7225202c35327225,0x34327225202c3931,0x6c2e6c756d090a3b,0x2509203233732e6f\n"
".quad 0x327225202c363272,0x61090a3b34202c30,0x09203233732e6464,0x7225202c37327225\n"
".quad 0x39317225202c3632,0x732e766f6d090a3b,0x3832722509203233,0x0a3b37327225202c\n"
".quad 0x3233752e766f6d09,0x202c393272250920,0x73090a3b33323031,0x732e74672e707465\n"
".quad 0x2c36702509203233,0x25202c3732722520,0x2540090a3b393272,0x0920617262203670\n"
".quad 0x36325f325f744c24,0x6f6d090a3b323838,0x2509203233732e76,0x383031202c303372\n"
".quad 0x2e627573090a3b37,0x3372250920323373,0x2c30337225202c31,0x090a3b3732722520\n"
".quad 0x203233732e726873,0x25202c3233722509,0x3b3133202c313372,0x33732e766f6d090a\n"
".quad 0x2c33337225092032,0x6e61090a3b333620,0x2509203233622e64,0x337225202c343372\n"
".quad 0x3b33337225202c32,0x33732e646461090a,0x2c35337225092032,0x25202c3433722520\n"
".quad 0x6873090a3b313372,0x2509203233732e72,0x337225202c363372,0x6d090a3b36202c35\n"
".quad 0x09203436752e766f,0x64202c3331647225,0x6d75537869646152,0x732e747663090a3b\n"
".quad 0x09203233732e3436,0x25202c3431647225,0x756d090a3b353272,0x732e656469772e6c\n"
".quad 0x3164722509203233,0x2c35327225202c35,0x646461090a3b3420,0x722509203436752e\n"
".quad 0x647225202c363164,0x31647225202c3331,0x2e747663090a3b35,0x203233732e343673\n"
".quad 0x202c373164722509,0x6d090a3b37327225,0x2e656469772e6c75,0x6472250920323373\n"
".quad 0x37327225202c3831,0x6461090a3b34202c,0x2509203436752e64,0x7225202c39316472\n"
".quad 0x31647225202c3164,0x2e766f6d090a3b38,0x3372250920323373,0x3b36337225202c37\n"
".quad 0x325f325f744c240a,0x2f200a3a34393337,0x203e706f6f6c3c2f,0x646f6220706f6f4c\n"
".quad 0x3420656e696c2079,0x7473656e202c3930,0x7470656420676e69,0x7365202c31203a68\n"
".quad 0x20646574616d6974,0x6f69746172657469,0x6e6b6e75203a736e,0x6f6c2e090a6e776f\n"
".quad 0x3231340937310963,0x672e646c090a3009,0x33752e6c61626f6c,0x2c38337225092032\n"
".quad 0x2b36316472255b20,0x766f6d090a3b5d30,0x722509203233732e,0x3334312d202c3933\n"
".quad 0x3b35363735353631,0x33732e766f6d090a,0x2c30347225092032,0x746573090a3b3020\n"
".quad 0x3233732e746c2e70,0x25202c3770250920,0x347225202c353272,0x2e736261090a3b30\n"
".quad 0x3472250920323373,0x3b35327225202c31,0x69682e6c756d090a,0x722509203233752e\n"
".quad 0x31347225202c3234,0x0a3b39337225202c,0x3233732e72687309,0x202c333472250920\n"
".quad 0x3131202c32347225,0x2037702540090a3b,0x203233732e627573,0x25202c3334722509\n"
".quad 0x347225202c303472,0x2e766f6d090a3b33,0x3472250920323373,0x3b33347225202c34\n"
".quad 0x36732e747663090a,0x2509203233732e34,0x7225202c30326472,0x6c756d090a3b3434\n"
".quad 0x33732e656469772e,0x3132647225092032,0x202c34347225202c,0x2e646461090a3b34\n"
".quad 0x6472250920343675,0x31647225202c3232,0x3b3132647225202c,0x6168732e646c090a\n"
".quad 0x203233752e646572,0x5b202c3534722509,0x30342b3232647225,0x6461090a3b5d3639\n"
".quad 0x2509203233752e64,0x337225202c363472,0x3b35347225202c38,0x6168732e7473090a\n"
".quad 0x203233752e646572,0x2b39316472255b09,0x36347225202c5d30,0x09636f6c2e090a3b\n"
".quad 0x3009343134093731,0x33732e646461090a,0x2c35327225092032,0x33202c3532722520\n"
".quad 0x6461090a3b323730,0x2509203436752e64,0x7225202c36316472,0x323231202c363164\n"
".quad 0x646461090a3b3838,0x722509203233732e,0x38327225202c3832,0x61090a3b3436202c\n"
".quad 0x09203436752e6464,0x25202c3931647225,0x3532202c39316472,0x2e766f6d090a3b36\n"
".quad 0x3472250920323375,0x3b33323031202c37,0x6c2e70746573090a,0x2509203233732e65\n"
".quad 0x38327225202c3870,0x0a3b37347225202c,0x7262203870254009,0x325f744c24092061\n"
".quad 0x0a3b34393337325f,0x36325f325f744c24,0x6c2e090a3a323838,0x313409373109636f\n"
".quad 0x726162090a300936,0x300920636e79732e,0x09636f6c2e090a3b,0x3009313334093731\n"
".quad 0x79732e726162090a,0x090a3b300920636e,0x203233622e646e61,0x25202c3834722509\n"
".quad 0x0a3b3531202c3172,0x3233752e72687309,0x202c393472250920,0x0a3b34202c317225\n"
".quad 0x2e6f6c2e6c756d09,0x3572250920323375,0x2c31327225202c30,0x2e646c090a3b3420\n"
".quad 0x33752e6d61726170,0x2c31357225092032,0x616475635f5f5b20,0x325a5f5f6d726170\n"
".quad 0x6441786964615235,0x7374657366664f64,0x6666756853646e41,0x79654b323150656c\n"
".quad 0x69615065756c6156,0x5f696a6a5f305372,0x73746e656d656c65,0x6465646e756f725f\n"
".quad 0x323730335f6f745f,0x2e766f6d090a3b5d,0x3572250920323375,0x313334312d202c32\n"
".quad 0x0a3b353637353536,0x2e69682e6c756d09,0x3572250920323375,0x2c31357225202c33\n"
".quad 0x090a3b3235722520,0x203233752e726873,0x25202c3435722509,0x0a3b37202c333572\n"
".quad 0x3233752e64646109,0x202c353572250920,0x7225202c39347225,0x6c756d090a3b3035\n"
".quad 0x203233752e6f6c2e,0x25202c3635722509,0x357225202c343572,0x2e646461090a3b35\n"
".quad 0x3572250920323373,0x2c38347225202c37,0x090a3b3635722520,0x203233732e766f6d\n"
".quad 0x25202c3835722509,0x6461090a3b373572,0x2509203233752e64,0x357225202c393572\n"
".quad 0x3b36357225202c34,0x672e70746573090a,0x2509203233752e65,0x37357225202c3970\n"
".quad 0x0a3b39357225202c,0x7262203970254009,0x325f744c24092061,0x0a3b36303937325f\n"
".quad 0x3233752e62757309,0x202c303672250920,0x7225202c34357225,0x646461090a3b3834\n"
".quad 0x722509203233752e,0x30367225202c3136,0x73090a3b3531202c,0x09203233732e7268\n"
".quad 0x7225202c32367225,0x0a3b3133202c3136,0x3233732e766f6d09,0x202c333672250920\n"
".quad 0x646e61090a3b3531,0x722509203233622e,0x32367225202c3436,0x0a3b33367225202c\n"
".quad 0x3233732e64646109,0x202c353672250920,0x7225202c34367225,0x726873090a3b3136\n"
".quad 0x722509203233732e,0x35367225202c3636,0x6f6d090a3b34202c,0x2509203233732e76\n"
".quad 0x0a3b30202c373672,0x71652e7074657309,0x702509203233732e,0x38347225202c3031\n"
".quad 0x0a3b37367225202c,0x3233732e766f6d09,0x202c383672250920,0x70746573090a3b31\n"
".quad 0x203233732e71652e,0x25202c3131702509,0x367225202c383472,0x2e766f6d090a3b38\n"
".quad 0x3672250920323373,0x73090a3b32202c39,0x732e71652e707465,0x3231702509203233\n"
".quad 0x202c38347225202c,0x6d090a3b39367225,0x09203233732e766f,0x3b33202c30377225\n"
".quad 0x652e70746573090a,0x2509203233732e71,0x347225202c333170,0x3b30377225202c38\n"
".quad 0x33732e766f6d090a,0x2c31377225092032,0x746573090a3b3420,0x3233732e71652e70\n"
".quad 0x202c343170250920,0x7225202c38347225,0x766f6d090a3b3137,0x722509203233732e\n"
".quad 0x090a3b35202c3237,0x2e71652e70746573,0x3170250920323373,0x2c38347225202c35\n"
".quad 0x090a3b3237722520,0x203233732e766f6d,0x36202c3337722509,0x2e70746573090a3b\n"
".quad 0x09203233732e7165,0x7225202c36317025,0x33377225202c3834,0x732e766f6d090a3b\n"
".quad 0x3437722509203233,0x6573090a3b37202c,0x33732e71652e7074,0x2c37317025092032\n"
".quad 0x25202c3834722520,0x6f6d090a3b343772,0x2509203233732e76,0x0a3b38202c353772\n"
".quad 0x71652e7074657309,0x702509203233732e,0x38347225202c3831,0x0a3b35377225202c\n"
".quad 0x3233732e766f6d09,0x202c363772250920,0x70746573090a3b39,0x203233732e71652e\n"
".quad 0x25202c3931702509,0x377225202c383472,0x2e766f6d090a3b36,0x3772250920323373\n"
".quad 0x090a3b3031202c37,0x2e71652e70746573,0x3270250920323373,0x2c38347225202c30\n"
".quad 0x090a3b3737722520,0x203233732e766f6d,0x31202c3837722509,0x70746573090a3b31\n"
".quad 0x203233732e71652e,0x25202c3132702509,0x377225202c383472,0x2e766f6d090a3b38\n"
".quad 0x3772250920323373,0x090a3b3231202c39,0x2e71652e70746573,0x3270250920323373\n"
".quad 0x2c38347225202c32,0x090a3b3937722520,0x203233732e766f6d,0x31202c3038722509\n"
".quad 0x70746573090a3b33,0x203233732e71652e,0x25202c3332702509,0x387225202c383472\n"
".quad 0x2e766f6d090a3b30,0x3872250920323373,0x090a3b3431202c31,0x2e71652e70746573\n"
".quad 0x3270250920323373,0x2c38347225202c34,0x090a3b3138722520,0x203233732e766f6d\n"
".quad 0x31202c3238722509,0x70746573090a3b35,0x203233732e71652e,0x25202c3532702509\n"
".quad 0x387225202c383472,0x706c6573090a3b32,0x722509203233732e,0x30202c31202c3338\n"
".quad 0x0a3b30317025202c,0x33732e706c657309,0x2c34387225092032,0x25202c30202c3120\n"
".quad 0x6573090a3b313170,0x09203233732e706c,0x2c31202c35387225,0x32317025202c3020\n"
".quad 0x2e706c6573090a3b,0x3872250920323373,0x2c30202c31202c36,0x090a3b3331702520\n"
".quad 0x3233732e706c6573,0x202c373872250920,0x7025202c30202c31,0x6c6573090a3b3431\n"
".quad 0x2509203233732e70,0x202c31202c383872,0x3b35317025202c30,0x732e706c6573090a\n"
".quad 0x3938722509203233,0x202c30202c31202c,0x73090a3b36317025,0x203233732e706c65\n"
".quad 0x31202c3039722509,0x317025202c30202c,0x706c6573090a3b37,0x722509203233732e\n"
".quad 0x30202c31202c3139,0x0a3b38317025202c,0x33732e706c657309,0x2c32397225092032\n"
".quad 0x25202c30202c3120,0x6573090a3b393170,0x09203233732e706c,0x2c31202c33397225\n"
".quad 0x30327025202c3020,0x2e706c6573090a3b,0x3972250920323373,0x2c30202c31202c34\n"
".quad 0x090a3b3132702520,0x3233732e706c6573,0x202c353972250920,0x7025202c30202c31\n"
".quad 0x6c6573090a3b3232,0x2509203233732e70,0x202c31202c363972,0x3b33327025202c30\n"
".quad 0x732e706c6573090a,0x3739722509203233,0x202c30202c31202c,0x73090a3b34327025\n"
".quad 0x203233732e706c65,0x31202c3839722509,0x327025202c30202c,0x702e646c090a3b35\n"
".quad 0x3233752e6d617261,0x202c393972250920,0x70616475635f5f5b,0x35325a5f5f6d7261\n"
".quad 0x6464417869646152,0x417374657366664f,0x6c6666756853646e,0x5679654b32315065\n"
".quad 0x7269615065756c61,0x655f696a6a5f3053,0x5d73746e656d656c,0x732e766f6d090a3b\n"
".quad 0x3031722509203233,0x3b36367225202c30,0x325f325f744c240a,0x2f200a3a38313438\n"
".quad 0x203e706f6f6c3c2f,0x646f6220706f6f4c,0x3420656e696c2079,0x7473656e202c3133\n"
".quad 0x7470656420676e69,0x7365202c31203a68,0x20646574616d6974,0x6f69746172657469\n"
".quad 0x6e6b6e75203a736e,0x746573090a6e776f,0x3233752e746c2e70,0x202c363270250920\n"
".quad 0x7225202c38357225,0x252140090a3b3939,0x2061726220363270,0x325f325f744c2409\n"
".quad 0x2f200a3b30333938,0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c\n"
".quad 0x3420656e696c2079,0x64616568202c3133,0x64656c6562616c20,0x325f325f744c2420\n"
".quad 0x6c2e090a38313438,0x343409373109636f,0x6c756d090a300930,0x203233752e6f6c2e\n"
".quad 0x202c313031722509,0x3b38202c38357225,0x36752e747663090a,0x2509203233752e34\n"
".quad 0x7225202c33326472,0x646c090a3b313031,0x752e6d617261702e,0x3264722509203436\n"
".quad 0x75635f5f5b202c34,0x5f5f6d7261706164,0x786964615235325a,0x657366664f646441\n"
".quad 0x756853646e417374,0x4b323150656c6666,0x5065756c61567965,0x6a6a5f3053726961\n"
".quad 0x3b5d637253705f69,0x36752e646461090a,0x3532647225092034,0x2c3332647225202c\n"
".quad 0x0a3b343264722520,0x626f6c672e646c09,0x33752e32762e6c61,0x303172257b092032\n"
".quad 0x7d33303172252c32,0x35326472255b202c,0x6f6d090a3b5d302b,0x2509203233732e76\n"
".quad 0x7225202c34303172,0x7262090a3b333031,0x240920696e752e61,0x3638325f325f744c\n"
".quad 0x5f744c240a3b3437,0x3a30333938325f32,0x6f6f6c3c2f2f200a,0x2074726150203e70\n"
".quad 0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3133342065,0x6562616c20646165\n"
".quad 0x5f744c242064656c,0x0a38313438325f32,0x373109636f6c2e09,0x090a300933343409\n"
".quad 0x203233752e766f6d,0x202c323031722509,0x325f744c240a3b30,0x0a3a34373638325f\n"
".quad 0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f\n"
".quad 0x6568202c31333420,0x6c6562616c206461,0x325f744c24206465,0x090a38313438325f\n"
".quad 0x3233732e706c6573,0x2c35303172250920,0x25202c30202c3120,0x6e61090a3b363270\n"
".quad 0x2509203233622e64,0x7225202c36303172,0x387225202c353031,0x2e766f6d090a3b33\n"
".quad 0x3172250920323375,0x090a3b30202c3730,0x2e71652e70746573,0x3270250920323373\n"
".quad 0x3630317225202c37,0x3b3730317225202c,0x203732702540090a,0x744c240920617262\n"
".quad 0x36383139325f325f,0x6f6c3c2f2f200a3b,0x74726150203e706f,0x706f6f6c20666f20\n"
".quad 0x696c2079646f6220,0x202c31333420656e,0x62616c2064616568,0x744c242064656c65\n"
".quad 0x38313438325f325f,0x3109636f6c2e090a,0x0a30093437340937,0x617261702e646c09\n"
".quad 0x2509203233732e6d,0x5f5b202c38303172,0x726170616475635f,0x615235325a5f5f6d\n"
".quad 0x664f646441786964,0x646e417374657366,0x50656c6666756853,0x6c615679654b3231\n"
".quad 0x3053726961506575,0x6968735f696a6a5f,0x6873090a3b5d7466,0x2509203233752e72\n"
".quad 0x7225202c39303172,0x317225202c323031,0x646e61090a3b3830,0x722509203233622e\n"
".quad 0x317225202c303131,0x3b353532202c3930,0x6f6c2e6c756d090a,0x722509203233752e\n"
".quad 0x317225202c313131,0x090a3b34202c3031,0x203233752e646461,0x202c323131722509\n"
".quad 0x7225202c39347225,0x7663090a3b313131,0x33752e3436752e74,0x3632647225092032\n"
".quad 0x3b3231317225202c,0x69772e6c756d090a,0x09203233752e6564,0x25202c3732647225\n"
".quad 0x3b34202c32313172,0x36752e646461090a,0x3832647225092034,0x202c31647225202c\n"
".quad 0x090a3b3732647225,0x65726168732e646c,0x2509203233752e64,0x255b202c33313172\n"
".quad 0x3b5d302b38326472,0x33752e646461090a,0x3431317225092032,0x2c3331317225202c\n"
".quad 0x2e7473090a3b3120,0x752e646572616873,0x6472255b09203233,0x25202c5d302b3832\n"
".quad 0x2e090a3b34313172,0x3409373109636f6c,0x756d090a30093537,0x3233752e6f6c2e6c\n"
".quad 0x2c35313172250920,0x202c333131722520,0x2e747663090a3b38,0x203233752e343675\n"
".quad 0x202c393264722509,0x090a3b3531317225,0x6d617261702e646c,0x722509203436752e\n"
".quad 0x5f5f5b202c303364,0x6d72617061647563,0x64615235325a5f5f,0x66664f6464417869\n"
".quad 0x53646e4173746573,0x3150656c66667568,0x756c615679654b32,0x5f30537269615065\n"
".quad 0x747344705f696a6a,0x2e646461090a3b5d,0x6472250920343675,0x32647225202c3133\n"
".quad 0x3033647225202c39,0x732e766f6d090a3b,0x3131722509203233,0x3430317225202c36\n"
".quad 0x6c672e7473090a3b,0x2e32762e6c61626f,0x72255b0920323375,0x202c5d302b313364\n"
".quad 0x252c32303172257b,0x240a3b7d36313172,0x3139325f325f744c,0x3c2f2f200a3a3638\n"
".quad 0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f,0x31333420656e696c\n"
".quad 0x6c2064616568202c,0x242064656c656261,0x3438325f325f744c,0x636f6c2e090a3831\n"
".quad 0x0937373409373109,0x732e726162090a30,0x0a3b300920636e79,0x3233622e646e6109\n"
".quad 0x2c37313172250920,0x202c353031722520,0x6d090a3b34387225,0x09203233752e766f\n"
".quad 0x30202c3831317225,0x2e70746573090a3b,0x09203233732e7165,0x7225202c38327025\n"
".quad 0x317225202c373131,0x702540090a3b3831,0x0920617262203832,0x39325f325f744c24\n"
".quad 0x2f2f200a3b383936,0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f\n"
".quad 0x333420656e696c20,0x2064616568202c31,0x2064656c6562616c,0x38325f325f744c24\n"
".quad 0x6f6c2e090a383134,0x3038340937310963,0x702e646c090a3009,0x3233732e6d617261\n"
".quad 0x2c39313172250920,0x616475635f5f5b20,0x325a5f5f6d726170,0x6441786964615235\n"
".quad 0x7374657366664f64,0x6666756853646e41,0x79654b323150656c,0x69615065756c6156\n"
".quad 0x5f696a6a5f305372,0x0a3b5d7466696873,0x3233752e72687309,0x2c39303172250920\n"
".quad 0x202c323031722520,0x090a3b3931317225,0x203233622e646e61,0x202c303131722509\n"
".quad 0x32202c3930317225,0x6c756d090a3b3535,0x203233752e6f6c2e,0x202c313131722509\n"
".quad 0x34202c3031317225,0x752e646461090a3b,0x3231722509203233,0x2c39347225202c30\n"
".quad 0x0a3b313131722520,0x3436752e74766309,0x722509203233752e,0x317225202c323364\n"
".quad 0x6c756d090a3b3032,0x33752e656469772e,0x3333647225092032,0x2c3032317225202c\n"
".quad 0x646461090a3b3420,0x722509203436752e,0x647225202c383264,0x3333647225202c31\n"
".quad 0x68732e646c090a3b,0x3233752e64657261,0x2c31323172250920,0x2b38326472255b20\n"
".quad 0x646461090a3b5d30,0x722509203233752e,0x317225202c323231,0x090a3b31202c3132\n"
".quad 0x65726168732e7473,0x5b09203233752e64,0x5d302b3832647225,0x3b3232317225202c\n"
".quad 0x3109636f6c2e090a,0x0a30093138340937,0x2e6f6c2e6c756d09,0x3172250920323375\n"
".quad 0x32317225202c3332,0x63090a3b38202c31,0x752e3436752e7476,0x3364722509203233\n"
".quad 0x3332317225202c34,0x61702e646c090a3b,0x203436752e6d6172,0x202c353364722509\n"
".quad 0x70616475635f5f5b,0x35325a5f5f6d7261,0x6464417869646152,0x417374657366664f\n"
".quad 0x6c6666756853646e,0x5679654b32315065,0x7269615065756c61,0x705f696a6a5f3053\n"
".quad 0x61090a3b5d747344,0x09203436752e6464,0x25202c3633647225,0x7225202c34336472\n"
".quad 0x6f6d090a3b353364,0x2509203233732e76,0x7225202c34323172,0x7473090a3b343031\n"
".quad 0x2e6c61626f6c672e,0x09203233752e3276,0x302b36336472255b,0x303172257b202c5d\n"
".quad 0x7d34323172252c32,0x5f325f744c240a3b,0x200a3a3839363932,0x3e706f6f6c3c2f2f\n"
".quad 0x666f207472615020,0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c313334\n"
".quad 0x656c6562616c2064,0x5f325f744c242064,0x2e090a3831343832,0x3409373109636f6c\n"
".quad 0x6162090a30093338,0x0920636e79732e72,0x2e646e61090a3b30,0x3172250920323362\n"
".quad 0x30317225202c3532,0x3b35387225202c35,0x33752e766f6d090a,0x3632317225092032\n"
".quad 0x6573090a3b30202c,0x33732e71652e7074,0x2c39327025092032,0x202c353231722520\n"
".quad 0x090a3b3632317225,0x7262203932702540,0x325f744c24092061,0x0a3b30313230335f\n"
".quad 0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f\n"
".quad 0x6568202c31333420,0x6c6562616c206461,0x325f744c24206465,0x090a38313438325f\n"
".quad 0x09373109636f6c2e,0x6c090a3009363834,0x2e6d617261702e64,0x3172250920323373\n"
".quad 0x635f5f5b202c3732,0x5f6d726170616475,0x6964615235325a5f,0x7366664f64644178\n"
".quad 0x6853646e41737465,0x323150656c666675,0x65756c615679654b,0x6a5f305372696150\n"
".quad 0x74666968735f696a,0x2e726873090a3b5d,0x3172250920323375,0x30317225202c3930\n"
".quad 0x3732317225202c32,0x622e646e61090a3b,0x3131722509203233,0x3930317225202c30\n"
".quad 0x090a3b353532202c,0x752e6f6c2e6c756d,0x3131722509203233,0x3031317225202c31\n"
".quad 0x6461090a3b34202c,0x2509203233752e64,0x7225202c38323172,0x31317225202c3934\n"
".quad 0x2e747663090a3b31,0x203233752e343675,0x202c373364722509,0x090a3b3832317225\n"
".quad 0x656469772e6c756d,0x722509203233752e,0x317225202c383364,0x090a3b34202c3832\n"
".quad 0x203436752e646461,0x202c383264722509,0x7225202c31647225,0x646c090a3b383364\n"
".quad 0x2e6465726168732e,0x3172250920323375,0x6472255b202c3932,0x090a3b5d302b3832\n"
".quad 0x203233752e646461,0x202c303331722509,0x31202c3932317225,0x68732e7473090a3b\n"
".quad 0x3233752e64657261,0x38326472255b0920,0x317225202c5d302b,0x6f6c2e090a3b3033\n"
".quad 0x3738340937310963,0x2e6c756d090a3009,0x09203233752e6f6c,0x25202c3133317225\n"
".quad 0x3b38202c39323172,0x36752e747663090a,0x2509203233752e34,0x7225202c39336472\n"
".quad 0x646c090a3b313331,0x752e6d617261702e,0x3464722509203436,0x75635f5f5b202c30\n"
".quad 0x5f5f6d7261706164,0x786964615235325a,0x657366664f646441,0x756853646e417374\n"
".quad 0x4b323150656c6666,0x5065756c61567965,0x6a6a5f3053726961,0x3b5d747344705f69\n"
".quad 0x36752e646461090a,0x3134647225092034,0x2c3933647225202c,0x0a3b303464722520\n"
".quad 0x3233732e766f6d09,0x2c32333172250920,0x0a3b343031722520,0x626f6c672e747309\n"
".quad 0x33752e32762e6c61,0x346472255b092032,0x257b202c5d302b31,0x3172252c32303172\n"
".quad 0x744c240a3b7d3233,0x30313230335f325f,0x6f6c3c2f2f200a3a,0x74726150203e706f\n"
".quad 0x706f6f6c20666f20,0x696c2079646f6220,0x202c31333420656e,0x62616c2064616568\n"
".quad 0x744c242064656c65,0x38313438325f325f,0x3109636f6c2e090a,0x0a30093938340937\n"
".quad 0x6e79732e72616209,0x61090a3b30092063,0x09203233622e646e,0x25202c3333317225\n"
".quad 0x7225202c35303172,0x766f6d090a3b3638,0x722509203233752e,0x0a3b30202c343331\n"
".quad 0x71652e7074657309,0x702509203233732e,0x33317225202c3033,0x3433317225202c33\n"
".quad 0x3033702540090a3b,0x4c24092061726220,0x323730335f325f74,0x6c3c2f2f200a3b32\n"
".quad 0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070,0x2c31333420656e69\n"
".quad 0x616c206461656820,0x4c242064656c6562,0x313438325f325f74,0x09636f6c2e090a38\n"
".quad 0x3009323934093731,0x7261702e646c090a,0x09203233732e6d61,0x5b202c3533317225\n"
".quad 0x6170616475635f5f,0x5235325a5f5f6d72,0x4f64644178696461,0x6e41737465736666\n"
".quad 0x656c666675685364,0x615679654b323150,0x537269615065756c,0x68735f696a6a5f30\n"
".quad 0x73090a3b5d746669,0x09203233752e7268,0x25202c3930317225,0x7225202c32303172\n"
".quad 0x6e61090a3b353331,0x2509203233622e64,0x7225202c30313172,0x353532202c393031\n"
".quad 0x6c2e6c756d090a3b,0x2509203233752e6f,0x7225202c31313172,0x0a3b34202c303131\n"
".quad 0x3233752e64646109,0x2c36333172250920,0x25202c3934722520,0x63090a3b31313172\n"
".quad 0x752e3436752e7476,0x3464722509203233,0x3633317225202c32,0x772e6c756d090a3b\n"
".quad 0x203233752e656469,0x202c333464722509,0x34202c3633317225,0x752e646461090a3b\n"
".quad 0x3264722509203436,0x2c31647225202c38,0x0a3b333464722520,0x726168732e646c09\n"
".quad 0x09203233752e6465,0x5b202c3733317225,0x5d302b3832647225,0x752e646461090a3b\n"
".quad 0x3331722509203233,0x3733317225202c38,0x7473090a3b31202c,0x2e6465726168732e\n"
".quad 0x72255b0920323375,0x202c5d302b383264,0x090a3b3833317225,0x09373109636f6c2e\n"
".quad 0x6d090a3009333934,0x33752e6f6c2e6c75,0x3933317225092032,0x2c3733317225202c\n"
".quad 0x747663090a3b3820,0x3233752e3436752e,0x2c34346472250920,0x0a3b393331722520\n"
".quad 0x617261702e646c09,0x2509203436752e6d,0x5f5b202c35346472,0x726170616475635f\n"
".quad 0x615235325a5f5f6d,0x664f646441786964,0x646e417374657366,0x50656c6666756853\n"
".quad 0x6c615679654b3231,0x3053726961506575,0x7344705f696a6a5f,0x646461090a3b5d74\n"
".quad 0x722509203436752e,0x647225202c363464,0x34647225202c3434,0x2e766f6d090a3b35\n"
".quad 0x3172250920323373,0x30317225202c3034,0x672e7473090a3b34,0x32762e6c61626f6c\n"
".quad 0x255b09203233752e,0x2c5d302b36346472,0x2c32303172257b20,0x0a3b7d3034317225\n"
".quad 0x30335f325f744c24,0x2f2f200a3a323237,0x50203e706f6f6c3c,0x6c20666f20747261\n"
".quad 0x79646f6220706f6f,0x333420656e696c20,0x2064616568202c31,0x2064656c6562616c\n"
".quad 0x38325f325f744c24,0x6f6c2e090a383134,0x3539340937310963,0x2e726162090a3009\n"
".quad 0x3b300920636e7973,0x33622e646e61090a,0x3134317225092032,0x2c3530317225202c\n"
".quad 0x090a3b3738722520,0x203233752e766f6d,0x202c323431722509,0x70746573090a3b30\n"
".quad 0x203233732e71652e,0x25202c3133702509,0x7225202c31343172,0x2540090a3b323431\n"
".quad 0x2061726220313370,0x335f325f744c2409,0x2f200a3b34333231,0x203e706f6f6c3c2f\n"
".quad 0x20666f2074726150,0x646f6220706f6f6c,0x3420656e696c2079,0x64616568202c3133\n"
".quad 0x64656c6562616c20,0x325f325f744c2420,0x6c2e090a38313438,0x393409373109636f\n"
".quad 0x2e646c090a300938,0x33732e6d61726170,0x3334317225092032,0x6475635f5f5b202c\n"
".quad 0x5a5f5f6d72617061,0x4178696461523532,0x74657366664f6464,0x66756853646e4173\n"
".quad 0x654b323150656c66,0x615065756c615679,0x696a6a5f30537269,0x3b5d74666968735f\n"
".quad 0x33752e726873090a,0x3930317225092032,0x2c3230317225202c,0x0a3b333431722520\n"
".quad 0x3233622e646e6109,0x2c30313172250920,0x202c393031722520,0x756d090a3b353532\n"
".quad 0x3233752e6f6c2e6c,0x2c31313172250920,0x202c303131722520,0x2e646461090a3b34\n"
".quad 0x3172250920323375,0x39347225202c3434,0x3b3131317225202c,0x36752e747663090a\n"
".quad 0x2509203233752e34,0x7225202c37346472,0x756d090a3b343431,0x752e656469772e6c\n"
".quad 0x3464722509203233,0x3434317225202c38,0x6461090a3b34202c,0x2509203436752e64\n"
".quad 0x7225202c38326472,0x34647225202c3164,0x732e646c090a3b38,0x33752e6465726168\n"
".quad 0x3534317225092032,0x38326472255b202c,0x6461090a3b5d302b,0x2509203233752e64\n"
".quad 0x7225202c36343172,0x0a3b31202c353431,0x726168732e747309,0x09203233752e6465\n"
".quad 0x302b38326472255b,0x3634317225202c5d,0x09636f6c2e090a3b,0x3009393934093731\n"
".quad 0x6f6c2e6c756d090a,0x722509203233752e,0x317225202c373431,0x090a3b38202c3534\n"
".quad 0x2e3436752e747663,0x6472250920323375,0x34317225202c3934,0x702e646c090a3b37\n"
".quad 0x3436752e6d617261,0x2c30356472250920,0x616475635f5f5b20,0x325a5f5f6d726170\n"
".quad 0x6441786964615235,0x7374657366664f64,0x6666756853646e41,0x79654b323150656c\n"
".quad 0x69615065756c6156,0x5f696a6a5f305372,0x090a3b5d74734470,0x203436752e646461\n"
".quad 0x202c313564722509,0x25202c3934647225,0x6d090a3b30356472,0x09203233732e766f\n"
".quad 0x25202c3834317225,0x73090a3b34303172,0x6c61626f6c672e74,0x203233752e32762e\n"
".quad 0x2b31356472255b09,0x3172257b202c5d30,0x38343172252c3230,0x325f744c240a3b7d\n"
".quad 0x0a3a34333231335f,0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066\n"
".quad 0x656e696c2079646f,0x6568202c31333420,0x6c6562616c206461,0x325f744c24206465\n"
".quad 0x090a38313438325f,0x09373109636f6c2e,0x62090a3009313035,0x20636e79732e7261\n"
".quad 0x646e61090a3b3009,0x722509203233622e,0x317225202c393431,0x38387225202c3530\n"
".quad 0x752e766f6d090a3b,0x3531722509203233,0x73090a3b30202c30,0x732e71652e707465\n"
".quad 0x3233702509203233,0x2c3934317225202c,0x0a3b303531722520,0x6220323370254009\n"
".quad 0x5f744c2409206172,0x3b36343731335f32,0x6f6f6c3c2f2f200a,0x2074726150203e70\n"
".quad 0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3133342065,0x6562616c20646165\n"
".quad 0x5f744c242064656c,0x0a38313438325f32,0x373109636f6c2e09,0x090a300934303509\n"
".quad 0x6d617261702e646c,0x722509203233732e,0x5f5f5b202c313531,0x6d72617061647563\n"
".quad 0x64615235325a5f5f,0x66664f6464417869,0x53646e4173746573,0x3150656c66667568\n"
".quad 0x756c615679654b32,0x5f30537269615065,0x666968735f696a6a,0x726873090a3b5d74\n"
".quad 0x722509203233752e,0x317225202c393031,0x35317225202c3230,0x2e646e61090a3b31\n"
".quad 0x3172250920323362,0x30317225202c3031,0x0a3b353532202c39,0x2e6f6c2e6c756d09\n"
".quad 0x3172250920323375,0x31317225202c3131,0x61090a3b34202c30,0x09203233752e6464\n"
".quad 0x25202c3235317225,0x317225202c393472,0x747663090a3b3131,0x3233752e3436752e\n"
".quad 0x2c32356472250920,0x0a3b323531722520,0x6469772e6c756d09,0x2509203233752e65\n"
".quad 0x7225202c33356472,0x0a3b34202c323531,0x3436752e64646109,0x2c38326472250920\n"
".quad 0x25202c3164722520,0x6c090a3b33356472,0x6465726168732e64,0x722509203233752e\n"
".quad 0x72255b202c333531,0x0a3b5d302b383264,0x3233752e64646109,0x2c34353172250920\n"
".quad 0x202c333531722520,0x732e7473090a3b31,0x33752e6465726168,0x326472255b092032\n"
".quad 0x7225202c5d302b38,0x6c2e090a3b343531,0x303509373109636f,0x6c756d090a300935\n"
".quad 0x203233752e6f6c2e,0x202c353531722509,0x38202c3335317225,0x752e747663090a3b\n"
".quad 0x09203233752e3436,0x25202c3435647225,0x6c090a3b35353172,0x2e6d617261702e64\n"
".quad 0x6472250920343675,0x635f5f5b202c3535,0x5f6d726170616475,0x6964615235325a5f\n"
".quad 0x7366664f64644178,0x6853646e41737465,0x323150656c666675,0x65756c615679654b\n"
".quad 0x6a5f305372696150,0x5d747344705f696a,0x752e646461090a3b,0x3564722509203436\n"
".quad 0x3435647225202c36,0x3b3535647225202c,0x33732e766f6d090a,0x3635317225092032\n"
".quad 0x3b3430317225202c,0x6f6c672e7473090a,0x752e32762e6c6162,0x6472255b09203233\n"
".quad 0x7b202c5d302b3635,0x72252c3230317225,0x4c240a3b7d363531,0x343731335f325f74\n"
".quad 0x6c3c2f2f200a3a36,0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070\n"
".quad 0x2c31333420656e69,0x616c206461656820,0x4c242064656c6562,0x313438325f325f74\n"
".quad 0x09636f6c2e090a38,0x3009373035093731,0x79732e726162090a,0x090a3b300920636e\n"
".quad 0x203233622e646e61,0x202c373531722509,0x25202c3530317225,0x6f6d090a3b393872\n"
".quad 0x2509203233752e76,0x3b30202c38353172,0x652e70746573090a,0x2509203233732e71\n"
".quad 0x317225202c333370,0x35317225202c3735,0x33702540090a3b38,0x2409206172622033\n"
".quad 0x3232335f325f744c,0x3c2f2f200a3b3835,0x6150203e706f6f6c,0x6f6c20666f207472\n"
".quad 0x2079646f6220706f,0x31333420656e696c,0x6c2064616568202c,0x242064656c656261\n"
".quad 0x3438325f325f744c,0x636f6c2e090a3831,0x0930313509373109,0x61702e646c090a30\n"
".quad 0x203233732e6d6172,0x202c393531722509,0x70616475635f5f5b,0x35325a5f5f6d7261\n"
".quad 0x6464417869646152,0x417374657366664f,0x6c6666756853646e,0x5679654b32315065\n"
".quad 0x7269615065756c61,0x735f696a6a5f3053,0x090a3b5d74666968,0x203233752e726873\n"
".quad 0x202c393031722509,0x25202c3230317225,0x61090a3b39353172,0x09203233622e646e\n"
".quad 0x25202c3031317225,0x3532202c39303172,0x2e6c756d090a3b35,0x09203233752e6f6c\n"
".quad 0x25202c3131317225,0x3b34202c30313172,0x33752e646461090a,0x3036317225092032\n"
".quad 0x202c39347225202c,0x090a3b3131317225,0x2e3436752e747663,0x6472250920323375\n"
".quad 0x36317225202c3735,0x2e6c756d090a3b30,0x3233752e65646977,0x2c38356472250920\n"
".quad 0x202c303631722520,0x2e646461090a3b34,0x6472250920343675,0x31647225202c3832\n"
".quad 0x3b3835647225202c,0x6168732e646c090a,0x203233752e646572,0x202c313631722509\n"
".quad 0x302b38326472255b,0x2e646461090a3b5d,0x3172250920323375,0x36317225202c3236\n"
".quad 0x73090a3b31202c31,0x6465726168732e74,0x255b09203233752e,0x2c5d302b38326472\n"
".quad 0x0a3b323631722520,0x373109636f6c2e09,0x090a300931313509,0x752e6f6c2e6c756d\n"
".quad 0x3631722509203233,0x3136317225202c33,0x7663090a3b38202c,0x33752e3436752e74\n"
".quad 0x3935647225092032,0x3b3336317225202c,0x7261702e646c090a,0x09203436752e6d61\n"
".quad 0x5b202c3036647225,0x6170616475635f5f,0x5235325a5f5f6d72,0x4f64644178696461\n"
".quad 0x6e41737465736666,0x656c666675685364,0x615679654b323150,0x537269615065756c\n"
".quad 0x44705f696a6a5f30,0x6461090a3b5d7473,0x2509203436752e64,0x7225202c31366472\n"
".quad 0x647225202c393564,0x766f6d090a3b3036,0x722509203233732e,0x317225202c343631\n"
".quad 0x2e7473090a3b3430,0x762e6c61626f6c67,0x5b09203233752e32,0x5d302b3136647225\n"
".quad 0x32303172257b202c,0x3b7d34363172252c,0x335f325f744c240a,0x2f200a3a38353232\n"
".quad 0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c,0x3420656e696c2079\n"
".quad 0x64616568202c3133,0x64656c6562616c20,0x325f325f744c2420,0x6c2e090a38313438\n"
".quad 0x313509373109636f,0x726162090a300933,0x300920636e79732e,0x622e646e61090a3b\n"
".quad 0x3631722509203233,0x3530317225202c35,0x0a3b30397225202c,0x3233752e766f6d09\n"
".quad 0x2c36363172250920,0x746573090a3b3020,0x3233732e71652e70,0x202c343370250920\n"
".quad 0x25202c3536317225,0x40090a3b36363172,0x6172622034337025,0x5f325f744c240920\n"
".quad 0x200a3b3037373233,0x3e706f6f6c3c2f2f,0x666f207472615020,0x6f6220706f6f6c20\n"
".quad 0x20656e696c207964,0x616568202c313334,0x656c6562616c2064,0x5f325f744c242064\n"
".quad 0x2e090a3831343832,0x3509373109636f6c,0x646c090a30093631,0x732e6d617261702e\n"
".quad 0x3631722509203233,0x75635f5f5b202c37,0x5f5f6d7261706164,0x786964615235325a\n"
".quad 0x657366664f646441,0x756853646e417374,0x4b323150656c6666,0x5065756c61567965\n"
".quad 0x6a6a5f3053726961,0x5d74666968735f69,0x752e726873090a3b,0x3031722509203233\n"
".quad 0x3230317225202c39,0x3b3736317225202c,0x33622e646e61090a,0x3031317225092032\n"
".quad 0x2c3930317225202c,0x6d090a3b35353220,0x33752e6f6c2e6c75,0x3131317225092032\n"
".quad 0x2c3031317225202c,0x646461090a3b3420,0x722509203233752e,0x347225202c383631\n"
".quad 0x3131317225202c39,0x752e747663090a3b,0x09203233752e3436,0x25202c3236647225\n"
".quad 0x6d090a3b38363172,0x2e656469772e6c75,0x6472250920323375,0x36317225202c3336\n"
".quad 0x61090a3b34202c38,0x09203436752e6464,0x25202c3832647225,0x647225202c316472\n"
".quad 0x2e646c090a3b3336,0x752e646572616873,0x3631722509203233,0x326472255b202c39\n"
".quad 0x61090a3b5d302b38,0x09203233752e6464,0x25202c3037317225,0x3b31202c39363172\n"
".quad 0x6168732e7473090a,0x203233752e646572,0x2b38326472255b09,0x37317225202c5d30\n"
".quad 0x636f6c2e090a3b30,0x0937313509373109,0x6c2e6c756d090a30,0x2509203233752e6f\n"
".quad 0x7225202c31373172,0x0a3b38202c393631,0x3436752e74766309,0x722509203233752e\n"
".quad 0x317225202c343664,0x2e646c090a3b3137,0x36752e6d61726170,0x3536647225092034\n"
".quad 0x6475635f5f5b202c,0x5a5f5f6d72617061,0x4178696461523532,0x74657366664f6464\n"
".quad 0x66756853646e4173,0x654b323150656c66,0x615065756c615679,0x696a6a5f30537269\n"
".quad 0x0a3b5d747344705f,0x3436752e64646109,0x2c36366472250920,0x202c343664722520\n"
".quad 0x090a3b3536647225,0x203233732e766f6d,0x202c323731722509,0x090a3b3430317225\n"
".quad 0x61626f6c672e7473,0x3233752e32762e6c,0x36366472255b0920,0x72257b202c5d302b\n"
".quad 0x373172252c323031,0x5f744c240a3b7d32,0x3a30373732335f32,0x6f6f6c3c2f2f200a\n"
".quad 0x2074726150203e70,0x20706f6f6c20666f,0x6e696c2079646f62,0x68202c3133342065\n"
".quad 0x6562616c20646165,0x5f744c242064656c,0x0a38313438325f32,0x373109636f6c2e09\n"
".quad 0x090a300939313509,0x636e79732e726162,0x6e61090a3b300920,0x2509203233622e64\n"
".quad 0x7225202c33373172,0x397225202c353031,0x2e766f6d090a3b31,0x3172250920323375\n"
".quad 0x090a3b30202c3437,0x2e71652e70746573,0x3370250920323373,0x3337317225202c35\n"
".quad 0x3b3437317225202c,0x203533702540090a,0x744c240920617262,0x32383233335f325f\n"
".quad 0x6f6c3c2f2f200a3b,0x74726150203e706f,0x706f6f6c20666f20,0x696c2079646f6220\n"
".quad 0x202c31333420656e,0x62616c2064616568,0x744c242064656c65,0x38313438325f325f\n"
".quad 0x3109636f6c2e090a,0x0a30093232350937,0x617261702e646c09,0x2509203233732e6d\n"
".quad 0x5f5b202c35373172,0x726170616475635f,0x615235325a5f5f6d,0x664f646441786964\n"
".quad 0x646e417374657366,0x50656c6666756853,0x6c615679654b3231,0x3053726961506575\n"
".quad 0x6968735f696a6a5f,0x6873090a3b5d7466,0x2509203233752e72,0x7225202c39303172\n"
".quad 0x317225202c323031,0x646e61090a3b3537,0x722509203233622e,0x317225202c303131\n"
".quad 0x3b353532202c3930,0x6f6c2e6c756d090a,0x722509203233752e,0x317225202c313131\n"
".quad 0x090a3b34202c3031,0x203233752e646461,0x202c363731722509,0x7225202c39347225\n"
".quad 0x7663090a3b313131,0x33752e3436752e74,0x3736647225092032,0x3b3637317225202c\n"
".quad 0x69772e6c756d090a,0x09203233752e6564,0x25202c3836647225,0x3b34202c36373172\n"
".quad 0x36752e646461090a,0x3832647225092034,0x202c31647225202c,0x090a3b3836647225\n"
".quad 0x65726168732e646c,0x2509203233752e64,0x255b202c37373172,0x3b5d302b38326472\n"
".quad 0x33752e646461090a,0x3837317225092032,0x2c3737317225202c,0x2e7473090a3b3120\n"
".quad 0x752e646572616873,0x6472255b09203233,0x25202c5d302b3832,0x2e090a3b38373172\n"
".quad 0x3509373109636f6c,0x756d090a30093332,0x3233752e6f6c2e6c,0x2c39373172250920\n"
".quad 0x202c373731722520,0x2e747663090a3b38,0x203233752e343675,0x202c393664722509\n"
".quad 0x090a3b3937317225,0x6d617261702e646c,0x722509203436752e,0x5f5f5b202c303764\n"
".quad 0x6d72617061647563,0x64615235325a5f5f,0x66664f6464417869,0x53646e4173746573\n"
".quad 0x3150656c66667568,0x756c615679654b32,0x5f30537269615065,0x747344705f696a6a\n"
".quad 0x2e646461090a3b5d,0x6472250920343675,0x36647225202c3137,0x3037647225202c39\n"
".quad 0x732e766f6d090a3b,0x3831722509203233,0x3430317225202c30,0x6c672e7473090a3b\n"
".quad 0x2e32762e6c61626f,0x72255b0920323375,0x202c5d302b313764,0x252c32303172257b\n"
".quad 0x240a3b7d30383172,0x3233335f325f744c,0x3c2f2f200a3a3238,0x6150203e706f6f6c\n"
".quad 0x6f6c20666f207472,0x2079646f6220706f,0x31333420656e696c,0x6c2064616568202c\n"
".quad 0x242064656c656261,0x3438325f325f744c,0x636f6c2e090a3831,0x0935323509373109\n"
".quad 0x732e726162090a30,0x0a3b300920636e79,0x3233622e646e6109,0x2c31383172250920\n"
".quad 0x202c353031722520,0x6d090a3b32397225,0x09203233752e766f,0x30202c3238317225\n"
".quad 0x2e70746573090a3b,0x09203233732e7165,0x7225202c36337025,0x317225202c313831\n"
".quad 0x702540090a3b3238,0x0920617262203633,0x33335f325f744c24,0x2f2f200a3b343937\n"
".quad 0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f,0x333420656e696c20\n"
".quad 0x2064616568202c31,0x2064656c6562616c,0x38325f325f744c24,0x6f6c2e090a383134\n"
".quad 0x3832350937310963,0x702e646c090a3009,0x3233732e6d617261,0x2c33383172250920\n"
".quad 0x616475635f5f5b20,0x325a5f5f6d726170,0x6441786964615235,0x7374657366664f64\n"
".quad 0x6666756853646e41,0x79654b323150656c,0x69615065756c6156,0x5f696a6a5f305372\n"
".quad 0x0a3b5d7466696873,0x3233752e72687309,0x2c39303172250920,0x202c323031722520\n"
".quad 0x090a3b3338317225,0x203233622e646e61,0x202c303131722509,0x32202c3930317225\n"
".quad 0x6c756d090a3b3535,0x203233752e6f6c2e,0x202c313131722509,0x34202c3031317225\n"
".quad 0x752e646461090a3b,0x3831722509203233,0x2c39347225202c34,0x0a3b313131722520\n"
".quad 0x3436752e74766309,0x722509203233752e,0x317225202c323764,0x6c756d090a3b3438\n"
".quad 0x33752e656469772e,0x3337647225092032,0x2c3438317225202c,0x646461090a3b3420\n"
".quad 0x722509203436752e,0x647225202c383264,0x3337647225202c31,0x68732e646c090a3b\n"
".quad 0x3233752e64657261,0x2c35383172250920,0x2b38326472255b20,0x646461090a3b5d30\n"
".quad 0x722509203233752e,0x317225202c363831,0x090a3b31202c3538,0x65726168732e7473\n"
".quad 0x5b09203233752e64,0x5d302b3832647225,0x3b3638317225202c,0x3109636f6c2e090a\n"
".quad 0x0a30093932350937,0x2e6f6c2e6c756d09,0x3172250920323375,0x38317225202c3738\n"
".quad 0x63090a3b38202c35,0x752e3436752e7476,0x3764722509203233,0x3738317225202c34\n"
".quad 0x61702e646c090a3b,0x203436752e6d6172,0x202c353764722509,0x70616475635f5f5b\n"
".quad 0x35325a5f5f6d7261,0x6464417869646152,0x417374657366664f,0x6c6666756853646e\n"
".quad 0x5679654b32315065,0x7269615065756c61,0x705f696a6a5f3053,0x61090a3b5d747344\n"
".quad 0x09203436752e6464,0x25202c3637647225,0x7225202c34376472,0x6f6d090a3b353764\n"
".quad 0x2509203233732e76,0x7225202c38383172,0x7473090a3b343031,0x2e6c61626f6c672e\n"
".quad 0x09203233752e3276,0x302b36376472255b,0x303172257b202c5d,0x7d38383172252c32\n"
".quad 0x5f325f744c240a3b,0x200a3a3439373333,0x3e706f6f6c3c2f2f,0x666f207472615020\n"
".quad 0x6f6220706f6f6c20,0x20656e696c207964,0x616568202c313334,0x656c6562616c2064\n"
".quad 0x5f325f744c242064,0x2e090a3831343832,0x3509373109636f6c,0x6162090a30093133\n"
".quad 0x0920636e79732e72,0x2e646e61090a3b30,0x3172250920323362,0x30317225202c3938\n"
".quad 0x3b33397225202c35,0x33752e766f6d090a,0x3039317225092032,0x6573090a3b30202c\n"
".quad 0x33732e71652e7074,0x2c37337025092032,0x202c393831722520,0x090a3b3039317225\n"
".quad 0x7262203733702540,0x325f744c24092061,0x0a3b36303334335f,0x706f6f6c3c2f2f20\n"
".quad 0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f,0x6568202c31333420\n"
".quad 0x6c6562616c206461,0x325f744c24206465,0x090a38313438325f,0x09373109636f6c2e\n"
".quad 0x6c090a3009343335,0x2e6d617261702e64,0x3172250920323373,0x635f5f5b202c3139\n"
".quad 0x5f6d726170616475,0x6964615235325a5f,0x7366664f64644178,0x6853646e41737465\n"
".quad 0x323150656c666675,0x65756c615679654b,0x6a5f305372696150,0x74666968735f696a\n"
".quad 0x2e726873090a3b5d,0x3172250920323375,0x30317225202c3930,0x3139317225202c32\n"
".quad 0x622e646e61090a3b,0x3131722509203233,0x3930317225202c30,0x090a3b353532202c\n"
".quad 0x752e6f6c2e6c756d,0x3131722509203233,0x3031317225202c31,0x6461090a3b34202c\n"
".quad 0x2509203233752e64,0x7225202c32393172,0x31317225202c3934,0x2e747663090a3b31\n"
".quad 0x203233752e343675,0x202c373764722509,0x090a3b3239317225,0x656469772e6c756d\n"
".quad 0x722509203233752e,0x317225202c383764,0x090a3b34202c3239,0x203436752e646461\n"
".quad 0x202c383264722509,0x7225202c31647225,0x646c090a3b383764,0x2e6465726168732e\n"
".quad 0x3172250920323375,0x6472255b202c3339,0x090a3b5d302b3832,0x203233752e646461\n"
".quad 0x202c343931722509,0x31202c3339317225,0x68732e7473090a3b,0x3233752e64657261\n"
".quad 0x38326472255b0920,0x317225202c5d302b,0x6f6c2e090a3b3439,0x3533350937310963\n"
".quad 0x2e6c756d090a3009,0x09203233752e6f6c,0x25202c3539317225,0x3b38202c33393172\n"
".quad 0x36752e747663090a,0x2509203233752e34,0x7225202c39376472,0x646c090a3b353931\n"
".quad 0x752e6d617261702e,0x3864722509203436,0x75635f5f5b202c30,0x5f5f6d7261706164\n"
".quad 0x786964615235325a,0x657366664f646441,0x756853646e417374,0x4b323150656c6666\n"
".quad 0x5065756c61567965,0x6a6a5f3053726961,0x3b5d747344705f69,0x36752e646461090a\n"
".quad 0x3138647225092034,0x2c3937647225202c,0x0a3b303864722520,0x3233732e766f6d09\n"
".quad 0x2c36393172250920,0x0a3b343031722520,0x626f6c672e747309,0x33752e32762e6c61\n"
".quad 0x386472255b092032,0x257b202c5d302b31,0x3172252c32303172,0x744c240a3b7d3639\n"
".quad 0x36303334335f325f,0x6f6c3c2f2f200a3a,0x74726150203e706f,0x706f6f6c20666f20\n"
".quad 0x696c2079646f6220,0x202c31333420656e,0x62616c2064616568,0x744c242064656c65\n"
".quad 0x38313438325f325f,0x3109636f6c2e090a,0x0a30093733350937,0x6e79732e72616209\n"
".quad 0x61090a3b30092063,0x09203233622e646e,0x25202c3739317225,0x7225202c35303172\n"
".quad 0x766f6d090a3b3439,0x722509203233752e,0x0a3b30202c383931,0x71652e7074657309\n"
".quad 0x702509203233732e,0x39317225202c3833,0x3839317225202c37,0x3833702540090a3b\n"
".quad 0x4c24092061726220,0x313834335f325f74,0x6c3c2f2f200a3b38,0x726150203e706f6f\n"
".quad 0x6f6f6c20666f2074,0x6c2079646f622070,0x2c31333420656e69,0x616c206461656820\n"
".quad 0x4c242064656c6562,0x313438325f325f74,0x09636f6c2e090a38,0x3009303435093731\n"
".quad 0x7261702e646c090a,0x09203233732e6d61,0x5b202c3939317225,0x6170616475635f5f\n"
".quad 0x5235325a5f5f6d72,0x4f64644178696461,0x6e41737465736666,0x656c666675685364\n"
".quad 0x615679654b323150,0x537269615065756c,0x68735f696a6a5f30,0x73090a3b5d746669\n"
".quad 0x09203233752e7268,0x25202c3930317225,0x7225202c32303172,0x6e61090a3b393931\n"
".quad 0x2509203233622e64,0x7225202c30313172,0x353532202c393031,0x6c2e6c756d090a3b\n"
".quad 0x2509203233752e6f,0x7225202c31313172,0x0a3b34202c303131,0x3233752e64646109\n"
".quad 0x2c30303272250920,0x25202c3934722520,0x63090a3b31313172,0x752e3436752e7476\n"
".quad 0x3864722509203233,0x3030327225202c32,0x772e6c756d090a3b,0x203233752e656469\n"
".quad 0x202c333864722509,0x34202c3030327225,0x752e646461090a3b,0x3264722509203436\n"
".quad 0x2c31647225202c38,0x0a3b333864722520,0x726168732e646c09,0x09203233752e6465\n"
".quad 0x5b202c3130327225,0x5d302b3832647225,0x752e646461090a3b,0x3032722509203233\n"
".quad 0x3130327225202c32,0x7473090a3b31202c,0x2e6465726168732e,0x72255b0920323375\n"
".quad 0x202c5d302b383264,0x090a3b3230327225,0x09373109636f6c2e,0x6d090a3009313435\n"
".quad 0x33752e6f6c2e6c75,0x3330327225092032,0x2c3130327225202c,0x747663090a3b3820\n"
".quad 0x3233752e3436752e,0x2c34386472250920,0x0a3b333032722520,0x617261702e646c09\n"
".quad 0x2509203436752e6d,0x5f5b202c35386472,0x726170616475635f,0x615235325a5f5f6d\n"
".quad 0x664f646441786964,0x646e417374657366,0x50656c6666756853,0x6c615679654b3231\n"
".quad 0x3053726961506575,0x7344705f696a6a5f,0x646461090a3b5d74,0x722509203436752e\n"
".quad 0x647225202c363864,0x38647225202c3438,0x2e766f6d090a3b35,0x3272250920323373\n"
".quad 0x30317225202c3430,0x672e7473090a3b34,0x32762e6c61626f6c,0x255b09203233752e\n"
".quad 0x2c5d302b36386472,0x2c32303172257b20,0x0a3b7d3430327225,0x34335f325f744c24\n"
".quad 0x2f2f200a3a383138,0x50203e706f6f6c3c,0x6c20666f20747261,0x79646f6220706f6f\n"
".quad 0x333420656e696c20,0x2064616568202c31,0x2064656c6562616c,0x38325f325f744c24\n"
".quad 0x6f6c2e090a383134,0x3334350937310963,0x2e726162090a3009,0x3b300920636e7973\n"
".quad 0x33622e646e61090a,0x3530327225092032,0x2c3530317225202c,0x090a3b3539722520\n"
".quad 0x203233752e766f6d,0x202c363032722509,0x70746573090a3b30,0x203233732e71652e\n"
".quad 0x25202c3933702509,0x7225202c35303272,0x2540090a3b363032,0x2061726220393370\n"
".quad 0x335f325f744c2409,0x2f200a3b30333335,0x203e706f6f6c3c2f,0x20666f2074726150\n"
".quad 0x646f6220706f6f6c,0x3420656e696c2079,0x64616568202c3133,0x64656c6562616c20\n"
".quad 0x325f325f744c2420,0x6c2e090a38313438,0x343509373109636f,0x2e646c090a300936\n"
".quad 0x33732e6d61726170,0x3730327225092032,0x6475635f5f5b202c,0x5a5f5f6d72617061\n"
".quad 0x4178696461523532,0x74657366664f6464,0x66756853646e4173,0x654b323150656c66\n"
".quad 0x615065756c615679,0x696a6a5f30537269,0x3b5d74666968735f,0x33752e726873090a\n"
".quad 0x3930317225092032,0x2c3230317225202c,0x0a3b373032722520,0x3233622e646e6109\n"
".quad 0x2c30313172250920,0x202c393031722520,0x756d090a3b353532,0x3233752e6f6c2e6c\n"
".quad 0x2c31313172250920,0x202c303131722520,0x2e646461090a3b34,0x3272250920323375\n"
".quad 0x39347225202c3830,0x3b3131317225202c,0x36752e747663090a,0x2509203233752e34\n"
".quad 0x7225202c37386472,0x756d090a3b383032,0x752e656469772e6c,0x3864722509203233\n"
".quad 0x3830327225202c38,0x6461090a3b34202c,0x2509203436752e64,0x7225202c38326472\n"
".quad 0x38647225202c3164,0x732e646c090a3b38,0x33752e6465726168,0x3930327225092032\n"
".quad 0x38326472255b202c,0x6461090a3b5d302b,0x2509203233752e64,0x7225202c30313272\n"
".quad 0x0a3b31202c393032,0x726168732e747309,0x09203233752e6465,0x302b38326472255b\n"
".quad 0x3031327225202c5d,0x09636f6c2e090a3b,0x3009373435093731,0x6f6c2e6c756d090a\n"
".quad 0x722509203233752e,0x327225202c313132,0x090a3b38202c3930,0x2e3436752e747663\n"
".quad 0x6472250920323375,0x31327225202c3938,0x702e646c090a3b31,0x3436752e6d617261\n"
".quad 0x2c30396472250920,0x616475635f5f5b20,0x325a5f5f6d726170,0x6441786964615235\n"
".quad 0x7374657366664f64,0x6666756853646e41,0x79654b323150656c,0x69615065756c6156\n"
".quad 0x5f696a6a5f305372,0x090a3b5d74734470,0x203436752e646461,0x202c313964722509\n"
".quad 0x25202c3938647225,0x6d090a3b30396472,0x09203233732e766f,0x25202c3231327225\n"
".quad 0x73090a3b34303172,0x6c61626f6c672e74,0x203233752e32762e,0x2b31396472255b09\n"
".quad 0x3172257b202c5d30,0x32313272252c3230,0x325f744c240a3b7d,0x0a3a30333335335f\n"
".quad 0x706f6f6c3c2f2f20,0x6f2074726150203e,0x6220706f6f6c2066,0x656e696c2079646f\n"
".quad 0x6568202c31333420,0x6c6562616c206461,0x325f744c24206465,0x090a38313438325f\n"
".quad 0x09373109636f6c2e,0x62090a3009393435,0x20636e79732e7261,0x646e61090a3b3009\n"
".quad 0x722509203233622e,0x317225202c333132,0x36397225202c3530,0x752e766f6d090a3b\n"
".quad 0x3132722509203233,0x73090a3b30202c34,0x732e71652e707465,0x3034702509203233\n"
".quad 0x2c3331327225202c,0x0a3b343132722520,0x6220303470254009,0x5f744c2409206172\n"
".quad 0x3b32343835335f32,0x6f6f6c3c2f2f200a,0x2074726150203e70,0x20706f6f6c20666f\n"
".quad 0x6e696c2079646f62,0x68202c3133342065,0x6562616c20646165,0x5f744c242064656c\n"
".quad 0x0a38313438325f32,0x373109636f6c2e09,0x090a300932353509,0x6d617261702e646c\n"
".quad 0x722509203233732e,0x5f5f5b202c353132,0x6d72617061647563,0x64615235325a5f5f\n"
".quad 0x66664f6464417869,0x53646e4173746573,0x3150656c66667568,0x756c615679654b32\n"
".quad 0x5f30537269615065,0x666968735f696a6a,0x726873090a3b5d74,0x722509203233752e\n"
".quad 0x317225202c393031,0x31327225202c3230,0x2e646e61090a3b35,0x3172250920323362\n"
".quad 0x30317225202c3031,0x0a3b353532202c39,0x2e6f6c2e6c756d09,0x3172250920323375\n"
".quad 0x31317225202c3131,0x61090a3b34202c30,0x09203233752e6464,0x25202c3631327225\n"
".quad 0x317225202c393472,0x747663090a3b3131,0x3233752e3436752e,0x2c32396472250920\n"
".quad 0x0a3b363132722520,0x6469772e6c756d09,0x2509203233752e65,0x7225202c33396472\n"
".quad 0x0a3b34202c363132,0x3436752e64646109,0x2c38326472250920,0x25202c3164722520\n"
".quad 0x6c090a3b33396472,0x6465726168732e64,0x722509203233752e,0x72255b202c373132\n"
".quad 0x0a3b5d302b383264,0x3233752e64646109,0x2c38313272250920,0x202c373132722520\n"
".quad 0x732e7473090a3b31,0x33752e6465726168,0x326472255b092032,0x7225202c5d302b38\n"
".quad 0x6c2e090a3b383132,0x353509373109636f,0x6c756d090a300933,0x203233752e6f6c2e\n"
".quad 0x202c393132722509,0x38202c3731327225,0x752e747663090a3b,0x09203233752e3436\n"
".quad 0x25202c3439647225,0x6c090a3b39313272,0x2e6d617261702e64,0x6472250920343675\n"
".quad 0x635f5f5b202c3539,0x5f6d726170616475,0x6964615235325a5f,0x7366664f64644178\n"
".quad 0x6853646e41737465,0x323150656c666675,0x65756c615679654b,0x6a5f305372696150\n"
".quad 0x5d747344705f696a,0x752e646461090a3b,0x3964722509203436,0x3439647225202c36\n"
".quad 0x3b3539647225202c,0x33732e766f6d090a,0x3032327225092032,0x3b3430317225202c\n"
".quad 0x6f6c672e7473090a,0x752e32762e6c6162,0x6472255b09203233,0x7b202c5d302b3639\n"
".quad 0x72252c3230317225,0x4c240a3b7d303232,0x343835335f325f74,0x6c3c2f2f200a3a32\n"
".quad 0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070,0x2c31333420656e69\n"
".quad 0x616c206461656820,0x4c242064656c6562,0x313438325f325f74,0x09636f6c2e090a38\n"
".quad 0x3009353535093731,0x79732e726162090a,0x090a3b300920636e,0x203233622e646e61\n"
".quad 0x202c313232722509,0x25202c3530317225,0x6f6d090a3b373972,0x2509203233752e76\n"
".quad 0x3b30202c32323272,0x652e70746573090a,0x2509203233732e71,0x327225202c313470\n"
".quad 0x32327225202c3132,0x34702540090a3b32,0x2409206172622031,0x3336335f325f744c\n"
".quad 0x3c2f2f200a3b3435,0x6150203e706f6f6c,0x6f6c20666f207472,0x2079646f6220706f\n"
".quad 0x31333420656e696c,0x6c2064616568202c,0x242064656c656261,0x3438325f325f744c\n"
".quad 0x636f6c2e090a3831,0x0938353509373109,0x61702e646c090a30,0x203233732e6d6172\n"
".quad 0x202c333232722509,0x70616475635f5f5b,0x35325a5f5f6d7261,0x6464417869646152\n"
".quad 0x417374657366664f,0x6c6666756853646e,0x5679654b32315065,0x7269615065756c61\n"
".quad 0x735f696a6a5f3053,0x090a3b5d74666968,0x203233752e726873,0x202c393031722509\n"
".quad 0x25202c3230317225,0x61090a3b33323272,0x09203233622e646e,0x25202c3031317225\n"
".quad 0x3532202c39303172,0x2e6c756d090a3b35,0x09203233752e6f6c,0x25202c3131317225\n"
".quad 0x3b34202c30313172,0x33752e646461090a,0x3432327225092032,0x202c39347225202c\n"
".quad 0x090a3b3131317225,0x2e3436752e747663,0x6472250920323375,0x32327225202c3739\n"
".quad 0x2e6c756d090a3b34,0x3233752e65646977,0x2c38396472250920,0x202c343232722520\n"
".quad 0x2e646461090a3b34,0x6472250920343675,0x31647225202c3832,0x3b3839647225202c\n"
".quad 0x6168732e646c090a,0x203233752e646572,0x202c353232722509,0x302b38326472255b\n"
".quad 0x2e646461090a3b5d,0x3272250920323375,0x32327225202c3632,0x73090a3b31202c35\n"
".quad 0x6465726168732e74,0x255b09203233752e,0x2c5d302b38326472,0x0a3b363232722520\n"
".quad 0x373109636f6c2e09,0x090a300939353509,0x752e6f6c2e6c756d,0x3232722509203233\n"
".quad 0x3532327225202c37,0x7663090a3b38202c,0x33752e3436752e74,0x3939647225092032\n"
".quad 0x3b3732327225202c,0x7261702e646c090a,0x09203436752e6d61,0x202c303031647225\n"
".quad 0x70616475635f5f5b,0x35325a5f5f6d7261,0x6464417869646152,0x417374657366664f\n"
".quad 0x6c6666756853646e,0x5679654b32315065,0x7269615065756c61,0x705f696a6a5f3053\n"
".quad 0x61090a3b5d747344,0x09203436752e6464,0x202c313031647225,0x25202c3939647225\n"
".quad 0x090a3b3030316472,0x203233732e766f6d,0x202c383232722509,0x090a3b3430317225\n"
".quad 0x61626f6c672e7473,0x3233752e32762e6c,0x30316472255b0920,0x257b202c5d302b31\n"
".quad 0x3272252c32303172,0x744c240a3b7d3832,0x34353336335f325f,0x6f6c3c2f2f200a3a\n"
".quad 0x74726150203e706f,0x706f6f6c20666f20,0x696c2079646f6220,0x202c31333420656e\n"
".quad 0x62616c2064616568,0x744c242064656c65,0x38313438325f325f,0x3109636f6c2e090a\n"
".quad 0x0a30093136350937,0x6e79732e72616209,0x61090a3b30092063,0x09203233622e646e\n"
".quad 0x25202c3932327225,0x7225202c35303172,0x766f6d090a3b3839,0x722509203233752e\n"
".quad 0x0a3b30202c303332,0x71652e7074657309,0x702509203233732e,0x32327225202c3234\n"
".quad 0x3033327225202c39,0x3234702540090a3b,0x4c24092061726220,0x363836335f325f74\n"
".quad 0x6c3c2f2f200a3b36,0x726150203e706f6f,0x6f6f6c20666f2074,0x6c2079646f622070\n"
".quad 0x2c31333420656e69,0x616c206461656820,0x4c242064656c6562,0x313438325f325f74\n"
".quad 0x09636f6c2e090a38,0x3009343635093731,0x7261702e646c090a,0x09203233732e6d61\n"
".quad 0x5b202c3133327225,0x6170616475635f5f,0x5235325a5f5f6d72,0x4f64644178696461\n"
".quad 0x6e41737465736666,0x656c666675685364,0x615679654b323150,0x537269615065756c\n"
".quad 0x68735f696a6a5f30,0x73090a3b5d746669,0x09203233752e7268,0x25202c3930317225\n"
".quad 0x7225202c32303172,0x6e61090a3b313332,0x2509203233622e64,0x7225202c30313172\n"
".quad 0x353532202c393031,0x6c2e6c756d090a3b,0x2509203233752e6f,0x7225202c31313172\n"
".quad 0x0a3b34202c303131,0x3233752e64646109,0x2c32333272250920,0x25202c3934722520\n"
".quad 0x63090a3b31313172,0x752e3436752e7476,0x3164722509203233,0x33327225202c3230\n"
".quad 0x2e6c756d090a3b32,0x3233752e65646977,0x3330316472250920,0x2c3233327225202c\n"
".quad 0x646461090a3b3420,0x722509203436752e,0x647225202c383264,0x3031647225202c31\n"
".quad 0x732e646c090a3b33,0x33752e6465726168,0x3333327225092032,0x38326472255b202c\n"
".quad 0x6461090a3b5d302b,0x2509203233752e64,0x7225202c34333272,0x0a3b31202c333332\n"
".quad 0x726168732e747309,0x09203233752e6465,0x302b38326472255b,0x3433327225202c5d\n"
".quad 0x09636f6c2e090a3b,0x3009353635093731,0x6f6c2e6c756d090a,0x722509203233752e\n"
".quad 0x327225202c353332,0x090a3b38202c3333,0x2e3436752e747663,0x6472250920323375\n"
".quad 0x327225202c343031,0x2e646c090a3b3533,0x36752e6d61726170,0x3031647225092034\n"
".quad 0x75635f5f5b202c35,0x5f5f6d7261706164,0x786964615235325a,0x657366664f646441\n"
".quad 0x756853646e417374,0x4b323150656c6666,0x5065756c61567965,0x6a6a5f3053726961\n"
".quad 0x3b5d747344705f69,0x36752e646461090a,0x3031647225092034,0x3031647225202c36\n"
".quad 0x3031647225202c34,0x2e766f6d090a3b35,0x3272250920323373,0x30317225202c3633\n"
".quad 0x672e7473090a3b34,0x32762e6c61626f6c,0x255b09203233752e,0x5d302b3630316472\n"
".quad 0x32303172257b202c,0x3b7d36333272252c,0x335f325f744c240a,0x2f200a3a36363836\n"
".quad 0x203e706f6f6c3c2f,0x20666f2074726150,0x646f6220706f6f6c,0x3420656e696c2079\n"
".quad 0x64616568202c3133,0x64656c6562616c20,0x325f325f744c2420,0x6c2e090a38313438\n"
".quad 0x363509373109636f,0x726162090a300937,0x300920636e79732e,0x732e646461090a3b\n"
".quad 0x3835722509203233,0x202c38357225202c,0x746573090a3b3631,0x3233752e746c2e70\n"
".quad 0x202c333470250920,0x7225202c38357225,0x702540090a3b3935,0x0920617262203334\n"
".quad 0x38325f325f744c24,0x744c240a3b383134,0x36303937325f325f,0x09636f6c2e090a3a\n"
".quad 0x3009333735093731,0x0a3b74697865090a,0x5f646e6557444c24,0x6964615235325a5f\n"
".quad 0x7366664f64644178,0x6853646e41737465,0x323150656c666675,0x65756c615679654b\n"
".quad 0x6a5f305372696150,0x2f207d090a3a696a,0x615235325a5f202f,0x664f646441786964\n"
".quad 0x646e417374657366,0x50656c6666756853,0x6c615679654b3231,0x3053726961506575\n"
".quad 0x00000a0a696a6a5f\n"
".text");
extern "C" {
extern const unsigned long long __deviceText_$compute_20$[5793];
}
static __cudaFatPtxEntry __ptxEntries [] = {{(char*)"compute_20",(char*)__deviceText_$compute_20$},{0,0}};
static __cudaFatCubinEntry __cubinEntries[] = {{0,0}};
static __cudaFatDebugEntry __debugEntries0 = {0, 0, 0, 0} ;
static __cudaFatElfEntry __elfEntries0 = {0, 0, 0, 0} ;
static __cudaFatElfEntry __elfEntries1 = {(char*)"sm_21", (char*)__deviceText_$sm_21$, &__elfEntries0, (unsigned int)sizeof(__deviceText_$sm_21$)};
static __cudaFatCudaBinary __fatDeviceText __attribute__ ((section (".nvFatBinSegment")))= {0x1ee55a01,0x00000004,0xa14f518d,(char*)"b7f601d2c38532b1",(char*)"/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu",(char*)" ",__ptxEntries,__cubinEntries,&__debugEntries0,0,0,0,0,0,0xa7b791db,&__elfEntries1};
# 3 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c" 2
struct __T20 {KeyValuePair *__par0;uint __par1;uint __par2;uint __par3;int __dummy_field;};
struct __T21 {KeyValuePair *__par0;KeyValuePair *__par1;uint __par2;uint __par3;int __par4;int __dummy_field;};
extern void __device_stub__Z8RadixSumP12KeyValuePairjjj(KeyValuePair *, uint, uint, uint);
extern void __device_stub__Z14RadixPrefixSumv(void);
extern void __device_stub__Z25RadixAddOffsetsAndShuffleP12KeyValuePairS0_jji(KeyValuePair *, KeyValuePair *, uint, uint, int);
static void __sti____cudaRegisterAll_51_tmpxft_00000a86_00000000_4_radixsort_kernel_cpp1_ii_3d289150(void) __attribute__((__constructor__));
void __device_stub__Z8RadixSumP12KeyValuePairjjj(KeyValuePair *__par0, uint __par1, uint __par2, uint __par3){ struct __T20 *__T22 = 0;
if (cudaSetupArgument((void*)(char*)&__par0, sizeof(__par0), (size_t)&__T22->__par0) != cudaSuccess) return;if (cudaSetupArgument((void*)(char*)&__par1, sizeof(__par1), (size_t)&__T22->__par1) != cudaSuccess) return;if (cudaSetupArgument((void*)(char*)&__par2, sizeof(__par2), (size_t)&__T22->__par2) != cudaSuccess) return;if (cudaSetupArgument((void*)(char*)&__par3, sizeof(__par3), (size_t)&__T22->__par3) != cudaSuccess) return;{ volatile static char *__f; __f = ((char *)((void ( *)(KeyValuePair *, uint, uint, uint))RadixSum)); (void)cudaLaunch(((char *)((void ( *)(KeyValuePair *, uint, uint, uint))RadixSum))); };}
void RadixSum( KeyValuePair *__cuda_0,uint __cuda_1,uint __cuda_2,uint __cuda_3)
# 102 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
{__device_stub__Z8RadixSumP12KeyValuePairjjj( __cuda_0,__cuda_1,__cuda_2,__cuda_3);
# 244 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
}
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c"
void __device_stub__Z14RadixPrefixSumv(void) {
{ volatile static char *__f; __f = ((char *)((void ( *)(void))RadixPrefixSum)); (void)cudaLaunch(((char *)((void ( *)(void))RadixPrefixSum))); }; }
void RadixPrefixSum(void)
# 252 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
{__device_stub__Z14RadixPrefixSumv();
# 360 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
}
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c"
void __device_stub__Z25RadixAddOffsetsAndShuffleP12KeyValuePairS0_jji( KeyValuePair *__par0, KeyValuePair *__par1, uint __par2, uint __par3, int __par4) { struct __T21 *__T23 = 0;
if (cudaSetupArgument((void*)(char*)&__par0, sizeof(__par0), (size_t)&__T23->__par0) != cudaSuccess) return; if (cudaSetupArgument((void*)(char*)&__par1, sizeof(__par1), (size_t)&__T23->__par1) != cudaSuccess) return; if (cudaSetupArgument((void*)(char*)&__par2, sizeof(__par2), (size_t)&__T23->__par2) != cudaSuccess) return; if (cudaSetupArgument((void*)(char*)&__par3, sizeof(__par3), (size_t)&__T23->__par3) != cudaSuccess) return; if (cudaSetupArgument((void*)(char*)&__par4, sizeof(__par4), (size_t)&__T23->__par4) != cudaSuccess) return; { volatile static char *__f; __f = ((char *)((void ( *)(KeyValuePair *, KeyValuePair *, uint, uint, int))RadixAddOffsetsAndShuffle)); (void)cudaLaunch(((char *)((void ( *)(KeyValuePair *, KeyValuePair *, uint, uint, int))RadixAddOffsetsAndShuffle))); }; }
void RadixAddOffsetsAndShuffle( KeyValuePair *__cuda_0,KeyValuePair *__cuda_1,uint __cuda_2,uint __cuda_3,int __cuda_4)
# 375 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
{__device_stub__Z25RadixAddOffsetsAndShuffleP12KeyValuePairS0_jji( __cuda_0,__cuda_1,__cuda_2,__cuda_3,__cuda_4);
# 573 "/home/normal/checkout/gpuocelot/tests-ptx-2.1/cuda2.2/tests/particles/radixsort_kernel.cu"
}
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c"
static void __sti____cudaRegisterAll_51_tmpxft_00000a86_00000000_4_radixsort_kernel_cpp1_ii_3d289150(void) { __cudaFatCubinHandle = __cudaRegisterFatBinary((void*)&__fatDeviceText); atexit(__cudaUnregisterBinaryUtil); __cudaRegisterFunction(__cudaFatCubinHandle, (const char*)((void ( *)(KeyValuePair *, KeyValuePair *, uint, uint, int))RadixAddOffsetsAndShuffle), (char*)"_Z25RadixAddOffsetsAndShuffleP12KeyValuePairS0_jji", "_Z25RadixAddOffsetsAndShuffleP12KeyValuePairS0_jji", -1, (uint3*)0, (uint3*)0, (dim3*)0, (dim3*)0, (int*)0); __cudaRegisterFunction(__cudaFatCubinHandle, (const char*)((void ( *)(void))RadixPrefixSum), (char*)"_Z14RadixPrefixSumv", "_Z14RadixPrefixSumv", -1, (uint3*)0, (uint3*)0, (dim3*)0, (dim3*)0, (int*)0); __cudaRegisterFunction(__cudaFatCubinHandle, (const char*)((void ( *)(KeyValuePair *, uint, uint, uint))RadixSum), (char*)"_Z8RadixSumP12KeyValuePairjjj", "_Z8RadixSumP12KeyValuePairjjj", -1, (uint3*)0, (uint3*)0, (dim3*)0, (dim3*)0, (int*)0); __cudaRegisterVar(__cudaFatCubinHandle, (char*)&dRadixSum, (char*)"dRadixSum", "dRadixSum", 0, 196608, 0, 0); __cudaRegisterVar(__cudaFatCubinHandle, (char*)&dRadixBlockSum, (char*)"dRadixBlockSum", "dRadixBlockSum", 0, 64, 0, 0); }
# 1 "/tmp/tmpxft_00000a86_00000000-1_radixsort_kernel.cudafe1.stub.c" 2
| 51.561004 | 1,214 | 0.765546 | florianjacob |
f324a156d7594e9e513d4d60b5c2fc7049dd224b | 11,897 | hpp | C++ | cpp/include/dataframe/serializer/bson/data_writer.hpp | fairtide/DataFrame | 2c1a7a84dd5fc49f25b74af3d5878004ac72aba4 | [
"Apache-2.0"
] | 5 | 2019-06-19T01:47:42.000Z | 2022-01-10T07:36:25.000Z | cpp/include/dataframe/serializer/bson/data_writer.hpp | fairtide/DataFrame | 2c1a7a84dd5fc49f25b74af3d5878004ac72aba4 | [
"Apache-2.0"
] | 1 | 2019-03-02T20:11:25.000Z | 2019-04-05T20:25:07.000Z | cpp/include/dataframe/serializer/bson/data_writer.hpp | fairtide/DataFrame | 2c1a7a84dd5fc49f25b74af3d5878004ac72aba4 | [
"Apache-2.0"
] | 2 | 2020-04-13T07:33:12.000Z | 2021-11-07T12:59:04.000Z | //============================================================================
// Copyright 2019 Fairtide Pte. Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//============================================================================
#ifndef DATAFRAME_SERIALIZER_BSON_DATA_WRITER_HPP
#define DATAFRAME_SERIALIZER_BSON_DATA_WRITER_HPP
#include <dataframe/serializer/bson/compress.hpp>
#include <dataframe/serializer/bson/type_writer.hpp>
namespace dataframe {
namespace bson {
class DataWriter : public ::arrow::ArrayVisitor
{
public:
DataWriter(::bsoncxx::builder::basic::document &builder,
Vector<std::uint8_t> &buffer1, Vector<std::uint8_t> &buffer2,
int compression_level)
: builder_(builder)
, buffer1_(buffer1)
, buffer2_(buffer2)
, compression_level_(compression_level)
{
}
::arrow::Status Visit(const ::arrow::NullArray &array) override
{
using ::bsoncxx::builder::basic::kvp;
builder_.append(
kvp(Schema::DATA(), static_cast<std::int64_t>(array.length())));
make_mask(array);
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
return ::arrow::Status::OK();
}
::arrow::Status Visit(const ::arrow::BooleanArray &array) override
{
using ::bsoncxx::builder::basic::kvp;
auto n = array.length();
buffer1_.resize(static_cast<std::size_t>(n));
for (std::int64_t i = 0; i != n; ++i) {
buffer1_[static_cast<std::size_t>(i)] = array.GetView(i);
}
builder_.append(kvp(Schema::DATA(),
compress(buffer1_, &buffer2_, compression_level_)));
make_mask(array);
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
return ::arrow::Status::OK();
}
#define DF_DEFINE_VISITOR(TypeName) \
::arrow::Status Visit(const ::arrow::TypeName##Array &array) override \
{ \
using ::bsoncxx::builder::basic::kvp; \
\
builder_.append(kvp(Schema::DATA(), \
compress(array.length(), array.raw_values(), &buffer2_, \
compression_level_))); \
\
make_mask(array); \
\
TypeWriter type_writer(builder_); \
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer)); \
\
return ::arrow::Status::OK(); \
}
DF_DEFINE_VISITOR(Int8)
DF_DEFINE_VISITOR(Int16)
DF_DEFINE_VISITOR(Int32)
DF_DEFINE_VISITOR(Int64)
DF_DEFINE_VISITOR(UInt8)
DF_DEFINE_VISITOR(UInt16)
DF_DEFINE_VISITOR(UInt32)
DF_DEFINE_VISITOR(UInt64)
DF_DEFINE_VISITOR(HalfFloat)
DF_DEFINE_VISITOR(Float)
DF_DEFINE_VISITOR(Double)
DF_DEFINE_VISITOR(Time32)
DF_DEFINE_VISITOR(Time64)
#undef DF_DEFINE_VISITOR
#define DF_DEFINE_VISITOR(TypeName) \
::arrow::Status Visit(const ::arrow::TypeName##Array &array) override \
{ \
using ::bsoncxx::builder::basic::kvp; \
\
encode_datetime(array.length(), array.raw_values(), &buffer1_); \
\
builder_.append(kvp(Schema::DATA(), \
compress(buffer1_, &buffer2_, compression_level_))); \
\
make_mask(array); \
\
TypeWriter type_writer(builder_); \
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer)); \
\
return ::arrow::Status::OK(); \
}
DF_DEFINE_VISITOR(Date32)
DF_DEFINE_VISITOR(Date64)
DF_DEFINE_VISITOR(Timestamp)
#undef DF_DEFINE_VISITOR
::arrow::Status Visit(const ::arrow::FixedSizeBinaryArray &array) override
{
using ::bsoncxx::builder::basic::kvp;
auto &type =
dynamic_cast<const ::arrow::FixedSizeBinaryType &>(*array.type());
builder_.append(kvp(Schema::DATA(),
compress(array.length() * type.byte_width(), array.raw_values(),
&buffer2_, compression_level_)));
make_mask(array);
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
return ::arrow::Status::OK();
}
::arrow::Status Visit(const ::arrow::BinaryArray &array) override
{
using ::bsoncxx::builder::basic::kvp;
// data
auto data_offset = array.value_offset(0);
auto data_length = array.value_offset(array.length()) - data_offset;
const std::uint8_t *data = nullptr;
if (data_length != 0) {
data = array.value_data()->data() + data_offset;
}
builder_.append(kvp(Schema::DATA(),
compress(data_length, data, &buffer2_, compression_level_)));
// mask
make_mask(array);
// type
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
// offset
encode_offsets(array.length(), array.raw_value_offsets(), &buffer1_);
builder_.append(kvp(Schema::OFFSET(),
compress(buffer1_, &buffer2_, compression_level_)));
return ::arrow::Status::OK();
}
::arrow::Status Visit(const ::arrow::StringArray &array) override
{
return Visit(static_cast<const ::arrow::BinaryArray &>(array));
}
::arrow::Status Visit(const ::arrow::ListArray &array) override
{
using ::bsoncxx::builder::basic::document;
using ::bsoncxx::builder::basic::kvp;
// data
auto values_offset = array.value_offset(0);
auto values_length =
array.value_offset(array.length()) - values_offset;
auto values = array.values()->Slice(values_offset, values_length);
document data;
DataWriter writer(data, buffer1_, buffer2_, compression_level_);
DF_ARROW_ERROR_HANDLER(values->Accept(&writer));
builder_.append(kvp(Schema::DATA(), data.extract()));
// mask
make_mask(array);
// type
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
// offset
encode_offsets(array.length(), array.raw_value_offsets(), &buffer1_);
builder_.append(kvp(Schema::OFFSET(),
compress(buffer1_, &buffer2_, compression_level_)));
return ::arrow::Status::OK();
}
::arrow::Status Visit(const ::arrow::StructArray &array) override
{
using ::bsoncxx::builder::basic::document;
using ::bsoncxx::builder::basic::kvp;
// data
document fields;
auto &type = dynamic_cast<const ::arrow::StructType &>(*array.type());
auto n = type.num_children();
for (auto i = 0; i != n; ++i) {
auto field = type.child(i);
if (field->name().empty()) {
throw DataFrameException("empty field name");
}
auto field_data = array.field(i);
if (field_data == nullptr) {
throw DataFrameException(
"Field dat for " + field->name() + " not found");
}
document field_builder;
DataWriter writer(
field_builder, buffer1_, buffer2_, compression_level_);
DF_ARROW_ERROR_HANDLER(field_data->Accept(&writer));
fields.append(kvp(field->name(), field_builder.extract()));
}
document data;
data.append(
kvp(Schema::LENGTH(), static_cast<std::int64_t>(array.length())));
data.append(kvp(Schema::FIELDS(), fields.extract()));
builder_.append(kvp(Schema::DATA(), data.extract()));
// mask
make_mask(array);
// type
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
return ::arrow::Status::OK();
}
::arrow::Status Visit(const ::arrow::DictionaryArray &array) override
{
using ::bsoncxx::builder::basic::document;
using ::bsoncxx::builder::basic::kvp;
// data
document index;
DataWriter index_writer(index, buffer1_, buffer2_, compression_level_);
DF_ARROW_ERROR_HANDLER(array.indices()->Accept(&index_writer));
document dict;
DataWriter dict_writer(dict, buffer1_, buffer2_, compression_level_);
DF_ARROW_ERROR_HANDLER(array.dictionary()->Accept(&dict_writer));
document data;
data.append(kvp(Schema::INDEX(), index.extract()));
data.append(kvp(Schema::DICT(), dict.extract()));
builder_.append(kvp(Schema::DATA(), data.extract()));
// mask
make_mask(array);
// type
TypeWriter type_writer(builder_);
DF_ARROW_ERROR_HANDLER(array.type()->Accept(&type_writer));
return ::arrow::Status::OK();
}
private:
void make_mask(const ::arrow::Array &array)
{
using ::bsoncxx::builder::basic::kvp;
auto n = array.length();
auto m = ::arrow::BitUtil::BytesForBits(n);
buffer1_.resize(static_cast<std::size_t>(m));
if (array.type()->id() == ::arrow::Type::NA) {
std::memset(buffer1_.data(), 0, buffer1_.size());
} else {
if (!buffer1_.empty()) {
buffer1_.back() = 0;
}
if (array.null_count() == 0) {
::arrow::BitUtil::SetBitsTo(buffer1_.data(), 0, n, true);
} else {
::arrow::internal::CopyBitmap(array.null_bitmap()->data(),
array.offset(), n, buffer1_.data(), 0, true);
}
internal::swap_bit_order(buffer1_.size(), buffer1_.data());
}
builder_.append(kvp(Schema::MASK(),
compress(buffer1_, &buffer2_, compression_level_)));
}
private:
::bsoncxx::builder::basic::document &builder_;
Vector<std::uint8_t> &buffer1_;
Vector<std::uint8_t> &buffer2_;
int compression_level_;
};
} // namespace bson
} // namespace dataframe
#endif // DATAFRAME_SERIALIZER_BSON_DATA_WRITER_HPP
| 33.32493 | 79 | 0.530974 | fairtide |
f326f527d760c60ebbbee51cfdea9e4d7036ecb7 | 5,547 | cpp | C++ | webkit/WebCore/inspector/InjectedScriptHost.cpp | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | 15 | 2016-01-05T12:43:41.000Z | 2022-03-15T10:34:47.000Z | webkit/WebCore/inspector/InjectedScriptHost.cpp | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | null | null | null | webkit/WebCore/inspector/InjectedScriptHost.cpp | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | 2 | 2020-11-30T18:36:01.000Z | 2021-02-05T23:20:24.000Z | /*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 "config.h"
#include "InjectedScriptHost.h"
#if ENABLE(INSPECTOR)
#include "Element.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLFrameOwnerElement.h"
#include "InspectorClient.h"
#include "InspectorController.h"
#include "InspectorDOMAgent.h"
#include "InspectorFrontend.h"
#include "InspectorResource.h"
#include "Pasteboard.h"
#include "ScriptArray.h"
#include "ScriptFunctionCall.h"
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
using namespace JSC;
#endif
#if ENABLE(DATABASE)
#include "Database.h"
#endif
#if ENABLE(DOM_STORAGE)
#include "Storage.h"
#endif
#include "markup.h"
#include <wtf/RefPtr.h>
#include <wtf/StdLibExtras.h>
using namespace std;
namespace WebCore {
InjectedScriptHost::InjectedScriptHost(InspectorController* inspectorController)
: m_inspectorController(inspectorController)
{
}
InjectedScriptHost::~InjectedScriptHost()
{
}
void InjectedScriptHost::copyText(const String& text)
{
Pasteboard::generalPasteboard()->writePlainText(text);
}
Node* InjectedScriptHost::nodeForId(long nodeId)
{
if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
return domAgent->nodeForId(nodeId);
return 0;
}
ScriptValue InjectedScriptHost::wrapObject(const ScriptValue& object, const String& objectGroup)
{
if (m_inspectorController)
return m_inspectorController->wrapObject(object, objectGroup);
return ScriptValue();
}
ScriptValue InjectedScriptHost::unwrapObject(const String& objectId)
{
if (m_inspectorController)
return m_inspectorController->unwrapObject(objectId);
return ScriptValue();
}
long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool selectInUI)
{
InspectorFrontend* frontend = inspectorFrontend();
InspectorDOMAgent* domAgent = inspectorDOMAgent();
if (!domAgent || !frontend)
return 0;
long id = domAgent->pushNodePathToFrontend(node);
if (selectInUI)
frontend->updateFocusedNode(id);
return id;
}
void InjectedScriptHost::addNodesToSearchResult(const String& nodeIds)
{
if (InspectorFrontend* frontend = inspectorFrontend())
frontend->addNodesToSearchResult(nodeIds);
}
long InjectedScriptHost::pushNodeByPathToFrontend(const String& path)
{
InspectorDOMAgent* domAgent = inspectorDOMAgent();
if (!domAgent)
return 0;
Node* node = domAgent->nodeForPath(path);
if (!node)
return 0;
return domAgent->pushNodePathToFrontend(node);
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
JavaScriptCallFrame* InjectedScriptHost::currentCallFrame() const
{
return JavaScriptDebugServer::shared().currentCallFrame();
}
#endif
#if ENABLE(DATABASE)
Database* InjectedScriptHost::databaseForId(long databaseId)
{
if (m_inspectorController)
return m_inspectorController->databaseForId(databaseId);
return 0;
}
void InjectedScriptHost::selectDatabase(Database* database)
{
if (m_inspectorController)
m_inspectorController->selectDatabase(database);
}
#endif
#if ENABLE(DOM_STORAGE)
void InjectedScriptHost::selectDOMStorage(Storage* storage)
{
if (m_inspectorController)
m_inspectorController->selectDOMStorage(storage);
}
#endif
void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException)
{
if (InspectorFrontend* frontend = inspectorFrontend())
frontend->didDispatchOnInjectedScript(callId, result, isException);
}
InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
{
if (!m_inspectorController)
return 0;
return m_inspectorController->domAgent();
}
InspectorFrontend* InjectedScriptHost::inspectorFrontend()
{
if (!m_inspectorController)
return 0;
return m_inspectorController->m_frontend.get();
}
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
| 28.890625 | 111 | 0.754822 | s1rcheese |
f327444821e89594c0f4f112fa4ace3381c66dd4 | 18,633 | cpp | C++ | base/src/TextureManager.cpp | rohith10/P6 | 0ff618a5aae09f678d699a1fe0db31010d077785 | [
"BSD-4-Clause-UC"
] | null | null | null | base/src/TextureManager.cpp | rohith10/P6 | 0ff618a5aae09f678d699a1fe0db31010d077785 | [
"BSD-4-Clause-UC"
] | null | null | null | base/src/TextureManager.cpp | rohith10/P6 | 0ff618a5aae09f678d699a1fe0db31010d077785 | [
"BSD-4-Clause-UC"
] | null | null | null | #include "TextureManager.h"
#include <algorithm>
#include <string>
#include <sstream>
#include "GLRenderer.h"
#include "Utility.h"
#include "gl/glew.h"
extern "C"
{
#include "SOIL/SOIL.h"
#include "SOIL/image_DXT.h"
#include "SOIL/image_helper.h"
}
std::weak_ptr<TextureManager> TextureManager::singleton;
namespace
{
enum
{
SOIL_FLAG_SRGB_TEXTURE = 1024
};
bool IsNonPowerOfTwoTextureDimsSupported()
{
int32_t numExts;
glGetIntegerv(GL_NUM_EXTENSIONS, &numExts);
for (int32_t i = 0; i < numExts; ++i)
{
if (strstr(reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i)), "GL_ARB_texture_non_power_of_two"))
{
return true;
}
}
return false;
}
bool IsS3TCSupported()
{
int32_t numExts;
glGetIntegerv(GL_NUM_EXTENSIONS, &numExts);
for (int32_t i = 0; i < numExts; ++i)
{
if (strstr(reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i)), "GL_EXT_texture_compression_s3tc"))
{
return true;
}
}
return false;
}
}
TextureManager::TextureManager()
{}
TextureManager::~TextureManager()
{
for (auto& eachElement : m_textureNameToObjectMap)
glDeleteTextures(1, &eachElement.first);
m_textureNameToObjectMap.clear();
}
std::shared_ptr<TextureManager> TextureManager::GetSingleton()
{
try
{
return std::shared_ptr<TextureManager>(singleton);
}
catch (std::bad_weak_ptr&)
{
try
{
TextureManager* pTextureManager = new TextureManager;
std::shared_ptr<TextureManager> newTextureManager = std::shared_ptr<TextureManager>(pTextureManager);
singleton = newTextureManager;
return newTextureManager;
}
catch (std::bad_alloc&)
{
assert(false); // Out of memory!
}
}
}
GLType_uint TextureManager::Acquire(const std::string& textureName)
{
uint32_t textureNameHash = Utility::HashCString(textureName.c_str());
GLType_uint acquiredTextureObject = 0;
if (textureName.length())
{
auto mapItr = m_textureNameToObjectMap.find(textureNameHash);
if (mapItr != m_textureNameToObjectMap.end())
{
std::pair<GLType_uint, uint32_t>& textureObject = mapItr->second;
++textureObject.second;
acquiredTextureObject = textureObject.first;
}
else
{
std::pair<GLType_uint, uint32_t> newTextureObject;
newTextureObject.first = LoadImageAndCreateTexture(textureName, 0, 0, SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_INVERT_Y);
newTextureObject.second = 1;
m_textureNameToObjectMap[textureNameHash] = newTextureObject;
acquiredTextureObject = newTextureObject.first;
}
}
return acquiredTextureObject;
}
void TextureManager::Release(GLType_uint textureObject)
{
bool found = false;
auto iterator = m_textureNameToObjectMap.begin();
for (; iterator != m_textureNameToObjectMap.end(); ++iterator)
{
if (iterator->second.first == textureObject)
{
found = true;
break;
}
}
if (found)
{
--iterator->second.second;
if (iterator->second.second == 0)
{
glDeleteTextures(1, &iterator->second.first);
m_textureNameToObjectMap.erase(iterator->first);
}
}
else
{
assert(false); // Trying to Release a texture that was not Acquired?
}
}
// SOIL code copy-pasted an modified as required.
GLType_uint TextureManager::LoadImageAndCreateTexture(const std::string& textureName, int32_t forceChannels, uint32_t reuseTextureName, uint32_t flags)
{
unsigned char* img;
int width, height, channels;
/* try to load the image */
img = SOIL_load_image(textureName.c_str(), &width, &height, &channels, forceChannels);
/* channels holds the original number of channels, which may have been forced */
if ((forceChannels >= 1) && (forceChannels <= 4))
{
channels = forceChannels;
}
if (NULL == img)
{
/* image loading failed */
Utility::LogMessage("Texture file: ");
Utility::LogMessage(textureName.c_str());
Utility::LogMessageAndEndLine(" doesn't exist.");
return 0;
}
GLType_uint opengl_texture_type = GL_TEXTURE_2D;
GLType_uint opengl_texture_target = GL_TEXTURE_2D;
/* variables */
unsigned int tex_id;
unsigned int internalFormat = 0, pixelFormat = 0;
int max_supported_size;
/* If the user wants to use the texture rectangle I kill a few flags */
if (flags & SOIL_FLAG_TEXTURE_RECTANGLE)
{
/* only allow this if the user in _NOT_ trying to do a cubemap! */
if (opengl_texture_type == GL_TEXTURE_2D)
{
/* clean out the flags that cannot be used with texture rectangles */
flags &= ~(
SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS |
SOIL_FLAG_TEXTURE_REPEATS
);
/* and change my target */
opengl_texture_target = GL_TEXTURE_RECTANGLE;
opengl_texture_type = GL_TEXTURE_RECTANGLE;
}
else
{
/* not allowed for any other uses (yes, I'm looking at you, cubemaps!) */
flags &= ~SOIL_FLAG_TEXTURE_RECTANGLE;
}
}
/* does the user want me to invert the image? */
if (flags & SOIL_FLAG_INVERT_Y)
{
int i, j;
for (j = 0; j * 2 < height; ++j)
{
int index1 = j * width * channels;
int index2 = (height - 1 - j) * width * channels;
for (i = width * channels; i > 0; --i)
{
unsigned char temp = img[index1];
img[index1] = img[index2];
img[index2] = temp;
++index1;
++index2;
}
}
}
/* does the user want me to scale the colors into the NTSC safe RGB range? */
if (flags & SOIL_FLAG_NTSC_SAFE_RGB)
{
scale_image_RGB_to_NTSC_safe(img, width, height, channels);
}
/* does the user want me to convert from straight to pre-multiplied alpha?
(and do we even _have_ alpha?) */
if (flags & SOIL_FLAG_MULTIPLY_ALPHA)
{
int i;
switch (channels)
{
case 2:
for (i = 0; i < 2 * width*height; i += 2)
{
img[i] = (img[i] * img[i + 1] + 128) >> 8;
}
break;
case 4:
for (i = 0; i < 4 * width*height; i += 4)
{
img[i + 0] = (img[i + 0] * img[i + 3] + 128) >> 8;
img[i + 1] = (img[i + 1] * img[i + 3] + 128) >> 8;
img[i + 2] = (img[i + 2] * img[i + 3] + 128) >> 8;
}
break;
default:
/* no other number of channels contains alpha data */
break;
}
}
/* if the user can't support NPOT textures, make sure we force the POT option */
if (!IsNonPowerOfTwoTextureDimsSupported() && !(flags & SOIL_FLAG_TEXTURE_RECTANGLE))
{
/* add in the POT flag */
flags |= SOIL_FLAG_POWER_OF_TWO;
}
/* how large of a texture can this OpenGL implementation handle? */
/* texture_check_size_enum will be GL_MAX_TEXTURE_SIZE or SOIL_MAX_CUBE_MAP_TEXTURE_SIZE */
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_supported_size);
/* do I need to make it a power of 2? */
if (
(flags & SOIL_FLAG_POWER_OF_TWO) || /* user asked for it */
(flags & SOIL_FLAG_MIPMAPS) || /* need it for the MIP-maps */
(width > max_supported_size) || /* it's too big, (make sure it's */
(height > max_supported_size)) /* 2^n for later down-sampling) */
{
int new_width = 1;
int new_height = 1;
while (new_width < width)
{
new_width *= 2;
}
while (new_height < height)
{
new_height *= 2;
}
/* still? */
if ((new_width != width) || (new_height != height))
{
/* yep, resize */
unsigned char *resampled = (unsigned char*)malloc(channels*new_width*new_height);
up_scale_image(
img, width, height, channels,
resampled, new_width, new_height);
/* OJO this is for debug only! */
/*
SOIL_save_image( "\\showme.bmp", SOIL_SAVE_TYPE_BMP,
new_width, new_height, channels,
resampled );
*/
/* nuke the old guy, then point it at the new guy */
SOIL_free_image_data(img);
img = resampled;
width = new_width;
height = new_height;
}
}
/* now, if it is too large... */
if ((width > max_supported_size) || (height > max_supported_size))
{
/* I've already made it a power of two, so simply use the MIPmapping
code to reduce its size to the allowable maximum. */
unsigned char *resampled;
int reduce_block_x = 1, reduce_block_y = 1;
int new_width, new_height;
if (width > max_supported_size)
{
reduce_block_x = width / max_supported_size;
}
if (height > max_supported_size)
{
reduce_block_y = height / max_supported_size;
}
new_width = width / reduce_block_x;
new_height = height / reduce_block_y;
resampled = (unsigned char*)malloc(channels*new_width*new_height);
/* perform the actual reduction */
mipmap_image(img, width, height, channels,
resampled, reduce_block_x, reduce_block_y);
/* nuke the old guy, then point it at the new guy */
SOIL_free_image_data(img);
img = resampled;
width = new_width;
height = new_height;
}
/* does the user want us to use YCoCg color space? */
if (flags & SOIL_FLAG_CoCg_Y)
{
/* this will only work with RGB and RGBA images */
convert_RGB_to_YCoCg(img, width, height, channels);
/*
save_image_as_DDS( "CoCg_Y.dds", width, height, channels, img );
*/
}
/* create the OpenGL texture ID handle
(note: allowing a forced texture ID lets me reload a texture) */
tex_id = reuseTextureName;
if (tex_id == 0)
{
glCreateTextures(opengl_texture_type, 1, &tex_id);
}
/* Note: sometimes glGenTextures fails (usually no OpenGL context) */
if (tex_id)
{
bool isS3TCSupported = IsS3TCSupported();
/* and what type am I using as the internal texture format? */
switch (channels)
{
case 1:
pixelFormat = GL_RED;
internalFormat = (isS3TCSupported && (flags & SOIL_FLAG_COMPRESS_TO_DXT)) ? GL_COMPRESSED_RGB_S3TC_DXT1_EXT : GL_R8;
break;
case 2:
pixelFormat = GL_RG;
internalFormat = (isS3TCSupported && (flags & SOIL_FLAG_COMPRESS_TO_DXT)) ? GL_COMPRESSED_RGBA_S3TC_DXT5_EXT : GL_RG8;
break;
case 3:
pixelFormat = GL_RGB;
internalFormat = (isS3TCSupported && (flags & SOIL_FLAG_COMPRESS_TO_DXT)) ? GL_COMPRESSED_RGB_S3TC_DXT1_EXT : GL_RGB8;
break;
case 4:
pixelFormat = GL_RGBA;
internalFormat = (isS3TCSupported && (flags & SOIL_FLAG_COMPRESS_TO_DXT)) ? GL_COMPRESSED_RGBA_S3TC_DXT5_EXT : GL_RGBA8;
break;
}
if (flags & SOIL_FLAG_SRGB_TEXTURE)
{
if (internalFormat == GL_RGB8)
internalFormat = GL_SRGB8;
else if (internalFormat == GL_RGBA8)
internalFormat = GL_SRGB8_ALPHA8;
else if (internalFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
internalFormat = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
internalFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
}
uint32_t numMipLevels = 0; // Mip levels ABOVE base level of 0.
if (flags & SOIL_FLAG_MIPMAPS)
{
uint32_t mipWidth = width;
uint32_t mipHeight = height;
while ((mipWidth > 1) || (mipHeight > 1))
{
mipWidth = std::max<uint32_t>(mipWidth >> 1, 1);
mipHeight = std::max<uint32_t>(mipHeight >> 1, 1);
++numMipLevels;
}
}
// Create the immutable storage for the texture.
glTextureStorage2D(tex_id, numMipLevels + 1, internalFormat, width, height);
/* does the user want me to, and can I, save as DXT? */
if (flags & SOIL_FLAG_COMPRESS_TO_DXT)
{
if (isS3TCSupported)
{
/* I can use DXT, whether I compress it or OpenGL does */
/* user wants me to do the DXT conversion! */
int DDS_size;
unsigned char *DDS_data = NULL;
if ((channels & 1) == 1)
{
/* RGB, use DXT1 */
DDS_data = convert_image_to_DXT1(img, width, height, channels, &DDS_size);
}
else
{
/* RGBA, use DXT5 */
DDS_data = convert_image_to_DXT5(img, width, height, channels, &DDS_size);
}
if (DDS_data)
{
glCompressedTextureSubImage2D(tex_id, 0, 0, 0, width, height, internalFormat, DDS_size, DDS_data);
SOIL_free_image_data(DDS_data);
/* printf( "Internal DXT compressor\n" ); */
}
else
{
/* my compression failed, try the OpenGL driver's version */
glTextureSubImage2D(tex_id, 0, 0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE, img);
/* printf( "OpenGL DXT compressor\n" ); */
}
}
}
else
{
/* upload the main image without compression */
glTextureSubImage2D(tex_id, 0, 0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE, img);
/*printf( "OpenGL DXT compressor\n" ); */
}
/* are any MIPmaps desired? */
if (numMipLevels > 0)
{
uint32_t MIPwidth = (width + 1) / 2, MIPheight = (height + 1) / 2;
unsigned char *resampled = (unsigned char*)malloc(channels*MIPwidth*MIPheight);
for (uint32_t MIPlevel = 1; MIPlevel <= numMipLevels; ++MIPlevel)
{
/* do this MIPmap level */
mipmap_image(
img, width, height, channels,
resampled,
(1 << MIPlevel), (1 << MIPlevel));
/* upload the MIPmaps */
if (isS3TCSupported)
{
/* user wants me to do the DXT conversion! */
int DDS_size;
unsigned char *DDS_data = NULL;
if ((channels & 1) == 1)
{
/* RGB, use DXT1 */
DDS_data = convert_image_to_DXT1(
resampled, MIPwidth, MIPheight, channels, &DDS_size);
}
else
{
/* RGBA, use DXT5 */
DDS_data = convert_image_to_DXT5(
resampled, MIPwidth, MIPheight, channels, &DDS_size);
}
if (DDS_data)
{
glCompressedTextureSubImage2D(tex_id, MIPlevel, 0, 0, MIPwidth, MIPheight, internalFormat, DDS_size, DDS_data);
SOIL_free_image_data(DDS_data);
}
else
{
/* my compression failed, try the OpenGL driver's version */
glTextureSubImage2D(tex_id, MIPlevel, 0, 0, MIPwidth, MIPheight, pixelFormat, GL_UNSIGNED_BYTE, resampled);
}
}
else
{
/* user want OpenGL to do all the work! */
glTextureSubImage2D(tex_id, MIPlevel, 0, 0, MIPwidth, MIPheight, pixelFormat, GL_UNSIGNED_BYTE, resampled);
}
MIPwidth = (width + 1) / 2;
MIPheight = (height + 1) / 2;
}
free(resampled);
/* instruct OpenGL to use the MIPmaps */
glTextureParameteri(tex_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTextureParameteri(tex_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTextureParameteri(tex_id, GL_TEXTURE_MAX_LEVEL, numMipLevels);
}
else
{
/* instruct OpenGL _NOT_ to use the MIPmaps */
glTextureParameteri(tex_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTextureParameteri(tex_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTextureParameteri(tex_id, GL_TEXTURE_MAX_LEVEL, 0);
}
/* does the user want clamping, or wrapping? */
if (flags & SOIL_FLAG_TEXTURE_REPEATS)
{
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_T, GL_REPEAT);
if (opengl_texture_type == GL_TEXTURE_CUBE_MAP)
{
/* SOIL_TEXTURE_WRAP_R is invalid if cubemaps aren't supported */
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_R, GL_REPEAT);
}
}
else
{
/* unsigned int clamp_mode = SOIL_CLAMP_TO_EDGE; */
unsigned int clamp_mode = GL_CLAMP_TO_EDGE;
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_S, clamp_mode);
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_T, clamp_mode);
if (opengl_texture_type == GL_TEXTURE_CUBE_MAP)
{
/* SOIL_TEXTURE_WRAP_R is invalid if cubemaps aren't supported */
glTextureParameteri(tex_id, GL_TEXTURE_WRAP_R, clamp_mode);
}
}
}
else
{
// Failed to generate an OpenGL texture name; missing OpenGL context?
assert(false);
}
SOIL_free_image_data(img);
return tex_id;
} | 35.356736 | 151 | 0.552085 | rohith10 |
f329b6343a63a6d99e1c333a8a3c93bb0c202be4 | 1,712 | cpp | C++ | CodeGeneration/codegen/mex/yolov2_detect/MWDepthConcatenationLayer.cpp | matlab-deep-learning/Object-Detection-Using-YOLO-v2-Deep-Learning | 4db074adf074e6e7471e430799355509e72fd033 | [
"BSD-2-Clause"
] | 38 | 2020-03-17T21:00:55.000Z | 2021-12-06T02:02:25.000Z | CodeGeneration/codegen/mex/yolov2_detect/MWDepthConcatenationLayer.cpp | matlab-deep-learning/Object-Detection-Using-YOLO-v2-Deep-Learning | 4db074adf074e6e7471e430799355509e72fd033 | [
"BSD-2-Clause"
] | 1 | 2020-05-01T02:21:40.000Z | 2020-05-13T18:55:40.000Z | CodeGeneration/codegen/mex/yolov2_detect/MWDepthConcatenationLayer.cpp | matlab-deep-learning/Object-Detection-Using-YOLO-v2-Deep-Learning | 4db074adf074e6e7471e430799355509e72fd033 | [
"BSD-2-Clause"
] | 14 | 2020-04-16T16:08:41.000Z | 2021-12-08T14:46:37.000Z | /* Copyright 2017 The MathWorks, Inc. */
#include "MWDepthConcatenationLayer.hpp"
#include "MWDepthConcatenationLayerImpl.hpp"
#include <stdarg.h>
#include <cassert>
MWDepthConcatenationLayer::MWDepthConcatenationLayer()
{
}
MWDepthConcatenationLayer::~MWDepthConcatenationLayer()
{
}
void MWDepthConcatenationLayer::createDepthConcatenationLayer(MWTargetNetworkImpl* ntwk_impl, int numInputs, ...)
{
va_list args;
va_start(args, numInputs);
for(int i = 0; i < numInputs; i++)
{
MWTensor* inputTensor = va_arg(args, MWTensor*);
setInputTensor(inputTensor, i);
}
int outbufIdx = va_arg(args, int);
// check that all input tensors match in size in all dim except channel dim
unsigned long numChannels = getInputTensor(0)->getChannels();
for(int k = 1; k < numInputs; k++)
{
assert(getInputTensor(0)->getHeight() == getInputTensor(k)->getHeight());
assert(getInputTensor(0)->getWidth() == getInputTensor(k)->getWidth());
assert(getInputTensor(0)->getBatchSize() == getInputTensor(k)->getBatchSize());
numChannels += (int)getInputTensor(k)->getChannels();
}
// allocate output
allocateOutputTensor(getInputTensor(0)->getHeight(),
getInputTensor(0)->getWidth(),
numChannels,
getInputTensor(0)->getBatchSize(),
NULL);
m_impl = new MWDepthConcatenationLayerImpl(this, ntwk_impl, outbufIdx);
MWTensor *opTensor = getOutputTensor();
opTensor->setData(m_impl->getData());
}
| 32.923077 | 113 | 0.608645 | matlab-deep-learning |
f329d9fafcdce123e5782ec5eade51ff203ad081 | 2,513 | cpp | C++ | src/core/DefaultAudioDestinationNode.cpp | doc22940/LabSound | 0f2379661dc9d0c2faa798a1be16791803c12621 | [
"BSD-2-Clause"
] | null | null | null | src/core/DefaultAudioDestinationNode.cpp | doc22940/LabSound | 0f2379661dc9d0c2faa798a1be16791803c12621 | [
"BSD-2-Clause"
] | null | null | null | src/core/DefaultAudioDestinationNode.cpp | doc22940/LabSound | 0f2379661dc9d0c2faa798a1be16791803c12621 | [
"BSD-2-Clause"
] | null | null | null | // License: BSD 2 Clause
// Copyright (C) 2011, Google Inc. All rights reserved.
// Copyright (C) 2015+, The LabSound Authors. All rights reserved.
#include "LabSound/core/DefaultAudioDestinationNode.h"
#include "LabSound/extended/AudioContextLock.h"
#include "LabSound/extended/Logging.h"
#include "internal/Assertions.h"
#include "internal/AudioDestination.h"
namespace lab {
DefaultAudioDestinationNode::DefaultAudioDestinationNode(AudioContext* context, size_t channelCount, const float sampleRate)
: AudioDestinationNode(context, channelCount, sampleRate)
{
// Node-specific default mixing rules.
m_channelCount = channelCount;
m_channelCountMode = ChannelCountMode::Explicit;
m_channelInterpretation = ChannelInterpretation::Speakers;
}
DefaultAudioDestinationNode::~DefaultAudioDestinationNode()
{
uninitialize();
}
void DefaultAudioDestinationNode::initialize()
{
if (isInitialized())
return;
createDestination();
AudioNode::initialize();
}
void DefaultAudioDestinationNode::uninitialize()
{
if (!isInitialized())
return;
m_destination->stop();
AudioNode::uninitialize();
}
void DefaultAudioDestinationNode::createDestination()
{
LOG("Designated Samplerate: %f", m_sampleRate);
m_destination = std::unique_ptr<AudioDestination>(AudioDestination::MakePlatformAudioDestination(*this, channelCount(), m_sampleRate));
}
void DefaultAudioDestinationNode::startRendering()
{
ASSERT(isInitialized());
if (isInitialized())
m_destination->start();
}
unsigned DefaultAudioDestinationNode::maxChannelCount() const
{
return AudioDestination::maxChannelCount();
}
void DefaultAudioDestinationNode::setChannelCount(ContextGraphLock& g, size_t channelCount)
{
// The channelCount for the input to this node controls the actual number of channels we
// send to the audio hardware. It can only be set depending on the maximum number of
// channels supported by the hardware.
ASSERT(g.context());
if (!maxChannelCount() || channelCount > maxChannelCount())
{
throw std::invalid_argument("Max channel count invalid");
}
size_t oldChannelCount = this->channelCount();
AudioNode::setChannelCount(g, channelCount);
if (this->channelCount() != oldChannelCount && isInitialized())
{
// Re-create destination.
m_destination->stop();
createDestination();
m_destination->start();
}
}
} // namespace lab
| 27.315217 | 139 | 0.720653 | doc22940 |
f32b6c6dbdbb92f74e7652c21d7933deefd85685 | 20,266 | cpp | C++ | 3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp | mchiasson/PhaserNative | f867454602c395484bf730a7c43b9c586c102ac2 | [
"MIT"
] | null | null | null | 3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp | mchiasson/PhaserNative | f867454602c395484bf730a7c43b9c586c102ac2 | [
"MIT"
] | null | null | null | 3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp | mchiasson/PhaserNative | f867454602c395484bf730a7c43b9c586c102ac2 | [
"MIT"
] | 1 | 2019-01-25T13:55:25.000Z | 2019-01-25T13:55:25.000Z | /*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2003-2017 Apple Inc. All rights reserved.
* Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "HTMLLinkElement.h"
#include "Attribute.h"
#include "CachedCSSStyleSheet.h"
#include "CachedResource.h"
#include "CachedResourceLoader.h"
#include "CachedResourceRequest.h"
#include "ContentSecurityPolicy.h"
#include "DOMTokenList.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
#include "EventSender.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameTree.h"
#include "FrameView.h"
#include "HTMLAnchorElement.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "Logging.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "MouseEvent.h"
#include "RenderStyle.h"
#include "RuntimeEnabledFeatures.h"
#include "SecurityOrigin.h"
#include "Settings.h"
#include "StyleInheritedData.h"
#include "StyleResolveForDocument.h"
#include "StyleScope.h"
#include "StyleSheetContents.h"
#include "SubresourceIntegrity.h"
#include <wtf/Ref.h>
#include <wtf/SetForScope.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
using namespace HTMLNames;
static LinkEventSender& linkLoadEventSender()
{
static NeverDestroyed<LinkEventSender> sharedLoadEventSender(eventNames().loadEvent);
return sharedLoadEventSender;
}
static LinkEventSender& linkErrorEventSender()
{
static NeverDestroyed<LinkEventSender> sharedErrorEventSender(eventNames().errorEvent);
return sharedErrorEventSender;
}
inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
: HTMLElement(tagName, document)
, m_linkLoader(*this)
, m_disabledState(Unset)
, m_loading(false)
, m_createdByParser(createdByParser)
, m_firedLoad(false)
, m_loadedResource(false)
, m_pendingSheetType(Unknown)
{
ASSERT(hasTagName(linkTag));
}
Ref<HTMLLinkElement> HTMLLinkElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
{
return adoptRef(*new HTMLLinkElement(tagName, document, createdByParser));
}
HTMLLinkElement::~HTMLLinkElement()
{
if (m_sheet)
m_sheet->clearOwnerNode();
if (m_cachedSheet)
m_cachedSheet->removeClient(*this);
if (m_styleScope)
m_styleScope->removeStyleSheetCandidateNode(*this);
linkLoadEventSender().cancelEvent(*this);
linkErrorEventSender().cancelEvent(*this);
}
void HTMLLinkElement::setDisabledState(bool disabled)
{
DisabledState oldDisabledState = m_disabledState;
m_disabledState = disabled ? Disabled : EnabledViaScript;
if (oldDisabledState == m_disabledState)
return;
ASSERT(isConnected() || !styleSheetIsLoading());
if (!isConnected())
return;
// If we change the disabled state while the sheet is still loading, then we have to
// perform three checks:
if (styleSheetIsLoading()) {
// Check #1: The sheet becomes disabled while loading.
if (m_disabledState == Disabled)
removePendingSheet();
// Check #2: An alternate sheet becomes enabled while it is still loading.
if (m_relAttribute.isAlternate && m_disabledState == EnabledViaScript)
addPendingSheet(ActiveSheet);
// Check #3: A main sheet becomes enabled while it was still loading and
// after it was disabled via script. It takes really terrible code to make this
// happen (a double toggle for no reason essentially). This happens on
// virtualplastic.net, which manages to do about 12 enable/disables on only 3
// sheets. :)
if (!m_relAttribute.isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
addPendingSheet(ActiveSheet);
// If the sheet is already loading just bail.
return;
}
// Load the sheet, since it's never been loaded before.
if (!m_sheet && m_disabledState == EnabledViaScript)
process();
else {
ASSERT(m_styleScope);
m_styleScope->didChangeActiveStyleSheetCandidates();
}
}
void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == relAttr) {
m_relAttribute = LinkRelAttribute(document(), value);
if (m_relList)
m_relList->associatedAttributeValueChanged(value);
process();
return;
}
if (name == hrefAttr) {
bool wasLink = isLink();
setIsLink(!value.isNull() && !shouldProhibitLinks(this));
if (wasLink != isLink())
invalidateStyleForSubtree();
process();
return;
}
if (name == typeAttr) {
m_type = value;
process();
return;
}
if (name == sizesAttr) {
if (m_sizes)
m_sizes->associatedAttributeValueChanged(value);
process();
return;
}
if (name == mediaAttr) {
m_media = value.string().convertToASCIILowercase();
process();
if (m_sheet && !isDisabled())
m_styleScope->didChangeActiveStyleSheetCandidates();
return;
}
if (name == disabledAttr) {
setDisabledState(!value.isNull());
return;
}
if (name == titleAttr) {
if (m_sheet)
m_sheet->setTitle(value);
return;
}
HTMLElement::parseAttribute(name, value);
}
bool HTMLLinkElement::shouldLoadLink()
{
Ref<Document> originalDocument = document();
if (!dispatchBeforeLoadEvent(getNonEmptyURLAttribute(hrefAttr)))
return false;
// A beforeload handler might have removed us from the document or changed the document.
if (!isConnected() || &document() != originalDocument.ptr())
return false;
return true;
}
void HTMLLinkElement::setCrossOrigin(const AtomicString& value)
{
setAttributeWithoutSynchronization(crossoriginAttr, value);
}
String HTMLLinkElement::crossOrigin() const
{
return parseCORSSettingsAttribute(attributeWithoutSynchronization(crossoriginAttr));
}
void HTMLLinkElement::setAs(const AtomicString& value)
{
setAttributeWithoutSynchronization(asAttr, value);
}
String HTMLLinkElement::as() const
{
String as = attributeWithoutSynchronization(asAttr);
if (equalLettersIgnoringASCIICase(as, "fetch")
|| equalLettersIgnoringASCIICase(as, "image")
|| equalLettersIgnoringASCIICase(as, "script")
|| equalLettersIgnoringASCIICase(as, "style")
|| (RuntimeEnabledFeatures::sharedFeatures().mediaPreloadingEnabled()
&& (equalLettersIgnoringASCIICase(as, "video")
|| equalLettersIgnoringASCIICase(as, "audio")))
#if ENABLE(VIDEO_TRACK)
|| equalLettersIgnoringASCIICase(as, "track")
#endif
|| equalLettersIgnoringASCIICase(as, "font"))
return as;
return String();
}
void HTMLLinkElement::process()
{
if (!isConnected()) {
ASSERT(!m_sheet);
return;
}
// Prevent recursive loading of link.
if (m_isHandlingBeforeLoad)
return;
URL url = getNonEmptyURLAttribute(hrefAttr);
if (!m_linkLoader.loadLink(m_relAttribute, url, attributeWithoutSynchronization(asAttr), attributeWithoutSynchronization(mediaAttr), attributeWithoutSynchronization(typeAttr), attributeWithoutSynchronization(crossoriginAttr), document()))
return;
bool treatAsStyleSheet = m_relAttribute.isStyleSheet
|| (document().settings().treatsAnyTextCSSLinkAsStylesheet() && m_type.containsIgnoringASCIICase("text/css"));
if (m_disabledState != Disabled && treatAsStyleSheet && document().frame() && url.isValid()) {
String charset = attributeWithoutSynchronization(charsetAttr);
if (charset.isEmpty())
charset = document().charset();
if (m_cachedSheet) {
removePendingSheet();
m_cachedSheet->removeClient(*this);
m_cachedSheet = nullptr;
}
{
SetForScope<bool> change(m_isHandlingBeforeLoad, true);
if (!shouldLoadLink())
return;
}
m_loading = true;
bool mediaQueryMatches = true;
if (!m_media.isEmpty()) {
std::optional<RenderStyle> documentStyle;
if (document().hasLivingRenderTree())
documentStyle = Style::resolveForDocument(document());
auto media = MediaQuerySet::create(m_media);
LOG(MediaQueries, "HTMLLinkElement::process evaluating queries");
mediaQueryMatches = MediaQueryEvaluator { document().frame()->view()->mediaType(), document(), documentStyle ? &*documentStyle : nullptr }.evaluate(media.get());
}
// Don't hold up render tree construction and script execution on stylesheets
// that are not needed for the rendering at the moment.
bool isActive = mediaQueryMatches && !isAlternate();
addPendingSheet(isActive ? ActiveSheet : InactiveSheet);
// Load stylesheets that are not needed for the rendering immediately with low priority.
std::optional<ResourceLoadPriority> priority;
if (!isActive)
priority = ResourceLoadPriority::VeryLow;
if (document().settings().subresourceIntegrityEnabled())
m_integrityMetadataForPendingSheetRequest = attributeWithoutSynchronization(HTMLNames::integrityAttr);
ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
options.sameOriginDataURLFlag = SameOriginDataURLFlag::Set;
if (document().contentSecurityPolicy()->allowStyleWithNonce(attributeWithoutSynchronization(HTMLNames::nonceAttr)))
options.contentSecurityPolicyImposition = ContentSecurityPolicyImposition::SkipPolicyCheck;
options.integrity = m_integrityMetadataForPendingSheetRequest;
CachedResourceRequest request(url, options, priority, WTFMove(charset));
request.setInitiator(*this);
request.setAsPotentiallyCrossOrigin(crossOrigin(), document());
ASSERT_WITH_SECURITY_IMPLICATION(!m_cachedSheet);
m_cachedSheet = document().cachedResourceLoader().requestCSSStyleSheet(WTFMove(request)).value_or(nullptr);
if (m_cachedSheet)
m_cachedSheet->addClient(*this);
else {
// The request may have been denied if (for example) the stylesheet is local and the document is remote.
m_loading = false;
sheetLoaded();
notifyLoadedSheetAndAllCriticalSubresources(false);
}
} else if (m_sheet) {
// we no longer contain a stylesheet, e.g. perhaps rel or type was changed
clearSheet();
m_styleScope->didChangeActiveStyleSheetCandidates();
}
}
void HTMLLinkElement::clearSheet()
{
ASSERT(m_sheet);
ASSERT(m_sheet->ownerNode() == this);
m_sheet->clearOwnerNode();
m_sheet = nullptr;
}
Node::InsertedIntoAncestorResult HTMLLinkElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
{
HTMLElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
if (!insertionType.connectedToDocument)
return InsertedIntoAncestorResult::Done;
m_styleScope = &Style::Scope::forNode(*this);
m_styleScope->addStyleSheetCandidateNode(*this, m_createdByParser);
return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
}
void HTMLLinkElement::didFinishInsertingNode()
{
process();
}
void HTMLLinkElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree)
{
HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
if (!removalType.disconnectedFromDocument)
return;
m_linkLoader.cancelLoad();
bool wasLoading = styleSheetIsLoading();
if (m_sheet)
clearSheet();
if (wasLoading)
removePendingSheet();
if (m_styleScope) {
m_styleScope->removeStyleSheetCandidateNode(*this);
m_styleScope = nullptr;
}
}
void HTMLLinkElement::finishParsingChildren()
{
m_createdByParser = false;
HTMLElement::finishParsingChildren();
}
void HTMLLinkElement::initializeStyleSheet(Ref<StyleSheetContents>&& styleSheet, const CachedCSSStyleSheet& cachedStyleSheet)
{
// FIXME: originClean should be turned to false except if fetch mode is CORS.
std::optional<bool> originClean;
if (cachedStyleSheet.options().mode == FetchOptions::Mode::Cors)
originClean = cachedStyleSheet.isCORSSameOrigin();
m_sheet = CSSStyleSheet::create(WTFMove(styleSheet), *this, originClean);
m_sheet->setMediaQueries(MediaQuerySet::create(m_media));
m_sheet->setTitle(title());
}
void HTMLLinkElement::setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet* cachedStyleSheet)
{
if (!isConnected()) {
ASSERT(!m_sheet);
return;
}
auto frame = makeRefPtr(document().frame());
if (!frame)
return;
// Completing the sheet load may cause scripts to execute.
Ref<HTMLLinkElement> protectedThis(*this);
if (!cachedStyleSheet->errorOccurred() && !matchIntegrityMetadata(*cachedStyleSheet, m_integrityMetadataForPendingSheetRequest)) {
document().addConsoleMessage(MessageSource::Security, MessageLevel::Error, makeString("Cannot load stylesheet ", cachedStyleSheet->url().stringCenterEllipsizedToLength(), ". Failed integrity metadata check."));
m_loading = false;
sheetLoaded();
notifyLoadedSheetAndAllCriticalSubresources(true);
return;
}
CSSParserContext parserContext(document(), baseURL, charset);
auto cachePolicy = frame->loader().subresourceCachePolicy(baseURL);
if (auto restoredSheet = const_cast<CachedCSSStyleSheet*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext, cachePolicy, frame->loader())) {
ASSERT(restoredSheet->isCacheable());
ASSERT(!restoredSheet->isLoading());
initializeStyleSheet(restoredSheet.releaseNonNull(), *cachedStyleSheet);
m_loading = false;
sheetLoaded();
notifyLoadedSheetAndAllCriticalSubresources(false);
return;
}
auto styleSheet = StyleSheetContents::create(href, parserContext);
initializeStyleSheet(styleSheet.copyRef(), *cachedStyleSheet);
styleSheet.get().parseAuthorStyleSheet(cachedStyleSheet, &document().securityOrigin());
m_loading = false;
styleSheet.get().notifyLoadedSheet(cachedStyleSheet);
styleSheet.get().checkLoaded();
if (styleSheet.get().isCacheable())
const_cast<CachedCSSStyleSheet*>(cachedStyleSheet)->saveParsedStyleSheet(WTFMove(styleSheet));
}
bool HTMLLinkElement::styleSheetIsLoading() const
{
if (m_loading)
return true;
if (!m_sheet)
return false;
return m_sheet->contents().isLoading();
}
DOMTokenList& HTMLLinkElement::sizes()
{
if (!m_sizes)
m_sizes = std::make_unique<DOMTokenList>(*this, sizesAttr);
return *m_sizes;
}
void HTMLLinkElement::linkLoaded()
{
m_loadedResource = true;
linkLoadEventSender().dispatchEventSoon(*this);
}
void HTMLLinkElement::linkLoadingErrored()
{
linkErrorEventSender().dispatchEventSoon(*this);
}
bool HTMLLinkElement::sheetLoaded()
{
if (!styleSheetIsLoading()) {
removePendingSheet();
return true;
}
return false;
}
void HTMLLinkElement::dispatchPendingLoadEvents()
{
linkLoadEventSender().dispatchPendingEvents();
}
void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
{
ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender() || eventSender == &linkErrorEventSender());
if (m_loadedResource)
dispatchEvent(Event::create(eventNames().loadEvent, false, false));
else
dispatchEvent(Event::create(eventNames().errorEvent, false, false));
}
DOMTokenList& HTMLLinkElement::relList()
{
if (!m_relList)
m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](Document& document, StringView token) {
return LinkRelAttribute::isSupported(document, token);
});
return *m_relList;
}
void HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
{
if (m_firedLoad)
return;
m_loadedResource = !errorOccurred;
linkLoadEventSender().dispatchEventSoon(*this);
m_firedLoad = true;
}
void HTMLLinkElement::startLoadingDynamicSheet()
{
// We don't support multiple active sheets.
ASSERT(m_pendingSheetType < ActiveSheet);
addPendingSheet(ActiveSheet);
}
bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const
{
return attribute.name().localName() == hrefAttr || HTMLElement::isURLAttribute(attribute);
}
void HTMLLinkElement::defaultEventHandler(Event& event)
{
if (MouseEvent::canTriggerActivationBehavior(event)) {
handleClick(event);
return;
}
HTMLElement::defaultEventHandler(event);
}
void HTMLLinkElement::handleClick(Event& event)
{
event.setDefaultHandled();
URL url = href();
if (url.isNull())
return;
RefPtr<Frame> frame = document().frame();
if (!frame)
return;
frame->loader().urlSelected(url, target(), &event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());
}
URL HTMLLinkElement::href() const
{
return document().completeURL(attributeWithoutSynchronization(hrefAttr));
}
const AtomicString& HTMLLinkElement::rel() const
{
return attributeWithoutSynchronization(relAttr);
}
String HTMLLinkElement::target() const
{
return attributeWithoutSynchronization(targetAttr);
}
const AtomicString& HTMLLinkElement::type() const
{
return attributeWithoutSynchronization(typeAttr);
}
std::optional<LinkIconType> HTMLLinkElement::iconType() const
{
return m_relAttribute.iconType;
}
void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
{
HTMLElement::addSubresourceAttributeURLs(urls);
// Favicons are handled by a special case in LegacyWebArchive::create()
if (m_relAttribute.iconType)
return;
if (!m_relAttribute.isStyleSheet)
return;
// Append the URL of this link element.
addSubresourceURL(urls, href());
if (auto styleSheet = makeRefPtr(this->sheet())) {
styleSheet->contents().traverseSubresources([&] (auto& resource) {
urls.add(resource.url());
return false;
});
}
}
void HTMLLinkElement::addPendingSheet(PendingSheetType type)
{
if (type <= m_pendingSheetType)
return;
m_pendingSheetType = type;
if (m_pendingSheetType == InactiveSheet)
return;
ASSERT(m_styleScope);
m_styleScope->addPendingSheet(*this);
}
void HTMLLinkElement::removePendingSheet()
{
PendingSheetType type = m_pendingSheetType;
m_pendingSheetType = Unknown;
if (type == Unknown)
return;
ASSERT(m_styleScope);
if (type == InactiveSheet) {
// Document just needs to know about the sheet for exposure through document.styleSheets
m_styleScope->didChangeActiveStyleSheetCandidates();
return;
}
m_styleScope->removePendingSheet(*this);
}
} // namespace WebCore
| 32.270701 | 242 | 0.701421 | mchiasson |
f32d7ee7a2372ad8f6eac2ceb65a3334e8c41719 | 39,610 | cpp | C++ | external/vulkancts/modules/vulkan/wsi/vktWsiPresentIdWaitTests.cpp | twoerner/VK-GL-CTS | 8e89717bf4ed2d67c58231d1847d2c8f574f300c | [
"Apache-2.0"
] | 354 | 2017-01-24T17:12:38.000Z | 2022-03-30T07:40:19.000Z | external/vulkancts/modules/vulkan/wsi/vktWsiPresentIdWaitTests.cpp | twoerner/VK-GL-CTS | 8e89717bf4ed2d67c58231d1847d2c8f574f300c | [
"Apache-2.0"
] | 275 | 2017-01-24T20:10:36.000Z | 2022-03-24T16:24:50.000Z | external/vulkancts/modules/vulkan/wsi/vktWsiPresentIdWaitTests.cpp | twoerner/VK-GL-CTS | 8e89717bf4ed2d67c58231d1847d2c8f574f300c | [
"Apache-2.0"
] | 190 | 2017-01-24T18:02:04.000Z | 2022-03-27T13:11:23.000Z | /*-------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
*
* Copyright (c) 2019 The Khronos Group Inc.
* Copyright (c) 2019 Valve 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.
*
*//*!
* \file
* \brief Tests for the present id and present wait extensions.
*//*--------------------------------------------------------------------*/
#include "vktWsiPresentIdWaitTests.hpp"
#include "vktTestCase.hpp"
#include "vktCustomInstancesDevices.hpp"
#include "vktNativeObjectsUtil.hpp"
#include "vkQueryUtil.hpp"
#include "vkDeviceUtil.hpp"
#include "vkWsiUtil.hpp"
#include "vkMemUtil.hpp"
#include "vkTypeUtil.hpp"
#include "vkRefUtil.hpp"
#include "tcuTestContext.hpp"
#include "tcuPlatform.hpp"
#include "tcuCommandLine.hpp"
#include "tcuTestLog.hpp"
#include "deDefs.hpp"
#include <vector>
#include <string>
#include <set>
#include <sstream>
#include <chrono>
#include <algorithm>
#include <utility>
#include <limits>
using std::vector;
using std::string;
using std::set;
namespace vkt
{
namespace wsi
{
namespace
{
// Handy time constants in nanoseconds.
constexpr deUint64 k10sec = 10000000000ull;
constexpr deUint64 k1sec = 1000000000ull;
// 100 milliseconds, way above 1/50 seconds for systems with 50Hz ticks.
// This should also take into account possible measure deviations due to the machine being loaded.
constexpr deUint64 kMargin = 100000000ull;
using TimeoutRange = std::pair<deInt64, deInt64>;
// Calculate acceptable timeout range based on indicated timeout and taking into account kMargin.
TimeoutRange calcTimeoutRange (deUint64 timeout)
{
constexpr auto kUnsignedMax = std::numeric_limits<deUint64>::max();
constexpr auto kSignedMax = static_cast<deUint64>(std::numeric_limits<deInt64>::max());
// Watch for over- and under-flows.
deUint64 timeoutMin = ((timeout < kMargin) ? 0ull : (timeout - kMargin));
deUint64 timeoutMax = ((kUnsignedMax - timeout < kMargin) ? kUnsignedMax : timeout + kMargin);
// Make sure casting is safe.
timeoutMin = de::min(kSignedMax, timeoutMin);
timeoutMax = de::min(kSignedMax, timeoutMax);
return TimeoutRange(static_cast<deInt64>(timeoutMin), static_cast<deInt64>(timeoutMax));
}
class PresentIdWaitInstance : public TestInstance
{
public:
PresentIdWaitInstance (Context& context, vk::wsi::Type wsiType) : TestInstance(context), m_wsiType(wsiType) {}
virtual ~PresentIdWaitInstance (void) {}
virtual tcu::TestStatus iterate (void);
virtual tcu::TestStatus run (const vk::DeviceInterface& vkd,
vk::VkDevice device,
vk::VkQueue queue,
vk::VkCommandPool commandPool,
vk::VkSwapchainKHR swapchain,
size_t swapchainSize,
const vk::wsi::WsiTriangleRenderer& renderer) = 0;
// Subclasses will need to implement a static method like this one indicating which extensions they need.
static vector<const char*> requiredDeviceExts (void) { return vector<const char*>(); }
// Subclasses will also need to implement this nonstatic method returning the same information as above.
virtual vector<const char*> getRequiredDeviceExts (void) = 0;
protected:
vk::wsi::Type m_wsiType;
};
vector<const char*> getRequiredInstanceExtensions (vk::wsi::Type wsiType)
{
vector<const char*> extensions;
extensions.push_back("VK_KHR_surface");
extensions.push_back(getExtensionName(wsiType));
return extensions;
}
CustomInstance createInstanceWithWsi (Context& context,
vk::wsi::Type wsiType,
const vk::VkAllocationCallbacks* pAllocator = nullptr)
{
const auto version = context.getUsedApiVersion();
const auto requiredExtensions = getRequiredInstanceExtensions(wsiType);
vector<string> requestedExtensions;
for (const auto& extensionName : requiredExtensions)
{
if (!vk::isCoreInstanceExtension(version, extensionName))
requestedExtensions.push_back(extensionName);
}
return vkt::createCustomInstanceWithExtensions(context, requestedExtensions, pAllocator);
}
struct InstanceHelper
{
const vector<vk::VkExtensionProperties> supportedExtensions;
CustomInstance instance;
const vk::InstanceDriver& vki;
InstanceHelper (Context& context, vk::wsi::Type wsiType, const vk::VkAllocationCallbacks* pAllocator = nullptr)
: supportedExtensions (enumerateInstanceExtensionProperties(context.getPlatformInterface(), nullptr))
, instance (createInstanceWithWsi(context, wsiType, pAllocator))
, vki (instance.getDriver())
{}
};
vector<const char*> getMandatoryDeviceExtensions ()
{
vector<const char*> mandatoryExtensions;
mandatoryExtensions.push_back("VK_KHR_swapchain");
return mandatoryExtensions;
}
vk::Move<vk::VkDevice> createDeviceWithWsi (const vk::PlatformInterface& vkp,
vk::VkInstance instance,
const vk::InstanceInterface& vki,
vk::VkPhysicalDevice physicalDevice,
const vector<const char*>& extraExtensions,
const deUint32 queueFamilyIndex,
bool validationEnabled,
const vk::VkAllocationCallbacks* pAllocator = nullptr)
{
const float queuePriorities[] = { 1.0f };
const vk::VkDeviceQueueCreateInfo queueInfos[] =
{
{
vk::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
nullptr,
(vk::VkDeviceQueueCreateFlags)0,
queueFamilyIndex,
DE_LENGTH_OF_ARRAY(queuePriorities),
&queuePriorities[0]
}
};
vk::VkPhysicalDeviceFeatures features;
std::vector<const char*> extensions = extraExtensions;
const auto mandatoryExtensions = getMandatoryDeviceExtensions();
for (const auto& ext : mandatoryExtensions)
extensions.push_back(ext);
deMemset(&features, 0, sizeof(features));
const vk::VkDeviceCreateInfo deviceParams =
{
vk::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
nullptr,
(vk::VkDeviceCreateFlags)0,
DE_LENGTH_OF_ARRAY(queueInfos),
&queueInfos[0],
0u, // enabledLayerCount
nullptr, // ppEnabledLayerNames
static_cast<deUint32>(extensions.size()), // enabledExtensionCount
extensions.data(), // ppEnabledExtensionNames
&features
};
return createCustomDevice(validationEnabled, vkp, instance, vki, physicalDevice, &deviceParams, pAllocator);
}
struct DeviceHelper
{
const vk::VkPhysicalDevice physicalDevice;
const deUint32 queueFamilyIndex;
const vk::Unique<vk::VkDevice> device;
const vk::DeviceDriver vkd;
const vk::VkQueue queue;
DeviceHelper (Context& context,
const vk::InstanceInterface& vki,
vk::VkInstance instance,
const vector<vk::VkSurfaceKHR>& surfaces,
const vector<const char*>& extraExtensions,
const vk::VkAllocationCallbacks* pAllocator = nullptr)
: physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()))
, queueFamilyIndex (vk::wsi::chooseQueueFamilyIndex(vki, physicalDevice, surfaces))
, device (createDeviceWithWsi(context.getPlatformInterface(),
instance,
vki,
physicalDevice,
extraExtensions,
queueFamilyIndex,
context.getTestContext().getCommandLine().isValidationEnabled(),
pAllocator))
, vkd (context.getPlatformInterface(), instance, *device)
, queue (getDeviceQueue(vkd, *device, queueFamilyIndex, 0))
{
}
};
vk::VkSwapchainCreateInfoKHR getBasicSwapchainParameters (vk::wsi::Type wsiType,
const vk::InstanceInterface& vki,
vk::VkPhysicalDevice physicalDevice,
vk::VkSurfaceKHR surface,
const tcu::UVec2& desiredSize,
deUint32 desiredImageCount)
{
const vk::VkSurfaceCapabilitiesKHR capabilities = vk::wsi::getPhysicalDeviceSurfaceCapabilities(vki,
physicalDevice,
surface);
const vector<vk::VkSurfaceFormatKHR> formats = vk::wsi::getPhysicalDeviceSurfaceFormats(vki,
physicalDevice,
surface);
const vk::wsi::PlatformProperties& platformProperties = vk::wsi::getPlatformProperties(wsiType);
const vk::VkSurfaceTransformFlagBitsKHR transform = (capabilities.supportedTransforms & vk::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) ? vk::VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : capabilities.currentTransform;
const vk::VkSwapchainCreateInfoKHR parameters =
{
vk::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
nullptr,
(vk::VkSwapchainCreateFlagsKHR)0,
surface,
de::clamp(desiredImageCount, capabilities.minImageCount, capabilities.maxImageCount > 0 ? capabilities.maxImageCount : capabilities.minImageCount + desiredImageCount),
formats[0].format,
formats[0].colorSpace,
(platformProperties.swapchainExtent == vk::wsi::PlatformProperties::SWAPCHAIN_EXTENT_MUST_MATCH_WINDOW_SIZE
? capabilities.currentExtent : vk::makeExtent2D(desiredSize.x(), desiredSize.y())),
1u, // imageArrayLayers
vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
vk::VK_SHARING_MODE_EXCLUSIVE,
0u,
nullptr,
transform,
vk::VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
vk::VK_PRESENT_MODE_FIFO_KHR,
VK_FALSE, // clipped
(vk::VkSwapchainKHR)0 // oldSwapchain
};
return parameters;
}
using CommandBufferSp = de::SharedPtr<vk::Unique<vk::VkCommandBuffer>>;
using FenceSp = de::SharedPtr<vk::Unique<vk::VkFence>>;
using SemaphoreSp = de::SharedPtr<vk::Unique<vk::VkSemaphore>>;
vector<FenceSp> createFences (const vk::DeviceInterface& vkd,
const vk::VkDevice device,
size_t numFences)
{
vector<FenceSp> fences(numFences);
for (size_t ndx = 0; ndx < numFences; ++ndx)
fences[ndx] = FenceSp(new vk::Unique<vk::VkFence>(createFence(vkd, device, vk::VK_FENCE_CREATE_SIGNALED_BIT)));
return fences;
}
vector<SemaphoreSp> createSemaphores (const vk::DeviceInterface& vkd,
const vk::VkDevice device,
size_t numSemaphores)
{
vector<SemaphoreSp> semaphores(numSemaphores);
for (size_t ndx = 0; ndx < numSemaphores; ++ndx)
semaphores[ndx] = SemaphoreSp(new vk::Unique<vk::VkSemaphore>(createSemaphore(vkd, device)));
return semaphores;
}
vector<CommandBufferSp> allocateCommandBuffers (const vk::DeviceInterface& vkd,
const vk::VkDevice device,
const vk::VkCommandPool commandPool,
const vk::VkCommandBufferLevel level,
const size_t numCommandBuffers)
{
vector<CommandBufferSp> buffers (numCommandBuffers);
for (size_t ndx = 0; ndx < numCommandBuffers; ++ndx)
buffers[ndx] = CommandBufferSp(new vk::Unique<vk::VkCommandBuffer>(allocateCommandBuffer(vkd, device, commandPool, level)));
return buffers;
}
class FrameStreamObjects
{
public:
struct FrameObjects
{
const vk::VkFence& renderCompleteFence;
const vk::VkSemaphore& renderCompleteSemaphore;
const vk::VkSemaphore& imageAvailableSemaphore;
const vk::VkCommandBuffer& commandBuffer;
};
FrameStreamObjects (const vk::DeviceInterface& vkd, vk::VkDevice device, vk::VkCommandPool cmdPool, size_t maxQueuedFrames)
: renderingCompleteFences (createFences(vkd, device, maxQueuedFrames))
, renderingCompleteSemaphores (createSemaphores(vkd, device, maxQueuedFrames))
, imageAvailableSemaphores (createSemaphores(vkd, device, maxQueuedFrames))
, commandBuffers (allocateCommandBuffers(vkd, device, cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, maxQueuedFrames))
, m_maxQueuedFrames (maxQueuedFrames)
, m_nextFrame (0u)
{}
size_t frameNumber (void) const { DE_ASSERT(m_nextFrame > 0u); return m_nextFrame - 1u; }
FrameObjects newFrame ()
{
const size_t mod = m_nextFrame % m_maxQueuedFrames;
FrameObjects ret =
{
**renderingCompleteFences[mod],
**renderingCompleteSemaphores[mod],
**imageAvailableSemaphores[mod],
**commandBuffers[mod],
};
++m_nextFrame;
return ret;
}
private:
const vector<FenceSp> renderingCompleteFences;
const vector<SemaphoreSp> renderingCompleteSemaphores;
const vector<SemaphoreSp> imageAvailableSemaphores;
const vector<CommandBufferSp> commandBuffers;
const size_t m_maxQueuedFrames;
size_t m_nextFrame;
};
tcu::TestStatus PresentIdWaitInstance::iterate (void)
{
const tcu::UVec2 desiredSize (256, 256);
const InstanceHelper instHelper (m_context, m_wsiType);
const NativeObjects native (m_context, instHelper.supportedExtensions, m_wsiType, 1u, tcu::just(desiredSize));
const vk::Unique<vk::VkSurfaceKHR> surface (createSurface(instHelper.vki, instHelper.instance, m_wsiType, native.getDisplay(), native.getWindow()));
const DeviceHelper devHelper (m_context, instHelper.vki, instHelper.instance, vector<vk::VkSurfaceKHR>(1u, surface.get()), getRequiredDeviceExts());
const vk::DeviceInterface& vkd = devHelper.vkd;
const vk::VkDevice device = *devHelper.device;
vk::SimpleAllocator allocator (vkd, device, getPhysicalDeviceMemoryProperties(instHelper.vki, devHelper.physicalDevice));
const vk::VkSwapchainCreateInfoKHR swapchainInfo = getBasicSwapchainParameters(m_wsiType, instHelper.vki, devHelper.physicalDevice, *surface, desiredSize, 2);
const vk::Unique<vk::VkSwapchainKHR> swapchain (vk::createSwapchainKHR(vkd, device, &swapchainInfo));
const vector<vk::VkImage> swapchainImages = vk::wsi::getSwapchainImages(vkd, device, *swapchain);
const vk::Unique<vk::VkCommandPool> commandPool (createCommandPool(vkd, device, vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, devHelper.queueFamilyIndex));
const vk::wsi::WsiTriangleRenderer renderer (vkd,
device,
allocator,
m_context.getBinaryCollection(),
false,
swapchainImages,
swapchainImages,
swapchainInfo.imageFormat,
tcu::UVec2(swapchainInfo.imageExtent.width, swapchainInfo.imageExtent.height));
try
{
return run(vkd, device, devHelper.queue, commandPool.get(), swapchain.get(), swapchainImages.size(), renderer);
}
catch (...)
{
// Make sure device is idle before destroying resources
vkd.deviceWaitIdle(device);
throw;
}
return tcu::TestStatus(QP_TEST_RESULT_INTERNAL_ERROR, "Reached unreachable code");
}
struct PresentParameters
{
tcu::Maybe<deUint64> presentId;
tcu::Maybe<vk::VkResult> expectedResult;
};
struct WaitParameters
{
deUint64 presentId;
deUint64 timeout; // Nanoseconds.
bool timeoutExpected;
};
// This structure represents a set of present operations to be run followed by a set of wait operations to be run after them.
// When running the present operations, the present id can be provided, together with an optional expected result to be checked.
// When runing the wait operations, the present id must be provided together with a timeout and an indication of whether the operation is expected to time out or not.
struct PresentAndWaitOps
{
vector<PresentParameters> presentOps;
vector<WaitParameters> waitOps;
};
// Parent class for VK_KHR_present_id and VK_KHR_present_wait simple tests.
class PresentIdWaitSimpleInstance : public PresentIdWaitInstance
{
public:
PresentIdWaitSimpleInstance(Context& context, vk::wsi::Type wsiType, const vector<PresentAndWaitOps>& sequence)
: PresentIdWaitInstance(context, wsiType), m_sequence(sequence)
{}
virtual ~PresentIdWaitSimpleInstance() {}
virtual tcu::TestStatus run (const vk::DeviceInterface& vkd,
vk::VkDevice device,
vk::VkQueue queue,
vk::VkCommandPool commandPool,
vk::VkSwapchainKHR swapchain,
size_t swapchainSize,
const vk::wsi::WsiTriangleRenderer& renderer);
protected:
const vector<PresentAndWaitOps> m_sequence;
};
// Waits for the appropriate fences, acquires swapchain image, records frame and submits it to the given queue, signaling the appropriate frame semaphores.
// Returns the image index from the swapchain.
deUint32 recordAndSubmitFrame (FrameStreamObjects::FrameObjects& frameObjects, const vk::wsi::WsiTriangleRenderer& triangleRenderer, const vk::DeviceInterface& vkd, vk::VkDevice device, vk::VkSwapchainKHR swapchain, size_t swapchainSize, vk::VkQueue queue, size_t frameNumber, tcu::TestLog& testLog)
{
// Wait and reset the render complete fence to avoid having too many submitted frames.
VK_CHECK(vkd.waitForFences(device, 1u, &frameObjects.renderCompleteFence, VK_TRUE, std::numeric_limits<deUint64>::max()));
VK_CHECK(vkd.resetFences(device, 1, &frameObjects.renderCompleteFence));
// Acquire swapchain image.
deUint32 imageNdx = std::numeric_limits<deUint32>::max();
const vk::VkResult acquireResult = vkd.acquireNextImageKHR(device,
swapchain,
std::numeric_limits<deUint64>::max(),
frameObjects.imageAvailableSemaphore,
(vk::VkFence)0,
&imageNdx);
if (acquireResult == vk::VK_SUBOPTIMAL_KHR)
testLog << tcu::TestLog::Message << "Got " << acquireResult << " at frame " << frameNumber << tcu::TestLog::EndMessage;
else
VK_CHECK(acquireResult);
TCU_CHECK(static_cast<size_t>(imageNdx) < swapchainSize);
// Submit frame to the queue.
const vk::VkPipelineStageFlags waitDstStage = vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
const vk::VkSubmitInfo submitInfo =
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
nullptr,
1u,
&frameObjects.imageAvailableSemaphore,
&waitDstStage,
1u,
&frameObjects.commandBuffer,
1u,
&frameObjects.renderCompleteSemaphore,
};
triangleRenderer.recordFrame(frameObjects.commandBuffer, imageNdx, static_cast<deUint32>(frameNumber));
VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, frameObjects.renderCompleteFence));
return imageNdx;
}
tcu::TestStatus PresentIdWaitSimpleInstance::run (const vk::DeviceInterface& vkd, vk::VkDevice device, vk::VkQueue queue, vk::VkCommandPool commandPool, vk::VkSwapchainKHR swapchain, size_t swapchainSize, const vk::wsi::WsiTriangleRenderer& renderer)
{
const size_t maxQueuedFrames = swapchainSize*2;
FrameStreamObjects frameStreamObjects (vkd, device, commandPool, maxQueuedFrames);
for (const auto& step : m_sequence)
{
for (const auto& presentOp : step.presentOps)
{
// Get objects for the next frame.
FrameStreamObjects::FrameObjects frameObjects = frameStreamObjects.newFrame();
// Record and submit new frame.
deUint32 imageNdx = recordAndSubmitFrame(frameObjects, renderer, vkd, device, swapchain, swapchainSize, queue, frameStreamObjects.frameNumber(), m_context.getTestContext().getLog());
// Present rendered frame.
const vk::VkPresentIdKHR presentId =
{
vk::VK_STRUCTURE_TYPE_PRESENT_ID_KHR, // VkStructureType sType;
nullptr, // const void* pNext;
(presentOp.presentId ? 1u : 0u), // deUint32 swapchainCount;
(presentOp.presentId ? &presentOp.presentId.get() : nullptr ), // const deUint64* pPresentIds;
};
const vk::VkPresentInfoKHR presentInfo =
{
vk::VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
(presentOp.presentId ? &presentId : nullptr),
1u,
&frameObjects.renderCompleteSemaphore,
1u,
&swapchain,
&imageNdx,
nullptr,
};
vk::VkResult result = vkd.queuePresentKHR(queue, &presentInfo);
if (presentOp.expectedResult)
{
const vk::VkResult expected = presentOp.expectedResult.get();
if ((expected == vk::VK_SUCCESS && result != vk::VK_SUCCESS && result != vk::VK_SUBOPTIMAL_KHR) ||
(expected != vk::VK_SUCCESS && result != expected))
{
std::ostringstream msg;
msg << "Got " << result << " while expecting " << expected << " after presenting with ";
if (presentOp.presentId)
msg << "id " << presentOp.presentId.get();
else
msg << "no id";
TCU_FAIL(msg.str());
}
}
}
// Wait operations.
for (const auto& waitOp : step.waitOps)
{
auto before = std::chrono::high_resolution_clock::now();
vk::VkResult waitResult = vkd.waitForPresentKHR(device, swapchain, waitOp.presentId, waitOp.timeout);
auto after = std::chrono::high_resolution_clock::now();
auto diff = std::chrono::nanoseconds(after - before).count();
if (waitOp.timeoutExpected)
{
if (waitResult != vk::VK_TIMEOUT)
{
std::ostringstream msg;
msg << "Got " << waitResult << " while expecting a timeout in vkWaitForPresentKHR call";
TCU_FAIL(msg.str());
}
const auto timeoutRange = calcTimeoutRange(waitOp.timeout);
if (diff < timeoutRange.first || diff > timeoutRange.second)
{
std::ostringstream msg;
msg << "vkWaitForPresentKHR waited for " << diff << " nanoseconds with a timeout of " << waitOp.timeout << " nanoseconds";
TCU_FAIL(msg.str());
}
}
else if (waitResult != vk::VK_SUCCESS)
{
std::ostringstream msg;
msg << "Got " << waitResult << " while expecting success in vkWaitForPresentKHR call";
TCU_FAIL(msg.str());
}
}
}
// Wait until device is idle.
VK_CHECK(vkd.deviceWaitIdle(device));
return tcu::TestStatus::pass("Pass");
}
// Parent class for VK_KHR_present_id simple tests.
class PresentIdInstance : public PresentIdWaitSimpleInstance
{
public:
PresentIdInstance(Context& context, vk::wsi::Type wsiType, const vector<PresentAndWaitOps>& sequence)
: PresentIdWaitSimpleInstance(context, wsiType, sequence)
{}
virtual ~PresentIdInstance() {}
static vector<const char*> requiredDeviceExts (void)
{
vector<const char*> extensions;
extensions.push_back("VK_KHR_present_id");
return extensions;
}
virtual vector<const char*> getRequiredDeviceExts (void)
{
return requiredDeviceExts();
}
};
// Parent class for VK_KHR_present_wait simple tests.
class PresentWaitInstance : public PresentIdWaitSimpleInstance
{
public:
PresentWaitInstance(Context& context, vk::wsi::Type wsiType, const vector<PresentAndWaitOps>& sequence)
: PresentIdWaitSimpleInstance(context, wsiType, sequence)
{}
virtual ~PresentWaitInstance() {}
static vector<const char*> requiredDeviceExts (void)
{
vector<const char*> extensions;
extensions.push_back("VK_KHR_present_id");
extensions.push_back("VK_KHR_present_wait");
return extensions;
}
virtual vector<const char*> getRequiredDeviceExts (void)
{
return requiredDeviceExts();
}
};
class PresentIdZeroInstance : public PresentIdInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentIdZeroInstance (Context& context, vk::wsi::Type wsiType)
: PresentIdInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentIdZeroInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(0), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
},
},
};
class PresentIdIncreasingInstance : public PresentIdInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentIdIncreasingInstance (Context& context, vk::wsi::Type wsiType)
: PresentIdInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentIdIncreasingInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(1), tcu::just(vk::VK_SUCCESS) },
{ tcu::just(std::numeric_limits<deUint64>::max()), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
},
},
};
class PresentIdInterleavedInstance : public PresentIdInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentIdInterleavedInstance (Context& context, vk::wsi::Type wsiType)
: PresentIdInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentIdInterleavedInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(0), tcu::just(vk::VK_SUCCESS) },
{ tcu::just<deUint64>(1), tcu::just(vk::VK_SUCCESS) },
{ tcu::nothing<deUint64>(), tcu::just(vk::VK_SUCCESS) },
{ tcu::just(std::numeric_limits<deUint64>::max()), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
},
},
};
class PresentWaitSingleFrameInstance : public PresentWaitInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentWaitSingleFrameInstance (Context& context, vk::wsi::Type wsiType)
: PresentWaitInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentWaitSingleFrameInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(1), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ 1ull, k10sec, false },
},
},
};
class PresentWaitPastFrameInstance : public PresentWaitInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentWaitPastFrameInstance (Context& context, vk::wsi::Type wsiType)
: PresentWaitInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentWaitPastFrameInstance::sequence =
{
// Start with present id 1.
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(1), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ 1ull, k10sec, false },
{ 1ull, 0ull, false },
},
},
// Then the maximum value. Both waiting for id 1 and the max id should work.
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just(std::numeric_limits<deUint64>::max()), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ 1ull, 0ull, false },
{ 1ull, k10sec, false },
{ std::numeric_limits<deUint64>::max(), k10sec, false },
{ std::numeric_limits<deUint64>::max(), 0ull, false },
},
},
// Submit some frames without id after having used the maximum value. This should also work.
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::nothing<deUint64>(), tcu::just(vk::VK_SUCCESS) },
{ tcu::just<deUint64>(0), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
},
},
};
class PresentWaitNoFramesInstance : public PresentWaitInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentWaitNoFramesInstance (Context& context, vk::wsi::Type wsiType)
: PresentWaitInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentWaitNoFramesInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
},
{ // waitOps vector
{ 1ull, 0ull, true },
{ 1ull, k1sec, true },
},
},
};
class PresentWaitNoFrameIdInstance : public PresentWaitInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentWaitNoFrameIdInstance (Context& context, vk::wsi::Type wsiType)
: PresentWaitInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentWaitNoFrameIdInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(0), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ 1ull, 0ull, true },
{ 1ull, k1sec, true },
},
},
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::nothing<deUint64>(), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ 1ull, 0ull, true },
{ 1ull, k1sec, true },
},
},
};
class PresentWaitFutureFrameInstance : public PresentWaitInstance
{
public:
static const vector<PresentAndWaitOps> sequence;
PresentWaitFutureFrameInstance (Context& context, vk::wsi::Type wsiType)
: PresentWaitInstance(context, wsiType, sequence)
{}
};
const vector<PresentAndWaitOps> PresentWaitFutureFrameInstance::sequence =
{
{ // PresentAndWaitOps
{ // presentOps vector
{ tcu::just<deUint64>(1), tcu::just(vk::VK_SUCCESS) },
},
{ // waitOps vector
{ std::numeric_limits<deUint64>::max(), k1sec, true },
{ std::numeric_limits<deUint64>::max(), 0ull, true },
{ 2ull, 0ull, true },
{ 2ull, k1sec, true },
},
},
};
// Instance with two windows and surfaces to check present ids are not mixed up.
class PresentWaitDualInstance : public TestInstance
{
public:
PresentWaitDualInstance (Context& context, vk::wsi::Type wsiType) : TestInstance(context), m_wsiType(wsiType) {}
virtual ~PresentWaitDualInstance (void) {}
virtual tcu::TestStatus iterate (void);
static vector<const char*> requiredDeviceExts (void)
{
vector<const char*> extensions;
extensions.push_back("VK_KHR_present_id");
extensions.push_back("VK_KHR_present_wait");
return extensions;
}
virtual vector<const char*> getRequiredDeviceExts (void)
{
return requiredDeviceExts();
}
protected:
vk::wsi::Type m_wsiType;
};
struct IdAndWait
{
deUint64 presentId;
bool wait;
};
struct DualIdAndWait
{
IdAndWait idWait1;
IdAndWait idWait2;
};
tcu::TestStatus PresentWaitDualInstance::iterate (void)
{
const tcu::UVec2 desiredSize (256, 256);
const InstanceHelper instHelper (m_context, m_wsiType);
const NativeObjects native (m_context, instHelper.supportedExtensions, m_wsiType, 2u, tcu::just(desiredSize));
const vk::Unique<vk::VkSurfaceKHR> surface1 (createSurface(instHelper.vki, instHelper.instance, m_wsiType, native.getDisplay(), native.getWindow(0)));
const vk::Unique<vk::VkSurfaceKHR> surface2 (createSurface(instHelper.vki, instHelper.instance, m_wsiType, native.getDisplay(), native.getWindow(1)));
const DeviceHelper devHelper (m_context, instHelper.vki, instHelper.instance, vector<vk::VkSurfaceKHR>{surface1.get(), surface2.get()}, getRequiredDeviceExts());
const vk::DeviceInterface& vkd = devHelper.vkd;
const vk::VkDevice device = *devHelper.device;
vk::SimpleAllocator allocator (vkd, device, getPhysicalDeviceMemoryProperties(instHelper.vki, devHelper.physicalDevice));
const vk::VkSwapchainCreateInfoKHR swapchainInfo1 = getBasicSwapchainParameters(m_wsiType, instHelper.vki, devHelper.physicalDevice, surface1.get(), desiredSize, 2);
const vk::VkSwapchainCreateInfoKHR swapchainInfo2 = getBasicSwapchainParameters(m_wsiType, instHelper.vki, devHelper.physicalDevice, surface2.get(), desiredSize, 2);
const vk::Unique<vk::VkSwapchainKHR> swapchain1 (vk::createSwapchainKHR(vkd, device, &swapchainInfo1));
const vk::Unique<vk::VkSwapchainKHR> swapchain2 (vk::createSwapchainKHR(vkd, device, &swapchainInfo2));
const vector<vk::VkImage> swapchainImages1 = vk::wsi::getSwapchainImages(vkd, device, swapchain1.get());
const vector<vk::VkImage> swapchainImages2 = vk::wsi::getSwapchainImages(vkd, device, swapchain2.get());
const vk::Unique<vk::VkCommandPool> commandPool (createCommandPool(vkd, device, vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, devHelper.queueFamilyIndex));
const vk::wsi::WsiTriangleRenderer renderer1 (vkd,
device,
allocator,
m_context.getBinaryCollection(),
false,
swapchainImages1,
swapchainImages1,
swapchainInfo1.imageFormat,
tcu::UVec2(swapchainInfo1.imageExtent.width, swapchainInfo1.imageExtent.height));
const vk::wsi::WsiTriangleRenderer renderer2 (vkd,
device,
allocator,
m_context.getBinaryCollection(),
false,
swapchainImages2,
swapchainImages2,
swapchainInfo2.imageFormat,
tcu::UVec2(swapchainInfo2.imageExtent.width, swapchainInfo2.imageExtent.height));
tcu::TestLog& testLog = m_context.getTestContext().getLog();
try
{
const size_t maxQueuedFrames = swapchainImages1.size()*2;
FrameStreamObjects frameStreamObjects1 (vkd, device, commandPool.get(), maxQueuedFrames);
FrameStreamObjects frameStreamObjects2 (vkd, device, commandPool.get(), maxQueuedFrames);
// Increasing ids for both swapchains, waiting on some to make sure we do not time out unexpectedly.
const vector<DualIdAndWait> sequence =
{
{
{ 1ull, false },
{ 2ull, true },
},
{
{ 4ull, true },
{ 3ull, false },
},
{
{ 5ull, true },
{ 6ull, true },
},
};
for (const auto& step : sequence)
{
// Get objects for the next frames.
FrameStreamObjects::FrameObjects frameObjects1 = frameStreamObjects1.newFrame();
FrameStreamObjects::FrameObjects frameObjects2 = frameStreamObjects2.newFrame();
// Record and submit frame.
deUint32 imageNdx1 = recordAndSubmitFrame(frameObjects1, renderer1, vkd, device, swapchain1.get(), swapchainImages1.size(), devHelper.queue, frameStreamObjects1.frameNumber(), testLog);
deUint32 imageNdx2 = recordAndSubmitFrame(frameObjects2, renderer2, vkd, device, swapchain2.get(), swapchainImages2.size(), devHelper.queue, frameStreamObjects2.frameNumber(), testLog);
// Present both images at the same time with their corresponding ids.
const deUint64 presentIdsArr[] = { step.idWait1.presentId, step.idWait2.presentId };
const vk::VkPresentIdKHR presentId =
{
vk::VK_STRUCTURE_TYPE_PRESENT_ID_KHR, // VkStructureType sType;
nullptr, // const void* pNext;
static_cast<deUint32>(DE_LENGTH_OF_ARRAY(presentIdsArr)), // deUint32 swapchainCount;
presentIdsArr, // const deUint64* pPresentIds;
};
const vk::VkSemaphore semaphoreArr[] = { frameObjects1.renderCompleteSemaphore, frameObjects2.renderCompleteSemaphore };
const vk::VkSwapchainKHR swapchainArr[] = { swapchain1.get(), swapchain2.get() };
const deUint32 imgIndexArr[] = { imageNdx1, imageNdx2 };
const vk::VkPresentInfoKHR presentInfo =
{
vk::VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
&presentId,
static_cast<deUint32>(DE_LENGTH_OF_ARRAY(semaphoreArr)),
semaphoreArr,
static_cast<deUint32>(DE_LENGTH_OF_ARRAY(swapchainArr)),
swapchainArr,
imgIndexArr,
nullptr,
};
VK_CHECK(vkd.queuePresentKHR(devHelper.queue, &presentInfo));
const IdAndWait* idWaitArr[] = { &step.idWait1, &step.idWait2 };
for (int i = 0; i < DE_LENGTH_OF_ARRAY(idWaitArr); ++i)
{
if (idWaitArr[i]->wait)
VK_CHECK(vkd.waitForPresentKHR(device, swapchainArr[i], idWaitArr[i]->presentId, k10sec));
}
}
// Wait until device is idle.
VK_CHECK(vkd.deviceWaitIdle(device));
return tcu::TestStatus::pass("Pass");
}
catch (...)
{
// Make sure device is idle before destroying resources
vkd.deviceWaitIdle(device);
throw;
}
return tcu::TestStatus(QP_TEST_RESULT_INTERNAL_ERROR, "Reached unreachable code");
}
// Templated class for every instance type.
template <class T> // T is the test instance class.
class PresentIdWaitCase : public TestCase
{
public:
PresentIdWaitCase (vk::wsi::Type wsiType, tcu::TestContext& ctx, const std::string& name, const std::string& description);
virtual ~PresentIdWaitCase (void) {}
virtual void initPrograms (vk::SourceCollections& programCollection) const;
virtual TestInstance* createInstance (Context& context) const;
virtual void checkSupport (Context& context) const;
protected:
vk::wsi::Type m_wsiType;
};
template <class T>
PresentIdWaitCase<T>::PresentIdWaitCase (vk::wsi::Type wsiType, tcu::TestContext& ctx, const std::string& name, const std::string& description)
: TestCase(ctx, name, description), m_wsiType(wsiType)
{
}
template <class T>
void PresentIdWaitCase<T>::initPrograms (vk::SourceCollections& programCollection) const
{
vk::wsi::WsiTriangleRenderer::getPrograms(programCollection);
}
template <class T>
TestInstance* PresentIdWaitCase<T>::createInstance (Context& context) const
{
return new T(context, m_wsiType);
}
template <class T>
void PresentIdWaitCase<T>::checkSupport (Context& context) const
{
// Check instance extension support.
const auto instanceExtensions = getRequiredInstanceExtensions(m_wsiType);
for (const auto& ext : instanceExtensions)
{
if (!context.isInstanceFunctionalitySupported(ext))
TCU_THROW(NotSupportedError, ext + string(" is not supported"));
}
// Check device extension support.
const auto& vki = context.getInstanceInterface();
const auto physDev = context.getPhysicalDevice();
const auto supportedDeviceExts = vk::enumerateDeviceExtensionProperties(vki, physDev, nullptr);
const auto mandatoryDeviceExts = getMandatoryDeviceExtensions();
auto checkedDeviceExts = T::requiredDeviceExts();
for (const auto& ext : mandatoryDeviceExts)
checkedDeviceExts.push_back(ext);
for (const auto& ext : checkedDeviceExts)
{
if (!vk::isExtensionSupported(supportedDeviceExts, vk::RequiredExtension(ext)))
TCU_THROW(NotSupportedError, ext + string(" is not supported"));
}
}
void createPresentIdTests (tcu::TestCaseGroup* testGroup, vk::wsi::Type wsiType)
{
testGroup->addChild(new PresentIdWaitCase<PresentIdZeroInstance> (wsiType, testGroup->getTestContext(), "zero", "Use present id zero"));
testGroup->addChild(new PresentIdWaitCase<PresentIdIncreasingInstance> (wsiType, testGroup->getTestContext(), "increasing", "Use increasing present ids"));
testGroup->addChild(new PresentIdWaitCase<PresentIdInterleavedInstance> (wsiType, testGroup->getTestContext(), "interleaved", "Use increasing present ids interleaved with no ids"));
}
void createPresentWaitTests (tcu::TestCaseGroup* testGroup, vk::wsi::Type wsiType)
{
testGroup->addChild(new PresentIdWaitCase<PresentWaitSingleFrameInstance> (wsiType, testGroup->getTestContext(), "single_no_timeout", "Present single frame with no expected timeout"));
testGroup->addChild(new PresentIdWaitCase<PresentWaitPastFrameInstance> (wsiType, testGroup->getTestContext(), "past_no_timeout", "Wait for past frame with no expected timeout"));
testGroup->addChild(new PresentIdWaitCase<PresentWaitNoFramesInstance> (wsiType, testGroup->getTestContext(), "no_frames", "Expect timeout before submitting any frame"));
testGroup->addChild(new PresentIdWaitCase<PresentWaitNoFrameIdInstance> (wsiType, testGroup->getTestContext(), "no_frame_id", "Expect timeout after submitting frames with no id"));
testGroup->addChild(new PresentIdWaitCase<PresentWaitFutureFrameInstance> (wsiType, testGroup->getTestContext(), "future_frame", "Expect timeout when waiting for a future frame"));
testGroup->addChild(new PresentIdWaitCase<PresentWaitDualInstance> (wsiType, testGroup->getTestContext(), "two_swapchains", "Smoke test using two windows, surfaces and swapchains"));
}
} // anonymous
void createPresentIdWaitTests (tcu::TestCaseGroup* testGroup, vk::wsi::Type wsiType)
{
de::MovePtr<tcu::TestCaseGroup> idGroup (new tcu::TestCaseGroup(testGroup->getTestContext(), "id", "VK_KHR_present_id tests"));
de::MovePtr<tcu::TestCaseGroup> waitGroup (new tcu::TestCaseGroup(testGroup->getTestContext(), "wait", "VK_KHR_present_wait tests"));
createPresentIdTests (idGroup.get(), wsiType);
createPresentWaitTests (waitGroup.get(), wsiType);
testGroup->addChild(idGroup.release());
testGroup->addChild(waitGroup.release());
}
} // wsi
} // vkt
| 35.911151 | 299 | 0.711638 | twoerner |
f32f21450e4f81f7e68e7627fde0fdef2010e74d | 6,080 | hpp | C++ | Lib/Chip/CM7/STMicro/STM32H7x3/IWDG.hpp | operativeF/Kvasir | dfbcbdc9993d326ef8cc73d99129e78459c561fd | [
"Apache-2.0"
] | null | null | null | Lib/Chip/CM7/STMicro/STM32H7x3/IWDG.hpp | operativeF/Kvasir | dfbcbdc9993d326ef8cc73d99129e78459c561fd | [
"Apache-2.0"
] | null | null | null | Lib/Chip/CM7/STMicro/STM32H7x3/IWDG.hpp | operativeF/Kvasir | dfbcbdc9993d326ef8cc73d99129e78459c561fd | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <Register/Utility.hpp>
namespace Kvasir {
//IWDG
namespace IwdgIwdgKr{ ///<Key register
using Addr = Register::Address<0x58004800,0xffff0000,0x00000000,std::uint32_t>;
///Key value (write only, read 0x0000) These bits must be written by software at regular intervals with the key value 0xAAAA, otherwise the watchdog generates a reset when the counter reaches 0. Writing the key value 0x5555 to enable access to the IWDG_PR, IWDG_RLR and IWDG_WINR registers (see Section23.3.6: Register access protection) Writing the key value CCCCh starts the watchdog (except if the hardware watchdog option is selected)
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> key{};
}
namespace IwdgIwdgPr{ ///<Prescaler register
using Addr = Register::Address<0x58004804,0xfffffff8,0x00000000,std::uint32_t>;
///Prescaler divider These bits are write access protected see Section23.3.6: Register access protection. They are written by software to select the prescaler divider feeding the counter clock. PVU bit of IWDG_SR must be reset in order to be able to change the prescaler divider. Note: Reading this register returns the prescaler value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the PVU bit in the IWDG_SR register is reset.
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,0),Register::ReadWriteAccess,unsigned> pr{};
}
namespace IwdgIwdgRlr{ ///<Reload register
using Addr = Register::Address<0x58004808,0xfffff000,0x00000000,std::uint32_t>;
///Watchdog counter reload value These bits are write access protected see Section23.3.6. They are written by software to define the value to be loaded in the watchdog counter each time the value 0xAAAA is written in the IWDG_KR register. The watchdog counter counts down from this value. The timeout period is a function of this value and the clock prescaler. Refer to the datasheet for the timeout information. The RVU bit in the IWDG_SR register must be reset in order to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing on this register. For this reason the value read from this register is valid only when the RVU bit in the IWDG_SR register is reset.
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> rl{};
}
namespace IwdgIwdgSr{ ///<Status register
using Addr = Register::Address<0x5800480c,0xfffffff8,0x00000000,std::uint32_t>;
///Watchdog prescaler value update This bit is set by hardware to indicate that an update of the prescaler value is ongoing. It is reset by hardware when the prescaler update operation is completed in the VDD voltage domain (takes up to 5 RC 40 kHz cycles). Prescaler value can be updated only when PVU bit is reset.
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> pvu{};
///Watchdog counter reload value update This bit is set by hardware to indicate that an update of the reload value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to 5 RC 40 kHz cycles). Reload value can be updated only when RVU bit is reset.
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> rvu{};
///Watchdog counter window value update This bit is set by hardware to indicate that an update of the window value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to 5 RC 40 kHz cycles). Window value can be updated only when WVU bit is reset. This bit is generated only if generic window = 1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> wvu{};
}
namespace IwdgIwdgWinr{ ///<Window register
using Addr = Register::Address<0x58004810,0xfffff000,0x00000000,std::uint32_t>;
///Watchdog counter window value These bits are write access protected see Section23.3.6. These bits contain the high limit of the window value to be compared to the downcounter. To prevent a reset, the downcounter must be reloaded when its value is lower than the window register value and greater than 0x0 The WVU bit in the IWDG_SR register must be reset in order to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the WVU bit in the IWDG_SR register is reset.
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,0),Register::ReadWriteAccess,unsigned> win{};
}
}
| 173.714286 | 1,029 | 0.657072 | operativeF |
f32f6a1b88639795a21a9acb6f1b81aba5657f8f | 9,429 | cc | C++ | content/browser/renderer_host/font_utils_linux.cc | metux/chromium-deb | 3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2021-05-24T13:52:28.000Z | 2021-05-24T13:53:10.000Z | content/browser/renderer_host/font_utils_linux.cc | metux/chromium-deb | 3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | content/browser/renderer_host/font_utils_linux.cc | metux/chromium-deb | 3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 3 | 2018-03-12T07:58:10.000Z | 2019-08-31T04:53:58.000Z | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <fcntl.h>
#include <fontconfig/fontconfig.h>
#include <stddef.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string>
#include "base/posix/eintr_wrapper.h"
// TODO(crbug/685022): Guard the inclusion of ppapi headers with
// BUILDFLAG(ENABLE_PLUGINS).
#include "ppapi/c/private/pp_private_font_charset.h" // nogncheck
#include "ppapi/c/trusted/ppb_browser_font_trusted.h" // nogncheck
namespace {
// MSCharSetToFontconfig translates a Microsoft charset identifier to a
// fontconfig language set by appending to |langset|.
// Returns true if |langset| is Latin/Greek/Cyrillic.
bool MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) {
// We have need to translate raw fdwCharSet values into terms that
// fontconfig can understand. (See the description of fdwCharSet in the MSDN
// documentation for CreateFont:
// http://msdn.microsoft.com/en-us/library/dd183499(VS.85).aspx )
//
// Although the argument is /called/ 'charset', the actual values conflate
// character sets (which are sets of Unicode code points) and character
// encodings (which are algorithms for turning a series of bits into a
// series of code points.) Sometimes the values will name a language,
// sometimes they'll name an encoding. In the latter case I'm assuming that
// they mean the set of code points in the domain of that encoding.
//
// fontconfig deals with ISO 639-1 language codes:
// http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
//
// So, for each of the documented fdwCharSet values I've had to take a
// guess at the set of ISO 639-1 languages intended.
bool is_lgc = false;
switch (fdwCharSet) {
case PP_PRIVATEFONTCHARSET_ANSI:
// These values I don't really know what to do with, so I'm going to map
// them to English also.
case PP_PRIVATEFONTCHARSET_DEFAULT:
case PP_PRIVATEFONTCHARSET_MAC:
case PP_PRIVATEFONTCHARSET_OEM:
case PP_PRIVATEFONTCHARSET_SYMBOL:
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("en"));
break;
case PP_PRIVATEFONTCHARSET_BALTIC:
// The three baltic languages.
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("et"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("lv"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("lt"));
break;
case PP_PRIVATEFONTCHARSET_CHINESEBIG5:
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("zh-tw"));
break;
case PP_PRIVATEFONTCHARSET_GB2312:
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("zh-cn"));
break;
case PP_PRIVATEFONTCHARSET_EASTEUROPE:
// A scattering of eastern European languages.
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("pl"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("cs"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("sk"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("hu"));
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("hr"));
break;
case PP_PRIVATEFONTCHARSET_GREEK:
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("el"));
break;
case PP_PRIVATEFONTCHARSET_HANGUL:
case PP_PRIVATEFONTCHARSET_JOHAB:
// Korean
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("ko"));
break;
case PP_PRIVATEFONTCHARSET_RUSSIAN:
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("ru"));
break;
case PP_PRIVATEFONTCHARSET_SHIFTJIS:
// Japanese
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("ja"));
break;
case PP_PRIVATEFONTCHARSET_TURKISH:
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("tr"));
break;
case PP_PRIVATEFONTCHARSET_VIETNAMESE:
is_lgc = true;
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("vi"));
break;
case PP_PRIVATEFONTCHARSET_ARABIC:
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("ar"));
break;
case PP_PRIVATEFONTCHARSET_HEBREW:
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("he"));
break;
case PP_PRIVATEFONTCHARSET_THAI:
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("th"));
break;
// default:
// Don't add any languages in that case that we don't recognise the
// constant.
}
return is_lgc;
}
} // namespace
namespace content {
int MatchFontFaceWithFallback(const std::string& face,
bool is_bold,
bool is_italic,
uint32_t charset,
uint32_t fallback_family) {
FcLangSet* langset = FcLangSetCreate();
bool is_lgc = MSCharSetToFontconfig(langset, charset);
FcPattern* pattern = FcPatternCreate();
FcPatternAddString(
pattern, FC_FAMILY, reinterpret_cast<const FcChar8*>(face.c_str()));
// TODO(thestig) Check if we can access Chrome's per-script font preference
// here and select better default fonts for non-LGC case.
std::string generic_font_name;
if (is_lgc) {
switch (fallback_family) {
case PP_BROWSERFONT_TRUSTED_FAMILY_SERIF:
generic_font_name = "Times New Roman";
break;
case PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF:
generic_font_name = "Arial";
break;
case PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE:
generic_font_name = "Courier New";
break;
}
}
if (!generic_font_name.empty()) {
const FcChar8* fc_generic_font_name =
reinterpret_cast<const FcChar8*>(generic_font_name.c_str());
FcPatternAddString(pattern, FC_FAMILY, fc_generic_font_name);
}
if (is_bold)
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
if (is_italic)
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
FcPatternAddLangSet(pattern, FC_LANG, langset);
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcFontSet* font_set = FcFontSort(0, pattern, 0, 0, &result);
int font_fd = -1;
int good_enough_index = -1;
bool good_enough_index_set = false;
if (font_set) {
for (int i = 0; i < font_set->nfont; ++i) {
FcPattern* current = font_set->fonts[i];
// Older versions of fontconfig have a bug where they cannot select
// only scalable fonts so we have to manually filter the results.
FcBool is_scalable;
if (FcPatternGetBool(current, FC_SCALABLE, 0, &is_scalable) !=
FcResultMatch ||
!is_scalable) {
continue;
}
FcChar8* c_filename;
if (FcPatternGetString(current, FC_FILE, 0, &c_filename) !=
FcResultMatch) {
continue;
}
// We only want to return sfnt (TrueType) based fonts. We don't have a
// very good way of detecting this so we'll filter based on the
// filename.
bool is_sfnt = false;
static const char kSFNTExtensions[][5] = {".ttf", ".otc", ".TTF", ".ttc",
""};
const size_t filename_len = strlen(reinterpret_cast<char*>(c_filename));
for (unsigned j = 0;; j++) {
if (kSFNTExtensions[j][0] == 0) {
// None of the extensions matched.
break;
}
const size_t ext_len = strlen(kSFNTExtensions[j]);
if (filename_len > ext_len &&
memcmp(c_filename + filename_len - ext_len,
kSFNTExtensions[j],
ext_len) == 0) {
is_sfnt = true;
break;
}
}
if (!is_sfnt)
continue;
// This font is good enough to pass muster, but we might be able to do
// better with subsequent ones.
if (!good_enough_index_set) {
good_enough_index = i;
good_enough_index_set = true;
}
FcValue matrix;
bool have_matrix = FcPatternGet(current, FC_MATRIX, 0, &matrix) == 0;
if (is_italic && have_matrix) {
// we asked for an italic font, but fontconfig is giving us a
// non-italic font with a transformation matrix.
continue;
}
FcValue embolden;
const bool have_embolden =
FcPatternGet(current, FC_EMBOLDEN, 0, &embolden) == 0;
if (is_bold && have_embolden) {
// we asked for a bold font, but fontconfig gave us a non-bold font
// and asked us to apply fake bolding.
continue;
}
font_fd =
HANDLE_EINTR(open(reinterpret_cast<char*>(c_filename), O_RDONLY));
if (font_fd >= 0)
break;
}
}
if (font_fd == -1 && good_enough_index_set) {
// We didn't find a font that we liked, so we fallback to something
// acceptable.
FcPattern* current = font_set->fonts[good_enough_index];
FcChar8* c_filename;
FcPatternGetString(current, FC_FILE, 0, &c_filename);
font_fd = HANDLE_EINTR(open(reinterpret_cast<char*>(c_filename), O_RDONLY));
}
if (font_set)
FcFontSetDestroy(font_set);
FcPatternDestroy(pattern);
return font_fd;
}
} // namespace content
| 35.447368 | 80 | 0.667091 | metux |
f3316659c5ed86abe7cf0809057ca8e9f234857a | 3,364 | cpp | C++ | MyFirstGame/map/TileSet.cpp | NullBy7e/MyFIrstGame | 487596cfc52c5a943585fa874cd9ccd33cd92cc9 | [
"MIT"
] | 1 | 2019-04-24T16:12:46.000Z | 2019-04-24T16:12:46.000Z | MyFirstGame/map/TileSet.cpp | NullBy7e/MyFIrstGame | 487596cfc52c5a943585fa874cd9ccd33cd92cc9 | [
"MIT"
] | null | null | null | MyFirstGame/map/TileSet.cpp | NullBy7e/MyFIrstGame | 487596cfc52c5a943585fa874cd9ccd33cd92cc9 | [
"MIT"
] | null | null | null | #include "TileSet.hpp"
#include <SFML/System/Vector2.hpp>
#include <iostream>
#include <filesystem>
#include <fstream>
#include <sstream>
#include <functional>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "../Logger.hpp"
TileSet::TileSet(const std::string& name, const std::string& path, const sf::Vector2u tilesize)
{
std::stringstream ss;
ss << "Loading tileset " << "\"" << name << "\"" << ":" << "\"" << path << "\"";
logger::info << "Loading tileset " << "\"" << name << "\"" << ":" << "\"" << path << "\"";
if(!texture_.loadFromFile(path))
{
std::cerr << "The tileset failed to load due to missing assets, please reinstall the game." << std::endl;
return;
}
// read the meta file
const auto meta_file_path = std::filesystem::path(path).parent_path().generic_string() + "/" + std::filesystem::
path(path).filename().replace_extension("meta").generic_string();
if (!load_meta_file(meta_file_path))
{
std::cerr << "The tileset failed to load due to missing assets, please reinstall the game." << std::endl;
return;
}
// slice up the image into multiple sf::Texture
const auto cols = texture_.getSize().x / tilesize.x;
const auto rows = texture_.getSize().y / tilesize.y;
// each col + row combination contains a sprite
for (auto col = 0u; col < cols; ++col)
{
for (auto row = 0u; row < rows; ++row)
{
// the xy location of the sprite in the image
const auto x_pos = col * tilesize.x;
const auto y_pos = row * tilesize.y;
const auto sprite_index = sprites_.empty() ? 1 : sprites_.size() + 1;
sprites_[sprite_index] = sf::Sprite(texture_, { static_cast<int>(x_pos), static_cast<int>(y_pos), static_cast<int>(tilesize.x), static_cast<int>(tilesize.y) });;
}
}
}
std::map<int, sf::Sprite>& TileSet::get_sprites()
{
return sprites_;
}
sf::Sprite TileSet::get_sprite(const int sprite_index)
{
return sprites_[sprite_index];
}
bool TileSet::load_meta_file(const std::string& meta_file_path)
{
std::cout << "Loading meta file: " << meta_file_path << std::endl;
if (!std::filesystem::exists(meta_file_path))
return false;
std::ifstream meta_file(meta_file_path);
if (meta_file.fail())
{
meta_file.close();
return false;
}
std::string line;
while (std::getline(meta_file, line))
{
if (line.empty())
continue;
//key and value
auto str_split = split(line, ':');
auto key = str_split[0];
auto val = str_split[1];
if (key == "tileset_name")
{
name_ = val;
}
if (key == "tileset_desc")
{
desc_ = val;
}
if (key == "tileset_stid")
{
stid_ = std::stoi(val);
}
if (key == "tileset_size")
{
auto size_split = split(val, 'x');
size_ = sf::Vector2u(std::stoi(size_split[0]), std::stoi(size_split[1]));
}
}
meta_file.close();
return true;
}
std::vector<std::string> TileSet::split(std::string& str_to_split, const char delimiter) const
{
std::stringstream ss(str_to_split);
std::string item;
std::vector<std::string> result;
while (std::getline(ss, item, delimiter))
{
item.erase(std::remove_if(item.begin(), item.end(),
[](const char c)
{
return !(std::isspace(c, {}) || std::isalnum(c, {}) || c == '_');
}),
item.end());
result.push_back(item);
}
return result;
}
| 25.104478 | 164 | 0.62396 | NullBy7e |
f3325937ea46cade47c63620d6e195f9736264c2 | 4,185 | cpp | C++ | src/param_json_editor.cpp | billyfish/grassroots-client-qt-desktop | daa3b8f2bb70c759ef037270b9f5d36643060a39 | [
"Apache-2.0"
] | 1 | 2018-01-08T09:06:23.000Z | 2018-01-08T09:06:23.000Z | src/param_json_editor.cpp | TGAC/grassroots-client-qt-desktop | 39c559ff00d7386da3d6477c1b83a4705c1ca1dc | [
"Apache-2.0"
] | null | null | null | src/param_json_editor.cpp | TGAC/grassroots-client-qt-desktop | 39c559ff00d7386da3d6477c1b83a4705c1ca1dc | [
"Apache-2.0"
] | null | null | null | /*
** Copyright 2014-2016 The Earlham Institute
**
** 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 <QDebug>
#include <QDialog>
#include "param_json_editor.h"
#include "jansson.h"
#include "json_util.h"
#include "string_utils.h"
#include "qt_client_data.h"
DroppableJSONBox :: DroppableJSONBox (QTParameterWidget *parent_p)
: DroppableTextBox (parent_p)
{}
bool DroppableJSONBox :: SetFromText (const char * const data_s)
{
bool success_flag = false;
json_error_t error;
json_t *data_p = json_loads (data_s, 0, &error);
if (data_p)
{
clear ();
insertPlainText (data_s);
success_flag = true;
json_decref (data_p);
}
return success_flag;
}
bool DroppableJSONBox :: SetFromJSON (const json_t * const value_p)
{
bool success_flag = false;
if (json_is_null (value_p))
{
clear ();
success_flag = true;
}
else
{
char *data_s = json_dumps (value_p, 0);
clear ();
if (data_s)
{
insertPlainText (data_s);
success_flag = true;
free (data_s);
}
}
return success_flag;
}
ParamJSONEditor :: ParamJSONEditor (JSONParameter * const param_p, QTParameterWidget * const parent_p)
: BaseParamWidget (& (param_p -> jp_base_param), parent_p)
{
pje_param_p = param_p;
pje_text_box_p = new DroppableJSONBox (parent_p);
}
bool ParamJSONEditor :: CreateDroppableTextBox (QTParameterWidget *parent_p)
{
pje_text_box_p = new DroppableJSONBox (parent_p);
return true;
}
ParamJSONEditor :: ~ParamJSONEditor ()
{
}
QWidget *ParamJSONEditor :: GetQWidget ()
{
return pje_text_box_p;
}
void ParamJSONEditor :: SetDefaultValue ()
{
const json_t *value_p = GetJSONParameterDefaultValue (pje_param_p );
if (!IsJSONEmpty (value_p))
{
char *value_s = json_dumps (value_p, JSON_INDENT (2) | JSON_PRESERVE_ORDER);
if (value_s)
{
pje_text_box_p -> setPlainText (value_s);
free (value_s);
}
}
}
bool ParamJSONEditor :: StoreParameterValue (bool refresh_flag)
{
bool success_flag = false;
QString s = pje_text_box_p -> toPlainText ();
QByteArray ba = s.toLocal8Bit ();
const char *value_s = ba.constData ();
if (!IsStringEmpty (value_s))
{
json_error_t error;
json_t *data_p = json_loads (value_s, 0, &error);
if (data_p)
{
success_flag = SetJSONParameterCurrentValue (pje_param_p, data_p);
json_decref (data_p);
}
else
{
success_flag = SetJSONParameterCurrentValue (pje_param_p, nullptr);
}
}
else
{
success_flag = SetJSONParameterCurrentValue (pje_param_p, nullptr);
}
if (bpw_parent_p -> GetClientData () -> qcd_verbose_flag)
{
qDebug () << "Setting " << bpw_param_p -> pa_name_s << " to " << value_s << " " << success_flag;
}
if (!success_flag)
{
}
return success_flag;
}
bool ParamJSONEditor :: SetValueFromText (const char *value_s)
{
return pje_text_box_p -> SetFromText (value_s);
}
bool ParamJSONEditor :: SetValueFromJSON (const json_t * const param_value_p)
{
bool success_flag = false;
// const json_t *param_value_p = json_object_get (value_p, PARAM_CURRENT_VALUE_S);
if ((!param_value_p) || (json_is_null (param_value_p)))
{
PrintLog (STM_LEVEL_INFO, __FILE__, __LINE__, "ParamJSONEditor :: SetValueFromJSON on widget \"%s\" with NULL\n", GetParameterName ());
success_flag = (static_cast <DroppableJSONBox *> (pje_text_box_p)) -> SetFromJSON (json_null ());
}
else
{
PrintJSONToLog (STM_LEVEL_INFO, __FILE__, __LINE__, param_value_p, "ParamJSONEditor :: SetValueFromJSON on widget \"%s\"\n", GetParameterName ());
success_flag = (static_cast <DroppableJSONBox *> (pje_text_box_p)) -> SetFromJSON (param_value_p);
}
return success_flag;
}
| 21.352041 | 149 | 0.702748 | billyfish |
f334313f095636754c2c8f696efec44b2deb58c2 | 3,030 | cpp | C++ | SCSGA/coalitional_values_generator_NRD.cpp | Friduric/scsga-aaai21 | 58030865964c6bc44b12f2acc40970bdbed25874 | [
"MIT"
] | 1 | 2021-06-21T06:22:34.000Z | 2021-06-21T06:22:34.000Z | SCSGA/coalitional_values_generator_NRD.cpp | Friduric/scsga-aaai21 | 58030865964c6bc44b12f2acc40970bdbed25874 | [
"MIT"
] | null | null | null | SCSGA/coalitional_values_generator_NRD.cpp | Friduric/scsga-aaai21 | 58030865964c6bc44b12f2acc40970bdbed25874 | [
"MIT"
] | null | null | null | #include "coalitional_values_generator_NRD.h"
#include "utility.h"
#include <cassert>
coalitional_values_generator_NRD::coalitional_values_generator_NRD() :
nrd_generator(coalition::value_t(0), coalition::value_t(0.1)), AgentToAgentToTaskSkillLevel{}
{
}
void coalitional_values_generator_NRD::reset
(
uint32_t n_agents,
uint32_t n_tasks,
int seed
)
{
if (seed >= 0)
generator.seed(seed); // Used to generate samples.
// Generate "relational utility" for each agent-to-task assignment.
AgentToAgentToTaskSkillLevel = std::vector < std::vector<std::vector<coalition::value_t>>>
(n_agents, std::vector < std::vector<coalition::value_t>>(n_agents, std::vector<coalition::value_t >(n_tasks, 0.0)));
for (uint32_t n_agent_index_i = 0; n_agent_index_i < n_agents; ++n_agent_index_i)
for (uint32_t n_agent_index_j = n_agent_index_i + 1; n_agent_index_j < n_agents; ++n_agent_index_j)
for (uint32_t n_task_index = 0; n_task_index < n_tasks; ++n_task_index)
{
auto& relational_utility_ij = AgentToAgentToTaskSkillLevel[n_agent_index_i][n_agent_index_j][n_task_index];
auto& relational_utility_ji = AgentToAgentToTaskSkillLevel[n_agent_index_j][n_agent_index_i][n_task_index];
relational_utility_ij = relational_utility_ji = nrd_generator(generator);
}
// TODO See if this can be integrated with the new coalitional values generation.
// Generate a vector for each coalition mask that represents the agents in that coalition mask
// (decreases time complexity of generating values)
/*
std::vector<std::vector<uint32_t>> CoalitionToAgentIndices(n_number_of_possible_coalitions, std::vector<uint32_t>());
for (uint32_t n_coalition_mask = 0ULL; n_coalition_mask < n_number_of_possible_coalitions; ++n_coalition_mask)
for (uint32_t n_agent_index = 0; n_agent_index < 32; ++n_agent_index)
if (((1 << n_agent_index) & n_coalition_mask) != 0) // Is agent in coalition?
CoalitionToAgentIndices[n_coalition_mask].push_back(n_agent_index);
*/
}
coalition::value_t coalitional_values_generator_NRD::get_value_of(
const coalition::coalition_t& coalition,
const uint32_t n_task
)
{
if (n_agents <= 32)
{
return coalitional_values_generator::get_value_of(coalition, n_task);
}
else
{
return generate_new_value(coalition, n_task);
}
}
coalition::value_t coalitional_values_generator_NRD::generate_new_value(
const coalition::coalition_t& coalition,
const uint32_t task
)
{
coalition::value_t value{};
const std::vector<uint32_t> agents{ coalition.get_all_agents() };
auto it_1 = agents.cbegin();
while (it_1 != agents.cend())
{
auto it_2 = it_1 + 1;
while (it_2 != agents.cend())
{
value += AgentToAgentToTaskSkillLevel[*it_1][*it_2][task];
++it_2;
}
++it_1;
}
return value;
}
std::string coalitional_values_generator_NRD::get_file_name() const
{
return "NRD_" + std::to_string(seed) + "_" + std::to_string(n_agents) + "_" + std::to_string(n_tasks) + ".problem";
} | 36.071429 | 120 | 0.732673 | Friduric |
f33576684a053e5c042c5de540423ddd1cf1c2ca | 960 | hpp | C++ | release/include/mlclient/internals/Conversions.hpp | adamfowleruk/mlcplusplus | bd8b47b8e92c7f66a22ecfe98353f3e8a621802d | [
"Apache-2.0"
] | 4 | 2016-04-21T06:27:40.000Z | 2017-01-20T12:10:54.000Z | release/include/mlclient/internals/Conversions.hpp | marklogic/mlcplusplus | bd8b47b8e92c7f66a22ecfe98353f3e8a621802d | [
"Apache-2.0"
] | 239 | 2015-11-26T23:10:33.000Z | 2017-01-03T23:48:23.000Z | release/include/mlclient/internals/Conversions.hpp | adamfowleruk/mlcplusplus | bd8b47b8e92c7f66a22ecfe98353f3e8a621802d | [
"Apache-2.0"
] | 3 | 2016-05-13T10:00:01.000Z | 2017-01-20T12:15:20.000Z | /*
* Copyright (c) MarkLogic Corporation. 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.
*/
/**
* \file Conversions.hpp
* \author Adam Fowler <adam.fowler@marklogic.com>
* \date 2016-06-20
* \since 8.0.2
*/
#pragma once
#ifndef INTERNALS_CONVERSIONS
#define INTERNALS_CONVERSIONS
//std::ostream& operator << (std::ostream& os, const web::json::value& rt);
#endif /* INTERNALS_CONVERSIONS */
| 29.090909 | 76 | 0.70625 | adamfowleruk |
f3359f4ed8018b23113970a5044bfc0cb87181e9 | 3,259 | cpp | C++ | OpenGl/src/shadowMapping/shadowMappingDepth.cpp | luckmoney/Cocos2dx | 909a23852b226b28f7d910e7eecc2d451884ad57 | [
"Apache-2.0"
] | 1 | 2020-01-25T14:57:32.000Z | 2020-01-25T14:57:32.000Z | OpenGl/src/shadowMapping/shadowMappingDepth.cpp | luckmoney/Cocos2dx | 909a23852b226b28f7d910e7eecc2d451884ad57 | [
"Apache-2.0"
] | null | null | null | OpenGl/src/shadowMapping/shadowMappingDepth.cpp | luckmoney/Cocos2dx | 909a23852b226b28f7d910e7eecc2d451884ad57 | [
"Apache-2.0"
] | null | null | null |
#include "shadowMapping/shadowMappingDepth.h"
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
ShadowMappingDepth::~ShadowMappingDepth()
{
}
void ShadowMappingDepth::Init()
{
glEnable(GL_DEPTH_TEST);
m_depthShader = new Shader("../Cocos2dx/src/shadowMapping/shadow_mapping_depth.vs",
"../Cocos2dx/src/shadowMapping/shadow_mapping_depth.fs");
m_depthQuad = new Shader("../Cocos2dx/src/shadowMapping/debug_quad.vs",
"../Cocos2dx/src/shadowMapping/debug_quad.fs");
m_woodTexture = loadTexture("../Cocos2dx/res/wood.png");
lightPos = glm::vec3(-2.0f, 4.0f, -1.0f);
glGenFramebuffers(1, &m_depthMapFBO);
glGenTextures(1, &m_depthMap);
glBindTexture(GL_TEXTURE_2D, m_depthMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBindFramebuffer(GL_FRAMEBUFFER, m_depthMapFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthMap, 0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
m_depthQuad->use();
m_depthQuad->setInt("depthMap", 0);
}
void ShadowMappingDepth::Render(Camera *camera)
{
glm::mat4 lightProjection, lightView;
glm::mat4 lightSpaceMatrix;
float near_plane = -1.0f, far_plane = 7.5f;
lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));
lightSpaceMatrix = lightProjection * lightView;
m_depthShader->use();
m_depthShader->setMat4("lightSpaceMatrix", lightSpaceMatrix);
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
glBindFramebuffer(GL_FRAMEBUFFER, m_depthMapFBO);
glClear(GL_DEPTH_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_woodTexture);
renderScene(m_depthShader);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.1f,0.1f,0.1f,1.0);
m_depthQuad->use();
m_depthQuad->setFloat("near_plane", near_plane);
m_depthQuad->setFloat("far_plane", far_plane);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_depthMap);
renderQuad();
}
void ShadowMappingDepth::renderScene(Shader* shader) {
glm::mat4 model = glm::mat4(1.0f);
shader->setMat4("model", model);
renderPlane();
model = glm::mat4(1.0f);
model = glm::translate(model, glm::vec3(0.0f,1.5f,0.0));
model = glm::scale(model, glm::vec3(0.5f));
shader->setMat4("model", model);
renderCube();
model = glm::mat4(1.0f);
model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));
model = glm::scale(model, glm::vec3(0.5f));
shader->setMat4("model", model);
renderCube();
model = glm::mat4(1.0f);
model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));
model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));
model = glm::scale(model, glm::vec3(0.25));
shader->setMat4("model", model);
renderCube();
}
| 27.618644 | 120 | 0.742252 | luckmoney |
f33779290df54ca16cff666e281aba7f74ad4937 | 14,328 | tcc | C++ | source/adios2/toolkit/format/bp/BPSerializer.tcc | gregorweiss/ADIOS2 | 25f91bb256ff004fccbe128dd9b0c584c3c674b3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | source/adios2/toolkit/format/bp/BPSerializer.tcc | gregorweiss/ADIOS2 | 25f91bb256ff004fccbe128dd9b0c584c3c674b3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | source/adios2/toolkit/format/bp/BPSerializer.tcc | gregorweiss/ADIOS2 | 25f91bb256ff004fccbe128dd9b0c584c3c674b3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | /*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* BPSerializer.tcc
*
* Created on: Sep 16, 2019
* Author: William F Godoy godoywf@ornl.gov
*/
#ifndef ADIOS2_TOOLKIT_FORMAT_BP_BPSERIALIZER_TCC_
#define ADIOS2_TOOLKIT_FORMAT_BP_BPSERIALIZER_TCC_
#include "BPSerializer.h"
namespace adios2
{
namespace format
{
template <class T>
inline void BPSerializer::PutAttributeCharacteristicValueInIndex(
uint8_t &characteristicsCounter, const core::Attribute<T> &attribute,
std::vector<char> &buffer) noexcept
{
const uint8_t characteristicID = CharacteristicID::characteristic_value;
helper::InsertToBuffer(buffer, &characteristicID);
if (attribute.m_IsSingleValue) // single value
{
helper::InsertToBuffer(buffer, &attribute.m_DataSingleValue);
}
else // array
{
helper::InsertToBuffer(buffer, attribute.m_DataArray.data(),
attribute.m_Elements);
}
++characteristicsCounter;
}
template <class T>
void BPSerializer::PutCharacteristicRecord(const uint8_t characteristicID,
uint8_t &characteristicsCounter,
const T &value,
std::vector<char> &buffer) noexcept
{
const uint8_t id = characteristicID;
helper::InsertToBuffer(buffer, &id);
helper::InsertToBuffer(buffer, &value);
++characteristicsCounter;
}
template <class T>
void BPSerializer::PutCharacteristicRecord(const uint8_t characteristicID,
uint8_t &characteristicsCounter,
const T &value,
std::vector<char> &buffer,
size_t &position) noexcept
{
const uint8_t id = characteristicID;
helper::CopyToBuffer(buffer, position, &id);
helper::CopyToBuffer(buffer, position, &value);
++characteristicsCounter;
}
template <class T>
inline void BPSerializer::PutPayloadInBuffer(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
const bool sourceRowMajor) noexcept
{
const size_t blockSize = helper::GetTotalSize(blockInfo.Count);
m_Profiler.Start("memcpy");
#ifdef ADIOS2_HAVE_CUDA
if (blockInfo.IsGPU)
{
helper::CopyFromGPUToBuffer(m_Data.m_Buffer, m_Data.m_Position,
blockInfo.Data, blockSize);
m_Profiler.Stop("memcpy");
m_Data.m_AbsolutePosition += blockSize * sizeof(T);
return;
}
#endif
if (!blockInfo.MemoryStart.empty())
{
helper::CopyMemoryBlock(
reinterpret_cast<T *>(m_Data.m_Buffer.data() + m_Data.m_Position),
blockInfo.Start, blockInfo.Count, sourceRowMajor, blockInfo.Data,
blockInfo.Start, blockInfo.Count, sourceRowMajor, false, Dims(),
Dims(), blockInfo.MemoryStart, blockInfo.MemoryCount);
m_Data.m_Position += blockSize * sizeof(T);
}
else
{
helper::CopyToBufferThreads(m_Data.m_Buffer, m_Data.m_Position,
blockInfo.Data, blockSize,
m_Parameters.Threads);
}
m_Profiler.Stop("memcpy");
m_Data.m_AbsolutePosition += blockSize * sizeof(T); // payload size
}
// PRIVATE
template <class T>
void BPSerializer::UpdateIndexOffsetsCharacteristics(size_t ¤tPosition,
const DataTypes dataType,
std::vector<char> &buffer)
{
const bool isLittleEndian = helper::IsLittleEndian();
helper::ReadValue<uint8_t>(buffer, currentPosition, isLittleEndian);
const uint32_t characteristicsLength =
helper::ReadValue<uint32_t>(buffer, currentPosition, isLittleEndian);
const size_t endPosition =
currentPosition + static_cast<size_t>(characteristicsLength);
size_t dimensionsSize = 0; // get it from dimensions characteristics
while (currentPosition < endPosition)
{
const uint8_t id =
helper::ReadValue<uint8_t>(buffer, currentPosition, isLittleEndian);
switch (id)
{
case (characteristic_time_index):
{
currentPosition += sizeof(uint32_t);
break;
}
case (characteristic_file_index):
{
currentPosition += sizeof(uint32_t);
break;
}
case (characteristic_value):
{
if (dataType == type_string)
{
// first get the length of the string
const size_t length = static_cast<size_t>(
helper::ReadValue<uint16_t>(buffer, currentPosition,
isLittleEndian));
currentPosition += length;
}
// using this function only for variables
// TODO string array if string arrays are supported in the future
else
{
currentPosition += sizeof(T);
}
break;
}
case (characteristic_min):
{
currentPosition += sizeof(T);
break;
}
case (characteristic_max):
{
currentPosition += sizeof(T);
break;
}
case (characteristic_minmax):
{
// first get the number of subblocks
const uint16_t M =
helper::ReadValue<uint16_t>(buffer, currentPosition);
currentPosition += 2 * sizeof(T); // block min/max
if (M > 1)
{
currentPosition += 1 + 8; // method (byte), blockSize (uint64_t)
currentPosition +=
dimensionsSize * sizeof(uint16_t); // N-dim division
currentPosition += 2 * M * sizeof(T); // M * min/max
}
break;
}
case (characteristic_offset):
{
const uint64_t currentOffset = helper::ReadValue<uint64_t>(
buffer, currentPosition, isLittleEndian);
const uint64_t updatedOffset =
currentOffset +
static_cast<uint64_t>(m_Data.m_AbsolutePosition);
currentPosition -= sizeof(uint64_t);
helper::CopyToBuffer(buffer, currentPosition, &updatedOffset);
break;
}
case (characteristic_payload_offset):
{
const uint64_t currentPayloadOffset = helper::ReadValue<uint64_t>(
buffer, currentPosition, isLittleEndian);
const uint64_t updatedPayloadOffset =
currentPayloadOffset +
static_cast<uint64_t>(m_Data.m_AbsolutePosition);
currentPosition -= sizeof(uint64_t);
helper::CopyToBuffer(buffer, currentPosition,
&updatedPayloadOffset);
break;
}
case (characteristic_dimensions):
{
dimensionsSize = static_cast<size_t>(helper::ReadValue<uint8_t>(
buffer, currentPosition, isLittleEndian));
currentPosition +=
3 * sizeof(uint64_t) * dimensionsSize + 2; // 2 is for length
break;
}
case (characteristic_transform_type):
{
const size_t typeLength =
static_cast<size_t>(helper::ReadValue<uint8_t>(
buffer, currentPosition, isLittleEndian));
// skip over operator name (transform type) string
currentPosition += typeLength;
// skip over pre-data type (1) and dimensionsSize (1)
currentPosition += 2;
const uint16_t dimensionsLength = helper::ReadValue<uint16_t>(
buffer, currentPosition, isLittleEndian);
// skip over dimensions
currentPosition += dimensionsLength;
const size_t metadataLength =
static_cast<size_t>(helper::ReadValue<uint16_t>(
buffer, currentPosition, isLittleEndian));
// skip over operator metadata
currentPosition += metadataLength;
break;
}
default:
{
throw std::invalid_argument(
"ERROR: characteristic ID " + std::to_string(id) +
" not supported when updating offsets\n");
}
} // end id switch
} // end while
}
template <class T>
inline size_t
BPSerializer::GetAttributeSizeInData(const core::Attribute<T> &attribute) const
noexcept
{
size_t size = 14 + attribute.m_Name.size() + 10;
size += 4 + sizeof(T) * attribute.m_Elements;
return size;
}
template <class T>
void BPSerializer::PutAttributeInData(const core::Attribute<T> &attribute,
Stats<T> &stats) noexcept
{
DoPutAttributeInData(attribute, stats);
}
template <class T>
void BPSerializer::PutAttributeInIndex(const core::Attribute<T> &attribute,
const Stats<T> &stats) noexcept
{
SerialElementIndex index(stats.MemberID);
auto &buffer = index.Buffer;
// index.Valid = true; // when the attribute is put, set this flag to true
size_t indexLengthPosition = buffer.size();
buffer.insert(buffer.end(), 4, '\0'); // skip attribute length (4)
helper::InsertToBuffer(buffer, &stats.MemberID);
buffer.insert(buffer.end(), 2, '\0'); // skip group name
PutNameRecord(attribute.m_Name, buffer);
buffer.insert(buffer.end(), 2, '\0'); // skip path
uint8_t dataType = TypeTraits<T>::type_enum; // dataType
if (dataType == type_string && !attribute.m_IsSingleValue)
{
dataType = type_string_array;
}
helper::InsertToBuffer(buffer, &dataType);
// Characteristics Sets Count in Metadata
index.Count = 1;
helper::InsertToBuffer(buffer, &index.Count);
// START OF CHARACTERISTICS
const size_t characteristicsCountPosition = buffer.size();
// skip characteristics count(1) + length (4)
buffer.insert(buffer.end(), 5, '\0');
uint8_t characteristicsCounter = 0;
// DIMENSIONS
PutCharacteristicRecord(characteristic_time_index, characteristicsCounter,
stats.Step, buffer);
PutCharacteristicRecord(characteristic_file_index, characteristicsCounter,
stats.FileIndex, buffer);
uint8_t characteristicID = characteristic_dimensions;
helper::InsertToBuffer(buffer, &characteristicID);
constexpr uint8_t dimensions = 1;
helper::InsertToBuffer(buffer, &dimensions); // count
constexpr uint16_t dimensionsLength = 24;
helper::InsertToBuffer(buffer, &dimensionsLength); // length
PutDimensionsRecord({attribute.m_Elements}, {}, {}, buffer);
++characteristicsCounter;
// VALUE
PutAttributeCharacteristicValueInIndex(characteristicsCounter, attribute,
buffer);
PutCharacteristicRecord(characteristic_offset, characteristicsCounter,
stats.Offset, buffer);
PutCharacteristicRecord(characteristic_payload_offset,
characteristicsCounter, stats.PayloadOffset,
buffer);
// END OF CHARACTERISTICS
// Back to characteristics count and length
size_t backPosition = characteristicsCountPosition;
helper::CopyToBuffer(buffer, backPosition,
&characteristicsCounter); // count (1)
// remove its own length (4) + characteristic counter (1)
const uint32_t characteristicsLength = static_cast<uint32_t>(
buffer.size() - characteristicsCountPosition - 4 - 1);
helper::CopyToBuffer(buffer, backPosition,
&characteristicsLength); // length
// Remember this attribute and its serialized piece
// should not affect BP3 as it's recalculated
const uint32_t indexLength =
static_cast<uint32_t>(buffer.size() - indexLengthPosition - 4);
helper::CopyToBuffer(buffer, indexLengthPosition, &indexLength);
m_MetadataSet.AttributesIndices.emplace(attribute.m_Name, index);
m_SerializedAttributes.emplace(attribute.m_Name);
}
// operations related functions
template <class T>
void BPSerializer::PutCharacteristicOperation(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo,
std::vector<char> &buffer) noexcept
{
auto &operation = blockInfo.Operations[0];
const std::string type = operation.Op->m_Type;
const uint8_t typeLength = static_cast<uint8_t>(type.size());
helper::InsertToBuffer(buffer, &typeLength);
helper::InsertToBuffer(buffer, type.c_str(), type.size());
// pre-transform type
const uint8_t dataType = TypeTraits<T>::type_enum;
helper::InsertToBuffer(buffer, &dataType);
// pre-transform dimensions
const uint8_t dimensions = static_cast<uint8_t>(blockInfo.Count.size());
helper::InsertToBuffer(buffer, &dimensions); // count
const uint16_t dimensionsLength = static_cast<uint16_t>(24 * dimensions);
helper::InsertToBuffer(buffer, &dimensionsLength); // length
PutDimensionsRecord(blockInfo.Count, blockInfo.Shape, blockInfo.Start,
buffer);
// here put the metadata info depending on operation
BPOperation bpOperation;
bpOperation.SetMetadata(variable, blockInfo, operation, buffer);
}
template <class T>
void BPSerializer::PutOperationPayloadInBuffer(
const core::Variable<T> &variable,
const typename core::Variable<T>::BPInfo &blockInfo)
{
BPOperation bpOperation;
bpOperation.SetData(variable, blockInfo, blockInfo.Operations[0], m_Data);
// update metadata
bool isFound = false;
SerialElementIndex &variableIndex = GetSerialElementIndex(
variable.m_Name, m_MetadataSet.VarsIndices, isFound);
bpOperation.UpdateMetadata(variable, blockInfo, blockInfo.Operations[0],
variableIndex.Buffer);
}
} // end namespace format
} // end namespace adios2
#endif /* ADIOS2_TOOLKIT_FORMAT_BP_BPSERIALIZER_TCC_ */
| 34.776699 | 80 | 0.619277 | gregorweiss |
f33a0e519b7456f690c3e53c0357bf64a3912503 | 2,586 | cpp | C++ | velox/serializers/tests/PrestoOutputStreamListenerTest.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | 1 | 2022-03-04T20:01:57.000Z | 2022-03-04T20:01:57.000Z | velox/serializers/tests/PrestoOutputStreamListenerTest.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | 1 | 2022-03-08T18:23:48.000Z | 2022-03-08T18:23:48.000Z | velox/serializers/tests/PrestoOutputStreamListenerTest.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <gtest/gtest.h>
#include <sstream>
#include "velox/serializers/PrestoSerializer.h"
using namespace facebook::velox;
class PrestoOutputStreamListenerTest : public ::testing::Test {};
TEST_F(PrestoOutputStreamListenerTest, basic) {
std::stringstream out;
serializer::presto::PrestoOutputStreamListener streamlListener;
auto os = std::make_unique<OutputStream>(&out, &streamlListener);
std::string str1 = "this";
std::string str2 = "is";
std::string str3 = "hello world!";
int length = str1.size() + str2.size() + str3.size();
char codec = 4;
int skipValue1 = 480;
int skipValue2 = 8999;
auto listener = dynamic_cast<serializer::presto::PrestoOutputStreamListener*>(
os->listener());
EXPECT_TRUE(listener != nullptr);
boost::crc_32_type crc;
crc.process_bytes(&codec, sizeof(codec));
crc.process_bytes(&length, sizeof(length));
crc.process_bytes(str1.data(), str1.size());
crc.process_bytes(str2.data(), str2.size());
crc.process_bytes(str3.data(), str3.size());
// We run following tests twice to test listener's reset capability.
for (int i = 0; i < 2; ++i) {
listener->reset();
listener->resume();
os->write(&codec, sizeof(codec));
listener->pause();
// Following two writes won't be reflected towards CRC computation.
os->write(reinterpret_cast<char*>(&skipValue1), sizeof(skipValue1));
os->write(reinterpret_cast<char*>(&skipValue2), sizeof(skipValue2));
listener->resume();
os->write(reinterpret_cast<char*>(&length), sizeof(length));
os->write(str1.data(), str1.size());
os->write(str2.data(), str2.size());
os->write(str3.data(), str3.size());
listener->pause();
// Following two writes won't be reflected towards CRC computation.
os->write(reinterpret_cast<char*>(&skipValue1), sizeof(skipValue1));
os->write(reinterpret_cast<char*>(&skipValue2), sizeof(skipValue2));
EXPECT_EQ(crc.checksum(), listener->crc().checksum());
}
}
| 35.424658 | 80 | 0.700696 | vancexu |
f33b2405e72d886ca33cac1a3c8593996da8b1a6 | 7,705 | cpp | C++ | SNesoid/sneslib_comp/screenshot.cpp | Pretz/SNesoid | a9381085e07c5aabbe8e371854d579fede0893ae | [
"Xnet",
"X11"
] | 17 | 2015-01-19T05:33:25.000Z | 2021-10-05T23:24:33.000Z | snes9x/src/main/cpp/sneslib/screenshot.cpp | CharlesNascimento/K-SNES | 10f97fdf28e647b484a68aecd1387ec549290c62 | [
"MIT"
] | 5 | 2015-01-19T09:24:55.000Z | 2019-08-09T18:55:58.000Z | SNesoid/sneslib_comp/screenshot.cpp | Pretz/SNesoid | a9381085e07c5aabbe8e371854d579fede0893ae | [
"Xnet",
"X11"
] | 22 | 2015-01-17T00:24:52.000Z | 2021-08-13T02:51:30.000Z | /*******************************************************************************
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
Jerremy Koot (jkoot@snes9x.com)
(c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net)
(c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net),
funkyass (funkyass@spam.shaw.ca),
Joel Yliluoma (http://iki.fi/bisqwit/)
Kris Bleakley (codeviolation@hotmail.com),
Matthew Kendora,
Nach (n-a-c-h@users.sourceforge.net),
Peter Bortas (peter@bortas.org) and
zones (kasumitokoduck@yahoo.com)
C4 x86 assembler and some C emulation code
(c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com),
_Demo_ (_demo_@zsnes.com), and Nach
C4 C++ code
(c) Copyright 2003 Brad Jorsch
DSP-1 emulator code
(c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson,
John Weidman, neviksti (neviksti@hotmail.com),
Kris Bleakley, Andreas Naive
DSP-2 emulator code
(c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and
Lord Nightmare (lord_nightmare@users.sourceforge.net
OBC1 emulator code
(c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and
Kris Bleakley
Ported from x86 assembler to C by sanmaiwashi
SPC7110 and RTC C++ emulator code
(c) Copyright 2002 Matthew Kendora with research by
zsKnight, John Weidman, and Dark Force
S-DD1 C emulator code
(c) Copyright 2003 Brad Jorsch with research by
Andreas Naive and John Weidman
S-RTC C emulator code
(c) Copyright 2001 John Weidman
ST010 C++ emulator code
(c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora
Super FX x86 assembler emulator code
(c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault
Super FX C emulator code
(c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman
SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
Specific ports contains the works of other authors. See headers in
individual files.
Snes9x homepage: http://www.snes9x.com
Permission to use, copy, modify and distribute Snes9x in both binary and
source form, for non-commercial purposes, is hereby granted without fee,
providing that this license information and copyright notice appear with
all copies and any derived work.
This software is provided 'as-is', without any express or implied
warranty. In no event shall the authors be held liable for any damages
arising from the use of this software.
Snes9x is freeware for PERSONAL USE only. Commercial users should
seek permission of the copyright holders first. Commercial use includes
charging money for Snes9x or software derived from Snes9x.
The copyright holders request that bug fixes and improvements to the code
should be forwarded to them so everyone can benefit from the modifications
in future versions.
Super NES and Super Nintendo Entertainment System are trademarks of
Nintendo Co., Limited and its subsidiary companies.
*******************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#ifndef __WIN32__
#include <unistd.h>
#else
#include <direct.h>
#endif
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_LIBPNG
#include <png.h>
#endif
#include "snes9x.h"
#include "memmap.h"
#include "display.h"
#include "gfx.h"
#include "ppu.h"
#include "screenshot.h"
bool8 S9xDoScreenshot(int width, int height){
#ifdef HAVE_LIBPNG
FILE *fp;
png_structp png_ptr;
png_infop info_ptr;
png_color_8 sig_bit;
png_color pngpal[256];
int imgwidth;
int imgheight;
const char *fname=S9xGetFilenameInc(".png");
Settings.TakeScreenshot=FALSE;
if((fp=fopen(fname, "wb"))==NULL){
perror("Screenshot failed");
return FALSE;
}
png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if(!png_ptr){
fclose(fp);
unlink(fname);
return FALSE;
}
info_ptr=png_create_info_struct(png_ptr);
if(!info_ptr){
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
fclose(fp);
unlink(fname);
return FALSE;
}
if(setjmp(png_jmpbuf(png_ptr))){
perror("Screenshot: setjmp");
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
unlink(fname);
return FALSE;
}
imgwidth=width;
imgheight=height;
if(Settings.StretchScreenshots==1){
if(width<=256 && height>SNES_HEIGHT_EXTENDED) imgwidth=width<<1;
if(width>256 && height<=SNES_HEIGHT_EXTENDED) imgheight=height<<1;
} else if(Settings.StretchScreenshots==2){
if(width<=256) imgwidth=width<<1;
if(height<=SNES_HEIGHT_EXTENDED) imgheight=height<<1;
}
png_init_io(png_ptr, fp);
if(!Settings.SixteenBit){
// BJ: credit sanmaiwashi for the idea to do palettized pngs, and to
// S9xSetPalette in x11.cpp for how to calculate the RGB values
int b=IPPU.MaxBrightness*140;
for(int i=0; i<256; i++){
pngpal[i].red = (PPU.CGDATA[i] & 0x1f)*b>>8;
pngpal[i].green = ((PPU.CGDATA[i] >> 5) & 0x1f)*b>>8;
pngpal[i].blue = ((PPU.CGDATA[i] >> 10) & 0x1f)*b>>8;
}
png_set_PLTE(png_ptr, info_ptr, pngpal, 256);
}
png_set_IHDR(png_ptr, info_ptr, imgwidth, imgheight, 8,
(Settings.SixteenBit?PNG_COLOR_TYPE_RGB:PNG_COLOR_TYPE_PALETTE),
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
if(Settings.SixteenBit){
/* 5 bits per color */
sig_bit.red=5;
sig_bit.green=5;
sig_bit.blue=5;
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
png_set_shift(png_ptr, &sig_bit);
}
png_write_info(png_ptr, info_ptr);
png_set_packing(png_ptr);
png_byte *row_pointer=new png_byte [png_get_rowbytes(png_ptr, info_ptr)];
uint8 *screen=GFX.Screen;
for(int y=0; y<height; y++, screen+=GFX.Pitch){
png_byte *rowpix = row_pointer;
for(int x=0; x<width; x++){
if(Settings.SixteenBit){
uint32 r, g, b;
DECOMPOSE_PIXEL((*(uint16 *)(screen+2*x)), r, g, b);
*(rowpix++) = r;
*(rowpix++) = g;
*(rowpix++) = b;
if(imgwidth!=width){
*(rowpix++) = r;
*(rowpix++) = g;
*(rowpix++) = b;
}
} else {
*(rowpix++)=*(uint8 *)(screen+x);
if(imgwidth!=width)
*(rowpix++)=*(uint8 *)(screen+x);
}
}
png_write_row(png_ptr, row_pointer);
if(imgheight!=height)
png_write_row(png_ptr, row_pointer);
}
delete [] row_pointer;
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
fprintf(stderr, "%s saved.\n", fname);
return TRUE;
#else
perror("Screenshot support not available (libpng was not found at build time)");
return FALSE;
#endif
}
| 32.648305 | 84 | 0.609215 | Pretz |
f33baed1673db87d7f1c6beb271a91f4a07f49e0 | 139 | cpp | C++ | assets/code_box/boj_sum.cpp | happyOBO/happyOBO.github.io | 96e60a67b9b84c26f01312f8ca5ade35803c521f | [
"MIT"
] | 2 | 2020-10-24T03:25:30.000Z | 2021-08-01T05:18:18.000Z | assets/code_box/boj_sum.cpp | happyOBO/happyOBO.github.io | 96e60a67b9b84c26f01312f8ca5ade35803c521f | [
"MIT"
] | 2 | 2020-12-05T14:31:19.000Z | 2020-12-06T05:09:43.000Z | assets/code_box/boj_sum.cpp | happyOBO/happyOBO.github.io | 96e60a67b9b84c26f01312f8ca5ade35803c521f | [
"MIT"
] | 4 | 2020-08-26T10:02:11.000Z | 2020-10-22T05:55:18.000Z | #include <iostream>
#include <algorithm>
using namespace std;
long long sum(void)
{
long long result = 0LL;
return result;
}
| 12.636364 | 27 | 0.661871 | happyOBO |
f33bb1ff7130234d64747dd585b822ca967b94cb | 12,005 | cpp | C++ | example/DomainDecomposition/EBINS/src/BCGVelAdvect.cpp | OscarAntepara/Chombo_4 | 87e0a282f7bab94249a3c8f56935ea77905c883d | [
"BSD-3-Clause-LBNL"
] | null | null | null | example/DomainDecomposition/EBINS/src/BCGVelAdvect.cpp | OscarAntepara/Chombo_4 | 87e0a282f7bab94249a3c8f56935ea77905c883d | [
"BSD-3-Clause-LBNL"
] | null | null | null | example/DomainDecomposition/EBINS/src/BCGVelAdvect.cpp | OscarAntepara/Chombo_4 | 87e0a282f7bab94249a3c8f56935ea77905c883d | [
"BSD-3-Clause-LBNL"
] | null | null | null |
#include "BCGVelAdvect.H"
#include "EBAdvectionFunctions.H"
#include "Chombo_ParmParse.H"
#include "Chombo_NamespaceHeader.H"
///
void
BCGVelAdvect::
applyVeloFluxBCs(EBFluxData<Real, 1> & a_flux,
const DataIndex & a_dit,
EBFluxData<Real, 1> & a_scalarLo,
EBFluxData<Real, 1> & a_scalarHi,
unsigned int a_velcomp)
{
Box validBox = m_grids[a_dit];
Bx dombx = ProtoCh::getProtoBox(m_domain);
Bx valbx = ProtoCh::getProtoBox(validBox);
for(SideIterator sit; sit.ok(); ++sit)
{
Point dombnd = dombx.boundary(sit());
Point valbnd = valbx.boundary(sit());
for(int idir = 0; idir < DIM; idir++)
{
if(dombnd[idir] == valbnd[idir])
{
int index = ebp_index(idir, sit());
string bcstr = m_ebibc.m_domainBC[index];
if(bcstr == string("outflow"))
{
//copy correct side of extrapolation to flux (using extrapolated value as flux here)
copyExtrapolatedState(a_flux, a_scalarLo, a_scalarHi, idir, sit(), valbx);
}
else if(bcstr == string("inflow"))
{
if(idir == a_velcomp)
{
Real fluxval = 0;
ParmParse pp;
pp.get("velocity_inflow_value", fluxval);
EBMACProjector::setFaceStuff(idir, sit(), a_flux, valbx, fluxval);
}
else
{
//copy correct side of extrapolation to flux (using extrapolated value as flux here)
copyExtrapolatedState(a_flux, a_scalarLo, a_scalarHi, idir, sit(), valbx);
}
}
else if((bcstr == string("no_slip_wall")) || (bcstr == string("slip_wall")))
{
if(a_velcomp== idir)
{
Real fluxval = 0;
EBMACProjector::setFaceStuff(idir, sit(), a_flux, valbx, fluxval);
}
else
{
//copy correct side of extrapolation to flux (using extrapolated value as flux here)
copyExtrapolatedState(a_flux, a_scalarLo, a_scalarHi, idir, sit(), valbx);
}
}
else
{
MayDay::Error("EBAdvection: unrecognized bc");
}
}
}
}
}
/*******/
void
BCGVelAdvect::
copyExtrapolatedState(EBFluxData<Real, 1>& a_flux,
EBFluxData<Real, 1>& a_scalarLo,
EBFluxData<Real, 1>& a_scalarHi,
int idir, Side::LoHiSide sit, Bx valbx)
{
Bx faceBx = valbx.faceBox(idir, sit);
int isign = sign(sit);
//unsigned long long int numflopspt = 0;
if(idir == 0)
{
//using non-eb forall because box restriction in eb land is broken right now. This will
//work if there are no cut cells near the domain boundary
auto& regflux = a_flux.m_xflux->getRegData();
auto& regsclo = a_scalarLo.m_xflux->getRegData();
auto& regschi = a_scalarHi.m_xflux->getRegData();
forallInPlaceBase(copyExtrap, faceBx, regflux, regsclo, regschi, isign);
}
else if(idir == 1)
{
//using non-eb forall because box restriction in eb land is broken right now. This will
//work if there are no cut cells near the domain boundary
auto& regflux = a_flux.m_yflux->getRegData();
auto& regsclo = a_scalarLo.m_yflux->getRegData();
auto& regschi = a_scalarHi.m_yflux->getRegData();
forallInPlaceBase(copyExtrap, faceBx, regflux, regsclo, regschi, isign);
}
#if DIM==3
else if(idir == 2)
{
//using non-eb forall because box restriction in eb land is broken right now. This will
//work if there are no cut cells near the domain boundary
auto& regflux = a_flux.m_zflux->getRegData();
auto& regsclo = a_scalarLo.m_zflux->getRegData();
auto& regschi = a_scalarHi.m_zflux->getRegData();
forallInPlaceBase(copyExtrap, faceBx, regflux, regsclo, regschi, isign);
}
#endif
else
{
MayDay::Error("bogus idir");
}
}
/*******/
void
BCGVelAdvect::
hybridVecDivergence(EBLevelBoxData<CELL, DIM>& a_divuu,
EBLevelBoxData<CELL, DIM>& a_inputVel,
const Real & a_dt,
Real a_tolerance, unsigned int a_maxIter)
{
CH_TIME("BCGAdvect::hybridDivergence");
getMACVectorVelocity(a_inputVel, a_dt, a_tolerance, a_maxIter);
//lots of aliasing and smushing
assembleDivergence(a_divuu, a_dt);
}
/*******/
void
BCGVelAdvect::
copyComp(EBFluxData<Real, 1>& a_dst,
EBFluxData<Real, 1>& a_src,
int a_vecDir)
{
CH_TIME("BCGAdvect::copyComp");
unsigned numflopspt = 0;
if(a_vecDir == 0)
{
ebforallInPlace(numflopspt, "Copied", Copied, a_dst.m_xflux->box(),
*a_dst.m_xflux, *a_src.m_xflux);
}
else if(a_vecDir == 1)
{
ebforallInPlace(numflopspt, "Copied", Copied, a_dst.m_yflux->box(),
*a_dst.m_yflux, *a_src.m_yflux );
}
#if DIM==3
else if(a_vecDir == 2)
{
ebforallInPlace(numflopspt, "Copied", Copied, a_dst.m_zflux->box(),
*a_dst.m_zflux, *a_src.m_zflux );
}
#endif
}
/*******/
void
BCGVelAdvect::
getMACVectorVelocity(EBLevelBoxData<CELL, DIM> & a_inputVel,
const Real & a_dt,
Real a_tol, unsigned int a_maxIter)
{
CH_TIME("BCGAdvect::getMACVectorVelocity");
for(unsigned int vecDir = 0; vecDir < DIM; vecDir++)
{
EBLevelBoxData< CELL, 1> velcomp;
EBLevelFluxData<1> facecomp;
velcomp.define<DIM> (a_inputVel, vecDir, m_graphs);
facecomp.define<DIM>(m_macVelocity, vecDir, m_graphs);
//source term = nu*lapl(ucomp);
if(m_eulerCalc)
{
m_source.setVal(0.);
}
else
{
Real alpha = 0; Real beta = m_viscosity;
m_helmholtz->resetAlphaAndBeta(alpha, beta);
m_helmholtz->applyOp(m_source, velcomp);
}
m_source.exchange(m_exchangeCopier);
DataIterator dit = m_grids.dataIterator();
int ideb = 0;
for(int ibox = 0; ibox < dit.size(); ++ibox)
{
Bx grid = ProtoCh::getProtoBox(m_grids[dit[ibox]]);
Bx grown = grid.grow(ProtoCh::getPoint(m_nghost));
const EBGraph & graph = (*m_graphs)[dit[ibox]];
//this gets the low and high side states for the riemann problem
auto& scalfab = velcomp[dit[ibox]];
EBFluxData<Real, 1> scalarHi(grown, graph);
EBFluxData<Real, 1> scalarLo(grown, graph);
EBFluxData<Real, 1> faceCentVelo( grown, graph);
EBFluxData<Real, 1>& upwindScal = facecomp[dit[ibox]];
auto & veccell = a_inputVel[dit[ibox]];
auto & sourfab = m_source[dit[ibox]];
bcgExtrapolateScalar(scalarLo, scalarHi, veccell, scalfab, sourfab,
grown, graph, dit[ibox], ibox, a_dt);
//average velocities to face centers.
getFaceCenteredVel( faceCentVelo, dit[ibox], ibox);
//get face fluxes and interpolate them to centroids
unsigned int curcomp = vecDir;
unsigned int doingvel = 1;
getUpwindState(upwindScal, faceCentVelo, scalarLo, scalarHi, curcomp, doingvel);
//enforce boundary conditions with an iron fist.
applyVeloFluxBCs(upwindScal, dit[ibox],
scalarLo, scalarHi, curcomp);
EBFluxData<Real, 1>& advvelfab = m_advectionVel[dit[ibox]];
//now copy into the normal direction holder
copyComp(advvelfab, upwindScal, vecDir);
} //end loop over boxes
} // and loop over velocity directions
// now we need to project the mac velocity
pout() << "mac projecting advection velocity" << endl;
m_macproj->project(m_advectionVel, m_macGradient, a_tol, a_maxIter);
m_advectionVel.exchange(m_exchangeCopier);
//subtract off pure gradient part of the velocity field in vector holder.
correctVectorVelocity();
}
/*******/
//subtract off pure gradient part of the velocity field
//makes normal component of the velocity = advection velocity at the face
//Recall the gradients only exist on the normal face.
//The tangential compoents get the average of neighboring gradients in the same direciton
//subtracted. So the y component on the xfaces get the average of the values of the
//gradient on the neighboring y faces
void
BCGVelAdvect::
correctVectorVelocity()
{
CH_TIME("BCGAdvect::correctVectorVelocity");
m_macGradient.exchange(m_exchangeCopier);
DataIterator dit = m_grids.dataIterator();
int ideb = 0;
for(unsigned int vecDir = 0; vecDir < DIM; vecDir++)
{
EBLevelFluxData<1> facecomp;
facecomp.define<DIM>(m_macVelocity, vecDir, m_graphs);
for(int ibox = 0; ibox < dit.size(); ++ibox)
{
auto & advvelfab = m_advectionVel[dit[ibox]];
auto & macGrad = m_macGradient[dit[ibox]];
EBCrossFaceStencil<2, Real> stencils =
m_brit->getCrossFaceStencil(StencilNames::TanVelCorrect, StencilNames::NoBC, m_domain, m_domain, ibox);
auto & velcomp = facecomp[dit[ibox]];
for(unsigned int faceDir =0; faceDir < DIM; faceDir++)
{
unsigned int srcDir = vecDir;
unsigned int dstDir = faceDir;
if(faceDir == vecDir)
{
//when vecdir==facedir,
//substitutNe the advection velocity, which already has its gradient removed
//correct facedir==vecdir direction
copyComp(velcomp, advvelfab, vecDir);
}
else
{
//begin debug
//EBFluxData<Real,1> tangrad(velcomp.m_xflux->inputBox(), (*m_graphs)[dit[ibox]]);
//stencils.apply(tangrad, macGrad, true , 1.0);
//end debug
bool setToZero=false; Real scale = -1; //subtracting off gradient
stencils.apply(velcomp, macGrad, dstDir, srcDir, setToZero, scale);
}
ideb++;
}
}
ideb++;
}
m_macVelocity.exchange(m_exchangeCopier);
}
/**********/
void
BCGVelAdvect::
assembleDivergence(EBLevelBoxData<CELL, DIM>& a_divuu,
const Real & a_dt)
{
CH_TIME("BCGAdvect::assembleDivergence");
DataIterator dit = m_grids.dataIterator();
for(int ivar = 0; ivar < DIM; ivar++)
{
EBLevelBoxData<CELL, 1> hybridDiv;
EBLevelFluxData<1> scalarVelComp;
hybridDiv.define<DIM>( a_divuu, ivar, m_graphs);
scalarVelComp.define<DIM>(m_macVelocity, ivar, m_graphs);
//this loop fills m_kappaDiv with the conservative divergence
for(unsigned int ibox = 0; ibox < dit.size(); ibox++)
{
Bx grid = ProtoCh::getProtoBox(m_grids[dit[ibox]]);
Bx grown = grid.grow(ProtoCh::getPoint(m_nghost));
const EBGraph & graph = (*m_graphs)[dit[ibox]];
auto& faceCentVel = m_advectionVel[dit[ibox]];
auto& scalar = scalarVelComp[dit[ibox]];
EBFluxData<Real, 1> centroidFlux(grown, graph);
EBFluxData<Real, 1> faceCentFlux(grown, graph);
assembleFlux(faceCentFlux, scalar, faceCentVel);
EBFluxStencil<2, Real> stencils = m_brit->getFluxStencil(s_centInterpLabel, s_nobcsLabel, m_domain, m_domain, ibox);
//interpolate flux to centroids
stencils.apply(centroidFlux, faceCentFlux, true, 1.0); //true is to initialize to zero
scalar.define(m_macVelocity[dit[ibox]], ivar);
auto& kapdiv = m_kappaDiv[dit[ibox]];
getKapDivFFromCentroidFlux(kapdiv, centroidFlux, ibox);
}
m_kappaDiv.exchange(m_exchangeCopier);
// begin debug
//string sourcefile = string("kappaDiv.") + std::to_string(ivar) + string(".hdf5");
//m_kappaDiv.writeToFileHDF5(sourcefile, 0.);
//end debug
//this computes the non-conservative divergence and puts it into m_nonConsDiv
nonConsDiv();
//this forms the hybrid divergence
//does linear combination of divnc and div c to get hybrid and compute delta M
kappaDivPlusOneMinKapDivNC(hybridDiv);
redistribute(hybridDiv);
}
}
/*******/
#include "Chombo_NamespaceFooter.H"
| 34.398281 | 124 | 0.622574 | OscarAntepara |
f33f00eb3798df2cf9624cb1970dfbb60930ba65 | 24,568 | cc | C++ | src/EMBase.cc | MIRTK/NeoSeg | d2ff4e307638727d66aff3ece25496677bbd8df1 | [
"Apache-2.0"
] | 16 | 2016-03-25T22:39:48.000Z | 2021-07-07T09:35:23.000Z | src/EMBase.cc | MIRTK/NeoSeg | d2ff4e307638727d66aff3ece25496677bbd8df1 | [
"Apache-2.0"
] | 24 | 2016-02-24T16:22:11.000Z | 2021-10-05T12:34:39.000Z | src/EMBase.cc | MIRTK/NeoSeg | d2ff4e307638727d66aff3ece25496677bbd8df1 | [
"Apache-2.0"
] | 13 | 2016-03-17T03:41:01.000Z | 2021-11-13T02:43:49.000Z | /*
* Developing brain Region Annotation With Expectation-Maximization (Draw-EM)
*
* Copyright 2013-2020 Imperial College London
* Copyright 2013-2020 Christian Ledig
* Copyright 2013-2020 Antonios Makropoulos
*
* 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 "mirtk/EMBase.h"
namespace mirtk {
EMBase::EMBase(){
InitialiseParameters();
}
template <class ImageType>
EMBase::EMBase(int noTissues, ImageType **atlas, ImageType *background)
{
InitialiseParameters();
_atlas.AddProbabilityMaps(noTissues, atlas);
addBackground(*background);
_number_of_tissues = _atlas.GetNumberOfMaps();
}
template <class ImageType>
EMBase::EMBase(int noTissues, ImageType **atlas)
{
InitialiseParameters();
_atlas.AddProbabilityMaps(noTissues, atlas);
_number_of_tissues = _atlas.GetNumberOfMaps();
}
template <class ImageType>
EMBase::EMBase(int noTissues, ImageType **atlas, ImageType **initposteriors)
{
InitialiseParameters();
_atlas.AddProbabilityMaps(noTissues, atlas);
_output.AddProbabilityMaps(noTissues, initposteriors);
_posteriors_set=true;
_number_of_tissues = _atlas.GetNumberOfMaps();
}
EMBase::~EMBase()
{
}
void EMBase::InitialiseParameters()
{
_padding = MIN_GREY;
_number_of_voxels = 0;
_number_of_tissues = 0;
_f = 0;
_superlabels=false;
_postpen=false;
_posteriors_set=false;
_has_background=false;
_mask_set=false;
}
void EMBase::SetInput(const RealImage &image)
{
_input = image;
_estimate = image;
_weights = image;
_number_of_voxels=_input.GetNumberOfVoxels();
}
void EMBase::CreateMask()
{
_atlas.First();
if(!_mask_set){
_mask.Initialize(_input.Attributes());
}
RealPixel *p=_input.GetPointerToVoxels();
BytePixel *m=_mask.GetPointerToVoxels();
for (int i=0; i<_number_of_voxels; i++) {
if(!_mask_set || *m==1){
if (*p!=_padding){
bool flag = true;
for (int j = 0; j < _number_of_tissues; j++) {
if (_atlas.GetValue(j) > 0) {
flag=false;break;
}
}
if(flag) *m=0;
else *m=1;
}
else *m=0;
}
p++;
m++;
_atlas.Next();
}
_mask_set = true;
}
void EMBase::SetMask(ByteImage &mask)
{
_mask=mask;
_mask_set = true;
}
void EMBase::Initialise()
{
_number_of_tissues = _atlas.GetNumberOfMaps();
_atlas.NormalizeAtlas();
if(!_posteriors_set) _output = _atlas;
else _output.NormalizeAtlas();
CreateMask();
_mi.resize(_number_of_tissues);
_sigma.resize(_number_of_tissues);
_c.resize(_number_of_tissues);
this->MStep();
Print();
}
void EMBase::InitialiseGMM()
{
_atlas.NormalizeAtlas();
if(!_posteriors_set) _output = _atlas;
else _output.NormalizeAtlas();
this->MStepGMM();
Print();
}
void EMBase::setPostPenalty(RealImage &pp){
_postpenalty=pp;
_postpen=true;
}
void EMBase::UniformPrior()
{
int i, k;
_atlas.First();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i=0; i< _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k < _number_of_tissues; k++) {
_atlas.SetValue(k,1.0/_number_of_tissues);
}
}
pm++;
_atlas.Next();
}
}
void EMBase::InitialiseGMMParameters(int n)
{
int i;
std::cout <<"Estimating GMM parameters ... ";
RealPixel imin, imax;
_input.GetMinMaxPad(&imin, &imax,_padding);
_number_of_tissues=n;
_mi.resize(_number_of_tissues);
_sigma.resize(_number_of_tissues);
_c.resize(_number_of_tissues);
for (i=0; i<n; i++) {
_mi[i]=imin+i*(imax-imin)/(n-1);
_sigma[i]=((imax-imin)/(n-1))*((imax-imin)/(n-1));
_c[i]=1.0/n;
}
PrintGMM();
}
void EMBase::InitialiseGMMParameters(int n, double *m, double *s, double *c)
{
int i;
_number_of_tissues = n;
_mi.resize(_number_of_tissues);
_sigma.resize(_number_of_tissues);
_c.resize(_number_of_tissues);
for ( i=0; i<n; i++) {
_mi[i]=m[i];
_sigma[i]=s[i];
_c[i]=c[i];
}
PrintGMM();
_output = _atlas;
EStepGMM();
}
void EMBase::MStep()
{
std::cout << "M-step" << std::endl;
int k;
Array<double> mi_num(_number_of_tissues);
Array<double> sigma_num(_number_of_tissues);
Array<double> denom(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] = 0;
sigma_num[k] = 0;
denom[k] = 0;
}
//superlabels
Array<double> mi_num_super, sigma_num_super, denom_super;
if(_superlabels) {
mi_num_super.resize(_number_of_tissues);
sigma_num_super.resize(_number_of_tissues);
denom_super.resize(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
mi_num_super[k] = 0;
sigma_num_super[k] = 0;
denom_super[k]=0;
}
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end = _output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1) {
mi_num[k] += it->second * _input.Get(it->first);
denom[k] += it->second;
}
}
}
/*
_output.First();
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] += _output.GetValue(k) * *ptr;
denom[k] += _output.GetValue(k);
}
}
ptr++;
pm++;
_output.Next();
}*/
//superlabels
if(_superlabels) {
for (k = 0; k < _number_of_tissues; k++) {
mi_num_super[_super[k]] += mi_num[k];
denom_super[_super[k]] += denom[k];
}
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] = mi_num_super[_super[k]];
denom[k] = denom_super[_super[k]];
}
}
for (k = 0; k < _number_of_tissues; k++) {
if (denom[k] != 0) {
_mi[k] = mi_num[k] / denom[k];
} else {
std::cerr << "Division by zero while computing tissue mean!" << std::endl;
exit(1);
}
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end = _output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1) {
sigma_num[k] += it->second * pow(_input.Get(it->first) - _mi[k],2);
}
}
}
/*
_output.First();
ptr = _input.GetPointerToVoxels();
pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k <_number_of_tissues; k++) {
sigma_num[k] += (_output.GetValue(k) * (*ptr - _mi[k]) * (*ptr - _mi[k]));
}
}
ptr++;
pm++;
_output.Next();
}*/
//superlabels
if(_superlabels){
for (k = 0; k < _number_of_tissues; k++) {
sigma_num_super[_super[k]] += sigma_num[k];
}
for (k = 0; k < _number_of_tissues; k++) {
sigma_num[k] = sigma_num_super[_super[k]];
}
}
for (k = 0; k <_number_of_tissues; k++) {
_sigma[k] = sigma_num[k] / denom[k];
_sigma[k] = max( _sigma[k], 0.005 );
}
}
void EMBase::EStep()
{
std::cout << "E-step" << std::endl;
int i, k;
double x;
RealImage segmentation;
Array<Gaussian> G(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
G[k].Initialise(_mi[k], _sigma[k]);
}
RealPixel *pptr = nullptr;
if (_postpen) pptr = _postpenalty.GetPointerToVoxels();
Array<double> likelihood(_number_of_tissues);
double sumlike;
_atlas.First();
_output.First();
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
Array<double> numerator(_number_of_tissues);
double denominator, temp;
for (i=0; i< _number_of_voxels; i++) {
if (*pm == 1) {
x = *ptr;
sumlike=0;
for (k = 0; k < _number_of_tissues; k++) {
likelihood[k] = G[k].Evaluate(x);
sumlike += likelihood[k];
}
for (k = 0; k < _number_of_tissues; k++) {
likelihood[k] /= sumlike;
}
denominator=0;
for (k = 0; k < _number_of_tissues; k++) {
temp = likelihood[k] * _atlas.GetValue(k);
numerator[k] = temp;
denominator += temp;
}
//model averaging
if (_postpen && denominator != 0) {
double olddenom=denominator;
denominator=0;
for (k = 0; k < _number_of_tissues; k++) {
double value = numerator[k]/olddenom;
double priorvalue=_atlas.GetValue(k);
value=(1-*pptr)*value +*pptr * priorvalue;
numerator[k] = value;
denominator += value;
}
}
for (k = 0; k < _number_of_tissues; k++) {
if (denominator != 0) {
double value = numerator[k]/denominator;
if ((value < 0) || (value > 1)) {
int x,y,z;
_input.IndexToVoxel(i, x, y, z);
std::cerr << "Probability value = " << value <<" @ Estep at voxel "<< x<<" "<<y<<" "<<z<< ", structure " << k << std::endl;
if (value < 0)value=0;
if (value > 1)value=1;
}
_output.SetValue(k, value);
} else {
_output.SetValue(k,_atlas.GetValue(k));
}
}
if (denominator == 0) {
int x,y,z;
_input.IndexToVoxel(i, x, y, z);
std::cerr<<"Division by 0 while computing probabilities at voxel "<<x<<","<<y<<","<<z<<std::endl;
}
} else {
for (k = 0; k < _number_of_tissues ; k++) {
_output.SetValue(k, 0);
}
}
ptr++;
pm++;
if(_postpen) pptr++;
_atlas.Next();
_output.Next();
}
}
void EMBase::WStep()
{
std::cout << "W-step" << std::endl;
int i,k;
double num, den;
std::cout<<"Calculating weights ...";
RealPixel *pi=_input.GetPointerToVoxels();
RealPixel *pw=_weights.GetPointerToVoxels();
RealPixel *pe=_estimate.GetPointerToVoxels();
BytePixel *pm=_mask.GetPointerToVoxels();
_output.First();
_atlas.First();
for (i=0; i< _number_of_voxels; i++) {
if (*pm == 1){
num=0;
den=0;
for (k=0; k<_number_of_tissues; k++) {
num += _output.GetValue(k)*_mi[k]/_sigma[k];
den += _output.GetValue(k)/_sigma[k];
}
if (den!=0){
*pw=den;
*pe=num/den;
} else {
*pw=_padding;
*pe=_padding;
}
} else {
*pw=_padding;
*pe=_padding;
}
pi++;
pm++;
pw++;
pe++;
_output.Next();
_atlas.Next();
}
std::cout<<"done."<<std::endl;
}
void EMBase::GetMean(double *mean){
int i;
for(i=0;i<_number_of_tissues;i++){
mean[i] = _mi[i];
}
}
void EMBase::GetVariance(double *variance){
int i;
for(i=0;i<_number_of_tissues;i++){
variance[i] = sqrt(_sigma[i]);
}
}
void EMBase::MStepGMM(bool uniform_prior)
{
std::cout << "M-step GMM" << std::endl;
int k;
Array<double> mi_num(_number_of_tissues);
Array<double> sigma_num(_number_of_tissues);
Array<double> denom(_number_of_tissues);
Array<double> num_vox(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] = 0;
sigma_num[k] = 0;
denom[k] = 0;
num_vox[k] = 0;
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end=_output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1) {
mi_num[k] += it->second * _input.Get(it->first);
denom[k] += it->second;
num_vox[k]+= 1;
}
}
}
/*
_output.First();
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
// Check for backgound
if (*pm == 1) {
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] += _output.GetValue(k) * *ptr;
denom[k] += _output.GetValue(k);
num_vox[k]+= 1;
}
}
ptr++;
pm++;
_output.Next();
}*/
for (k = 0; k < _number_of_tissues; k++) {
if (denom[k] != 0) {
_mi[k] = mi_num[k] / denom[k];
} else {
std::cerr <<"Tissue "<< k <<": Division by zero while computing tissue mean!" << std::endl;
exit(1);
}
if (uniform_prior) _c[k]=1.0/_number_of_tissues;
else _c[k]=denom[k]/num_vox[k];
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end=_output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1) {
sigma_num[k] += it->second * pow(_input.Get(it->first) - _mi[k],2);
}
}
}
/*_output.First();
ptr = _input.GetPointerToVoxels();
pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k <_number_of_tissues; k++) {
sigma_num[k] += (_output.GetValue(k) * (*ptr - _mi[k]) * (*ptr - _mi[k]));
}
}
ptr++;
pm++;
_output.Next();
}*/
for (k = 0; k <_number_of_tissues; k++) {
_sigma[k] = sigma_num[k] / denom[k];
if(_sigma[k]<1) _sigma[k] = 1;
}
}
void EMBase::MStepVarGMM(bool uniform_prior)
{
std::cout << "M-step VarGMM" << std::endl;
int k;
Array<double> mi_num(_number_of_tissues);
Array<double> denom(_number_of_tissues);
Array<double> num_vox(_number_of_tissues);
double sigma_num = 0;
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] = 0;
denom[k] = 0;
num_vox[k] = 0;
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end=_output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1){
mi_num[k] += it->second * _input.Get(it->first);
denom[k] += it->second;
num_vox[k]+= 1;
}
}
}
/*
_output.First();
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k < _number_of_tissues; k++) {
mi_num[k] += _output.GetValue(k) * *ptr;
denom[k] += _output.GetValue(k);
num_vox[k]+= 1;
}
}
ptr++;
pm++;
_output.Next();
}*/
for (k = 0; k < _number_of_tissues; k++) {
if (denom[k] != 0) {
_mi[k] = mi_num[k] / denom[k];
} else {
std::cerr << "Division by zero while computing tissue mean!" << std::endl;
exit(1);
}
if (uniform_prior) _c[k]=1.0/_number_of_tissues;
else _c[k]=denom[k]/num_vox[k];
}
for (k = 0; k < _number_of_tissues; k++) {
const auto end=_output.End(k);
for (auto it = _output.Begin(k); it != end; ++it) {
if (_mask.Get(it->first)==1){
sigma_num += it->second * pow(_input.Get(it->first) - _mi[k],2);
}
}
}
/*
_output.First();
ptr = _input.GetPointerToVoxels();
pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
for (k = 0; k <_number_of_tissues; k++) {
sigma_num += (_output.GetValue(k) * (*ptr - _mi[k]) * (*ptr - _mi[k]));
}
}
ptr++;
pm++;
_output.Next();
}*/
double sum =0;
for (k = 0; k <_number_of_tissues; k++) sum += denom[k];
for (k = 0; k <_number_of_tissues; k++) {
if (sum>0) _sigma[k] = sigma_num / sum;
}
}
void EMBase::EStepGMM(bool uniform_prior)
{
std::cout << "E-step GMM" << std::endl;
int i, k;
double x;
Array<double> gv(_number_of_tissues);
Array<double> numerator(_number_of_tissues);
Array<Gaussian> G(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
G[k].Initialise( _mi[k], _sigma[k]);
}
_output.First();
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i=0; i< _number_of_voxels; i++) {
double denominator=0, temp=0;
if (*pm == 1) {
x = *ptr;
for (k = 0; k < _number_of_tissues; k++) {
temp = G[k].Evaluate(x);
gv[k] = temp;
if (!uniform_prior) temp = temp * _c[k];
numerator[k] = temp;
denominator += temp;
}
for (k = 0; k < _number_of_tissues; k++) {
if (denominator != 0) {
double value = numerator[k]/denominator;
if ((value < 0) || (value > 1)) {
int x,y,z;
_input.IndexToVoxel(i, x, y, z);
std::cerr << "Probability value = " << value <<" @ Estep gmm at voxel "<< x<<" "<<y<<" "<<z<< ", structure " << k << std::endl;
if (value < 0)value=0;
if (value > 1)value=1;
}
_output.SetValue(k, value);
} else {
_output.SetValue(k,_atlas.GetValue(k));
}
}
if (denominator <= 0) {
int x,y,z;
_input.IndexToVoxel(i, x, y, z);
std::cerr<<"Division by 0 while computing probabilities at voxel "<<x<<","<<y<<","<<z<<std::endl;
}
} else {
for (k = 0; k < _number_of_tissues ; k++) {
_output.SetValue(k, 0);
}
}
ptr++;
pm++;
_output.Next();
}
}
void EMBase::Print()
{
int k;
std::cout << "mean:";
for (k = 0; k <_number_of_tissues; k++) {
std::cout << " " << k << ": " << _mi[k];
}
std::cout << std::endl;
std::cout << "sigma:";
for (k = 0; k < _number_of_tissues; k++) {
std::cout << " " << k << ": " << sqrt(_sigma[k]);
}
std::cout << std::endl;
}
void EMBase::PrintGMM()
{
int k;
Print();
std::cout << "c:";
for (k = 0; k < _number_of_tissues; k++) {
std::cout << " " << k << ": " << _c[k];
}
std::cout << std::endl;
}
double EMBase::Iterate(int)
{
this->EStep();
this->MStep();
Print();
return LogLikelihood();
}
double EMBase::IterateGMM(int iteration, bool equal_var, bool uniform_prior)
{
if (iteration > 1) this->EStepGMM();
if (equal_var) this->MStepVarGMM(uniform_prior);
else this->MStepGMM(uniform_prior);
PrintGMM();
return LogLikelihoodGMM();
}
double EMBase::LogLikelihood()
{
int i, k;
double temp, f;
std::cout<< "Log likelihood: ";
Array<Gaussian> G(_number_of_tissues);
Array<double> gv(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
G[k].Initialise( _mi[k], _sigma[k]);
}
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
_output.First();
f = 0;
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
temp = 0;
double max = 0;
int max_k = 0;
for (k=0; k < _number_of_tissues; k++) {
// Estimation of gaussian probability of intensity (*ptr) for tissue k
gv[k] = G[k].Evaluate(*ptr);
if( gv[k] > 1 ) gv[k] = 1.0;
if( max < gv[k] )
{
max_k = k;
max = gv[k];
}
// Probability that current voxel is from tissue k
temp += gv[k] * _output.GetValue(k);
}
if ((temp > 0) && (temp <= 1)) {
f += log(temp);
}
}
ptr++;
pm++;
_output.Next();
}
f = -f;
double diff, rel_diff;
diff = _f-f;
if (_f == 0) rel_diff = 1;
else rel_diff = diff/_f;
_f=f;
std::cout << "f= "<< f << " diff = " << diff << " rel_diff = " << rel_diff <<std::endl;
return rel_diff;
}
double EMBase::LogLikelihoodGMM()
{
int i, k;
double temp, f;
std::cout<< "Log likelihood GMM: ";
Array<Gaussian> G(_number_of_tissues);
Array<double> gv(_number_of_tissues);
for (k = 0; k < _number_of_tissues; k++) {
G[k].Initialise( _mi[k], _sigma[k]);
}
RealPixel *ptr = _input.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
_output.First();
f = 0;
for (i = 0; i < _number_of_voxels; i++) {
if (*pm == 1) {
temp = 0;
for (k=0; k < _number_of_tissues; k++) {
// Estimation of gaussian probability of intensity (*ptr) for tissue k
gv[k] = G[k].Evaluate(*ptr);
// Probability that current voxel is from tissue k
temp += gv[k] * _c[k];
}
if ((temp > 0) && (temp <= 1)) {
f += log(temp);
}
}
ptr++;
pm++;
_output.Next();
}
f = -f;
double diff, rel_diff;
diff = _f-f;
if (_f == 0) rel_diff = 1;
else rel_diff = diff/_f;
_f=f;
std::cout << "f= "<< f << " diff = " << diff << " rel_diff = " << rel_diff <<std::endl;
return rel_diff;
}
void EMBase::ConstructSegmentation(IntegerImage &segmentation)
{
int i, j, m;
RealPixel max;
std::cout<<"Constructing segmentation"<<std::endl;
// Initialize pointers of probability maps
_output.First();
// Initialize segmentation to same size as input
segmentation = IntegerImage(_input.Attributes());
RealPixel *ptr = _input.GetPointerToVoxels();
int *sptr = segmentation.GetPointerToVoxels();
BytePixel *pm = _mask.GetPointerToVoxels();
for (i = 0; i < _number_of_voxels; i++) {
m = 0;
if (*pm == 1) {
max = 0;
for (j = 0; j < _number_of_tissues; j++) {
if (_output.GetValue(j) > max) {
max = _output.GetValue(j);
m = j+1;
if ( _has_background && (j+1) == _number_of_tissues) m=0;
}
}
if(max==0){
int x,y,z;
int index=i;
z = index / (_input.GetX() * _input.GetY());
index -= z * (_input.GetX() * _input.GetY());
x = index % _input.GetX();
y = index / _input.GetX();
std::cerr<<"voxel at "<<x<<","<<y<<","<<z<<" has 0 prob"<<std::endl;
}
}
*sptr = m;
sptr++;
ptr++;
pm++;
_output.Next();
}
}
void EMBase::ConstructSegmentation()
{
ConstructSegmentation(_segmentation);
}
void EMBase::GetProbMap(int i,RealImage& image){
if (i < _number_of_tissues) {
image = _output.GetImage(i);
} else {
std::cerr << "HashProbabilisticAtlas::Write: No such probability map" << std::endl;
exit(1);
}
}
void EMBase::WriteProbMap(int i, const char *filename)
{
if (i < _number_of_tissues) {
_output.GetImage(i).Write(filename);
} else {
std::cerr << "HashProbabilisticAtlas::Write: No such probability map" << std::endl;
exit(1);
}
}
void EMBase::WriteGaussianParameters(const char *file_name, int flag)
{
std::cout << "Writing GaussianDistributionParameters: " << file_name << std::endl;
ofstream fileOut(file_name);
if (!fileOut) {
std::cerr << "Can't open file " << file_name << std::endl;
exit(1);
}
int k,l,m;
if(flag){
// out put without names
for (k=0; k<_number_of_tissues; k++) {
fileOut << _mi[k] << " " << _sigma[k] << std::endl;
}
}else{
// out put with names
fileOut << "mi: " <<std::endl;
for (k=0; k<_number_of_tissues; k++) {
fileOut << "Tissue " << k << ": (";
for (l=0; l < 1/*_input.GetNumberOfChannels()*/; l++) {
fileOut << _mi[k];//.Get(l);
if (l == 0/*_input.GetNumberOfChannels() - 1*/) fileOut << ")" << std::endl;
else fileOut << ", ";
}
}
fileOut << "sigma: " << std::endl;
for (k=0; k<_number_of_tissues; k++) {
fileOut << "Tissue " << k << ": (";
//<<std::endl << "(";
for (l=0; l < 1/*_input.GetNumberOfChannels()*/; l++) {
//fileOut << "(";
for (m = 0; m < 1/*_input.GetNumberOfChannels()*/; m++) {
double s = _sigma[k];//.Get(m,l);
if ( s >= 0) fileOut << sqrt(s);
else fileOut << -sqrt(-s);
}
}
//if (l == 0/*_input.GetNumberOfChannels() - 1*/) fileOut << ")" << std::endl;
fileOut << ")" << std::endl;
}
}
}
void EMBase::WriteWeights(const char *filename)
{
RealImage w(_weights);
RealPixel *pw = w.GetPointerToVoxels();
int i;
double sigma_min=_sigma[0];
for (i = 1; i < _number_of_tissues; i++) {
if (sigma_min > _sigma[i]) sigma_min = _sigma[i];
}
std::cerr<<"sigma min = "<<sigma_min<<std::endl;
for (i=0; i<w.GetNumberOfVoxels(); i++) {
if (*pw != _padding) *pw=(*pw) * sigma_min * 100;
pw++;
}
w.Write(filename);
}
double EMBase::PointLogLikelihoodGMM(double x)
{
int k;
double temp=0;
for (k = 0; k < _number_of_tissues; k++) {
temp += _G[k].Evaluate(x) * _c[k];
}
if (-log(temp)> 1000000) exit(1);
if ((temp > 1) || (temp < 0)) {
std::cerr << "Could not compute likelihood, probability out of range = " << temp << std::endl;
exit(1);
}
return -log(temp);
}
void EMBase::GInit()
{
_G.resize(_number_of_tissues);
for (int i = 0; i < _number_of_tissues; ++i) {
_G[i].Initialise(_mi[i], _sigma[i]);
}
}
void EMBase::setSuperlabels(int *superlabels)
{
for (int i = 0; i < _number_of_tissues; ++i) {
_super[i] = superlabels[i];
}
_superlabels=true;
}
void EMBase::GetProportions(double *proportions)
{
for(int i = 0; i < _number_of_tissues; ++i) {
proportions[i] = _c[i];
}
}
template EMBase::EMBase(int, RealImage **, RealImage *);
template EMBase::EMBase(int, HashRealImage **, HashRealImage *);
template EMBase::EMBase(int, RealImage **);
template EMBase::EMBase(int, HashRealImage **);
template EMBase::EMBase(int, RealImage **, RealImage **);
template EMBase::EMBase(int, HashRealImage **, HashRealImage **);
template void EMBase::addProbabilityMap(RealImage image);
template void EMBase::addProbabilityMap(HashRealImage image);
template void EMBase::addBackground(RealImage image);
template void EMBase::addBackground(HashRealImage image);
} // namespace mirtk | 23.221172 | 133 | 0.589303 | MIRTK |
f34018b38a84f45fef0b9b1dae7b58a1c53a7c46 | 1,350 | cpp | C++ | hippo/src/input/keyboard.cpp | progrematic/hippo | fefc65b7db5468ef29f0ca1d1e42a4b62c255b64 | [
"MIT"
] | 11 | 2021-05-10T14:57:59.000Z | 2022-03-14T06:37:31.000Z | hippo/src/input/keyboard.cpp | progrematic/hippo | fefc65b7db5468ef29f0ca1d1e42a4b62c255b64 | [
"MIT"
] | null | null | null | hippo/src/input/keyboard.cpp | progrematic/hippo | fefc65b7db5468ef29f0ca1d1e42a4b62c255b64 | [
"MIT"
] | 8 | 2021-07-13T13:16:42.000Z | 2022-03-22T16:52:13.000Z | #include "hippo/input/keyboard.h"
#include "hippo/log.h"
#include <algorithm>
#include "SDL2/SDL_keyboard.h"
namespace hippo::input
{
std::array<bool, Keyboard::KeyCount> Keyboard::keys;
std::array<bool, Keyboard::KeyCount> Keyboard::keysLast;
void Keyboard::Initialize()
{
std::fill(keys.begin(), keys.end(), false);
std::fill(keysLast.begin(), keysLast.end(), false);
}
void Keyboard::Update()
{
keysLast = keys;
const Uint8* state = SDL_GetKeyboardState(nullptr);
for (int i = HIPPO_INPUT_KEY_FIRST; i < KeyCount; i++)
{
keys[i] = state[i];
}
}
bool Keyboard::Key(int key)
{
HIPPO_ASSERT(key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount, "Invalid keyboard key!");
if (key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount)
{
return keys[key];
}
return false;
}
bool Keyboard::KeyDown(int key)
{
HIPPO_ASSERT(key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount, "Invalid keyboard key!");
if (key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount)
{
return keys[key] && !keysLast[key];
}
return false;
}
bool Keyboard::KeyUp(int key)
{
HIPPO_ASSERT(key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount, "Invalid keyboard key!");
if (key >= HIPPO_INPUT_KEY_FIRST && key < KeyCount)
{
return !keys[key] && keysLast[key];
}
return false;
}
} | 23.275862 | 89 | 0.637778 | progrematic |
f34062ec29c0bfb11b1a8912f673f016913244e8 | 1,802 | cpp | C++ | SearchEngine/SortingProperty.cpp | AnnaKrykora/indexer-plus-plus | 99998b5205bf80ada23e2fdbd6aa2cc6be7f5ed1 | [
"MIT"
] | 59 | 2016-07-27T20:36:04.000Z | 2022-02-21T07:39:43.000Z | SearchEngine/SortingProperty.cpp | Stateford/indexer-plus-plus | 6ffc46d85a00fd83f0117b358ffe3eaae82ea575 | [
"MIT"
] | 43 | 2016-08-18T15:59:50.000Z | 2021-01-18T09:16:50.000Z | SearchEngine/SortingProperty.cpp | Stateford/indexer-plus-plus | 6ffc46d85a00fd83f0117b358ffe3eaae82ea575 | [
"MIT"
] | 13 | 2016-07-28T16:08:41.000Z | 2020-12-17T06:06:27.000Z | // This file is the part of the Indexer++ project.
// Copyright (C) 2016 Anna Krykora <krykoraanna@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
#include "SortingProperty.h"
namespace indexer {
SortingProperty PropertyNameToSortingPropertyEnum(std::string prop_name) {
if (prop_name == "Name") return SortingProperty::SORT_NAME;
if (prop_name == "Path") return SortingProperty::SORT_PATH;
if (prop_name == "Size") return SortingProperty::SORT_SIZE;
if (prop_name == "Date created") return SortingProperty::SORT_CREATION_TIME;
if (prop_name == "Date modified") return SortingProperty::SORT_LASTWRITE_TIME;
if (prop_name == "Date accessed") return SortingProperty::SORT_LASTACCESS_TIME;
if (prop_name == "Extension") return SortingProperty::SORT_EXTENSION;
if (prop_name == "Type") return SortingProperty::SORT_TYPE;
return SortingProperty::SORT_NOTSUPPORTED_COLUMNS;
}
std::wstring SortingPropertyEnumToPropertyName(SortingProperty prop) {
if (prop == SortingProperty::SORT_NAME) return L"Name";
if (prop == SortingProperty::SORT_PATH) return L"Path";
if (prop == SortingProperty::SORT_SIZE) return L"Size";
if (prop == SortingProperty::SORT_CREATION_TIME) return L"Date created";
if (prop == SortingProperty::SORT_LASTWRITE_TIME) return L"Date modified";
if (prop == SortingProperty::SORT_LASTACCESS_TIME) return L"Date accessed";
if (prop == SortingProperty::SORT_EXTENSION) return L"Extension";
if (prop == SortingProperty::SORT_TYPE) return L"Type";
return L"Not supported column";
}
} // namespace indexer | 48.702703 | 101 | 0.689234 | AnnaKrykora |
f3421fa9f1a2c98b318a9761005c572ca1c53f6b | 24,678 | cc | C++ | src/common/json.cc | asprasad/xgboost | bb47fd8c496ccd25e6499f722f0d9f2ee3965500 | [
"Apache-2.0"
] | null | null | null | src/common/json.cc | asprasad/xgboost | bb47fd8c496ccd25e6499f722f0d9f2ee3965500 | [
"Apache-2.0"
] | 1 | 2022-02-01T16:14:41.000Z | 2022-02-01T16:14:41.000Z | src/common/json.cc | asprasad/xgboost | bb47fd8c496ccd25e6499f722f0d9f2ee3965500 | [
"Apache-2.0"
] | null | null | null | /*!
* Copyright (c) by Contributors 2019-2022
*/
#include "xgboost/json.h"
#include <dmlc/endian.h>
#include <cctype>
#include <cmath>
#include <cstddef>
#include <iterator>
#include <limits>
#include <sstream>
#include "./math.h"
#include "charconv.h"
#include "xgboost/base.h"
#include "xgboost/json_io.h"
#include "xgboost/logging.h"
#include "xgboost/string_view.h"
namespace xgboost {
void JsonWriter::Save(Json json) { json.Ptr()->Save(this); }
void JsonWriter::Visit(JsonArray const* arr) {
this->WriteArray(arr, [](auto const& v) { return v; });
}
void JsonWriter::Visit(F32Array const* arr) {
this->WriteArray(arr, [](float v) { return Json{v}; });
}
namespace {
auto to_i64 = [](auto v) { return Json{static_cast<int64_t>(v)}; };
} // anonymous namespace
void JsonWriter::Visit(U8Array const* arr) { this->WriteArray(arr, to_i64); }
void JsonWriter::Visit(I32Array const* arr) { this->WriteArray(arr, to_i64); }
void JsonWriter::Visit(I64Array const* arr) { this->WriteArray(arr, to_i64); }
void JsonWriter::Visit(JsonObject const* obj) {
stream_->emplace_back('{');
size_t i = 0;
size_t size = obj->GetObject().size();
for (auto& value : obj->GetObject()) {
auto s = String{value.first};
this->Visit(&s);
stream_->emplace_back(':');
this->Save(value.second);
if (i != size-1) {
stream_->emplace_back(',');
}
i++;
}
stream_->emplace_back('}');
}
void JsonWriter::Visit(JsonNumber const* num) {
char number[NumericLimits<float>::kToCharsSize];
auto res = to_chars(number, number + sizeof(number), num->GetNumber());
auto end = res.ptr;
auto ori_size = stream_->size();
stream_->resize(stream_->size() + end - number);
std::memcpy(stream_->data() + ori_size, number, end - number);
}
void JsonWriter::Visit(JsonInteger const* num) {
char i2s_buffer_[NumericLimits<int64_t>::kToCharsSize];
auto i = num->GetInteger();
auto ret = to_chars(i2s_buffer_, i2s_buffer_ + NumericLimits<int64_t>::kToCharsSize, i);
auto end = ret.ptr;
CHECK(ret.ec == std::errc());
auto digits = std::distance(i2s_buffer_, end);
auto ori_size = stream_->size();
stream_->resize(ori_size + digits);
std::memcpy(stream_->data() + ori_size, i2s_buffer_, digits);
}
void JsonWriter::Visit(JsonNull const* ) {
auto s = stream_->size();
stream_->resize(s + 4);
auto& buf = (*stream_);
buf[s + 0] = 'n';
buf[s + 1] = 'u';
buf[s + 2] = 'l';
buf[s + 3] = 'l';
}
void JsonWriter::Visit(JsonString const* str) {
std::string buffer;
buffer += '"';
auto const& string = str->GetString();
for (size_t i = 0; i < string.length(); i++) {
const char ch = string[i];
if (ch == '\\') {
if (i < string.size() && string[i+1] == 'u') {
buffer += "\\";
} else {
buffer += "\\\\";
}
} else if (ch == '"') {
buffer += "\\\"";
} else if (ch == '\b') {
buffer += "\\b";
} else if (ch == '\f') {
buffer += "\\f";
} else if (ch == '\n') {
buffer += "\\n";
} else if (ch == '\r') {
buffer += "\\r";
} else if (ch == '\t') {
buffer += "\\t";
} else if (static_cast<uint8_t>(ch) <= 0x1f) {
// Unit separator
char buf[8];
snprintf(buf, sizeof buf, "\\u%04x", ch);
buffer += buf;
} else {
buffer += ch;
}
}
buffer += '"';
auto s = stream_->size();
stream_->resize(s + buffer.size());
std::memcpy(stream_->data() + s, buffer.data(), buffer.size());
}
void JsonWriter::Visit(JsonBoolean const* boolean) {
bool val = boolean->GetBoolean();
auto s = stream_->size();
if (val) {
stream_->resize(s + 4);
auto& buf = (*stream_);
buf[s + 0] = 't';
buf[s + 1] = 'r';
buf[s + 2] = 'u';
buf[s + 3] = 'e';
} else {
stream_->resize(s + 5);
auto& buf = (*stream_);
buf[s + 0] = 'f';
buf[s + 1] = 'a';
buf[s + 2] = 'l';
buf[s + 3] = 's';
buf[s + 4] = 'e';
}
}
// Value
std::string Value::TypeStr() const {
switch (kind_) {
case ValueKind::kString:
return "String";
case ValueKind::kNumber:
return "Number";
case ValueKind::kObject:
return "Object";
case ValueKind::kArray:
return "Array";
case ValueKind::kBoolean:
return "Boolean";
case ValueKind::kNull:
return "Null";
case ValueKind::kInteger:
return "Integer";
case ValueKind::kNumberArray:
return "F32Array";
case ValueKind::kU8Array:
return "U8Array";
case ValueKind::kI32Array:
return "I32Array";
case ValueKind::kI64Array:
return "I64Array";
}
return "";
}
// Only used for keeping old compilers happy about non-reaching return
// statement.
Json& DummyJsonObject() {
static Json obj;
return obj;
}
Json& Value::operator[](std::string const&) {
LOG(FATAL) << "Object of type " << TypeStr() << " can not be indexed by string.";
return DummyJsonObject();
}
Json& Value::operator[](int) {
LOG(FATAL) << "Object of type " << TypeStr() << " can not be indexed by Integer.";
return DummyJsonObject();
}
// Json Object
JsonObject::JsonObject(JsonObject&& that) noexcept : Value(ValueKind::kObject) {
std::swap(that.object_, this->object_);
}
JsonObject::JsonObject(std::map<std::string, Json>&& object) noexcept
: Value(ValueKind::kObject), object_{std::forward<std::map<std::string, Json>>(object)} {}
bool JsonObject::operator==(Value const& rhs) const {
if (!IsA<JsonObject>(&rhs)) {
return false;
}
return object_ == Cast<JsonObject const>(&rhs)->GetObject();
}
void JsonObject::Save(JsonWriter* writer) const { writer->Visit(this); }
// Json String
bool JsonString::operator==(Value const& rhs) const {
if (!IsA<JsonString>(&rhs)) { return false; }
return Cast<JsonString const>(&rhs)->GetString() == str_;
}
// FIXME: UTF-8 parsing support.
void JsonString::Save(JsonWriter* writer) const { writer->Visit(this); }
// Json Array
JsonArray::JsonArray(JsonArray&& that) noexcept : Value(ValueKind::kArray) {
std::swap(that.vec_, this->vec_);
}
bool JsonArray::operator==(Value const& rhs) const {
if (!IsA<JsonArray>(&rhs)) {
return false;
}
auto& arr = Cast<JsonArray const>(&rhs)->GetArray();
if (vec_.size() != arr.size()) {
return false;
}
return std::equal(arr.cbegin(), arr.cend(), vec_.cbegin());
}
void JsonArray::Save(JsonWriter* writer) const { writer->Visit(this); }
// typed array
namespace {
// error C2668: 'fpclassify': ambiguous call to overloaded function
template <typename T>
std::enable_if_t<std::is_floating_point<T>::value, bool> IsInfMSVCWar(T v) {
return std::isinf(v);
}
template <typename T>
std::enable_if_t<std::is_integral<T>::value, bool> IsInfMSVCWar(T v) {
return false;
}
} // namespace
template <typename T, Value::ValueKind kind>
void JsonTypedArray<T, kind>::Save(JsonWriter* writer) const {
writer->Visit(this);
}
template <typename T, Value::ValueKind kind>
bool JsonTypedArray<T, kind>::operator==(Value const& rhs) const {
if (!IsA<JsonTypedArray<T, kind>>(&rhs)) {
return false;
}
auto& arr = Cast<JsonTypedArray<T, kind> const>(&rhs)->GetArray();
if (vec_.size() != arr.size()) {
return false;
}
if (std::is_same<float, T>::value) {
for (size_t i = 0; i < vec_.size(); ++i) {
bool equal{false};
if (common::CheckNAN(vec_[i])) {
equal = common::CheckNAN(arr[i]);
} else if (IsInfMSVCWar(vec_[i])) {
equal = IsInfMSVCWar(arr[i]);
} else {
equal = (arr[i] - vec_[i] == 0);
}
if (!equal) {
return false;
}
}
return true;
}
return std::equal(arr.cbegin(), arr.cend(), vec_.cbegin());
}
template class JsonTypedArray<float, Value::ValueKind::kNumberArray>;
template class JsonTypedArray<uint8_t, Value::ValueKind::kU8Array>;
template class JsonTypedArray<int32_t, Value::ValueKind::kI32Array>;
template class JsonTypedArray<int64_t, Value::ValueKind::kI64Array>;
// Json Number
bool JsonNumber::operator==(Value const& rhs) const {
if (!IsA<JsonNumber>(&rhs)) { return false; }
auto r_num = Cast<JsonNumber const>(&rhs)->GetNumber();
if (std::isinf(number_)) {
return std::isinf(r_num);
}
if (std::isnan(number_)) {
return std::isnan(r_num);
}
return number_ - r_num == 0;
}
void JsonNumber::Save(JsonWriter* writer) const { writer->Visit(this); }
// Json Integer
bool JsonInteger::operator==(Value const& rhs) const {
if (!IsA<JsonInteger>(&rhs)) { return false; }
return integer_ == Cast<JsonInteger const>(&rhs)->GetInteger();
}
void JsonInteger::Save(JsonWriter* writer) const { writer->Visit(this); }
// Json Null
bool JsonNull::operator==(Value const& rhs) const {
if (!IsA<JsonNull>(&rhs)) { return false; }
return true;
}
void JsonNull::Save(JsonWriter* writer) const { writer->Visit(this); }
// Json Boolean
bool JsonBoolean::operator==(Value const& rhs) const {
if (!IsA<JsonBoolean>(&rhs)) { return false; }
return boolean_ == Cast<JsonBoolean const>(&rhs)->GetBoolean();
}
void JsonBoolean::Save(JsonWriter* writer) const { writer->Visit(this); }
size_t constexpr JsonReader::kMaxNumLength;
Json JsonReader::Parse() {
while (true) {
SkipSpaces();
char c = PeekNextChar();
if (c == -1) { break; }
if (c == '{') {
return ParseObject();
} else if ( c == '[' ) {
return ParseArray();
} else if ( c == '-' || std::isdigit(c) ||
c == 'N' || c == 'I') {
// For now we only accept `NaN`, not `nan` as the later violates LR(1) with `null`.
return ParseNumber();
} else if ( c == '\"' ) {
return ParseString();
} else if ( c == 't' || c == 'f' ) {
return ParseBoolean();
} else if (c == 'n') {
return ParseNull();
} else {
Error("Unknown construct");
}
}
return {};
}
Json JsonReader::Load() {
Json result = Parse();
return result;
}
void JsonReader::Error(std::string msg) const {
// just copy it.
std::stringstream str_s;
str_s << raw_str_.substr(0, raw_str_.size());
msg += ", around character position: " + std::to_string(cursor_.Pos());
msg += '\n';
if (cursor_.Pos() == 0) {
LOG(FATAL) << msg << ", \"" << str_s.str() << " \"";
}
constexpr size_t kExtend = 8;
auto beg = static_cast<int64_t>(cursor_.Pos()) -
static_cast<int64_t>(kExtend) < 0 ? 0 : cursor_.Pos() - kExtend;
auto end = cursor_.Pos() + kExtend >= raw_str_.size() ?
raw_str_.size() : cursor_.Pos() + kExtend;
auto raw_portion = raw_str_.substr(beg, end - beg);
std::string portion;
for (auto c : raw_portion) {
if (c == '\n') {
portion += "\\n";
} else if (c == '\0') {
portion += "\\0";
} else {
portion += c;
}
}
msg += " ";
msg += portion;
msg += '\n';
msg += " ";
for (size_t i = beg; i < cursor_.Pos() - 1; ++i) {
msg += '~';
}
msg += '^';
for (size_t i = cursor_.Pos(); i < end; ++i) {
msg += '~';
}
LOG(FATAL) << msg;
}
namespace {
bool IsSpace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
} // anonymous namespace
// Json class
void JsonReader::SkipSpaces() {
while (cursor_.Pos() < raw_str_.size()) {
char c = raw_str_[cursor_.Pos()];
if (IsSpace(c)) {
cursor_.Forward();
} else {
break;
}
}
}
void ParseStr(std::string const& str) {
size_t end = 0;
for (size_t i = 0; i < str.size(); ++i) {
if (str[i] == '"' && i > 0 && str[i-1] != '\\') {
end = i;
break;
}
}
std::string result;
result.resize(end);
}
Json JsonReader::ParseString() {
char ch { GetConsecutiveChar('\"') }; // NOLINT
std::ostringstream output;
std::string str;
while (true) {
ch = GetNextChar();
if (ch == '\\') {
char next = static_cast<char>(GetNextChar());
switch (next) {
case 'r': str += u8"\r"; break;
case 'n': str += u8"\n"; break;
case '\\': str += u8"\\"; break;
case 't': str += u8"\t"; break;
case '\"': str += u8"\""; break;
case 'u':
str += ch;
str += 'u';
break;
default: Error("Unknown escape");
}
} else {
if (ch == '\"') break;
str += ch;
}
if (ch == EOF || ch == '\r' || ch == '\n') {
Expect('\"', ch);
}
}
return Json(std::move(str));
}
Json JsonReader::ParseNull() {
char ch = GetNextNonSpaceChar();
std::string buffer{ch};
for (size_t i = 0; i < 3; ++i) {
buffer.push_back(GetNextChar());
}
if (buffer != "null") {
Error("Expecting null value \"null\"");
}
return Json{JsonNull()};
}
Json JsonReader::ParseArray() {
std::vector<Json> data;
char ch { GetConsecutiveChar('[') }; // NOLINT
while (true) {
if (PeekNextChar() == ']') {
GetConsecutiveChar(']');
return Json(std::move(data));
}
auto obj = Parse();
data.emplace_back(obj);
ch = GetNextNonSpaceChar();
if (ch == ']') break;
if (ch != ',') {
Expect(',', ch);
}
}
return Json(std::move(data));
}
Json JsonReader::ParseObject() {
GetConsecutiveChar('{');
std::map<std::string, Json> data;
SkipSpaces();
char ch = PeekNextChar();
if (ch == '}') {
GetConsecutiveChar('}');
return Json(std::move(data));
}
while (true) {
SkipSpaces();
ch = PeekNextChar();
CHECK_NE(ch, -1) << "cursor_.Pos(): " << cursor_.Pos() << ", "
<< "raw_str_.size():" << raw_str_.size();
if (ch != '"') {
Expect('"', ch);
}
Json key = ParseString();
ch = GetNextNonSpaceChar();
if (ch != ':') {
Expect(':', ch);
}
Json value { Parse() };
data[get<String>(key)] = std::move(value);
ch = GetNextNonSpaceChar();
if (ch == '}') break;
if (ch != ',') {
Expect(',', ch);
}
}
return Json(std::move(data));
}
Json JsonReader::ParseNumber() {
// Adopted from sajson with some simplifications and small optimizations.
char const* p = raw_str_.c_str() + cursor_.Pos();
char const* const beg = p; // keep track of current pointer
// TODO(trivialfis): Add back all the checks for number
if (XGBOOST_EXPECT(*p == 'N', false)) {
GetConsecutiveChar('N');
GetConsecutiveChar('a');
GetConsecutiveChar('N');
return Json(static_cast<Number::Float>(std::numeric_limits<float>::quiet_NaN()));
}
bool negative = false;
switch (*p) {
case '-': {
negative = true;
++p;
break;
}
case '+': {
negative = false;
++p;
break;
}
default: {
break;
}
}
if (XGBOOST_EXPECT(*p == 'I', false)) {
cursor_.Forward(std::distance(beg, p)); // +/-
for (auto i : {'I', 'n', 'f', 'i', 'n', 'i', 't', 'y'}) {
GetConsecutiveChar(i);
}
auto f = std::numeric_limits<float>::infinity();
if (negative) {
f = -f;
}
return Json(static_cast<Number::Float>(f));
}
bool is_float = false;
int64_t i = 0;
if (*p == '0') {
i = 0;
p++;
}
while (XGBOOST_EXPECT(*p >= '0' && *p <= '9', true)) {
i = i * 10 + (*p - '0');
p++;
}
if (*p == '.') {
p++;
is_float = true;
while (*p >= '0' && *p <= '9') {
i = i * 10 + (*p - '0');
p++;
}
}
if (*p == 'E' || *p == 'e') {
is_float = true;
p++;
switch (*p) {
case '-':
case '+': {
p++;
break;
}
default:
break;
}
if (XGBOOST_EXPECT(*p >= '0' && *p <= '9', true)) {
p++;
while (*p >= '0' && *p <= '9') {
p++;
}
} else {
Error("Expecting digit");
}
}
auto moved = std::distance(beg, p);
this->cursor_.Forward(moved);
if (is_float) {
float f;
auto ret = from_chars(beg, p, f);
if (XGBOOST_EXPECT(ret.ec != std::errc(), false)) {
// Compatible with old format that generates very long mantissa from std stream.
f = std::strtof(beg, nullptr);
}
return Json(static_cast<Number::Float>(f));
} else {
if (negative) {
i = -i;
}
return Json(JsonInteger(i));
}
}
Json JsonReader::ParseBoolean() {
bool result = false;
char ch = GetNextNonSpaceChar();
std::string const t_value = u8"true";
std::string const f_value = u8"false";
std::string buffer;
if (ch == 't') {
GetConsecutiveChar('r');
GetConsecutiveChar('u');
GetConsecutiveChar('e');
result = true;
} else {
GetConsecutiveChar('a');
GetConsecutiveChar('l');
GetConsecutiveChar('s');
GetConsecutiveChar('e');
result = false;
}
return Json{JsonBoolean{result}};
}
Json Json::Load(StringView str, std::ios::openmode mode) {
Json json;
if (mode & std::ios::binary) {
UBJReader reader{str};
json = Json::Load(&reader);
} else {
JsonReader reader(str);
json = reader.Load();
}
return json;
}
Json Json::Load(JsonReader* reader) {
Json json{reader->Load()};
return json;
}
void Json::Dump(Json json, std::string* str, std::ios::openmode mode) {
std::vector<char> buffer;
Dump(json, &buffer, mode);
str->resize(buffer.size());
std::copy(buffer.cbegin(), buffer.cend(), str->begin());
}
void Json::Dump(Json json, std::vector<char>* str, std::ios::openmode mode) {
str->clear();
if (mode & std::ios::binary) {
UBJWriter writer{str};
writer.Save(json);
} else {
JsonWriter writer(str);
writer.Save(json);
}
}
void Json::Dump(Json json, JsonWriter* writer) {
writer->Save(json);
}
static_assert(std::is_nothrow_move_constructible<Json>::value, "");
static_assert(std::is_nothrow_move_constructible<Object>::value, "");
static_assert(std::is_nothrow_move_constructible<Array>::value, "");
static_assert(std::is_nothrow_move_constructible<String>::value, "");
Json UBJReader::ParseArray() {
auto marker = PeekNextChar();
if (marker == '$') { // typed array
GetNextChar(); // remove $
marker = GetNextChar();
auto type = marker;
GetConsecutiveChar('#');
GetConsecutiveChar('L');
auto n = this->ReadPrimitive<int64_t>();
marker = PeekNextChar();
switch (type) {
case 'd':
return ParseTypedArray<F32Array>(n);
case 'U':
return ParseTypedArray<U8Array>(n);
case 'l':
return ParseTypedArray<I32Array>(n);
case 'L':
return ParseTypedArray<I64Array>(n);
default:
LOG(FATAL) << "`" + std::string{type} + "` is not supported for typed array."; // NOLINT
}
}
std::vector<Json> results;
if (marker == '#') { // array with length optimization
GetNextChar();
GetConsecutiveChar('L');
auto n = this->ReadPrimitive<int64_t>();
results.resize(n);
for (int64_t i = 0; i < n; ++i) {
results[i] = Parse();
}
} else { // normal array
while (marker != ']') {
results.emplace_back(Parse());
marker = PeekNextChar();
}
GetConsecutiveChar(']');
}
return Json{results};
}
std::string UBJReader::DecodeStr() {
// only L is supported right now.
GetConsecutiveChar('L');
auto bsize = this->ReadPrimitive<int64_t>();
std::string str;
str.resize(bsize);
auto ptr = raw_str_.c_str() + cursor_.Pos();
std::memcpy(&str[0], ptr, bsize);
this->cursor_.Forward(bsize);
return str;
}
Json UBJReader::ParseObject() {
auto marker = PeekNextChar();
std::map<std::string, Json> results;
while (marker != '}') {
auto str = this->DecodeStr();
results.emplace(str, this->Parse());
marker = PeekNextChar();
}
GetConsecutiveChar('}');
return Json{std::move(results)};
}
Json UBJReader::Load() {
Json result = Parse();
return result;
}
Json UBJReader::Parse() {
while (true) {
char c = PeekNextChar();
if (c == -1) {
break;
}
GetNextChar();
switch (c) {
case '{':
return ParseObject();
case '[':
return ParseArray();
case 'Z': {
return Json{nullptr};
}
case 'T': {
return Json{JsonBoolean{true}};
}
case 'F': {
return Json{JsonBoolean{true}};
}
case 'd': {
auto v = this->ReadPrimitive<float>();
return Json{v};
}
case 'S': {
auto str = this->DecodeStr();
return Json{str};
}
case 'i': {
Integer::Int i = this->ReadPrimitive<int8_t>();
return Json{i};
}
case 'U': {
Integer::Int i = this->ReadPrimitive<uint8_t>();
return Json{i};
}
case 'I': {
Integer::Int i = this->ReadPrimitive<int16_t>();
return Json{i};
}
case 'l': {
Integer::Int i = this->ReadPrimitive<int32_t>();
return Json{i};
}
case 'L': {
auto i = this->ReadPrimitive<int64_t>();
return Json{i};
}
case 'C': {
Integer::Int i = this->ReadPrimitive<char>();
return Json{i};
}
case 'D': {
LOG(FATAL) << "f64 is not supported.";
}
case 'H': {
LOG(FATAL) << "High precision number is not supported.";
}
default:
Error("Unknown construct");
}
}
return {};
}
namespace {
template <typename T>
void WritePrimitive(T v, std::vector<char>* stream) {
v = ToBigEndian(v);
auto s = stream->size();
stream->resize(s + sizeof(v));
auto ptr = stream->data() + s;
std::memcpy(ptr, &v, sizeof(v));
}
void EncodeStr(std::vector<char>* stream, std::string const& string) {
stream->push_back('L');
int64_t bsize = string.size();
WritePrimitive(bsize, stream);
auto s = stream->size();
stream->resize(s + string.size());
auto ptr = stream->data() + s;
std::memcpy(ptr, string.data(), string.size());
}
} // anonymous namespace
void UBJWriter::Visit(JsonArray const* arr) {
stream_->emplace_back('[');
auto const& vec = arr->GetArray();
int64_t n = vec.size();
stream_->push_back('#');
stream_->push_back('L');
WritePrimitive(n, stream_);
for (auto const& v : vec) {
this->Save(v);
}
}
template <typename T, Value::ValueKind kind>
void WriteTypedArray(JsonTypedArray<T, kind> const* arr, std::vector<char>* stream) {
stream->emplace_back('[');
stream->push_back('$');
if (std::is_same<T, float>::value) {
stream->push_back('d');
} else if (std::is_same<T, int8_t>::value) {
stream->push_back('i');
} else if (std::is_same<T, uint8_t>::value) {
stream->push_back('U');
} else if (std::is_same<T, int32_t>::value) {
stream->push_back('l');
} else if (std::is_same<T, int64_t>::value) {
stream->push_back('L');
} else {
LOG(FATAL) << "Not implemented";
}
stream->push_back('#');
stream->push_back('L');
int64_t n = arr->Size();
WritePrimitive(n, stream);
auto s = stream->size();
stream->resize(s + arr->Size() * sizeof(T));
auto const& vec = arr->GetArray();
for (int64_t i = 0; i < n; ++i) {
auto v = ToBigEndian(vec[i]);
std::memcpy(stream->data() + s, &v, sizeof(v));
s += sizeof(v);
}
}
void UBJWriter::Visit(F32Array const* arr) { WriteTypedArray(arr, stream_); }
void UBJWriter::Visit(U8Array const* arr) { WriteTypedArray(arr, stream_); }
void UBJWriter::Visit(I32Array const* arr) { WriteTypedArray(arr, stream_); }
void UBJWriter::Visit(I64Array const* arr) { WriteTypedArray(arr, stream_); }
void UBJWriter::Visit(JsonObject const* obj) {
stream_->emplace_back('{');
for (auto const& value : obj->GetObject()) {
auto const& key = value.first;
EncodeStr(stream_, key);
this->Save(value.second);
}
stream_->emplace_back('}');
}
void UBJWriter::Visit(JsonNumber const* num) {
stream_->push_back('d');
auto val = num->GetNumber();
WritePrimitive(val, stream_);
}
void UBJWriter::Visit(JsonInteger const* num) {
auto i = num->GetInteger();
if (i > std::numeric_limits<int8_t>::min() && i < std::numeric_limits<int8_t>::max()) {
stream_->push_back('i');
WritePrimitive(static_cast<int8_t>(i), stream_);
} else if (i > std::numeric_limits<int16_t>::min() && i < std::numeric_limits<int16_t>::max()) {
stream_->push_back('I');
WritePrimitive(static_cast<int16_t>(i), stream_);
} else if (i > std::numeric_limits<int32_t>::min() && i < std::numeric_limits<int32_t>::max()) {
stream_->push_back('l');
WritePrimitive(static_cast<int32_t>(i), stream_);
} else {
stream_->push_back('L');
WritePrimitive(i, stream_);
}
}
void UBJWriter::Visit(JsonNull const* null) { stream_->push_back('Z'); }
void UBJWriter::Visit(JsonString const* str) {
stream_->push_back('S');
EncodeStr(stream_, str->GetString());
}
void UBJWriter::Visit(JsonBoolean const* boolean) {
stream_->push_back(boolean->GetBoolean() ? 'T' : 'F');
}
void UBJWriter::Save(Json json) { json.Ptr()->Save(this); }
} // namespace xgboost
| 25.079268 | 98 | 0.579139 | asprasad |
f34a5dacbb7582163b72d3d60a654716a90e8edf | 8,935 | cc | C++ | src/server/endpoint.cc | dlinten/pistache | 22d74298038cadd3a2bc5e5424d352b7e58984d9 | [
"Apache-2.0"
] | null | null | null | src/server/endpoint.cc | dlinten/pistache | 22d74298038cadd3a2bc5e5424d352b7e58984d9 | [
"Apache-2.0"
] | null | null | null | src/server/endpoint.cc | dlinten/pistache | 22d74298038cadd3a2bc5e5424d352b7e58984d9 | [
"Apache-2.0"
] | null | null | null | /* endpoint.cc
Mathieu Stefani, 22 janvier 2016
Implementation of the http endpoint
*/
#include <pistache/config.h>
#include <pistache/endpoint.h>
#include <pistache/peer.h>
#include <pistache/tcp.h>
#include <array>
#include <chrono>
namespace Pistache
{
namespace Http
{
class TransportImpl : public Tcp::Transport
{
public:
using Base = Tcp::Transport;
explicit TransportImpl(const std::shared_ptr<Tcp::Handler>& handler);
void registerPoller(Polling::Epoll& poller) override;
void onReady(const Aio::FdSet& fds) override;
void setHeaderTimeout(std::chrono::milliseconds timeout);
void setBodyTimeout(std::chrono::milliseconds timeout);
std::shared_ptr<Aio::Handler> clone() const override;
private:
std::shared_ptr<Tcp::Handler> handler_;
std::chrono::milliseconds headerTimeout_;
std::chrono::milliseconds bodyTimeout_;
int timerFd;
void checkIdlePeers();
};
TransportImpl::TransportImpl(const std::shared_ptr<Tcp::Handler>& handler)
: Tcp::Transport(handler)
, handler_(handler)
{ }
void TransportImpl::registerPoller(Polling::Epoll& poller)
{
Base::registerPoller(poller);
timerFd = TRY_RET(timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK));
static constexpr auto TimerInterval = std::chrono::milliseconds(500);
static constexpr auto TimerIntervalNs = std::chrono::duration_cast<std::chrono::nanoseconds>(TimerInterval);
static_assert(
TimerInterval < std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::seconds(1)),
"Timer frequency should be less than 1 second");
itimerspec spec;
spec.it_value.tv_sec = 0;
spec.it_value.tv_nsec = TimerIntervalNs.count();
spec.it_interval.tv_sec = 0;
spec.it_interval.tv_nsec = TimerIntervalNs.count();
TRY(timerfd_settime(timerFd, 0, &spec, 0));
Polling::Tag tag(timerFd);
poller.addFd(timerFd, Flags<Polling::NotifyOn>(Polling::NotifyOn::Read), Polling::Tag(timerFd));
}
void TransportImpl::onReady(const Aio::FdSet& fds)
{
bool handled = false;
for (const auto& entry : fds)
{
if (entry.getTag() == Polling::Tag(timerFd))
{
uint64_t wakeups;
::read(timerFd, &wakeups, sizeof wakeups);
checkIdlePeers();
handled = true;
}
}
if (!handled)
Base::onReady(fds);
}
void TransportImpl::setHeaderTimeout(std::chrono::milliseconds timeout)
{
headerTimeout_ = timeout;
}
void TransportImpl::setBodyTimeout(std::chrono::milliseconds timeout)
{
bodyTimeout_ = timeout;
}
void TransportImpl::checkIdlePeers()
{
std::vector<std::shared_ptr<Tcp::Peer>> idlePeers;
for (const auto& peerPair : peers)
{
const auto& peer = peerPair.second;
auto parser = Http::Handler::getParser(peer);
auto time = parser->time();
auto now = std::chrono::steady_clock::now();
auto elapsed = now - time;
auto* step = parser->step();
if (step->id() == Private::RequestLineStep::Id)
{
if (elapsed > headerTimeout_ || elapsed > bodyTimeout_)
idlePeers.push_back(peer);
}
else if (step->id() == Private::HeadersStep::Id)
{
if (elapsed > bodyTimeout_)
idlePeers.push_back(peer);
}
}
for (const auto& idlePeer : idlePeers)
{
ResponseWriter response(Http::Version::Http11, this, static_cast<Http::Handler*>(handler_.get()), idlePeer);
response.send(Http::Code::Request_Timeout).then([=, this](ssize_t) { removePeer(idlePeer); },
[=, this](const std::exception_ptr&) { removePeer(idlePeer); });
}
}
std::shared_ptr<Aio::Handler> TransportImpl::clone() const
{
auto transport = std::make_shared<TransportImpl>(handler_->clone());
transport->setHeaderTimeout(headerTimeout_);
transport->setBodyTimeout(bodyTimeout_);
return transport;
}
Endpoint::Options::Options()
: threads_(1)
, flags_()
, backlog_(Const::MaxBacklog)
, maxRequestSize_(Const::DefaultMaxRequestSize)
, maxResponseSize_(Const::DefaultMaxResponseSize)
, headerTimeout_(Const::DefaultHeaderTimeout)
, bodyTimeout_(Const::DefaultBodyTimeout)
, logger_(PISTACHE_NULL_STRING_LOGGER)
{ }
Endpoint::Options& Endpoint::Options::threads(int val)
{
threads_ = val;
return *this;
}
Endpoint::Options& Endpoint::Options::threadsName(const std::string& val)
{
threadsName_ = val;
return *this;
}
Endpoint::Options& Endpoint::Options::flags(Flags<Tcp::Options> flags)
{
flags_ = flags;
return *this;
}
Endpoint::Options& Endpoint::Options::backlog(int val)
{
backlog_ = val;
return *this;
}
Endpoint::Options& Endpoint::Options::maxRequestSize(size_t val)
{
maxRequestSize_ = val;
return *this;
}
Endpoint::Options& Endpoint::Options::maxPayload(size_t val)
{
return maxRequestSize(val);
}
Endpoint::Options& Endpoint::Options::maxResponseSize(size_t val)
{
maxResponseSize_ = val;
return *this;
}
Endpoint::Options& Endpoint::Options::logger(PISTACHE_STRING_LOGGER_T logger)
{
logger_ = logger;
return *this;
}
Endpoint::Endpoint() { }
Endpoint::Endpoint(const Address& addr)
: listener(addr)
{ }
void Endpoint::init(const Endpoint::Options& options)
{
listener.init(options.threads_, options.flags_, options.threadsName_);
listener.setTransportFactory([&] {
if (!handler_)
throw std::runtime_error("Must call setHandler()");
auto transport = std::make_shared<TransportImpl>(handler_);
transport->setHeaderTimeout(options.headerTimeout_);
transport->setBodyTimeout(options.bodyTimeout_);
return transport;
});
options_ = options;
logger_ = options.logger_;
}
void Endpoint::setHandler(const std::shared_ptr<Handler>& handler)
{
handler_ = handler;
handler_->setMaxRequestSize(options_.maxRequestSize_);
handler_->setMaxResponseSize(options_.maxResponseSize_);
}
void Endpoint::bind() { listener.bind(); }
void Endpoint::bind(const Address& addr) { listener.bind(addr); }
void Endpoint::serve() { serveImpl(&Tcp::Listener::run); }
void Endpoint::serveThreaded() { serveImpl(&Tcp::Listener::runThreaded); }
void Endpoint::shutdown() { listener.shutdown(); }
void Endpoint::useSSL(const std::string& cert, const std::string& key, bool use_compression)
{
#ifndef PISTACHE_USE_SSL
(void)cert;
(void)key;
(void)use_compression;
throw std::runtime_error("Pistache is not compiled with SSL support.");
#else
listener.setupSSL(cert, key, use_compression);
#endif /* PISTACHE_USE_SSL */
}
void Endpoint::useSSLAuth(std::string ca_file, std::string ca_path,
int (*cb)(int, void*))
{
#ifndef PISTACHE_USE_SSL
(void)ca_file;
(void)ca_path;
(void)cb;
throw std::runtime_error("Pistache is not compiled with SSL support.");
#else
listener.setupSSLAuth(ca_file, ca_path, cb);
#endif /* PISTACHE_USE_SSL */
}
Async::Promise<Tcp::Listener::Load>
Endpoint::requestLoad(const Tcp::Listener::Load& old)
{
return listener.requestLoad(old);
}
Endpoint::Options Endpoint::options() { return Options(); }
} // namespace Http
} // namespace Pistache
| 32.02509 | 128 | 0.550979 | dlinten |
f34ac9c8fbbc092e5435a0c038450cd88850425f | 12,934 | cpp | C++ | opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp | sanjaymsh/compute-runtime | 1bf270a804d47745dc6ee0bd2bf6232b2a4d835b | [
"MIT"
] | 1 | 2020-09-03T17:10:38.000Z | 2020-09-03T17:10:38.000Z | opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp | sanjaymsh/compute-runtime | 1bf270a804d47745dc6ee0bd2bf6232b2a4d835b | [
"MIT"
] | null | null | null | opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp | sanjaymsh/compute-runtime | 1bf270a804d47745dc6ee0bd2bf6232b2a4d835b | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_gmm.h"
#include "gtest/gtest.h"
#include <memory>
using namespace NEO;
class GetMemObjectInfo : public ::testing::Test, public PlatformFixture, public ClDeviceFixture {
using ClDeviceFixture::SetUp;
using PlatformFixture::SetUp;
public:
void SetUp() override {
PlatformFixture::SetUp();
ClDeviceFixture::SetUp();
BufferDefaults::context = new MockContext;
}
void TearDown() override {
delete BufferDefaults::context;
ClDeviceFixture::TearDown();
PlatformFixture::TearDown();
}
};
TEST_F(GetMemObjectInfo, GivenInvalidParamsWhenGettingMemObjectInfoThenInvalidValueErrorIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
auto retVal = buffer->getMemObjectInfo(
0,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
TEST_F(GetMemObjectInfo, GivenInvalidParametersWhenGettingMemObjectInfoThenValueSizeRetIsNotUpdated) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0x1234;
auto retVal = buffer->getMemObjectInfo(
0,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
EXPECT_EQ(0x1234u, sizeReturned);
}
TEST_F(GetMemObjectInfo, GivenMemTypeWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_TYPE,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(cl_mem_object_type), sizeReturned);
cl_mem_object_type object_type = 0;
retVal = buffer->getMemObjectInfo(
CL_MEM_TYPE,
sizeof(cl_mem_object_type),
&object_type,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<cl_mem_object_type>(CL_MEM_OBJECT_BUFFER), object_type);
}
TEST_F(GetMemObjectInfo, GivenMemFlagsWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
cl_mem_flags mem_flags = 0;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_FLAGS,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(mem_flags), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_FLAGS,
sizeof(mem_flags),
&mem_flags,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<cl_mem_flags>(CL_MEM_READ_WRITE), mem_flags);
}
TEST_F(GetMemObjectInfo, GivenMemSizeWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
size_t mem_size = 0;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_SIZE,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(mem_size), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_SIZE,
sizeof(mem_size),
&mem_size,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(buffer->getSize(), mem_size);
}
TEST_F(GetMemObjectInfo, GivenMemHostPtrWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
void *host_ptr = nullptr;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_HOST_PTR,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(host_ptr), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_HOST_PTR,
sizeof(host_ptr),
&host_ptr,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(buffer->getHostPtr(), host_ptr);
}
TEST_F(GetMemObjectInfo, GivenMemContextWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
MockContext context;
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create(&context));
size_t sizeReturned = 0;
cl_context contextReturned = nullptr;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_CONTEXT,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(contextReturned), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_CONTEXT,
sizeof(contextReturned),
&contextReturned,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&context, contextReturned);
}
TEST_F(GetMemObjectInfo, GivenMemUsesSvmPointerWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<BufferUseHostPtr<>>::create());
size_t sizeReturned = 0;
cl_bool usesSVMPointer = false;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(usesSVMPointer), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
sizeof(usesSVMPointer),
&usesSVMPointer,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<cl_bool>(CL_FALSE), usesSVMPointer);
}
TEST_F(GetMemObjectInfo, GivenBufferWithMemUseHostPtrAndMemTypeWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
auto hostPtr = clSVMAlloc(BufferDefaults::context, CL_MEM_READ_WRITE, BufferUseHostPtr<>::sizeInBytes, 64);
ASSERT_NE(nullptr, hostPtr);
cl_int retVal;
auto buffer = Buffer::create(
BufferDefaults::context,
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
BufferUseHostPtr<>::sizeInBytes,
hostPtr,
retVal);
size_t sizeReturned = 0;
cl_bool usesSVMPointer = false;
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(usesSVMPointer), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
sizeof(usesSVMPointer),
&usesSVMPointer,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<cl_bool>(CL_TRUE), usesSVMPointer);
delete buffer;
clSVMFree(BufferDefaults::context, hostPtr);
}
}
TEST_F(GetMemObjectInfo, GivenMemOffsetWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
size_t offset = false;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_OFFSET,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(offset), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_OFFSET,
sizeof(offset),
&offset,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(0u, offset);
}
TEST_F(GetMemObjectInfo, GivenMemAssociatedMemobjectWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
cl_mem object = nullptr;
auto retVal = buffer->getMemObjectInfo(
CL_MEM_ASSOCIATED_MEMOBJECT,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(object), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_ASSOCIATED_MEMOBJECT,
sizeof(object),
&object,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, object);
}
TEST_F(GetMemObjectInfo, GivenMemMapCountWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
cl_uint mapCount = static_cast<uint32_t>(-1);
auto retVal = buffer->getMemObjectInfo(
CL_MEM_MAP_COUNT,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(mapCount), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_MAP_COUNT,
sizeof(mapCount),
&mapCount,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(mapCount), sizeReturned);
}
TEST_F(GetMemObjectInfo, GivenMemReferenceCountWhenGettingMemObjectInfoThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
size_t sizeReturned = 0;
cl_uint refCount = static_cast<uint32_t>(-1);
auto retVal = buffer->getMemObjectInfo(
CL_MEM_REFERENCE_COUNT,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(refCount), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_REFERENCE_COUNT,
sizeof(refCount),
&refCount,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(refCount), sizeReturned);
}
TEST_F(GetMemObjectInfo, GivenValidBufferWhenGettingCompressionOfMemObjectThenCorrectValueIsReturned) {
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
auto graphicsAllocation = buffer->getMultiGraphicsAllocation().getDefaultGraphicsAllocation();
size_t sizeReturned = 0;
cl_bool usesCompression{};
cl_int retVal{};
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_COMPRESSION_INTEL,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_EQ(sizeof(cl_bool), sizeReturned);
graphicsAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_COMPRESSION_INTEL,
sizeReturned,
&usesCompression,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(cl_bool{CL_TRUE}, usesCompression);
graphicsAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_COMPRESSION_INTEL,
sizeReturned,
&usesCompression,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(cl_bool{CL_FALSE}, usesCompression);
}
class GetMemObjectInfoLocalMemory : public GetMemObjectInfo {
using GetMemObjectInfo::SetUp;
public:
void SetUp() override {
dbgRestore = std::make_unique<DebugManagerStateRestore>();
DebugManager.flags.EnableLocalMemory.set(1);
GetMemObjectInfo::SetUp();
delete BufferDefaults::context;
BufferDefaults::context = new MockContext(pClDevice, true);
}
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
};
TEST_F(GetMemObjectInfoLocalMemory, givenLocalMemoryEnabledWhenNoZeroCopySvmAllocationUsedThenBufferAllocationInheritsZeroCopyFlag) {
const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
auto hostPtr = clSVMAlloc(BufferDefaults::context, CL_MEM_READ_WRITE, BufferUseHostPtr<>::sizeInBytes, 64);
ASSERT_NE(nullptr, hostPtr);
cl_int retVal;
auto buffer = Buffer::create(
BufferDefaults::context,
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
BufferUseHostPtr<>::sizeInBytes,
hostPtr,
retVal);
size_t sizeReturned = 0;
cl_bool usesSVMPointer = false;
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
0,
nullptr,
&sizeReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(usesSVMPointer), sizeReturned);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_SVM_POINTER,
sizeof(usesSVMPointer),
&usesSVMPointer,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(static_cast<cl_bool>(CL_TRUE), usesSVMPointer);
EXPECT_TRUE(buffer->isMemObjWithHostPtrSVM());
EXPECT_FALSE(buffer->isMemObjZeroCopy());
delete buffer;
clSVMFree(BufferDefaults::context, hostPtr);
}
}
| 30.868735 | 133 | 0.685789 | sanjaymsh |
f34dc131c2555722a1b1b690fa3d1d0a0e939584 | 3,506 | cpp | C++ | modules/task_1/bezrodnov_d_radix_sort_double_batcher/radix_sort_double_batcher.cpp | allnes/pp_2022_spring | 159191f9c2f218f8b8487f92853cc928a7652462 | [
"BSD-3-Clause"
] | null | null | null | modules/task_1/bezrodnov_d_radix_sort_double_batcher/radix_sort_double_batcher.cpp | allnes/pp_2022_spring | 159191f9c2f218f8b8487f92853cc928a7652462 | [
"BSD-3-Clause"
] | null | null | null | modules/task_1/bezrodnov_d_radix_sort_double_batcher/radix_sort_double_batcher.cpp | allnes/pp_2022_spring | 159191f9c2f218f8b8487f92853cc928a7652462 | [
"BSD-3-Clause"
] | 2 | 2022-03-31T17:48:22.000Z | 2022-03-31T18:06:07.000Z | // Copyright 2022 Bezrodnov Dmitry
#include "../../../modules/task_1/bezrodnov_d_radix_sort_double_batcher/radix_sort_double_batcher.h"
#include <random>
#include <cmath>
#include<algorithm>
std::vector<std::vector<int>> get_vector_part(const std::vector<int>& vec,
int part) {
std::vector<std::vector<int>> result(part);
int result_size = result.size();
int vec_size = vec.size();
for (int i = 0; i < result_size; i++) {
for (int j = 0; j < vec_size / part; j++) {
result[i].push_back(vec[i * (vec_size / part) + j]);
}
}
if (part * (vec_size / part) < vec_size) {
for (int i = part * (vec_size / part); i < vec_size; i++) {
result[result_size - 1].push_back(vec[i]);
}
}
return result;
}
std::vector<int> to_int(const std::vector<double>& vec, unsigned int count) {
std::vector<int> result(vec.size());
int vec_size = vec.size();
for (int i = 0; i < vec_size; i++) {
result[i] = static_cast<int>(vec[i] * pow(10, count));
}
return result;
}
std::vector<double> to_double(const std::vector<int>& vec, unsigned int count) {
std::vector<double> result(vec.size());
int vec_size = vec.size();
for (int i = 0; i < vec_size; i++) {
result[i] = static_cast<double>(vec[i]) / pow(10.0, count);
}
return result;
}
std::vector<int> counting_sort(const std::vector<int>& vec, int div) {
std::vector<int> result(vec.size());
std::vector<int> count(10, 0);
int vec_size = vec.size();
for (int i = 0; i < vec_size; i++) {
int index = (vec[i] / div) % 10;
count[index]++;
}
for (int i = 1; i < 10; i++)
count[i] += count[i - 1];
for (int i = vec_size - 1; i >= 0; i--) {
result[count[(vec[i] / div) % 10] - 1] = vec[i];
count[(vec[i] / div) % 10]--;
}
return result;
}
std::vector<double> radix_sort(const std::vector<double>& vec,
unsigned int count) {
std::vector<int> vec_int = to_int(vec, count);
int num_thread = 8;
std::vector<std::vector<int>> vector_part
= get_vector_part(vec_int, num_thread);
for (int i = 0; i < num_thread; i++) {
int m = *max_element(vector_part[i].begin(), vector_part[i].end());
for (int div = 1; m / div > 0; div *= 10) {
vector_part[i] = counting_sort(vector_part[i], div);
}
}
OddEvenMerge merge;
std::vector<int> part_all
= merge.odd_even_merge(vector_part[0], vector_part[1]);
for (int i = 2; i < num_thread; i++) {
part_all = merge.odd_even_merge(part_all, vector_part[i]);
}
std::vector<double> current_result = to_double(part_all, count);
return current_result;
}
bool check_sort(const std::vector<double>& vec) {
int vec_size = vec.size();
for (int i = 0; i < vec_size - 1; i++) {
if (vec[i] > vec[i + 1])
return false;
}
return true;
}
std::vector<double> get_random_double_vector(unsigned int elements) {
std::vector<double> result(elements);
std::uniform_real_distribution<double> unif(10.0, 120.0);
std::default_random_engine random_engine;
for (unsigned int i = 0; i < elements; i++) {
result[i] = unif(random_engine);
result[i] -= remainder(result[i], 0.001);
}
return result;
}
| 31.303571 | 100 | 0.554478 | allnes |
f34dc40cd24090eb337c0d42e224a37c223c04aa | 43,653 | cpp | C++ | sources/libengine/engine/graphics/dispatch.cpp | Gaeldrin/cage | 6399a5cdcb3932e8d422901ce7d72099dc09273c | [
"MIT"
] | null | null | null | sources/libengine/engine/graphics/dispatch.cpp | Gaeldrin/cage | 6399a5cdcb3932e8d422901ce7d72099dc09273c | [
"MIT"
] | null | null | null | sources/libengine/engine/graphics/dispatch.cpp | Gaeldrin/cage | 6399a5cdcb3932e8d422901ce7d72099dc09273c | [
"MIT"
] | null | null | null | #include <cage-core/geometry.h>
#include <cage-core/config.h>
#include <cage-core/serialization.h>
#include <cage-core/flatSet.h>
#include <cage-engine/graphics.h>
#include <cage-engine/opengl.h>
#include <cage-engine/shaderConventions.h>
#include <cage-engine/window.h>
#include "../engine.h"
#include "graphics.h"
#include "ssaoPoints.h"
#include <map>
namespace cage
{
namespace
{
ConfigSint32 visualizeBuffer("cage/graphics/visualizeBuffer", 0);
struct ShadowmapBuffer
{
private:
uint32 width = 0;
uint32 height = 0;
public:
Holder<Texture> texture;
void resize(uint32 w, uint32 h)
{
if (w == width && h == height)
return;
width = w;
height = h;
texture->bind();
if (texture->getTarget() == GL_TEXTURE_CUBE_MAP)
texture->imageCube(w, h, GL_DEPTH_COMPONENT16);
else
texture->image2d(w, h, GL_DEPTH_COMPONENT24);
CAGE_CHECK_GL_ERROR_DEBUG();
}
ShadowmapBuffer(uint32 target)
{
CAGE_ASSERT(target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_2D);
texture = newTexture(target);
texture->setDebugName("shadowmap");
texture->filters(GL_LINEAR, GL_LINEAR, 16);
texture->wraps(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
CAGE_CHECK_GL_ERROR_DEBUG();
}
};
enum class VisualizableTextureModeEnum
{
Color,
Depth2d,
DepthCube,
Monochromatic,
Velocity,
};
struct VisualizableTexture
{
Texture *tex = nullptr;
VisualizableTextureModeEnum visualizableTextureMode;
VisualizableTexture(Texture *tex, VisualizableTextureModeEnum vtm) : tex(tex), visualizableTextureMode(vtm)
{}
};
struct SsaoShader
{
mat4 viewProj;
mat4 viewProjInv;
vec4 params; // strength, bias, power, radius
ivec4 iparams; // sampleCount, frameIndex
};
struct DofShader
{
mat4 projInv;
vec4 dofNear; // near, far
vec4 dofFar; // near, far
};
struct FinalScreenShader
{
CameraTonemap tonemap; // 7 reals
real tonemapEnabled;
real eyeAdaptationKey;
real eyeAdaptationStrength;
real _dummy1;
real _dummy2;
real gamma;
real _dummy3;
real _dummy4;
real _dummy5;
};
struct CameraSpecificData
{
Holder<Texture> luminanceCollectionTexture; // w * h
Holder<Texture> luminanceAccumulationTexture; // 1 * 1
void update(uint32 w, uint32 h, CameraEffectsFlags ce)
{
if (w == width && h == height && ce == cameraEffects)
return;
width = w;
height = h;
cameraEffects = ce;
if ((ce & CameraEffectsFlags::EyeAdaptation) == CameraEffectsFlags::EyeAdaptation)
{
if (luminanceCollectionTexture)
luminanceCollectionTexture->bind();
else
{
luminanceCollectionTexture = newTexture();
luminanceCollectionTexture->setDebugName("luminanceCollectionTexture");
luminanceCollectionTexture->filters(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, 0);
luminanceCollectionTexture->wraps(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
}
luminanceCollectionTexture->image2d(max(w / CAGE_SHADER_LUMINANCE_DOWNSCALE, 1u), max(h / CAGE_SHADER_LUMINANCE_DOWNSCALE, 1u), GL_R16F);
if (luminanceAccumulationTexture)
luminanceAccumulationTexture->bind();
else
{
luminanceAccumulationTexture = newTexture();
luminanceAccumulationTexture->setDebugName("luminanceAccumulationTexture");
luminanceAccumulationTexture->filters(GL_NEAREST, GL_NEAREST, 0);
luminanceAccumulationTexture->wraps(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
}
luminanceAccumulationTexture->image2d(1, 1, GL_R16F);
CAGE_CHECK_GL_ERROR_DEBUG();
}
else
{
luminanceCollectionTexture.clear();
luminanceAccumulationTexture.clear();
}
}
private:
uint32 width = 0;
uint32 height = 0;
CameraEffectsFlags cameraEffects = CameraEffectsFlags::None;
};
struct UboCache
{
// double buffered ring buffer of uniform buffers :D
std::vector<Holder<UniformBuffer>> data;
uint32 current = 0, last = 0, prev = 0;
UboCache()
{
data.reserve(200);
data.resize(10);
}
UniformBuffer *get()
{
if ((current + 1) % data.size() == prev)
{
// grow the buffer
data.insert(data.begin() + prev, Holder<UniformBuffer>());
prev++;
if (last > current)
last++;
}
auto &c = data[current];
current = (current + 1) % data.size();
if (!c)
{
c = newUniformBuffer({});
c->setDebugName("uboCache");
}
return &*c;
}
void frame()
{
prev = last;
last = current;
}
};
struct GraphicsDispatchHolders
{
Holder<Model> modelSquare, modelSphere, modelCone;
Holder<ShaderProgram> shaderVisualizeColor, shaderVisualizeDepth, shaderVisualizeMonochromatic, shaderVisualizeVelocity;
Holder<ShaderProgram> shaderAmbient, shaderBlit, shaderDepth, shaderGBuffer, shaderLighting, shaderTranslucent;
Holder<ShaderProgram> shaderGaussianBlur, shaderSsaoGenerate, shaderSsaoApply, shaderDofCollect, shaderDofApply, shaderMotionBlur, shaderBloomGenerate, shaderBloomApply, shaderLuminanceCollection, shaderLuminanceCopy, shaderFinalScreen, shaderFxaa;
Holder<ShaderProgram> shaderFont;
Holder<FrameBuffer> gBufferTarget;
Holder<FrameBuffer> renderTarget;
Holder<Texture> albedoTexture;
Holder<Texture> specialTexture;
Holder<Texture> normalTexture;
Holder<Texture> colorTexture;
Holder<Texture> intermediateTexture;
Holder<Texture> velocityTexture;
Holder<Texture> ambientOcclusionTexture1;
Holder<Texture> ambientOcclusionTexture2;
Holder<Texture> bloomTexture1;
Holder<Texture> bloomTexture2;
Holder<Texture> dofTexture1;
Holder<Texture> dofTexture2;
Holder<Texture> dofTexture3;
Holder<Texture> depthTexture;
Holder<UniformBuffer> ssaoPointsBuffer;
UboCache uboCacheLarge;
UboCache uboCacheSmall;
std::vector<ShadowmapBuffer> shadowmaps2d, shadowmapsCube;
std::vector<VisualizableTexture> visualizableTextures;
std::map<uintPtr, CameraSpecificData> cameras;
};
struct GraphicsDispatchImpl : public GraphicsDispatch, private GraphicsDispatchHolders
{
public:
uint32 drawCalls = 0;
uint32 drawPrimitives = 0;
private:
uint32 frameIndex = 0;
uint32 lastGBufferWidth = 0;
uint32 lastGBufferHeight = 0;
CameraEffectsFlags lastCameraEffects = CameraEffectsFlags::None;
bool lastTwoSided = false;
bool lastDepthTest = false;
bool lastDepthWrite = false;
Texture *texSource = nullptr;
Texture *texTarget = nullptr;
static void applyShaderRoutines(const ShaderConfig *c, const Holder<ShaderProgram> &s)
{
s->uniform(CAGE_SHADER_UNI_ROUTINES, c->shaderRoutines);
CAGE_CHECK_GL_ERROR_DEBUG();
}
static void viewportAndScissor(sint32 x, sint32 y, uint32 w, uint32 h)
{
glViewport(x, y, w, h);
glScissor(x, y, w, h);
}
static void activeTexture(uint32 t)
{
glActiveTexture(GL_TEXTURE0 + t);
}
static void resetAllTextures()
{
GraphicsDebugScope graphicsDebugScope("reset all textures");
for (uint32 i = 0; i < 16; i++)
{
activeTexture(i);
glBindTexture(GL_TEXTURE_1D, 0);
glBindTexture(GL_TEXTURE_1D_ARRAY, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
glBindTexture(GL_TEXTURE_3D, 0);
}
activeTexture(0);
}
void setTwoSided(bool twoSided)
{
if (twoSided != lastTwoSided)
{
if (twoSided)
glDisable(GL_CULL_FACE);
else
glEnable(GL_CULL_FACE);
lastTwoSided = twoSided;
}
}
void setDepthTest(bool depthTest, bool depthWrite)
{
if (depthTest != lastDepthTest)
{
if (depthTest)
glDepthFunc(GL_LEQUAL);
else
glDepthFunc(GL_ALWAYS);
lastDepthTest = depthTest;
}
if (depthWrite != lastDepthWrite)
{
if (depthWrite)
glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
lastDepthWrite = depthWrite;
}
}
void useDisposableUbo(uint32 bindIndex, PointerRange<const char> data)
{
UniformBuffer *ubo = data.size() > 256 ? uboCacheLarge.get() : uboCacheSmall.get();
ubo->bind();
if (ubo->getSize() < data.size())
ubo->writeWhole(data, GL_DYNAMIC_DRAW);
else
ubo->writeRange(data, 0);
ubo->bind(bindIndex);
}
template<class T>
void useDisposableUbo(uint32 bindIndex, const T &data)
{
PointerRange<const T> r = { &data, &data + 1 };
useDisposableUbo(bindIndex, bufferCast<const char>(r));
}
template<class T>
void useDisposableUbo(uint32 bindIndex, const std::vector<T> &data)
{
useDisposableUbo(bindIndex, bufferCast<const char, const T>(data));
}
void bindGBufferTextures()
{
GraphicsDebugScope graphicsDebugScope("bind gBuffer textures");
const uint32 tius[] = { CAGE_SHADER_TEXTURE_ALBEDO, CAGE_SHADER_TEXTURE_SPECIAL, CAGE_SHADER_TEXTURE_NORMAL, CAGE_SHADER_TEXTURE_COLOR, CAGE_SHADER_TEXTURE_DEPTH };
const Texture *texs[] = { albedoTexture.get(), specialTexture.get(), normalTexture.get(), colorTexture.get(), depthTexture.get() };
Texture::multiBind(tius, texs);
}
void bindShadowmap(sint32 shadowmap)
{
if (shadowmap != 0)
{
activeTexture((shadowmap > 0 ? CAGE_SHADER_TEXTURE_SHADOW : CAGE_SHADER_TEXTURE_SHADOW_CUBE));
ShadowmapBuffer &s = shadowmap > 0 ? shadowmaps2d[shadowmap - 1] : shadowmapsCube[-shadowmap - 1];
s.texture->bind();
}
}
void gaussianBlur(Texture *texData, Texture *texHelper, uint32 mipmapLevel = 0)
{
shaderGaussianBlur->bind();
shaderGaussianBlur->uniform(1, (int)mipmapLevel);
auto blur = [&](Texture *tex1, Texture *tex2, const vec2 &direction)
{
tex1->bind();
renderTarget->colorTexture(0, tex2, mipmapLevel);
#ifdef CAGE_DEBUG
renderTarget->checkStatus();
#endif // CAGE_DEBUG
shaderGaussianBlur->uniform(0, direction);
renderDispatch(modelSquare, 1);
};
blur(texData, texHelper, vec2(1, 0));
blur(texHelper, texData, vec2(0, 1));
}
void renderEffect()
{
CAGE_CHECK_GL_ERROR_DEBUG();
renderTarget->colorTexture(0, texTarget);
#ifdef CAGE_DEBUG
renderTarget->checkStatus();
#endif // CAGE_DEBUG
texSource->bind();
renderDispatch(modelSquare, 1);
std::swap(texSource, texTarget);
}
void renderDispatch(const Objects *obj)
{
renderDispatch(obj->model, numeric_cast<uint32>(obj->uniModeles.size()));
}
void renderDispatch(const Holder<Model> &model, uint32 count)
{
model->dispatch(count);
drawCalls++;
drawPrimitives += count * model->getPrimitivesCount();
}
void renderObject(const Objects *obj, const Holder<ShaderProgram> &shr)
{
renderObject(obj, shr, obj->model->getFlags());
}
void renderObject(const Objects *obj, const Holder<ShaderProgram> &shr, ModelRenderFlags flags)
{
applyShaderRoutines(&obj->shaderConfig, shr);
useDisposableUbo(CAGE_SHADER_UNIBLOCK_MESHES, obj->uniModeles);
if (!obj->uniArmatures.empty())
{
useDisposableUbo(CAGE_SHADER_UNIBLOCK_ARMATURES, obj->uniArmatures);
shr->uniform(CAGE_SHADER_UNI_BONESPERINSTANCE, obj->model->getSkeletonBones());
}
obj->model->bind();
setTwoSided(any(flags & ModelRenderFlags::TwoSided));
setDepthTest(any(flags & ModelRenderFlags::DepthTest), any(flags & ModelRenderFlags::DepthWrite));
{ // bind textures
uint32 tius[MaxTexturesCountPerMaterial];
const Texture *texs[MaxTexturesCountPerMaterial];
for (uint32 i = 0; i < MaxTexturesCountPerMaterial; i++)
{
if (obj->textures[i])
{
switch (obj->textures[i]->getTarget())
{
case GL_TEXTURE_2D_ARRAY:
tius[i] = CAGE_SHADER_TEXTURE_ALBEDO_ARRAY + i;
break;
case GL_TEXTURE_CUBE_MAP:
tius[i] = CAGE_SHADER_TEXTURE_ALBEDO_CUBE + i;
break;
default:
tius[i] = CAGE_SHADER_TEXTURE_ALBEDO + i;
break;
}
texs[i] = obj->textures[i].get();
}
else
{
tius[i] = 0;
texs[i] = nullptr;
}
}
Texture::multiBind(tius, texs);
}
CAGE_CHECK_GL_ERROR_DEBUG();
renderDispatch(obj);
}
void renderOpaque(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("opaque");
OPTICK_EVENT("opaque");
const Holder<ShaderProgram> &shr = pass->targetShadowmap ? shaderDepth : shaderGBuffer;
shr->bind();
for (const Holder<Objects> &o : pass->opaques)
renderObject(o.get(), shr);
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderLighting(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("lighting");
OPTICK_EVENT("lighting");
const Holder<ShaderProgram> &shr = shaderLighting;
shr->bind();
for (const Holder<Lights> &l : pass->lights)
{
applyShaderRoutines(&l->shaderConfig, shr);
Holder<Model> model;
switch (l->lightType)
{
case LightTypeEnum::Directional:
model = modelSquare.share();
glCullFace(GL_BACK);
break;
case LightTypeEnum::Spot:
model = modelCone.share();
glCullFace(GL_FRONT);
break;
case LightTypeEnum::Point:
model = modelSphere.share();
glCullFace(GL_FRONT);
break;
default:
CAGE_THROW_CRITICAL(Exception, "invalid light type");
}
bindShadowmap(l->shadowmap);
useDisposableUbo(CAGE_SHADER_UNIBLOCK_LIGHTS, l->uniLights);
model->bind();
renderDispatch(model, numeric_cast<uint32>(l->uniLights.size()));
}
glCullFace(GL_BACK);
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderTranslucent(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("translucent");
OPTICK_EVENT("translucent");
const Holder<ShaderProgram> &shr = shaderTranslucent;
shr->bind();
for (const Holder<Translucent> &t : pass->translucents)
{
{ // render ambient object
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // assume premultiplied alpha
uint32 tmp = CAGE_SHADER_ROUTINEPROC_LIGHTFORWARDBASE;
uint32 &orig = const_cast<uint32&>(t->object.shaderConfig.shaderRoutines[CAGE_SHADER_ROUTINEUNIF_LIGHTTYPE]);
std::swap(tmp, orig);
renderObject(&t->object, shr);
std::swap(tmp, orig);
}
if (!t->lights.empty())
{ // render lights on the object
glBlendFunc(GL_ONE, GL_ONE); // assume premultiplied alpha
for (const Holder<Lights> &l : t->lights)
{
applyShaderRoutines(&l->shaderConfig, shr);
bindShadowmap(l->shadowmap);
useDisposableUbo(CAGE_SHADER_UNIBLOCK_LIGHTS, l->uniLights);
renderDispatch(t->object.model, numeric_cast<uint32>(l->uniLights.size()));
}
}
}
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderTexts(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("texts");
OPTICK_EVENT("texts");
for (const Holder<Texts> &t : pass->texts)
{
t->font->bind(modelSquare.get(), shaderFont.get());
for (const Holder<Texts::Render> &r : t->renders)
{
shaderFont->uniform(0, r->transform);
shaderFont->uniform(4, r->color);
t->font->render(r->glyphs, r->format);
drawCalls += numeric_cast<uint32>(r->glyphs.size() + CAGE_SHADER_MAX_CHARACTERS - 1) / CAGE_SHADER_MAX_CHARACTERS;
drawPrimitives += numeric_cast<uint32>(r->glyphs.size()) * 2;
}
}
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderCameraPass(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("camera pass");
OPTICK_EVENT("camera pass");
// camera specific data
CAGE_ASSERT(pass->entityId != 0);
CameraSpecificData &cs = cameras[pass->entityId];
cs.update(pass->vpW, pass->vpH, pass->effects);
renderCameraOpaque(pass);
renderCameraEffectsOpaque(pass, cs);
renderCameraTransparencies(pass);
renderCameraEffectsFinal(pass, cs);
// blit to final output texture
if (texSource != pass->targetTexture)
{
texTarget = pass->targetTexture;
shaderBlit->bind();
renderEffect();
}
}
void renderCameraOpaque(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("deferred");
OPTICK_EVENT("deferred");
// opaque
gBufferTarget->bind();
gBufferTarget->activeAttachments(31);
gBufferTarget->checkStatus();
CAGE_CHECK_GL_ERROR_DEBUG();
if (pass->clearFlags)
glClear(pass->clearFlags);
renderOpaque(pass);
setTwoSided(false);
setDepthTest(false, false);
CAGE_CHECK_GL_ERROR_DEBUG();
// lighting
renderTarget->bind();
renderTarget->clear();
renderTarget->colorTexture(0, colorTexture.get());
renderTarget->activeAttachments(1);
renderTarget->checkStatus();
bindGBufferTextures();
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
CAGE_CHECK_GL_ERROR_DEBUG();
renderLighting(pass);
setDepthTest(false, false);
glDisable(GL_BLEND);
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderCameraEffectsOpaque(const RenderPass *pass, CameraSpecificData &cs)
{
OPTICK_EVENT("effects opaque");
// opaque screen-space effects
renderTarget->bind();
renderTarget->depthTexture(nullptr);
renderTarget->activeAttachments(1);
bindGBufferTextures();
modelSquare->bind();
texSource = colorTexture.get();
texTarget = intermediateTexture.get();
CAGE_CHECK_GL_ERROR_DEBUG();
// ssao
if (any(pass->effects & CameraEffectsFlags::AmbientOcclusion))
{
GraphicsDebugScope graphicsDebugScope("ssao");
viewportAndScissor(pass->vpX / CAGE_SHADER_SSAO_DOWNSCALE, pass->vpY / CAGE_SHADER_SSAO_DOWNSCALE, pass->vpW / CAGE_SHADER_SSAO_DOWNSCALE, pass->vpH / CAGE_SHADER_SSAO_DOWNSCALE);
{
SsaoShader s;
s.viewProj = pass->viewProj;
s.viewProjInv = pass->uniViewport.vpInv;
s.params = vec4(pass->ssao.strength, pass->ssao.bias, pass->ssao.power, pass->ssao.worldRadius);
s.iparams[0] = pass->ssao.samplesCount;
s.iparams[1] = frameIndex;
useDisposableUbo(CAGE_SHADER_UNIBLOCK_EFFECT_PROPERTIES, s);
}
{ // generate
renderTarget->colorTexture(0, ambientOcclusionTexture1.get());
renderTarget->checkStatus();
shaderSsaoGenerate->bind();
renderDispatch(modelSquare, 1);
}
{ // blur
for (uint32 i = 0; i < pass->ssao.blurPasses; i++)
gaussianBlur(+ambientOcclusionTexture1, +ambientOcclusionTexture2);
}
{ // apply
renderTarget->colorTexture(0, ambientOcclusionTexture2.get());
renderTarget->checkStatus();
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
ambientOcclusionTexture1->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
shaderSsaoApply->bind();
renderDispatch(modelSquare, 1);
}
viewportAndScissor(pass->vpX, pass->vpY, pass->vpW, pass->vpH);
}
// ambient light
if ((pass->uniViewport.ambientLight + pass->uniViewport.ambientDirectionalLight) != vec4())
{
GraphicsDebugScope graphicsDebugScope("ambient light");
shaderAmbient->bind();
if (any(pass->effects & CameraEffectsFlags::AmbientOcclusion))
{
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
ambientOcclusionTexture2->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
shaderAmbient->uniform(CAGE_SHADER_UNI_AMBIENTOCCLUSION, 1);
}
else
shaderAmbient->uniform(CAGE_SHADER_UNI_AMBIENTOCCLUSION, 0);
renderEffect();
}
// depth of field
if (any(pass->effects & CameraEffectsFlags::DepthOfField))
{
GraphicsDebugScope graphicsDebugScope("depth of field");
{
const real fd = pass->depthOfField.focusDistance;
const real fr = pass->depthOfField.focusRadius;
const real br = pass->depthOfField.blendRadius;
DofShader s;
s.projInv = inverse(pass->proj);
s.dofNear = vec4(fd - fr - br, fd - fr, 0, 0);
s.dofFar = vec4(fd + fr, fd + fr + br, 0, 0);
useDisposableUbo(CAGE_SHADER_UNIBLOCK_EFFECT_PROPERTIES, s);
}
texSource->bind();
shaderDofCollect->bind();
viewportAndScissor(pass->vpX / CAGE_SHADER_DOF_DOWNSCALE, pass->vpY / CAGE_SHADER_DOF_DOWNSCALE, pass->vpW / CAGE_SHADER_DOF_DOWNSCALE, pass->vpH / CAGE_SHADER_DOF_DOWNSCALE);
{ // collect near
renderTarget->colorTexture(0, dofTexture1.get());
renderTarget->checkStatus();
shaderDofCollect->uniform(0, 0);
renderDispatch(modelSquare, 1);
}
{ // collect far
renderTarget->colorTexture(0, dofTexture2.get());
renderTarget->checkStatus();
shaderDofCollect->uniform(0, 1);
renderDispatch(modelSquare, 1);
}
{ // blur
for (uint32 i = 0; i < pass->depthOfField.blurPasses; i++)
gaussianBlur(+dofTexture1, +dofTexture3);
for (uint32 i = 0; i < pass->depthOfField.blurPasses; i++)
gaussianBlur(+dofTexture2, +dofTexture3);
}
viewportAndScissor(pass->vpX, pass->vpY, pass->vpW, pass->vpH);
{ // apply
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS + 0);
dofTexture1->bind();
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS + 1);
dofTexture2->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
shaderDofApply->bind();
renderEffect();
}
}
// motion blur
if (any(pass->effects & CameraEffectsFlags::MotionBlur))
{
GraphicsDebugScope graphicsDebugScope("motion blur");
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
velocityTexture->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
shaderMotionBlur->bind();
renderEffect();
}
// eye adaptation
if (any(pass->effects & CameraEffectsFlags::EyeAdaptation))
{
GraphicsDebugScope graphicsDebugScope("eye adaptation");
// bind the luminance texture for use
{
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
cs.luminanceAccumulationTexture->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
}
// luminance collection
{
viewportAndScissor(pass->vpX / CAGE_SHADER_LUMINANCE_DOWNSCALE, pass->vpY / CAGE_SHADER_LUMINANCE_DOWNSCALE, pass->vpW / CAGE_SHADER_LUMINANCE_DOWNSCALE, pass->vpH / CAGE_SHADER_LUMINANCE_DOWNSCALE);
renderTarget->colorTexture(0, cs.luminanceCollectionTexture.get());
renderTarget->checkStatus();
texSource->bind();
shaderLuminanceCollection->bind();
renderDispatch(modelSquare, 1);
}
// downscale
{
cs.luminanceCollectionTexture->bind();
cs.luminanceCollectionTexture->generateMipmaps();
}
// luminance copy
{
viewportAndScissor(0, 0, 1, 1);
renderTarget->colorTexture(0, cs.luminanceAccumulationTexture.get());
renderTarget->checkStatus();
shaderLuminanceCopy->bind();
shaderLuminanceCopy->uniform(0, vec2(pass->eyeAdaptation.darkerSpeed, pass->eyeAdaptation.lighterSpeed));
renderDispatch(modelSquare, 1);
}
viewportAndScissor(pass->vpX, pass->vpY, pass->vpW, pass->vpH);
texSource->bind();
}
}
void renderCameraTransparencies(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("transparencies");
OPTICK_EVENT("transparencies");
if (pass->translucents.empty() && pass->texts.empty())
return;
if (texSource != colorTexture.get())
{
shaderBlit->bind();
renderEffect();
}
CAGE_ASSERT(texSource == colorTexture.get());
CAGE_ASSERT(texTarget == intermediateTexture.get());
renderTarget->colorTexture(0, colorTexture.get());
renderTarget->depthTexture(depthTexture.get());
renderTarget->activeAttachments(1);
renderTarget->checkStatus();
CAGE_CHECK_GL_ERROR_DEBUG();
setDepthTest(true, true);
glEnable(GL_BLEND);
CAGE_CHECK_GL_ERROR_DEBUG();
renderTranslucent(pass);
setDepthTest(true, false);
setTwoSided(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CAGE_CHECK_GL_ERROR_DEBUG();
renderTexts(pass);
setDepthTest(false, false);
setTwoSided(false);
glDisable(GL_BLEND);
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
CAGE_CHECK_GL_ERROR_DEBUG();
renderTarget->depthTexture(nullptr);
renderTarget->activeAttachments(1);
modelSquare->bind();
bindGBufferTextures();
}
void renderCameraEffectsFinal(const RenderPass *pass, CameraSpecificData &cs)
{
GraphicsDebugScope graphicsDebugScope("effects final");
OPTICK_EVENT("effects final");
// bloom
if (any(pass->effects & CameraEffectsFlags::Bloom))
{
GraphicsDebugScope graphicsDebugScope("bloom");
viewportAndScissor(pass->vpX / CAGE_SHADER_BLOOM_DOWNSCALE, pass->vpY / CAGE_SHADER_BLOOM_DOWNSCALE, pass->vpW / CAGE_SHADER_BLOOM_DOWNSCALE, pass->vpH / CAGE_SHADER_BLOOM_DOWNSCALE);
{ // generate
renderTarget->colorTexture(0, bloomTexture1.get());
renderTarget->checkStatus();
shaderBloomGenerate->bind();
shaderBloomGenerate->uniform(0, vec4(pass->bloom.threshold, 0, 0, 0));
renderDispatch(modelSquare, 1);
}
{ // blur
bloomTexture1->bind();
bloomTexture1->generateMipmaps();
for (uint32 i = 0; i < pass->bloom.blurPasses; i++)
{
uint32 d = CAGE_SHADER_BLOOM_DOWNSCALE + i;
viewportAndScissor(pass->vpX / d, pass->vpY / d, pass->vpW / d, pass->vpH / d);
gaussianBlur(+bloomTexture1, +bloomTexture2, i);
}
}
viewportAndScissor(pass->vpX, pass->vpY, pass->vpW, pass->vpH);
{ // apply
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
bloomTexture1->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
shaderBloomApply->bind();
shaderBloomApply->uniform(0, (int)pass->bloom.blurPasses);
renderEffect();
}
}
// final screen effects
if (any(pass->effects & (CameraEffectsFlags::EyeAdaptation | CameraEffectsFlags::ToneMapping | CameraEffectsFlags::GammaCorrection)))
{
GraphicsDebugScope graphicsDebugScope("final screen");
FinalScreenShader f;
if (any(pass->effects & CameraEffectsFlags::EyeAdaptation))
{
activeTexture(CAGE_SHADER_TEXTURE_EFFECTS);
cs.luminanceAccumulationTexture->bind();
activeTexture(CAGE_SHADER_TEXTURE_COLOR);
f.eyeAdaptationKey = pass->eyeAdaptation.key;
f.eyeAdaptationStrength = pass->eyeAdaptation.strength;
}
f.tonemap = pass->tonemap;
f.tonemapEnabled = any(pass->effects & CameraEffectsFlags::ToneMapping);
if (any(pass->effects & CameraEffectsFlags::GammaCorrection))
f.gamma = 1.0 / pass->gamma;
else
f.gamma = 1.0;
useDisposableUbo(CAGE_SHADER_UNIBLOCK_EFFECT_PROPERTIES, f);
shaderFinalScreen->bind();
renderEffect();
}
// fxaa
if (any(pass->effects & CameraEffectsFlags::AntiAliasing))
{
GraphicsDebugScope graphicsDebugScope("fxaa");
shaderFxaa->bind();
renderEffect();
}
}
void renderShadowPass(const RenderPass *pass)
{
GraphicsDebugScope graphicsDebugScope("shadow pass");
OPTICK_EVENT("shadow pass");
renderTarget->bind();
renderTarget->clear();
renderTarget->depthTexture(pass->targetShadowmap > 0 ? shadowmaps2d[pass->targetShadowmap - 1].texture.get() : shadowmapsCube[-pass->targetShadowmap - 1].texture.get());
renderTarget->activeAttachments(0);
renderTarget->checkStatus();
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glClear(GL_DEPTH_BUFFER_BIT);
CAGE_CHECK_GL_ERROR_DEBUG();
const Holder<ShaderProgram> &shr = shaderDepth;
shr->bind();
for (const Holder<Objects> &o : pass->opaques)
renderObject(o.get(), shr, o->model->getFlags() | ModelRenderFlags::DepthWrite);
for (const Holder<Translucent> &o : pass->translucents)
renderObject(&o->object, shr, o->object.model->getFlags() | ModelRenderFlags::DepthWrite);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
CAGE_CHECK_GL_ERROR_DEBUG();
}
void renderPass(const RenderPass *pass)
{
useDisposableUbo(CAGE_SHADER_UNIBLOCK_VIEWPORT, pass->uniViewport);
viewportAndScissor(pass->vpX, pass->vpY, pass->vpW, pass->vpH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
lastTwoSided = true;
setTwoSided(false);
lastDepthTest = false; lastDepthWrite = false;
setDepthTest(true, true);
resetAllTextures();
CAGE_CHECK_GL_ERROR_DEBUG();
if (pass->targetShadowmap == 0)
renderCameraPass(pass);
else
renderShadowPass(pass);
setTwoSided(false);
setDepthTest(false, false);
resetAllTextures();
CAGE_CHECK_GL_ERROR_DEBUG();
}
bool resizeTexture(const char *debugName, Holder<Texture> &texture, bool enabled, uint32 internalFormat, uint32 downscale = 1, bool mipmaps = false)
{
if (enabled)
{
if (texture)
texture->bind();
else
{
texture = newTexture();
texture->setDebugName(debugName);
texture->filters(mipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR, GL_LINEAR, 0);
texture->wraps(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
}
texture->image2d(max(lastGBufferWidth / downscale, 1u), max(lastGBufferHeight / downscale, 1u), internalFormat);
if (mipmaps)
texture->generateMipmaps();
}
else
texture.clear();
return enabled;
}
void gBufferResize(uint32 w, uint32 h, CameraEffectsFlags cameraEffects)
{
if (w == lastGBufferWidth && h == lastGBufferHeight && lastCameraEffects == cameraEffects)
return;
OPTICK_EVENT("g-buffer resize");
lastGBufferWidth = w;
lastGBufferHeight = h;
lastCameraEffects = cameraEffects;
resizeTexture("albedoTexture", albedoTexture, true, GL_RGB8);
resizeTexture("specialTexture", specialTexture, true, GL_RG8);
resizeTexture("normalTexture", normalTexture, true, GL_RGB16F);
resizeTexture("colorTexture", colorTexture, true, GL_RGB16F);
resizeTexture("depthTexture", depthTexture, true, GL_DEPTH_COMPONENT32);
resizeTexture("intermediateTexture", intermediateTexture, true, GL_RGB16F);
resizeTexture("velocityTexture", velocityTexture, any(cameraEffects & CameraEffectsFlags::MotionBlur), GL_RG16F);
resizeTexture("ambientOcclusionTexture1", ambientOcclusionTexture1, any(cameraEffects & CameraEffectsFlags::AmbientOcclusion), GL_R8, CAGE_SHADER_SSAO_DOWNSCALE);
resizeTexture("ambientOcclusionTexture2", ambientOcclusionTexture2, any(cameraEffects & CameraEffectsFlags::AmbientOcclusion), GL_R8, CAGE_SHADER_SSAO_DOWNSCALE);
resizeTexture("bloomTexture1", bloomTexture1, any(cameraEffects & CameraEffectsFlags::Bloom), GL_RGB16F, CAGE_SHADER_BLOOM_DOWNSCALE, true);
resizeTexture("bloomTexture2", bloomTexture2, any(cameraEffects & CameraEffectsFlags::Bloom), GL_RGB16F, CAGE_SHADER_BLOOM_DOWNSCALE, true);
resizeTexture("dofTexture1", dofTexture1, any(cameraEffects & CameraEffectsFlags::DepthOfField), GL_RGB16F, CAGE_SHADER_DOF_DOWNSCALE);
resizeTexture("dofTexture2", dofTexture2, any(cameraEffects & CameraEffectsFlags::DepthOfField), GL_RGB16F, CAGE_SHADER_DOF_DOWNSCALE);
resizeTexture("dofTexture3", dofTexture3, any(cameraEffects & CameraEffectsFlags::DepthOfField), GL_RGB16F, CAGE_SHADER_DOF_DOWNSCALE);
CAGE_CHECK_GL_ERROR_DEBUG();
gBufferTarget->bind();
gBufferTarget->colorTexture(CAGE_SHADER_ATTRIB_OUT_ALBEDO, albedoTexture.get());
gBufferTarget->colorTexture(CAGE_SHADER_ATTRIB_OUT_SPECIAL, specialTexture.get());
gBufferTarget->colorTexture(CAGE_SHADER_ATTRIB_OUT_NORMAL, normalTexture.get());
gBufferTarget->colorTexture(CAGE_SHADER_ATTRIB_OUT_COLOR, colorTexture.get());
gBufferTarget->colorTexture(CAGE_SHADER_ATTRIB_OUT_VELOCITY, any(cameraEffects & CameraEffectsFlags::MotionBlur) ? velocityTexture.get() : nullptr);
gBufferTarget->depthTexture(depthTexture.get());
CAGE_CHECK_GL_ERROR_DEBUG();
}
public:
explicit GraphicsDispatchImpl(const EngineCreateConfig &config)
{}
void initialize()
{
shadowmaps2d.reserve(4);
shadowmapsCube.reserve(32);
gBufferTarget = newFrameBufferDraw();
renderTarget = newFrameBufferDraw();
CAGE_CHECK_GL_ERROR_DEBUG();
ssaoPointsBuffer = newUniformBuffer();
ssaoPointsBuffer->setDebugName("ssaoPointsBuffer");
{
const vec4 *points = nullptr;
uint32 count = 0;
pointsForSsaoShader(points, count);
PointerRange<const vec4> r = { points, points + count };
ssaoPointsBuffer->writeWhole(bufferCast<const char>(r), GL_STATIC_DRAW);
}
CAGE_CHECK_GL_ERROR_DEBUG();
}
void finalize()
{
lastGBufferWidth = lastGBufferHeight = 0;
*(GraphicsDispatchHolders*)this = GraphicsDispatchHolders();
}
void tick()
{
GraphicsDebugScope graphicsDebugScope("engine tick");
drawCalls = 0;
drawPrimitives = 0;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
CAGE_CHECK_GL_ERROR_DEBUG();
if (windowWidth == 0 || windowHeight == 0)
return;
AssetManager *ass = engineAssets();
if (!ass->get<AssetSchemeIndexPack, AssetPack>(HashString("cage/cage.pack")))
return;
modelSquare = ass->get<AssetSchemeIndexModel, Model>(HashString("cage/model/square.obj"));
modelSphere = ass->get<AssetSchemeIndexModel, Model>(HashString("cage/model/sphere.obj"));
modelCone = ass->get<AssetSchemeIndexModel, Model>(HashString("cage/model/cone.obj"));
shaderVisualizeColor = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/visualize/color.glsl"));
shaderVisualizeDepth = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/visualize/depth.glsl"));
shaderVisualizeMonochromatic = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/visualize/monochromatic.glsl"));
shaderVisualizeVelocity = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/visualize/velocity.glsl"));
shaderAmbient = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/ambient.glsl"));
shaderBlit = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/blit.glsl"));
shaderDepth = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/depth.glsl"));
shaderGBuffer = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/gBuffer.glsl"));
shaderLighting = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/lighting.glsl"));
shaderTranslucent = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/translucent.glsl"));
shaderGaussianBlur = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/gaussianBlur.glsl"));
shaderSsaoGenerate = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/ssaoGenerate.glsl"));
shaderSsaoApply = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/ssaoApply.glsl"));
shaderDofCollect = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/dofCollect.glsl"));
shaderDofApply = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/dofApply.glsl"));
shaderMotionBlur = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/motionBlur.glsl"));
shaderBloomGenerate = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/bloomGenerate.glsl"));
shaderBloomApply = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/bloomApply.glsl"));
shaderLuminanceCollection = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/luminanceCollection.glsl"));
shaderLuminanceCopy = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/luminanceCopy.glsl"));
shaderFinalScreen = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/finalScreen.glsl"));
shaderFxaa = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/engine/effects/fxaa.glsl"));
shaderFont = ass->get<AssetSchemeIndexShaderProgram, ShaderProgram>(HashString("cage/shader/gui/font.glsl"));
if (!shaderBlit)
return;
visualizableTextures.clear();
visualizableTextures.emplace_back(colorTexture.get(), VisualizableTextureModeEnum::Color); // unscaled
if (windowWidth != lastGBufferWidth || windowHeight != lastGBufferHeight)
visualizableTextures.emplace_back(colorTexture.get(), VisualizableTextureModeEnum::Color); // scaled
visualizableTextures.emplace_back(albedoTexture.get(), VisualizableTextureModeEnum::Color);
visualizableTextures.emplace_back(specialTexture.get(), VisualizableTextureModeEnum::Color);
visualizableTextures.emplace_back(normalTexture.get(), VisualizableTextureModeEnum::Color);
visualizableTextures.emplace_back(depthTexture.get(), VisualizableTextureModeEnum::Depth2d);
if (ambientOcclusionTexture2)
visualizableTextures.emplace_back(ambientOcclusionTexture2.get(), VisualizableTextureModeEnum::Monochromatic);
if (bloomTexture1)
visualizableTextures.emplace_back(bloomTexture1.get(), VisualizableTextureModeEnum::Color);
if (dofTexture1)
visualizableTextures.emplace_back(dofTexture1.get(), VisualizableTextureModeEnum::Color);
if (dofTexture2)
visualizableTextures.emplace_back(dofTexture2.get(), VisualizableTextureModeEnum::Color);
if (velocityTexture)
visualizableTextures.emplace_back(velocityTexture.get(), VisualizableTextureModeEnum::Velocity);
{ // prepare all render targets
uint32 maxW = windowWidth, maxH = windowHeight;
CameraEffectsFlags cameraEffects = CameraEffectsFlags::None;
for (const Holder<RenderPass> &renderPass : renderPasses)
{
cameraEffects |= renderPass->effects;
if (renderPass->targetTexture)
{ // render to texture
visualizableTextures.emplace_back(renderPass->targetTexture, VisualizableTextureModeEnum::Color);
uint32 w, h;
renderPass->targetTexture->getResolution(w, h);
maxW = max(maxW, w);
maxH = max(maxH, h);
continue;
}
if (renderPass->targetShadowmap == 0)
{ // render to screen
renderPass->targetTexture = colorTexture.get();
continue;
}
// render to shadowmap
if (renderPass->targetShadowmap > 0)
{ // 2d shadowmap
uint32 idx = renderPass->targetShadowmap - 1;
while (shadowmaps2d.size() <= idx)
shadowmaps2d.push_back(ShadowmapBuffer(GL_TEXTURE_2D));
ShadowmapBuffer &s = shadowmaps2d[idx];
s.resize(renderPass->shadowmapResolution, renderPass->shadowmapResolution);
visualizableTextures.emplace_back(s.texture.get(), VisualizableTextureModeEnum::Depth2d);
}
if (renderPass->targetShadowmap < 0)
{ // cube shadowmap
uint32 idx = -renderPass->targetShadowmap - 1;
while (shadowmapsCube.size() <= idx)
shadowmapsCube.push_back(ShadowmapBuffer(GL_TEXTURE_CUBE_MAP));
ShadowmapBuffer &s = shadowmapsCube[idx];
s.resize(renderPass->shadowmapResolution, renderPass->shadowmapResolution);
visualizableTextures.emplace_back(s.texture.get(), VisualizableTextureModeEnum::DepthCube);
}
}
gBufferResize(maxW, maxH, cameraEffects);
CAGE_CHECK_GL_ERROR_DEBUG();
}
if (!visualizableTextures[0].tex)
return;
ssaoPointsBuffer->bind(CAGE_SHADER_UNIBLOCK_SSAO_POINTS);
uboCacheLarge.frame();
uboCacheSmall.frame();
CAGE_CHECK_GL_ERROR_DEBUG();
{ // render all passes
FlatSet<uintPtr> camerasToDestroy;
for (auto &cs : cameras)
camerasToDestroy.insert(cs.first);
for (const Holder<RenderPass> &pass : renderPasses)
{
renderPass(pass.get());
CAGE_CHECK_GL_ERROR_DEBUG();
camerasToDestroy.erase(pass->entityId);
}
for (auto r : camerasToDestroy)
cameras.erase(r);
}
{ // blit to the window
GraphicsDebugScope graphicsDebugScope("blit to the window");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
viewportAndScissor(0, 0, windowWidth, windowHeight);
setTwoSided(false);
setDepthTest(false, false);
const sint32 visualizeCount = numeric_cast<sint32>(visualizableTextures.size());
const sint32 visualizeIndex = (visualizeBuffer % visualizeCount + visualizeCount) % visualizeCount;
VisualizableTexture &v = visualizableTextures[visualizeIndex];
modelSquare->bind();
v.tex->bind();
if (visualizeIndex == 0)
{
CAGE_ASSERT(v.visualizableTextureMode == VisualizableTextureModeEnum::Color);
shaderVisualizeColor->bind();
shaderVisualizeColor->uniform(0, vec2(1.0 / lastGBufferWidth, 1.0 / lastGBufferHeight));
renderDispatch(modelSquare, 1);
}
else
{
vec2 scale = vec2(1.0 / windowWidth, 1.0 / windowHeight);
switch (v.visualizableTextureMode)
{
case VisualizableTextureModeEnum::Color:
shaderVisualizeColor->bind();
shaderVisualizeColor->uniform(0, scale);
renderDispatch(modelSquare, 1);
break;
case VisualizableTextureModeEnum::Depth2d:
case VisualizableTextureModeEnum::DepthCube:
{
shaderVisualizeDepth->bind();
shaderVisualizeDepth->uniform(0, scale);
GLint cmpMode = 0;
glGetTexParameteriv(v.tex->getTarget(), GL_TEXTURE_COMPARE_MODE, &cmpMode);
glTexParameteri(v.tex->getTarget(), GL_TEXTURE_COMPARE_MODE, GL_NONE);
renderDispatch(modelSquare, 1);
glTexParameteri(v.tex->getTarget(), GL_TEXTURE_COMPARE_MODE, cmpMode);
} break;
case VisualizableTextureModeEnum::Monochromatic:
shaderVisualizeMonochromatic->bind();
shaderVisualizeMonochromatic->uniform(0, scale);
renderDispatch(modelSquare, 1);
break;
case VisualizableTextureModeEnum::Velocity:
shaderVisualizeVelocity->bind();
shaderVisualizeVelocity->uniform(0, scale);
renderDispatch(modelSquare, 1);
break;
}
}
CAGE_CHECK_GL_ERROR_DEBUG();
}
{ // check gl errors (even in release, but do not halt the game)
try
{
checkGlError();
}
catch (const GraphicsError &)
{
}
}
frameIndex++;
}
void swap()
{
CAGE_CHECK_GL_ERROR_DEBUG();
engineWindow()->swapBuffers();
glFinish(); // this is where the engine should be waiting for the gpu
}
};
}
GraphicsDispatch *graphicsDispatch;
void graphicsDispatchCreate(const EngineCreateConfig &config)
{
graphicsDispatch = systemArena().createObject<GraphicsDispatchImpl>(config);
}
void graphicsDispatchDestroy()
{
systemArena().destroy<GraphicsDispatchImpl>(graphicsDispatch);
graphicsDispatch = nullptr;
}
void graphicsDispatchInitialize()
{
((GraphicsDispatchImpl*)graphicsDispatch)->initialize();
}
void graphicsDispatchFinalize()
{
((GraphicsDispatchImpl*)graphicsDispatch)->finalize();
}
void graphicsDispatchTick(uint32 &drawCalls, uint32 &drawPrimitives)
{
GraphicsDispatchImpl *impl = (GraphicsDispatchImpl*)graphicsDispatch;
impl->tick();
drawCalls = impl->drawCalls;
drawPrimitives = impl->drawPrimitives;
}
void graphicsDispatchSwap()
{
((GraphicsDispatchImpl*)graphicsDispatch)->swap();
}
}
| 34.453828 | 251 | 0.70041 | Gaeldrin |
f353cc7deba62399e60d4fa94dee21bd570a77c6 | 5,308 | cc | C++ | src/cascade/target/core/sw/sw_compiler.cc | 3Nigma/cascade | 44f7cf20719822f2cba5df7065083a15db217c30 | [
"BSD-2-Clause"
] | 425 | 2018-10-17T19:47:32.000Z | 2021-06-16T18:03:08.000Z | src/cascade/target/core/sw/sw_compiler.cc | 3Nigma/cascade | 44f7cf20719822f2cba5df7065083a15db217c30 | [
"BSD-2-Clause"
] | 196 | 2018-09-17T20:42:33.000Z | 2020-05-15T00:00:24.000Z | src/cascade/target/core/sw/sw_compiler.cc | 3Nigma/cascade | 44f7cf20719822f2cba5df7065083a15db217c30 | [
"BSD-2-Clause"
] | 39 | 2018-11-07T21:16:21.000Z | 2021-06-08T16:24:12.000Z | // Copyright 2017-2019 VMware, Inc.
// SPDX-License-Identifier: BSD-2-Clause
//
// The BSD-2 license (the License) set forth below applies to all parts of the
// Cascade project. You may not use this file except in compliance with the
// License.
//
// BSD-2 License
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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 "target/core/sw/sw_compiler.h"
#include "target/compiler.h"
#include "verilog/analyze/evaluate.h"
#include "verilog/analyze/module_info.h"
#include "verilog/analyze/resolve.h"
#include "verilog/ast/ast.h"
using namespace std;
namespace cascade::sw {
SwCompiler::SwCompiler() : CoreCompiler() {
set_led(nullptr, nullptr);
set_pad(nullptr, nullptr);
set_reset(nullptr, nullptr);
}
SwCompiler& SwCompiler::set_led(Bits* b, mutex* l) {
led_ = b;
led_lock_ = l;
return *this;
}
SwCompiler& SwCompiler::set_pad(Bits* b, mutex* l) {
pad_ = b;
pad_lock_ = l;
return *this;
}
SwCompiler& SwCompiler::set_reset(Bits* b, mutex* l) {
reset_ = b;
reset_lock_ = l;
return *this;
}
void SwCompiler::stop_compile(Engine::Id id) {
// Does nothing. Compilations all return in a reasonable amount of time.
(void) id;
}
SwClock* SwCompiler::compile_clock(Engine::Id id, ModuleDeclaration* md, Interface* interface) {
(void) id;
if (!check_io(md, 0, 1)) {
get_compiler()->error("Unable to compile a software clock with more than one output");
delete md;
return nullptr;
}
const auto* out = *ModuleInfo(md).outputs().begin();
const auto oid = to_vid(out);
delete md;
return new SwClock(interface, oid);
}
SwLed* SwCompiler::compile_led(Engine::Id id, ModuleDeclaration* md, Interface* interface) {
(void) id;
if (led_ == nullptr) {
get_compiler()->error("Unable to compile a software led without a reference to a software fpga");
delete md;
return nullptr;
}
if (!check_io(md, 8, 8)) {
get_compiler()->error("Unable to compile a software led with more than 8 outputs");
delete md;
return nullptr;
}
if (!ModuleInfo(md).inputs().empty()) {
const auto* in = *ModuleInfo(md).inputs().begin();
const auto iid = to_vid(in);
const auto w = Evaluate().get_width(in);
delete md;
return new SwLed(interface, iid, w, led_, led_lock_);
} else {
delete md;
return new SwLed(interface, nullid(), 0, led_, led_lock_);
}
}
SwLogic* SwCompiler::compile_logic(Engine::Id id, ModuleDeclaration* md, Interface* interface) {
(void) id;
ModuleInfo info(md);
auto* c = new SwLogic(interface, md);
for (auto* i : info.inputs()) {
c->set_input(i, to_vid(i));
}
for (auto* s : info.stateful()) {
c->set_state(s, to_vid(s));
}
for (auto* o : info.outputs()) {
c->set_output(o, to_vid(o));
}
return c;
}
SwPad* SwCompiler::compile_pad(Engine::Id id, ModuleDeclaration* md, Interface* interface) {
(void) id;
if (pad_ == nullptr) {
get_compiler()->error("Unable to compile a software pad without a reference to a software fpga");
delete md;
return nullptr;
}
if (pad_ == nullptr || !check_io(md, 0, 4)) {
get_compiler()->error("Unable to compile a software pad with more than four inputs");
delete md;
return nullptr;
}
const auto* out = *ModuleInfo(md).outputs().begin();
const auto oid = to_vid(out);
const auto w = Evaluate().get_width(out);
delete md;
return new SwPad(interface, oid, w, pad_, pad_lock_);
}
SwReset* SwCompiler::compile_reset(Engine::Id id, ModuleDeclaration* md, Interface* interface) {
(void) id;
if (pad_ == nullptr) {
get_compiler()->error("Unable to compile a software reset without a reference to a software fpga");
delete md;
return nullptr;
}
if (pad_ == nullptr || !check_io(md, 0, 1)) {
get_compiler()->error("Unable to compile a software reset with more than one input");
delete md;
return nullptr;
}
const auto* out = *ModuleInfo(md).outputs().begin();
const auto oid = to_vid(out);
delete md;
return new SwReset(interface, oid, reset_, reset_lock_);
}
} // namespace cascade::sw
| 30.331429 | 103 | 0.694989 | 3Nigma |
f3555b8bc3721d607c340db22af5d773d512cd4f | 2,637 | cpp | C++ | include/workqueue.cpp | yyzhuxin/ilibevent | c9444b3600f5ac9eae0130e3f11753b6bd58017a | [
"MIT"
] | 1 | 2017-04-02T12:33:04.000Z | 2017-04-02T12:33:04.000Z | include/workqueue.cpp | yyzhuxin/ilibevent | c9444b3600f5ac9eae0130e3f11753b6bd58017a | [
"MIT"
] | null | null | null | include/workqueue.cpp | yyzhuxin/ilibevent | c9444b3600f5ac9eae0130e3f11753b6bd58017a | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "workqueue.hpp"
#define LL_ADD(item, list) { \
item->prev = NULL; \
item->next = list; \
list = item; \
}
#define LL_REMOVE(item, list) { \
if (item->prev != NULL) item->prev->next = item->next; \
if (item->next != NULL) item->next->prev = item->prev; \
if (list == item) list = item->next; \
item->prev = item->next = NULL; \
}
static void* worker_function(void* ptr)
{
worker_t* worker = (worker_t*)ptr;
job_t* job;
while (1)
{
pthread_mutex_lock(&worker->workqueue->jobs_mutex);
while (worker->workqueue->waiting_jobs == NULL)
{
if (worker->terminate)
{
break;
}
pthread_cond_wait(&worker->workqueue->jobs_cond, &worker->workqueue->jobs_mutex);
}
if (worker->terminate)
{
break;
}
job = worker->workqueue->waiting_jobs;
if (job != NULL)
{
LL_REMOVE(job, worker->workqueue->waiting_jobs);
}
pthread_mutex_unlock(&worker->workqueue->jobs_mutex);
if (job == NULL)
{
continue;
}
job->job_function(job);
}
free(worker);
pthread_exit(NULL);
}
int workqueue_init(workqueue_t* workqueue, int numWorkers)
{
int i;
worker_t* worker;
pthread_cond_t blank_cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t blank_mutex = PTHREAD_MUTEX_INITIALIZER;
if (numWorkers < 1)
{
numWorkers = 1;
}
memset(workqueue, 0, sizeof(*workqueue));
memcpy(&workqueue->jobs_mutex, &blank_mutex, sizeof(workqueue->jobs_mutex));
memcpy(&workqueue->jobs_cond, &blank_cond, sizeof(workqueue->jobs_cond));
for (i = 0; i < numWorkers; ++i)
{
if ((worker = (worker_t*)malloc(sizeof(worker_t))) == NULL)
{
perror("Failed to allocate all workers");
return 1;
}
memset(worker, 0, sizeof(*worker));
worker->workqueue = workqueue;
if (pthread_create(&worker->thread, NULL, worker_function, (void*)worker))
{
perror("Failed to start all worker threads");
free(worker);
return 1;
}
LL_ADD(worker, worker->workqueue->workers);
}
return 0;
}
void workqueue_shutdown(workqueue_t* workqueue)
{
worker_t* worker = NULL;
for (worker = workqueue->workers; worker != NULL; worker = worker->next)
{
worker->terminate = 1;
}
pthread_mutex_lock(&workqueue->jobs_mutex);
workqueue->workers = NULL;
workqueue->waiting_jobs = NULL;
pthread_cond_broadcast(&workqueue->jobs_cond);
pthread_mutex_unlock(&workqueue->jobs_mutex);
}
void workqueue_add_job(workqueue_t* workqueue, job_t* job)
{
pthread_mutex_lock(&workqueue->jobs_mutex);
LL_ADD(job, workqueue->waiting_jobs);
pthread_cond_signal(&workqueue->jobs_cond);
pthread_mutex_unlock(&workqueue->jobs_mutex);
}
| 22.538462 | 84 | 0.68449 | yyzhuxin |
f355d1fac8057ee33c8a28cc09f6fe3dbfc60607 | 1,661 | cpp | C++ | aws-cpp-sdk-glue/source/model/BatchGetCrawlersRequest.cpp | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | 2 | 2019-03-11T15:50:55.000Z | 2020-02-27T11:40:27.000Z | aws-cpp-sdk-glue/source/model/BatchGetCrawlersRequest.cpp | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-glue/source/model/BatchGetCrawlersRequest.cpp | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/glue/model/BatchGetCrawlersRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Glue::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
BatchGetCrawlersRequest::BatchGetCrawlersRequest() :
m_crawlerNamesHasBeenSet(false)
{
}
Aws::String BatchGetCrawlersRequest::SerializePayload() const
{
JsonValue payload;
if(m_crawlerNamesHasBeenSet)
{
Array<JsonValue> crawlerNamesJsonList(m_crawlerNames.size());
for(unsigned crawlerNamesIndex = 0; crawlerNamesIndex < crawlerNamesJsonList.GetLength(); ++crawlerNamesIndex)
{
crawlerNamesJsonList[crawlerNamesIndex].AsString(m_crawlerNames[crawlerNamesIndex]);
}
payload.WithArray("CrawlerNames", std::move(crawlerNamesJsonList));
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection BatchGetCrawlersRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSGlue.BatchGetCrawlers"));
return headers;
}
| 28.152542 | 113 | 0.7646 | curiousjgeorge |
f358d96b90e05b4e769c3f18a08c50de9b94fdd0 | 3,545 | cpp | C++ | Classes/uiloader/loaders/UIButtonLoader.cpp | youlanhai/cc-qt-framework | 35b19d253cdbe2800ecb8068e476efa408f76242 | [
"MIT"
] | null | null | null | Classes/uiloader/loaders/UIButtonLoader.cpp | youlanhai/cc-qt-framework | 35b19d253cdbe2800ecb8068e476efa408f76242 | [
"MIT"
] | null | null | null | Classes/uiloader/loaders/UIButtonLoader.cpp | youlanhai/cc-qt-framework | 35b19d253cdbe2800ecb8068e476efa408f76242 | [
"MIT"
] | 2 | 2015-11-05T08:25:14.000Z | 2018-03-07T07:29:48.000Z | //
// UIButtonLoader.cpp
// Clover
//
// Created by C218-pc on 15/6/29.
//
//
#include "UIButtonLoader.h"
#include "UIButton.h"
#include "UIHelper.h"
cocos2d::Node * UIButtonLoader::createObject(rapidjson::Value & config)
{
return uilib::Button::create();
}
bool UIButtonLoader::setProperty(cocos2d::Node *p, const std::string & name, const rapidjson::Value & value, rapidjson::Value & properties)
{
uilib::Button * btn = dynamic_cast<uilib::Button*>(p);
CCAssert(btn, "UIButtonLoader::setProperty");
if(name == "enable")
{
if(value.IsBool())
{
btn->setEnable(value.GetBool());
}
}
else if(name == "text")
{
if(value.IsString())
{
btn->setText(value.GetString());
}
}
else if(name == "fontName")
{
if(value.IsString())
{
btn->setFontName(value.GetString());
}
}
else if(name == "fontSize")
{
if(value.IsInt())
{
btn->setFontSize(value.GetInt());
}
}
else if(name == "fontColor")
{
cocos2d::Color3B cr;
if(helper::parseValue(value, cr))
{
btn->setFontColor(cr);
}
}
else if(name == "image")
{
std::string imageNormal, imagePressed, imageDisable;
if(value.IsArray())
{
do
{
if(value.Size() < 1 || !value[0u].IsString()) break;
imageNormal = value[0u].GetString();
if(value.Size() < 2 || !value[1].IsString()) break;
imagePressed = value[1].GetString();
if(value.Size() < 3 || !value[2].IsString()) break;
imageDisable = value[2].GetString();
}while(0);
btn->setImages(imageNormal, imagePressed, imageDisable);
}
}
else if(name == "tileImage")
{
std::string imageTile, imageDisable;
if(value.IsArray())
{
do
{
if(value.Size() < 1 || !value[0u].IsString()) break;
imageTile = value[0u].GetString();
if(value.Size() < 2 || !value[1].IsString()) break;
imageDisable = value[1].GetString();
}while(0);
btn->setTileImage(imageTile, imageDisable);
}
}
else if(name == "customSizeEnable")
{
if(value.IsBool())
{
btn->setCustomSizeEnable(value.GetBool());
}
}
else
{
return base_class::setProperty(p, name, value, properties);
}
return true;
}
void UIButtonLoader::trimProperty(rapidjson::Value & property, rapidjson::Value::AllocatorType & allocator)
{
rapidjson::Value *jvalue = &property["customSizeEnable"];
if(!jvalue->IsBool() || !jvalue->GetBool())
{
property.RemoveMemberStable("size");
property.RemoveMemberStable("percentSize");
property.RemoveMemberStable("sizeType");
}
base_class::trimProperty(property, allocator);
}
bool UIButtonLoader::hookPropertyChange(PropertyParam & param)
{
if(param.name == "size" || param.name == "percentSize" || param.name == "sizeType")
{
rapidjson::Value & jvalue = param.properties["customSizeEnable"];
if(!jvalue.IsBool() || !jvalue.GetBool())
{
return false;
}
}
return base_class::hookPropertyChange(param);
}
| 25.688406 | 139 | 0.521016 | youlanhai |
f3601d9449452b3ed499080a6131888a603b4454 | 426 | cpp | C++ | libs/dg_cli.cpp | xmac1/udpserver | d392eaf716f7762ec40bc01710a108364e0b2ca2 | [
"Apache-2.0"
] | null | null | null | libs/dg_cli.cpp | xmac1/udpserver | d392eaf716f7762ec40bc01710a108364e0b2ca2 | [
"Apache-2.0"
] | null | null | null | libs/dg_cli.cpp | xmac1/udpserver | d392eaf716f7762ec40bc01710a108364e0b2ca2 | [
"Apache-2.0"
] | null | null | null | //
// Created by xmac on 18-10-22.
//
#include "../include/unp.h"
void dg_cli(FILE* fp, int sockfd, const SA* servaddr, socklen_t addrlen) {
int n;
int recvline[MAXLINE], sendline[MAXLINE];
while(Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(recvline), 0, servaddr, addrlen);
Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
Fputs(recvline, stdout);
}
} | 25.058824 | 74 | 0.633803 | xmac1 |
f360c0f3174cc8666055ba588bca76206daa4f53 | 1,099 | cpp | C++ | HomeWork/HomeWork220126/HomeWork220126.cpp | Munjongyun/HomeWork | 9215fdcf283e70591cc67acd41f5b19fa6d6c22e | [
"MIT"
] | null | null | null | HomeWork/HomeWork220126/HomeWork220126.cpp | Munjongyun/HomeWork | 9215fdcf283e70591cc67acd41f5b19fa6d6c22e | [
"MIT"
] | null | null | null | HomeWork/HomeWork220126/HomeWork220126.cpp | Munjongyun/HomeWork | 9215fdcf283e70591cc67acd41f5b19fa6d6c22e | [
"MIT"
] | null | null | null | // HomeWork220126.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <iostream>
class MyInt
{
public:
int Value;
public:
MyInt(int _Value)
: Value(_Value)
{
}
MyInt& operator++()
{
Value += 1;
return *this;
}
MyInt operator++(int)
{
MyInt result(Value);
Value += 1;
return result;
}
};
int main()
{
int Value = 0;
int Result = 0;
Result = ++Value;
Result = 0;
Result = Value++;
MyInt MyValue = 0;
MyInt MyResult = 0;
// ++ 쓰지마세요
MyResult = ++MyValue;
MyResult = 0;
MyResult = MyValue++;
int a = 0;
}
// 프로그램 실행: <Ctrl+F5> 또는 [디버그] > [디버깅하지 않고 시작] 메뉴
// 프로그램 디버그: <F5> 키 또는 [디버그] > [디버깅 시작] 메뉴
// 시작을 위한 팁:
// 1. [솔루션 탐색기] 창을 사용하여 파일을 추가/관리합니다.
// 2. [팀 탐색기] 창을 사용하여 소스 제어에 연결합니다.
// 3. [출력] 창을 사용하여 빌드 출력 및 기타 메시지를 확인합니다.
// 4. [오류 목록] 창을 사용하여 오류를 봅니다.
// 5. [프로젝트] > [새 항목 추가]로 이동하여 새 코드 파일을 만들거나, [프로젝트] > [기존 항목 추가]로 이동하여 기존 코드 파일을 프로젝트에 추가합니다.
// 6. 나중에 이 프로젝트를 다시 열려면 [파일] > [열기] > [프로젝트]로 이동하고 .sln 파일을 선택합니다.
| 16.907692 | 96 | 0.519563 | Munjongyun |
f364bd2777c2dfa159ae5e9b20004d1541c05fad | 13,424 | cpp | C++ | src/v_palette.cpp | 351ELEC/lzdoom | 2ee3ea91bc9c052b3143f44c96d85df22851426f | [
"RSA-MD"
] | 2 | 2020-04-19T13:37:34.000Z | 2021-06-09T04:26:25.000Z | src/v_palette.cpp | 351ELEC/lzdoom | 2ee3ea91bc9c052b3143f44c96d85df22851426f | [
"RSA-MD"
] | null | null | null | src/v_palette.cpp | 351ELEC/lzdoom | 2ee3ea91bc9c052b3143f44c96d85df22851426f | [
"RSA-MD"
] | null | null | null | /*
** v_palette.cpp
** Automatic colormap generation for "colored lights", etc.
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "g_level.h"
#include <stddef.h>
#include <string.h>
#include <math.h>
#include <float.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#define O_BINARY 0
#endif
#include <fcntl.h>
#include "templates.h"
#include "v_video.h"
#include "i_system.h"
#include "w_wad.h"
#include "i_video.h"
#include "c_dispatch.h"
#include "st_stuff.h"
#include "gi.h"
#include "x86.h"
#include "colormatcher.h"
#include "v_palette.h"
#include "g_levellocals.h"
#include "r_data/colormaps.h"
FPalette GPalette;
FColorMatcher ColorMatcher;
/* Current color blending values */
int BlendR, BlendG, BlendB, BlendA;
static int sortforremap (const void *a, const void *b);
static int sortforremap2 (const void *a, const void *b);
/**************************/
/* Gamma correction stuff */
/**************************/
uint8_t newgamma[256];
CUSTOM_CVAR (Float, Gamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self == 0.f)
{ // Gamma values of 0 are illegal.
self = 1.f;
return;
}
if (screen != NULL)
{
screen->SetGamma (self);
}
}
CCMD (bumpgamma)
{
// [RH] Gamma correction tables are now generated
// on the fly for *any* gamma level.
// Q: What are reasonable limits to use here?
float newgamma = Gamma + 0.1f;
if (newgamma > 3.0)
newgamma = 1.0;
Gamma = newgamma;
Printf ("Gamma correction level %g\n", *Gamma);
}
/****************************/
/* Palette management stuff */
/****************************/
int BestColor (const uint32_t *pal_in, int r, int g, int b, int first, int num)
{
const PalEntry *pal = (const PalEntry *)pal_in;
int bestcolor = first;
int bestdist = 257 * 257 + 257 * 257 + 257 * 257;
for (int color = first; color < num; color++)
{
int x = r - pal[color].r;
int y = g - pal[color].g;
int z = b - pal[color].b;
int dist = x*x + y*y + z*z;
if (dist < bestdist)
{
if (dist == 0)
return color;
bestdist = dist;
bestcolor = color;
}
}
return bestcolor;
}
FPalette::FPalette ()
{
}
FPalette::FPalette (const uint8_t *colors)
{
SetPalette (colors);
}
void FPalette::SetPalette (const uint8_t *colors)
{
for (int i = 0; i < 256; i++, colors += 3)
{
BaseColors[i] = PalEntry (colors[0], colors[1], colors[2]);
Remap[i] = i;
}
// Find white and black from the original palette so that they can be
// used to make an educated guess of the translucency % for a BOOM
// translucency map.
WhiteIndex = BestColor ((uint32_t *)BaseColors, 255, 255, 255, 0, 255);
BlackIndex = BestColor ((uint32_t *)BaseColors, 0, 0, 0, 0, 255);
}
// In ZDoom's new texture system, color 0 is used as the transparent color.
// But color 0 is also a valid color for Doom engine graphics. What to do?
// Simple. The default palette for every game has at least one duplicate
// color, so find a duplicate pair of palette entries, make one of them a
// duplicate of color 0, and remap every graphic so that it uses that entry
// instead of entry 0.
void FPalette::MakeGoodRemap ()
{
PalEntry color0 = BaseColors[0];
int i;
// First try for an exact match of color 0. Only Hexen does not have one.
for (i = 1; i < 256; ++i)
{
if (BaseColors[i] == color0)
{
Remap[0] = i;
break;
}
}
// If there is no duplicate of color 0, find the first set of duplicate
// colors and make one of them a duplicate of color 0. In Hexen's PLAYPAL
// colors 209 and 229 are the only duplicates, but we cannot assume
// anything because the player might be using a custom PLAYPAL where those
// entries are not duplicates.
if (Remap[0] == 0)
{
PalEntry sortcopy[256];
for (i = 0; i < 256; ++i)
{
sortcopy[i] = BaseColors[i] | (i << 24);
}
qsort (sortcopy, 256, 4, sortforremap);
for (i = 255; i > 0; --i)
{
if ((sortcopy[i] & 0xFFFFFF) == (sortcopy[i-1] & 0xFFFFFF))
{
int new0 = sortcopy[i].a;
int dup = sortcopy[i-1].a;
if (new0 > dup)
{
// Make the lower-numbered entry a copy of color 0. (Just because.)
swapvalues (new0, dup);
}
Remap[0] = new0;
Remap[new0] = dup;
BaseColors[new0] = color0;
break;
}
}
}
// If there were no duplicates, InitPalette() will remap color 0 to the
// closest matching color. Hopefully nobody will use a palette where all
// 256 entries are different. :-)
}
static int sortforremap (const void *a, const void *b)
{
return (*(const uint32_t *)a & 0xFFFFFF) - (*(const uint32_t *)b & 0xFFFFFF);
}
struct RemappingWork
{
uint32_t Color;
uint8_t Foreign; // 0 = local palette, 1 = foreign palette
uint8_t PalEntry; // Entry # in the palette
uint8_t Pad[2];
};
void FPalette::MakeRemap (const uint32_t *colors, uint8_t *remap, const uint8_t *useful, int numcolors) const
{
RemappingWork workspace[255+256];
int i, j, k;
// Fill in workspace with the colors from the passed palette and this palette.
// By sorting this array, we can quickly find exact matches so that we can
// minimize the time spent calling BestColor for near matches.
for (i = 1; i < 256; ++i)
{
workspace[i-1].Color = uint32_t(BaseColors[i]) & 0xFFFFFF;
workspace[i-1].Foreign = 0;
workspace[i-1].PalEntry = i;
}
for (i = k = 0, j = 255; i < numcolors; ++i)
{
if (useful == NULL || useful[i] != 0)
{
workspace[j].Color = colors[i] & 0xFFFFFF;
workspace[j].Foreign = 1;
workspace[j].PalEntry = i;
++j;
++k;
}
else
{
remap[i] = 0;
}
}
qsort (workspace, j, sizeof(RemappingWork), sortforremap2);
// Find exact matches
--j;
for (i = 0; i < j; ++i)
{
if (workspace[i].Foreign)
{
if (!workspace[i+1].Foreign && workspace[i].Color == workspace[i+1].Color)
{
remap[workspace[i].PalEntry] = workspace[i+1].PalEntry;
workspace[i].Foreign = 2;
++i;
--k;
}
}
}
// Find near matches
if (k > 0)
{
for (i = 0; i <= j; ++i)
{
if (workspace[i].Foreign == 1)
{
remap[workspace[i].PalEntry] = BestColor ((uint32_t *)BaseColors,
RPART(workspace[i].Color), GPART(workspace[i].Color), BPART(workspace[i].Color),
1, 255);
}
}
}
}
static int sortforremap2 (const void *a, const void *b)
{
const RemappingWork *ap = (const RemappingWork *)a;
const RemappingWork *bp = (const RemappingWork *)b;
if (ap->Color == bp->Color)
{
return bp->Foreign - ap->Foreign;
}
else
{
return ap->Color - bp->Color;
}
}
void ReadPalette(int lumpnum, uint8_t *buffer)
{
if (lumpnum < 0)
{
I_FatalError("Palette not found");
}
FMemLump lump = Wads.ReadLump(lumpnum);
uint8_t *lumpmem = (uint8_t*)lump.GetMem();
memset(buffer, 0, 768);
if (memcmp(lumpmem, "JASC-PAL", 8))
{
memcpy(buffer, lumpmem, MIN<size_t>(768, lump.GetSize()));
}
else
{
FScanner sc;
sc.OpenMem(Wads.GetLumpFullName(lumpnum), (char*)lumpmem, int(lump.GetSize()));
sc.MustGetString();
sc.MustGetNumber(); // version - ignore
sc.MustGetNumber();
int colors = MIN(256, sc.Number) * 3;
for (int i = 0; i < colors; i++)
{
sc.MustGetNumber();
if (sc.Number < 0 || sc.Number > 255)
{
sc.ScriptError("Color %d value out of range.", sc.Number);
}
buffer[i] = sc.Number;
}
}
}
void InitPalette ()
{
uint8_t pal[768];
ReadPalette(Wads.CheckNumForName("PLAYPAL"), pal);
GPalette.SetPalette (pal);
GPalette.MakeGoodRemap ();
ColorMatcher.SetPalette ((uint32_t *)GPalette.BaseColors);
if (GPalette.Remap[0] == 0)
{ // No duplicates, so settle for something close to color 0
GPalette.Remap[0] = BestColor ((uint32_t *)GPalette.BaseColors,
GPalette.BaseColors[0].r, GPalette.BaseColors[0].g, GPalette.BaseColors[0].b, 1, 255);
}
// Colormaps have to be initialized before actors are loaded,
// otherwise Powerup.Colormap will not work.
R_InitColormaps ();
}
void DoBlending_MMX (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);
void DoBlending_SSE2 (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);
void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a)
{
if (a == 0)
{
if (from != to)
{
memcpy (to, from, count * sizeof(uint32_t));
}
return;
}
else if (a == 256)
{
uint32_t t = MAKERGB(r,g,b);
int i;
for (i = 0; i < count; i++)
{
to[i] = t;
}
return;
}
#if defined(_M_X64) || defined(_M_IX86) || defined(__i386__) || defined(__amd64__)
else if (CPU.bSSE2)
{
if (count >= 4)
{
int not3count = count & ~3;
DoBlending_SSE2 (from, to, not3count, r, g, b, a);
count &= 3;
if (count <= 0)
{
return;
}
from += not3count;
to += not3count;
}
}
#endif
#if defined(_M_IX86) || defined(__i386__)
else if (CPU.bMMX)
{
if (count >= 4)
{
int not3count = count & ~3;
DoBlending_MMX (from, to, not3count, r, g, b, a);
count &= 3;
if (count <= 0)
{
return;
}
from += not3count;
to += not3count;
}
}
#endif
int i, ia;
ia = 256 - a;
r *= a;
g *= a;
b *= a;
for (i = count; i > 0; i--, to++, from++)
{
to->r = (r + from->r * ia) >> 8;
to->g = (g + from->g * ia) >> 8;
to->b = (b + from->b * ia) >> 8;
}
}
void V_SetBlend (int blendr, int blendg, int blendb, int blenda)
{
// Don't do anything if the new blend is the same as the old
if (((blenda|BlendA) == 0) ||
(blendr == BlendR &&
blendg == BlendG &&
blendb == BlendB &&
blenda == BlendA))
return;
V_ForceBlend (blendr, blendg, blendb, blenda);
}
void V_ForceBlend (int blendr, int blendg, int blendb, int blenda)
{
BlendR = blendr;
BlendG = blendg;
BlendB = blendb;
BlendA = blenda;
screen->SetFlash (PalEntry (BlendR, BlendG, BlendB), BlendA);
}
CCMD (testblend)
{
FString colorstring;
int color;
float amt;
if (argv.argc() < 3)
{
Printf ("testblend <color> <amount>\n");
}
else
{
if ( !(colorstring = V_GetColorStringByName (argv[1])).IsEmpty() )
{
color = V_GetColorFromString (NULL, colorstring);
}
else
{
color = V_GetColorFromString (NULL, argv[1]);
}
amt = (float)atof (argv[2]);
if (amt > 1.0f)
amt = 1.0f;
else if (amt < 0.0f)
amt = 0.0f;
BaseBlendR = RPART(color);
BaseBlendG = GPART(color);
BaseBlendB = BPART(color);
BaseBlendA = amt;
}
}
/****** Colorspace Conversion Functions ******/
// Code from http://www.cs.rit.edu/~yxv4997/t_convert.html
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]
// if s == 0, then h = -1 (undefined)
// Green Doom guy colors:
// RGB - 0: { .46 1 .429 } 7: { .254 .571 .206 } 15: { .0317 .0794 .0159 }
// HSV - 0: { 116.743 .571 1 } 7: { 112.110 .639 .571 } 15: { 105.071 .800 .0794 }
void RGBtoHSV (float r, float g, float b, float *h, float *s, float *v)
{
float min, max, delta, foo;
if (r == g && g == b)
{
*h = 0;
*s = 0;
*v = r;
return;
}
foo = r < g ? r : g;
min = (foo < b) ? foo : b;
foo = r > g ? r : g;
max = (foo > b) ? foo : b;
*v = max; // v
delta = max - min;
*s = delta / max; // s
if (r == max)
*h = (g - b) / delta; // between yellow & magenta
else if (g == max)
*h = 2 + (b - r) / delta; // between cyan & yellow
else
*h = 4 + (r - g) / delta; // between magenta & cyan
*h *= 60; // degrees
if (*h < 0)
*h += 360;
}
void HSVtoRGB (float *r, float *g, float *b, float h, float s, float v)
{
int i;
float f, p, q, t;
if (s == 0)
{ // achromatic (grey)
*r = *g = *b = v;
return;
}
h /= 60; // sector 0 to 5
i = (int)floor (h);
f = h - i; // factorial part of h
p = v * (1 - s);
q = v * (1 - s * f);
t = v * (1 - s * (1 - f));
switch (i)
{
case 0: *r = v; *g = t; *b = p; break;
case 1: *r = q; *g = v; *b = p; break;
case 2: *r = p; *g = v; *b = t; break;
case 3: *r = p; *g = q; *b = v; break;
case 4: *r = t; *g = p; *b = v; break;
default: *r = v; *g = p; *b = q; break;
}
}
| 23.675485 | 109 | 0.610623 | 351ELEC |
f364f98554b8570a3c01ed661bdc0ded28f229aa | 1,004 | cpp | C++ | GOOGLETEST/RangeValidator/testRunner.cpp | Amit-Khobragade/Google-Test-And-Mock-Examples-Using-Cmake | f1a3951c5fb9c29cc3de7deadb34caea5c8829d0 | [
"MIT"
] | null | null | null | GOOGLETEST/RangeValidator/testRunner.cpp | Amit-Khobragade/Google-Test-And-Mock-Examples-Using-Cmake | f1a3951c5fb9c29cc3de7deadb34caea5c8829d0 | [
"MIT"
] | null | null | null | GOOGLETEST/RangeValidator/testRunner.cpp | Amit-Khobragade/Google-Test-And-Mock-Examples-Using-Cmake | f1a3951c5fb9c29cc3de7deadb34caea5c8829d0 | [
"MIT"
] | null | null | null | #include <iostream>
// #include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "checker.h"
/////////////////////////////////////////////////////////////
//fixture class for parameters
class RangeCheckerFixture: public testing::TestWithParam<double>{
public:
RangeCheckerFixture() = default;
protected:
RangeChecker range{ 0.0, 100.0 };
};
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
//test with param
TEST_P( RangeCheckerFixture, TEST_IN_RANGE ){
int param = GetParam();
std::cout<< "\n\n" <<param << "\n\n";
bool testval= range( param );
ASSERT_TRUE( testval );
}
/////////////////////////////////////////////////////////////
INSTANTIATE_TEST_CASE_P( TEST_IN_RANGE, RangeCheckerFixture, testing::Values(1,20,30,40,120));
int main( int argc, char* argv[] ){
testing::InitGoogleTest( &argc, argv );
return RUN_ALL_TESTS();
} | 31.375 | 94 | 0.479084 | Amit-Khobragade |
f3692526af1e199b77934e57ac9e25971c840cf6 | 30,478 | cc | C++ | src/perf_data_converter.cc | EricMountain/perf_data_converter | 1684499f7d18cefef820fbfec45309ac998e3c25 | [
"BSD-3-Clause"
] | null | null | null | src/perf_data_converter.cc | EricMountain/perf_data_converter | 1684499f7d18cefef820fbfec45309ac998e3c25 | [
"BSD-3-Clause"
] | null | null | null | src/perf_data_converter.cc | EricMountain/perf_data_converter | 1684499f7d18cefef820fbfec45309ac998e3c25 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2016, Google Inc.
* All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/perf_data_converter.h"
#include <algorithm>
#include <deque>
#include <map>
#include <sstream>
#include <utility>
#include <vector>
#include "src/builder.h"
#include "src/compat/int_compat.h"
#include "src/compat/string_compat.h"
#include "src/perf_data_handler.h"
#include "src/quipper/perf_data.pb.h"
#include "src/quipper/perf_parser.h"
#include "src/quipper/perf_reader.h"
namespace perftools {
namespace {
typedef perftools::profiles::Profile Profile;
typedef perftools::profiles::Builder ProfileBuilder;
typedef uint32 Pid;
typedef uint32 Tid;
enum ExecutionMode {
Unknown,
HostKernel,
HostUser,
GuestKernel,
GuestUser,
Hypervisor
};
const char* ExecModeString(ExecutionMode mode) {
switch (mode) {
case HostKernel:
return ExecutionModeHostKernel;
case HostUser:
return ExecutionModeHostUser;
case GuestKernel:
return ExecutionModeGuestKernel;
case GuestUser:
return ExecutionModeGuestUser;
case Hypervisor:
return ExecutionModeHypervisor;
default:
LOG(ERROR) << "Execution mode not handled: " << mode;
return "";
}
}
ExecutionMode PerfExecMode(const PerfDataHandler::SampleContext& sample) {
if (sample.header.has_misc()) {
switch (sample.header.misc() & quipper::PERF_RECORD_MISC_CPUMODE_MASK) {
case quipper::PERF_RECORD_MISC_KERNEL:
return HostKernel;
case quipper::PERF_RECORD_MISC_USER:
return HostUser;
case quipper::PERF_RECORD_MISC_GUEST_KERNEL:
return GuestKernel;
case quipper::PERF_RECORD_MISC_GUEST_USER:
return GuestUser;
case quipper::PERF_RECORD_MISC_HYPERVISOR:
return Hypervisor;
}
}
return Unknown;
}
// Adds the string to the profile builder. If the UTF-8 library is included,
// this also ensures the string contains structurally valid UTF-8.
// In order to successfully unmarshal the proto in Go, all strings inserted into
// the profile string table must be valid UTF-8.
int64 UTF8StringId(const string& s, ProfileBuilder* builder) {
return builder->StringId(s.c_str());
}
// List of profile location IDs, currently used to represent a call stack.
typedef std::vector<uint64> LocationIdVector;
// It is sufficient to key the location and mapping maps by PID.
// However, when Samples include labels, it is necessary to key their maps
// not only by PID, but also by anything their labels may contain, since labels
// are also distinguishing features. This struct should contain everything
// required to uniquely identify a Sample: if two Samples you consider different
// end up with the same SampleKey, you should extend SampleKey til they don't.
//
// If any of these values are not used as labels, they should be set to 0.
struct SampleKey {
Pid pid = 0;
Tid tid = 0;
uint64 time_ns = 0;
ExecutionMode exec_mode = Unknown;
// The index of the sample's command in the profile's string table.
uint64 comm = 0;
// The index of the sample's thread type in the profile's string table.
uint64 thread_type = 0;
// The index of the sample's thread command in the profile's string table.
uint64 thread_comm = 0;
// The index of the sample's cgroup name in the profiles's string table.
uint64 cgroup = 0;
uint64 code_page_size = 0;
uint64 data_page_size = 0;
LocationIdVector stack;
};
struct SampleKeyEqualityTester {
bool operator()(const SampleKey a, const SampleKey b) const {
return ((a.pid == b.pid) && (a.tid == b.tid) && (a.time_ns == b.time_ns) &&
(a.exec_mode == b.exec_mode) && (a.comm == b.comm) &&
(a.thread_type == b.thread_type) &&
(a.thread_comm == b.thread_comm) && (a.cgroup == b.cgroup) &&
(a.code_page_size == b.code_page_size) &&
(a.data_page_size == b.data_page_size) && (a.stack == b.stack));
}
};
struct SampleKeyHasher {
size_t operator()(const SampleKey k) const {
size_t hash = 0;
hash ^= std::hash<int32>()(k.pid);
hash ^= std::hash<int32>()(k.tid);
hash ^= std::hash<uint64>()(k.time_ns);
hash ^= std::hash<int>()(k.exec_mode);
hash ^= std::hash<uint64>()(k.comm);
hash ^= std::hash<uint64>()(k.thread_type);
hash ^= std::hash<uint64>()(k.thread_comm);
hash ^= std::hash<uint64>()(k.cgroup);
hash ^= std::hash<uint64>()(k.code_page_size);
hash ^= std::hash<uint64>()(k.data_page_size);
for (const auto& id : k.stack) {
hash ^= std::hash<uint64>()(id);
}
return hash;
}
};
// While Locations and Mappings are per-address-space (=per-process), samples
// can be thread-specific. If the requested sample labels include PID and
// TID, we'll need to maintain separate profile sample objects for samples
// that are identical except for TID. Likewise, if the requested sample
// labels include timestamp_ns, then we'll need to have separate
// profile_proto::Samples for samples that are identical except for timestamp.
typedef std::unordered_map<SampleKey, perftools::profiles::Sample*,
SampleKeyHasher, SampleKeyEqualityTester>
SampleMap;
// Map from a virtual address to a profile location ID. It only keys off the
// address, not also the mapping ID since the map / its portions are invalidated
// by Comm() and MMap() methods to force re-creation of those locations.
//
typedef std::map<uint64, uint64> LocationMap;
// Map from the handler mapping object to profile mapping ID. The mappings
// the handler creates are immutable and reasonably shared (as in no new mapping
// object is created per, say, each sample), so using the pointers is OK.
typedef std::unordered_map<const PerfDataHandler::Mapping*, uint64> MappingMap;
// Per-process (aggregated when no PID grouping requested) info.
// See docs on ProcessProfile in the header file for details on the fields.
class ProcessMeta {
public:
// Constructs the object for the specified PID.
explicit ProcessMeta(Pid pid) : pid_(pid) {}
// Updates the bounding time interval ranges per specified timestamp.
void UpdateTimestamps(int64 time_nsec) {
if (min_sample_time_ns_ == 0 || time_nsec < min_sample_time_ns_) {
min_sample_time_ns_ = time_nsec;
}
if (max_sample_time_ns_ == 0 || time_nsec > max_sample_time_ns_) {
max_sample_time_ns_ = time_nsec;
}
}
std::unique_ptr<ProcessProfile> makeProcessProfile(Profile* data) {
ProcessProfile* pp = new ProcessProfile();
pp->pid = pid_;
pp->data.Swap(data);
pp->min_sample_time_ns = min_sample_time_ns_;
pp->max_sample_time_ns = max_sample_time_ns_;
return std::unique_ptr<ProcessProfile>(pp);
}
private:
Pid pid_;
int64 min_sample_time_ns_ = 0;
int64 max_sample_time_ns_ = 0;
};
class PerfDataConverter : public PerfDataHandler {
public:
explicit PerfDataConverter(const quipper::PerfDataProto& perf_data,
uint32 sample_labels = kNoLabels,
uint32 options = kGroupByPids,
const std::map<Tid, string>& thread_types = {})
: perf_data_(perf_data),
sample_labels_(sample_labels),
options_(options) {
for (auto& it : thread_types) {
thread_types_.insert(std::make_pair(it.first, it.second));
}
}
PerfDataConverter(const PerfDataConverter&) = delete;
PerfDataConverter& operator=(const PerfDataConverter&) = delete;
virtual ~PerfDataConverter() {}
ProcessProfiles Profiles();
// Callbacks for PerfDataHandler
void Sample(const PerfDataHandler::SampleContext& sample) override;
void Comm(const CommContext& comm) override;
void MMap(const MMapContext& mmap) override;
private:
// Adds a new sample updating the event counters if such sample is not present
// in the profile initializing its metrics. Updates the metrics associated
// with the sample if the sample was added before.
void AddOrUpdateSample(const PerfDataHandler::SampleContext& context,
const Pid& pid, const SampleKey& sample_key,
ProfileBuilder* builder);
// Adds a new location to the profile if such location is not present in the
// profile, returning the ID of the location. It also adds the profile mapping
// corresponding to the specified handler mapping.
uint64 AddOrGetLocation(const Pid& pid, uint64 addr,
const PerfDataHandler::Mapping* mapping,
ProfileBuilder* builder);
// Adds a new mapping to the profile if such mapping is not present in the
// profile, returning the ID of the mapping. It returns 0 to indicate that the
// mapping was not added (only happens if smap == 0 currently).
uint64 AddOrGetMapping(const Pid& pid, const PerfDataHandler::Mapping* smap,
ProfileBuilder* builder);
// Returns whether pid labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludePidLabels() const { return (sample_labels_ & kPidLabel); }
// Returns whether tid labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeTidLabels() const { return (sample_labels_ & kTidLabel); }
// Returns whether timestamp_ns labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeTimestampNsLabels() const {
return (sample_labels_ & kTimestampNsLabel);
}
// Returns whether execution_mode labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeExecutionModeLabels() const {
return (sample_labels_ & kExecutionModeLabel);
}
// Returns whether comm labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeCommLabels() const { return (sample_labels_ & kCommLabel); }
// Returns whether thread type labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeThreadTypeLabels() const {
return (sample_labels_ & kThreadTypeLabel) && !thread_types_.empty();
}
// Returns whether thread comm labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeThreadCommLabels() const {
return (sample_labels_ & kThreadCommLabel);
}
// Returns whether cgroup labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeCgroupLabels() const { return (sample_labels_ & kCgroupLabel); }
// Returns whether code page size labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeCodePageSizeLabels() const {
return (sample_labels_ & kCodePageSizeLabel);
}
// Returns whether data page size labels were requested for inclusion in the
// profile.proto's Sample.Label field.
bool IncludeDataPageSizeLabels() const {
return (sample_labels_ & kDataPageSizeLabel);
}
SampleKey MakeSampleKey(const PerfDataHandler::SampleContext& sample,
ProfileBuilder* builder);
ProfileBuilder* GetOrCreateBuilder(
const PerfDataHandler::SampleContext& sample);
const quipper::PerfDataProto& perf_data_;
// Using deque so that appends do not invalidate existing pointers.
std::deque<ProfileBuilder> builders_;
std::deque<ProcessMeta> process_metas_;
struct PerPidInfo {
ProfileBuilder* builder = nullptr;
ProcessMeta* process_meta = nullptr;
LocationMap location_map;
MappingMap mapping_map;
std::unordered_map<Tid, string> tid_to_comm_map;
SampleMap sample_map;
void clear() {
builder = nullptr;
process_meta = nullptr;
location_map.clear();
mapping_map.clear();
tid_to_comm_map.clear();
sample_map.clear();
}
};
std::unordered_map<Pid, PerPidInfo> per_pid_;
const uint32 sample_labels_;
const uint32 options_;
std::unordered_map<Tid, string> thread_types_;
};
SampleKey PerfDataConverter::MakeSampleKey(
const PerfDataHandler::SampleContext& sample, ProfileBuilder* builder) {
SampleKey sample_key;
sample_key.pid = sample.sample.has_pid() ? sample.sample.pid() : 0;
sample_key.tid =
(IncludeTidLabels() && sample.sample.has_tid()) ? sample.sample.tid() : 0;
sample_key.time_ns =
(IncludeTimestampNsLabels() && sample.sample.has_sample_time_ns())
? sample.sample.sample_time_ns()
: 0;
if (IncludeExecutionModeLabels()) {
sample_key.exec_mode = PerfExecMode(sample);
}
if (IncludeCommLabels() && sample.sample.has_pid()) {
Pid pid = sample.sample.pid();
string comm = per_pid_[pid].tid_to_comm_map[pid];
sample_key.comm = UTF8StringId(comm, builder);
}
if (IncludeThreadTypeLabels() && sample.sample.has_tid()) {
Tid tid = sample.sample.tid();
auto it = thread_types_.find(tid);
if (it != thread_types_.end()) {
sample_key.thread_type = UTF8StringId(it->second, builder);
}
}
if (IncludeThreadCommLabels() && sample.sample.has_pid() &&
sample.sample.has_tid()) {
Pid pid = sample.sample.pid();
Tid tid = sample.sample.tid();
const string& comm = per_pid_[pid].tid_to_comm_map[tid];
sample_key.thread_comm = UTF8StringId(comm, builder);
}
if (IncludeCgroupLabels() && sample.cgroup) {
sample_key.cgroup = UTF8StringId(*sample.cgroup, builder);
}
if (IncludeCodePageSizeLabels() && sample.sample.has_code_page_size()) {
sample_key.code_page_size = sample.sample.code_page_size();
}
if (IncludeDataPageSizeLabels() && sample.sample.has_data_page_size()) {
sample_key.data_page_size = sample.sample.data_page_size();
}
return sample_key;
}
ProfileBuilder* PerfDataConverter::GetOrCreateBuilder(
const PerfDataHandler::SampleContext& sample) {
Pid builder_pid = (options_ & kGroupByPids) ? sample.sample.pid() : 0;
VLOG(2) << "Processing sample for PID=" << sample.sample.pid();
auto& per_pid = per_pid_[builder_pid];
if (per_pid.builder == nullptr) {
VLOG(2) << "Creating a new profile for PID key " << builder_pid;
builders_.push_back(ProfileBuilder());
per_pid.builder = &builders_.back();
process_metas_.push_back(ProcessMeta(builder_pid));
per_pid.process_meta = &process_metas_.back();
ProfileBuilder* builder = per_pid.builder;
Profile* profile = builder->mutable_profile();
int unknown_event_idx = 0;
for (int event_idx = 0; event_idx < perf_data_.file_attrs_size();
++event_idx) {
// Come up with an event name for this event. perf.data will usually
// contain an event_types section of the same cardinality as its
// file_attrs; in this case we can just use the name there. Otherwise
// we just give it an anonymous name.
string event_name = "";
if (perf_data_.file_attrs_size() == perf_data_.event_types_size()) {
const auto& event_type = perf_data_.event_types(event_idx);
if (event_type.has_name()) {
event_name = event_type.name() + "_";
}
}
if (event_name.empty()) {
event_name = "event_" + std::to_string(unknown_event_idx++) + "_";
}
auto sample_type = profile->add_sample_type();
sample_type->set_type(UTF8StringId(event_name + "sample", builder));
sample_type->set_unit(builder->StringId("count"));
sample_type = profile->add_sample_type();
sample_type->set_type(UTF8StringId(event_name + "event", builder));
sample_type->set_unit(builder->StringId("count"));
}
if (sample.main_mapping == nullptr) {
auto fake_main = profile->add_mapping();
fake_main->set_id(profile->mapping_size());
fake_main->set_memory_start(0);
fake_main->set_memory_limit(1);
} else {
AddOrGetMapping(sample.sample.pid(), sample.main_mapping, builder);
}
if (perf_data_.string_metadata().has_perf_version()) {
string perf_version =
"perf-version:" + perf_data_.string_metadata().perf_version().value();
profile->add_comment(UTF8StringId(perf_version, builder));
}
if (perf_data_.string_metadata().has_perf_command_line_whole()) {
string perf_command =
"perf-command:" +
perf_data_.string_metadata().perf_command_line_whole().value();
profile->add_comment(UTF8StringId(perf_command, builder));
}
} else {
Profile* profile = per_pid.builder->mutable_profile();
if ((options_ & kGroupByPids) && sample.main_mapping != nullptr &&
!sample.main_mapping->filename.empty()) {
const string& filename =
profile->string_table(profile->mapping(0).filename());
const string& sample_filename = MappingFilename(sample.main_mapping);
if (filename != sample_filename) {
if (options_ & kFailOnMainMappingMismatch) {
LOG(FATAL) << "main mapping mismatch: " << sample.sample.pid() << " "
<< filename << " " << sample_filename;
} else {
LOG(WARNING) << "main mapping mismatch: " << sample.sample.pid()
<< " " << filename << " " << sample_filename;
}
}
}
}
if (sample.sample.sample_time_ns()) {
per_pid.process_meta->UpdateTimestamps(sample.sample.sample_time_ns());
}
return per_pid.builder;
}
uint64 PerfDataConverter::AddOrGetMapping(const Pid& pid,
const PerfDataHandler::Mapping* smap,
ProfileBuilder* builder) {
CHECK(builder != nullptr) << "Cannot add mapping to null builder";
if (smap == nullptr) {
return 0;
}
MappingMap& mapmap = per_pid_[pid].mapping_map;
auto it = mapmap.find(smap);
if (it != mapmap.end()) {
return it->second;
}
Profile* profile = builder->mutable_profile();
auto mapping = profile->add_mapping();
uint64 mapping_id = profile->mapping_size();
mapping->set_id(mapping_id);
mapping->set_memory_start(smap->start);
mapping->set_memory_limit(smap->limit);
mapping->set_file_offset(smap->file_offset);
if (!smap->build_id.empty()) {
mapping->set_build_id(UTF8StringId(smap->build_id, builder));
}
string mapping_filename = MappingFilename(smap);
mapping->set_filename(UTF8StringId(mapping_filename, builder));
CHECK_LE(mapping->memory_start(), mapping->memory_limit())
<< "Mapping start must be strictly less than its limit: "
<< mapping->filename();
VLOG(2) << "Added mapping ID=" << mapping_id
<< ", filename=" << mapping_filename
<< ", memory_start=" << mapping->memory_start()
<< ", memory_limit=" << mapping->memory_limit()
<< ", file_offset=" << mapping->file_offset();
mapmap.insert(std::make_pair(smap, mapping_id));
return mapping_id;
}
void PerfDataConverter::AddOrUpdateSample(
const PerfDataHandler::SampleContext& context, const Pid& pid,
const SampleKey& sample_key, ProfileBuilder* builder) {
perftools::profiles::Sample* sample = per_pid_[pid].sample_map[sample_key];
if (sample == nullptr) {
Profile* profile = builder->mutable_profile();
sample = profile->add_sample();
per_pid_[pid].sample_map[sample_key] = sample;
for (const auto& location_id : sample_key.stack) {
sample->add_location_id(location_id);
}
// Emit any requested labels.
if (IncludePidLabels() && context.sample.has_pid()) {
auto* label = sample->add_label();
label->set_key(builder->StringId(PidLabelKey));
label->set_num(static_cast<int64>(context.sample.pid()));
}
if (IncludeTidLabels() && context.sample.has_tid()) {
auto* label = sample->add_label();
label->set_key(builder->StringId(TidLabelKey));
label->set_num(static_cast<int64>(context.sample.tid()));
}
if (IncludeCommLabels() && sample_key.comm != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(CommLabelKey));
label->set_str(sample_key.comm);
}
if (IncludeTimestampNsLabels() && context.sample.has_sample_time_ns()) {
auto* label = sample->add_label();
label->set_key(builder->StringId(TimestampNsLabelKey));
int64 timestamp_ns_as_int64 =
static_cast<int64>(context.sample.sample_time_ns());
label->set_num(timestamp_ns_as_int64);
}
if (IncludeExecutionModeLabels() && sample_key.exec_mode != Unknown) {
auto* label = sample->add_label();
label->set_key(builder->StringId(ExecutionModeLabelKey));
label->set_str(builder->StringId(ExecModeString(sample_key.exec_mode)));
}
if (IncludeThreadTypeLabels() && sample_key.thread_type != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(ThreadTypeLabelKey));
label->set_str(sample_key.thread_type);
}
if (IncludeThreadCommLabels() && sample_key.thread_comm != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(ThreadCommLabelKey));
label->set_str(sample_key.thread_comm);
}
if (IncludeCgroupLabels() && sample_key.cgroup != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(CgroupLabelKey));
label->set_str(sample_key.cgroup);
}
if (IncludeCodePageSizeLabels() && sample_key.code_page_size != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(CodePageSizeLabelKey));
label->set_num(sample_key.code_page_size);
}
if (IncludeDataPageSizeLabels() && sample_key.data_page_size != 0) {
auto* label = sample->add_label();
label->set_key(builder->StringId(DataPageSizeLabelKey));
label->set_num(sample_key.data_page_size);
}
// Two values per collected event: the first is sample counts, the second is
// event counts (unsampled weight for each sample).
for (int event_id = 0; event_id < perf_data_.file_attrs_size();
++event_id) {
sample->add_value(0);
sample->add_value(0);
}
}
int64 weight = 1;
// If the sample has a period, use that in preference
if (context.sample.period() > 0) {
weight = context.sample.period();
} else if (context.file_attrs_index >= 0) {
uint64 period =
perf_data_.file_attrs(context.file_attrs_index).attr().sample_period();
if (period > 0) {
// If sampling used a fixed period, use that as the weight.
weight = period;
}
}
int event_index = context.file_attrs_index;
sample->set_value(2 * event_index, sample->value(2 * event_index) + 1);
sample->set_value(2 * event_index + 1,
sample->value(2 * event_index + 1) + weight);
}
uint64 PerfDataConverter::AddOrGetLocation(
const Pid& pid, uint64 addr, const PerfDataHandler::Mapping* mapping,
ProfileBuilder* builder) {
LocationMap& loc_map = per_pid_[pid].location_map;
auto loc_it = loc_map.find(addr);
if (loc_it != loc_map.end()) {
return loc_it->second;
}
Profile* profile = builder->mutable_profile();
perftools::profiles::Location* loc = profile->add_location();
uint64 loc_id = profile->location_size();
loc->set_id(loc_id);
loc->set_address(addr);
uint64 mapping_id = AddOrGetMapping(pid, mapping, builder);
if (mapping_id != 0) {
loc->set_mapping_id(mapping_id);
} else {
CHECK(addr == 0) << "Unmapped address in PID " << pid;
}
VLOG(2) << "Added location ID=" << loc_id << ", addr=" << addr
<< ", mapping_id=" << mapping_id;
loc_map[addr] = loc_id;
return loc_id;
}
void PerfDataConverter::Comm(const CommContext& comm) {
Pid pid = comm.comm->pid();
Tid tid = comm.comm->tid();
if (comm.is_exec) {
// The is_exec bit indicates an exec() happened, so clear everything
// from the existing pid.
VLOG(2) << "exec() for PID=" << pid << ", clearing the profile";
per_pid_[pid].clear();
}
per_pid_[pid].tid_to_comm_map[tid] = PerfDataHandler::NameOrMd5Prefix(
comm.comm->comm(), comm.comm->comm_md5_prefix());
}
// Invalidates the locations in location_map in the mmap event's range.
void PerfDataConverter::MMap(const MMapContext& mmap) {
LocationMap& loc_map = per_pid_[mmap.pid].location_map;
loc_map.erase(loc_map.lower_bound(mmap.mapping->start),
loc_map.lower_bound(mmap.mapping->limit));
}
void PerfDataConverter::Sample(const PerfDataHandler::SampleContext& sample) {
if (sample.file_attrs_index < 0 ||
sample.file_attrs_index >= perf_data_.file_attrs_size()) {
LOG(WARNING) << "out of bounds file_attrs_index: "
<< sample.file_attrs_index;
return;
}
Pid event_pid = sample.sample.pid();
ProfileBuilder* builder = GetOrCreateBuilder(sample);
SampleKey sample_key = MakeSampleKey(sample, builder);
uint64 ip = sample.sample_mapping != nullptr ? sample.sample.ip() : 0;
if (ip != 0) {
const auto start = sample.sample_mapping->start;
const auto limit = sample.sample_mapping->limit;
CHECK_GE(ip, start);
CHECK_LT(ip, limit);
}
// Leaf at stack[0]. Record the program counter of the sample as the leaf of
// the stack. When kAddDataAddressFrames is set, add another leaf with the
// virtual data address of the access.
if (options_ & kAddDataAddressFrames) {
uint64 addr = sample.addr_mapping != nullptr ? sample.sample.addr() : 0;
if (addr != 0) {
const auto start = sample.addr_mapping->start;
const auto limit = sample.addr_mapping->limit;
CHECK_GE(addr, start);
CHECK_LT(addr, limit);
}
sample_key.stack.push_back(
AddOrGetLocation(event_pid, addr, sample.addr_mapping, builder));
}
sample_key.stack.push_back(
AddOrGetLocation(event_pid, ip, sample.sample_mapping, builder));
// LBR callstacks include only user call chains. If this is an LBR sample,
// we get the kernel callstack from the sample's callchain, and the user
// callstack from the sample's branch_stack.
const bool lbr_sample = !sample.branch_stack.empty();
bool skipped_dup = false;
for (const auto& frame : sample.callchain) {
if (lbr_sample && frame.ip == quipper::PERF_CONTEXT_USER) {
break;
}
// These aren't real callchain entries, just hints as to kernel / user
// addresses.
if (frame.ip >= quipper::PERF_CONTEXT_MAX) {
continue;
}
// perf_events includes the IP at the leaf of the callchain. If PEBS is on,
// kernels built after
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/events/intel/ds.c?id=b8000586c90b4804902058a38d3a59ce5708e695
// will have the first callchain entry be the interrupted IP, while in older
// kernels it will be the sampled IP. If PEBS is off, the first callchain
// entry will be the interrupted IP. Either way, skip the first non-marker
// entry.
if (!skipped_dup) {
skipped_dup = true;
continue;
}
if (frame.mapping == nullptr) {
continue;
}
// Why <=? Because this is a return address, which should be
// preceded by a call (the "real" context.) If we're at the edge
// of the mapping, we're really off its edge.
if (frame.ip <= frame.mapping->start) {
continue;
}
// Subtract one so we point to the call instead of the return addr.
sample_key.stack.push_back(
AddOrGetLocation(event_pid, frame.ip - 1, frame.mapping, builder));
}
for (const auto& frame : sample.branch_stack) {
// branch_stack entries are pairs of <from, to> locations corresponding to
// addresses of call instructions and target addresses of those calls.
// We need only the addresses of the function call instructions, stored in
// the 'from' field, to recover the call chains.
if (frame.from.mapping == nullptr) {
continue;
}
// An LBR entry includes the address of the call instruction, so we don't
// have to do any adjustments.
if (frame.from.ip < frame.from.mapping->start) {
continue;
}
sample_key.stack.push_back(AddOrGetLocation(event_pid, frame.from.ip,
frame.from.mapping, builder));
}
AddOrUpdateSample(sample, event_pid, sample_key, builder);
}
ProcessProfiles PerfDataConverter::Profiles() {
ProcessProfiles pps;
for (size_t i = 0; i < builders_.size(); i++) {
auto& b = builders_[i];
b.Finalize();
auto pp = process_metas_[i].makeProcessProfile(b.mutable_profile());
pps.push_back(std::move(pp));
}
return pps;
}
} // namespace
ProcessProfiles PerfDataProtoToProfiles(
const quipper::PerfDataProto* perf_data, const uint32 sample_labels,
const uint32 options, const std::map<Tid, string>& thread_types) {
PerfDataConverter converter(*perf_data, sample_labels, options, thread_types);
PerfDataHandler::Process(*perf_data, &converter);
return converter.Profiles();
}
ProcessProfiles RawPerfDataToProfiles(
const void* raw, const int raw_size,
const std::map<string, string>& build_ids, const uint32 sample_labels,
const uint32 options, const std::map<Tid, string>& thread_types) {
quipper::PerfReader reader;
if (!reader.ReadFromPointer(reinterpret_cast<const char*>(raw), raw_size)) {
LOG(ERROR) << "Could not read input perf.data";
return ProcessProfiles();
}
reader.InjectBuildIDs(build_ids);
// Perf populates info about the kernel using multiple pathways,
// which don't actually all match up how they name kernel data; in
// particular, buildids are reported by a different name than the
// actual "mmap" info. Normalize these names so our ProcessProfiles
// will match kernel mappings to a buildid.
reader.LocalizeUsingFilenames({
{"[kernel.kallsyms]_text", "[kernel.kallsyms]"},
{"[kernel.kallsyms]_stext", "[kernel.kallsyms]"},
});
// Use PerfParser to modify reader's events to have magic done to them such
// as hugepage deduction and sorting events based on time, if timestamps are
// present.
quipper::PerfParserOptions opts;
opts.sort_events_by_time = true;
opts.deduce_huge_page_mappings = true;
opts.combine_mappings = true;
opts.allow_unaligned_jit_mappings = options & kAllowUnalignedJitMappings;
quipper::PerfParser parser(&reader, opts);
if (!parser.ParseRawEvents()) {
LOG(ERROR) << "Could not parse perf events.";
return ProcessProfiles();
}
return PerfDataProtoToProfiles(&reader.proto(), sample_labels, options,
thread_types);
}
} // namespace perftools
| 38.924649 | 151 | 0.686725 | EricMountain |
f36943983cbb129ac4ea3529f8001b09153510c3 | 991 | cpp | C++ | CWin/CWin/control/radio_check_button_control_group.cpp | benbraide/CWin | 0441b48a71fef0dbddabf61033d7286669772c1e | [
"MIT"
] | null | null | null | CWin/CWin/control/radio_check_button_control_group.cpp | benbraide/CWin | 0441b48a71fef0dbddabf61033d7286669772c1e | [
"MIT"
] | null | null | null | CWin/CWin/control/radio_check_button_control_group.cpp | benbraide/CWin | 0441b48a71fef0dbddabf61033d7286669772c1e | [
"MIT"
] | null | null | null | #include "../hook/responsive_hooks.h"
#include "radio_check_button_control_group.h"
cwin::control::radio_group::radio_group(){
insert_object<hook::contain>(nullptr);
}
cwin::control::radio_group::radio_group(tree &parent)
: radio_group(parent, static_cast<std::size_t>(-1)){}
cwin::control::radio_group::radio_group(tree &parent, std::size_t index)
: radio_group(){
index_ = index;
if (&parent.get_thread() == &thread_)
set_parent_(parent);
else//Error
throw thread::exception::context_mismatch();
}
cwin::control::radio_group::~radio_group(){
force_destroy_();
}
bool cwin::control::radio_group::inserting_child_(ui::object &child){
return (dynamic_cast<check_button *>(&child) != nullptr || dynamic_cast<hook::object *>(&child) != nullptr);
}
void cwin::control::radio_group::create_(){
creation_state_ = true;
}
void cwin::control::radio_group::destroy_(){
creation_state_ = false;
}
bool cwin::control::radio_group::is_created_() const{
return creation_state_;
}
| 24.775 | 109 | 0.732593 | benbraide |
f36b433e6ea74cad89816d4e70986e1300f005b6 | 2,762 | cpp | C++ | oneflow/core/operator/acc_tick_op.cpp | wangyuyue/oneflow | 0a71c22fe8355392acc8dc0e301589faee4c4832 | [
"Apache-2.0"
] | 3,285 | 2020-07-31T05:51:22.000Z | 2022-03-31T15:20:16.000Z | oneflow/core/operator/acc_tick_op.cpp | wangyuyue/oneflow | 0a71c22fe8355392acc8dc0e301589faee4c4832 | [
"Apache-2.0"
] | 2,417 | 2020-07-31T06:28:58.000Z | 2022-03-31T23:04:14.000Z | oneflow/core/operator/acc_tick_op.cpp | wangyuyue/oneflow | 0a71c22fe8355392acc8dc0e301589faee4c4832 | [
"Apache-2.0"
] | 520 | 2020-07-31T05:52:42.000Z | 2022-03-29T02:38:11.000Z | /*
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "oneflow/core/operator/acc_tick_op.h"
namespace oneflow {
namespace {
Maybe<void> InferBlobDescs(const std::function<BlobDesc*(const std::string&)>& GetBlobDesc4BnInOp) {
*GetBlobDesc4BnInOp("acc") = *GetBlobDesc4BnInOp("one");
GetBlobDesc4BnInOp("acc")->mut_shape() = Shape({1LL});
return Maybe<void>::Ok();
}
} // namespace
Maybe<void> AccTickOp::InitFromOpConf() {
CHECK(op_conf().has_acc_tick_conf());
EnrollInputBn("one", false);
EnrollOutputBn("acc", false);
return Maybe<void>::Ok();
}
Maybe<void> AccTickOp::InferLogicalOutBlobDescs(
const std::function<BlobDesc*(const std::string&)>& BlobDesc4BnInOp,
const ParallelDesc& parallel_desc) const {
return InferBlobDescs(BlobDesc4BnInOp);
}
Maybe<void> AccTickOp::InferOutBlobDescs(
const std::function<BlobDesc*(const std::string&)>& GetBlobDesc4BnInOp,
const ParallelContext* parallel_ctx) const {
return InferBlobDescs(GetBlobDesc4BnInOp);
}
Maybe<void> AccTickOp::InferOpTimeShape(
const std::function<Maybe<const Shape>(const std::string&)>& GetTimeShape4BnInOp,
std::shared_ptr<const Shape>* time_shape) const {
const int32_t max_acc_num = op_conf().acc_tick_conf().max_acc_num();
std::shared_ptr<const Shape> in_shape = JUST(GetTimeShape4BnInOp("one"));
CHECK_EQ_OR_RETURN(in_shape->elem_cnt() % max_acc_num, 0);
DimVector in_dim_vec = in_shape->dim_vec();
std::shared_ptr<Shape> op_time_shape;
if (in_dim_vec.back() == max_acc_num) {
in_dim_vec.pop_back();
op_time_shape.reset(new Shape(in_dim_vec));
} else if (in_dim_vec.back() % max_acc_num == 0) {
in_dim_vec.back() /= max_acc_num;
op_time_shape.reset(new Shape(in_dim_vec));
} else {
op_time_shape.reset(new Shape({in_shape->elem_cnt() / max_acc_num}));
}
*time_shape = op_time_shape;
return Maybe<void>::Ok();
}
Maybe<void> AccTickOp::GetSbpSignatures(
const std::function<Maybe<const BlobDesc&>(const std::string&)>& LogicalBlobDesc4Ibn,
cfg::SbpSignatureList* sbp_sig_list) const {
return Maybe<void>::Ok();
}
REGISTER_OP(OperatorConf::kAccTickConf, AccTickOp);
REGISTER_TICK_TOCK_OP(OperatorConf::kAccTickConf);
} // namespace oneflow
| 34.098765 | 100 | 0.742578 | wangyuyue |
f36c78f92557a31e38faeadc6bec86270965f2fc | 2,107 | cpp | C++ | processcreate.cpp | fossabot/Allocation-and-Reclaim | 53662c00fd845cbb2891e7ff5b8b06b7cea15a92 | [
"MIT"
] | 1 | 2021-11-07T13:53:38.000Z | 2021-11-07T13:53:38.000Z | processcreate.cpp | fossabot/Allocation-and-Reclaim | 53662c00fd845cbb2891e7ff5b8b06b7cea15a92 | [
"MIT"
] | 1 | 2022-01-18T16:40:42.000Z | 2022-01-18T16:40:42.000Z | processcreate.cpp | fossabot/Allocation-and-Reclaim | 53662c00fd845cbb2891e7ff5b8b06b7cea15a92 | [
"MIT"
] | 1 | 2022-01-18T16:38:20.000Z | 2022-01-18T16:38:20.000Z | #include "processcreate.h"
#include "ui_processcreate.h"
#include <QDebug>
ProcessCreate::ProcessCreate(QWidget *parent) :
QWidget(parent),
ui(new Ui::ProcessCreate)
{
ui->setupUi(this);
this->setWindowTitle("创建进程 - PowerSimulator");
this->setFixedSize(this->width(),this->height());
this->setWindowFlag(Qt::FramelessWindowHint);
ui->titleBarGroup->setAlignment(Qt::AlignRight);
QBitmap bmp(this->size());
bmp.fill();
QPainter p(&bmp);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setPen(Qt::transparent);
p.setBrush(Qt::black);
p.drawRoundedRect(bmp.rect(), 15, 15);
setMask(bmp);
}
ProcessCreate::~ProcessCreate()
{
delete ui;
}
void ProcessCreate::on_pushButton_exit_clicked()
{
this->close();
delete this;
}
void ProcessCreate::on_pushButton_create_clicked()
{
qDebug()<< ui->lineEdit_pid->text().toInt();
PCB* newPCB = new PCB(ui->lineEdit_pid->text().toInt(),ui->lineEdit_neededtime->text().toInt(),ui->lineEdit_priority->text().toInt(),ui->lineEdit_neededLength->text().toInt());
emit transmitPCB(newPCB);
}
/*
* 以下代码段为隐藏标题栏之后,重写的鼠标事件
*/
void ProcessCreate::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
m_Drag = true;
m_DragPosition = event->globalPos() - this->pos();
event->accept();
}
QWidget::mousePressEvent(event);
}
void ProcessCreate::mouseMoveEvent(QMouseEvent *event)
{
if (m_Drag && (event->buttons() && static_cast<bool>(Qt::LeftButton)))
{
move(event->globalPos() - m_DragPosition);
event->accept();
emit mouseButtonMove(event->globalPos() - m_DragPosition);
emit signalMainWindowMove();
}
QWidget::mouseMoveEvent(event);
}
void ProcessCreate::mouseReleaseEvent(QMouseEvent *event)
{
Q_UNUSED(event);
m_Drag = false;
QWidget::mouseReleaseEvent(event);
}
//最小化这个窗口
void ProcessCreate::on_btn_min_clicked()
{
this->setWindowState(Qt::WindowMinimized);
}
//关闭这个窗口
void ProcessCreate::on_btn_close_clicked()
{
this->close();
delete this;
}
| 23.153846 | 180 | 0.668723 | fossabot |
f36de8688e0e1b1ff148c279b4264465268d51c7 | 4,033 | hpp | C++ | agency/execution/execution_policy/parallel_execution_policy.hpp | nerikhman/agency | 966ac59101f2fc3561a86b11874fbe8de361d0e4 | [
"BSD-3-Clause"
] | 129 | 2016-08-18T23:24:15.000Z | 2022-03-25T12:06:05.000Z | agency/execution/execution_policy/parallel_execution_policy.hpp | nerikhman/agency | 966ac59101f2fc3561a86b11874fbe8de361d0e4 | [
"BSD-3-Clause"
] | 86 | 2016-08-19T03:43:33.000Z | 2020-07-20T14:27:41.000Z | agency/execution/execution_policy/parallel_execution_policy.hpp | nerikhman/agency | 966ac59101f2fc3561a86b11874fbe8de361d0e4 | [
"BSD-3-Clause"
] | 23 | 2016-08-18T23:52:13.000Z | 2022-02-28T16:28:20.000Z | /// \file
/// \brief Contains definition of parallel_execution_policy.
///
#pragma once
#include <agency/detail/config.hpp>
#include <agency/execution/executor/parallel_executor.hpp>
#include <agency/execution/execution_agent.hpp>
#include <agency/execution/execution_policy/basic_execution_policy.hpp>
namespace agency
{
/// \brief Encapsulates requirements for creating groups of parallel execution agents.
/// \ingroup execution_policies
///
///
/// When used as a control structure parameter, `parallel_execution_policy` requires the creation of a group of execution agents which execute in parallel.
/// When agents in such a group execute on separate threads, they have no order. Otherwise, if agents in such a group execute on the same thread,
/// they execute in an unspecified order.
///
/// The type of execution agent `parallel_execution_policy` induces is `parallel_agent`, and the type of its associated executor is `parallel_executor`.
///
/// \see execution_policies
/// \see basic_execution_policy
/// \see par
/// \see parallel_agent
/// \see parallel_executor
/// \see parallel_execution_tag
class parallel_execution_policy : public basic_execution_policy<parallel_agent, parallel_executor, parallel_execution_policy>
{
private:
using super_t = basic_execution_policy<parallel_agent, parallel_executor, parallel_execution_policy>;
public:
using super_t::basic_execution_policy;
};
/// \brief The global variable `par` is the default `parallel_execution_policy`.
/// \ingroup execution_policies
const parallel_execution_policy par{};
/// \brief Encapsulates requirements for creating two-dimensional groups of parallel execution agents.
/// \ingroup execution_policies
///
///
/// When used as a control structure parameter, `parallel_execution_policy_2d` requires the creation of a two-dimensional group of execution agents which execute in parallel.
/// When agents in such a group execute on separate threads, they have no order. Otherwise, if agents in such a group execute on the same thread,
/// they execute in an unspecified order.
///
/// The type of execution agent `parallel_execution_policy_2d` induces is `parallel_agent_2d`, and the type of its associated executor is `parallel_executor`.
///
/// \see execution_policies
/// \see basic_execution_policy
/// \see par
/// \see parallel_agent_2d
/// \see parallel_executor
/// \see parallel_execution_tag
class parallel_execution_policy_2d : public basic_execution_policy<parallel_agent_2d, parallel_executor, parallel_execution_policy_2d>
{
private:
using super_t = basic_execution_policy<parallel_agent_2d, parallel_executor, parallel_execution_policy_2d>;
public:
using super_t::basic_execution_policy;
};
/// \brief The global variable `par2d` is the default `parallel_execution_policy_2d`.
/// \ingroup execution_policies
const parallel_execution_policy_2d par2d{};
/// \brief The function template `parnd` creates an n-dimensional parallel
/// execution policy that induces execution agents over the given domain.
/// \ingroup execution_policies
template<class Index>
__AGENCY_ANNOTATION
basic_execution_policy<
agency::detail::basic_execution_agent<agency::bulk_guarantee_t::parallel_t,Index>,
agency::parallel_executor
>
parnd(const agency::lattice<Index>& domain)
{
using policy_type = agency::basic_execution_policy<
agency::detail::basic_execution_agent<agency::bulk_guarantee_t::parallel_t,Index>,
agency::parallel_executor
>;
typename policy_type::param_type param(domain);
return policy_type{param};
}
/// \brief The function template `parnd` creates an n-dimensional parallel
/// execution policy that creates agent groups of the given shape.
/// \ingroup execution_policies
template<class Shape>
__AGENCY_ANNOTATION
basic_execution_policy<
agency::detail::basic_execution_agent<agency::bulk_guarantee_t::parallel_t,Shape>,
agency::parallel_executor
>
parnd(const Shape& shape)
{
return agency::parnd(agency::make_lattice(shape));
}
} // end agency
| 34.470085 | 174 | 0.782544 | nerikhman |
f36ec0beb28f0bdaab7502b50c403b3e88fbdd75 | 1,762 | cxx | C++ | src/configuration/BeaconCacheConfiguration.cxx | jeanmarcwatson/openkit-native | bb02b6555e992eae0e3632394ad587f345e92fcb | [
"Apache-2.0"
] | null | null | null | src/configuration/BeaconCacheConfiguration.cxx | jeanmarcwatson/openkit-native | bb02b6555e992eae0e3632394ad587f345e92fcb | [
"Apache-2.0"
] | null | null | null | src/configuration/BeaconCacheConfiguration.cxx | jeanmarcwatson/openkit-native | bb02b6555e992eae0e3632394ad587f345e92fcb | [
"Apache-2.0"
] | null | null | null | /**
* Copyright 2018-2019 Dynatrace LLC
*
* 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 "configuration/BeaconCacheConfiguration.h"
using namespace configuration;
///
/// The default @ref BeaconCacheConfiguration when user does not override it.
/// Default settings allow beacons which are max 2 hours old and unbounded memory limits.
///
const std::chrono::milliseconds BeaconCacheConfiguration::DEFAULT_MAX_RECORD_AGE_IN_MILLIS = std::chrono::minutes(105); // 1hour and 45 minutes
const int64_t BeaconCacheConfiguration::DEFAULT_UPPER_MEMORY_BOUNDARY_IN_BYTES = 100 * 1024 * 1024; // 100 MiB
const int64_t BeaconCacheConfiguration::DEFAULT_LOWER_MEMORY_BOUNDARY_IN_BYTES = 80 * 1024 * 1024; // 80 MiB
BeaconCacheConfiguration::BeaconCacheConfiguration(int64_t maxRecordAge, int64_t cacheSizeLowerBound, int64_t cacheSizeUpperBound)
: mMaxRecordAge(maxRecordAge)
, mCacheSizeLowerBound(cacheSizeLowerBound)
, mCacheSizeUpperBound(cacheSizeUpperBound)
{
}
int64_t BeaconCacheConfiguration::getMaxRecordAge() const
{
return mMaxRecordAge;
}
int64_t BeaconCacheConfiguration::getCacheSizeLowerBound() const
{
return mCacheSizeLowerBound;
}
int64_t BeaconCacheConfiguration::getCacheSizeUpperBound() const
{
return mCacheSizeUpperBound;
} | 35.24 | 143 | 0.799092 | jeanmarcwatson |
f375d8dc43244f5ebb18cd29f5bc8deab1553f14 | 2,967 | cpp | C++ | REDSI_1160929_1161573/boost_1_67_0/libs/hana/test/ext/boost/mpl/list/iterable.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 32 | 2019-02-27T06:57:07.000Z | 2021-08-29T10:56:19.000Z | REDSI_1160929_1161573/boost_1_67_0/libs/hana/test/ext/boost/mpl/list/iterable.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 1 | 2019-04-04T18:00:00.000Z | 2019-04-04T18:00:00.000Z | REDSI_1160929_1161573/boost_1_67_0/libs/hana/test/ext/boost/mpl/list/iterable.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 5 | 2019-08-20T13:45:04.000Z | 2022-03-01T18:23:49.000Z | // Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <boost/hana/ext/boost/mpl/list.hpp>
#include <boost/hana/assert.hpp>
#include <boost/hana/drop_front_exactly.hpp>
#include <boost/hana/equal.hpp>
#include <boost/hana/front.hpp>
#include <boost/hana/is_empty.hpp>
#include <boost/hana/not.hpp>
#include <boost/hana/tuple.hpp>
#include <boost/hana/type.hpp>
#include <laws/iterable.hpp>
#include <boost/mpl/list.hpp>
namespace hana = boost::hana;
namespace mpl = boost::mpl;
struct t1; struct t2; struct t3; struct t4;
int main() {
// front
{
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::front(mpl::list<t1>{}),
hana::type_c<t1>
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::front(mpl::list<t1, t2>{}),
hana::type_c<t1>
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::front(mpl::list<t1, t2, t3>{}),
hana::type_c<t1>
));
}
// drop_front_exactly
{
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1>{}),
mpl::list<>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1, t2>{}),
mpl::list<t2>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1, t2, t3>{}),
mpl::list<t2, t3>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1, t2, t3>{}, hana::size_c<2>),
mpl::list<t3>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1, t2, t3, t4>{}, hana::size_c<2>),
mpl::list<t3, t4>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::drop_front_exactly(mpl::list<t1, t2, t3, t4>{}, hana::size_c<3>),
mpl::list<t4>{}
));
}
// is_empty
{
BOOST_HANA_CONSTANT_CHECK(hana::is_empty(mpl::list<>{}));
BOOST_HANA_CONSTANT_CHECK(hana::is_empty(mpl::list0<>{}));
BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(mpl::list<t1>{})));
BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(mpl::list1<t1>{})));
BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(mpl::list<t1, t2>{})));
BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(mpl::list2<t1, t2>{})));
}
// laws
auto lists = hana::make_tuple(
mpl::list<>{}
, mpl::list<t1>{}
, mpl::list<t1, t2>{}
, mpl::list<t1, t2, t3>{}
, mpl::list<t1, t2, t3, t4>{}
);
hana::test::TestIterable<hana::ext::boost::mpl::list_tag>{lists};
}
| 30.90625 | 85 | 0.564206 | Wultyc |
f37895c257050ca50b6d9b1ea631903c0ccee7e7 | 46,311 | cpp | C++ | shell/ext/ratings/msrating/parselbl.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | shell/ext/ratings/msrating/parselbl.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | shell/ext/ratings/msrating/parselbl.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | #include "msrating.h"
#include <npassert.h>
#include "array.h"
#include "msluglob.h"
#include "parselbl.h"
#include "debug.h"
#include <convtime.h>
#include <wininet.h>
extern BOOL LoadWinINet();
COptionsBase::COptionsBase()
{
m_cRef = 1;
m_timeUntil = 0xffffffff; /* as far in the future as possible */
m_fdwFlags = 0;
m_pszInvalidString = NULL;
m_pszURL = NULL;
}
void COptionsBase::AddRef()
{
m_cRef++;
}
void COptionsBase::Release()
{
if (!--m_cRef)
Delete();
}
void COptionsBase::Delete()
{
/* default does nothing when deleting reference */
}
BOOL COptionsBase::CheckUntil(DWORD timeUntil)
{
if (m_timeUntil <= timeUntil)
{
m_fdwFlags |= LBLOPT_EXPIRED;
return FALSE;
}
return TRUE;
}
/* AppendSlash forces pszString to end in a single slash if it doesn't
* already. This may produce a technically invalid URL (for example,
* "http://gregj/default.htm/", but we're only using the result for
* comparisons against other paths similarly mangled.
*/
void AppendSlash(LPSTR pszString)
{
LPSTR pszSlash = ::strrchrf(pszString, '/');
if (pszSlash == NULL || *(pszSlash + 1) != '\0')
::strcatf(pszString, "/");
}
extern BOOL (WINAPI *pfnInternetCrackUrl)(
IN LPCTSTR lpszUrl,
IN DWORD dwUrlLength,
IN DWORD dwFlags,
IN OUT LPURL_COMPONENTS lpUrlComponents
);
extern BOOL (WINAPI *pfnInternetCanonicalizeUrl)(
IN LPCSTR lpszUrl,
OUT LPSTR lpszBuffer,
IN OUT LPDWORD lpdwBufferLength,
IN DWORD dwFlags
);
BOOL DoURLsMatch(LPCSTR pszBaseURL, LPCSTR pszCheckURL, BOOL fGeneric)
{
/* Buffers to canonicalize URLs into */
LPSTR pszBaseCanon = new char[INTERNET_MAX_URL_LENGTH + 1];
LPSTR pszCheckCanon = new char[INTERNET_MAX_URL_LENGTH + 1];
if (pszBaseCanon != NULL && pszCheckCanon != NULL)
{
BOOL fCanonOK = FALSE;
DWORD cbBuffer = INTERNET_MAX_URL_LENGTH + 1;
if (pfnInternetCanonicalizeUrl(pszBaseURL, pszBaseCanon, &cbBuffer, ICU_ENCODE_SPACES_ONLY))
{
cbBuffer = INTERNET_MAX_URL_LENGTH + 1;
if (pfnInternetCanonicalizeUrl(pszCheckURL, pszCheckCanon, &cbBuffer, ICU_ENCODE_SPACES_ONLY))
{
fCanonOK = TRUE;
}
}
if (!fCanonOK)
{
delete pszBaseCanon;
pszBaseCanon = NULL;
delete pszCheckCanon;
pszCheckCanon = NULL;
return FALSE;
}
}
UINT cbBaseURL = strlenf(pszBaseCanon) + 1;
LPSTR pszBaseUrlPath = new char[cbBaseURL];
LPSTR pszBaseExtra = new char[cbBaseURL];
CHAR szBaseHostName[INTERNET_MAX_HOST_NAME_LENGTH];
CHAR szBaseUrlScheme[20]; // reasonable limit
UINT cbCheckURL = strlenf(pszCheckCanon) + 1;
LPSTR pszCheckUrlPath = new char[cbCheckURL];
LPSTR pszCheckExtra = new char[cbCheckURL];
CHAR szCheckHostName[INTERNET_MAX_HOST_NAME_LENGTH];
CHAR szCheckUrlScheme[20]; // reasonable limit
BOOL fOK = FALSE;
if (pszBaseUrlPath != NULL &&
pszBaseExtra != NULL &&
pszCheckUrlPath != NULL &&
pszCheckExtra != NULL)
{
URL_COMPONENTS ucBase, ucCheck;
memset(&ucBase, 0, sizeof(ucBase));
ucBase.dwStructSize = sizeof(ucBase);
ucBase.lpszScheme = szBaseUrlScheme;
ucBase.dwSchemeLength = sizeof(szBaseUrlScheme);
ucBase.lpszHostName = szBaseHostName;
ucBase.dwHostNameLength = sizeof(szBaseHostName);
ucBase.lpszUrlPath = pszBaseUrlPath;
ucBase.dwUrlPathLength = cbBaseURL;
ucBase.lpszExtraInfo = pszBaseExtra;
ucBase.dwExtraInfoLength = cbBaseURL;
memset(&ucCheck, 0, sizeof(ucCheck));
ucCheck.dwStructSize = sizeof(ucCheck);
ucCheck.lpszScheme = szCheckUrlScheme;
ucCheck.dwSchemeLength = sizeof(szCheckUrlScheme);
ucCheck.lpszHostName = szCheckHostName;
ucCheck.dwHostNameLength = sizeof(szCheckHostName);
ucCheck.lpszUrlPath = pszCheckUrlPath;
ucCheck.dwUrlPathLength = cbCheckURL;
ucCheck.lpszExtraInfo = pszCheckExtra;
ucCheck.dwExtraInfoLength = cbCheckURL;
if (pfnInternetCrackUrl(pszBaseCanon, 0, 0, &ucBase) &&
pfnInternetCrackUrl(pszCheckCanon, 0, 0, &ucCheck))
{
/* Scheme and host name must always match */
if (!stricmpf(ucBase.lpszScheme, ucCheck.lpszScheme) &&
!stricmpf(ucBase.lpszHostName, ucCheck.lpszHostName))
{
/* For extra info, just has to match exactly, even for a generic URL. */
if (!*ucBase.lpszExtraInfo ||
!stricmpf(ucBase.lpszExtraInfo, ucCheck.lpszExtraInfo))
{
AppendSlash(ucBase.lpszUrlPath);
AppendSlash(ucCheck.lpszUrlPath);
/* If not a generic label, path must match exactly too */
if (!fGeneric)
{
if (!stricmpf(ucBase.lpszUrlPath, ucCheck.lpszUrlPath))
{
fOK = TRUE;
}
}
else
{
UINT cbBasePath = strlenf(ucBase.lpszUrlPath);
if (!strnicmpf(ucBase.lpszUrlPath, ucCheck.lpszUrlPath, cbBasePath))
{
fOK = TRUE;
}
}
}
}
}
}
delete pszBaseUrlPath;
pszBaseUrlPath = NULL;
delete pszBaseExtra;
pszBaseExtra = NULL;
delete pszCheckUrlPath;
pszCheckUrlPath = NULL;
delete pszCheckExtra;
pszCheckExtra = NULL;
delete pszBaseCanon;
pszBaseCanon = NULL;
delete pszCheckCanon;
pszCheckCanon = NULL;
return fOK;
}
BOOL COptionsBase::CheckURL(LPCSTR pszURL)
{
if (!(m_fdwFlags & LBLOPT_URLCHECKED))
{
m_fdwFlags |= LBLOPT_URLCHECKED;
BOOL fInvalid = FALSE;
if (pszURL != NULL && m_pszURL != NULL)
{
if (LoadWinINet())
{
fInvalid = !DoURLsMatch(m_pszURL, pszURL, m_fdwFlags & LBLOPT_GENERIC);
}
}
if (fInvalid)
{
m_fdwFlags |= LBLOPT_WRONGURL;
}
}
return !(m_fdwFlags & LBLOPT_WRONGURL);
}
void CDynamicOptions::Delete()
{
delete this;
}
CParsedServiceInfo::CParsedServiceInfo()
{
m_pNext = NULL;
m_poptCurrent = &m_opt;
m_poptList = NULL;
m_pszServiceName = NULL;
m_pszErrorString = NULL;
m_fInstalled = TRUE; /* assume the best */
m_pszInvalidString = NULL;
m_pszCurrent = NULL;
}
void FreeOptionsList(CDynamicOptions *pList)
{
while (pList != NULL)
{
CDynamicOptions *pNext = pList->m_pNext;
delete pList;
pList = pNext;
}
}
CParsedServiceInfo::~CParsedServiceInfo()
{
FreeOptionsList(m_poptList);
}
void CParsedServiceInfo::Append(CParsedServiceInfo *pNew)
{
CParsedServiceInfo **ppNext = &m_pNext;
while (*ppNext != NULL)
{
ppNext = &((*ppNext)->m_pNext);
}
*ppNext = pNew;
pNew->m_pNext = NULL;
}
CParsedLabelList::CParsedLabelList()
{
m_pszList = NULL;
m_fRated = FALSE;
m_pszInvalidString = NULL;
m_pszURL = NULL;
m_pszOriginalLabel = NULL;
m_fDenied = FALSE;
m_fIsHelper = FALSE;
m_fNoRating = FALSE;
m_fIsCustomHelper = FALSE;
m_pszRatingName = NULL;
m_pszRatingReason = NULL;
}
CParsedLabelList::~CParsedLabelList()
{
delete m_pszList;
m_pszList = NULL;
CParsedServiceInfo *pInfo = m_ServiceInfo.Next();
while (pInfo != NULL)
{
CParsedServiceInfo *pNext = pInfo->Next();
delete pInfo;
pInfo = pNext;
}
delete m_pszURL;
m_pszURL = NULL;
delete m_pszOriginalLabel;
m_pszOriginalLabel = NULL;
delete [] m_pszRatingName;
m_pszRatingName = NULL;
delete [] m_pszRatingReason;
m_pszRatingReason = NULL;
}
/* SkipWhitespace(&pszString)
*
* advances pszString past whitespace characters
*/
void SkipWhitespace(LPSTR *ppsz)
{
UINT cchWhitespace = ::strspnf(*ppsz, szWhitespace);
*ppsz += cchWhitespace;
}
/* FindTokenEnd(pszStart)
*
* Returns a pointer to the end of a contiguous range of similarly-typed
* characters (whitespace, quote mark, punctuation, or alphanumerics).
*/
LPSTR FindTokenEnd(LPSTR pszStart)
{
LPSTR pszEnd = pszStart;
if (*pszEnd == '\0')
{
return pszEnd;
}
else if (strchrf(szSingleCharTokens, *pszEnd))
{
return ++pszEnd;
}
UINT cch;
cch = ::strspnf(pszEnd, szWhitespace);
if (cch > 0)
{
return pszEnd + cch;
}
cch = ::strspnf(pszEnd, szExtendedAlphaNum);
if (cch > 0)
{
return pszEnd + cch;
}
return pszEnd; /* unrecognized characters */
}
/* GetBool(LPSTR *ppszToken, BOOL *pfOut, PICSRulesBooleanSwitch PRBoolSwitch)
*
* t-markh 8/98 (
* added default parameter PRBoolSwitch=PR_BOOLEAN_TRUEFALSE
* this allows for no modification of existing code, and extension
* of the GetBool function from true/false to include pass/fail and
* yes/no. The enumerated type PICSRulesBooleanSwitch is defined
* in picsrule.h)
*
* Parses a boolean value at the given token and returns its value in *pfOut.
* Legal values are 't', 'f', 'true', and 'false'. If success, *ppszToken
* is advanced past the boolean token and any following whitespace. If failure,
* *ppszToken is not modified.
*
* pfOut may be NULL if the caller just wants to eat the token and doesn't
* care about its value.
*/
HRESULT GetBool(LPSTR *ppszToken, BOOL *pfOut, PICSRulesBooleanSwitch PRBoolSwitch)
{
BOOL bValue;
LPSTR pszTokenEnd = FindTokenEnd(*ppszToken);
switch(PRBoolSwitch)
{
case PR_BOOLEAN_TRUEFALSE:
{
if (IsEqualToken(*ppszToken, pszTokenEnd, szShortTrue) ||
IsEqualToken(*ppszToken, pszTokenEnd, szTrue))
{
bValue = TRUE;
}
else if (IsEqualToken(*ppszToken, pszTokenEnd, szShortFalse) ||
IsEqualToken(*ppszToken, pszTokenEnd, szFalse))
{
bValue = FALSE;
}
else
{
TraceMsg( TF_WARNING, "GetBool() - Failed True/False Token Parse at '%s'!", *ppszToken );
return ResultFromScode(MK_E_SYNTAX);
}
break;
}
case PR_BOOLEAN_PASSFAIL:
{
//szPRShortPass and szPRShortfail are not supported in the
//official PICSRules spec, but we'll catch them anyway
if (IsEqualToken(*ppszToken, pszTokenEnd, szPRShortPass) ||
IsEqualToken(*ppszToken, pszTokenEnd, szPRPass))
{
bValue = PR_PASSFAIL_PASS;
}
else if (IsEqualToken(*ppszToken, pszTokenEnd, szPRShortFail) ||
IsEqualToken(*ppszToken, pszTokenEnd, szPRFail))
{
bValue = PR_PASSFAIL_FAIL;
}
else
{
TraceMsg( TF_WARNING, "GetBool() - Failed Pass/Fail Token Parse at '%s'!", *ppszToken );
return ResultFromScode(MK_E_SYNTAX);
}
break;
}
case PR_BOOLEAN_YESNO:
{
if (IsEqualToken(*ppszToken, pszTokenEnd, szPRShortYes) ||
IsEqualToken(*ppszToken, pszTokenEnd, szPRYes))
{
bValue = PR_YESNO_YES;
}
else if (IsEqualToken(*ppszToken, pszTokenEnd, szPRShortNo) ||
IsEqualToken(*ppszToken, pszTokenEnd, szPRNo))
{
bValue = PR_YESNO_NO;
}
else
{
TraceMsg( TF_WARNING, "GetBool() - Failed Yes/No Token Parse at '%s'!", *ppszToken );
return ResultFromScode(MK_E_SYNTAX);
}
break;
}
default:
{
return(MK_E_UNAVAILABLE);
}
}
if (pfOut != NULL)
{
*pfOut = bValue;
}
*ppszToken = pszTokenEnd;
SkipWhitespace(ppszToken);
return NOERROR;
}
/* GetQuotedToken(&pszThisToken, &pszQuotedToken)
*
* Sets pszQuotedToken to point to the contents of the doublequotes.
* pszQuotedToken may be NULL if the caller just wants to eat the token.
* Sets pszThisToken to point to the first character after the closing
* doublequote.
* Fails if pszThisToken doesn't start with a doublequote or doesn't
* contain a closing doublequote.
* The closing doublequote is replaced with a null terminator, iff the
* function does not fail.
*/
HRESULT GetQuotedToken(LPSTR *ppszThisToken, LPSTR *ppszQuotedToken)
{
HRESULT hres = ResultFromScode(MK_E_SYNTAX);
LPSTR pszStart = *ppszThisToken;
if (*pszStart != '\"')
{
TraceMsg( TF_WARNING, "GetQuotedToken() - Failed to Find Start Quote at '%s'!", pszStart );
return hres;
}
pszStart++;
LPSTR pszEndQuote = strchrf(pszStart, '\"');
if (pszEndQuote == NULL)
{
TraceMsg( TF_WARNING, "GetQuotedToken() - Failed to Find End Quote at '%s'!", pszStart );
return hres;
}
*pszEndQuote = '\0';
if (ppszQuotedToken != NULL)
{
*ppszQuotedToken = pszStart;
}
*ppszThisToken = pszEndQuote+1;
return NOERROR;
}
BOOL IsEqualToken(LPCSTR pszTokenStart, LPCSTR pszTokenEnd, LPCSTR pszTokenToMatch)
{
UINT cbToken = strlenf(pszTokenToMatch);
if (cbToken != (UINT)(pszTokenEnd - pszTokenStart) || strnicmpf(pszTokenStart, pszTokenToMatch, cbToken))
{
return FALSE;
}
return TRUE;
}
/* ParseLiteralToken(ppsz, pszToken) tries to match *ppsz against pszToken.
* If they don't match, an error is returned. If they do match, then *ppsz
* is advanced past the token and any following whitespace.
*
* If ppszInvalid is NULL, then the function is non-destructive in the error
* path, so it's OK to call ParseLiteralToken just to see if a possible literal
* token is what's next; if the token isn't found, whatever was there didn't
* get eaten or anything.
*
* If ppszInvalid is not NULL, then if the token doesn't match, *ppszInvalid
* will be set to *ppsz.
*/
HRESULT ParseLiteralToken(LPSTR *ppsz, LPCSTR pszToken, LPCSTR *ppszInvalid)
{
LPSTR pszTokenEnd = FindTokenEnd(*ppsz);
if (!IsEqualToken(*ppsz, pszTokenEnd, pszToken))
{
if (ppszInvalid != NULL)
{
*ppszInvalid = *ppsz;
}
// TraceMsg( TF_WARNING, "ParseLiteralToken() - Token '%s' Not Found at '%s'!", pszToken, *ppsz );
return ResultFromScode(MK_E_SYNTAX);
}
*ppsz = pszTokenEnd;
SkipWhitespace(ppsz);
return NOERROR;
}
/* ParseServiceError parses a service-error construct, once it's been
* determined that such is the case. m_pszCurrent has been advanced past
* the 'error' keyword that indicates a service-error.
*
* We're pretty flexible about the contents of this stuff. We basically
* accept anything of the form:
*
* 'error' '(' <error string> [quoted explanations] ')' - or -
* 'error' <error string>
*
* without caring too much about what the error string actually is.
*
* A format with quoted explanations but without the parens would not be
* legal, we wouldn't be able to distinguish the explanations from the
* serviceID of the next service-info.
*/
HRESULT CParsedServiceInfo::ParseServiceError()
{
BOOL fParen = FALSE;
HRESULT hres = NOERROR;
if (SUCCEEDED(ParseLiteralToken(&m_pszCurrent, szLeftParen, NULL)))
{
fParen = TRUE;
}
LPSTR pszErrorEnd = FindTokenEnd(m_pszCurrent); /* find end of error string */
m_pszErrorString = m_pszCurrent; /* remember start of error string */
if (fParen)
{ /* need to eat explanations */
m_pszCurrent = pszErrorEnd; /* skip error string to get to explanations */
SkipWhitespace();
while (SUCCEEDED(hres))
{
hres = GetQuotedToken(&m_pszCurrent, NULL);
SkipWhitespace();
}
}
if (fParen)
{
hres = ParseLiteralToken(&m_pszCurrent, szRightParen, &m_pszInvalidString);
}
else
{
hres = NOERROR;
}
if (SUCCEEDED(hres))
{
*pszErrorEnd = '\0'; /* null-terminate the error string */
}
return hres;
}
/* ParseNumber parses a numeric token at the specified position. If the
* number makes sense, the pointer is advanced to the end of the number
* and past any following whitespace, and the numeric value is returned
* in *pnOut. Any non-numeric characters are considered to terminate the
* number without error; it is assumed that higher-level parsing code
* will eventually reject such characters if they're not supposed to be
* there.
*
* pnOut may be NULL if the caller doesn't care about the number being
* returned and just wants to eat it.
*
* Floating point numbers of the form nnn.nnn are rounded to the next
* higher integer and returned as such.
*/
//t-markh 8/98 - added fPICSRules for line counting support in PICSRules
HRESULT ParseNumber(LPSTR *ppszNumber, INT *pnOut,BOOL fPICSRules)
{
HRESULT hres = ResultFromScode(MK_E_SYNTAX);
BOOL fNegative = FALSE;
INT nAccum = 0;
BOOL fNonZeroDecimal = FALSE;
BOOL fInDecimal = FALSE;
BOOL fFoundDigits = FALSE;
LPSTR pszCurrent = *ppszNumber;
/* Handle one sign character. */
if (*pszCurrent == '+')
{
pszCurrent++;
}
else if (*pszCurrent == '-')
{
pszCurrent++;
fNegative = TRUE;
}
for (;;)
{
if (*pszCurrent == '.')
{
fInDecimal = TRUE;
}
else if (*pszCurrent >= '0' && *pszCurrent <= '9')
{
fFoundDigits = TRUE;
if (fInDecimal)
{
if (*pszCurrent > '0')
{
fNonZeroDecimal = TRUE;
}
}
else
{
nAccum = nAccum * 10 + (*pszCurrent - '0');
}
}
else
{
break;
}
pszCurrent++;
}
if (fFoundDigits)
{
hres = NOERROR;
if (fNonZeroDecimal)
{
nAccum++; /* round away from zero if decimal present */
}
if (fNegative)
{
nAccum = -nAccum;
}
}
if (SUCCEEDED(hres))
{
if (pnOut != NULL)
{
*pnOut = nAccum;
}
*ppszNumber = pszCurrent;
if ( fPICSRules == FALSE )
{
SkipWhitespace(ppszNumber);
}
}
else
{
TraceMsg( TF_WARNING, "ParseNumber() - Failed with hres=0x%x at '%s'!", hres, pszCurrent );
}
return hres;
}
/* ParseExtensionData just needs to get past whatever data was supplied
* for an extension. The PICS spec implies that it can be recursive, which
* complicates matters a bit:
*
* data :: quoted-ISO-date | quotedURL | number | quotedname | '(' data* ')'
*
* Use of recursion here is probably OK, we don't really expect complicated
* nested extensions all that often, and this function doesn't use a lot of
* stack or other resources...
*/
HRESULT CParsedServiceInfo::ParseExtensionData(COptionsBase *pOpt)
{
HRESULT hres;
if (SUCCEEDED(ParseLiteralToken(&m_pszCurrent, szLeftParen, NULL)))
{
hres = ParseExtensionData(pOpt);
if (FAILED(hres))
{
return hres;
}
return ParseLiteralToken(&m_pszCurrent, szRightParen, &m_pszInvalidString);
}
if (SUCCEEDED(GetQuotedToken(&m_pszCurrent, NULL)))
{
SkipWhitespace();
return NOERROR;
}
hres = ParseNumber(&m_pszCurrent, NULL);
if (FAILED(hres))
{
m_pszInvalidString = m_pszCurrent;
}
return hres;
}
/* ParseExtension parses an extension option. Syntax is:
*
* extension ( mandatory|optional "identifyingURL" data )
*
* Currently all extensions are parsed but ignored, although a mandatory
* extension causes the entire options structure and anything dependent
* on it to be invalidated.
*/
HRESULT CParsedServiceInfo::ParseExtension(COptionsBase *pOpt)
{
HRESULT hres;
hres = ParseLiteralToken(&m_pszCurrent, szLeftParen, &m_pszInvalidString);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseExtension() - Missing '(' at '%s'!", m_pszInvalidString );
return hres;
}
hres = ParseLiteralToken(&m_pszCurrent, szOptional, &m_pszInvalidString);
if (FAILED(hres))
{
hres = ParseLiteralToken(&m_pszCurrent, szMandatory, &m_pszInvalidString);
if (SUCCEEDED(hres))
{
pOpt->m_fdwFlags |= LBLOPT_INVALID;
}
}
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseExtension() - Failed ParseLiteralToken() with hres=0x%x at '%s'!", hres, m_pszInvalidString );
return hres; /* this causes us to lose our place -- OK? */
}
hres = GetQuotedToken(&m_pszCurrent, NULL);
if (FAILED(hres))
{
m_pszInvalidString = m_pszCurrent;
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseExtension() - Missing Quote at '%s'!", m_pszInvalidString );
return hres;
}
SkipWhitespace();
while (*m_pszCurrent != ')' && *m_pszCurrent != '\0')
{
hres = ParseExtensionData(pOpt);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseExtension() - Failed ParseExtensionData() with hres=0x%x!", hres );
return hres;
}
}
if (*m_pszCurrent != ')')
{
m_pszInvalidString = m_pszCurrent;
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseExtension() - Missing ')' at '%s'!", m_pszInvalidString );
return ResultFromScode(MK_E_SYNTAX);
}
m_pszCurrent++;
SkipWhitespace();
return NOERROR;
}
/* ParseTime parses a "quoted-ISO-date" as found in a label. This is required
* to have the following form, as quoted from the PICS spec:
*
* quoted-ISO-date :: YYYY'.'MM'.'DD'T'hh':'mmStz
* YYYY :: four-digit year
* MM :: two-digit month (01=January, etc.)
* DD :: two-digit day of month (01-31)
* hh :: two digits of hour (00-23)
* mm :: two digits of minute (00-59)
* S :: sign of time zone offset from UTC (+ or -)
* tz :: four digit amount of offset from UTC (e.g., 1512 means 15 hours 12 minutes)
*
* Example: "1994.11.05T08:15-0500" means Nov. 5, 1994, 8:15am, US EST.
*
* Time is parsed into NET format -- seconds since 1970 (easiest to adjust for
* time zones, and compare with). Returns an error if string is invalid.
*/
/* Template describing the string format. 'n' means a digit, '+' means a
* plus or minus sign, any other character must match that literal character.
*/
const char szTimeTemplate[] = "nnnn.nn.nnTnn:nn+nnnn";
const char szPICSRulesTimeTemplate[] = "nnnn-nn-nnTnn:nn+nnnn";
HRESULT ParseTime(LPSTR pszTime, DWORD *pOut, BOOL fPICSRules)
{
/* Copy the time string into a temporary buffer, since we're going to
* stomp on some separators. We preserve the original in case it turns
* out to be invalid and we have to show it to the user later.
*/
LPCSTR pszCurrTemplate;
char szTemp[sizeof(szTimeTemplate)];
if (::strlenf(pszTime) >= sizeof(szTemp))
{
TraceMsg( TF_WARNING, "ParseTime() - Time String Too Long (pszTime='%s', %d chars expected)!", pszTime, sizeof(szTemp) );
return ResultFromScode(MK_E_SYNTAX);
}
strcpyf(szTemp, pszTime);
LPSTR pszCurrent = szTemp;
if(fPICSRules)
{
pszCurrTemplate = szPICSRulesTimeTemplate;
}
else
{
pszCurrTemplate = szTimeTemplate;
}
/* First validate the format against the template. If that succeeds, then
* we get to make all sorts of assumptions later.
*
* We stomp all separators except the +/- for the timezone with spaces
* so that ParseNumber will (a) skip them for us, and (b) not interpret
* the '.' separators as decimal points.
*/
BOOL fOK = TRUE;
while (*pszCurrent && *pszCurrTemplate && fOK)
{
char chCurrent = *pszCurrent;
switch (*pszCurrTemplate)
{
case 'n':
if (chCurrent < '0' || chCurrent > '9')
{
fOK = FALSE;
}
break;
case '+':
if (chCurrent != '+' && chCurrent != '-')
{
fOK = FALSE;
}
break;
default:
if (chCurrent != *pszCurrTemplate)
{
fOK = FALSE;
}
else
{
*pszCurrent = ' ';
}
break;
}
pszCurrent++;
pszCurrTemplate++;
}
/* If invalid character, or didn't reach the ends of both strings
* simultaneously, fail.
*/
if (!fOK || *pszCurrent || *pszCurrTemplate)
{
TraceMsg( TF_WARNING, "ParseTime() - Invalid Character or Strings Mismatch (fOK=%d, pszCurrent='%s', pszCurrTemplate='%s')!", fOK, pszCurrent, pszCurrTemplate );
return ResultFromScode(MK_E_SYNTAX);
}
HRESULT hres;
int n;
SYSTEMTIME st;
/* We parse into SYSTEMTIME structure because it has separate fields for
* the different components. We then convert to net time (seconds since
* Jan 1 1970) to easily add the timezone bias and compare with other
* times.
*
* The sense of the bias sign is inverted because it indicates the direction
* of the bias FROM UTC. We want to use it to convert the specified time
* back TO UTC.
*/
int nBiasSign = -1;
int nBiasNumber;
pszCurrent = szTemp;
hres = ParseNumber(&pszCurrent, &n);
if (SUCCEEDED(hres) && n >= 1980)
{
st.wYear = (WORD)n;
hres = ParseNumber(&pszCurrent, &n);
if (SUCCEEDED(hres) && n <= 12)
{
st.wMonth = (WORD)n;
hres = ParseNumber(&pszCurrent, &n);
if (SUCCEEDED(hres) && n < 32)
{
st.wDay = (WORD)n;
hres = ParseNumber(&pszCurrent, &n);
if (SUCCEEDED(hres) && n <= 23)
{
st.wHour = (WORD)n;
hres = ParseNumber(&pszCurrent, &n);
if (SUCCEEDED(hres) && n <= 59)
{
st.wMinute = (WORD)n;
if (*(pszCurrent++) == '-')
{
nBiasSign = 1;
}
hres = ParseNumber(&pszCurrent, &nBiasNumber);
}
}
}
}
}
/* Seconds are used by the time converter, but are not specified in
* the label.
*/
st.wSecond = 0;
/* Other fields (wDayOfWeek, wMilliseconds) are ignored when converting
* to net time.
*/
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "ParseTime() - Failed to Parse Time where hres=0x%x!", hres );
return hres;
}
DWORD dwTime = SystemToNetDate(&st);
/* The bias number is 4 digits, but hours and minutes. Convert to
* a number of seconds.
*/
nBiasNumber = (((nBiasNumber / 100) * 60) + (nBiasNumber % 100)) * 60;
/* Adjust the time by the timezone bias, and return to the caller. */
*pOut = dwTime + (nBiasNumber * nBiasSign);
return hres;
}
/* ParseOptions parses through any label options that may be present at
* m_pszCurrent. pszTokenEnd initially points to the end of the token at
* m_pszCurrent, a small perf win since the caller has already calculated
* it. If ParseOptions is filling in the static options structure embedded
* in the serviceinfo, pOpt points to it and ppOptOut will be NULL. If pOpt
* is NULL, then ParseOptions will construct a new CDynamicOptions object
* and return it in *ppOptOut, iff any new options are found at the current
* token. pszOptionEndToken indicates the token which ends the list of
* options -- either "labels" or "ratings". A token consisting of just the
* first character of pszOptionEndToken will also terminate the list.
*
* ParseOptions fails iff it finds an option it doesn't recognize, or a
* syntax error in an option it does recognize. It succeeds if all options
* are syntactically correct or if there are no options to parse.
*
* The token which terminates the list of options is also consumed.
*
* FEATURE - how should we flag mandatory extensions, 'until' options that
* give an expired date, etc.? set a flag in the CParsedServiceInfo and
* keep parsing?
*/
enum OptionID {
OID_AT,
OID_BY,
OID_COMMENT,
OID_FULL,
OID_EXTENSION,
OID_GENERIC,
OID_FOR,
OID_MIC,
OID_ON,
OID_SIG,
OID_UNTIL
};
enum OptionContents {
OC_QUOTED,
OC_BOOL,
OC_SPECIAL
};
const struct {
LPCSTR pszToken;
OptionID oid;
OptionContents oc;
} aKnownOptions[] = {
{ szAtOption, OID_AT, OC_QUOTED },
{ szByOption, OID_BY, OC_QUOTED },
{ szCommentOption, OID_COMMENT, OC_QUOTED },
{ szCompleteLabelOption, OID_FULL, OC_QUOTED },
{ szFullOption, OID_FULL, OC_QUOTED },
{ szExtensionOption, OID_EXTENSION, OC_SPECIAL },
{ szGenericOption, OID_GENERIC, OC_BOOL },
{ szShortGenericOption, OID_GENERIC, OC_BOOL },
{ szForOption, OID_FOR, OC_QUOTED },
{ szMICOption, OID_MIC, OC_QUOTED },
{ szMD5Option, OID_MIC, OC_QUOTED },
{ szOnOption, OID_ON, OC_QUOTED },
{ szSigOption, OID_SIG, OC_QUOTED },
{ szUntilOption, OID_UNTIL, OC_QUOTED },
{ szExpOption, OID_UNTIL, OC_QUOTED }
};
const UINT cKnownOptions = sizeof(aKnownOptions) / sizeof(aKnownOptions[0]);
HRESULT CParsedServiceInfo::ParseOptions(LPSTR pszTokenEnd, COptionsBase *pOpt,
CDynamicOptions **ppOptOut, LPCSTR pszOptionEndToken)
{
HRESULT hres = NOERROR;
char szShortOptionEndToken[2];
szShortOptionEndToken[0] = *pszOptionEndToken;
szShortOptionEndToken[1] = '\0';
if (pszTokenEnd == NULL)
{
pszTokenEnd = FindTokenEnd(m_pszCurrent);
}
do
{
/* Have we hit the token that signals the end of the options? */
if (IsEqualToken(m_pszCurrent, pszTokenEnd, pszOptionEndToken) ||
IsEqualToken(m_pszCurrent, pszTokenEnd, szShortOptionEndToken))
{
m_pszCurrent = pszTokenEnd;
SkipWhitespace();
return NOERROR;
}
for (UINT i=0; i<cKnownOptions; i++)
{
if (IsEqualToken(m_pszCurrent, pszTokenEnd, aKnownOptions[i].pszToken))
{
break;
}
}
if (i == cKnownOptions)
{
m_pszInvalidString = m_pszCurrent;
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseOptions() - Unknown Token Encountered at '%s'!", m_pszInvalidString );
return ResultFromScode(MK_E_SYNTAX); /* unrecognized option */
}
m_pszCurrent = pszTokenEnd;
SkipWhitespace();
/* Now parse the stuff that comes after the option token. */
LPSTR pszQuotedString = NULL;
BOOL fBoolOpt = FALSE;
switch (aKnownOptions[i].oc)
{
case OC_QUOTED:
hres = GetQuotedToken(&m_pszCurrent, &pszQuotedString);
break;
case OC_BOOL:
hres = GetBool(&m_pszCurrent, &fBoolOpt);
break;
case OC_SPECIAL:
break; /* we'll handle this specially */
}
if (FAILED(hres))
{ /* incorrect stuff after the option token */
m_pszInvalidString = m_pszCurrent;
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseOptions() - Failed Option Contents Parse at '%s'!", m_pszInvalidString );
return hres;
}
if (pOpt == NULL)
{ /* need to allocate a new options structure */
CDynamicOptions *pNew = new CDynamicOptions;
if (pNew == NULL)
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseOptions() - Failed to Create CDynamicOptions Object!" );
return ResultFromScode(E_OUTOFMEMORY);
}
pOpt = pNew;
*ppOptOut = pNew; /* return new structure to caller */
}
/* Now actually do useful stuff based on which option it is. */
switch (aKnownOptions[i].oid)
{
case OID_UNTIL:
hres = ParseTime(pszQuotedString, &pOpt->m_timeUntil);
if (FAILED(hres))
{
m_pszInvalidString = pszQuotedString;
}
break;
case OID_FOR:
pOpt->m_pszURL = pszQuotedString;
break;
case OID_GENERIC:
if (fBoolOpt)
{
pOpt->m_fdwFlags |= LBLOPT_GENERIC;
}
else
{
pOpt->m_fdwFlags &= ~LBLOPT_GENERIC;
}
break;
case OID_EXTENSION:
hres = ParseExtension(pOpt);
break;
}
if ( FAILED(hres) )
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseOptions() - Failed Option ID Parse at '%s'!", m_pszCurrent );
}
SkipWhitespace();
pszTokenEnd = FindTokenEnd(m_pszCurrent);
} while (SUCCEEDED(hres));
return hres;
}
/* CParsedServiceInfo::ParseRating parses a single rating -- a transmit-name
* followed by either a number or a parenthesized list of multi-values. The
* corresponding rating is stored in the current list of ratings.
*/
HRESULT CParsedServiceInfo::ParseRating()
{
LPSTR pszTokenEnd = FindTokenEnd(m_pszCurrent);
if (*m_pszCurrent == '\0')
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseRating() - Empty String after FindTokenEnd()!" );
return ResultFromScode(MK_E_SYNTAX);
}
*(pszTokenEnd++) = '\0';
CParsedRating r;
r.pszTransmitName = m_pszCurrent;
m_pszCurrent = pszTokenEnd;
SkipWhitespace();
HRESULT hres = ParseNumber(&m_pszCurrent, &r.nValue);
if (FAILED(hres))
{
m_pszInvalidString = m_pszCurrent;
return hres;
}
r.pOptions = m_poptCurrent;
r.fFound = FALSE;
r.fFailed = FALSE;
return (aRatings.Append(r) ? NOERROR : ResultFromScode(E_OUTOFMEMORY));
}
/* CParsedServiceInfo::ParseSingleLabel starts parsing where a single-label
* should occur. A single-label may contain options (in which case a new
* options structure will be allocated), following by the keyword 'ratings'
* (or 'r') and a parenthesized list of ratings.
*/
HRESULT CParsedServiceInfo::ParseSingleLabel()
{
HRESULT hres;
CDynamicOptions *pOpt = NULL;
hres = ParseOptions(NULL, NULL, &pOpt, szRatings);
if (FAILED(hres))
{
if (pOpt != NULL)
{
pOpt->Release();
}
return hres;
}
if (pOpt != NULL)
{
pOpt->m_pNext = m_poptList;
m_poptList = pOpt;
m_poptCurrent = pOpt;
}
hres = ParseLiteralToken(&m_pszCurrent, szLeftParen, &m_pszInvalidString);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseSingleLabel() - ParseLiteralToken() Failed with hres=0x%x!", hres );
return hres;
}
do
{
hres = ParseRating();
} while (SUCCEEDED(hres) && *m_pszCurrent != ')' && *m_pszCurrent != '\0');
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseSingleLabel() - ParseRating() Failed with hres=0x%x!", hres );
return hres;
}
return ParseLiteralToken(&m_pszCurrent, szRightParen, &m_pszInvalidString);
}
/* CParsedServiceInfo::ParseLabels starts parsing just past the keyword
* 'labels' (or 'l'). It needs to handle a label-error, a single-label,
* or a parenthesized list of single-labels.
*/
HRESULT CParsedServiceInfo::ParseLabels()
{
HRESULT hres;
/* First deal with a label-error. It begins with the keyword 'error'. */
if (SUCCEEDED(ParseLiteralToken(&m_pszCurrent, szError, NULL)))
{
hres = ParseLiteralToken(&m_pszCurrent, szLeftParen, &m_pszInvalidString);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseLabels() - ParseLiteralToken() Failed with hres=0x%x!", hres );
return hres;
}
LPSTR pszTokenEnd = FindTokenEnd(m_pszCurrent);
m_pszErrorString = m_pszCurrent;
m_pszCurrent = pszTokenEnd;
SkipWhitespace();
while (*m_pszCurrent != ')')
{
hres = GetQuotedToken(&m_pszCurrent, NULL);
if (FAILED(hres))
{
m_pszInvalidString = m_pszCurrent;
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseLabels() - GetQuotedToken() Failed with hres=0x%x!", hres );
return hres;
}
}
return NOERROR;
}
BOOL fParenthesized = FALSE;
/* If we see a left paren, it's a parenthesized list of single-labels,
* which basically means we'll have to eat an extra parenthesis later.
*/
if (SUCCEEDED(ParseLiteralToken(&m_pszCurrent, szLeftParen, NULL)))
{
fParenthesized = TRUE;
}
for (;;)
{
/* Things which signify the end of the label list:
* - the close parenthesis checked for above
* - a quoted string, indicating the next service-info
* - the end of the string
* - a service-info saying "error (no-ratings <explanation>)"
*
* Check the easy ones first.
*/
if (*m_pszCurrent == ')' || *m_pszCurrent == '\"' || *m_pszCurrent == '\0')
{
break;
}
/* Now look for that tricky error-state service-info. */
LPSTR pszTemp = m_pszCurrent;
if (SUCCEEDED(ParseLiteralToken(&pszTemp, szError, NULL)) &&
SUCCEEDED(ParseLiteralToken(&pszTemp, szLeftParen, NULL)) &&
SUCCEEDED(ParseLiteralToken(&pszTemp, szNoRatings, NULL)))
{
break;
}
hres = ParseSingleLabel();
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedServiceInfo::ParseLabels() - ParseSingleLabel() Failed with hres=0x%x!", hres );
return hres;
}
}
if (fParenthesized)
{
return ParseLiteralToken(&m_pszCurrent, szRightParen, &m_pszInvalidString);
}
return NOERROR;
}
/* Parse is passed a pointer to a pointer to something which should
* be a service-info string (i.e., not the close paren for the labellist, and
* not the end of the string). The caller's string pointer is advanced to the
* end of the service-info string.
*/
HRESULT CParsedServiceInfo::Parse(LPSTR *ppszServiceInfo)
{
/* NOTE: Do not return out of this function without copying m_pszCurrent
* back into *ppszServiceInfo! Always store your return code in hres and
* exit out the bottom of the function.
*/
HRESULT hres;
m_pszCurrent = *ppszServiceInfo;
hres = ParseLiteralToken(&m_pszCurrent, szError, NULL);
if (SUCCEEDED(hres))
{
/* Keyword is 'error'. Better be followed by '(', 'no-ratings',
* explanations, and a close-paren.
*/
hres = ParseLiteralToken(&m_pszCurrent, szLeftParen, &m_pszInvalidString);
if (SUCCEEDED(hres))
{
hres = ParseLiteralToken(&m_pszCurrent, szNoRatings, &m_pszInvalidString);
}
if (SUCCEEDED(hres))
{
m_pszErrorString = szNoRatings;
while (*m_pszCurrent != ')' && *m_pszCurrent != '\0')
{
hres = GetQuotedToken(&m_pszCurrent, NULL);
if (FAILED(hres))
{
m_pszInvalidString = m_pszCurrent;
break;
}
SkipWhitespace();
}
if (*m_pszCurrent == ')')
{
m_pszCurrent++;
SkipWhitespace();
}
}
}
else
{
/* Keyword is not 'error'. Better start with a serviceID --
* a quoted URL.
*/
LPSTR pszServiceID;
hres = GetQuotedToken(&m_pszCurrent, &pszServiceID);
if (SUCCEEDED(hres))
{
m_pszServiceName = pszServiceID;
SkipWhitespace();
/* Past the serviceID. Next either 'error' indicating a service-error,
* or we start options and then a labelword.
*/
LPSTR pszTokenEnd = FindTokenEnd(m_pszCurrent);
if (IsEqualToken(m_pszCurrent, pszTokenEnd, szError))
{
m_pszCurrent = pszTokenEnd;
SkipWhitespace();
hres = ParseServiceError();
}
else
{
hres = ParseOptions(pszTokenEnd, &m_opt, NULL, ::szLabelWord);
if (SUCCEEDED(hres))
{
hres = ParseLabels();
}
}
}
else
{
m_pszInvalidString = m_pszCurrent;
}
}
*ppszServiceInfo = m_pszCurrent;
return hres;
}
const char szPicsVersionLabel[] = "PICS-";
const UINT cchLabel = (sizeof(szPicsVersionLabel)-1) / sizeof(szPicsVersionLabel[0]);
HRESULT CParsedLabelList::Parse(LPSTR pszCopy)
{
m_pszList = pszCopy; /* we own the label list string now */
/* Make another copy, which we won't carve up during parsing, so that the
* access-denied dialog can compare literal labels.
*/
m_pszOriginalLabel = new char[::strlenf(pszCopy)+1];
if (m_pszOriginalLabel != NULL)
{
::strcpyf(m_pszOriginalLabel, pszCopy);
}
m_pszCurrent = m_pszList;
SkipWhitespace();
HRESULT hres;
hres = ParseLiteralToken(&m_pszCurrent, szLeftParen, &m_pszInvalidString);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedLabelList::Parse() - ParseLiteralToken() Failed with hres=0x%x!", hres );
return hres;
}
if (strnicmpf(m_pszCurrent, szPicsVersionLabel, cchLabel))
{
TraceMsg( TF_WARNING, "CParsedLabelList::Parse() - Pics Version Label Comparison Failed at '%s'!", m_pszCurrent );
return ResultFromScode(MK_E_SYNTAX);
}
m_pszCurrent += cchLabel;
INT nVersion;
hres = ParseNumber(&m_pszCurrent, &nVersion);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedLabelList::Parse() - ParseNumber() Failed with hres=0x%x!", hres );
return hres;
}
CParsedServiceInfo *psi = &m_ServiceInfo;
do
{
hres = psi->Parse(&m_pszCurrent);
if (FAILED(hres))
{
TraceMsg( TF_WARNING, "CParsedLabelList::Parse() - psi->Parse() Failed with hres=0x%x!", hres );
return hres;
}
if (*m_pszCurrent != ')' && *m_pszCurrent != '\0')
{
CParsedServiceInfo *pNew = new CParsedServiceInfo;
if (pNew == NULL)
{
TraceMsg( TF_WARNING, "CParsedLabelList::Parse() - Failed to Create CParsedServiceInfo!" );
return ResultFromScode(E_OUTOFMEMORY);
}
psi->Append(pNew);
psi = pNew;
}
} while (*m_pszCurrent != ')' && *m_pszCurrent != '\0');
return NOERROR;
}
HRESULT ParseLabelList(LPCSTR pszList, CParsedLabelList **ppParsed)
{
LPSTR pszCopy = new char[strlenf(pszList)+1];
if (pszCopy == NULL)
{
TraceMsg( TF_WARNING, "ParseLabelList() - Failed to Create pszCopy!" );
return ResultFromScode(E_OUTOFMEMORY);
}
::strcpyf(pszCopy, pszList);
*ppParsed = new CParsedLabelList;
if (*ppParsed == NULL)
{
TraceMsg( TF_WARNING, "ParseLabelList() - Failed to Create CParsedLabelList!" );
delete pszCopy;
pszCopy = NULL;
return ResultFromScode(E_OUTOFMEMORY);
}
return (*ppParsed)->Parse(pszCopy);
}
void FreeParsedLabelList(CParsedLabelList *pList)
{
delete pList;
pList = NULL;
}
| 28.962477 | 170 | 0.574097 | npocmaka |
f3796fcf86116b59f70a9ffe916bc4182eba9155 | 10,048 | cc | C++ | tensorflow/core/grappler/graph_analyzer/graph_analyzer.cc | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 848 | 2019-12-03T00:16:17.000Z | 2022-03-31T22:53:17.000Z | tensorflow/core/grappler/graph_analyzer/graph_analyzer.cc | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 656 | 2019-12-03T00:48:46.000Z | 2022-03-31T18:41:54.000Z | tensorflow/core/grappler/graph_analyzer/graph_analyzer.cc | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 506 | 2019-12-03T00:46:26.000Z | 2022-03-30T10:34:56.000Z | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include <deque>
#include <iostream>
#include "absl/memory/memory.h"
#include "absl/strings/str_format.h"
#include "tensorflow/core/grappler/graph_analyzer/gen_node.h"
#include "tensorflow/core/grappler/graph_analyzer/graph_analyzer.h"
#include "tensorflow/core/grappler/graph_analyzer/sig_node.h"
namespace tensorflow {
namespace grappler {
namespace graph_analyzer {
GraphAnalyzer::GraphAnalyzer(const GraphDef& graph, int subgraph_size)
: graph_(graph), subgraph_size_(subgraph_size) {}
GraphAnalyzer::~GraphAnalyzer() {}
Status GraphAnalyzer::Run() {
// The signature computation code would detect this too, but better
// to report it up front than spend time computing all the graphs first.
if (subgraph_size_ > Signature::kMaxGraphSize) {
return Status(error::INVALID_ARGUMENT,
absl::StrFormat("Subgraphs of %d nodes are not supported, "
"the maximal supported node count is %d.",
subgraph_size_, Signature::kMaxGraphSize));
}
Status st = BuildMap();
if (!st.ok()) {
return st;
}
FindSubgraphs();
DropInvalidSubgraphs();
st = CollateResult();
if (!st.ok()) {
return st;
}
return Status::OK();
}
Status GraphAnalyzer::BuildMap() {
nodes_.clear();
return GenNode::BuildGraphInMap(graph_, &nodes_);
}
void GraphAnalyzer::FindSubgraphs() {
result_.clear();
if (subgraph_size_ < 1) {
return;
}
partial_.clear();
todo_.clear(); // Just in case.
// Start with all subgraphs of size 1.
const Subgraph::Identity empty_parent;
for (const auto& node : nodes_) {
if (subgraph_size_ == 1) {
result_.ExtendParent(empty_parent, node.second.get());
} else {
// At this point ExtendParent() is guaranteed to not return nullptr.
todo_.push_back(partial_.ExtendParent(empty_parent, node.second.get()));
}
}
// Then extend the subgraphs until no more extensions are possible.
while (!todo_.empty()) {
ExtendSubgraph(todo_.front());
todo_.pop_front();
}
partial_.clear();
}
void GraphAnalyzer::ExtendSubgraph(Subgraph* parent) {
bool will_complete = (parent->id().size() + 1 == subgraph_size_);
SubgraphPtrSet& sg_set = will_complete ? result_ : partial_;
const GenNode* last_all_or_none_node = nullptr;
for (SubgraphIterator sit(parent); !sit.AtEnd(); sit.Next()) {
const GenNode* node = sit.GetNode();
GenNode::Port port = sit.GetPort();
const GenNode::LinkTarget& neighbor = sit.GetNeighbor();
if (node->AllInputsOrNone() && port.IsInbound() && !port.IsControl()) {
if (node != last_all_or_none_node) {
ExtendSubgraphAllOrNone(parent, node);
last_all_or_none_node = node;
}
sit.SkipPort();
} else if (neighbor.node->AllInputsOrNone() && !port.IsInbound() &&
!port.IsControl()) {
if (parent->id().find(neighbor.node) == parent->id().end()) {
// Not added yet.
ExtendSubgraphAllOrNone(parent, neighbor.node);
}
} else if (node->IsMultiInput(port)) {
ExtendSubgraphPortAllOrNone(parent, node, port);
sit.SkipPort();
} else if (neighbor.node->IsMultiInput(neighbor.port)) {
// Would need to add all inputs of the neighbor node at this port at
// once.
if (parent->id().find(neighbor.node) != parent->id().end()) {
continue; // Already added.
}
ExtendSubgraphPortAllOrNone(parent, neighbor.node, neighbor.port);
} else {
Subgraph* sg = sg_set.ExtendParent(parent->id(), neighbor.node);
if (!will_complete && sg != nullptr) {
todo_.push_back(sg);
}
}
}
}
void GraphAnalyzer::ExtendSubgraphAllOrNone(Subgraph* parent,
const GenNode* node) {
Subgraph::Identity id = parent->id();
id.insert(node);
auto range_end = node->links().end();
for (auto nbit = node->links().begin(); nbit != range_end; ++nbit) {
auto port = nbit->first;
if (!port.IsInbound() || port.IsControl()) {
continue;
}
// Since there might be multiple links to the same nodes,
// have to add all links one-by-one to check whether the subgraph
// would grow too large. But if it does grow too large, there is no
// point in growing it more, can just skip over the rest of the links.
for (const auto& link : nbit->second) {
id.insert(link.node);
if (id.size() > subgraph_size_) {
return; // Too big.
}
}
}
AddExtendedSubgraph(parent, id);
}
void GraphAnalyzer::ExtendSubgraphPortAllOrNone(Subgraph* parent,
const GenNode* node,
GenNode::Port port) {
auto nbit = node->links().find(port);
if (nbit == node->links().end()) {
return; // Should never happen.
}
Subgraph::Identity id = parent->id();
id.insert(node);
// Since there might be multiple links to the same nodes,
// have to add all links one-by-one to check whether the subgraph
// would grow too large. But if it does grow too large, there is no
// point in growing it more, can just skip over the rest of the links.
for (const auto& link : nbit->second) {
id.insert(link.node);
if (id.size() > subgraph_size_) {
return; // Too big.
}
}
AddExtendedSubgraph(parent, id);
}
void GraphAnalyzer::AddExtendedSubgraph(Subgraph* parent,
const Subgraph::Identity& id) {
if (id.size() == parent->id().size()) {
return; // Nothing new was added.
}
auto sg = absl::make_unique<Subgraph>(id);
SubgraphPtrSet& spec_sg_set =
(id.size() == subgraph_size_) ? result_ : partial_;
if (spec_sg_set.find(sg) != spec_sg_set.end()) {
// This subgraph was already found by extending from a different path.
return;
}
if (id.size() != subgraph_size_) {
todo_.push_back(sg.get());
}
spec_sg_set.insert(std::move(sg));
}
void GraphAnalyzer::DropInvalidSubgraphs() {
auto resit = result_.begin();
while (resit != result_.end()) {
if (HasInvalidMultiInputs(resit->get())) {
auto delit = resit;
++resit;
result_.erase(delit);
} else {
++resit;
}
}
}
bool GraphAnalyzer::HasInvalidMultiInputs(Subgraph* sg) {
// Do the all-or-none-input nodes.
for (auto const& node : sg->id()) {
if (!node->AllInputsOrNone()) {
continue;
}
bool anyIn = false;
bool anyOut = false;
auto range_end = node->links().end();
for (auto nbit = node->links().begin(); nbit != range_end; ++nbit) {
auto port = nbit->first;
if (!port.IsInbound() || port.IsControl()) {
continue;
}
// Since there might be multiple links to the same nodes,
// have to add all links one-by-one to check whether the subgraph
// would grow too large. But if it does grow too large, there is no
// point in growing it more, can just skip over the rest of the links.
for (const auto& link : nbit->second) {
if (sg->id().find(link.node) == sg->id().end()) {
anyOut = true;
} else {
anyIn = true;
}
}
}
if (anyIn && anyOut) {
return true;
}
}
// Do the multi-input ports.
for (SubgraphIterator sit(sg); !sit.AtEnd(); sit.Next()) {
if (sit.GetNode()->IsMultiInput(sit.GetPort())) {
bool anyIn = false;
bool anyOut = false;
do {
GenNode* peer = sit.GetNeighbor().node;
if (sg->id().find(peer) == sg->id().end()) {
anyOut = true;
} else {
anyIn = true;
}
} while (sit.NextIfSamePort());
if (anyIn && anyOut) {
return true;
}
}
}
return false;
}
Status GraphAnalyzer::CollateResult() {
ordered_collation_.clear();
collation_map_.clear();
// Collate by the signatures of the graphs.
for (const auto& it : result_) {
auto sig = absl::make_unique<Signature>();
it->ExtractForSignature(&sig->map);
Status status = sig->Compute();
if (!status.ok()) {
return status;
}
auto& coll_entry = collation_map_[sig.get()];
if (coll_entry.sig == nullptr) {
coll_entry.sig = std::move(sig);
}
++coll_entry.count;
}
// Then order them by the count.
for (auto& entry : collation_map_) {
ordered_collation_.insert(&entry.second);
}
result_.clear(); // Not needed after collation.
return Status::OK();
}
std::vector<string> GraphAnalyzer::DumpRawSubgraphs() {
std::vector<string> result;
for (const auto& it : result_) {
result.emplace_back(it->Dump());
}
return result;
}
std::vector<string> GraphAnalyzer::DumpSubgraphs() {
std::vector<string> result;
for (auto ptr : ordered_collation_) {
result.emplace_back(
absl::StrFormat("%d %s", ptr->count, ptr->sig->ToString()));
}
return result;
}
Status GraphAnalyzer::OutputSubgraphs() {
size_t total = 0;
for (auto ptr : ordered_collation_) {
std::cout << ptr->count << ' ' << ptr->sig->ToString() << '\n';
total += ptr->count;
}
std::cout << "Total: " << total << '\n';
if (std::cout.fail()) {
return Status(error::DATA_LOSS, "Failed to write to stdout");
} else {
return Status::OK();
}
}
} // end namespace graph_analyzer
} // end namespace grappler
} // end namespace tensorflow
| 29.380117 | 80 | 0.619924 | abhaikollara |
f37b9708cabd854b47d663424a149a05a7e84e72 | 7,196 | cpp | C++ | src/TundraCore/Script/Script.cpp | realXtend/tundra-urho3d | 436d41c3e3dd1a9b629703ee76fd0ef2ee212ef8 | [
"Apache-2.0"
] | 13 | 2015-02-25T02:42:38.000Z | 2018-07-31T11:40:56.000Z | src/TundraCore/Script/Script.cpp | realXtend/tundra-urho3d | 436d41c3e3dd1a9b629703ee76fd0ef2ee212ef8 | [
"Apache-2.0"
] | 8 | 2015-02-12T22:27:05.000Z | 2017-01-21T15:59:17.000Z | src/TundraCore/Script/Script.cpp | realXtend/tundra-urho3d | 436d41c3e3dd1a9b629703ee76fd0ef2ee212ef8 | [
"Apache-2.0"
] | 12 | 2015-03-25T21:10:50.000Z | 2019-04-10T09:03:10.000Z | // For conditions of distribution and use, see copyright notice in LICENSE
#include "StableHeaders.h"
#include "Script.h"
#include "IScriptInstance.h"
#include "ScriptAsset.h"
#include "AssetAPI.h"
#include "Framework.h"
#include "IAttribute.h"
#include "AttributeMetadata.h"
#include "IAssetTransfer.h"
#include "Entity.h"
#include "AssetRefListener.h"
#include "LoggingFunctions.h"
namespace Tundra
{
Script::~Script()
{
// If we have a classname, empty it to trigger deletion of the script object
if (!className.Get().Trimmed().Empty())
className.Set("", AttributeChange::LocalOnly);
if (scriptInstance_)
scriptInstance_->Unload();
scriptInstance_.Reset();
}
void Script::SetScriptInstance(IScriptInstance *instance)
{
// If we already have a script instance, unload and delete it.
if (scriptInstance_)
{
scriptInstance_->Unload();
scriptInstance_.Reset();
}
scriptInstance_ = instance;
}
void Script::SetScriptApplication(Script* app)
{
if (app)
scriptApplication_ = app;
else
scriptApplication_.Reset();
}
Script* Script::ScriptApplication() const
{
return dynamic_cast<Script*>(scriptApplication_.Get());
}
bool Script::ShouldRun() const
{
int mode = runMode.Get();
if (mode == RunOnBoth)
return true;
if (mode == RunOnClient && isClient_)
return true;
if (mode == RunOnServer && isServer_)
return true;
return false;
}
void Script::SetIsClientIsServer(bool isClient, bool isServer)
{
isClient_ = isClient;
isServer_ = isServer;
}
void Script::Run(const String &name)
{
if (!ShouldRun())
{
LogWarning("Run explicitly called, but RunMode does not match");
return;
}
// This function (Script::Run) is invoked on the Entity Action RunScript(scriptName). To
// allow the user to differentiate between multiple instances of Script in the same entity, the first
// parameter of RunScript allows the user to specify which Script to run. So, first check
// if this Run message is meant for us.
if (!name.Empty() && name != Name())
return; // Not our RunScript invocation - ignore it.
if (!scriptInstance_)
{
LogError("Run: No script instance set");
return;
}
scriptInstance_->Run();
}
/// Invoked on the Entity Action UnloadScript(scriptName).
void Script::Unload(const String &name)
{
if (!name.Empty() && name != Name())
return; // Not our RunScript invocation - ignore it.
if (!scriptInstance_)
{
LogError("Unload: Cannot perform, no script instance set");
return;
}
scriptInstance_->Unload();
}
Script::Script(Urho3D::Context* context, Scene* scene):
IComponent(context, scene),
INIT_ATTRIBUTE_VALUE(scriptRef, "Script ref", AssetReferenceList("Script")),
INIT_ATTRIBUTE_VALUE(runOnLoad, "Run on load", false),
INIT_ATTRIBUTE_VALUE(runMode, "Run mode", RunOnBoth),
INIT_ATTRIBUTE(applicationName, "Script application name"),
INIT_ATTRIBUTE(className, "Script class name"),
scriptInstance_(0),
isClient_(false),
isServer_(false)
{
static AttributeMetadata scriptRefData;
static AttributeMetadata runModeData;
static bool metadataInitialized = false;
if (!metadataInitialized)
{
AttributeMetadata::ButtonInfoList scriptRefButtons;
scriptRefData.buttons = scriptRefButtons;
scriptRefData.elementType = "AssetReference";
runModeData.enums[RunOnBoth] = "Both";
runModeData.enums[RunOnClient] = "Client";
runModeData.enums[RunOnServer] = "Server";
metadataInitialized = true;
}
scriptRef.SetMetadata(&scriptRefData);
runMode.SetMetadata(&runModeData);
AttributeChanged.Connect(this, &Script::HandleAttributeChanged);
ParentEntitySet.Connect(this, &Script::RegisterActions);
}
void Script::HandleAttributeChanged(IAttribute* attribute, AttributeChange::Type /*change*/)
{
if (!framework)
return;
if (attribute == &scriptRef)
{
// Do not even fetch the assets if we should not run
if (!ShouldRun())
return;
AssetReferenceList scripts = scriptRef.Get();
// Purge empty script refs
scripts.RemoveEmpty();
if (scripts.Size())
scriptAssets->HandleChange(scripts);
else // If there are no non-empty script refs, we unload the script instance.
SetScriptInstance(0);
}
else if (attribute == &applicationName)
{
ApplicationNameChanged.Emit(this, applicationName.Get());
}
else if (attribute == &className)
{
ClassNameChanged.Emit(this, className.Get());
}
else if (attribute == &runMode)
{
// If we had not loaded script assets previously because of runmode not allowing, load them now
if (ShouldRun())
{
if (scriptAssets->Assets().Empty())
HandleAttributeChanged(&scriptRef, AttributeChange::Default);
}
else // If runmode is changed and shouldn't run, unload script assets and script instance
{
scriptAssets->HandleChange(AssetReferenceList());
SetScriptInstance(0);
}
}
else if (attribute == &runOnLoad)
{
// If RunOnLoad changes, is true, and we don't have a script instance yet, emit ScriptAssetsChanged to start up the script.
if (runOnLoad.Get() && scriptAssets->Assets().Size() && (!scriptInstance_ || !scriptInstance_->IsEvaluated()))
OnScriptAssetLoaded(0, AssetPtr()); // The asset ptr can be null, it is not used.
}
}
void Script::OnScriptAssetLoaded(uint /*index*/, AssetPtr /*asset_*/)
{
// If all asset ref listeners have valid, loaded script assets, it's time to fire up the script engine
Vector<ScriptAssetPtr> loadedScriptAssets;
Vector<AssetPtr> allAssets = scriptAssets->Assets();
for (uint i = 0; i < allAssets.Size(); ++i)
{
if (allAssets[i])
{
ScriptAssetPtr asset = Urho3D::DynamicCast<ScriptAsset>(allAssets[i]);
if (!asset)
{
LogError("Script::ScriptAssetLoaded: Loaded asset of type other than ScriptAsset!");
continue;
}
if (asset->IsLoaded())
loadedScriptAssets.Push(asset);
}
}
if (loadedScriptAssets.Size() == allAssets.Size())
ScriptAssetsChanged.Emit(this, loadedScriptAssets);
}
void Script::RegisterActions()
{
Entity *entity = ParentEntity();
assert(entity);
if (entity)
{
entity->Action("RunScript")->Triggered.Connect(this, &Script::RunTriggered);
entity->Action("UnloadScript")->Triggered.Connect(this, &Script::UnloadTriggered);
}
scriptAssets = new AssetRefListListener(framework->Asset());
scriptAssets->Loaded.Connect(this, &Script::OnScriptAssetLoaded);
}
void Script::RunTriggered(const StringVector& params)
{
if (params.Size())
Run(params[0]);
}
void Script::UnloadTriggered(const StringVector& params)
{
if (params.Size())
Unload(params[0]);
}
}
| 29.371429 | 131 | 0.6505 | realXtend |
3ce18297a386f1e8912d40bf2e36749f0b7bbfca | 31,907 | cpp | C++ | Ogitor/src/PGInstanceManager.cpp | nexustheru/ogitor | a700f8fefffa4ac51c5c20ad155e97e6700aabd4 | [
"MIT"
] | null | null | null | Ogitor/src/PGInstanceManager.cpp | nexustheru/ogitor | a700f8fefffa4ac51c5c20ad155e97e6700aabd4 | [
"MIT"
] | null | null | null | Ogitor/src/PGInstanceManager.cpp | nexustheru/ogitor | a700f8fefffa4ac51c5c20ad155e97e6700aabd4 | [
"MIT"
] | 2 | 2021-04-02T03:53:18.000Z | 2022-03-03T07:12:16.000Z | /*/////////////////////////////////////////////////////////////////////////////////
/// An
/// ___ ____ ___ _____ ___ ____
/// / _ \ / ___|_ _|_ _/ _ \| _ \
/// | | | | | _ | | | || | | | |_) |
/// | |_| | |_| || | | || |_| | _ <
/// \___/ \____|___| |_| \___/|_| \_\
/// File
///
/// Copyright (c) 2008-2016 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
///
/// The MIT License
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////*/
#include "OgitorsPrerequisites.h"
#include "BaseEditor.h"
#include "OgitorsRoot.h"
#include "OgitorsSystem.h"
#include "CameraEditor.h"
#include "ViewportEditor.h"
#include "PGInstanceManager.h"
#include "PGInstanceEditor.h"
#include "OgitorsUndoManager.h"
#include "tinyxml.h"
#include "ofs.h"
#include "PagedGeometry.h"
#include "BatchPage.h"
#include "ImpostorPage.h"
#include "TreeLoader3D.h"
using namespace Ogitors;
using namespace Forests;
//-----------------------------------------------------------------------------------------
namespace Ogitors
{
class AddInstanceUndo : public OgitorsUndoBase
{
public:
AddInstanceUndo(unsigned int objectID, int index) : mObjectID(objectID), mIndex(index) {};
virtual bool apply();
protected:
unsigned int mObjectID;
int mIndex;
};
//-----------------------------------------------------------------------------------------
class RemoveInstanceUndo : public OgitorsUndoBase
{
public:
RemoveInstanceUndo(unsigned int objectID, Ogre::Vector3 pos, Ogre::Real scale, Ogre::Real yaw) : mObjectID(objectID), mPos(pos), mScale(scale), mYaw(yaw) {};
virtual bool apply();
protected:
unsigned int mObjectID;
Ogre::Vector3 mPos;
Ogre::Real mScale;
Ogre::Real mYaw;
};
}
//-----------------------------------------------------------------------------------------
bool AddInstanceUndo::apply()
{
CPGInstanceManager *man = static_cast<CPGInstanceManager*>(OgitorsRoot::getSingletonPtr()->FindObject(mObjectID));
if(man)
{
PGInstanceInfo info = man->getInstanceInfo(mIndex);
man->_deleteChildEditor(mIndex);
man->removeInstance(mIndex);
OgitorsUndoManager::getSingletonPtr()->AddUndo(OGRE_NEW RemoveInstanceUndo(mObjectID, info.pos, info.scale, info.yaw));
}
return true;
}
//-----------------------------------------------------------------------------------------
bool RemoveInstanceUndo::apply()
{
CPGInstanceManager *man = static_cast<CPGInstanceManager *>(OgitorsRoot::getSingletonPtr()->FindObject(mObjectID));
if(man)
{
int index = man->addInstance(mPos, mScale, mYaw);
man->_createChildEditor(index , mPos, mScale, mYaw);
OgitorsUndoManager::getSingletonPtr()->AddUndo(OGRE_NEW AddInstanceUndo(mObjectID, index));
}
return true;
}
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
CPGInstanceManager::CPGInstanceManager(CBaseEditorFactory *factory) : CBaseEditor(factory),
mHandle(0), mPGHandle(0), mEntityHandle(0), mPlacementMode(false), mNextInstanceIndex(0)
{
mHelper = 0;
mHideChildrenInProgress = false;
mLastFileName = "";
mUsingPlaceHolderMesh = false;
mTempFileName = "";
mShowChildren = false;
}
//-----------------------------------------------------------------------------------------
CPGInstanceManager::~CPGInstanceManager()
{
}
//-----------------------------------------------------------------------------------------
Ogre::AxisAlignedBox CPGInstanceManager::getAABB()
{
if(mEntityHandle)
return mEntityHandle->getBoundingBox();
else
return Ogre::AxisAlignedBox::BOX_NULL;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::update(float timePassed)
{
if(mPGHandle)
mPGHandle->update();
return false;
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::showBoundingBox(bool bShow)
{
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::setLayerImpl(unsigned int newlayer)
{
if(mEntityHandle)
mEntityHandle->setVisibilityFlags(1 << newlayer);
if(mLoaded->get())
{
unLoad();
load();
}
return true;
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::setSelectedImpl(bool bSelected)
{
if(!bSelected)
{
mPlacementMode = false;
mOgitorsRoot->ReleaseMouse();
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_save(Ogre::String filename)
{
std::stringstream stream;
PGInstanceList::iterator it = mInstanceList.begin();
while(it != mInstanceList.end())
{
stream << Ogre::StringConverter::toString(it->first).c_str();
stream << ";";
stream << Ogre::StringConverter::toString(it->second.pos).c_str();
stream << ";";
stream << Ogre::StringConverter::toString(it->second.scale).c_str();
stream << ";";
stream << Ogre::StringConverter::toString(it->second.yaw).c_str();
stream << "\n";
it++;
}
OgitorsUtils::SaveStreamOfs(stream, filename);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::onSave(bool forced)
{
Ogre::String dir = "/PGInstances/";
OFS::OfsPtr& mFile = mOgitorsRoot->GetProjectFile();
mFile->createDirectory(dir.c_str());
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
if(!mLastFileName.empty())
mFile->deleteFile(mLastFileName.c_str());
if(!mTempFileName.empty())
mFile->deleteFile(mTempFileName.c_str());
Ogre::String filename = dir + Ogre::StringConverter::toString(mObjectID->get()) + "_" + name + ".instance";
mLastFileName = filename;
_save(filename);
mTempModified->set(false);
mTempFileName = "";
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_onLoad()
{
Ogre::String filename;
if(mTempModified->get())
{
if(mTempFileName.empty())
mTempFileName = "/Temp/tmp" + Ogre::StringConverter::toString(mObjectID->get()) + ".instance";
filename = mTempFileName;
}
else
{
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
filename = "/PGInstances/" + Ogre::StringConverter::toString(mObjectID->get()) + "_" + name + ".instance";
}
OFS::OFSHANDLE handle;
OFS::OfsPtr& mFile = mOgitorsRoot->GetProjectFile();
OFS::OfsResult ret = mFile->openFile(handle, filename.c_str());
if(ret != OFS::OFS_OK)
return;
OFS::ofs64 file_size = 0;
mFile->getFileSize(handle, file_size);
if(file_size == 0)
{
mFile->closeFile(handle);
return;
}
char *buffer = new char[(unsigned int)file_size];
mFile->read(handle, buffer, (unsigned int)file_size);
std::stringstream stream;
stream << buffer;
delete [] buffer;
if(!mTempModified->get())
mLastFileName = filename;
Ogre::StringVector list;
char res[128];
while(!stream.eof())
{
stream.getline(res, 128);
Ogre::String resStr(res);
OgitorsUtils::ParseStringVector(resStr, list);
if(list.size() == 3)
{
PGInstanceInfo info;
info.pos = Ogre::StringConverter::parseVector3(list[0]);
info.scale = Ogre::StringConverter::parseReal(list[1]);
info.yaw = Ogre::StringConverter::parseReal(list[2]);
mInstanceList[mNextInstanceIndex++] = info;
}
else if(list.size() == 4)
{
PGInstanceInfo info;
int index = Ogre::StringConverter::parseInt(list[0]);
info.pos = Ogre::StringConverter::parseVector3(list[1]);
info.scale = Ogre::StringConverter::parseReal(list[2]);
info.yaw = Ogre::StringConverter::parseReal(list[3]);
info.instance = 0;
mInstanceList[index] = info;
if(index >= mNextInstanceIndex)
mNextInstanceIndex = index + 1;
}
}
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::getObjectContextMenu(UTFStringVector &menuitems)
{
menuitems.clear();
if(!mEntityHandle)
return false;
if(mPlacementMode)
menuitems.push_back(OTR("Stop Placement"));
else
menuitems.push_back(OTR("Start Placement"));
if(mInstanceList.size())
{
if(mShowChildren)
menuitems.push_back(OTR("Hide Children"));
else
menuitems.push_back(OTR("Show Children"));
}
return true;
}
//-------------------------------------------------------------------------------
void CPGInstanceManager::onObjectContextMenu(int menuresult)
{
if(menuresult == 0)
{
mPlacementMode = !mPlacementMode;
if(mPlacementMode)
mOgitorsRoot->CaptureMouse(this);
else
mOgitorsRoot->ReleaseMouse();
}
else if(menuresult == 1)
{
if(mShowChildren)
{
mHideChildrenInProgress = true;
NameObjectPairList::iterator i, iend;
iend = mChildren.end();
for (i = mChildren.begin(); i != iend; ++i)
{
mSystem->DeleteTreeItem(i->second);
i->second->destroy();
}
mChildren.clear();
mHideChildrenInProgress = false;
mShowChildren = false;
}
else
{
mShowChildren = true;
PGInstanceList::iterator it = mInstanceList.begin();
while(it != mInstanceList.end())
{
_createChildEditor(it->first, it->second.pos, it->second.scale, it->second.yaw);
it++;
}
}
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::createProperties(OgitorsPropertyValueMap ¶ms)
{
PROPERTY_PTR(mModel , "model" , Ogre::String , "" , 0, SETTER(Ogre::String, CPGInstanceManager, _setModel));
PROPERTY_PTR(mPageSize , "pagesize" , int , 75 , 0, SETTER(int, CPGInstanceManager, _setPageSize));
PROPERTY_PTR(mBatchDistance , "batchdistance" , int , 75 , 0, SETTER(int, CPGInstanceManager, _setBatchDistance));
PROPERTY_PTR(mImpostorDistance, "impostordistance", int , 1000, 0, SETTER(int, CPGInstanceManager, _setImpostorDistance));
PROPERTY_PTR(mBounds , "bounds" , Ogre::Vector4, Ogre::Vector4(-10000,-10000,10000,10000), 0, SETTER(Ogre::Vector4, CPGInstanceManager, _setBounds));
PROPERTY_PTR(mCastShadows , "castshadows" , bool ,false,0, SETTER(bool, CPGInstanceManager, _setCastShadows));
PROPERTY_PTR(mTempModified , "tempmodified" , bool ,false,0, 0);
PROPERTY_PTR(mMinScale , "randomizer::minscale", Ogre::Real,1.0f,0, 0);
PROPERTY_PTR(mMaxScale , "randomizer::maxscale", Ogre::Real,1.0f,0, 0);
PROPERTY_PTR(mMinYaw , "randomizer::minyaw", Ogre::Real , 0.0f,0, 0);
PROPERTY_PTR(mMaxYaw , "randomizer::maxyaw", Ogre::Real , 0.0f,0, 0);
mProperties.initValueMap(params);
}
//-----------------------------------------------------------------------------------------
TiXmlElement* CPGInstanceManager::exportDotScene(TiXmlElement *pParent)
{
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
name = Ogre::StringConverter::toString(mObjectID->get()) + "_" + name;
Ogre::String filename = "PGInstances/" + name + ".instance";
TiXmlElement *pNode = pParent->InsertEndChild(TiXmlElement("node"))->ToElement();
// node properties
pNode->SetAttribute("name", mName->get().c_str());
pNode->SetAttribute("id", Ogre::StringConverter::toString(mObjectID->get()).c_str());
// position
TiXmlElement *pPosition = pNode->InsertEndChild(TiXmlElement("position"))->ToElement();
pPosition->SetAttribute("x", "0");
pPosition->SetAttribute("y", "0");
pPosition->SetAttribute("z", "0");
// rotation
TiXmlElement *pRotation = pNode->InsertEndChild(TiXmlElement("rotation"))->ToElement();
pRotation->SetAttribute("qw", "1");
pRotation->SetAttribute("qx", "0");
pRotation->SetAttribute("qy", "0");
pRotation->SetAttribute("qz", "0");
// scale
TiXmlElement *pScale = pNode->InsertEndChild(TiXmlElement("scale"))->ToElement();
pScale->SetAttribute("x", "1");
pScale->SetAttribute("y", "1");
pScale->SetAttribute("z", "1");
TiXmlElement *pPG = pNode->InsertEndChild(TiXmlElement("pagedgeometry"))->ToElement();
pPG->SetAttribute("fileName", filename.c_str());
pPG->SetAttribute("model", mModel->get().c_str());
pPG->SetAttribute("pageSize", Ogre::StringConverter::toString(mPageSize->get()).c_str());
pPG->SetAttribute("batchDistance", Ogre::StringConverter::toString(mBatchDistance->get()).c_str());
pPG->SetAttribute("impostorDistance", Ogre::StringConverter::toString(mImpostorDistance->get()).c_str());
pPG->SetAttribute("bounds", Ogre::StringConverter::toString(mBounds->get()).c_str());
pPG->SetAttribute("castShadows", Ogre::StringConverter::toString(mCastShadows->get()).c_str());
return pPG;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::load(bool async)
{
if(mLoaded->get())
return true;
Ogre::String tmpDir = OgitorsUtils::QualifyPath(mOgitorsRoot->GetProjectOptions()->ProjectDir + "/Temp") + "/";
mPGHandle = new PagedGeometry();
mPGHandle->setCamera(mOgitorsRoot->GetViewport()->getCameraEditor()->getCamera());
mPGHandle->setPageSize(mPageSize->get());
mPGHandle->setInfinite();
mPGHandle->setTempDir(tmpDir);
mPGHandle->addDetailLevel<BatchPage>(mBatchDistance->get(),0);
mPGHandle->addDetailLevel<ImpostorPage>(mImpostorDistance->get(),0);
Ogre::Vector4 bounds = mBounds->get();
mHandle = new Forests::TreeLoader3D(mPGHandle, Forests::TBounds(bounds.x, bounds.y, bounds.z, bounds.w));
mPGHandle->setPageLoader(mHandle);
if(mInstanceList.size() == 0)
_onLoad();
if(mModel->get() != "")
{
try
{
mEntityHandle = mOgitorsRoot->GetSceneManager()->createEntity(mName->get(), mModel->get() + ".mesh", PROJECT_RESOURCE_GROUP);
mUsingPlaceHolderMesh = false;
}
catch(...)
{
mUsingPlaceHolderMesh = true;
mEntityHandle = mOgitorsRoot->GetSceneManager()->createEntity(mName->get(), "missing_mesh.mesh");
mEntityHandle->setMaterialName("MAT_GIZMO_X_L");
}
mEntityHandle->setQueryFlags(0);
mEntityHandle->setVisibilityFlags(1 << mLayer->get());
mEntityHandle->setCastShadows(mCastShadows->get());
PGInstanceList::iterator it = mInstanceList.begin();
while(it != mInstanceList.end())
{
mHandle->addTree(mEntityHandle, it->second.pos, Ogre::Degree(it->second.yaw), it->second.scale);
it++;
}
}
registerForUpdates();
mLoaded->set(true);
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::unLoad()
{
if(!mLoaded->get())
return true;
if(mOgitorsRoot->GetLoadState() != LS_UNLOADED)
{
if(mTempFileName.empty())
{
mTempFileName = "/Temp/tmp" + Ogre::StringConverter::toString(mObjectID->get()) + ".instance";
}
_save(mTempFileName);
mTempModified->set(true);
}
unRegisterForUpdates();
if(mHandle)
delete mHandle;
if(mPGHandle)
delete mPGHandle;
if(mEntityHandle)
mOgitorsRoot->GetSceneManager()->destroyEntity(mEntityHandle);
mHandle = 0;
mPGHandle = 0;
mEntityHandle = 0;
if(mPlacementMode)
mOgitorsRoot->ReleaseMouse();
mPlacementMode = false;
mLoaded->set(false);
return true;
}
//-----------------------------------------------------------------------------------------
PGInstanceInfo CPGInstanceManager::getInstanceInfo(int index)
{
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
return it->second;
}
return PGInstanceInfo();
}
//-----------------------------------------------------------------------------------------
int CPGInstanceManager::addInstance(const Ogre::Vector3& pos, const Ogre::Real& scale, const Ogre::Real& yaw)
{
if(!mEntityHandle || !mHandle)
return -1;
mHandle->addTree(mEntityHandle, pos, Ogre::Degree(yaw), scale);
PGInstanceInfo instance;
instance.pos = pos;
instance.scale = scale;
instance.yaw = yaw;
instance.instance = 0;
int result = mNextInstanceIndex++;
mInstanceList.insert(PGInstanceList::value_type(result, instance));
return result;
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::removeInstance(int index)
{
if(!mLoaded->get() || index == -1)
return;
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
it->second.instance = 0;
if(!mHideChildrenInProgress)
{
mHandle->deleteTrees(it->second.pos, 0.01f, mEntityHandle);
mInstanceList.erase(it);
}
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::modifyInstancePosition(int index, const Ogre::Vector3& pos)
{
if(!mHandle || index == -1)
return;
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
if(mEntityHandle)
{
mHandle->deleteTrees(it->second.pos, 0.01f, mEntityHandle);
mHandle->addTree(mEntityHandle, pos, Ogre::Degree(it->second.yaw), it->second.scale);
}
it->second.pos = pos;
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::modifyInstanceScale(int index, Ogre::Real scale)
{
if(!mHandle || index == -1)
return;
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
it->second.scale = scale;
if(mEntityHandle)
{
mHandle->deleteTrees(it->second.pos, 0.01f, mEntityHandle);
mHandle->addTree(mEntityHandle, it->second.pos, Ogre::Degree(it->second.yaw), it->second.scale);
}
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::modifyInstanceYaw(int index, Ogre::Real yaw)
{
if(!mHandle || index == -1)
return;
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
it->second.yaw = yaw;
if(mEntityHandle)
{
mHandle->deleteTrees(it->second.pos, 0.01f, mEntityHandle);
mHandle->addTree(mEntityHandle, it->second.pos, Ogre::Degree(it->second.yaw), it->second.scale);
}
}
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setModel(OgitorsPropertyBase* property, const Ogre::String& value)
{
Ogre::String newname = "PGInstance<" + value + ">";
newname += mOgitorsRoot->CreateUniqueID(newname,"");
if(mPlacementMode)
{
mPlacementMode = false;
mOgitorsRoot->ReleaseMouse();
}
mModel->init(value);
mName->set(newname);
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setPageSize(OgitorsPropertyBase* property, const int& value)
{
if(value < 10)
return false;
if(mLoaded->get())
{
unLoad();
load();
}
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setBatchDistance(OgitorsPropertyBase* property, const int& value)
{
if(value < 50)
return false;
if(mLoaded->get())
{
unLoad();
load();
}
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setImpostorDistance(OgitorsPropertyBase* property, const int& value)
{
if(value < (mBatchDistance->get() + 50))
return false;
if(mLoaded->get())
{
unLoad();
load();
}
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setBounds(OgitorsPropertyBase* property, const Ogre::Vector4& value)
{
if(mLoaded->get())
{
unLoad();
load();
}
return true;
}
//-----------------------------------------------------------------------------------------
bool CPGInstanceManager::_setCastShadows(OgitorsPropertyBase* property, const bool& value)
{
if(mEntityHandle)
{
mEntityHandle->setCastShadows(value);
}
if(mPGHandle)
mPGHandle->reloadGeometry();
return true;
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_createChildEditor(int index, Ogre::Vector3 pos, Ogre::Real scale, Ogre::Real yaw)
{
if(index == -1 || !mShowChildren)
return;
//We do not want an UNDO to be created for creation of children
OgitorsUndoManager::getSingletonPtr()->BeginCollection("Eat Creation");
OgitorsPropertyValueMap params;
params["init"] = OgitorsPropertyValue(PROP_STRING, Ogre::Any(Ogre::String("")));
params["position"] = OgitorsPropertyValue(PROP_VECTOR3, Ogre::Any(pos));
params["index"] = OgitorsPropertyValue(PROP_INT, Ogre::Any(index));
params["scale"] = OgitorsPropertyValue(PROP_VECTOR3, Ogre::Any(Ogre::Vector3(scale, scale, scale)));
params["uniformscale"] = OgitorsPropertyValue(PROP_REAL, Ogre::Any(scale));
params["yaw"] = OgitorsPropertyValue(PROP_REAL, Ogre::Any(yaw));
Ogre::Quaternion q1;
q1.FromAngleAxis(Ogre::Degree(yaw), Ogre::Vector3::UNIT_Y);
params["orientation"] = OgitorsPropertyValue(PROP_QUATERNION, Ogre::Any(q1));
mInstanceList[index].instance = static_cast<CPGInstanceEditor*>(mOgitorsRoot->CreateEditorObject(this, "PGInstance", params, true, false));
OgitorsUndoManager::getSingletonPtr()->EndCollection(false, true);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_deleteChildEditor(int index)
{
if(index == -1 || !mShowChildren)
return;
//We do not want an UNDO to be created for deletion of children
OgitorsUndoManager::getSingletonPtr()->BeginCollection("Eat Deletion");
PGInstanceList::iterator it = mInstanceList.find(index);
if(it != mInstanceList.end())
{
mHideChildrenInProgress = true;
if(it->second.instance)
{
mSystem->DeleteTreeItem(it->second.instance);
it->second.instance->destroy(true);
it->second.instance = 0;
}
mHideChildrenInProgress = false;
}
OgitorsUndoManager::getSingletonPtr()->EndCollection(false, true);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseLeftUp (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseLeftDown (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
Ogre::Camera *cam = viewport->getCameraEditor()->getCamera();
Ogre::Viewport *vp = static_cast<Ogre::Viewport*>(viewport->getHandle());
float width = vp->getActualWidth();
float height = vp->getActualHeight();
Ogre::Ray mRay = cam->getCameraToViewportRay(point.x / width, point.y / height);
Ogre::Vector3 vPos;
if(viewport->GetHitPosition(mRay, vPos))
{
float yaw = (mMaxYaw->get() - mMinYaw->get()) * Ogre::Math::UnitRandom() + mMinYaw->get();
float scale = (mMaxScale->get() - mMinScale->get()) * Ogre::Math::UnitRandom() + mMinScale->get();
int index = addInstance(vPos, scale, yaw);
OgitorsUndoManager::getSingletonPtr()->BeginCollection("Add Instance");
_createChildEditor(index , vPos, scale, yaw);
OgitorsUndoManager::getSingletonPtr()->AddUndo(OGRE_NEW AddInstanceUndo(mObjectID->get(), index));
OgitorsUndoManager::getSingletonPtr()->EndCollection(true);
}
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseMove (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseMove(point, buttons & ~OMB_LEFT);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseLeave (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseLeave(point, buttons);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseRightDown (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseRightDown(point, buttons);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseRightUp (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseRightUp(point, buttons);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseMiddleDown (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseMiddleDown(point, buttons);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseMiddleUp (CViewportEditor *viewport, Ogre::Vector2 point, unsigned int buttons)
{
viewport->OnMouseMiddleUp(point, buttons);
}
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::OnMouseWheel (CViewportEditor *viewport, Ogre::Vector2 point, float delta, unsigned int buttons)
{
viewport->OnMouseWheel(point, delta, buttons);
}
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
//------CMATERIALEDITORFACTORY-----------------------------------------------------------------
//-----------------------------------------------------------------------------------------
CPGInstanceManagerFactory::CPGInstanceManagerFactory(OgitorsView *view) : CBaseEditorFactory(view)
{
mTypeName = "PGInstance Manager";
mEditorType = ETYPE_CUSTOM_MANAGER;
mAddToObjectList = true;
mRequirePlacement = false;
mIcon = "pagedgeometry.svg";
mCapabilities = CAN_UNDO | CAN_DELETE;
mUsesGizmos = false;
mUsesHelper = false;
OgitorsPropertyDef *definition = AddPropertyDefinition("model", "Model", "The model to be used.", PROP_STRING);
definition->setOptions(OgitorsRoot::getSingletonPtr()->GetModelNames());
AddPropertyDefinition("pagesize", "Page Size", "Size of batch pages.",PROP_INT);
AddPropertyDefinition("batchdistance", "Batch Distance", "Batch Distance.",PROP_INT);
AddPropertyDefinition("impostordistance", "Impostor Distance", "Impostor Distance.",PROP_INT);
definition = AddPropertyDefinition("bounds", "Bounds", "The dimensions of the bounding area.",PROP_VECTOR4);
definition->setFieldNames("X1","Z1","X2","Z2");
AddPropertyDefinition("castshadows","Cast Shadows","Do the instances cast shadows?",PROP_BOOL);
AddPropertyDefinition("tempmodified", "", "Is it temporarily modified.", PROP_BOOL);
AddPropertyDefinition("randomizer::minscale", "Randomizer::Min. Scale", "Minimum Scale of new objects.",PROP_REAL);
AddPropertyDefinition("randomizer::maxscale", "Randomizer::Max. Scale", "Maximum Scale of new objects.",PROP_REAL);
AddPropertyDefinition("randomizer::minyaw", "Randomizer::Min. Yaw", "Minimum Yaw of new objects.",PROP_REAL);
AddPropertyDefinition("randomizer::maxyaw", "Randomizer::Max. Yaw", "Maximum Yaw of new objects.",PROP_REAL);
OgitorsPropertyDefMap::iterator it = mPropertyDefs.find("name");
it->second.setAccess(true, false);
}
//-----------------------------------------------------------------------------------------
CBaseEditorFactory *CPGInstanceManagerFactory::duplicate(OgitorsView *view)
{
CBaseEditorFactory *ret = new CPGInstanceManagerFactory(view);
ret->mTypeID = mTypeID;
return ret;
}
//-----------------------------------------------------------------------------------------
CBaseEditor *CPGInstanceManagerFactory::CreateObject(CBaseEditor **parent, OgitorsPropertyValueMap ¶ms)
{
CPGInstanceManager *object = new CPGInstanceManager(this);
OgitorsPropertyValueMap::iterator ni;
if((ni = params.find("init")) != params.end())
{
OgitorsPropertyValue value = EMPTY_PROPERTY_VALUE;
value.val = Ogre::Any(CreateUniqueID("PGInstance<>"));
params["name"] = value;
params.erase(ni);
}
object->createProperties(params);
object->mParentEditor->init(*parent);
mInstanceCount++;
return object;
}
//-----------------------------------------------------------------------------------------
| 35.334441 | 171 | 0.551133 | nexustheru |
3ce3623a40bc8290b36449418088e85ccbafb816 | 2,518 | hpp | C++ | alpaka/include/alpaka/time/TimeOmp.hpp | alpaka-group/mallocMC | ddba224b764885f816c42a7719551b14e6f5752b | [
"MIT"
] | 6 | 2021-02-01T09:01:39.000Z | 2021-11-14T17:09:03.000Z | alpaka/include/alpaka/time/TimeOmp.hpp | alpaka-group/mallocMC | ddba224b764885f816c42a7719551b14e6f5752b | [
"MIT"
] | 17 | 2020-11-09T14:13:50.000Z | 2021-11-03T11:54:54.000Z | alpaka/include/alpaka/time/TimeOmp.hpp | alpaka-group/mallocMC | ddba224b764885f816c42a7719551b14e6f5752b | [
"MIT"
] | null | null | null | /* Copyright 2019 Axel Huebl, Benjamin Worpitz
*
* This file is part of alpaka.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#ifdef _OPENMP
# include <alpaka/core/Common.hpp>
# include <alpaka/core/Unused.hpp>
# include <alpaka/time/Traits.hpp>
# include <omp.h>
namespace alpaka
{
//#############################################################################
//! The OpenMP accelerator time implementation.
class TimeOmp : public concepts::Implements<ConceptTime, TimeOmp>
{
public:
//-----------------------------------------------------------------------------
TimeOmp() = default;
//-----------------------------------------------------------------------------
ALPAKA_FN_HOST TimeOmp(TimeOmp const&) = delete;
//-----------------------------------------------------------------------------
ALPAKA_FN_HOST TimeOmp(TimeOmp&&) = delete;
//-----------------------------------------------------------------------------
ALPAKA_FN_HOST auto operator=(TimeOmp const&) -> TimeOmp& = delete;
//-----------------------------------------------------------------------------
ALPAKA_FN_HOST auto operator=(TimeOmp&&) -> TimeOmp& = delete;
//-----------------------------------------------------------------------------
/*virtual*/ ~TimeOmp() = default;
};
namespace traits
{
//#############################################################################
//! The OpenMP accelerator clock operation.
template<>
struct Clock<TimeOmp>
{
//-----------------------------------------------------------------------------
ALPAKA_FN_HOST static auto clock(TimeOmp const& time) -> std::uint64_t
{
alpaka::ignore_unused(time);
// NOTE: We compute the number of clock ticks by dividing the following durations:
// - omp_get_wtime returns the elapsed wall clock time in seconds.
// - omp_get_wtick gets the timer precision, i.e., the number of seconds between two successive clock
// ticks.
return static_cast<std::uint64_t>(omp_get_wtime() / omp_get_wtick());
}
};
} // namespace traits
} // namespace alpaka
#endif
| 39.968254 | 117 | 0.42772 | alpaka-group |
3ce52e50af98affa2ee425a05fe1443b443327ed | 2,397 | cpp | C++ | tests/unittests/CompliantByDefaultEventFilterModuleTests.cpp | lalitb/cpp_client_telemetry | 728b656c6cfaca7cc1f2dd418372d210219a49e8 | [
"Apache-2.0"
] | 30 | 2021-01-12T07:42:00.000Z | 2022-03-02T05:18:58.000Z | tests/unittests/CompliantByDefaultEventFilterModuleTests.cpp | lalitb/cpp_client_telemetry | 728b656c6cfaca7cc1f2dd418372d210219a49e8 | [
"Apache-2.0"
] | 173 | 2021-01-06T22:44:50.000Z | 2022-03-30T11:20:53.000Z | tests/unittests/CompliantByDefaultEventFilterModuleTests.cpp | lalitb/cpp_client_telemetry | 728b656c6cfaca7cc1f2dd418372d210219a49e8 | [
"Apache-2.0"
] | 29 | 2021-01-25T10:10:16.000Z | 2022-02-21T12:35:16.000Z | //
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
#include "common/Common.hpp"
#include "common/MockILogManagerInternal.hpp"
#include "modules/filter/CompliantByDefaultEventFilterModule.hpp"
using namespace MAT;
using namespace testing;
class CompliantByDefaultEventFilterModuleTests : public CompliantByDefaultEventFilterModule, public ::testing::Test
{
public:
CompliantByDefaultEventFilterModuleTests() noexcept
: m_logManager(m_logConfiguration, static_cast<bool>(nullptr)) { }
ILogConfiguration m_logConfiguration;
LogManagerImpl m_logManager;
using CompliantByDefaultEventFilterModule::m_parent;
using CompliantByDefaultEventFilterModule::m_allowedLevels;
virtual void SetUp() override
{
Initialize(&m_logManager);
}
};
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_ParentValid_SetsParentMember)
{
ASSERT_EQ(&m_logManager, m_parent);
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_AllowedLevelsSizeOne)
{
ASSERT_EQ(m_allowedLevels.GetSize(), size_t { 1 });
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_AllowedLevelValueIsRequired)
{
ASSERT_TRUE(m_allowedLevels.IsLevelInCollection(DIAG_LEVEL_REQUIRED));
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_HooksIsNotNullptr)
{
ASSERT_TRUE(m_hooks != nullptr);
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_HooksSizeSet)
{
#ifdef HAVE_MAT_DEFAULT_FILTER
constexpr const size_t expected = 2; // This, and the default filter initialized by LogManager.
#else
constexpr const size_t expected = 1; // Just this hook.
#endif // HAVE_MAT_DEFAULT_FILTER
ASSERT_EQ(m_hooks->GetSize(), expected);
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Initialize_ThisPointerIsInHooksCollection)
{
ASSERT_TRUE(m_hooks->IsModuleInCollection(this));
}
TEST_F(CompliantByDefaultEventFilterModuleTests, UpdateAllowedLevels_UpdatesSetOfAllowedLevels)
{
UpdateAllowedLevels({ DIAG_LEVEL_OPTIONAL });
ASSERT_TRUE(m_allowedLevels.IsLevelInCollection(DIAG_LEVEL_OPTIONAL));
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Teardown_HooksIsNullptr)
{
Teardown();
ASSERT_EQ(m_hooks, nullptr);
}
TEST_F(CompliantByDefaultEventFilterModuleTests, Teardown_ParentIsNullptr)
{
Teardown();
ASSERT_EQ(m_parent, nullptr);
}
| 28.535714 | 115 | 0.804339 | lalitb |
3ce7ed4adf5a2f71aad64ff2b4cfd04321b8d76a | 976 | hpp | C++ | include/afsm/detail/event_identity.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 133 | 2016-11-20T18:23:09.000Z | 2022-03-28T07:25:04.000Z | include/afsm/detail/event_identity.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 24 | 2016-11-14T17:13:50.000Z | 2021-08-31T15:48:48.000Z | include/afsm/detail/event_identity.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 24 | 2019-02-06T22:13:42.000Z | 2022-01-20T05:42:52.000Z | /*
* event_identity.hpp
*
* Created on: Dec 20, 2016
* Author: zmij
*/
#ifndef AFSM_DETAIL_EVENT_IDENTITY_HPP_
#define AFSM_DETAIL_EVENT_IDENTITY_HPP_
#include <type_traits>
#include <set>
#include <pushkin/meta/type_tuple.hpp>
namespace afsm {
namespace detail {
struct event_base {
struct id_type {};
};
template < typename T >
struct event : event_base {
static constexpr id_type id{};
};
template < typename T >
constexpr event_base::id_type event<T>::id;
template < typename T >
struct event_identity {
using event_type = typename ::std::decay<T>::type;
using type = event<event_type>;
};
using event_set = ::std::set< event_base::id_type const* >;
template < typename ... T >
event_set
make_event_set( ::psst::meta::type_tuple<T...> const& )
{
return event_set{
&event_identity<T>::type::id...
};
}
} /* namespace detail */
} /* namespace afsm */
#endif /* AFSM_DETAIL_EVENT_IDENTITY_HPP_ */
| 18.415094 | 67 | 0.667008 | galek |
3ce88288f981e822d7dc3a960bbfa493615d0028 | 9,954 | cpp | C++ | DoorMotor_GarageDoor.cpp | james-prior/chicken-coop | a9b49c391e94c2a42c18bd4e6dfe0aada8107638 | [
"Unlicense"
] | null | null | null | DoorMotor_GarageDoor.cpp | james-prior/chicken-coop | a9b49c391e94c2a42c18bd4e6dfe0aada8107638 | [
"Unlicense"
] | null | null | null | DoorMotor_GarageDoor.cpp | james-prior/chicken-coop | a9b49c391e94c2a42c18bd4e6dfe0aada8107638 | [
"Unlicense"
] | null | null | null | ////////////////////////////////////////////////////////////
// Door Motor - Open / close coop door by cycling a relay
////////////////////////////////////////////////////////////
#include <Arduino.h>
#include <GPSParser.h>
#include <SaveController.h>
#include "ICommInterface.h"
#include "TelemetryTags.h"
#include "Telemetry.h"
#include "MilliTimer.h"
#include "Pins.h"
#include "SunCalc.h"
#include "DoorController.h"
#include "LightController.h"
#include "BeepController.h"
#include "GaryCooper.h"
#include "DoorMotor_GarageDoor.h"
typedef enum
{
doorSwitchOpen = 1 << 0,
doorSwitchClosed = 1 << 1,
} doorSwitchMaskE;
////////////////////////////////////////////////////////////
// Implementation of a chicken coop door controller that
// treats the door as a garage door style system with a
// button to open / close the door. This is broken out
// of the door controller so that other types of door
// motor (such as stepper motors) can be used with minimal
// change to the other software, especially the CDoorController class.
////////////////////////////////////////////////////////////
IDoorMotor *getDoorMotor()
{
static CDoorMotor_GarageDoor s_doorMotor;
return &s_doorMotor;
}
CDoorMotor_GarageDoor::CDoorMotor_GarageDoor()
{
m_seekingKnownState = true;
m_state = doorState_unknown;
m_lastCommand = (doorCommandE) - 1;
}
CDoorMotor_GarageDoor::~CDoorMotor_GarageDoor()
{
}
void CDoorMotor_GarageDoor::setup()
{
// Setup the door relay
pinMode(PIN_DOOR_RELAY, OUTPUT);
digitalWrite(PIN_DOOR_RELAY, RELAY_OFF);
// Setup the door position switch sensor inputs
pinMode(PIN_DOOR_OPEN_SWITCH, INPUT_PULLUP);
pinMode(PIN_DOOR_CLOSED_SWITCH, INPUT_PULLUP);
}
telemetrycommandResponseE CDoorMotor_GarageDoor::command(doorCommandE _command)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.print(F("CDoorMotor_GarageDoor - command door: "));
DEBUG_SERIAL.println((_command == doorCommand_open) ? F("open.") :
(_command == doorCommand_close) ? F("close.") :
F("*** INVALID ***"));
#endif
if((_command != doorCommand_open) && (_command != doorCommand_close))
return telemetry_cmd_response_nak_invalid_value;
// Very special case at startup when coop door should be open
if(m_seekingKnownState)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - received command while seeking known state. Command delayed."));
#endif
m_lastCommand = _command;
return telemetry_cmd_response_ack;
}
// Only accept commands when I am in a stable state
if((m_state != doorState_closed) && (m_state != doorState_open))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - commmand() info:"));
#endif
return telemetry_cmd_response_nak_not_ready;
}
// Well, act on the command
if( ((m_state == doorState_closed) && (_command == doorCommand_open)) ||
((m_state == doorState_open) && (_command == doorCommand_close)))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - cycling relay."));
#endif
// Remember my last valid command
m_lastCommand = _command;
// Start the relay on timer
m_relayTimer.start(CDoorMotor_GarageDoor_relayMS);
digitalWrite(PIN_DOOR_RELAY, RELAY_ON);
// Set door state to moving and start the stuck timer
m_state = doorState_moving;
m_stuckDoorTimer.start(CDoorMotor_GarageDoor_stuck_door_delayMS);
return telemetry_cmd_response_ack;
}
else
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - not commanded to opposite state, ignoring."));
#endif
return telemetry_cmd_response_ack;
}
return telemetry_cmd_response_nak_internal_error;
}
doorStateE CDoorMotor_GarageDoor::getDoorState()
{
if(uglySwitches())
return doorState_unknown;
return m_state;
}
void CDoorMotor_GarageDoor::tick()
{
// Don't do anything if the switches are in an ugly state
if(uglySwitches())
{
digitalWrite(PIN_DOOR_RELAY, RELAY_OFF);
return;
}
// Monitor the relay and turn it off
// when the timer hits zero
// First "running" test returns to keep the door switch debounce
// logic from messing with the relay timing
if(m_relayTimer.getState() == CMilliTimer::running)
return;
if(m_relayTimer.getState() == CMilliTimer::expired)
{
m_relayTimer.reset();
digitalWrite(PIN_DOOR_RELAY, RELAY_OFF);
}
///////////////////////////////////////////////////////////////////////
// If I have not checked my initial state then do it now.
if(m_seekingKnownState)
{
// I just started. This is my first tick. If I don't know
// where the door is then toggle the relay to get it to
// go somewhere!
if((getSwitches() == 0) && (m_seekKnownStateRelayCommandIssued == false))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - Started in unknown state, seeking a switch."));
#endif
// Start the relay on timer
m_relayTimer.start( CDoorMotor_GarageDoor_relayMS);
digitalWrite(PIN_DOOR_RELAY, RELAY_ON);
// And a delay to see if we ever get there
m_state = doorState_unknown;
m_stuckDoorTimer.start(CDoorMotor_GarageDoor_stuck_door_delayMS);
m_seekKnownStateRelayCommandIssued = true;
}
// I'm waiting for a known state - good or bad.
if(getSwitches() == doorSwitchOpen)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - found open-switch, now in known state."));
#endif
m_state = doorState_open;
m_seekingKnownState = false;
m_stuckDoorTimer.reset();
}
else if(getSwitches() == doorSwitchClosed)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - found closed-switch, now in known state."));
#endif
m_state = doorState_closed;
m_seekingKnownState = false;
m_stuckDoorTimer.reset();
}
else if(m_stuckDoorTimer.getState() == CMilliTimer::expired)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - time is up, entering unknown state."));
#endif
m_state = doorState_unknown;
m_seekingKnownState = false;
m_stuckDoorTimer.reset();
}
return;
}
///////////////////////////////////////////////////////////////////////
// We have passed the m_seekingKnownState startup phase. This is normal
// operation
switch(m_state)
{
case doorState_moving:
if((m_lastCommand == doorCommand_open) && (getSwitches() == doorSwitchOpen))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - reached command state: open"));
#endif
m_state = doorState_open;
m_stuckDoorTimer.reset();
}
else if((m_lastCommand == doorCommand_close) && (getSwitches() == doorSwitchClosed))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - reached command state: closed"));
#endif
m_state = doorState_closed;
m_stuckDoorTimer.reset();
}
else if(m_stuckDoorTimer.getState() == CMilliTimer::expired)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - *** Timed out waiting for commanded state. ***"));
#endif
m_state = doorState_unknown;
m_stuckDoorTimer.reset();
}
return;
case doorState_open:
// Closed from the open state
if((m_state == doorState_open) && (getSwitches() == doorSwitchClosed))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - spontaneous change to: closed"));
#endif
m_state = doorState_closed;
}
break;
case doorState_closed:
// Open from the closed state
if((m_state == doorState_closed) && (getSwitches() == doorSwitchOpen))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - spontaneous change to: open"));
#endif
m_state = doorState_open;
}
break;
case doorState_unknown:
if(getSwitches() == doorSwitchOpen)
m_state = doorState_open;
if(getSwitches() == doorSwitchClosed)
m_state = doorState_closed;
break;
default:
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - *** UNKNOWN STATE VALUE ***"));
#endif
return;
}
////////////////////////////////////////////
// We are not moving, so we should be in the open or closed state.
// Now we monitor for spontaneous changes in the door switches
// Loss of door switches
if(getSwitches() == 0)
{
// The switches went to 0. Someone might be out there
// opening the door, so wait until we know for sure.
if(m_lostSwitchesTimer.getState() == CMilliTimer::notSet)
{
m_lostSwitchesTimer.start(CDoorMotor_GarageDoor_stuck_door_delayMS);
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - both door switches open. Is the door moving?"));
#endif
}
else if(m_lostSwitchesTimer.getState() == CMilliTimer::expired)
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - spontaneous change to: * UNKNOWN *"));
#endif
m_lostSwitchesTimer.reset();
m_state = doorState_unknown;
}
}
else
{
#ifdef DEBUG_DOOR_MOTOR
if(m_lostSwitchesTimer.getState() == CMilliTimer::running)
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - switches recovered before timeout to unknown state."));
#endif
m_lostSwitchesTimer.reset();
}
}
static unsigned int rawSwitchRead()
{
unsigned int mask = 0;
// NOTE, Inputs are active LOW, so a zero means that
// the switch is closed and the door is in that position
if(digitalRead(PIN_DOOR_OPEN_SWITCH) == 0)
mask |= doorSwitchOpen;
if(digitalRead(PIN_DOOR_CLOSED_SWITCH) == 0)
mask |= doorSwitchClosed;
return mask;
}
unsigned int CDoorMotor_GarageDoor::getSwitches()
{
unsigned int mask1 = 0;
unsigned int mask2 = 0;
// Make sure the switches are not bouncing
// and producing false readings.
do
{
mask1 = rawSwitchRead();
delay(2);
mask2 = rawSwitchRead();
delay(2);
}
while(mask1 != mask2);
return mask2;
}
bool CDoorMotor_GarageDoor::uglySwitches()
{
if((getSwitches() & doorSwitchOpen) && (getSwitches() & doorSwitchClosed))
{
#ifdef DEBUG_DOOR_MOTOR
DEBUG_SERIAL.println(F("CDoorMotor_GarageDoor - *** Ugly switches ***"));
#endif
return true;
}
return false;
}
| 26.97561 | 114 | 0.705947 | james-prior |
3ce8c3614b5df8bcaf7ea8c3aa5a8cf339ae9d6a | 6,873 | cxx | C++ | src/lib/SceMi/tlmxactors/ValidRequest.cxx | GaloisInc/BESSPIN-BSC | 21a0a8cba9e643ef5afcb87eac164cc33ea83e94 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2022-02-11T01:52:42.000Z | 2022-02-11T01:52:42.000Z | src/lib/SceMi/tlmxactors/ValidRequest.cxx | GaloisInc/BESSPIN-BSC | 21a0a8cba9e643ef5afcb87eac164cc33ea83e94 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | src/lib/SceMi/tlmxactors/ValidRequest.cxx | GaloisInc/BESSPIN-BSC | 21a0a8cba9e643ef5afcb87eac164cc33ea83e94 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | #include "ValidRequest.h"
#include "dllexport.h"
using TLMUtilities::E_XactorType ;
template<unsigned A, unsigned D, unsigned U>
unsigned ValidRequest<A,D,U>::isValid (TLMUtilities::E_XactorType xtype
, const TLMRequest<A,D,U> &req
, TLMUtilities::ErrorList_t &errs) {
ValidRequest<A,D,U> checker( xtype, req, errs);
return checker.errCount();
}
template<unsigned A, unsigned D, unsigned U>
ValidRequest<A,D,U>::ValidRequest ( TLMUtilities::E_XactorType xtype
, const TLMRequest<A,D,U> &req
, TLMUtilities::ErrorList_t &errs)
: m_type(xtype)
, m_request(req)
, m_errors(errs)
, m_errCnt(0)
{
check();
}
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::check() {
checkLock();
switch (m_type) {
case TLMUtilities::e_UNKNOWN: break;
case TLMUtilities::e_AHB: checkAhb(); break;
case TLMUtilities::e_APB: checkApb(); break;
case TLMUtilities::e_AXI3: checkAxi3(); break;
case TLMUtilities::e_AXI4: checkAxi4(); break;
}
}
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkAddressAligned() {
unsigned zeros = TLMUtilities::lsbZeros (m_request.m_header.m_b_size);
long long addr = (long long) m_request.m_address;
long long mask = ~((-1LL) << zeros);
if ((mask & addr) != 0) {
errorAddressAlignment();
}
}
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkBurstCross(unsigned boundary) {
long long baseAddr = (long long) m_request.m_address;
// only incr burst can cross boundary
if (m_request.m_header.m_burst_mode == TLMBurstMode::e_INCR) {
unsigned bursts = (unsigned) m_request.m_b_length ;
unsigned a_incr = TLMUtilities::addrIncr (m_request.m_header.m_b_size) * bursts ;
long long topAddr = baseAddr + (long long) a_incr ;
long long mask = (boundary - 1);
if ((baseAddr & ~mask) != (topAddr & ~mask)) {
errorBurstCrossing (boundary);
}
}
}
/// \brief Check that burst lenght is valid. wrap must be a power of 2 (-1)
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkBurstLenght() {
if (m_request.m_header.m_burst_mode == TLMBurstMode::e_WRAP) {
unsigned blen = (unsigned) m_request.m_b_length;
if (!isPowerOfTwo (blen)) {
errorBurstLength();
}
}
}
/// \brief Check that that exclusive access restrictions are met for AXI transactions
///
/// Address must be aligned withe total byte transfered
/// number of byte must be power of 2 upto 128
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkExclusizeAccessRestrictions( ){
bool ok = true;
if (m_request.m_header.m_lock == TLMLock::e_EXCLUSIVE) {
unsigned blen = (unsigned) m_request.m_b_length;
unsigned oneXferBytes = TLMUtilities::addrIncr (m_request.m_header.m_b_size);
unsigned totalBytes = blen * oneXferBytes;
if ( !isPowerOfTwo (totalBytes) ) {
errorExclusiveSize(totalBytes);
ok = false;
}
if ((totalBytes > 128) ) {
errorExclusiveTooBig(totalBytes);
ok = false;
}
if (ok) {
// This will error if the above condition is false
unsigned zeros = TLMUtilities::lsbZeros(TLMUtilities::getBSize(totalBytes*8));
long long addr = (long long) m_request.m_address;
long long mask = ~((-1LL) << zeros);
if ((mask & addr) != 0) {
errorExclusiveUnaligned(totalBytes);
}
}
}
}
/// \brief Check that the lock field is supported for the xtype
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkLock() {
bool err = false;
switch (m_type) {
case TLMUtilities::e_UNKNOWN:
break;
case TLMUtilities::e_AHB:
err = (m_request.m_header.m_lock != TLMLock::e_NORMAL);
break;
case TLMUtilities::e_APB:
err = (m_request.m_header.m_lock != TLMLock::e_NORMAL);
break;
case TLMUtilities::e_AXI3:
err = (m_request.m_header.m_lock == TLMLock::e_RESERVED);
break;
case TLMUtilities::e_AXI4:
err = ( (m_request.m_header.m_lock != TLMLock::e_NORMAL) &&
(m_request.m_header.m_lock != TLMLock::e_EXCLUSIVE) ) ;
break;
}
if (err) {
errorWrongLockMode ();
}
}
template<unsigned A, unsigned D, unsigned U>
void ValidRequest<A,D,U>::checkBurstSize(unsigned maxb) {
unsigned bursts = (unsigned) m_request.m_b_length ;
if (bursts > maxb) {
errorBurstSize(maxb);
}
}
template class DLLEXPORT ValidRequest<32,8,0>;
template class DLLEXPORT ValidRequest<32,16,0>;
template class DLLEXPORT ValidRequest<32,32,0>;
template class DLLEXPORT ValidRequest<32,64,0>;
template class DLLEXPORT ValidRequest<32,128,0>;
template class DLLEXPORT ValidRequest<32,256,0>;
template class DLLEXPORT ValidRequest<32,512,0>;
template class DLLEXPORT ValidRequest<32,1024,0>;
template class DLLEXPORT ValidRequest<64,8,0>;
template class DLLEXPORT ValidRequest<64,16,0>;
template class DLLEXPORT ValidRequest<64,32,0>;
template class DLLEXPORT ValidRequest<64,64,0>;
template class DLLEXPORT ValidRequest<64,128,0>;
template class DLLEXPORT ValidRequest<64,256,0>;
template class DLLEXPORT ValidRequest<64,512,0>;
template class DLLEXPORT ValidRequest<64,1024,0>;
template class DLLEXPORT ValidRequest<32,8,32>;
template class DLLEXPORT ValidRequest<32,16,32>;
template class DLLEXPORT ValidRequest<32,32,32>;
template class DLLEXPORT ValidRequest<32,64,32>;
template class DLLEXPORT ValidRequest<32,128,32>;
template class DLLEXPORT ValidRequest<32,256,32>;
template class DLLEXPORT ValidRequest<32,512,32>;
template class DLLEXPORT ValidRequest<32,1024,32>;
template class DLLEXPORT ValidRequest<64,8,32>;
template class DLLEXPORT ValidRequest<64,16,32>;
template class DLLEXPORT ValidRequest<64,32,32>;
template class DLLEXPORT ValidRequest<64,64,32>;
template class DLLEXPORT ValidRequest<64,128,32>;
template class DLLEXPORT ValidRequest<64,256,32>;
template class DLLEXPORT ValidRequest<64,512,32>;
template class DLLEXPORT ValidRequest<64,1024,32>;
template class DLLEXPORT ValidRequest<32,8,64>;
template class DLLEXPORT ValidRequest<32,16,64>;
template class DLLEXPORT ValidRequest<32,32,64>;
template class DLLEXPORT ValidRequest<32,64,64>;
template class DLLEXPORT ValidRequest<32,128,64>;
template class DLLEXPORT ValidRequest<32,256,64>;
template class DLLEXPORT ValidRequest<32,512,64>;
template class DLLEXPORT ValidRequest<32,1024,64>;
template class DLLEXPORT ValidRequest<64,8,64>;
template class DLLEXPORT ValidRequest<64,16,64>;
template class DLLEXPORT ValidRequest<64,32,64>;
template class DLLEXPORT ValidRequest<64,64,64>;
template class DLLEXPORT ValidRequest<64,128,64>;
template class DLLEXPORT ValidRequest<64,256,64>;
template class DLLEXPORT ValidRequest<64,512,64>;
template class DLLEXPORT ValidRequest<64,1024,64>;
| 33.526829 | 85 | 0.714244 | GaloisInc |
3cea3a42e1f668bfaee9d5f603c2c8b4ad171a4c | 24,260 | cpp | C++ | src/Application/JavascriptModule/qscript_Circle.cpp | Joosua/tundra | c170c597d9af73a5ef08ea8ef4566665addc6664 | [
"Apache-2.0"
] | 31 | 2015-01-12T15:20:29.000Z | 2022-02-03T10:04:17.000Z | src/Application/JavascriptModule/qscript_Circle.cpp | Joosua/tundra | c170c597d9af73a5ef08ea8ef4566665addc6664 | [
"Apache-2.0"
] | 2 | 2015-02-04T12:58:05.000Z | 2016-01-04T15:46:48.000Z | src/Application/JavascriptModule/qscript_Circle.cpp | Joosua/tundra | c170c597d9af73a5ef08ea8ef4566665addc6664 | [
"Apache-2.0"
] | 20 | 2015-03-04T02:31:33.000Z | 2022-02-13T18:12:55.000Z | #include "QtScriptBindingsHelpers.h"
void ToExistingScriptValue_Circle(QScriptEngine *engine, const Circle &value, QScriptValue obj)
{
obj.setProperty("pos", qScriptValueFromValue(engine, value.pos), QScriptValue::Undeletable);
obj.setProperty("normal", qScriptValueFromValue(engine, value.normal), QScriptValue::Undeletable);
obj.setProperty("r", qScriptValueFromValue(engine, value.r), QScriptValue::Undeletable);
}
static QScriptValue Circle_Circle(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_Circle in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle ret;
memset(&ret, 0, sizeof ret);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_Circle_float3_float3_float(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 3) { printf("Error! Invalid number of arguments passed to function Circle_Circle_float3_float3_float in file %s, line %d!\nExpected 3, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
float3 center = qscriptvalue_cast<float3>(context->argument(0));
float3 normal = qscriptvalue_cast<float3>(context->argument(1));
float radius = qscriptvalue_cast<float>(context->argument(2));
Circle ret(center, normal, radius);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_BasisU_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_BasisU_const in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 ret = This.BasisU();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_BasisV_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_BasisV_const in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 ret = This.BasisV();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_GetPoint_float_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_GetPoint_float_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float angleRadians = qscriptvalue_cast<float>(context->argument(0));
float3 ret = This.GetPoint(angleRadians);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_GetPoint_float_float_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 2) { printf("Error! Invalid number of arguments passed to function Circle_GetPoint_float_float_const in file %s, line %d!\nExpected 2, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float angleRadians = qscriptvalue_cast<float>(context->argument(0));
float d = qscriptvalue_cast<float>(context->argument(1));
float3 ret = This.GetPoint(angleRadians, d);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_CenterPoint_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_CenterPoint_const in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 ret = This.CenterPoint();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_Centroid_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_Centroid_const in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 ret = This.Centroid();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_ExtremePoint_float3_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_ExtremePoint_float3_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 direction = qscriptvalue_cast<float3>(context->argument(0));
float3 ret = This.ExtremePoint(direction);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_ContainingPlane_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 0) { printf("Error! Invalid number of arguments passed to function Circle_ContainingPlane_const in file %s, line %d!\nExpected 0, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
Plane ret = This.ContainingPlane();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_Translate_float3(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Translate_float3 in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 offset = qscriptvalue_cast<float3>(context->argument(0));
This.Translate(offset);
ToExistingScriptValue_Circle(engine, This, context->thisObject());
return QScriptValue();
}
static QScriptValue Circle_Transform_float3x3(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Transform_float3x3 in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3x3 transform = qscriptvalue_cast<float3x3>(context->argument(0));
This.Transform(transform);
ToExistingScriptValue_Circle(engine, This, context->thisObject());
return QScriptValue();
}
static QScriptValue Circle_Transform_float3x4(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Transform_float3x4 in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3x4 transform = qscriptvalue_cast<float3x4>(context->argument(0));
This.Transform(transform);
ToExistingScriptValue_Circle(engine, This, context->thisObject());
return QScriptValue();
}
static QScriptValue Circle_Transform_float4x4(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Transform_float4x4 in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float4x4 transform = qscriptvalue_cast<float4x4>(context->argument(0));
This.Transform(transform);
ToExistingScriptValue_Circle(engine, This, context->thisObject());
return QScriptValue();
}
static QScriptValue Circle_Transform_Quat(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Transform_Quat in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
Quat transform = qscriptvalue_cast<Quat>(context->argument(0));
This.Transform(transform);
ToExistingScriptValue_Circle(engine, This, context->thisObject());
return QScriptValue();
}
static QScriptValue Circle_EdgeContains_float3_float_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 2) { printf("Error! Invalid number of arguments passed to function Circle_EdgeContains_float3_float_const in file %s, line %d!\nExpected 2, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 point = qscriptvalue_cast<float3>(context->argument(0));
float maxDistance = qscriptvalue_cast<float>(context->argument(1));
bool ret = This.EdgeContains(point, maxDistance);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_DistanceToEdge_float3_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_DistanceToEdge_float3_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 point = qscriptvalue_cast<float3>(context->argument(0));
float ret = This.DistanceToEdge(point);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_DistanceToDisc_float3_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_DistanceToDisc_float3_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 point = qscriptvalue_cast<float3>(context->argument(0));
float ret = This.DistanceToDisc(point);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_ClosestPointToEdge_float3_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_ClosestPointToEdge_float3_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 point = qscriptvalue_cast<float3>(context->argument(0));
float3 ret = This.ClosestPointToEdge(point);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_ClosestPointToDisc_float3_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_ClosestPointToDisc_float3_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
float3 point = qscriptvalue_cast<float3>(context->argument(0));
float3 ret = This.ClosestPointToDisc(point);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_Intersects_Plane_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_Intersects_Plane_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
Plane plane = qscriptvalue_cast<Plane>(context->argument(0));
int ret = This.Intersects(plane);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_IntersectsDisc_Line_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_IntersectsDisc_Line_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
Line line = qscriptvalue_cast<Line>(context->argument(0));
bool ret = This.IntersectsDisc(line);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_IntersectsDisc_LineSegment_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_IntersectsDisc_LineSegment_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
LineSegment lineSegment = qscriptvalue_cast<LineSegment>(context->argument(0));
bool ret = This.IntersectsDisc(lineSegment);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_IntersectsDisc_Ray_const(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_IntersectsDisc_Ray_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
Ray ray = qscriptvalue_cast<Ray>(context->argument(0));
bool ret = This.IntersectsDisc(ray);
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_toString_const(QScriptContext *context, QScriptEngine *engine)
{
Circle This;
if (context->argumentCount() > 0) This = qscriptvalue_cast<Circle>(context->argument(0)); // Qt oddity (bug?): Sometimes the built-in toString() function doesn't give us this from thisObject, but as the first argument.
else This = qscriptvalue_cast<Circle>(context->thisObject());
QString ret = This.toString();
return qScriptValueFromValue(engine, ret);
}
static QScriptValue Circle_IntersectsFaces_manual(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() != 1) { printf("Error! Invalid number of arguments passed to function Circle_IntersectsDisc_Ray_const in file %s, line %d!\nExpected 1, but got %d!\n", __FILE__, __LINE__, context->argumentCount()); PrintCallStack(context->backtrace()); return QScriptValue(); }
Circle This = qscriptvalue_cast<Circle>(context->thisObject());
OBB obb = qscriptvalue_cast<OBB>(context->argument(0));
std::vector<float3> ret = This.IntersectsFaces(obb);
QScriptValue retObj = engine->newArray((uint)ret.size());
for(size_t i = 0; i < ret.size(); ++i)
retObj.setProperty((quint32)i, qScriptValueFromValue(engine, ret[i]));
return retObj;
}
static QScriptValue Circle_ctor(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() == 0)
return Circle_Circle(context, engine);
if (context->argumentCount() == 3 && QSVIsOfType<float3>(context->argument(0)) && QSVIsOfType<float3>(context->argument(1)) && QSVIsOfType<float>(context->argument(2)))
return Circle_Circle_float3_float3_float(context, engine);
printf("Circle_ctor failed to choose the right function to call! Did you use 'var x = Circle();' instead of 'var x = new Circle();'?\n"); PrintCallStack(context->backtrace()); return QScriptValue();
}
static QScriptValue Circle_GetPoint_selector(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() == 1 && QSVIsOfType<float>(context->argument(0)))
return Circle_GetPoint_float_const(context, engine);
if (context->argumentCount() == 2 && QSVIsOfType<float>(context->argument(0)) && QSVIsOfType<float>(context->argument(1)))
return Circle_GetPoint_float_float_const(context, engine);
printf("Circle_GetPoint_selector failed to choose the right function to call in file %s, line %d!\n", __FILE__, __LINE__); PrintCallStack(context->backtrace()); return QScriptValue();
}
static QScriptValue Circle_Transform_selector(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() == 1 && QSVIsOfType<float3x3>(context->argument(0)))
return Circle_Transform_float3x3(context, engine);
if (context->argumentCount() == 1 && QSVIsOfType<float3x4>(context->argument(0)))
return Circle_Transform_float3x4(context, engine);
if (context->argumentCount() == 1 && QSVIsOfType<float4x4>(context->argument(0)))
return Circle_Transform_float4x4(context, engine);
if (context->argumentCount() == 1 && QSVIsOfType<Quat>(context->argument(0)))
return Circle_Transform_Quat(context, engine);
printf("Circle_Transform_selector failed to choose the right function to call in file %s, line %d!\n", __FILE__, __LINE__); PrintCallStack(context->backtrace()); return QScriptValue();
}
static QScriptValue Circle_IntersectsDisc_selector(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() == 1 && QSVIsOfType<Line>(context->argument(0)))
return Circle_IntersectsDisc_Line_const(context, engine);
if (context->argumentCount() == 1 && QSVIsOfType<LineSegment>(context->argument(0)))
return Circle_IntersectsDisc_LineSegment_const(context, engine);
if (context->argumentCount() == 1 && QSVIsOfType<Ray>(context->argument(0)))
return Circle_IntersectsDisc_Ray_const(context, engine);
printf("Circle_IntersectsDisc_selector failed to choose the right function to call in file %s, line %d!\n", __FILE__, __LINE__); PrintCallStack(context->backtrace()); return QScriptValue();
}
void FromScriptValue_Circle(const QScriptValue &obj, Circle &value)
{
value.pos = qScriptValueToValue<float3>(obj.property("pos"));
value.normal = qScriptValueToValue<float3>(obj.property("normal"));
value.r = qScriptValueToValue<float>(obj.property("r"));
}
QScriptValue ToScriptValue_Circle(QScriptEngine *engine, const Circle &value)
{
QScriptValue obj = engine->newVariant(QVariant::fromValue(value)); // The contents of this variant are NOT used. The real data lies in the data() pointer of this QScriptValue. This only exists to enable overload resolution to work for QObject slots.
ToExistingScriptValue_Circle(engine, value, obj);
return obj;
}
QScriptValue ToScriptValue_const_Circle(QScriptEngine *engine, const Circle &value)
{
QScriptValue obj = engine->newVariant(QVariant::fromValue(value)); // The contents of this variant are NOT used. The real data lies in the data() pointer of this QScriptValue. This only exists to enable overload resolution to work for QObject slots.
obj.setPrototype(engine->defaultPrototype(qMetaTypeId<Circle>()));
obj.setProperty("pos", ToScriptValue_const_float3(engine, value.pos), QScriptValue::Undeletable | QScriptValue::ReadOnly);
obj.setProperty("normal", ToScriptValue_const_float3(engine, value.normal), QScriptValue::Undeletable | QScriptValue::ReadOnly);
obj.setProperty("r", qScriptValueFromValue(engine, value.r), QScriptValue::Undeletable | QScriptValue::ReadOnly);
return obj;
}
QScriptValue register_Circle_prototype(QScriptEngine *engine)
{
QScriptValue proto = engine->newObject();
proto.setProperty("BasisU", engine->newFunction(Circle_BasisU_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("BasisV", engine->newFunction(Circle_BasisV_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("GetPoint", engine->newFunction(Circle_GetPoint_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("GetPoint", engine->newFunction(Circle_GetPoint_selector, 2), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("CenterPoint", engine->newFunction(Circle_CenterPoint_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Centroid", engine->newFunction(Circle_Centroid_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ExtremePoint", engine->newFunction(Circle_ExtremePoint_float3_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ContainingPlane", engine->newFunction(Circle_ContainingPlane_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Translate", engine->newFunction(Circle_Translate_float3, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Transform", engine->newFunction(Circle_Transform_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("EdgeContains", engine->newFunction(Circle_EdgeContains_float3_float_const, 2), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("DistanceToEdge", engine->newFunction(Circle_DistanceToEdge_float3_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("DistanceToDisc", engine->newFunction(Circle_DistanceToDisc_float3_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ClosestPointToEdge", engine->newFunction(Circle_ClosestPointToEdge_float3_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ClosestPointToDisc", engine->newFunction(Circle_ClosestPointToDisc_float3_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Intersects", engine->newFunction(Circle_Intersects_Plane_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("IntersectsDisc", engine->newFunction(Circle_IntersectsDisc_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("toString", engine->newFunction(Circle_toString_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("IntersectsFaces", engine->newFunction(Circle_IntersectsFaces_manual, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("metaTypeId", engine->toScriptValue<qint32>((qint32)qMetaTypeId<Circle>()));
engine->setDefaultPrototype(qMetaTypeId<Circle>(), proto);
engine->setDefaultPrototype(qMetaTypeId<Circle*>(), proto);
qScriptRegisterMetaType(engine, ToScriptValue_Circle, FromScriptValue_Circle, proto);
QScriptValue ctor = engine->newFunction(Circle_ctor, proto, 3);
engine->globalObject().setProperty("Circle", ctor, QScriptValue::Undeletable | QScriptValue::ReadOnly);
return ctor;
}
| 69.712644 | 302 | 0.758739 | Joosua |