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 <iostream> | |
#include <iomanip> | |
#include <chrono> | |
// Use it with | sort -n | grep -P 'CLK[01]' | |
namespace | |
{ | |
void displayDuration(const std::chrono::nanoseconds duration) | |
{ |
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 <iostream> | |
#include <cstdint> | |
#include <vector> | |
#include <queue> | |
#include <list> | |
template <class SizeType, uint8_t MIN_LOG_INDEX, uint8_t BALANCE_LOG_RATIO, class Type> | |
struct TIndexedList | |
{ | |
using Iterator = typename std::list<Type>::iterator; |
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
What is math concretely? | |
From the outside, it resembles a group of people talking to each other. The theme of the discussion loosely depends on what was said before and no one really knows how it all started. | |
You can join in if you want but you will need to speak some dialect first. An implicit algorithm is used such that the people can agree on the validity of what is being said. | |
Some people have started to translate the discussion from the original set of evolving dialects into programming languages. In this new setting, the implicit algorithm can be made explicit and the translation checked mechanically. If no mistake is found in the algorithm or in the translation, we can be confident that what was said is indeed valid. | |
Given such an explicit algorithm and a complete enough record of the discussion, we could store a full verified translation. But this translation would be fairly redundant and we could try to compress it. Doing so, we would see that the bytes with the highest compression ratio would ma |
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
{ | |
"node": "Program", | |
"functions": [ | |
{ | |
"node": "Function", | |
"name": { | |
"node": "Identifier", | |
"lexeme": { | |
"node": "Lexeme", | |
"index": 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
#include <iostream> | |
#include <vector> | |
namespace node | |
{ | |
enum class Kind | |
{ | |
PROGRAM, |
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 <iostream> | |
namespace type_flag | |
{ | |
template <class TypeFlag, class Type> | |
using THas = std::enable_if_t<std::is_base_of_v <TypeFlag, std::decay_t<Type>>, int>; | |
template <class TypeFlag, class Type> | |
using THasNot = std::enable_if_t<std::negation_v<std::is_base_of<TypeFlag, std::decay_t<Type>>>, int>; |
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 <algorithm> | |
#include <iostream> | |
#include <cstdint> | |
#include <vector> | |
#include <array> | |
constexpr int log2(int x) | |
{ | |
return x < 2 ? x : 1 + log2(x >> 1); | |
} |
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 <iostream> | |
#include <cstdint> | |
#include <vector> | |
namespace tree | |
{ | |
template <class Type> | |
struct TNode | |
{ |
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 <iostream> | |
enum class Endianness | |
{ | |
LITTLE, | |
BIG | |
}; | |
Endianness makeEndianness() | |
{ |
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
// http://coliru.stacked-crooked.com/a/661e096db956eca7 | |
// Timing on my computer (with larger benchmarks) | |
// 0s 907ms 747us (benchmark_16_2048000_FULL_BUILD) | |
// 0s 919ms 263us (benchmark_16_2048000_SPTR_BUILD) | |
// 0s 620ms 877us (benchmark_16_2048000_FULL_PROBE) | |
// 0s 697ms 964us (benchmark_16_2048000_SPTR_PROBE) | |
// | |
// 0s 578ms 693us (benchmark_64_1024000_FULL_BUILD) | |
// 0s 527ms 744us (benchmark_64_1024000_SPTR_BUILD) | |
// 0s 440ms 486us (benchmark_64_1024000_FULL_PROBE) |
NewerOlder