Skip to content

Instantly share code, notes, and snippets.

// https://godbolt.org/z/Yob396xoT
// MIT License - Copyright(c) 2023 James Edward Anhalt III - https://github.com/jeaiii
using size_t = decltype(sizeof(0));
#pragma pack(push, 1)
template<auto, class, size_t N> union member_at;
template<class T, class U, T U::* M, class B, size_t N> union member_at<M, B, N>
{
// https://godbolt.org/z/s9GheEWav
// MIT License - Copyright(c) 2023 James Edward Anhalt III - https://github.com/jeaiii
#define CPP17 0
#define CPP14 0
#if CPP17
#define AUTO_T auto
#else
#define AUTO_T unsigned long long
@jeaiii
jeaiii / crc32.h
Last active September 13, 2023 18:01
// MIT License
// https://godbolt.org/z/xdG3dYWd8
using uint8_t = unsigned char;
using uint32_t = decltype(0xffffffff);
template<class...> struct each;
template<class T> struct each<T const*>
{
@jeaiii
jeaiii / sse2_floor.h
Last active July 11, 2022 01:21
sse2 mm_floor_ps
/*
MIT License
Copyright(c) 2022 James Edward Anhalt III - https://github.com/jeaiii
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@jeaiii
jeaiii / fnv1a.h
Created September 26, 2020 20:37
constexpr fnv1a hashing
/*
MIT License
Copyright (c) 2020 James Edward Anhalt III - https://github.com/jeaiii
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is