Skip to content

Instantly share code, notes, and snippets.

View miyuki's full-sized avatar

Mikhail Maltsev miyuki

View GitHub Profile
@miyuki
miyuki / rngs.cpp
Last active January 1, 2017 19:50
ranges-v3 benchmark
int64_t compute(int64_t sz, size_t iter_num)
{
using namespace ranges::v3;
auto res = view::generate([sz]{
auto xs = view::iota(0LL, sz);
auto ys = view::zip_with([](auto x, auto y){ return x+y; },
xs, xs | view::drop(1));
return accumulate(ys | view::stride(100), 0LL);
});
return *(res | view::drop_exactly(iter_num-1)).begin();
void foo(const int*x, int*y)
{
cout << *x << *y << '\n'; // 0 0
*y = 2;
cout << *x << *y << '\n; // 2 2
*const_cast<int*>(x) = 3
cout << *x << *y << '\n' // 4 4
}
struct S {
@miyuki
miyuki / gcc-coverage.sh
Last active July 2, 2017 17:20
GCC coverage data postprocessing
#!/bin/bash -ex
BUILD_GCC_DIR="${BUILD_DIR}/gcc"
OUTPUT_DIR="${WORKSPACE}/lcov_output"
TRACE_FILE="${WORKSPACE}/coverage.info"
SUMMARY_FILE="${WORKSPACE}/summary.txt"
# Dirty hack
cp "${SRC_DIR}/gcc/cp/cfns.gperf" "${BUILD_GCC_DIR}/"
@miyuki
miyuki / gcc-1.27.patch
Created October 4, 2017 21:11
A patch required to build GCC 1.27 on a modern system
diff --git a/Makefile b/Makefile
index ee02e0f..25a4aa5 100644
--- a/Makefile
+++ b/Makefile
@@ -373,19 +373,19 @@ maketest:
stage1: force
-mkdir stage1
mv $(STAGESTUFF) $(STAGE_GCC) stage1
- -rm stage1/gnulib
+ -rm -f stage1/gnulib