Add big integer implementation
This commit is contained in:
31
include/bh/internal/bigint.h
Normal file
31
include/bh/internal/bigint.h
Normal file
@@ -0,0 +1,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 */
|
||||
Reference in New Issue
Block a user