Skip to content

Instantly share code, notes, and snippets.

class functions {
public static function make_callback($function) {
if (is_array($function) || strpos($function,'::') === false) {
if (! is_callable($function)) {
if (tep_in_sandbox()) {
tep_die_deprecated("Called nonexistent function '$function' in functions::make_callback");
} else {
dusty_record_value("bad_function_calls", $function);
}
}
<?
namespace unicorns;
class module {
private $helper;
public function __get($name) {
if (!$this->helper) {
$this->helper = new PHPFuncHelper();
}
template<
typename GetterReturnType,
typename GetterThisType,
typename SetterArgumentType,
typename SetterThisType>
value_struct& field(
const char* fieldName,
GetterReturnType (*getter)(const GetterThisType&),
void (*setter)(SetterThisType&, SetterArgumentType)
) {
/*
* I am building a mechanism for selecting member function overloads without
* having to use C-style casts. It works today on non-member functions and
* non-const member functions. The syntax looks like:
*
* select_overload<int(int)>(&some_overloaded_function)
* select_overload<int(int)>(&some_overloaded_member_function)
*
* You can see the implementation of select_overload at http://pastie.org/7649267
*
/* To my understanding, the following is well-defined C:
*
* given: */
int* p;
// then:
char* c = (char*)p;
char firstByteAtP = *c;
// firstByteAtP is the first byte at the pointer p.
// thread 1
wglMakeCurrent
issue draw commands...
glFinish()
wglMakeCurrent(NULL, NULL)
// thread 2
wglMakeCurrent
SwapBuffers
wglMakeCurrent(NULL, NULL)
function __ZN4gmtl6MatrixIfLj4ELj4EEC2Ev(a) {
for(
var a = a >> 2,
b = 0
;
!(HEAPF32[(b << 2 >> 2) + a] = 0,
HEAPF32[(b + 4 << 2 >> 2) + a] = 0,
HEAPF32[(b + 8 << 2 >> 2) + a] = 0,
HEAPF32[(b + 12 << 2 >> 2) + a] = 0,
b = b + 1 | 0,
function __ZN4gmtl6MatrixIfLj4ELj4EEC2Ev(a) {
for(
var b = 0
;
!(HEAPF32[a + (b << 2) >> 2] = 0,
HEAPF32[a + (b + 4 << 2) >> 2] = 0,
HEAPF32[a + (b + 8 << 2) >> 2] = 0,
HEAPF32[a + (b + 12 << 2) >> 2] = 0,
b = b + 1 | 0,
!(4 > b >>> 0))
original=12, zlib=18 (1.50), delta+zlib=17 (1.42), highwatermark+zlib=16 (1.33) highwatermark+utf8+zlib=14 (1.17)
original=456, zlib=222 (0.49), delta+zlib=207 (0.45), highwatermark+zlib=166 (0.36) highwatermark+utf8+zlib=130 (0.29)
original=1560, zlib=831 (0.53), delta+zlib=170 (0.11), highwatermark+zlib=141 (0.09) highwatermark+utf8+zlib=115 (0.07)
original=4368, zlib=2279 (0.52), delta+zlib=616 (0.14), highwatermark+zlib=512 (0.12) highwatermark+utf8+zlib=391 (0.09)
original=2988, zlib=1577 (0.53), delta+zlib=491 (0.16), highwatermark+zlib=398 (0.13) highwatermark+utf8+zlib=304 (0.10)
original=576, zlib=286 (0.50), delta+zlib=212 (0.37), highwatermark+zlib=177 (0.31) highwatermark+utf8+zlib=135 (0.23)
original=1992, zlib=1112 (0.56), delta+zlib=474 (0.24), highwatermark+zlib=387 (0.19) highwatermark+utf8+zlib=315 (0.16)
original=576, zlib=293 (0.51), delta+zlib=229 (0.40), highwatermark+zlib=191 (0.33) highwatermark+utf8+zlib=149 (0.26)
original=192, zlib=101 (0.53), delta+zlib=97 (0.51), highwatermark+zli
original=16, zlib=21 (1.31), interleave+zlib=25 (1.56), quant10+zlib=13 (0.81), quant1+zlib=15 (0.94), quant1+delta+utf8+zlib=16 (1.00), quant1+delta+utf8+fse=9 (0.56)
original=212, zlib=171 (0.81), interleave+zlib=208 (0.98), quant10+zlib=51 (0.24), quant1+zlib=71 (0.33), quant1+delta+utf8+zlib=100 (0.47), quant1+delta+utf8+fse=92 (0.43)
original=1072, zlib=1023 (0.95), interleave+zlib=1032 (0.96), quant10+zlib=246 (0.23), quant1+zlib=380 (0.35), quant1+delta+utf8+zlib=461 (0.43), quant1+delta+utf8+fse=476 (0.44)
original=2096, zlib=1479 (0.71), interleave+zlib=1732 (0.83), quant10+zlib=470 (0.22), quant1+zlib=732 (0.35), quant1+delta+utf8+zlib=765 (0.36), quant1+delta+utf8+fse=811 (0.39)
original=1260, zlib=907 (0.72), interleave+zlib=1064 (0.84), quant10+zlib=287 (0.23), quant1+zlib=405 (0.32), quant1+delta+utf8+zlib=430 (0.34), quant1+delta+utf8+fse=430 (0.34)
original=312, zlib=176 (0.56), interleave+zlib=257 (0.82), quant10+zlib=78 (0.25), quant1+zlib=116 (0.37), quant1+delta+utf8+zlib=126 (0.40), quant