Skip to content

Supplementary repository for the book "Bring Your Own Int" that implements an integer type with arbitrary length from scratch, just using booleans as bits.

License

Notifications You must be signed in to change notification settings

curiositas-books/bring-your-own-int

Repository files navigation



About | Get Book | Quickstart | Curiositas Books

About

Supplementary repository for the book "Bring Your Own Int" that implements an integer type with arbitrary length from scratch, just using booleans as bits.

Get the Book

The book is available in multiple digital formats, as PDF, epub or Kindle E-Book.

Quickstart

The simplest way to start coding is creating your own respository from this template and using Github Codespaces for your own version of the project. The devcontainer provided contains the necessary tools to build the project and execute tests.

Dependencies

Building in Ubuntu 22.04

In an ubuntu:22.04 based environment (WSL2, Native Ubuntu, Docker Container, Cloud VM):

$ # Optionally: Install dependencies to build C++ software
$ sudo apt-get update
$ # 'catch2' might not be present in the repository, depending on the ubuntu
$ # version.
$ sudo apt-get install build-essential catch2 git ninja-build pkg-config python3-pip
$ sudo pip3 install meson cmake

$ cd <your-software-directory>
$ # Use your own repository path here!
$ git clone https://github.com/curiositas-books/bring-your-own-int.git
$ cd bring-your-own-int
$ meson setup build
$ meson compile -C build
$ meson test -C build

$ # Run the provided executables:
$ ./build/bin/sieve_eratosthenes 10
> <No output, Implementation is your job :)>
$ ./build/bin/collatz_chain 1230815809128370172541231203988123
> <No output, Implementation is your job :)>

Building and Using the Reference Implementation

The instruction assume, that you already cloned the project as described above.

$ cd bring-your-own-int/reference-impl
$ meson setup build
$ meson compile -C build
$ meson test -C build

$ # Run the provided executables:
$ ./build/bin/sieve_eratosthenes 10
> 2
> 3
> 5
> 7
$ ./build/bin/collatz_chain 1230815809128370172541231203988123
> Chain Length for 1230815809128370172541231203988123: 1007

Curiositas Books

This project is part of the Curiositas Books Project.

License

This project and all its works are under Creative Commons CC BY-NC 4.0 license. You may do anything with the code and text provided, but please keep it open and please don't make any money from it. The books are sold for fair prices and make no use of DRM. It takes a lot of time and effort to create these works. I don't want to rely on an ad infested platform or publish only to DRM and device restricted media. Please do not exploit this.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.