Skip to content

Instantly share code, notes, and snippets.

View ttvd's full-sized avatar
:shipit:

Mykola Konyk ttvd

:shipit:
View GitHub Profile
@ttvd
ttvd / gist:318ac280cdc9969588e7
Created May 3, 2015 04:56
Elixir detect endianness
defp endianness() when <<1::integer-little-size(4)-unit(8)>> == <<1::integer-native-size(4)-unit(8)>>, do: :endianness_little
defp endianness(), do: :endianness_big

Keybase proof

I hereby claim:

  • I am ttvd on github.
  • I am ttvd (https://keybase.io/ttvd) on keybase.
  • I have a public key whose fingerprint is 6AAE 1296 BDE2 797F A278 A2FB F677 B63D E466 628A

To claim this, I am signing this object:

@ttvd
ttvd / untitled
Created January 19, 2015 04:00
gcc 4.4.4 Predefined Compiler Macros, 2.6.39.1 32 bit.
#define __DBL_MIN_EXP__ (-1021)
#define __pentiumpro__ 1
#define __FLT_MIN__ 1.17549435e-38F
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
@ttvd
ttvd / untitled
Created January 19, 2015 02:25
Predefined Clang Macros on OS X 10.10
#define OBJC_NEW_PROPERTIES 1
#define _LP64 1
#define __APPLE_CC__ 6000
#define __APPLE__ 1
#define __ATOMIC_ACQUIRE 2
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_CONSUME 1
#define __ATOMIC_RELAXED 0
#define __ATOMIC_RELEASE 3
#define __ATOMIC_SEQ_CST 5
@ttvd
ttvd / gist:6582569
Created September 16, 2013 15:55
Killzone 2 decision tree rendering
I hope I'm going to be able to describe what we do there - it's really no magic
involved - we just wanted something simple.
The decision tree is quite simple structure - leaf nodes are individual
drawparts (drawpart is a structure that contains vertex array, index array,
shader, matrices, constants... - the minimum data to render something without
any higher logic required) and non-leaf nodes pretty much contain
rules/conditions determining what child node to pick - since we don't want
to have any virtual calls there, we only have predefined set of conditions
such as LOD node (based on distance from camera), "switch" node
@ttvd
ttvd / gist:6201663
Created August 10, 2013 18:53
NV_gpu_program4 - Apple ARB compiler issue.
The <float> rule matches a floating-point constant consisting of an
integer part, a decimal point, a fraction part, an "e" or "E", and an
optionally signed integer exponent. The integer and fraction parts both
consist of a sequence of one or more digits ("0" through "9"). Either the
integer part or the fraction parts (not both) may be missing; either the
decimal point or the "e" (or "E") and the exponent (not both) may be
missing. Most grammar rules that allow floating-point values also allow
integers matching the <int> rule.
Apple ARB compiler will reject 1.E+05 even though this seems valid judging from above description?