消息类型码 | 含义 |
---|---|
UA1115 | A+H市场状态 |
UA1202 | 3 心跳消息(Heartbeat) |
UA2102 | A+H个股行情 |
UA2107 | A+H个股集合竞价 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <assert.h> | |
const char* code = "-1+2*3"; | |
const char* token = nullptr; | |
void init() { | |
token = code; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_bom() | |
{ | |
head -c3 "$1" | grep -qP '\xef\xbb\xbf'; | |
} | |
utf8bom() | |
{ | |
echo "convert " $1 | |
has_bom $1 | |
if [ $? -ne 1 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdint.h> | |
template<typename T> | |
inline void copy_byte(uint8_t* dst, uint8_t* src, size_t size ) { | |
T* sdst = (T*)dst; | |
T* ssrc = (T*)src; | |
size /= sizeof(T); | |
clock_t s = clock(); | |
while (size-- > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include <time.h> | |
#include <vector> | |
struct Item { | |
int a; | |
Item(int i): a(i) { | |
std::cout << "ctor" << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
/* | |
一个如下的内存分配方法,初始分配2^n条记录,然后按倍增的方式。 | |
当达到2^(n+m)时,改为每次分配2^(n+m)的方式进行。 | |
在这种分配方法下,给定记录编号,算出记录所属的内存块及其在内存块中的偏移。 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 2.8) | |
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |
project (QuantBox_XAPI) | |
set(CMAKE_CXX_FLAGS "-std=c++11") | |
include_directories(.) | |
include_directories(QuantBox_Queue) | |
#add_subdirectory(./) | |
set(QUEUE_SRC_LIST | |
QuantBox_Queue/readerwriterqueue.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, typename M> | |
T* container_of(M *m, const M T::*mp) { | |
static const T * null = reinterpret_cast<const T *>(null); | |
static const ptrdiff_t offset = reinterpret_cast<const ptrdiff_t>(&(null->*mp)); | |
return reinterpret_cast<T*>(reinterpret_cast<char*>(m) - offset); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Created by IntelliJ IDEA. | |
-- User: andi | |
-- Date: 14-4-27 | |
-- Time: 下午7:07 | |
-- To change this template use File | Settings | File Templates. | |
-- | |
local sqrt = require("math").sqrt | |
local re = require("re") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function repl() | |
local cmd, res, msg1, msg2 | |
-- R | |
io.write '>' | |
cmd = io.read() | |
if not cmd or #cmd == 0 then | |
return repl() | |
end | |
res, msg1 = loadstring(cmd, 'repl') | |
if not res then |
NewerOlder