Skip to content

Instantly share code, notes, and snippets.

#include <benchmark/benchmark.h>
#include <cstdint>
using bitcount_t = std::uint8_t;
template <typename itype>
inline itype unxorshift_new(itype x, bitcount_t bits, bitcount_t shift)
{
do {
x ^= x >> shift;
@LRFLEW
LRFLEW / decypher_mis.py
Created April 18, 2020 21:29
Python 3.8 Compatible .MIS to .TXT converter for MTiaA
#!/usr/bin/env python3
import fnmatch
import os
import sys
matches = []
for root, dirnames, filenames in os.walk('DATA'):
for filename in fnmatch.filter(filenames, '*.MIS'):
matches.append(os.path.join(root, filename))
@LRFLEW
LRFLEW / testrand.c
Created October 8, 2019 22:47
Proof of Accuracy of cc65/cc65#951
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
#define REPITITIONS 1000000000
// 6502 A register, C flag, and ADC instruction
static uint8_t a, c;
static void adc(uint8_t v) {
uint8_t a2 = a + v + c;
// ... The changes made (starting at like 47)
template<class T, class... Types>
inline T (__cdecl *MC2_PROC_PTR(const std::uintptr_t address))(Types...) {
return reinterpret_cast<T(__cdecl *)(Types...)>(address);
}
template<class T, class... Types>
inline T (__cdecl *MC2_PROC_PTR_VA(const std::uintptr_t address))(Types..., ...) {
return reinterpret_cast<T(__cdecl *)(Types..., ...)>(address);
}
#include "Example.hpp"
static Example::vTable Example_vtable = {
&Example::impl_00,
};
Example::Example() : vtable(&Example_vtable) { }
void Example::impl_00() {
// Do Stuff Here
@LRFLEW
LRFLEW / main.cpp
Created July 12, 2016 02:20
SDLGLTest
#include <iostream>
#include <SDL.h>
#include <SDL_opengl.h>
int main(int argc, char * argv[]) {
if (SDL_Init(SDL_INIT_VIDEO)) {
std::cerr << "Error In Init" << std::endl;
return 1;
}
@LRFLEW
LRFLEW / gist:5f30731b9863c99f13e4
Created March 12, 2016 23:30
How to prevent Fullscreen button on OS X Title Bar
@import AppKit;
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
void update_SDL_Window_NSWindow(SDL_Window *win) {
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (SDL_GetWindowWMInfo(win, &wmi)) {
switch (wmi.subsystem) {
case SDL_SYSWM_COCOA:
Change-Id: I6e1503652e61683a16312c74f46b79d28c880848
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 83e94c4..80957e6 100644
--- a/qtbase/src/widgets/widgets/qlabel.cpp
+++ b/qtbase/src/widgets/widgets/qlabel.cpp
@@ -1076,14 +1076,16 @@ void QLabel::paintEvent(QPaintEvent *)
if (d->pixmap && !d->pixmap->isNull()) {
QPixmap pix;
if (d->scaledcontents) {
public class Hooked {
public Hooked() {
}
/**
* Silently place a call to the custom hook, does not return any information.
*