■ C言語の標準関数のmemset, memcpyなどはメモリを直接コピーするので高速だ・・・とか小耳に挟んだことはないですか? 構造体を初期化する時などはmemset(hgoe,0,sizeof(hoge));などのようにして使われるのを見ることがあります。 ■ しかし、いくら高速とい... 続きを読む
evhttp_cmd_type { EVHTTP_REQ_GET, EVHTTP_REQ_POST, EVHTTP_REQ_HEAD } 続きを読む
C++STLのstringで,str="100 200 400"のような文字をスペースで切り分けて,a=100,b=200,c=400...のようにしたいことがある.この場合,str.split(" "); のようにすれば適当に切り分けてvectorにでも出力してくれるんじゃないかと思っていたのだけど,調べたと... 続きを読む
Cのポインタを整数に変換する Cのポインタを整数に変換したいときがあります。このとき問題になるのは、ポインタのサイズが int と同じとは限らないということです。たとえば、 x86_64 の 64ビットのバイナリでは sizeof(int) = 4, sizeof(void *) = 8 となりま... 続きを読む
Initial hash returns (A,B), final hash is A^tab[B] The perfect hash algorithm I use isn't a Pearson hash. My perfect hash algorithm uses an initial hash to find a pair (A,B) for each keyword, then it generates a mapping table tab[] so that A^... 続きを読む
Motivation A perfect hash function maps a static set of n keys into a set of m integer numbers without collisions, where m is greater than or equal to n. If m is equal to n, the function is called minimal. Minimal perfect hash functions are w... 続きを読む
C 言語によるオブジェクト記述法 COOL ver.2 C-language's Object Oriented Language ver.2 [検索] 目次 0. はじめに 1. クラスの記述, 属性の記述 2. 操作の記述 3. クラス属性の記述、定数の記述 4. 初期化操作と後始末操作の記述 4-1.処理効率優先インターフ... 続きを読む
MTK+ は BLAS/LAPACK をラップした C 言語用のライブラリです。 ガーベジコレクションに Boehm GC を用いて数式に近い記述を実現しています。 ライセンスは MIT License です(Boehm GC のライセンスはこちら)。 mtk+.tar.gz (version 0.0.1) 例1:主成分分... 続きを読む
バイト単位でコピーするアホなコードの方が、勝手にベクトル化される分、gcc 内蔵のヤツより最大3倍高速なんだってwwwmemcpy() compiled with vectorizing compilers All current compilers for linux should support SSE2 auto-vectorization with #include v... 続きを読む
Any C structure can be stored in a hash table using uthash. Just add a UT_hash_handle to the structure and choose one or more fields in your structure to act as the key. Then use these macros to store, retrieve or delete items from the hash t... 続きを読む
We’ve all been taught that when malloc returns 0, it means the machine ran out of memory. This case should be detected and "handled" by our application in some graceful manner. But what does "handled" mean here? How does an application recov... 続きを読む
ooc is an object-oriented programming language which is implemented with a source-to-source translator to pure C99. It supports classes, abstract functions, foreach, ranges, etc. It intends to be modern, modular, extensible, yet simple and fa... 続きを読む
STDARG Section: Linux Programmer's Manual (3) Updated: 2001-10-14 Index JM Home Page roff page 名前 stdarg, va_start, va_arg, va_end, va_copy - 個数・型が可変な引数リスト 書式 #include <stdarg.h> void va_start(va_list ap, last); type va_arg(v... 続きを読む
C言語によるPythonの拡張 C言語でPythonモジュールを作るには 実践Pythonモジュール作り (UNIX編) 実践Pythonモジュール作り (MS-Windows編) セクションのサブメニューに戻る (first uploaded 2000/08/26 last updated 2002/07/20) 続きを読む