Skip to content

Instantly share code, notes, and snippets.

void Mul(uniform float R[3], uniform const float V[3], uniform const float X)
{
R[0] = V[0] * X;
R[1] = V[1] * X;
R[2] = V[2] * X;
}
float Dot(float X0, float Y0, float Z0, float X1, float Y1, float Z1)
{
@PACKAGE_INIT@
set_and_check(Lua_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(Lua_LIBRARY_DIR "@PACKAGE_LIBRARY_INSTALL_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/LuaTargets.cmake")
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CONFIGURATION_TYPES "Debug" "Release")
set(PROJECT_NAME Lua)
project(${PROJECT_NAME})
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
########################################################################
#include <cstdint>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
using s8 = int8_t;
using s16 = int16_t;
using s32 = int32_t;
using s64 = int64_t;
@taqu
taqu / inv_mt.cpp
Created May 6, 2022 18:17
The inversion of the Mersenne Twister
#include <random>
#include <iostream>
class mt_random
{
public:
static constexpr uint32_t N = 624;
static constexpr uint32_t M = 397;
static constexpr uint32_t MATRIX_A = 0x9908B0DFUL;
static constexpr uint32_t UPPER_MASK = 0x80000000UL;
@taqu
taqu / chacha.cpp
Last active October 14, 2025 15:07
An encoder of the chiper ChaCha
#include <stdint.h>
#define ROTL(a,b) (((a)<<(b)) | ((a)>>(32-(b))))
#define QR(a,b,c,d) (\
a += b, d ^= a, d = ROTL(d,16),\
c += d, b ^= c, b = ROTL(b,12),\
a += b, d ^= a, d = ROTL(d, 8),\
c += d, b ^= c, b = ROTL(b, 7))
#ifdef __cplusplus
@taqu
taqu / AES-NI.cpp
Created September 20, 2020 09:55
AES256 codec with Intel's AES-NI
#include <assert.h>
#include <stdint.h>
#include <wmmintrin.h>
#ifdef BUILD_EXPORTS
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif
@taqu
taqu / fp16conversion.cpp
Last active September 20, 2020 09:34
32bit Float to 16 bit Float計測 ref: https://qiita.com/taqu/items/3de14e7d602c1f00df87
#include <immintrin.h>
#include <emmintrin.h>
#include <cstdint>
#include <cmath>
#include <chrono>
#include <random>
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;