This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <limits> | |
#include "types.hpp" | |
namespace GBA { | |
template <typename Storage, usize start, usize end, typename IO = Storage> | |
class BitField { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SHA256 { | |
public: | |
using Digest = std::array<u8, 32>; | |
SHA256() { | |
mbedtls_sha256_init(&ctx); | |
} | |
SHA256(const SHA256& original) { | |
mbedtls_sha256_clone(&ctx, &original.ctx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
#include <vector> | |
#include <set> | |
#include <iterator> | |
using u32 = std::uint32_t; | |
void run(std::istream& stream); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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{}; |