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
template<class T, T v> | |
struct integral_constant { | |
static constexpr T value = v; | |
using value_type = T; | |
using type = integral_constant; // using injected-class-name | |
constexpr operator value_type() const noexcept { return value; } | |
constexpr value_type operator()() const noexcept { return value; } //since c++14 | |
}; | |
using false_type = integral_constant<bool, false>; | |
using true_type = integral_constant<bool, true>; |
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
//Checking whether member function is constexpr | |
#include <array> | |
#include <vector> | |
template<typename T, typename = void> | |
struct has_constexpr_size : std::false_type {}; | |
template<typename T, typename Fn, typename ...Args> | |
constexpr auto invoke_memfn(Fn fn, Args...args) { return (T().*fn)(args...); } |
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 <unordered_map> | |
#include <vector> | |
#include <iostream> | |
#include <type_traits> | |
#include <memory> | |
//iteator pair - very crude range | |
template <typename I1, typename I2=I1> | |
struct iter_pair : std::pair<I1, I2> | |
{ |
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
//-checks=*,-modernize-use-auto,-hicpp-use-auto -extra-arg="-Weverything -Wno-missing-prototype -Wno-c++98-compat" | |
void f(double d, int a, int b) { | |
double r1 = a/b; //warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division] | |
double r2 = int{a/b}; | |
double r3 = (int)(a/b); //redundant cast to the same type [google-readability-casting] | |
double r4 = int(a/b); | |
double r5 = static_cast<int>(a/b); | |
int i1 = d; | |
int i2 = int{d}; //error: type 'double' cannot be narrowed to 'int' in initializer list [clang-diagnostic-c++11-narrowing] |
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 <immintrin.h> | |
#ifdef __ICC //ICC>=16 | |
#define USE_TARGET_ATTR 0 | |
#else //Clang (>=3.8) or GCC | |
#define USE_TARGET_ATTR 1 | |
#endif | |
#if USE_TARGET_ATTR | |
#define TARGET_AVX __attribute__ ((target ("avx"))) |
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
Update (s) Perf (ns/day) | |
flexible non-simd 0.494 2.196 | |
flexible 0.253 2.236 | |
non-freeze,acc, bNemd, NH 0.186 2.253 | |
non-ctc 0.183 2.27 | |
non-vsite/shell 0.115 2.278 | |
diag M 0.11 2.258 | |
intrinsic 0.077 2.268 | |
intrinsic, collapse 0.048 2.262 |
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
### Keybase proof | |
I hereby claim: | |
* I am rolandschulz on github. | |
* I am rschulz (https://keybase.io/rschulz) on keybase. | |
* I have a public key whose fingerprint is E0A8 00C1 496A 767D AA3F DDEE 8B21 18C9 DBF4 28AB | |
To claim this, I am signing this object: |
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<profiles version="1"> | |
<profile kind="CodeFormatterProfile" name="Gromacs" version="1"> | |
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> | |
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> | |
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> | |
<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/> | |
<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/> | |
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/> | |
<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/> |
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
import sys,os,re | |
CMAKE_SOURCE_DIR="/home/rschulz/download/gromacs5.0" | |
sp=[CMAKE_SOURCE_DIR+"/src/", CMAKE_SOURCE_DIR+"/src/gromacs/legacyheaders/", os.path.abspath(os.path.dirname(sys.argv[1]))+"/"] | |
ll=file(sys.argv[1]).readlines() | |
of=file(sys.argv[1],"w") | |
inclp = re.compile('^# *include *"') | |
for l in ll: |