aboutsummaryrefslogtreecommitdiff
path: root/include/bh/internal/bigint.h
blob: 96377cf60fa5a178955756ccc38828d72efe4f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef BH_INTERNAL_BIGINT_H
#define BH_INTERNAL_BIGINT_H

#include "bh.h"
#include <bh/bigint.h>

#if defined(BH_BIGINT_LONG)
#define BH_BIGINT_BITS  31
#define BH_BIGINT_MASK  0x7FFFFFFF
#define BH_BIGINT_TYPE  bh_uint32_t
#define BH_BIGINT_TMP   bh_uint64_t
#else
#define BH_BIGINT_BITS  15
#define BH_BIGINT_MASK  0x7FFF
#define BH_BIGINT_TYPE  bh_uint16_t
#define BH_BIGINT_TMP   bh_uint32_t
#endif

struct bh_bigint_s
{
    BH_BIGINT_TYPE *data;
    size_t size;
    size_t capacity;
    int type;
    int error;
};

void bh_bigint_init(bh_bigint_t *bigint);
void bh_bigint_destroy(bh_bigint_t *bigint);

#endif /* BH_INTERNAL_BIGINT_H */