From ceba059c53625abd90f0e81766700944e814edbd Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 4 Jun 2021 22:05:48 +1000 Subject: [PATCH] Implement --numbers fixed --- Cargo.lock | 60 +++++++ Cargo.toml | 2 + html/index.html | 10 +- html/index.js | 1 + html/worker.js | 9 +- src/main.rs | 12 +- src/numbers/fixed.rs | 327 ++++++++++++++++++++++++++++++++++++ src/numbers/mod.rs | 2 + src/numbers/native.rs | 21 +-- src/numbers/rational_num.rs | 17 +- src/numbers/rational_rug.rs | 101 +++++------ src/stv/wasm.rs | 16 +- 12 files changed, 472 insertions(+), 106 deletions(-) create mode 100644 src/numbers/fixed.rs diff --git a/Cargo.lock b/Cargo.lock index d0f758d..1f7ae2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,6 +96,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const_fn_assert" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d614f23f34f7b5165a77dc1591f497e2518f9cec4b4f4b92bfc4dc6cf7a190" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "crc32fast" version = "1.2.1" @@ -127,6 +139,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "derive_more" +version = "0.99.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "flate2" version = "1.0.20" @@ -186,6 +210,19 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "ibig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c5022ee7f7a2feb0bd2fdc4b8ec882cd14903cebf33e7c1847e3f3a282f8b7" +dependencies = [ + "cfg-if 1.0.0", + "const_fn_assert", + "num-traits", + "rand", + "static_assertions", +] + [[package]] name = "indexmap" version = "1.6.2" @@ -297,8 +334,10 @@ dependencies = [ "clap", "console_error_panic_hook", "csv", + "derive_more", "flate2", "git-version", + "ibig", "js-sys", "num-bigint", "num-rational", @@ -368,6 +407,21 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" + [[package]] name = "regex-automata" version = "0.1.9" @@ -400,6 +454,12 @@ version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "1.0.72" diff --git a/Cargo.toml b/Cargo.toml index 4a06971..48d6b98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,9 @@ edition = "2018" crate-type = ["lib", "cdylib"] [dependencies] +derive_more = "0.99.14" git-version = "0.3.4" +ibig = "0.3.2" num-traits = "0.2" wasm-bindgen = "0.2.74" diff --git a/html/index.html b/html/index.html index 5bb23f3..d23f448 100644 --- a/html/index.html +++ b/html/index.html @@ -146,18 +146,16 @@ - +