Skip to content

Instantly share code, notes, and snippets.

#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
build ) ninja test
[0/2] Re-checking globbed directories...
[0/65] cd /Users/peter/github/fish-shell/fish-rust && /opt/homebrew/Cellar/cmake/...b/fish-shell/build/./cargo/build --config foo=0 -- -Cdefault-linker-libraries=yes
Compiling fish-rust v0.1.0 (/Users/peter/github/fish-shell/fish-rust)
Finished dev [unoptimized + debuginfo] target(s) in 2.24s
[63/64] cd /Users/peter/github/fish-shell/build && /opt/homebrew/Cellar/cmake/3.2...ll/build/test/buildroot//usr/local /Users/peter/github/fish-shell/build/test/root
[0/2] Re-checking globbed directories...
[0/13] cd /Users/peter/github/fish-shell/fish-rust && /opt/homebrew/Cellar/cmake/3.26.3/bin/cmake -E env FISH_BUILD_DIR=/Users/peter/github/fish-shell/build FISH_AUTOCXX_GEN_DIR=/Users/peter/github/fish-shell/build/fish-autocxx-gen/ FISH_RUST_TARGET_DIR=/Users/peter/github/fish-shell/build/cargo/build/aarch64-apple-darwin PREFIX=/usr/local CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=c++ CORROSION_BUILD_DIR=/Users/peter/github/fish-shell/build CARGO_BUILD_
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <random>
/*
* Perform a narrowing division: 128 / 64 -> 64, and 64 / 32 -> 32.
@ridiculousfish
ridiculousfish / benchmark_results.txt
Last active January 28, 2023 20:03
divlu benchmarking again
# Benchmark results, lower is better
# Apple M1 Max
> clang++ -std=c++14 -O3 divlu_benchmark.cpp; ./a.out
hackers 11.5198
libdiv org 8.9480 # without branch
libdiv brn 9.0656 # with branch
# Ryzen 9 5900x
> clang++ -O3 divlu_benchmark.cpp; ./a.out
@ridiculousfish
ridiculousfish / output.m
Created November 3, 2022 21:06
function [force, torque]=pointMatrixGravity(array1,array2)
Synthesizing 10/10 solutions
=======
function [force, torque]=pointMatrixGravity(array1,array2)
% pointMatrixGravity - Calculates the gravitational force between a point
% mass and a matrix of masses
%
% Syntax: [force, torque]=pointMatrixGravity(array1,array2)
%
@ridiculousfish
ridiculousfish / output.m
Created November 3, 2022 21:05
function force=Gmmr2Array(mass1, mass2)
Synthesizing 10/10 solutions
=======
function force=Gmmr2Array(mass1, mass2)
{
var G = 6.67e-11;
var r = distance(mass1, mass2);
return G*mass1.mass*mass2.mass/(r*r);
}
@ridiculousfish
ridiculousfish / calc_gen.cpp
Created September 24, 2022 02:03
calc_gen.cpp file
#include "calc__gen.hpp"
namespace lang::calc::lexer {
rc_ptr<lang_rt::DFALabelIdVec> label_ids_ascii() {
auto ret = Vec<lang_rt::DFALabelId>::repeat(lang_rt::DFATable::NO_LABEL, 128);
ret->at_unchecked(0) = 1;
ret->at_unchecked(1) = 1;
ret->at_unchecked(2) = 1;
ret->at_unchecked(3) = 1;
ret->at_unchecked(4) = 1;
#pragma once
#include "langcc_rt.hpp"
namespace lang::calc::lexer {
rc_ptr<lang_rt::DFALabelIdVec> label_ids_ascii();
rc_ptr<lang_rt::DFALabelIdMap> label_ids_unicode();
}
#include <math.h>
#include <float.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
__attribute__((noinline))
double nafter(double x) {
return nextafter(x, INFINITY);
}
// An object wrapping a scoped lock and a value
// This is returned from owning_lock.acquire()
// Sample usage:
// owning_lock<string> locked_name;
// acquired_lock<string> name = name.acquire();
// name.value = "derp"
//
// Or for simple cases:
// name.acquire().value = "derp"