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 <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> |
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
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_ |
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.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. |
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
# 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 |
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
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) | |
% |
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
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); | |
} |
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 "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; |
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
#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(); | |
} |
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 <math.h> | |
#include <float.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
__attribute__((noinline)) | |
double nafter(double x) { | |
return nextafter(x, INFINITY); | |
} |
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
// 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" |
NewerOlder