Skip to content

Instantly share code, notes, and snippets.

View Andersama's full-sized avatar

Alex Anderson Andersama

View GitHub Profile
// file_organizer.cpp : Defines the entry point for the application.
//
#include "file_organizer.h"
#include <filesystem>
#include <string>
#include <string_view>
#include <memory>
#include <memory_resource>
#include "fmt/format.h"
@Andersama
Andersama / MWC.h
Last active August 19, 2022 08:50
#pragma once
#include <stdint.h>
// This software is a derivative of the below and is distributed without any warranty
// see: https://prng.di.unimi.it/MWC128.c
// license: https://creativecommons.org/publicdomain/zero/1.0/
// This because uint128_t is not universally supported...
#include <intrin.h> //see: https://github.com/yuikns/intrin for gcc and clang
#pragma once
#include <stdint.h>
// for reference see: https://github.com/jxskiss/base62
// quick_base62_encoding.h
const uint32_t base62_high_bitmask = (62 & 63); //
const uint32_t base62_low_bitmask = (30 & 31); //
const uint32_t base62_common_bitmask = (base62_high_bitmask & base62_low_bitmask); //00011110
const uint32_t bits6_mask = (64-1); //
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <string_view>
struct number_to_text {
size_t i;
std::string_view str;
};
state("Inscryption") {
}
startup {
// Add Events from dotpeeking Assembly-CSharp SaveManager > SaveFile > StoryEvent [DiskCardGame.StoryEvent]
print("Starting up!");
vars.event_names = new string[] {
"BasicTutorialCompleted", // story_event_0 etc...
"TutorialRunCompleted",
#pragma once
#include <cstdint>
struct flags_t {
uint32_t bitmask = {};
// set the bit at a particular index
constexpr void set(uint8_t index) noexcept {
bitmask |= 1UL << index;
}
// unset the bit at a particular index
#pragma once
#include <cstdint>
#include <array>
//returns an array of the first N primes
template<size_t N>
constexpr std::array<uint32_t, N> primes_list() {
constexpr uint32_t segment_count = 32;
std::array<uint32_t, segment_count> bits{};
std::array<uint32_t, N> primes_list{};
//if constexpr (N == 0)
@Andersama
Andersama / keyword_dfa.h
Last active January 17, 2025 06:44
Generates a dfa designed to accept a list of keywords
#pragma once
#include <vector>
#include <array>
#include <string>
#include <string_view>
#include <cstdint>
#include <algorithm>
#include <format>
#include <iostream>
@Andersama
Andersama / simple_bench.h
Last active January 7, 2024 00:09
An even smaller and simpler benchmarking header
#pragma once
#include <vector>
#include <memory_resource>
#include <string>
#include <string_view>
#include <chrono>
//A shameless rip of the bits that appear to make nanobench work
@Andersama
Andersama / sse_lexer.h
Last active May 8, 2021 04:02
A quick and dirty sse based tokenizer
#pragma once
#include <cstdint>
#include <intrin.h>
#include <string_view>
#include <cstring>
#include <array>
constexpr uint8_t l_space = 0x1;
constexpr uint8_t h_space = 0x2;
constexpr uint8_t h_delch = 0x4;