Skip to content

Instantly share code, notes, and snippets.

View chrisfrazier0's full-sized avatar

Chris Frazier chrisfrazier0

View GitHub Profile
@chrisfrazier0
chrisfrazier0 / BigNum.ts
Created February 5, 2022 21:16
BigNum -- Arbitrarily large integers
const UINT32_MAX_VALUE = 0xFFFFFFFF
class BigNum {
private _positive!: boolean
private _limbs!: Uint32Array
constructor(positive: boolean | string = true, limbs: Uint32Array | number[] = []) {
if (typeof positive === 'string') {
return BigNum._fromString(positive)
}
@chrisfrazier0
chrisfrazier0 / 0 LICENSE
Last active November 5, 2021 01:38
ECC: Ed448 - Goldilocks
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@chrisfrazier0
chrisfrazier0 / isometric.js
Created January 10, 2021 18:10
Cartesian to Isometric and back
function ctoi(x, y) {
return {
x: x-y,
y: (x+y)/2,
}
}
function itoc(x, y) {
return {
x: (2*y+x)/2,
@chrisfrazier0
chrisfrazier0 / avl.go
Last active January 10, 2021 18:08
AVL Tree Implementation in Go
package avl
type Compareable interface {
Compare(Compareable) int8 // 0 equal, -1 less than, 1 greater than
}
type Node struct {
Data []Compareable // duplicates allowed, data stored as array
Balance int8 // negative left heavy, positive right heavy
Link [2]*Node // 0 left, 1 right