Skip to content

Rust library of custom number malarkey, including variable-bit-width integers

License

Notifications You must be signed in to change notification settings

danwilliams/numberwang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Numberwang

Rust Crate version CI Docs License

The Numberwang crate is a library of custom number types and functionality, including variable-bit-width integers.

It is named after the fictitious game show "Numberwang", which is a running joke in the British sketch comedy show That Mitchell and Webb Look. The name was chosen because the crate is all about numbers.

The modules provided are:

int

The int module provides a variable-bit-width integer type, Int, which can be used to store integers of any bit width, from 1 to 65,536 bits.

This is particularly useful for situations such as:

  • Database compatibility: This type can be used to create an unsigned 63-bit integer to represent the crossover between a [u64] (which would be the choice for the types used in Rust) and an [i64] (which is a limitation of certain databases, e.g. PostgreSQL). This is necessary in order to safely represent the values in the database without losing any information.

  • Efficiency: This type is also useful for efficiency, as it can be used to create integers that only take the space they need between the standard sizes, e.g. 24-bit, 48-bit, etc.

  • Higher boundaries: This type can also be used to create integers with higher boundaries than the standard Rust integer types, e.g. 256-bit, 512-bit, etc. all the way up to 65,536-bit.

The type implements all standard Rust functionality for integers, and follows standard Rust conventions, meaning it should be intuitive to use. It also correctly observes Endian rules and interoperability, in terms of both bits and bytes.

About

Rust library of custom number malarkey, including variable-bit-width integers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages