Skip to content

Instantly share code, notes, and snippets.

View magurosan's full-sized avatar

Masaki Ota magurosan

  • Nagoya, Aichi, Japan
View GitHub Profile
@magurosan
magurosan / collatz.cpp
Created August 14, 2017 04:54
Various step count function for Collatz 3n+1 problem
#include <stdint.h>
#include <windows.h>
#include <intrin.h>
uint64_t collatz_count_ref(uint64_t n) {
uint64_t count = 0;
while (n > 1) {
n = (n % 2 == 1) ? 3 * n + 1 : n >> 1;
count++;
}
@magurosan
magurosan / collatz_bench.cpp
Last active November 29, 2017 14:23
collatz count benchmark in Xbyak (require Xbyak and collatz.cpp => http://bit.ly/2uTTEpd ). and slide is here => https://www.slideshare.net/MasakiOta3/intel-goldmontmpx
// collatz_bench.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include <stdlib.h>
#include <stdint.h>
#include "xbyak/xbyak.h"
#include "xbyak/xbyak_util.h"