Skip to content

Instantly share code, notes, and snippets.

View willkill07's full-sized avatar
🏠
Working from home

Will Killian willkill07

🏠
Working from home
View GitHub Profile
@willkill07
willkill07 / runtime_dispatch.hpp
Last active September 15, 2023 03:49
Runtime Dispatch of compile-time product
#pragma once
#include <algorithm>
#include <array>
#include <concepts>
#include <optional>
#include <string_view>
#include <type_traits>
#include <utility>
@willkill07
willkill07 / mandelbrot.c
Last active July 13, 2021 17:11
Mandelbrot
// Author: Will Killian
//
// Modified/Generalized from:
// https://code.it4i.cz/jansik/mandelbrot/-/blob/master/mandelbrot-real-fma-omp.c
#include <stdio.h>
#include <stdlib.h>
#define SIZE 512
#include <type_traits>
template <template <class... Ts> class Name, class ... Args>
struct Concept {
};
template <class> struct CheckConcept;
//#define RAJA_CXX_VERSION 17
template<typename T, typename U = std::remove_all_extents_t<T>>
using has_dtor = decltype(std::declval<U&>().~U());
class Empty
{};
class NotEmpty
{
virtual ~NotEmpty();
};
// Prevent warning when testing the Abstract test type.
#include <type_traits>
template <typename...>
struct voider {
using type = void;
};
template<typename ... Ts>
using void_t = typename voider<Ts...>::type;
@willkill07
willkill07 / lisp.cpp
Created September 13, 2019 21:46
Lisp Evaluator C++ TMP
template <typename T> auto declval() -> T&&;
template <class... Args> using eval = decltype(evaluate(declval<Args>()...));
template <class... Args> using eval2 = decltype(evaluate2(declval<Args>()...));
template <class... Args> using eval3 = decltype(evaluate3(declval<Args>()...));
template <class...>
struct L{};
// the datatype cons (not the keyword)
template <class, class>
@willkill07
willkill07 / fib_lol.cpp
Created September 26, 2017 22:07
Fib Fun
#include <array>
#include <utility>
using Int = unsigned long long;
template<Int N, Int A = 0x0llu, Int B = 0x1llu>
constexpr Int Fib = []() constexpr {
if constexpr(N == 0)
return A;
else if constexpr(N == 1)
@willkill07
willkill07 / 10.13_compat_homebrew.sh
Created September 16, 2017 17:06
high sierra compatibility
echo "type in a brew package name and press enter"
echo "to end your queries, send EOF (Ctrl+D)"
echo "> "
while read -r package
do
brew info $package | \
awk '/^From:/{
gsub(/github.com/,"raw.githubusercontent.com")
gsub(/\/blob\//,"/")
print $2
@willkill07
willkill07 / PolicyBase.hpp
Last active July 20, 2017 03:53
OpenMP policy tag dispatching
#ifndef POLICY_BASE_HPP_
#define POLICY_BASE_HPP_
#include <cstdio>
#include "meta.hpp"
// Policy base
enum class Policy { seq, openmp, target_openmp };
@willkill07
willkill07 / AddClangPlugin.cmake
Last active June 30, 2017 18:06
Clang Plugin CMakeLists.txt
find_package(Clang REQUIRED)
set(CLANG_LIBRARIES clangAST clangASTMatchers clangAnalysis clangBasic clangDriver clangEdit clangFrontend clangFrontendTool clangLex clangParse clangSema clangEdit clangRewrite clangRewriteFrontend clangStaticAnalyzerFrontend clangStaticAnalyzerCheckers clangStaticAnalyzerCore clangSerialization clangToolingCore clangTooling clangFormat)
macro(add_clang_plugin _name)
add_library(${_name} SHARED "")
set_target_properties(${_name}
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED On