Skip to content

Instantly share code, notes, and snippets.

@BreadFish64
BreadFish64 / matrix.cpp
Created March 30, 2023 02:17
Matrix multiplication
#include "matrix.hpp"
#include <immintrin.h>
#include <cstring>
#include <future>
#include <vector>
// Anonymous namespace for internal linkage
namespace {
@BreadFish64
BreadFish64 / fsr_easu_expanded.comp
Created July 16, 2021 22:36
AMD FSR mpv shaders
//!DESC FSR_EASU
//!HOOK MAINPRESUB
//!BIND HOOKED
//!WIDTH OUTPUT.w
//!HEIGHT OUTPUT.h
//!COMPUTE 8 8
#extension GL_GOOGLE_include_directive : enable
#define SAMPLE_EASU 1
#include <algorithm>
#include <array>
#include <bit>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <random>
#include <string>
//!DESC ScaleForce
//!HOOK MAINPRESUB
//!BIND HOOKED
//!WIDTH OUTPUT.w
//!HEIGHT OUTPUT.h
//? #version 450 core
#ifndef HOOKED_tex
// Copy MPV built-ins for IDE
#define tex1D texture
#version 330
in vec2 TexCoord;
out vec4 FragColor;
uniform sampler2D Texture;
vec3 dtt = vec3(65536.0,255.0,1.0);
class Solution {
public:
[[gnu::target("avx2")]] int reverse(int x) const {
bool negative = x < 0;
if (negative) {
if (x == std::numeric_limits<int>::min())
return 0;
x = -x;
}
if (x >= 10) {
#include <algorithm>
#include <string>
class Solution {
public:
std::string longestPalindrome(const std::string& s) const {
std::size_t longest{0};
std::string::const_iterator longest_begin, longest_end;
// The search will start at the center of a potential palindrome
// and work outward to find the length.
#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;