Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tim-rex's full-sized avatar

Tim-Rex tim-rex

View GitHub Profile
@michaeljclark
michaeljclark / cpuident.c
Last active July 30, 2022 08:17
cmake configure time CPU feature detection for x86 processors
#include <stdio.h>
#include <stdlib.h>
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
#define HAS_X86_CPUID 1
#include <cpuid.h>
static inline void __x86_cpuidex(int reg[], int level, int count)
{ __cpuid_count(level, count, reg[0], reg[1], reg[2], reg[3]); }
#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64)
#define HAS_X86_CPUID 1
@NoelFB
NoelFB / routine.h
Last active November 7, 2022 07:19
Simple C++ Coroutine using a switch statement internally
#pragma once
namespace YourNamespace
{
struct Routine
{
// Current "waiting time" before we run the next block
float wait_for = 0;
// Used during `rt_for`, which repeats the given block for X time
@nicebyte
nicebyte / dyn_arr.h
Last active January 23, 2024 00:10
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*
@cdleon
cdleon / macbook-pro-2011-defective-gpu-fix.md
Last active February 15, 2024 10:24
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
  • void glEnableVertexAttribArray​(GLuint attribIndex);
  • void glDisableVertexAttribArray​(GLuint attribIndex);
  • void glVertexAttribPointer(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
  • void glVertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
  • void glVertexAttribBinding(GLuint attribIndex, GLuint bindingIndex);
  • void glBindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, GLintptr stride);
parameter Details
attribIndex the location for the vertex attribute to which the vertex array will feed data
@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 23, 2024 13:59
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?