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 <stdio.h> | |
#include <inttypes.h> | |
static uint64_t pack754(long double f, uint8_t bits, uint8_t expbits) | |
{ | |
long double fnorm; | |
int shift; | |
uint64_t sign; | |
uint64_t exp; | |
uint64_t significand; |
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
--[[============================================================================= | |
# FileName: HXProtHandler.lua | |
# Desc: 单个消息多个处理函数带有优先级的实现 | |
# Author: hanxi | |
# Email: hanxi.com@gmail.com | |
# HomePage: http://hanxi.cnblogs.com | |
# Version: 0.0.1 | |
# LastChange: 2013-08-26 11:42:37 | |
# History: 添加优先级冲突检测 | |
=============================================================================]] |
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> | |
using namespace std; | |
class A { | |
public: | |
A() { | |
q=&A::funcA; | |
cout << "q=" << q << endl; | |
//(this ->* ((A*)this)->A::q) (); |
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
--[[ deepcopy.lua | |
Deep-copy function for Lua - v0.2 | |
============================== | |
- Does not overflow the stack. | |
- Maintains cyclic-references | |
- Copies metatables | |
- Maintains common upvalues between copied functions (for Lua 5.2 only) | |
TODO |
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 "lua.h" | |
#include "lauxlib.h" | |
#include <stdio.h> | |
int | |
dylib_add(lua_State* L) { | |
int a = lua_tonumber(L,1); | |
int b = lua_tonumber(L,2); | |
int c = a+b; |
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
static void PrintRefCnt(const char *s, PyObject *obj) | |
{ | |
printf("PrintRefCnt:%s.%ld\n", s, (long)(obj->ob_refcnt)); | |
} | |
static void DumpPyObject(const char *s, PyObject *obj) | |
{ | |
PyObject *str = PyObject_Str(obj); | |
printf("DumpPyObject:%s.%s\n", s, PyString_AsString(obj)); | |
Py_DECREF(str); |
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
local lru = {} | |
local lru_mt = { __index = lru } | |
local function addnode(self, node) | |
local head = self._head | |
node._next = head | |
if head then | |
head._pre = node | |
end | |
self._head = node |
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
ForegroundColour=248,248,242 | |
BackgroundColour=40,42,54 | |
Black=0,0,0 | |
BoldBlack=104,104,104 | |
Red=255,85,85 | |
BoldRed=255,110,103 | |
Green=80,250,123 | |
BoldGreen=90,247,142 | |
Yellow=241,250,140 | |
BoldYellow=244,249,157 |
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! SearchRoot() | |
let l:scm_list = ['.root', '.svn', '.git'] | |
for l:item in l:scm_list | |
let l:dirs = finddir(l:item, '.;', -1) | |
if !empty(l:dirs) | |
return fnamemodify(l:dirs[-1].'/../', ':p:h') | |
endif | |
endfor | |
return getcwd() | |
endfunction |