Skip to content

Instantly share code, notes, and snippets.

@stryku
stryku / hex_character_to_binary_benchmark.cpp
Created Apr 2, 2020
Branchless conversion of a hex character to its value
View hex_character_to_binary_benchmark.cpp
// Requires google's benchmark library: https://github.com/google/benchmark
#include <benchmark/benchmark.h>
#include <cstdint>
constexpr auto k_samples_count = 1000000u;
uint8_t random_char()
{
View CMakeSL - Declarative Extensions.md
@stryku
stryku / CMakeSL builds itself.md
Last active Oct 7, 2019
CMakeSL fully builds itself for the first time
View CMakeSL builds itself.md

CMakeSL builds itself \o/

tl;dr: CMakeSL is now able to build itself. Read along to find out what changes have been made since last reddit post and a short video from CMakeSL building.

Links

View CMakeSL - abseil-cpp scripts.md

Links

  • CMakeSL RSS - I'm going to reuse my page feed. I'm not going to post every article at r/cpp or r/cmake, so if you want to be notified about new CMakeSL arts, the RSS is the only reliable way.
  • CMakeSL repo

CMakeSL - abseil-cpp scripts

This article is meant to present what's going on with the CMakeSL project. If you don't know what the CMakeSL is, check out this gist or the readme.

CMakeSL changes

@stryku
stryku / CMakeSL.md
Last active Jun 19, 2020
CMakeSL (CMake Scripting Language) - An attempt to introduce a new scripting language for CMake
View CMakeSL.md

CMakeSL (CMake Scripting Language) - An attempt to introduce a new scripting language for CMake

Agenda

  • Abstract
  • Video
  • Why
  • How
  • Current status
  • Future plans
  • How to
View recursive-clang-format_5.diff
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp
index 37c2d8b78f..ff71b4aac8 100644
--- a/tools/clang-format/ClangFormat.cpp
+++ b/tools/clang-format/ClangFormat.cpp
@@ -22,6 +22,7 @@
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
View recursive-clang-format_4.cpp
for every listed file
for every passed regex
if file name match regex
format shit out
View recursive-clang-format_3.cpp
static cl::opt<bool> Recursively("r",
cl::desc("Recursively search for <file>s."),
cl::cat(ClangFormatCategory));
View recursive-clang-format_2.cpp
if (Recursively) {
return clang::format::formatRecusively();
}
View recursive-clang-format_1.cpp
static bool formatRecusively() {
std::vector<std::string> files;
if (checkMultipleFilesPreconditions() || findMatchingFiles(files)) {
return false;
}
bool Error = false;
for (unsigned i = 0; i < files.size(); ++i) {
Error |= clang::format::format(files[i]);
You can’t perform that action at this time.