Infinity Calculator implementation for Assignment 2 in Computer Organization.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1009 B

#ifndef INFNUMH
#define INFNUMH
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct infint_t {
uint8_t *data;
size_t capacity, size;
char sign;
} infint_t;
void test_infint();
// Utility functions
infint_t *infint_new(size_t init_cap);
infint_t *infint_clone(infint_t *ii);
infint_t *infint_slice(infint_t *ii, size_t start, size_t len);
void infint_free(infint_t *ii);
char infint_grow_to(infint_t *ii, size_t size);
void infint_comp(infint_t *ii);
char infint_abs_less_than(infint_t *ii, uint8_t n);
char infint_abs_less_than2(infint_t *ii1, infint_t *ii2);
void infint_shift_right(infint_t *ii, size_t n);
// Four functions
void infint_add(infint_t *ii, uint8_t n);
void infint_add2(infint_t *ii1, infint_t *ii2);
void infint_sub(infint_t *ii, uint8_t n);
void infint_sub2(infint_t *ii1, infint_t *ii2);
void infint_mult(infint_t *ii, uint8_t n);
void infint_mult2(infint_t *ii1, infint_t *ii2);
uint8_t infint_div(infint_t *ii, uint8_t n);