Skip to content

Instantly share code, notes, and snippets.

Tavian Barnes tavianator

Block or report user

Report or block tavianator

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tavianator
tavianator / README
Created Nov 1, 2016
NDK bug 176 reproducer
View README
Apologies for the gcc-based test case! But clang chokes on linking the same .s file, so I suspect it's not a gcc-specific bug.
$ arm-linux-androideabi-g++ -std=c++11 -fpic -O3 -flto -Ipath/to/boost -c foo.cpp
$ arm-linux-androideabi-g++ -shared foo.o -lc++_shared -o foo.so -save-temps
/tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a(pr-support.o): multiple definition of '__gnu_unwind_frame'
/tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/libunwind.a(Unwind-EHABI.o): previous definition here
/tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /tmp/ndk-arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a(pr-support.o): multiple definition of '_Unwind_GetRegionStart'
/tmp/ndk-arm/bin/../lib/gcc/
@tavianator
tavianator / ray_box.c
Last active Oct 30, 2019
Ray/bounding box intersection test program
View ray_box.c
/****************************************************************************
* Copyright (C) 2015 Tavian Barnes <tavianator@tavianator.com> *
* *
* Permission to use, copy, modify, and/or distribute this software for any *
* purpose with or without fee is hereby granted. *
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES *
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR *
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
View 0001-Don-t-trust-the-bytesConsumed-value-from-SSLEngine.u.patch
From ef19df89a9ee7be2d9c092bcc24cd80a79d35499 Mon Sep 17 00:00:00 2001
From: Tavian Barnes <tavianator@tavianator.com>
Date: Wed, 7 Jan 2015 16:32:51 -0500
Subject: [PATCH 1/1] Don't trust the bytesConsumed() value from
SSLEngine.unwrap().
Android 5.0 always returns 0 instead of the actual number of bytes.
Compute it from the byte buffer positions instead.
https://code.google.com/p/android/issues/detail?id=93740
@tavianator
tavianator / gist:65f8642a5b859d6cb181
Last active Aug 29, 2015
Output of gcc -std=c11 -O3 -fopt-info-all-vec -S slp-test.c
View gist:65f8642a5b859d6cb181
slp-test.c:8:17: note: ===vect_slp_analyze_bb===
slp-test.c:8:17: note: === vect_analyze_data_refs ===
slp-test.c:8:17: note: got vectype for stmt: _4 = x0_3(D)->z;
vector(2) double
slp-test.c:8:17: note: got vectype for stmt: _7 = n_6(D)->z;
vector(2) double
slp-test.c:8:17: note: got vectype for stmt: _9 = x0_3(D)->x;
vector(2) double
slp-test.c:8:17: note: got vectype for stmt: _10 = n_6(D)->x;
vector(2) double
View Example 17.5-1
class FinalFieldExample {
final int x;
int y;
static FinalFieldExample f;
public FinalFieldExample() {
x = 3;
y = 4;
}
You can’t perform that action at this time.