Skip to content

Instantly share code, notes, and snippets.

View alecazam's full-sized avatar

Alec Miller alecazam

  • Thatgamecompany
  • California
View GitHub Profile
@dalibor-drgon
dalibor-drgon / recip14.c
Created September 7, 2021 08:15
Reciprocal algorithms
/* Copyright (c) 2015, Intel Corporation Redistribution and use in source and
binary forms, with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors may
@meshula
meshula / 3d-formats.md
Last active March 30, 2022 18:45
3d file formats, last mile vs. interchange
@Ludophonic
Ludophonic / Half.py
Last active April 5, 2022 15:53
Xcode / LLDB script for formatting half-precision floats in the debugger.
import lldb
# FP16 summary
def summary_FP16( valobj, internal_dict ):
anon = valobj.GetChildAtIndex(1)
m = anon.GetChildAtIndex(0).GetValueAsUnsigned()
e = anon.GetChildAtIndex(1).GetValueAsUnsigned()
s = anon.GetChildAtIndex(2).GetValueAsUnsigned()
if e == 0:
summary = "" if s == 0 else "-"
@netguy204
netguy204 / vtable.cpp
Created July 28, 2013 02:11
Monkey patching a C++ class by modifying its VTABLE.
#include <stdio.h>
#include <stdint.h>
class A {
public:
virtual void doThing() {
printf("I'm an A\n");
}
};
@rygorous
rygorous / magic_ring.cpp
Created July 22, 2012 03:55
The magic ring buffer.
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string.h>
#include <Windows.h>
// This allocates a "magic ring buffer" that is mapped twice, with the two
// copies being contiguous in (virtual) memory. The advantage of this is
// that this allows any function that expects data to be contiguous in
// memory to read from (or write to) such a buffer. It also means that