This file contains 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
void SDL_Convert_S8_to_F32_NEON(const Sint8* src, float* dst) | |
{ | |
uint8x16_t flipper = vdupq_n_u8(0x80); | |
uint32x4_t caster = vdupq_n_u32(0x47800000u); | |
float32x4_t offset = vdupq_n_f32(-65537.0f); | |
uint8x16_t bytes = veorq_u8(vld1q_u8((const uint8_t*) src), flipper); | |
uint16x8_t shorts1 = vmovl_u8(vget_low_u8(bytes)); | |
uint16x8_t shorts2 = vmovl_u8(vget_high_u8(bytes)); |
This file contains 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 <stdint.h> | |
uint8_t blend_classic(uint8_t sC, uint8_t dC, uint8_t sA) | |
{ | |
// The blend equation as specified in SDL_BLENDMODE_BLEND, which uses 2 multiplies and a divide | |
return ((sC * sA) + (dC * (255 - sA))) / 255; | |
} | |
uint8_t blend_sdl(uint8_t sC, uint8_t dC, uint8_t sA) | |
{ |
This file contains 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 <stdint.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#include <string.h> | |
uint32_t joaat_loop(const uint8_t* key, size_t length, uint32_t hash) | |
{ | |
size_t i = 0; | |
while (i != length) { |
This file contains 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 <vector> | |
using u16 = uint16_t; | |
using u32 = uint32_t; | |
using usize = size_t; | |
// clang-format off | |
static const u16 casefold_mph_tab[] { | |
0x563,0x4B3,0x040,0x04C,0x4C2,0x36A,0x50F,0x2F8,0x09F,0x587,0x150,0x20A,0x4D0,0x34E,0x2D1,0x1E8, | |
0x5AD,0x0F2,0x133,0x3CF,0x567,0x179,0x423,0x5E3,0x33D,0x51B,0x577,0x2F6,0x2DD,0x33A,0x23E,0x52C, |
This file contains 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
# https://wiki.sagemath.org/quickref?action=AttachFile&do=get&target=quickref-linalg.pdf | |
# https://github.com/emin63/pyfinite | |
# https://github.com/malb/m4ri | |
from functools import reduce | |
import sys | |
def extract_rows(table): | |
''' | |
Extracts a set linearly independent rows from a lookup table |
This file contains 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> | |
bool PolyMul(uint32_t from, uint32_t to, uint32_t& out_mul) | |
{ | |
for (; ~from & 1; from >>= 1, to >>= 1) { | |
if (to & 1) | |
return false; | |
} | |
uint32_t result = 0; |
This file contains 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 <SDL.h> | |
#include <SDL_opengl.h> | |
#include <SDL_syswm.h> | |
#include <Windows.h> | |
enum class UpdateReason | |
{ | |
Main, |
This file contains 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 <limits> | |
#include <type_traits> | |
enum class int_cast_mode | |
{ | |
lossless, | |
check_sign, | |
check_max, | |
check_trip, | |
}; |
This file contains 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 <cstddef> | |
#include <cstdint> | |
#include <initializer_list> | |
#include <limits> | |
#include <type_traits> | |
constexpr std::size_t popcount(std::uint8_t value) noexcept | |
{ | |
value -= (value >> 1) & 0x55; | |
value = (value & 0x33) + ((value >> 2) & 0x33); |
This file contains 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
import struct | |
import json | |
if True: | |
import lzf # pip install python-lzf | |
else: | |
import ctypes | |
class lzf: | |
_lzf_dll = ctypes.CDLL('lzf.dll') |
NewerOlder