Skip to content

Instantly share code, notes, and snippets.

View BrettRToomey's full-sized avatar

Brett R. Toomey BrettRToomey

View GitHub Profile
// x64 encoding
enum Reg {
RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
R8, R9, R10, R11, R12, R13, R14, R15,
};
enum XmmReg {
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
@BrettRToomey
BrettRToomey / simd_boundary_trim.c
Last active June 24, 2022 21:39
An example showing how to trim an array of integers using a boundary in SIMD
// Credit for this algorithm goes to @pervognsen.
// I just took his pseudocode and turned it into C
//
// NOTE: this code is not "production safe" and makes assumptions about
// the input (like 'count' being divisible by 4).
#include <tmmintrin.h>
#include <emmintrin.h>
#include <popcntintrin.h>
address-book
address-card
adjust
alarm-clock
align-center
align-justify
align-left
align-right
allergies
ambulance
Name: cllvm
Description: The llvm library
Version: 4.0.0
Libs: -L/usr/lib/llvm-4.0/lib -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMTableGen -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMRISCVDesc -lLLVMRISCVCodeGen -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmP
#library "libc"
#import github("vdka/gl")
#import github("vdka/glfw")
#import github("kai-language/stdlib")
#foreign libc {
printf :: (fmt: *u8, args: #cvargs ..any) -> i32
exit :: (exitcode: i32) -> void
@BrettRToomey
BrettRToomey / Scanner.swift
Created May 18, 2017 15:48
A utility for scanning bytes
struct Scanner<Element> {
var pointer: UnsafePointer<Element>
let endAddress: UnsafePointer<Element>
var elements: UnsafeBufferPointer<Element>
// assuming you don't mutate no copy _should_ occur
let elementsCopy: [Element]
}
extension Scanner {
#!/usr/bin/env bash
VERSION="3.1"
echo "Swift $VERSION Continuous Integration";
# Determine OS
UNAME=`uname`;
if [[ $UNAME == "Darwin" ]];
then
OS="macos";
#!/usr/bin/env bash
VERSION="3.1"
echo "Swift $VERSION Continuous Integration";
# Determine OS
UNAME=`uname`;
if [[ $UNAME == "Darwin" ]];
then
OS="macos";
@BrettRToomey
BrettRToomey / BasicUserExample.swift
Last active December 31, 2016 08:14
A basic User model example.
import Vapor
import Fluent
struct User: Model {
var id: Node?
var name: String
init(name: String) {
self.name = name
}
@BrettRToomey
BrettRToomey / CustomSaveStruct.swift
Created December 31, 2016 08:10
An example of a custom save call for an automatic updated_at field.
import Vapor
import Fluent
import Foundation
struct User: Model {
var updated_at: Int
//...
mutating func save() throws {