Skip to content

Instantly share code, notes, and snippets.

View beru's full-sized avatar
😷
Caught 2019-nCoV

beru beru

😷
Caught 2019-nCoV
View GitHub Profile
@beru
beru / fixed_point_log.cpp
Last active August 29, 2015 13:56
対数を求める関数、浮動小数点演算を行わないで求める。http://en.wikipedia.org/wiki/Binary_logarithm#Real_number
/*
The MIT License (MIT)
Copyright (c) 2014 berupon@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@beru
beru / ccheck_symbols.py
Created March 28, 2014 20:35
Cのソースのシンボル検査
#!/usr/bin/env python
from __future__ import division
import sys
import os
import glob
from pycparser import parse_file
from pycparser.c_ast import *
@beru
beru / Makefile
Last active August 29, 2015 13:58
clang test
CFLAGS = "-fsanitize=integer,unsigned-integer-overflow,shift"
.PHONY: all clean
all: program
program: mulodi4.o test.o
clang $(CFLAGS) *.o -o test
#include <stdlib.h>
#include <stdint.h>
#include <algorithm>
#include "timer.h"
#include "trace.h"
#include <vector>
#if defined(_MSC_VER)
@beru
beru / timer.h
Created January 13, 2014 18:43
時間計測用
#pragma once
#ifdef _MSC_VER
#include <windows.h>
#else
#include <sys/time.h>
#endif
/*!
@file Timer.h
@beru
beru / gather_test.cpp
Last active October 8, 2016 21:39
1バイトインデックスによる1バイト要素のテーブル引き処理の動作確認コード
#include <immintrin.h>
#ifdef _MSC_VER
#include <conio.h>
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#include <stdlib.h>
#include <immintrin.h>
#include <x86intrin.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
static inline
__m256i mm256_u8gather_epu8(const uint8_t* lut, __m256i vindex, __m256i andMask) {
__m256i lo = _mm256_unpacklo_epi8(vindex, _mm256_setzero_si256());
@beru
beru / extension.ts
Created July 2, 2017 13:07
VS CodeのExtension カーソル下のファイルパスを開く、行番号が付加されていたらその行に移動、かなりカスカスな実装
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
; Script genferated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=Microsoft Visual Studio 6.0 Service Pack 6
AppVerName=Microsoft Visual Studio 6.0 Service Pack 6
AppPublisher=Microsoft Corporation
AppPublisherURL=http://www.microsoft.com
AppSupportURL=http://www.microsoft.com
AppUpdatesURL=http://www.microsoft.com
#include <Windows.h>
#include <stdio.h>
struct CStopWatch final
{
const char* title;
LARGE_INTEGER frequency;
LARGE_INTEGER startTime;
CStopWatch( const char* pszTitle )