Skip to content

Instantly share code, notes, and snippets.

@stryku
stryku / hex_character_to_binary_benchmark.cpp
Created April 2, 2020 23:24
Branchless conversion of a hex character to its value
// 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()
{
@stryku
stryku / CMakeSL builds itself.md
Last active October 7, 2019 21:48
CMakeSL fully builds itself for the first time

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

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 June 19, 2020 06:21
CMakeSL (CMake Scripting Language) - An attempt to introduce a new scripting language for CMake

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
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"
for every listed file
for every passed regex
if file name match regex
format shit out
static cl::opt<bool> Recursively("r",
cl::desc("Recursively search for <file>s."),
cl::cat(ClangFormatCategory));
if (Recursively) {
return clang::format::formatRecusively();
}
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]);