Skip to content

Instantly share code, notes, and snippets.

Caught in an infinite loop dividing by zero.

Frederic Meyer fleroviux

Caught in an infinite loop dividing by zero.
Block or report user

Report or block fleroviux

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
@fleroviux
fleroviux / make-toolchain.sh
Last active Mar 9, 2019
Bash script for compiling a GCC (cross) compiler
View make-toolchain.sh
#!/bin/sh
# Please install non-optional dependencies noted on this site:
# https://wiki.osdev.org/GCC_Cross-Compiler
# Compiler Configuration
CROSS_TARGET=x86_64-elf
GCC_VERSION="8.1.0" # GCC version
BIN_VERSION="2.30" # Binutils version
@fleroviux
fleroviux / fft512.c
Last active Oct 31, 2018
Dead simple & stupid FFT512 implementation in C11
View fft512.c
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <complex.h>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
/* Permutation */
View pow_mod.c
#include <stdio.h>
#include <stdint.h>
/*
a mod n = r
a = p * q
p = an+x
q = bn+y
@fleroviux
fleroviux / threads.cpp
Last active Sep 28, 2018
Minimal C++11 threading example for LF6 @MMBbS
View threads.cpp
#include <iostream>
#include <thread>
#include <chrono>
#include <mutex>
static std::mutex g_cout_mutex; /* Mutex means "mutually exclusive" */
/**
* Count from zero to maximum number in a thread-safe manner.
*
@fleroviux
fleroviux / ansi-colors.c
Created Mar 19, 2018
MinGW 32/64 enable ANSI color sequences on Windows 10
View ansi-colors.c
// Windows 10 supports ANSI color code sequences, however they need to be enabled
// and apparently MinGW/MinGW-w64 doesn't support set the required STDOUT flag yet. This code enables ANSI VT processing
// on MinGW compilers however it hasn't been tested on older Windows systems yet which do not have that flag.
// So if you use this in production code you probably have to check if the platform is Windows 10.
#include <stdio.h>
#ifdef __MINGW32__
#define NEED_COLOR_FIX
#endif
@fleroviux
fleroviux / masking.hpp
Last active Nov 6, 2016
This code demonstrates how to perform human-readable bit manipulation in C++. Please note that one must place this code in a header file, otherwise the compiler CANNOT inline it, which will result in much slower code.
View masking.hpp
#pragma once
namespace util
{
namespace bit
{
template <typename T, int position>
int get(T value)
{
return (value >> position) & 1;
You can’t perform that action at this time.