I hereby claim:
- I am nico on github.
- I am thakis (https://keybase.io/thakis) on keybase.
- I have a public key whose fingerprint is 6CB0 90B6 D027 3BCF FD99 475D E98E DBFB D44D EE5C
To claim this, I am signing this object:
#include <algorithm> | |
#include <iostream> | |
#include <map> | |
#include <set> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
#include <direct.h> | |
#include <stdint.h> |
I hereby claim:
To claim this, I am signing this object:
let g:cr_root = '/Users/thakis/src/chrome-git/src/' | |
let g:cr_builddb = '/Users/thakis/src/chrome-git/src/all-builddb.sqlite' | |
fu! g:clang_per_file_user_options(path) | |
if a:path =~ g:cr_root | |
let l:path = a:path[strlen(g:cr_root):] | |
let l:cmd = 'sqlite3 ' . g:cr_builddb . | |
\' ''' . 'select command from gcc_build_commands join filenames ' . | |
\ 'on filename_input_id = filenames.rowid where name = "' . | |
\ l:path . |
// memchr / strchr benchmark | |
// clang -O2 -o chr_bench chr_bench.cc | |
// | |
// Includes a glibc memchr implementation for comparison, which makes this | |
// benchmark GPL-licensed I believe. | |
// Output on my system (OS X 10.7.3): | |
// stupid_memchr: 380.0us | |
// glibc_memchr: 105.0us | |
// memchr: 566.0us |
from Foundation import * | |
from AppKit import * | |
from Quartz import * | |
def mkimg(w, h): | |
img = NSImage.alloc().initWithSize_((w, h)) | |
return img | |
def saverep(rep, path): | |
rep.representationUsingType_properties_(NSPNGFileType, None) \ |
// uncompressed png, no dependencies | |
// from https://github.com/nico/hack/blob/master/wpng/wpng.c | |
void wpng(int w, int h, const uint8_t* pix, FILE* f) { // pix: rgba in memory | |
uint32_t crc_table[256]; | |
for (uint32_t n = 0, c = 0; n < 256; n++, c = n) { | |
for (int k = 0; k < 8; k++) c = (c & 1) ? 0xedb88320L ^ (c >> 1) : c >> 1; | |
crc_table[n] = c; | |
} | |
#define CRCWRITE(d, len) fwrite(d, 1, len, f); for (int n = 0; n < len; n++) \ | |
crc = crc_table[(crc ^ (d)[n]) & 0xff] ^ (crc >> 8) |
Nicos-MacBook-Pro:repro thakis$ cat repro.py | |
#!/usr/bin/env python | |
import ninja_syntax | |
n = ninja_syntax.Writer(open('build.ninja', 'w')) | |
n.rule(name='cxx', | |
command='clang++ -c $in -o $out -MF $out.d -MMD', | |
depfile='$out.d', |
diff --git a/tim.cc b/tim.cc | |
index 4d8200e..f6cfc19 100644 | |
--- a/tim.cc | |
+++ b/tim.cc | |
@@ -16,7 +16,11 @@ | |
#include <stdlib.h> | |
#include <windows.h> | |
+#include <psapi.h> // Must be after windows.h | |
+ |
Nicos-MacBook-Pro:hack thakis$ clang -o xmltest xmltest_libxml.cc -I$(xcrun -show-sdk-path)/usr/include/libxml2 -lxml2 && ./xmltest xmltest_in.xml | |
xmltest_in.xml:3: namespace warning : xmlns: URI foo is not absolute | |
<hi xmlns="foo" xmlns:x="bar"> | |
^ | |
1/XML_ELEMENT_NODE hi (null) | |
3/XML_TEXT_NODE text | |
1/XML_ELEMENT_NODE hi (null) ((null):foo XML_NAMESPACE_DECL) (x:bar XML_NAMESPACE_DECL) | |
def ns: ((null):foo XML_NAMESPACE_DECL) (x:bar XML_NAMESPACE_DECL) 3/XML_TEXT_NODE text | |
C:\src\hack>type xmltest_in.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<?xml-stylesheet href="common.css"?> | |
<hi> | |
<hi xmlns="http://example.com/foo-ns" xmlns:x="urn:example-com:bar-ns"> | |
<?foobar version="1.0"?> | |
<ho | |
/>text&more@<x:ho x:attr="adsf"/> | |
<!-- adsf --> | |
</hi> |