Skip to content

Instantly share code, notes, and snippets.

View BreadFish64's full-sized avatar

BreadFish64

View GitHub Profile
#pragma once
#include <functional>
#include "opcode.hpp"
namespace GBA::CPU::DataProcessing {
namespace Basic {
using DataProcessingOperation = void (*)(ProcessorState& state, u32 operand_one, u32 operand_two,
bool carry_in, u32& result) noexcept;
@BreadFish64
BreadFish64 / bit_field.hpp
Created August 19, 2020 02:38
ARMv4 Instruction Bitfield Prototype
#pragma once
#include <limits>
#include "types.hpp"
namespace GBA {
template <typename Storage, usize start, usize end, typename IO = Storage>
class BitField {
#version 450
in vec2 tex_coord;
out vec4 frag_color;
layout(binding = 0) uniform sampler2D input_texure;
vec4 cubic(float v) {
vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v;
#include <array>
#include <cstdint>
template <typename T, std::size_t max_count>
class PoolAllocator {
using Uninitialized = std::array<unsigned char, sizeof(T)>;
std::array<Uninitialized, max_count> backing{};
std::array<Uninitialized*, max_count> pointer_stack{};
typename decltype(pointer_stack)::iterator stack_pointer = pointer_stack.begin();
class SHA256 {
public:
using Digest = std::array<u8, 32>;
SHA256() {
mbedtls_sha256_init(&ctx);
}
SHA256(const SHA256& original) {
mbedtls_sha256_clone(&ctx, &original.ctx);
#include <cstdint>
#include <iostream>
#include <vector>
#include <set>
#include <iterator>
using u32 = std::uint32_t;
void run(std::istream& stream);
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <type_traits>
constexpr std::array<char, 27> ALPHABET = []() constexpr {
std::remove_const<decltype(ALPHABET)>::type data{};
data[0] = ' ';
for (auto i = 0; i < data.size() - 1; ++i)
using UnityEngine;
public class InputManager : MonoBehaviour
{
static readonly Vector2 x1 = new Vector2(1f, 0f);
public abstract class InputBase
{
public abstract Vector2 Get();
static public implicit operator Vector2(InputBase inputTypeBase){
return inputTypeBase.Get();
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
// I like rust's primitives better
using u8 = std::uint_fast8_t;
using u16 = std::uint_fast16_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
#include <array>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
constexpr double PI = 3.14159265358979323846;
int main() {
std::array<std::pair<double, double>, 'Z' - 'A' + 1> char_coords{};