Skip to content

Instantly share code, notes, and snippets.

View Blei's full-sized avatar

Philipp Brüschweiler Blei

View GitHub Profile
@Blei
Blei / gist:2720163
Created May 17, 2012 16:53
i32 fail
target datalayout = "e-p:16:16:16-i8:16:16-i16:16:16-i32:16:16-s0:16:16-n16"
target triple = "dcpu16"
define void @storei32(i32* nocapture %a, i32 %b) nounwind {
entry:
store i32 %b, i32* %a, align 1, !tbaa !0
ret void
}
will be expanded to
@Blei
Blei / errout
Created September 17, 2012 12:41
Failing compilation
levenshtein-automata.rs:48:16: 48:34 error: multiple applicable methods in scope
levenshtein-automata.rs:48 for s.transitions.each() |c, t| {
^~~~~~~~~~~~~~~~~~
levenshtein-automata.rs:48:16: 48:34 error: multiple applicable methods in scope
levenshtein-automata.rs:48 for s.transitions.each() |c, t| {
^~~~~~~~~~~~~~~~~~
levenshtein-automata.rs:80:16: 80:34 error: multiple applicable methods in scope
levenshtein-automata.rs:80 for s.transitions.each() |c, t| {
^~~~~~~~~~~~~~~~~~
levenshtein-automata.rs:80:16: 80:34 error: multiple applicable methods in scope
impl CXCursor : IterBytes {
pure fn iter_bytes(lsb0: bool, f: Cb) {
iter_bytes_3(&self.kind, &self.xdata, &self.data, lsb0, f);
}
}
main.rs:37:4: 39:5 error: method `iter_bytes` has an incompatible type: expected argument mode ++, but found +
main.rs:37 pure fn iter_bytes(lsb0: bool, f: Cb) {
main.rs:38 iter_bytes_3(&self.kind, &self.xdata, &self.data, lsb0, f);
@Blei
Blei / gist:3854999
Created October 8, 2012 21:10
Incorrect visibility parsing of first function in extern block
// shouldn't parse but does
extern { pub pub fn foo(); }
// ignores visibility
extern { pub fn bar(); }
pub fn at_vec_remove(v: @[int], remove: int) -> @[int] {
do at_vec::build |f| {
for v.each() |e| {
if (*e != remove) {
f(*e);
}
}
}
}
enum FOO {
Foo(fn@())
}
fn bar() {
io::println("baz");
}
fn main() {
let f = Foo(bar);
@Blei
Blei / gist:3924261
Created October 20, 2012 18:21
No trait!
struct Thing {
x: int
}
impl Thing {
pure fn mul(c: &int) -> Thing {
Thing {x: self.x * *c}
}
}
extern mod std;
use option::{Option, Some, None};
macro_rules! offset_of(($T:ty, $field:ident) => (
unsafe {
let x: *$T = ptr::null();
ptr::to_uint(&(*x).$field)
}))
macro_rules! container_of(($p:expr, $T:ty, $field:ident) => (
@Blei
Blei / gist:5118802
Last active December 14, 2015 16:59
Fix sw rendering for wayland
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index a959237..2499677 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -163,7 +163,7 @@ wayland_shm_display_init_screen(struct native_display *ndpy)
return FALSE;
if (shmdpy->base.formats == 0)
- wayland_roundtrip(shmdpy->base.dpy);
+ wayland_roundtrip(&shmdpy->base);
@Blei
Blei / part 1
Last active December 14, 2015 18:19
From 995bc862ee398257ffd97d48d6d62fcd9107db2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Sun, 10 Mar 2013 14:12:49 +0100
Subject: [PATCH 1/2] compositor: remove unused field option_idle_time
---
src/compositor.c | 1 -
src/compositor.h | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)