Coder Social home page Coder Social logo

twr-bigint's Introduction

Big Integer C Library

twr-bigint.c, twr-bigint.h

This big integer code allows operations on an integer of an arbitrary large number of bits.

This implementation of an unsigned big integer has the following benefits:

  • easy to incorporate into your project
    • copy bigint.c and bigint.h
  • has no external dependencies (for example, does not use stdlib)
  • is implemented in C
  • is simple, small, lightweight

To Use In Your Project

copy bigint.c and bigint.h into your project.

This bigint library is also available as part of my tiny-wasm-runtime library (for which it was created, to implement various float functions).

Documentation

See bigint.h for a list of functions available.

See factorial.c for a simple example.

Functions are available for multiplication, division, addition, subtraction, bit manipulation, base 10 and 2 integer logarithms, power (exponent), digit counting, text conversion (for printing or inputting ASCII), and comparison.

The bigint is an array of 32 bit words of arbitrary length. This implementation uses a fix size bigint. You can change the size in the bigint.h file. This method was helpful for use with my wasm crt since it allows bigints that don't use malloc. This also allows bigint to be implemented without depending on a crt (c runtime library) and makes it easy to allocate bigints on the stack.

Makefile

The GNU makefile will build the unit tests and the factorial example.

Author

Written by Anthony Wood 2023

twr-bigint's People

Contributors

twiddlingbits avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.