Skip to content

Instantly share code, notes, and snippets.

@hawkinsw
hawkinsw / hello.S
Created July 9, 2024 20:22
Annotated Hello, World Program in Assembly
; To build and execute this program on Linux, you can use:
; nasm -f elf32 hello.S -o hello.o
; ld -m elf_i386 hello.o -o hello
section .data
hello db 'Hello, World.', 0
section .text
global _main
_main:
@hawkinsw
hawkinsw / malloc_maybe.cpp
Created June 28, 2024 21:36
Does Windows "Over" Allocate?
#include <iostream>
#include <fstream>
#include <malloc.h>
#include <cassert>
int main() {
std::ofstream output{ "results-release.csv" };
uint64_t max_alloc_request_size = 16*1024;
uint64_t alloc_request_size = 0;
for (; alloc_request_size < max_alloc_request_size; alloc_request_size++) {
@hawkinsw
hawkinsw / arm_and_handler.rs
Created September 4, 2019 09:07
arm_and_handler: A procedural macro that makes it possible to automatically write match statements.
extern crate arm_and_handler;
use arm_and_handler::arm;
use arm_and_handler::arm_and_handler;
use arm_and_handler::handle;
struct T {
i: usize,
}