Skip to content

Instantly share code, notes, and snippets.

View Wunkolo's full-sized avatar
💻

Wunk Wunkolo

💻
View GitHub Profile
@Wunkolo
Wunkolo / SimpWind.cpp
Created June 4, 2016 19:28
Simple Painting Window
#include "SimpWind.hpp"
#include <mutex>
bool SimpWind::WindowImplementation::PopEvent(Event & event)
{
if( Events.empty() )
{
// Populate Queue
ProcessEvents();
}
#pragma once
#include <cstdint>
#include <string>
#include <array>
#include <vector>
class BoyerMoore
{
public:
BoyerMoore(const std::string &Pattern)
#include "Console.hpp"
#include <Windows.h>
#include <conio.h> // _getch()
#pragma warning(disable:4996)
#include <io.h>
#include <cctype> //isgraph
<html>
<head>
<title>{Title}{block:PostTitle} | {PostTitle}{/block:PostTitle}{block:PostSummary} | {PostSummary}{/block:PostSummary}</title>
<meta charset="utf-8">
<meta name="color:Text" content="#a2a2a2" />
<meta name="color:Trim" content="#313032" />
<meta name="color:Background" content="#0e0e0f" />
<meta name="color:BackLight" content="#1f1e21" />
<meta name="color:Posts" content="#19181a" />
<link rel="shortcut icon" href="{Favicon}">
@Wunkolo
Wunkolo / Clock.cpp
Created December 20, 2012 03:54
Clock and Time
#include "Clock.h"
//platform specific time implementations.
#if defined(__WIN32) || defined(_WIN32)
//windows
#include <windows.h>
namespace
{
LARGE_INTEGER getFrequency()
@Wunkolo
Wunkolo / GreedyPower2.md
Last active March 21, 2018 03:43
Greedy Powers of 2

Greedy SIMD algorithms

When making an algorithm I at some point wanted to measure just how better it is than the serial method. With SIMD you can process multiple elements of an array in parallel at the granularity of the size of the vector registers. So if I have an algorithm that can process 16,8,4,2,1 elements in parallel, what is the most optimal way I could fire off each algorithm to process an array? Since this is basically a greedy algorithm, divide N(the size of the array) by 16, and then divide whats left-over by 8, and divide whats left-over by 4, and so on until you've touched every part of the array. So you'd fire off the 16 algorithm one as much as you can, before having to resort to the smaller ones, and eventually reaching 1 where you're processing one element at a time.

avx512

Say you have an array of 91 elements, and can onl

# Wunkolo<wunkolo@gmail.com> - 8/3/2018
# Dumps the archive files for Avalanche's APEX Engine 2 ".tab/.arc" file pairs
# Drag this python script into your "theHunter Call of the Wild\archives_win64\"
# directory and run the script. It will create some worker threads and dump each
# archive into its own folder. Each dumped file will be named using its file
# identifier(a numerical hash of the actual filename). Other games such as
# Just Cause 3 were mistakingly shipped with a .txt file that paired each hash
# with a full filename but they fixed up theHunter so all we got to work
# with are numerical file IDs
@Wunkolo
Wunkolo / pclmulqdq.cpp
Last active May 28, 2019 23:09
Fun with pclmulqdq(carryless multiply)
#include <cstdint>
#include <cstdio>
#include <bitset>
#include <immintrin.h>
int main()
{
const std::uint64_t Bits
= 0b00011000100000000001000000000010000000001000000100000001000000001;
std::puts(("Bits:\t"+std::bitset<64>(Bits).to_string()).c_str());
@Wunkolo
Wunkolo / ASCIIRayTrace.cpp
Last active June 13, 2021 05:36
Just a fun ASCII raytracer I made one day.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <initializer_list>
#include <thread>
#include <chrono>
from PIL import Image
from PIL import ImageDraw
def qHilbertSOA(Width, Distances):
Level = 1
PositionsX = [0] * len(Distances)
PositionsY = [0] * len(Distances)
CurDistances = Distances
for i in range(Width.bit_length() - 1):
# Determine Regions