View two_or_three.s
.globl _compute_two ; -- Begin function compute_two | |
.p2align 2 | |
_compute_two: ; @compute_two | |
.cfi_startproc | |
; %bb.0: | |
Lloh0: | |
adrp x8, _M@PAGE | |
Lloh1: | |
ldr x8, [x8, _M@PAGEOFF] | |
tst x8, #0x7fffffffffffffff |
View CMakeLists.txt
# Copy this file as CMakeLists.txt in | |
# some directory. With a recent CMake | |
# (at least 3.15), in this directory do | |
# | |
# cmake -B build . | |
# cmake --build build | |
# ./build/repro | |
# | |
# | |
cmake_minimum_required(VERSION 3.15) |
View createsimd.c
namespace { | |
/** | |
* make_uint8x16_t initializes a SIMD register (uint8x16_t). | |
* This is needed because, incredibly, the syntax uint8x16_t x = {1,2,3...} | |
* is not recognized under Visual Studio! This is a workaround. | |
* Using a std::initializer_list<uint8_t> as a parameter resulted in | |
* inefficient code. With the current approach, if the parameters are | |
* compile-time constants, | |
* GNU GCC compiles it to ldr, the same as uint8x16_t x = {1,2,3...}. |
View perfdocker.bash
docker run -it --privileged ubuntu bash | |
apt-get update | |
apt-get install linux-tools-generic | |
/usr/lib/linux-tools/5.4.0-28-generic/perf stat ls |
View is_utf8_continuing.c
// returns true if the provided byte value is a | |
// "continuing" UTF-8 value, that is, if it starts with | |
// 0b10... | |
static inline bool is_utf8_continuing(char c) { | |
// in 2 complement's notation, values start at 0b10000 (-128)... and | |
// go up to 0b11111 (-1)... so we want all values from -128 to -65 (which is 0b10111111) | |
return ((signed char)c) <= -65; | |
} |
View portable_prefetch.c
// prefetching can be useful for large documents | |
// where page walking becomes a significant overhead | |
#ifdef _MSC_VER | |
// annoyingly, Visual Studio does not appear to have a portable | |
// prefetch | |
#ifdef IS_ARM64 | |
inline void prefetch(const void * p) { | |
__prefetch(p); | |
} |
View gosetbenchmark_test.go
package Main | |
import ( | |
"math" | |
"reflect" | |
"testing" | |
"github.com/RoaringBitmap/roaring" | |
"github.com/willf/bitset" | |
) |
View noavx.c
// this is more or less a port of travis_avx2_w to plain C | |
namespace { | |
// this is __m256i for people who don't have avx | |
struct poor__m256i { | |
uint32_t val[8]; | |
}; | |
#ifndef really_inline |
View attributepush_namespace.cpp
// the following works fine under clang: | |
#pragma clang attribute push(__attribute__((target("sse4.2,pclmul"))), apply_to=function) | |
void f(){} | |
#pragma clang attribute pop | |
//////////// | |
/// The following DOES NOT WORK: 'error: expected unqualified-id' | |
////////// | |
namespace joe { |
View marvel.py
def f(x): | |
r1 = (x + 212) % 256 | |
r2 = x | 32 | |
table = [44, 125, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 123 ] | |
if ((r1&0x80)==0x80): | |
r3 = 0 | |
else: | |
r3 = table[r1& 0xF] | |
r4 = r2 == r3 | |
return r4 |
NewerOlder