This file contains hidden or 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
template <typename InputIt, typename OutputIt, typename BinaryOp, typename T, typename Size> | |
unique_future<OutputIt> | |
async_inclusive_scan(InputIt first, InputIt last, OutputIt output,BinaryOp op, T init, Size chunk_size) | |
{ | |
Size const elements = std::distance(first, last); | |
Size const chunks = (1 + ((elements - 1) / chunk_size)); // Round up. | |
std::vector<unique_future<T>> sweep; | |
sweep.reserve(chunks); |
This file contains hidden or 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
// From Andrei Alexandrescu talk | |
// https://www.facebook.com/notes/facebook-engineering/three-optimization-tips-for-c/10151361643253920/ | |
// Apache License | |
// Version 2.0, January 2004 | |
** | |
* Returns the number of digits in the base 10 representation of an | |
* uint64_t. Useful for preallocating buffers and such. It's also used | |
* internally, see below. Measurements suggest that defining a | |
* separate overload for 32-bit integers is not worthwhile. | |
*/ |
This file contains hidden or 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 <cstdlib> | |
// Andrei Alexandrescu at the C++ and Beyond 2012 | |
class atoi_func | |
{ | |
public: | |
atoi_func(): value_() {} | |
inline int value() const { return value_; } |
This file contains hidden or 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
git remote prune origin | |
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin |
This file contains hidden or 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
template<class T> | |
auto serialize_imp(std::ostream& os, T const& obj, int) | |
-> decltype(os << obj, void()) | |
{ | |
os << obj; | |
} | |
template<class T> | |
auto serialize_imp(std::ostream& os, T const& obj, long) | |
-> decltype(obj.stream(os), void()) |
This file contains hidden or 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
// https://vittorioromeo.info/index/blog/capturing_perfectly_forwarded_objects_in_lambdas.html | |
#include <iostream> | |
#include <functional> | |
#define FWD(...) std::forward<decltype(__VA_ARGS__)>(__VA_ARGS__) | |
namespace impl | |
{ | |
template <typename... Ts> |
This file contains hidden or 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 <cstddef> | |
template<typename T1, typename T2> | |
struct StaticPair { | |
T1 first; | |
T2 second; | |
friend constexpr bool operator<(const StaticPair& lhs, const StaticPair& rhs) noexcept { | |
return lhs.first < rhs.first; | |
} | |
This file contains hidden or 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
tomMath vs GMP vs BSD http://tcl.2662.n7.nabble.com/tommath-is-slow-td64598.html | |
arp vs openssl vs libtommath https://gitlab.haskell.org/ghc/ghc/wikis/replacing-gmp-notes/performance-measurements | |
why arprec https://mail.haskell.org/pipermail/glasgow-haskell-users/2006-September/010963.html | |
http://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/ | |
https://github.com/gcc-mirror/gcc/tree/master/libdecnumber |
This file contains hidden or 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 | |
# | |
# Runs clang-format on changed regions before commit. | |
# | |
# To install this, copy it to .git/hooks/pre-commit in your repo. | |
# Remaining installation checks/instructions will be printed when you commit. | |
# | |
read -d '' help <<- EOF | |
This repository requires you to install the git clang-format command. |
This file contains hidden or 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
#ifndef MINIPOOL_H | |
#define MINIPOOL_H | |
#include <cassert> | |
#include <cstddef> | |
#include <memory> | |
#include <new> | |
#include <utility> | |
/* |