Skip to content

Instantly share code, notes, and snippets.

View BreadFish64's full-sized avatar

BreadFish64

View GitHub Profile
#pragma once
#include <cassert>
#include <concepts>
#include <cstring>
#include <functional>
#include <memory>
#include <new>
#include <type_traits>
#include <utility>
@BreadFish64
BreadFish64 / breaded_expected.hpp
Created January 8, 2025 05:47
C++20 implementation of std::expected which passes MSVC's unit tests
#pragma once
#include <cassert>
#include <concepts>
#include <memory>
#include <type_traits>
#include <utility>
namespace breaded {
@BreadFish64
BreadFish64 / BreadSort.hpp
Created May 27, 2024 04:06
ranges::BubbleSort
#pragma once
#include <algorithm>
#include <ranges>
#include <functional>
#include <iterator>
#include <type_traits>
namespace BreadSort {
namespace detail {
@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.