This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bignum multiplication of numbers with arbitrary bases, using the | |
* Schonhage-Strassen algorithm. | |
* | |
* g++ -std=c++11 -Wall -Wextra -Werror -pedantic-errors bn_strassen.cpp -o bn_strassen | |
* | |
* usage: bn_strassen.exe 123456789 987654321 | |
* | |
* Sources: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# This script follows the instructions for building GCC, from the GNU | |
# documentation here: https://gcc.gnu.org/install/index.html | |
# x86_64: x86_64-pc-linux-gnu | |
# ARM: arm-none-eabi-linux | |
# Aarch64: aarch64-linux-gnu | |
# Vocore2: mipsel-openwrt-linux-uclibc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef _MSC_VER | |
#include <intrin.h> // _BitScanForward | |
#endif | |
#include <cassert> | |
#include <cstdint> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# This script follows the instructions for building Clang, from the LLVM | |
# documentation here: https://llvm.org/docs/GettingStarted.html#requirements | |
CLANG_RELEASE_LATEST=13.0.0 | |
CLANG_GIT_REPO=https://github.com/llvm/llvm-project.git | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A simple compile-time endian test | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic -pedantic-errors endian.cpp -o endian | |
* | |
* This can be used with specialized template functions, classes, and class | |
* methods in order better tailor code and reduce reliance on runtime | |
* checking systems. | |
*/ | |
#include <cstdint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A small raymarcher using CUDA | |
* | |
* This program renders a dynamically-generated image to a PPM file. | |
* | |
* nvcc cuda_raymarcher.cu -arch=sm_20 -o cuda_raymarcher | |
*/ | |
#include <assert.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Testing implementations of different sorting methods. | |
* | |
* gcc -ansi -Wall -Werror -Wextra -static-libgcc -pedantic-errors sorts.c -o sorts | |
*/ | |
#include <assert.h> | |
#include <math.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Simple worker thread/task queue test. | |
* | |
* g++ -std=c++11 -Wall Werror -Wextra -pedantic-errors work_thread.cpp -lpthread -o work_thread | |
*/ | |
#include <atomic> | |
#include <cassert> | |
#include <chrono> // std::seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* g++ --std=c++11 -O3 -DNUM_TEST_RUNS=50000 -pthread -Wall -Werror -Wextra -pedantic -pedantic-errors line_drawing.cpp -o line_drawing | |
*/ | |
#include <cstdint> // uint8_t | |
#include <fstream> // std::ofstream | |
#include <iostream> // std::cout, std::cerr | |
#include <limits> // std::numeric_limits<> | |
#include <memory> // std::unique_ptr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Test for parsing command-line arguments from a single string | |
* | |
* gcc -std=c11 -Wall -Werror -Wextra -pedantic -pedantic-errors parse_args.c -o parse_args | |
*/ | |
#include <stdio.h> // printf(), fprintf() | |
#include <string.h> // strlen() | |
#include <stdbool.h> // bool, true, false | |
#include <ctype.h> // isspace() |
NewerOlder