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
#include <math.h> | |
__device__ inline float clampf(const float n, const float minVal, const float maxVal) | |
{ | |
return (n < minVal ? minVal : n) > maxVal ? maxVal : n; | |
} |
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 the audio API in SFML | |
* | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic-errors sfmusic.cpp -o sfmusic -lsfml-audio -lsfml-system | |
*/ | |
#include <sys/stat.h> | |
#include <iostream> |
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
/** | |
* This test is to see if a std::map can be populated at program startup before | |
* main() is reached. | |
* | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic-errors static_map.cpp -o static_map | |
*/ | |
#include <map> | |
#include <iostream> |
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 type-generic math */ | |
/* | |
* gcc -std=c11 -Wall -Wextra -Werror -pedantic -pedantic-errors c_generics.c -o c_generics | |
*/ | |
#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
// Test to automatically get the aspect ratio of a display | |
// g++ -std=c++11 -pedantic-errors -Wall -Wextra -Werror aspect.cpp -o aspect | |
#include <cmath> | |
#include <iostream> | |
template <typename int_t> | |
int_t gcd(int_t a, int_t b) { | |
while (b) { |
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 test to get the average of an arbitrary set of numbers | |
* | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic -pedantic-errors avgnum.cpp -o avgnum | |
*/ | |
#include <iostream> | |
#define TEST_NUM 42 |
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 Addition Test | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic -pedantic-errors bignum_add.cpp -o bignum_add | |
*/ | |
#include <utility> // std::move | |
#include <string> // std::string | |
#include <iostream> // std::cout | |
#include <cstdint> // uint8_t, uint16_t, UINT8_MAX |
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 | |
* | |
* g++ -std=c++11 -Wall -Wextra -Werror -pedantic-errors bn_mul.cpp -o bn_mul | |
* | |
* usage: ./bn_mul 123456789 987654321 | |
*/ | |
#include <cstring> |
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 the result of a dot product | |
* | |
* gcc -std=c99 -Wall -Werror -Wextra -pedantic -pedantic-errors dotprod.c -o dotprod | |
*/ | |
#include <stdio.h> | |
typedef struct vector |