int enif_get_ulong(ErlNifEnv* env, Eterm term, unsigned long* ip) { #if SIZEOF_LONG == ERTS_SIZEOF_ETERM return term_to_Uint(term, ip); #elif SIZEOF_LONG == 8 return term_to_Uint64(term, ip); #else # error Unknown long word size #endif }
Eterm erts_debug_make_unique_integer(Process *c_p, Eterm etval0, Eterm etval1) { Uint64 val0, val1; Uint hsz; Eterm res, *hp, *end_hp; if (!term_to_Uint64(etval0, &val0)) return THE_NON_VALUE; if (!term_to_Uint64(etval1, &val1)) return THE_NON_VALUE; bld_unique_integer_term(NULL, &hsz, val0, val1, 0); hp = HAlloc(c_p, hsz); end_hp = hp + hsz; res = bld_unique_integer_term(&hp, NULL, val0, val1, 0); if (hp != end_hp) ERTS_INTERNAL_ERROR("Heap allocation error"); return res; }
int erts_debug_set_unique_monotonic_integer_state(Eterm et_value) { Sint64 value; if (!term_to_Sint64(et_value, &value)) { Uint64 uvalue; if (!term_to_Uint64(et_value, &uvalue)) return 0; value = (Sint64) uvalue; } erts_atomic64_set_mb(&raw_unique_monotonic_integer.w.value, (erts_aint64_t) value); return 1; }
int enif_get_ulong(ErlNifEnv* env, Eterm term, unsigned long* ip) { #if SIZEOF_LONG == ERTS_SIZEOF_ETERM return term_to_Uint(term, ip); #elif SIZEOF_LONG == 8 return term_to_Uint64(term, ip); #elif SIZEOF_LONG == SIZEOF_INT int ret; unsigned int tmp; ret = enif_get_uint(env,term,&tmp); if (ret) { *ip = (unsigned long) tmp; } return ret; #else # error Unknown long word size #endif }
int enif_get_uint64(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifUInt64* ip) { return term_to_Uint64(term, ip); }