adjusted bigint code
This commit is contained in:
parent
0483f506f8
commit
eff0957fbb
12
configure
vendored
12
configure
vendored
@ -17522,6 +17522,18 @@ fi
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for ac_header in dlfcn.h
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_header_dlfcn_h" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_DLFCN_H 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ dnl check header files.
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h])
|
AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h])
|
||||||
AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h])
|
AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h])
|
||||||
|
AC_CHECK_HEADERS([dlfcn.h])
|
||||||
|
|
||||||
dnl check data types
|
dnl check data types
|
||||||
dnl AC_CHECK_TYPE([wchar_t],
|
dnl AC_CHECK_TYPE([wchar_t],
|
||||||
|
4013
lib/bigint.c
4013
lib/bigint.c
File diff suppressed because it is too large
Load Diff
@ -478,7 +478,6 @@ hcl_mod_data_t* hcl_openmod (hcl_t* hcl, const hcl_ooch_t* name, hcl_oow_t namel
|
|||||||
}
|
}
|
||||||
|
|
||||||
mdp = (hcl_mod_data_t*)HCL_RBT_VPTR(pair);
|
mdp = (hcl_mod_data_t*)HCL_RBT_VPTR(pair);
|
||||||
HCL_ASSERT (hcl, HCL_SIZEOF(mdp->mod.hints) == HCL_SIZEOF(int));
|
|
||||||
if (load(hcl, &mdp->mod) <= -1)
|
if (load(hcl, &mdp->mod) <= -1)
|
||||||
{
|
{
|
||||||
hcl_rbt_delete (&hcl->modtab, (hcl_ooch_t*)name, namelen);
|
hcl_rbt_delete (&hcl->modtab, (hcl_ooch_t*)name, namelen);
|
||||||
@ -543,7 +542,6 @@ hcl_mod_data_t* hcl_openmod (hcl_t* hcl, const hcl_ooch_t* name, hcl_oow_t namel
|
|||||||
}
|
}
|
||||||
|
|
||||||
mdp = (hcl_mod_data_t*)HCL_RBT_VPTR(pair);
|
mdp = (hcl_mod_data_t*)HCL_RBT_VPTR(pair);
|
||||||
HCL_ASSERT (hcl, HCL_SIZEOF(mdp->mod.hints) == HCL_SIZEOF(int));
|
|
||||||
if (load(hcl, &mdp->mod) <= -1)
|
if (load(hcl, &mdp->mod) <= -1)
|
||||||
{
|
{
|
||||||
const hcl_ooch_t* oldmsg = hcl_backuperrmsg (hcl);
|
const hcl_ooch_t* oldmsg = hcl_backuperrmsg (hcl);
|
||||||
|
13
lib/hcl.h
13
lib/hcl.h
@ -885,7 +885,6 @@ struct hcl_mod_t
|
|||||||
{
|
{
|
||||||
/* input */
|
/* input */
|
||||||
const hcl_ooch_t name[HCL_MOD_NAME_LEN_MAX + 1];
|
const hcl_ooch_t name[HCL_MOD_NAME_LEN_MAX + 1];
|
||||||
/*const*/ int hints; /* bitwised-ORed of hcl_mod_hint_t enumerators */
|
|
||||||
|
|
||||||
/* user-defined data */
|
/* user-defined data */
|
||||||
hcl_mod_query_t query;
|
hcl_mod_query_t query;
|
||||||
@ -1215,6 +1214,8 @@ enum
|
|||||||
HCL_BRAND_SYMBOL,
|
HCL_BRAND_SYMBOL,
|
||||||
HCL_BRAND_STRING,
|
HCL_BRAND_STRING,
|
||||||
HCL_BRAND_DIC,
|
HCL_BRAND_DIC,
|
||||||
|
HCL_BRAND_PBIGINT, /* positive big integer */
|
||||||
|
HCL_BRAND_NBIGINT, /* negative big integer */
|
||||||
|
|
||||||
HCL_BRAND_CFRAME,/* compiler frame */
|
HCL_BRAND_CFRAME,/* compiler frame */
|
||||||
HCL_BRAND_PRIM,
|
HCL_BRAND_PRIM,
|
||||||
@ -1265,6 +1266,9 @@ enum
|
|||||||
#define HCL_IS_ARRAY(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_ARRAY)
|
#define HCL_IS_ARRAY(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_ARRAY)
|
||||||
#define HCL_IS_DIC(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_DIC)
|
#define HCL_IS_DIC(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_DIC)
|
||||||
#define HCL_IS_PRIM(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_PRIM)
|
#define HCL_IS_PRIM(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_PRIM)
|
||||||
|
#define HCL_IS_PBIGINT(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_PBIGINT)
|
||||||
|
#define HCL_IS_NBIGINT(hcl,v) (HCL_OOP_IS_POINTER(v) && HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_NBIGINT)
|
||||||
|
#define HCL_IS_BIGINT(hcl,v) (HCL_OOP_IS_POINTER(v) && (HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_NBIGINT || HCL_OBJ_GET_FLAGS_BRAND(v) == HCL_BRAND_NBIGINT))
|
||||||
|
|
||||||
#define HCL_CONS_CAR(v) (((hcl_cons_t*)(v))->car)
|
#define HCL_CONS_CAR(v) (((hcl_cons_t*)(v))->car)
|
||||||
#define HCL_CONS_CDR(v) (((hcl_cons_t*)(v))->cdr)
|
#define HCL_CONS_CDR(v) (((hcl_cons_t*)(v))->cdr)
|
||||||
@ -1612,6 +1616,13 @@ HCL_EXPORT hcl_oop_t hcl_makeinteger (
|
|||||||
hcl_ooi_t v
|
hcl_ooi_t v
|
||||||
);
|
);
|
||||||
|
|
||||||
|
HCL_EXPORT hcl_oop_t hcl_makebigint (
|
||||||
|
hcl_t* hcl,
|
||||||
|
int brand,
|
||||||
|
const hcl_liw_t* ptr,
|
||||||
|
hcl_oow_t len
|
||||||
|
);
|
||||||
|
|
||||||
HCL_EXPORT hcl_oop_t hcl_makecons (
|
HCL_EXPORT hcl_oop_t hcl_makecons (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
hcl_oop_t car,
|
hcl_oop_t car,
|
||||||
|
19
lib/obj.c
19
lib/obj.c
@ -377,6 +377,25 @@ hcl_oop_t hcl_makeinteger (hcl_t* hcl, hcl_ooi_t v)
|
|||||||
return hcl_allocwordobj (hcl, HCL_BRAND_INTEGER, (hcl_oow_t*)&v, 1);
|
return hcl_allocwordobj (hcl, HCL_BRAND_INTEGER, (hcl_oow_t*)&v, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcl_oop_t hcl_makebigint (hcl_t* hcl, int brand, const hcl_liw_t* ptr, hcl_oow_t len)
|
||||||
|
{
|
||||||
|
hcl_oop_t oop;
|
||||||
|
|
||||||
|
HCL_ASSERT (hcl, brand == HCL_BRAND_PBIGINT || brand == HCL_BRAND_NBIGINT);
|
||||||
|
|
||||||
|
#if (HCL_LIW_BITS == HCL_OOW_BITS)
|
||||||
|
oop = hcl_allocwordobj (hcl, brand, ptr, len);
|
||||||
|
#elif (HCL_LIW_BITS == HCL_OOHW_BITS)
|
||||||
|
oop = hcl_allochalfwordobj (hcl, brand, ptr, len);
|
||||||
|
#else
|
||||||
|
# error UNSUPPORTED LIW BIT SIZE
|
||||||
|
#endif
|
||||||
|
if (!oop) return HCL_NULL;
|
||||||
|
|
||||||
|
HCL_OBJ_SET_FLAGS_BRAND (oop, brand);
|
||||||
|
return oop;
|
||||||
|
}
|
||||||
|
|
||||||
hcl_oop_t hcl_makecons (hcl_t* hcl, hcl_oop_t car, hcl_oop_t cdr)
|
hcl_oop_t hcl_makecons (hcl_t* hcl, hcl_oop_t car, hcl_oop_t cdr)
|
||||||
{
|
{
|
||||||
hcl_oop_cons_t cons;
|
hcl_oop_cons_t cons;
|
||||||
|
Loading…
Reference in New Issue
Block a user