Skip to content

Instantly share code, notes, and snippets.

View brendandahl's full-sized avatar

Brendan Dahl brendandahl

  • Google
  • San Francisco, CA
View GitHub Profile
@brendandahl
brendandahl / test_fp16_sqrt.cpp
Created August 27, 2024 00:46
Compare FP16 results of Soft Float's sqrt to Converting FP16 to F32 and using std::sqrt
/*
* Using https://www.jhauser.us/arithmetic/SoftFloat.html
* and https://github.com/Maratyszcza/FP16
* compiling with:
* clang++ -std=c++20 -o sf -I ../../source/include/ -I ~/projects/binaryen/third_party/FP16/include/ main.cpp softfloat.a && ./sf
*/
extern "C" {
#include "softfloat.h"
}
#include <cmath>
var library = {};
if (EM.ASYNCIFY) {
library['sleep'] = function () { ... };
} else {
library['sleep'] = function () { ... };
}
addToLibrary(library);
@brendandahl
brendandahl / rebase.diff
Created October 27, 2023 20:17
emscripten size tests
diff --git a/test/other/metadce/test_metadce_files_wasmfs.size b/test/other/metadce/test_metadce_files_wasmfs.size
index 7e63637a7..e8a794252 100644
--- a/test/other/metadce/test_metadce_files_wasmfs.size
+++ b/test/other/metadce/test_metadce_files_wasmfs.size
@@ -1 +1 @@
-51626
+51634
diff --git a/test/other/metadce/test_metadce_hello_dylink.size b/test/other/metadce/test_metadce_hello_dylink.size
index 5c3d25d34..03aa96dc2 100644
--- a/test/other/metadce/test_metadce_hello_dylink.size
diff --git a/test/other/metadce/test_metadce_cxx_ctors1.jssize b/test/other/metadce/test_metadce_cxx_ctors1.jssize
index d4c636143..c0ec1b6fd 100644
--- a/test/other/metadce/test_metadce_cxx_ctors1.jssize
+++ b/test/other/metadce/test_metadce_cxx_ctors1.jssize
@@ -1 +1 @@
-26008
+26031
diff --git a/test/other/metadce/test_metadce_cxx_ctors2.jssize b/test/other/metadce/test_metadce_cxx_ctors2.jssize
index af118f35f..3a2c12952 100644
--- a/test/other/metadce/test_metadce_cxx_ctors2.jssize

Keybase proof

I hereby claim:

  • I am brendandahl on github.
  • I am bdahlmoz (https://keybase.io/bdahlmoz) on keybase.
  • I have a public key ASAdMWA4LEj8U65mGa6hBg8l3BOY-j6N3a8e_bxgkvsdOAo

To claim this, I am signing this object:

@brendandahl
brendandahl / dom_load_events.js
Created May 23, 2019 20:39
Log the load events of a document.
const domContentLoadedPromise = new Promise(resolve => {
window.addEventListener("DOMContentLoaded", () => {
dump(">>> dialog - DOMContentLoaded event" + window.document.documentURI + "\n");
resolve();
}, { capture: true, once: true });
});
domContentLoadedPromise.then(() => {
dump(">>> dialog - Promise for domContentLoadedPromise resolved\n");
});
let fs = require("fs");
var {
Parser
} = require("saxen");
function structure(filename) {
let contents = fs.readFileSync(filename, "utf8");
let parser = new Parser();
let indent = 0;
let out = "";
@brendandahl
brendandahl / tags.js
Last active May 10, 2019 18:11
XUL element names and HTML element namesa
let xulElements = ["action","arrowscrollbox","assign","bbox","binding","bindings","box","broadcaster","broadcasterset","browser","button","caption","checkbox","colorpicker","column","columns","command","commandset","conditions","content","datepicker","deck","description","dialog","dialogheader","dropmarker","editor","Findbar","grid","grippy","groupbox","hbox","iframe","image","key","keyset","label","listbox","listcell","listcol","listcols","listhead","listheader","listitem","member","menu","menubar","menuitem","menulist","menupopup","menuseparator","notification","notificationbox","observes","page","panel","param","popup","popupset","preference","preferences","prefpane","prefwindow","progressmeter","query","queryset","radio","radiogroup","resizer","richlistbox","richlistitem","row","rows","rule","scale","script","scrollbar","scrollbox","scrollcorner","separator","spacer","spinbuttons","splitter","stack","statusbar","statusbarpanel","stringbundle","stringbundleset","tab","tabbox","tabbrowser","tabpanel","tabpa
@brendandahl
brendandahl / gist:8853d78b159e939e2bbc46b1e9b7ab94
Created April 18, 2019 15:26
Increase number of inodes for MacOS (make git status fast again for mozilla central)
sudo sysctl kern.maxvnodes=$((512*1024))
@brendandahl
brendandahl / chrome_url_to_file_path.js
Created November 8, 2018 22:26
chrome url to file path
function toFile(url) { var chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry); return chromeRegistry.convertChromeURL(Services.io.newURI(url)).QueryInterface(Ci.nsIFileURL).file.path; }